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
819 RL78 Options -msim -mmul=none -mmul=g13 -mmul=g14 -mallregs
820 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14
821 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts
822
823 RS/6000 and PowerPC Options -mcpu=cpu-type -mtune=cpu-type
824 -mcmodel=code-model -mpowerpc64 -maltivec -mno-altivec
825 -mpowerpc-gpopt -mno-powerpc-gpopt -mpowerpc-gfxopt
826 -mno-powerpc-gfxopt -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb
827 -mpopcntd -mno-popcntd -mfprnd -mno-fprnd -mcmpb -mno-cmpb
828 -mhard-dfp -mno-hard-dfp -mfull-toc -mminimal-toc
829 -mno-fp-in-toc -mno-sum-in-toc -m64 -m32 -mxl-compat
830 -mno-xl-compat -mpe -malign-power -malign-natural -msoft-float
831 -mhard-float -mmultiple -mno-multiple -mupdate -mno-update
832 -mavoid-indexed-addresses -mno-avoid-indexed-addresses
833 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align
834 -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
835 -mrelocatable-lib -mno-relocatable-lib -mtoc -mno-toc -mlittle
836 -mlittle-endian -mbig -mbig-endian -mdynamic-no-pic -mswdiv
837 -msingle-pic-base -mprioritize-restricted-insns=priority
838 -msched-costly-dep=dependence_type -minsert-sched-nops=scheme
839 -mcall-aixdesc -mcall-eabi -mcall-freebsd -mcall-linux
840 -mcall-netbsd -mcall-openbsd -mcall-sysv -mcall-sysv-eabi
841 -mcall-sysv-noeabi -mtraceback=traceback_type -maix-struct-return
842 -msvr4-struct-return -mabi=abi-type -msecure-plt -mbss-plt
843 -mlongcall -mno-longcall -mpltseq -mno-pltseq
844 -mblock-move-inline-limit=num -mblock-compare-inline-limit=num
845 -mblock-compare-inline-loop-limit=num -mno-block-ops-unaligned-vsx
846 -mstring-compare-inline-limit=num -misel -mno-isel -mvrsave
847 -mno-vrsave -mmulhw -mno-mulhw -mdlmzb -mno-dlmzb -mprototype
848 -mno-prototype -msim -mmvme -mads -myellowknife -memb -msdata
849 -msdata=opt -mreadonly-in-sdata -mvxworks -G num -mrecip
850 -mrecip=opt -mno-recip -mrecip-precision -mno-recip-precision
851 -mveclibabi=type -mfriz -mno-friz -mpointers-to-nested-functions
852 -mno-pointers-to-nested-functions -msave-toc-indirect
853 -mno-save-toc-indirect -mpower8-fusion -mno-mpower8-fusion
854 -mpower8-vector -mno-power8-vector -mcrypto -mno-crypto -mhtm
855 -mno-htm -mquad-memory -mno-quad-memory -mquad-memory-atomic
856 -mno-quad-memory-atomic -mcompat-align-parm -mno-compat-align-parm
857 -mfloat128 -mno-float128 -mfloat128-hardware
858 -mno-float128-hardware -mgnu-attribute -mno-gnu-attribute
859 -mstack-protector-guard=guard -mstack-protector-guard-reg=reg
860 -mstack-protector-guard-offset=offset -mprefixed -mno-prefixed
861 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
862 -mprivileged -mno-privileged
863
864 RX Options -m64bit-doubles -m32bit-doubles -fpu -nofpu -mcpu=
865 -mbig-endian-data -mlittle-endian-data -msmall-data -msim
866 -mno-sim -mas100-syntax -mno-as100-syntax -mrelax
867 -mmax-constant-size= -mint-register= -mpid -mallow-string-insns
868 -mno-allow-string-insns -mjsr -mno-warn-multiple-fast-interrupts
869 -msave-acc-in-interrupts
870
871 S/390 and zSeries Options -mtune=cpu-type -march=cpu-type
872 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp
873 -mlong-double-64 -mlong-double-128 -mbackchain -mno-backchain
874 -mpacked-stack -mno-packed-stack -msmall-exec -mno-small-exec
875 -mmvcle -mno-mvcle -m64 -m31 -mdebug -mno-debug -mesa -mzarch
876 -mhtm -mvx -mzvector -mtpf-trace -mno-tpf-trace
877 -mtpf-trace-skip -mno-tpf-trace-skip -mfused-madd -mno-fused-madd
878 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard
879 -mhotpatch=halfwords,halfwords
880
881 SH Options -m1 -m2 -m2e -m2a-nofpu -m2a-single-only -m2a-single
882 -m2a -m3 -m3e -m4-nofpu -m4-single-only -m4-single -m4
883 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al -mb -ml
884 -mdalign -mrelax -mbigtable -mfmovd -mrenesas -mno-renesas
885 -mnomacsave -mieee -mno-ieee -mbitops -misize
886 -minline-ic_invalidate -mpadstruct -mprefergot -musermode
887 -multcost=number -mdiv=strategy -mdivsi3_libfunc=name
888 -mfixed-range=register-range -maccumulate-outgoing-args
889 -matomic-model=atomic-model -mbranch-cost=num -mzdcbranch
890 -mno-zdcbranch -mcbranch-force-delay-slot -mfused-madd
891 -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra
892 -mpretend-cmove -mtas
893
894 Solaris 2 Options -mclear-hwcap -mno-clear-hwcap -mimpure-text
895 -mno-impure-text -pthreads
896
897 SPARC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model
898 -mmemory-model=mem-model -m32 -m64 -mapp-regs -mno-app-regs
899 -mfaster-structs -mno-faster-structs -mflat -mno-flat -mfpu
900 -mno-fpu -mhard-float -msoft-float -mhard-quad-float
901 -msoft-quad-float -mstack-bias -mno-stack-bias -mstd-struct-return
902 -mno-std-struct-return -munaligned-doubles -mno-unaligned-doubles
903 -muser-mode -mno-user-mode -mv8plus -mno-v8plus -mvis -mno-vis
904 -mvis2 -mno-vis2 -mvis3 -mno-vis3 -mvis4 -mno-vis4 -mvis4b
905 -mno-vis4b -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld
906 -mno-fsmuld -mpopc -mno-popc -msubxc -mno-subxc -mfix-at697f
907 -mfix-ut699 -mfix-ut700 -mfix-gr712rc -mlra -mno-lra
908
909 System V Options -Qy -Qn -YP,paths -Ym,dir
910
911 V850 Options -mlong-calls -mno-long-calls -mep -mno-ep
912 -mprolog-function -mno-prolog-function -mspace -mtda=n -msda=n
913 -mzda=n -mapp-regs -mno-app-regs -mdisable-callt
914 -mno-disable-callt -mv850e2v3 -mv850e2 -mv850e1 -mv850es -mv850e
915 -mv850 -mv850e3v5 -mloop -mrelax -mlong-jumps -msoft-float
916 -mhard-float -mgcc-abi -mrh850-abi -mbig-switch
917
918 VAX Options -mg -mgnu -munix -mlra
919
920 Visium Options -mdebug -msim -mfpu -mno-fpu -mhard-float
921 -msoft-float -mcpu=cpu-type -mtune=cpu-type -msv-mode
922 -muser-mode
923
924 VMS Options -mvms-return-codes -mdebug-main=prefix -mmalloc64
925 -mpointer-size=size
926
927 VxWorks Options -mrtp -non-static -Bstatic -Bdynamic -Xbind-lazy
928 -Xbind-now
929
930 x86 Options -mtune=cpu-type -march=cpu-type -mtune-ctrl=feature-
931 list -mdump-tune-features -mno-default -mfpmath=unit
932 -masm=dialect -mno-fancy-math-387 -mno-fp-ret-in-387 -m80387
933 -mhard-float -msoft-float -mno-wide-multiply -mrtd
934 -malign-double -mpreferred-stack-boundary=num
935 -mincoming-stack-boundary=num -mcld -mcx16 -msahf -mmovbe
936 -mcrc32 -mmwait -mrecip -mrecip=opt -mvzeroupper -mprefer-avx128
937 -mprefer-vector-width=opt -mmove-max=bits -mstore-max=bits -mmmx
938 -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx
939 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl
940 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes
941 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd
942 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves
943 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4
944 -mxop -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm
945 -mhle -mlwp -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes
946 -mwaitpkg -mshstk -mmanual-endbr -mcet-switch -mforce-indirect-call
947 -mavx512vbmi2 -mavx512bf16 -menqcmd -mvpclmulqdq -mavx512bitalg
948 -mmovdiri -mmovdir64b -mavx512vpopcntdq -mavx5124fmaps
949 -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid -mrdseed -msgx
950 -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8
951 -mamx-bf16 -muintr -mhreset -mavxvnni -mavx512fp16 -mavxifma
952 -mavxvnniint8 -mavxneconvert -mcmpccxadd -mamx-fp16 -mprefetchi
953 -mraoint -mamx-complex -mcldemote -mms-bitfields
954 -mno-align-stringops -minline-all-stringops
955 -minline-stringops-dynamically -mstringop-strategy=alg -mkl
956 -mwidekl -mmemcpy-strategy=strategy -mmemset-strategy=strategy
957 -mpush-args -maccumulate-outgoing-args -m128bit-long-double
958 -m96bit-long-double -mlong-double-64 -mlong-double-80
959 -mlong-double-128 -mregparm=num -msseregparm -mveclibabi=type
960 -mvect8-ret-in-mem -mpc32 -mpc64 -mpc80 -mdaz-ftz -mstackrealign
961 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs
962 -mcmodel=code-model -mabi=name -maddress-mode=mode -m32 -m64
963 -mx32 -m16 -miamcu -mlarge-data-threshold=num -msse2avx
964 -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv
965 -minstrument-return=type -mfentry-name=name -mfentry-section=name
966 -mavx256-split-unaligned-load -mavx256-split-unaligned-store
967 -malign-data=type -mstack-protector-guard=guard
968 -mstack-protector-guard-reg=reg
969 -mstack-protector-guard-offset=offset
970 -mstack-protector-guard-symbol=symbol -mgeneral-regs-only
971 -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop
972 -mindirect-branch=choice -mfunction-return=choice
973 -mindirect-branch-register -mharden-sls=choice
974 -mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access
975 -munroll-only-small-loops -mlam=choice
976
977 x86 Windows Options -mconsole -mcygwin -mno-cygwin -mdll
978 -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows
979 -fno-set-stack-executable
980
981 Xstormy16 Options -msim
982
983 Xtensa Options -mconst16 -mno-const16 -mfused-madd
984 -mno-fused-madd -mforce-no-pic -mserialize-volatile
985 -mno-serialize-volatile -mtext-section-literals
986 -mno-text-section-literals -mauto-litpools -mno-auto-litpools
987 -mtarget-align -mno-target-align -mlongcalls -mno-longcalls
988 -mabi=abi-type -mextra-l32r-costs=cycles
989
990 zSeries Options See S/390 and zSeries Options.
991
992 Options Controlling the Kind of Output
993 Compilation can involve up to four stages: preprocessing, compilation
994 proper, assembly and linking, always in that order. GCC is capable of
995 preprocessing and compiling several files either into several assembler
996 input files, or into one assembler input file; then each assembler
997 input file produces an object file, and linking combines all the object
998 files (those newly compiled, and those specified as input) into an
999 executable file.
1000
1001 For any given input file, the file name suffix determines what kind of
1002 compilation is done:
1003
1004 file.c
1005 C source code that must be preprocessed.
1006
1007 file.i
1008 C source code that should not be preprocessed.
1009
1010 file.ii
1011 C++ source code that should not be preprocessed.
1012
1013 file.m
1014 Objective-C source code. Note that you must link with the libobjc
1015 library to make an Objective-C program work.
1016
1017 file.mi
1018 Objective-C source code that should not be preprocessed.
1019
1020 file.mm
1021 file.M
1022 Objective-C++ source code. Note that you must link with the
1023 libobjc library to make an Objective-C++ program work. Note that
1024 .M refers to a literal capital M.
1025
1026 file.mii
1027 Objective-C++ source code that should not be preprocessed.
1028
1029 file.h
1030 C, C++, Objective-C or Objective-C++ header file to be turned into
1031 a precompiled header (default), or C, C++ header file to be turned
1032 into an Ada spec (via the -fdump-ada-spec switch).
1033
1034 file.cc
1035 file.cp
1036 file.cxx
1037 file.cpp
1038 file.CPP
1039 file.c++
1040 file.C
1041 C++ source code that must be preprocessed. Note that in .cxx, the
1042 last two letters must both be literally x. Likewise, .C refers to
1043 a literal capital C.
1044
1045 file.mm
1046 file.M
1047 Objective-C++ source code that must be preprocessed.
1048
1049 file.mii
1050 Objective-C++ source code that should not be preprocessed.
1051
1052 file.hh
1053 file.H
1054 file.hp
1055 file.hxx
1056 file.hpp
1057 file.HPP
1058 file.h++
1059 file.tcc
1060 C++ header file to be turned into a precompiled header or Ada spec.
1061
1062 file.f
1063 file.for
1064 file.ftn
1065 Fixed form Fortran source code that should not be preprocessed.
1066
1067 file.F
1068 file.FOR
1069 file.fpp
1070 file.FPP
1071 file.FTN
1072 Fixed form Fortran source code that must be preprocessed (with the
1073 traditional preprocessor).
1074
1075 file.f90
1076 file.f95
1077 file.f03
1078 file.f08
1079 Free form Fortran source code that should not be preprocessed.
1080
1081 file.F90
1082 file.F95
1083 file.F03
1084 file.F08
1085 Free form Fortran source code that must be preprocessed (with the
1086 traditional preprocessor).
1087
1088 file.go
1089 Go source code.
1090
1091 file.d
1092 D source code.
1093
1094 file.di
1095 D interface file.
1096
1097 file.dd
1098 D documentation code (Ddoc).
1099
1100 file.ads
1101 Ada source code file that contains a library unit declaration (a
1102 declaration of a package, subprogram, or generic, or a generic
1103 instantiation), or a library unit renaming declaration (a package,
1104 generic, or subprogram renaming declaration). Such files are also
1105 called specs.
1106
1107 file.adb
1108 Ada source code file containing a library unit body (a subprogram
1109 or package body). Such files are also called bodies.
1110
1111 file.s
1112 Assembler code.
1113
1114 file.S
1115 file.sx
1116 Assembler code that must be preprocessed.
1117
1118 other
1119 An object file to be fed straight into linking. Any file name with
1120 no recognized suffix is treated this way.
1121
1122 You can specify the input language explicitly with the -x option:
1123
1124 -x language
1125 Specify explicitly the language for the following input files
1126 (rather than letting the compiler choose a default based on the
1127 file name suffix). This option applies to all following input
1128 files until the next -x option. Possible values for language are:
1129
1130 c c-header cpp-output
1131 c++ c++-header c++-system-header c++-user-header c++-cpp-output
1132 objective-c objective-c-header objective-c-cpp-output
1133 objective-c++ objective-c++-header objective-c++-cpp-output
1134 assembler assembler-with-cpp
1135 ada
1136 d
1137 f77 f77-cpp-input f95 f95-cpp-input
1138 go
1139
1140 -x none
1141 Turn off any specification of a language, so that subsequent files
1142 are handled according to their file name suffixes (as they are if
1143 -x has not been used at all).
1144
1145 If you only want some of the stages of compilation, you can use -x (or
1146 filename suffixes) to tell gcc where to start, and one of the options
1147 -c, -S, or -E to say where gcc is to stop. Note that some combinations
1148 (for example, -x cpp-output -E) instruct gcc to do nothing at all.
1149
1150 -c Compile or assemble the source files, but do not link. The linking
1151 stage simply is not done. The ultimate output is in the form of an
1152 object file for each source file.
1153
1154 By default, the object file name for a source file is made by
1155 replacing the suffix .c, .i, .s, etc., with .o.
1156
1157 Unrecognized input files, not requiring compilation or assembly,
1158 are ignored.
1159
1160 -S Stop after the stage of compilation proper; do not assemble. The
1161 output is in the form of an assembler code file for each non-
1162 assembler input file specified.
1163
1164 By default, the assembler file name for a source file is made by
1165 replacing the suffix .c, .i, etc., with .s.
1166
1167 Input files that don't require compilation are ignored.
1168
1169 -E Stop after the preprocessing stage; do not run the compiler proper.
1170 The output is in the form of preprocessed source code, which is
1171 sent to the standard output.
1172
1173 Input files that don't require preprocessing are ignored.
1174
1175 -o file
1176 Place the primary output in file file. This applies to whatever
1177 sort of output is being produced, whether it be an executable file,
1178 an object file, an assembler file or preprocessed C code.
1179
1180 If -o is not specified, the default is to put an executable file in
1181 a.out, the object file for source.suffix in source.o, its assembler
1182 file in source.s, a precompiled header file in source.suffix.gch,
1183 and all preprocessed C source on standard output.
1184
1185 Though -o names only the primary output, it also affects the naming
1186 of auxiliary and dump outputs. See the examples below. Unless
1187 overridden, both auxiliary outputs and dump outputs are placed in
1188 the same directory as the primary output. In auxiliary outputs,
1189 the suffix of the input file is replaced with that of the auxiliary
1190 output file type; in dump outputs, the suffix of the dump file is
1191 appended to the input file suffix. In compilation commands, the
1192 base name of both auxiliary and dump outputs is that of the primary
1193 output; in compile and link commands, the primary output name,
1194 minus the executable suffix, is combined with the input file name.
1195 If both share the same base name, disregarding the suffix, the
1196 result of the combination is that base name, otherwise, they are
1197 concatenated, separated by a dash.
1198
1199 gcc -c foo.c ...
1200
1201 will use foo.o as the primary output, and place aux outputs and
1202 dumps next to it, e.g., aux file foo.dwo for -gsplit-dwarf, and
1203 dump file foo.c.???r.final for -fdump-rtl-final.
1204
1205 If a non-linker output file is explicitly specified, aux and dump
1206 files by default take the same base name:
1207
1208 gcc -c foo.c -o dir/foobar.o ...
1209
1210 will name aux outputs dir/foobar.* and dump outputs dir/foobar.c.*.
1211
1212 A linker output will instead prefix aux and dump outputs:
1213
1214 gcc foo.c bar.c -o dir/foobar ...
1215
1216 will generally name aux outputs dir/foobar-foo.* and
1217 dir/foobar-bar.*, and dump outputs dir/foobar-foo.c.* and
1218 dir/foobar-bar.c.*.
1219
1220 The one exception to the above is when the executable shares the
1221 base name with the single input:
1222
1223 gcc foo.c -o dir/foo ...
1224
1225 in which case aux outputs are named dir/foo.* and dump outputs
1226 named dir/foo.c.*.
1227
1228 The location and the names of auxiliary and dump outputs can be
1229 adjusted by the options -dumpbase, -dumpbase-ext, -dumpdir,
1230 -save-temps=cwd, and -save-temps=obj.
1231
1232 -dumpbase dumpbase
1233 This option sets the base name for auxiliary and dump output files.
1234 It does not affect the name of the primary output file.
1235 Intermediate outputs, when preserved, are not regarded as primary
1236 outputs, but as auxiliary outputs:
1237
1238 gcc -save-temps -S foo.c
1239
1240 saves the (no longer) temporary preprocessed file in foo.i, and
1241 then compiles to the (implied) output file foo.s, whereas:
1242
1243 gcc -save-temps -dumpbase save-foo -c foo.c
1244
1245 preprocesses to in save-foo.i, compiles to save-foo.s (now an
1246 intermediate, thus auxiliary output), and then assembles to the
1247 (implied) output file foo.o.
1248
1249 Absent this option, dump and aux files take their names from the
1250 input file, or from the (non-linker) output file, if one is
1251 explicitly specified: dump output files (e.g. those requested by
1252 -fdump-* options) with the input name suffix, and aux output files
1253 (those requested by other non-dump options, e.g. "-save-temps",
1254 "-gsplit-dwarf", "-fcallgraph-info") without it.
1255
1256 Similar suffix differentiation of dump and aux outputs can be
1257 attained for explicitly-given -dumpbase basename.suf by also
1258 specifying -dumpbase-ext .suf.
1259
1260 If dumpbase is explicitly specified with any directory component,
1261 any dumppfx specification (e.g. -dumpdir or -save-temps=*) is
1262 ignored, and instead of appending to it, dumpbase fully overrides
1263 it:
1264
1265 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1266 -dumpdir pfx- -save-temps=cwd ...
1267
1268 creates auxiliary and dump outputs named alt/foo.*, disregarding
1269 dir/ in -o, the ./ prefix implied by -save-temps=cwd, and pfx- in
1270 -dumpdir.
1271
1272 When -dumpbase is specified in a command that compiles multiple
1273 inputs, or that compiles and then links, it may be combined with
1274 dumppfx, as specified under -dumpdir. Then, each input file is
1275 compiled using the combined dumppfx, and default values for
1276 dumpbase and auxdropsuf are computed for each input file:
1277
1278 gcc foo.c bar.c -c -dumpbase main ...
1279
1280 creates foo.o and bar.o as primary outputs, and avoids overwriting
1281 the auxiliary and dump outputs by using the dumpbase as a prefix,
1282 creating auxiliary and dump outputs named main-foo.* and
1283 main-bar.*.
1284
1285 An empty string specified as dumpbase avoids the influence of the
1286 output basename in the naming of auxiliary and dump outputs during
1287 compilation, computing default values :
1288
1289 gcc -c foo.c -o dir/foobar.o -dumpbase " ...
1290
1291 will name aux outputs dir/foo.* and dump outputs dir/foo.c.*. Note
1292 how their basenames are taken from the input name, but the
1293 directory still defaults to that of the output.
1294
1295 The empty-string dumpbase does not prevent the use of the output
1296 basename for outputs during linking:
1297
1298 gcc foo.c bar.c -o dir/foobar -dumpbase " -flto ...
1299
1300 The compilation of the source files will name auxiliary outputs
1301 dir/foo.* and dir/bar.*, and dump outputs dir/foo.c.* and
1302 dir/bar.c.*. LTO recompilation during linking will use dir/foobar.
1303 as the prefix for dumps and auxiliary files.
1304
1305 -dumpbase-ext auxdropsuf
1306 When forming the name of an auxiliary (but not a dump) output file,
1307 drop trailing auxdropsuf from dumpbase before appending any
1308 suffixes. If not specified, this option defaults to the suffix of
1309 a default dumpbase, i.e., the suffix of the input file when
1310 -dumpbase is not present in the command line, or dumpbase is
1311 combined with dumppfx.
1312
1313 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1314
1315 creates dir/foo.o as the main output, and generates auxiliary
1316 outputs in dir/x-foo.*, taking the location of the primary output,
1317 and dropping the .c suffix from the dumpbase. Dump outputs retain
1318 the suffix: dir/x-foo.c.*.
1319
1320 This option is disregarded if it does not match the suffix of a
1321 specified dumpbase, except as an alternative to the executable
1322 suffix when appending the linker output base name to dumppfx, as
1323 specified below:
1324
1325 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1326
1327 creates main.out as the primary output, and avoids overwriting the
1328 auxiliary and dump outputs by using the executable name minus
1329 auxdropsuf as a prefix, creating auxiliary outputs named main-foo.*
1330 and main-bar.* and dump outputs named main-foo.c.* and
1331 main-bar.c.*.
1332
1333 -dumpdir dumppfx
1334 When forming the name of an auxiliary or dump output file, use
1335 dumppfx as a prefix:
1336
1337 gcc -dumpdir pfx- -c foo.c ...
1338
1339 creates foo.o as the primary output, and auxiliary outputs named
1340 pfx-foo.*, combining the given dumppfx with the default dumpbase
1341 derived from the default primary output, derived in turn from the
1342 input name. Dump outputs also take the input name suffix:
1343 pfx-foo.c.*.
1344
1345 If dumppfx is to be used as a directory name, it must end with a
1346 directory separator:
1347
1348 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1349
1350 creates obj/bar.o as the primary output, and auxiliary outputs
1351 named dir/bar.*, combining the given dumppfx with the default
1352 dumpbase derived from the primary output name. Dump outputs also
1353 take the input name suffix: dir/bar.c.*.
1354
1355 It defaults to the location of the output file, unless the output
1356 file is a special file like "/dev/null". Options -save-temps=cwd
1357 and -save-temps=obj override this default, just like an explicit
1358 -dumpdir option. In case multiple such options are given, the last
1359 one prevails:
1360
1361 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1362
1363 outputs foo.o, with auxiliary outputs named foo.* because
1364 -save-temps=* overrides the dumppfx given by the earlier -dumpdir
1365 option. It does not matter that =obj is the default for
1366 -save-temps, nor that the output directory is implicitly the
1367 current directory. Dump outputs are named foo.c.*.
1368
1369 When compiling from multiple input files, if -dumpbase is
1370 specified, dumpbase, minus a auxdropsuf suffix, and a dash are
1371 appended to (or override, if containing any directory components)
1372 an explicit or defaulted dumppfx, so that each of the multiple
1373 compilations gets differently-named aux and dump outputs.
1374
1375 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1376
1377 outputs auxiliary dumps to dir/pfx-main-foo.* and
1378 dir/pfx-main-bar.*, appending dumpbase- to dumppfx. Dump outputs
1379 retain the input file suffix: dir/pfx-main-foo.c.* and
1380 dir/pfx-main-bar.c.*, respectively. Contrast with the single-input
1381 compilation:
1382
1383 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1384
1385 that, applying -dumpbase to a single source, does not compute and
1386 append a separate dumpbase per input file. Its auxiliary and dump
1387 outputs go in dir/pfx-main.*.
1388
1389 When compiling and then linking from multiple input files, a
1390 defaulted or explicitly specified dumppfx also undergoes the
1391 dumpbase- transformation above (e.g. the compilation of foo.c and
1392 bar.c above, but without -c). If neither -dumpdir nor -dumpbase
1393 are given, the linker output base name, minus auxdropsuf, if
1394 specified, or the executable suffix otherwise, plus a dash is
1395 appended to the default dumppfx instead. Note, however, that
1396 unlike earlier cases of linking:
1397
1398 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1399
1400 does not append the output name main to dumppfx, because -dumpdir
1401 is explicitly specified. The goal is that the explicitly-specified
1402 dumppfx may contain the specified output name as part of the
1403 prefix, if desired; only an explicitly-specified -dumpbase would be
1404 combined with it, in order to avoid simply discarding a meaningful
1405 option.
1406
1407 When compiling and then linking from a single input file, the
1408 linker output base name will only be appended to the default
1409 dumppfx as above if it does not share the base name with the single
1410 input file name. This has been covered in single-input linking
1411 cases above, but not with an explicit -dumpdir that inhibits the
1412 combination, even if overridden by -save-temps=*:
1413
1414 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1415
1416 Auxiliary outputs are named foo.*, and dump outputs foo.c.*, in the
1417 current working directory as ultimately requested by
1418 -save-temps=cwd.
1419
1420 Summing it all up for an intuitive though slightly imprecise data
1421 flow: the primary output name is broken into a directory part and a
1422 basename part; dumppfx is set to the former, unless overridden by
1423 -dumpdir or -save-temps=*, and dumpbase is set to the latter,
1424 unless overriden by -dumpbase. If there are multiple inputs or
1425 linking, this dumpbase may be combined with dumppfx and taken from
1426 each input file. Auxiliary output names for each input are formed
1427 by combining dumppfx, dumpbase minus suffix, and the auxiliary
1428 output suffix; dump output names are only different in that the
1429 suffix from dumpbase is retained.
1430
1431 When it comes to auxiliary and dump outputs created during LTO
1432 recompilation, a combination of dumppfx and dumpbase, as given or
1433 as derived from the linker output name but not from inputs, even in
1434 cases in which this combination would not otherwise be used as
1435 such, is passed down with a trailing period replacing the compiler-
1436 added dash, if any, as a -dumpdir option to lto-wrapper; being
1437 involved in linking, this program does not normally get any
1438 -dumpbase and -dumpbase-ext, and it ignores them.
1439
1440 When running sub-compilers, lto-wrapper appends LTO stage names to
1441 the received dumppfx, ensures it contains a directory component so
1442 that it overrides any -dumpdir, and passes that as -dumpbase to
1443 sub-compilers.
1444
1445 -v Print (on standard error output) the commands executed to run the
1446 stages of compilation. Also print the version number of the
1447 compiler driver program and of the preprocessor and the compiler
1448 proper.
1449
1450 -###
1451 Like -v except the commands are not executed and arguments are
1452 quoted unless they contain only alphanumeric characters or "./-_".
1453 This is useful for shell scripts to capture the driver-generated
1454 command lines.
1455
1456 --help
1457 Print (on the standard output) a description of the command-line
1458 options understood by gcc. If the -v option is also specified then
1459 --help is also passed on to the various processes invoked by gcc,
1460 so that they can display the command-line options they accept. If
1461 the -Wextra option has also been specified (prior to the --help
1462 option), then command-line options that have no documentation
1463 associated with them are also displayed.
1464
1465 --target-help
1466 Print (on the standard output) a description of target-specific
1467 command-line options for each tool. For some targets extra target-
1468 specific information may also be printed.
1469
1470 --help={class|[^]qualifier}[,...]
1471 Print (on the standard output) a description of the command-line
1472 options understood by the compiler that fit into all specified
1473 classes and qualifiers. These are the supported classes:
1474
1475 optimizers
1476 Display all of the optimization options supported by the
1477 compiler.
1478
1479 warnings
1480 Display all of the options controlling warning messages
1481 produced by the compiler.
1482
1483 target
1484 Display target-specific options. Unlike the --target-help
1485 option however, target-specific options of the linker and
1486 assembler are not displayed. This is because those tools do
1487 not currently support the extended --help= syntax.
1488
1489 params
1490 Display the values recognized by the --param option.
1491
1492 language
1493 Display the options supported for language, where language is
1494 the name of one of the languages supported in this version of
1495 GCC. If an option is supported by all languages, one needs to
1496 select common class.
1497
1498 common
1499 Display the options that are common to all languages.
1500
1501 These are the supported qualifiers:
1502
1503 undocumented
1504 Display only those options that are undocumented.
1505
1506 joined
1507 Display options taking an argument that appears after an equal
1508 sign in the same continuous piece of text, such as:
1509 --help=target.
1510
1511 separate
1512 Display options taking an argument that appears as a separate
1513 word following the original option, such as: -o output-file.
1514
1515 Thus for example to display all the undocumented target-specific
1516 switches supported by the compiler, use:
1517
1518 --help=target,undocumented
1519
1520 The sense of a qualifier can be inverted by prefixing it with the ^
1521 character, so for example to display all binary warning options
1522 (i.e., ones that are either on or off and that do not take an
1523 argument) that have a description, use:
1524
1525 --help=warnings,^joined,^undocumented
1526
1527 The argument to --help= should not consist solely of inverted
1528 qualifiers.
1529
1530 Combining several classes is possible, although this usually
1531 restricts the output so much that there is nothing to display. One
1532 case where it does work, however, is when one of the classes is
1533 target. For example, to display all the target-specific
1534 optimization options, use:
1535
1536 --help=target,optimizers
1537
1538 The --help= option can be repeated on the command line. Each
1539 successive use displays its requested class of options, skipping
1540 those that have already been displayed. If --help is also
1541 specified anywhere on the command line then this takes precedence
1542 over any --help= option.
1543
1544 If the -Q option appears on the command line before the --help=
1545 option, then the descriptive text displayed by --help= is changed.
1546 Instead of describing the displayed options, an indication is given
1547 as to whether the option is enabled, disabled or set to a specific
1548 value (assuming that the compiler knows this at the point where the
1549 --help= option is used).
1550
1551 Here is a truncated example from the ARM port of gcc:
1552
1553 % gcc -Q -mabi=2 --help=target -c
1554 The following options are target specific:
1555 -mabi= 2
1556 -mabort-on-noreturn [disabled]
1557 -mapcs [disabled]
1558
1559 The output is sensitive to the effects of previous command-line
1560 options, so for example it is possible to find out which
1561 optimizations are enabled at -O2 by using:
1562
1563 -Q -O2 --help=optimizers
1564
1565 Alternatively you can discover which binary optimizations are
1566 enabled by -O3 by using:
1567
1568 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1569 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1570 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1571
1572 --version
1573 Display the version number and copyrights of the invoked GCC.
1574
1575 -pass-exit-codes
1576 Normally the gcc program exits with the code of 1 if any phase of
1577 the compiler returns a non-success return code. If you specify
1578 -pass-exit-codes, the gcc program instead returns with the
1579 numerically highest error produced by any phase returning an error
1580 indication. The C, C++, and Fortran front ends return 4 if an
1581 internal compiler error is encountered.
1582
1583 -pipe
1584 Use pipes rather than temporary files for communication between the
1585 various stages of compilation. This fails to work on some systems
1586 where the assembler is unable to read from a pipe; but the GNU
1587 assembler has no trouble.
1588
1589 -specs=file
1590 Process file after the compiler reads in the standard specs file,
1591 in order to override the defaults which the gcc driver program uses
1592 when determining what switches to pass to cc1, cc1plus, as, ld,
1593 etc. More than one -specs=file can be specified on the command
1594 line, and they are processed in order, from left to right.
1595
1596 -wrapper
1597 Invoke all subcommands under a wrapper program. The name of the
1598 wrapper program and its parameters are passed as a comma separated
1599 list.
1600
1601 gcc -c t.c -wrapper gdb,--args
1602
1603 This invokes all subprograms of gcc under gdb --args, thus the
1604 invocation of cc1 is gdb --args cc1 ....
1605
1606 -ffile-prefix-map=old=new
1607 When compiling files residing in directory old, record any
1608 references to them in the result of the compilation as if the files
1609 resided in directory new instead. Specifying this option is
1610 equivalent to specifying all the individual -f*-prefix-map options.
1611 This can be used to make reproducible builds that are location
1612 independent. Directories referenced by directives are not affected
1613 by these options. See also -fmacro-prefix-map, -fdebug-prefix-map,
1614 -fprofile-prefix-map and -fcanon-prefix-map.
1615
1616 -fcanon-prefix-map
1617 For the -f*-prefix-map options normally comparison of old prefix
1618 against the filename that would be normally referenced in the
1619 result of the compilation is done using textual comparison of the
1620 prefixes, or ignoring character case for case insensitive
1621 filesystems and considering slashes and backslashes as equal on DOS
1622 based filesystems. The -fcanon-prefix-map causes such comparisons
1623 to be done on canonicalized paths of old and the referenced
1624 filename.
1625
1626 -fplugin=name.so
1627 Load the plugin code in file name.so, assumed to be a shared object
1628 to be dlopen'd by the compiler. The base name of the shared object
1629 file is used to identify the plugin for the purposes of argument
1630 parsing (See -fplugin-arg-name-key=value below). Each plugin
1631 should define the callback functions specified in the Plugins API.
1632
1633 -fplugin-arg-name-key=value
1634 Define an argument called key with a value of value for the plugin
1635 called name.
1636
1637 -fdump-ada-spec[-slim]
1638 For C and C++ source and include files, generate corresponding Ada
1639 specs.
1640
1641 -fada-spec-parent=unit
1642 In conjunction with -fdump-ada-spec[-slim] above, generate Ada
1643 specs as child units of parent unit.
1644
1645 -fdump-go-spec=file
1646 For input files in any language, generate corresponding Go
1647 declarations in file. This generates Go "const", "type", "var",
1648 and "func" declarations which may be a useful way to start writing
1649 a Go interface to code written in some other language.
1650
1651 @file
1652 Read command-line options from file. The options read are inserted
1653 in place of the original @file option. If file does not exist, or
1654 cannot be read, then the option will be treated literally, and not
1655 removed.
1656
1657 Options in file are separated by whitespace. A whitespace
1658 character may be included in an option by surrounding the entire
1659 option in either single or double quotes. Any character (including
1660 a backslash) may be included by prefixing the character to be
1661 included with a backslash. The file may itself contain additional
1662 @file options; any such options will be processed recursively.
1663
1664 Compiling C++ Programs
1665 C++ source files conventionally use one of the suffixes .C, .cc, .cpp,
1666 .CPP, .c++, .cp, or .cxx; C++ header files often use .hh, .hpp, .H, or
1667 (for shared template code) .tcc; and preprocessed C++ files use the
1668 suffix .ii. GCC recognizes files with these names and compiles them as
1669 C++ programs even if you call the compiler the same way as for
1670 compiling C programs (usually with the name gcc).
1671
1672 However, the use of gcc does not add the C++ library. g++ is a program
1673 that calls GCC and automatically specifies linking against the C++
1674 library. It treats .c, .h and .i files as C++ source files instead of
1675 C source files unless -x is used. This program is also useful when
1676 precompiling a C header file with a .h extension for use in C++
1677 compilations. On many systems, g++ is also installed with the name
1678 c++.
1679
1680 When you compile C++ programs, you may specify many of the same
1681 command-line options that you use for compiling programs in any
1682 language; or command-line options meaningful for C and related
1683 languages; or options that are meaningful only for C++ programs.
1684
1685 Options Controlling C Dialect
1686 The following options control the dialect of C (or languages derived
1687 from C, such as C++, Objective-C and Objective-C++) that the compiler
1688 accepts:
1689
1690 -ansi
1691 In C mode, this is equivalent to -std=c90. In C++ mode, it is
1692 equivalent to -std=c++98.
1693
1694 This turns off certain features of GCC that are incompatible with
1695 ISO C90 (when compiling C code), or of standard C++ (when compiling
1696 C++ code), such as the "asm" and "typeof" keywords, and predefined
1697 macros such as "unix" and "vax" that identify the type of system
1698 you are using. It also enables the undesirable and rarely used ISO
1699 trigraph feature. For the C compiler, it disables recognition of
1700 C++ style // comments as well as the "inline" keyword.
1701
1702 The alternate keywords "__asm__", "__extension__", "__inline__" and
1703 "__typeof__" continue to work despite -ansi. You would not want to
1704 use them in an ISO C program, of course, but it is useful to put
1705 them in header files that might be included in compilations done
1706 with -ansi. Alternate predefined macros such as "__unix__" and
1707 "__vax__" are also available, with or without -ansi.
1708
1709 The -ansi option does not cause non-ISO programs to be rejected
1710 gratuitously. For that, -Wpedantic is required in addition to
1711 -ansi.
1712
1713 The macro "__STRICT_ANSI__" is predefined when the -ansi option is
1714 used. Some header files may notice this macro and refrain from
1715 declaring certain functions or defining certain macros that the ISO
1716 standard doesn't call for; this is to avoid interfering with any
1717 programs that might use these names for other things.
1718
1719 Functions that are normally built in but do not have semantics
1720 defined by ISO C (such as "alloca" and "ffs") are not built-in
1721 functions when -ansi is used.
1722
1723 -std=
1724 Determine the language standard. This option is currently only
1725 supported when compiling C or C++.
1726
1727 The compiler can accept several base standards, such as c90 or
1728 c++98, and GNU dialects of those standards, such as gnu90 or
1729 gnu++98. When a base standard is specified, the compiler accepts
1730 all programs following that standard plus those using GNU
1731 extensions that do not contradict it. For example, -std=c90 turns
1732 off certain features of GCC that are incompatible with ISO C90,
1733 such as the "asm" and "typeof" keywords, but not other GNU
1734 extensions that do not have a meaning in ISO C90, such as omitting
1735 the middle term of a "?:" expression. On the other hand, when a GNU
1736 dialect of a standard is specified, all features supported by the
1737 compiler are enabled, even when those features change the meaning
1738 of the base standard. As a result, some strict-conforming programs
1739 may be rejected. The particular standard is used by -Wpedantic to
1740 identify which features are GNU extensions given that version of
1741 the standard. For example -std=gnu90 -Wpedantic warns about C++
1742 style // comments, while -std=gnu99 -Wpedantic does not.
1743
1744 A value for this option must be provided; possible values are
1745
1746 c90
1747 c89
1748 iso9899:1990
1749 Support all ISO C90 programs (certain GNU extensions that
1750 conflict with ISO C90 are disabled). Same as -ansi for C code.
1751
1752 iso9899:199409
1753 ISO C90 as modified in amendment 1.
1754
1755 c99
1756 c9x
1757 iso9899:1999
1758 iso9899:199x
1759 ISO C99. This standard is substantially completely supported,
1760 modulo bugs and floating-point issues (mainly but not entirely
1761 relating to optional C99 features from Annexes F and G). See
1762 <https://gcc.gnu.org/c99status.html> for more information. The
1763 names c9x and iso9899:199x are deprecated.
1764
1765 c11
1766 c1x
1767 iso9899:2011
1768 ISO C11, the 2011 revision of the ISO C standard. This
1769 standard is substantially completely supported, modulo bugs,
1770 floating-point issues (mainly but not entirely relating to
1771 optional C11 features from Annexes F and G) and the optional
1772 Annexes K (Bounds-checking interfaces) and L (Analyzability).
1773 The name c1x is deprecated.
1774
1775 c17
1776 c18
1777 iso9899:2017
1778 iso9899:2018
1779 ISO C17, the 2017 revision of the ISO C standard (published in
1780 2018). This standard is same as C11 except for corrections of
1781 defects (all of which are also applied with -std=c11) and a new
1782 value of "__STDC_VERSION__", and so is supported to the same
1783 extent as C11.
1784
1785 c2x The next version of the ISO C standard, still under
1786 development. The support for this version is experimental and
1787 incomplete.
1788
1789 gnu90
1790 gnu89
1791 GNU dialect of ISO C90 (including some C99 features).
1792
1793 gnu99
1794 gnu9x
1795 GNU dialect of ISO C99. The name gnu9x is deprecated.
1796
1797 gnu11
1798 gnu1x
1799 GNU dialect of ISO C11. The name gnu1x is deprecated.
1800
1801 gnu17
1802 gnu18
1803 GNU dialect of ISO C17. This is the default for C code.
1804
1805 gnu2x
1806 The next version of the ISO C standard, still under
1807 development, plus GNU extensions. The support for this version
1808 is experimental and incomplete.
1809
1810 c++98
1811 c++03
1812 The 1998 ISO C++ standard plus the 2003 technical corrigendum
1813 and some additional defect reports. Same as -ansi for C++ code.
1814
1815 gnu++98
1816 gnu++03
1817 GNU dialect of -std=c++98.
1818
1819 c++11
1820 c++0x
1821 The 2011 ISO C++ standard plus amendments. The name c++0x is
1822 deprecated.
1823
1824 gnu++11
1825 gnu++0x
1826 GNU dialect of -std=c++11. The name gnu++0x is deprecated.
1827
1828 c++14
1829 c++1y
1830 The 2014 ISO C++ standard plus amendments. The name c++1y is
1831 deprecated.
1832
1833 gnu++14
1834 gnu++1y
1835 GNU dialect of -std=c++14. The name gnu++1y is deprecated.
1836
1837 c++17
1838 c++1z
1839 The 2017 ISO C++ standard plus amendments. The name c++1z is
1840 deprecated.
1841
1842 gnu++17
1843 gnu++1z
1844 GNU dialect of -std=c++17. This is the default for C++ code.
1845 The name gnu++1z is deprecated.
1846
1847 c++20
1848 c++2a
1849 The 2020 ISO C++ standard plus amendments. Support is
1850 experimental, and could change in incompatible ways in future
1851 releases. The name c++2a is deprecated.
1852
1853 gnu++20
1854 gnu++2a
1855 GNU dialect of -std=c++20. Support is experimental, and could
1856 change in incompatible ways in future releases. The name
1857 gnu++2a is deprecated.
1858
1859 c++2b
1860 c++23
1861 The next revision of the ISO C++ standard, planned for 2023.
1862 Support is highly experimental, and will almost certainly
1863 change in incompatible ways in future releases.
1864
1865 gnu++2b
1866 gnu++23
1867 GNU dialect of -std=c++2b. Support is highly experimental, and
1868 will almost certainly change in incompatible ways in future
1869 releases.
1870
1871 -aux-info filename
1872 Output to the given filename prototyped declarations for all
1873 functions declared and/or defined in a translation unit, including
1874 those in header files. This option is silently ignored in any
1875 language other than C.
1876
1877 Besides declarations, the file indicates, in comments, the origin
1878 of each declaration (source file and line), whether the declaration
1879 was implicit, prototyped or unprototyped (I, N for new or O for
1880 old, respectively, in the first character after the line number and
1881 the colon), and whether it came from a declaration or a definition
1882 (C or F, respectively, in the following character). In the case of
1883 function definitions, a K&R-style list of arguments followed by
1884 their declarations is also provided, inside comments, after the
1885 declaration.
1886
1887 -fno-asm
1888 Do not recognize "asm", "inline" or "typeof" as a keyword, so that
1889 code can use these words as identifiers. You can use the keywords
1890 "__asm__", "__inline__" and "__typeof__" instead. In C, -ansi
1891 implies -fno-asm.
1892
1893 In C++, "inline" is a standard keyword and is not affected by this
1894 switch. You may want to use the -fno-gnu-keywords flag instead,
1895 which disables "typeof" but not "asm" and "inline". In C99 mode
1896 (-std=c99 or -std=gnu99), this switch only affects the "asm" and
1897 "typeof" keywords, since "inline" is a standard keyword in ISO C99.
1898 In C2X mode (-std=c2x or -std=gnu2x), this switch only affects the
1899 "asm" keyword, since "typeof" is a standard keyword in ISO C2X.
1900
1901 -fno-builtin
1902 -fno-builtin-function
1903 Don't recognize built-in functions that do not begin with
1904 __builtin_ as prefix.
1905
1906 GCC normally generates special code to handle certain built-in
1907 functions more efficiently; for instance, calls to "alloca" may
1908 become single instructions which adjust the stack directly, and
1909 calls to "memcpy" may become inline copy loops. The resulting code
1910 is often both smaller and faster, but since the function calls no
1911 longer appear as such, you cannot set a breakpoint on those calls,
1912 nor can you change the behavior of the functions by linking with a
1913 different library. In addition, when a function is recognized as a
1914 built-in function, GCC may use information about that function to
1915 warn about problems with calls to that function, or to generate
1916 more efficient code, even if the resulting code still contains
1917 calls to that function. For example, warnings are given with
1918 -Wformat for bad calls to "printf" when "printf" is built in and
1919 "strlen" is known not to modify global memory.
1920
1921 With the -fno-builtin-function option only the built-in function
1922 function is disabled. function must not begin with __builtin_. If
1923 a function is named that is not built-in in this version of GCC,
1924 this option is ignored. There is no corresponding
1925 -fbuiltin-function option; if you wish to enable built-in functions
1926 selectively when using -fno-builtin or -ffreestanding, you may
1927 define macros such as:
1928
1929 #define abs(n) __builtin_abs ((n))
1930 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1931
1932 -fcond-mismatch
1933 Allow conditional expressions with mismatched types in the second
1934 and third arguments. The value of such an expression is void.
1935 This option is not supported for C++.
1936
1937 -ffreestanding
1938 Assert that compilation targets a freestanding environment. This
1939 implies -fno-builtin. A freestanding environment is one in which
1940 the standard library may not exist, and program startup may not
1941 necessarily be at "main". The most obvious example is an OS
1942 kernel. This is equivalent to -fno-hosted.
1943
1944 -fgimple
1945 Enable parsing of function definitions marked with "__GIMPLE".
1946 This is an experimental feature that allows unit testing of GIMPLE
1947 passes.
1948
1949 -fgnu-tm
1950 When the option -fgnu-tm is specified, the compiler generates code
1951 for the Linux variant of Intel's current Transactional Memory ABI
1952 specification document (Revision 1.1, May 6 2009). This is an
1953 experimental feature whose interface may change in future versions
1954 of GCC, as the official specification changes. Please note that
1955 not all architectures are supported for this feature.
1956
1957 For more information on GCC's support for transactional memory,
1958
1959 Note that the transactional memory feature is not supported with
1960 non-call exceptions (-fnon-call-exceptions).
1961
1962 -fgnu89-inline
1963 The option -fgnu89-inline tells GCC to use the traditional GNU
1964 semantics for "inline" functions when in C99 mode.
1965
1966 Using this option is roughly equivalent to adding the "gnu_inline"
1967 function attribute to all inline functions.
1968
1969 The option -fno-gnu89-inline explicitly tells GCC to use the C99
1970 semantics for "inline" when in C99 or gnu99 mode (i.e., it
1971 specifies the default behavior). This option is not supported in
1972 -std=c90 or -std=gnu90 mode.
1973
1974 The preprocessor macros "__GNUC_GNU_INLINE__" and
1975 "__GNUC_STDC_INLINE__" may be used to check which semantics are in
1976 effect for "inline" functions.
1977
1978 -fhosted
1979 Assert that compilation targets a hosted environment. This implies
1980 -fbuiltin. A hosted environment is one in which the entire
1981 standard library is available, and in which "main" has a return
1982 type of "int". Examples are nearly everything except a kernel.
1983 This is equivalent to -fno-freestanding.
1984
1985 -flax-vector-conversions
1986 Allow implicit conversions between vectors with differing numbers
1987 of elements and/or incompatible element types. This option should
1988 not be used for new code.
1989
1990 -fms-extensions
1991 Accept some non-standard constructs used in Microsoft header files.
1992
1993 In C++ code, this allows member names in structures to be similar
1994 to previous types declarations.
1995
1996 typedef int UOW;
1997 struct ABC {
1998 UOW UOW;
1999 };
2000
2001 Some cases of unnamed fields in structures and unions are only
2002 accepted with this option.
2003
2004 Note that this option is off for all targets except for x86 targets
2005 using ms-abi.
2006
2007 -foffload=disable
2008 -foffload=default
2009 -foffload=target-list
2010 Specify for which OpenMP and OpenACC offload targets code should be
2011 generated. The default behavior, equivalent to -foffload=default,
2012 is to generate code for all supported offload targets. The
2013 -foffload=disable form generates code only for the host fallback,
2014 while -foffload=target-list generates code only for the specified
2015 comma-separated list of offload targets.
2016
2017 Offload targets are specified in GCC's internal target-triplet
2018 format. You can run the compiler with -v to show the list of
2019 configured offload targets under "OFFLOAD_TARGET_NAMES".
2020
2021 -foffload-options=options
2022 -foffload-options=target-triplet-list=options
2023 With -foffload-options=options, GCC passes the specified options to
2024 the compilers for all enabled offloading targets. You can specify
2025 options that apply only to a specific target or targets by using
2026 the -foffload-options=target-list=options form. The target-list is
2027 a comma-separated list in the same format as for the -foffload=
2028 option.
2029
2030 Typical command lines are
2031
2032 -foffload-options=-lgfortran -foffload-options=-lm
2033 -foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic
2034 -foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm
2035
2036 -fopenacc
2037 Enable handling of OpenACC directives "#pragma acc" in C/C++ and
2038 "!$acc" in Fortran. When -fopenacc is specified, the compiler
2039 generates accelerated code according to the OpenACC Application
2040 Programming Interface v2.6 <https://www.openacc.org>. This option
2041 implies -pthread, and thus is only supported on targets that have
2042 support for -pthread.
2043
2044 -fopenacc-dim=geom
2045 Specify default compute dimensions for parallel offload regions
2046 that do not explicitly specify. The geom value is a triple of
2047 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A
2048 size can be omitted, to use a target-specific default value.
2049
2050 -fopenmp
2051 Enable handling of OpenMP directives "#pragma omp" in C/C++,
2052 "[[omp::directive(...)]]" and "[[omp::sequence(...)]]" in C++ and
2053 "!$omp" in Fortran. When -fopenmp is specified, the compiler
2054 generates parallel code according to the OpenMP Application Program
2055 Interface v4.5 <https://www.openmp.org>. This option implies
2056 -pthread, and thus is only supported on targets that have support
2057 for -pthread. -fopenmp implies -fopenmp-simd.
2058
2059 -fopenmp-simd
2060 Enable handling of OpenMP's "simd", "declare simd", "declare
2061 reduction", "assume", "ordered", "scan", "loop" directives and
2062 combined or composite directives with "simd" as constituent with
2063 "#pragma omp" in C/C++, "[[omp::directive(...)]]" and
2064 "[[omp::sequence(...)]]" in C++ and "!$omp" in Fortran. Other
2065 OpenMP directives are ignored.
2066
2067 -fopenmp-target-simd-clone
2068 -fopenmp-target-simd-clone=device-type
2069 In addition to generating SIMD clones for functions marked with the
2070 "declare simd" directive, GCC also generates clones for functions
2071 marked with the OpenMP "declare target" directive that are suitable
2072 for vectorization when this option is in effect. The device-type
2073 may be one of "none", "host", "nohost", and "any", which correspond
2074 to keywords for the "device_type" clause of the "declare target"
2075 directive; clones are generated for the intersection of devices
2076 specified. -fopenmp-target-simd-clone is equivalent to
2077 -fopenmp-target-simd-clone=any and -fno-openmp-target-simd-clone is
2078 equivalent to -fopenmp-target-simd-clone=none.
2079
2080 At -O2 and higher (but not -Os or -Og) this optimization defaults
2081 to -fopenmp-target-simd-clone=nohost; otherwise it is disabled by
2082 default.
2083
2084 -fpermitted-flt-eval-methods=style
2085 ISO/IEC TS 18661-3 defines new permissible values for
2086 "FLT_EVAL_METHOD" that indicate that operations and constants with
2087 a semantic type that is an interchange or extended format should be
2088 evaluated to the precision and range of that type. These new
2089 values are a superset of those permitted under C99/C11, which does
2090 not specify the meaning of other positive values of
2091 "FLT_EVAL_METHOD". As such, code conforming to C11 may not have
2092 been written expecting the possibility of the new values.
2093
2094 -fpermitted-flt-eval-methods specifies whether the compiler should
2095 allow only the values of "FLT_EVAL_METHOD" specified in C99/C11, or
2096 the extended set of values specified in ISO/IEC TS 18661-3.
2097
2098 style is either "c11" or "ts-18661-3" as appropriate.
2099
2100 The default when in a standards compliant mode (-std=c11 or
2101 similar) is -fpermitted-flt-eval-methods=c11. The default when in
2102 a GNU dialect (-std=gnu11 or similar) is
2103 -fpermitted-flt-eval-methods=ts-18661-3.
2104
2105 -fplan9-extensions
2106 Accept some non-standard constructs used in Plan 9 code.
2107
2108 This enables -fms-extensions, permits passing pointers to
2109 structures with anonymous fields to functions that expect pointers
2110 to elements of the type of the field, and permits referring to
2111 anonymous fields declared using a typedef. This is only
2112 supported for C, not C++.
2113
2114 -fsigned-bitfields
2115 -funsigned-bitfields
2116 -fno-signed-bitfields
2117 -fno-unsigned-bitfields
2118 These options control whether a bit-field is signed or unsigned,
2119 when the declaration does not use either "signed" or "unsigned".
2120 By default, such a bit-field is signed, because this is consistent:
2121 the basic integer types such as "int" are signed types.
2122
2123 -fsigned-char
2124 Let the type "char" be signed, like "signed char".
2125
2126 Note that this is equivalent to -fno-unsigned-char, which is the
2127 negative form of -funsigned-char. Likewise, the option
2128 -fno-signed-char is equivalent to -funsigned-char.
2129
2130 -funsigned-char
2131 Let the type "char" be unsigned, like "unsigned char".
2132
2133 Each kind of machine has a default for what "char" should be. It
2134 is either like "unsigned char" by default or like "signed char" by
2135 default.
2136
2137 Ideally, a portable program should always use "signed char" or
2138 "unsigned char" when it depends on the signedness of an object.
2139 But many programs have been written to use plain "char" and expect
2140 it to be signed, or expect it to be unsigned, depending on the
2141 machines they were written for. This option, and its inverse, let
2142 you make such a program work with the opposite default.
2143
2144 The type "char" is always a distinct type from each of "signed
2145 char" or "unsigned char", even though its behavior is always just
2146 like one of those two.
2147
2148 -fstrict-flex-arrays
2149 Control when to treat the trailing array of a structure as a
2150 flexible array member for the purpose of accessing the elements of
2151 such an array. The positive form is equivalent to
2152 -fstrict-flex-arrays=3, which is the strictest. A trailing array
2153 is treated as a flexible array member only when it is declared as a
2154 flexible array member per C99 standard onwards. The negative form
2155 is equivalent to -fstrict-flex-arrays=0, which is the least strict.
2156 All trailing arrays of structures are treated as flexible array
2157 members.
2158
2159 -fstrict-flex-arrays=level
2160 Control when to treat the trailing array of a structure as a
2161 flexible array member for the purpose of accessing the elements of
2162 such an array. The value of level controls the level of
2163 strictness.
2164
2165 The possible values of level are the same as for the
2166 "strict_flex_array" attribute.
2167
2168 You can control this behavior for a specific trailing array field
2169 of a structure by using the variable attribute "strict_flex_array"
2170 attribute.
2171
2172 -fsso-struct=endianness
2173 Set the default scalar storage order of structures and unions to
2174 the specified endianness. The accepted values are big-endian,
2175 little-endian and native for the native endianness of the target
2176 (the default). This option is not supported for C++.
2177
2178 Warning: the -fsso-struct switch causes GCC to generate code that
2179 is not binary compatible with code generated without it if the
2180 specified endianness is not the native endianness of the target.
2181
2182 Options Controlling C++ Dialect
2183 This section describes the command-line options that are only
2184 meaningful for C++ programs. You can also use most of the GNU compiler
2185 options regardless of what language your program is in. For example,
2186 you might compile a file firstClass.C like this:
2187
2188 g++ -g -fstrict-enums -O -c firstClass.C
2189
2190 In this example, only -fstrict-enums is an option meant only for C++
2191 programs; you can use the other options with any language supported by
2192 GCC.
2193
2194 Some options for compiling C programs, such as -std, are also relevant
2195 for C++ programs.
2196
2197 Here is a list of options that are only for compiling C++ programs:
2198
2199 -fabi-version=n
2200 Use version n of the C++ ABI. The default is version 0.
2201
2202 Version 0 refers to the version conforming most closely to the C++
2203 ABI specification. Therefore, the ABI obtained using version 0
2204 will change in different versions of G++ as ABI bugs are fixed.
2205
2206 Version 1 is the version of the C++ ABI that first appeared in G++
2207 3.2.
2208
2209 Version 2 is the version of the C++ ABI that first appeared in G++
2210 3.4, and was the default through G++ 4.9.
2211
2212 Version 3 corrects an error in mangling a constant address as a
2213 template argument.
2214
2215 Version 4, which first appeared in G++ 4.5, implements a standard
2216 mangling for vector types.
2217
2218 Version 5, which first appeared in G++ 4.6, corrects the mangling
2219 of attribute const/volatile on function pointer types, decltype of
2220 a plain decl, and use of a function parameter in the declaration of
2221 another parameter.
2222
2223 Version 6, which first appeared in G++ 4.7, corrects the promotion
2224 behavior of C++11 scoped enums and the mangling of template
2225 argument packs, const/static_cast, prefix ++ and --, and a class
2226 scope function used as a template argument.
2227
2228 Version 7, which first appeared in G++ 4.8, that treats nullptr_t
2229 as a builtin type and corrects the mangling of lambdas in default
2230 argument scope.
2231
2232 Version 8, which first appeared in G++ 4.9, corrects the
2233 substitution behavior of function types with function-cv-
2234 qualifiers.
2235
2236 Version 9, which first appeared in G++ 5.2, corrects the alignment
2237 of "nullptr_t".
2238
2239 Version 10, which first appeared in G++ 6.1, adds mangling of
2240 attributes that affect type identity, such as ia32 calling
2241 convention attributes (e.g. stdcall).
2242
2243 Version 11, which first appeared in G++ 7, corrects the mangling of
2244 sizeof... expressions and operator names. For multiple entities
2245 with the same name within a function, that are declared in
2246 different scopes, the mangling now changes starting with the
2247 twelfth occurrence. It also implies -fnew-inheriting-ctors.
2248
2249 Version 12, which first appeared in G++ 8, corrects the calling
2250 conventions for empty classes on the x86_64 target and for classes
2251 with only deleted copy/move constructors. It accidentally changes
2252 the calling convention for classes with a deleted copy constructor
2253 and a trivial move constructor.
2254
2255 Version 13, which first appeared in G++ 8.2, fixes the accidental
2256 change in version 12.
2257
2258 Version 14, which first appeared in G++ 10, corrects the mangling
2259 of the nullptr expression.
2260
2261 Version 15, which first appeared in G++ 10.3, corrects G++ 10 ABI
2262 tag regression.
2263
2264 Version 16, which first appeared in G++ 11, changes the mangling of
2265 "__alignof__" to be distinct from that of "alignof", and dependent
2266 operator names.
2267
2268 Version 17, which first appeared in G++ 12, fixes layout of classes
2269 that inherit from aggregate classes with default member
2270 initializers in C++14 and up.
2271
2272 Version 18, which first appeard in G++ 13, fixes manglings of
2273 lambdas that have additional context.
2274
2275 See also -Wabi.
2276
2277 -fabi-compat-version=n
2278 On targets that support strong aliases, G++ works around mangling
2279 changes by creating an alias with the correct mangled name when
2280 defining a symbol with an incorrect mangled name. This switch
2281 specifies which ABI version to use for the alias.
2282
2283 With -fabi-version=0 (the default), this defaults to 13 (GCC 8.2
2284 compatibility). If another ABI version is explicitly selected,
2285 this defaults to 0. For compatibility with GCC versions 3.2
2286 through 4.9, use -fabi-compat-version=2.
2287
2288 If this option is not provided but -Wabi=n is, that version is used
2289 for compatibility aliases. If this option is provided along with
2290 -Wabi (without the version), the version from this option is used
2291 for the warning.
2292
2293 -fno-access-control
2294 Turn off all access checking. This switch is mainly useful for
2295 working around bugs in the access control code.
2296
2297 -faligned-new
2298 Enable support for C++17 "new" of types that require more alignment
2299 than "void* ::operator new(std::size_t)" provides. A numeric
2300 argument such as "-faligned-new=32" can be used to specify how much
2301 alignment (in bytes) is provided by that function, but few users
2302 will need to override the default of alignof(std::max_align_t).
2303
2304 This flag is enabled by default for -std=c++17.
2305
2306 -fchar8_t
2307 -fno-char8_t
2308 Enable support for "char8_t" as adopted for C++20. This includes
2309 the addition of a new "char8_t" fundamental type, changes to the
2310 types of UTF-8 string and character literals, new signatures for
2311 user-defined literals, associated standard library updates, and new
2312 "__cpp_char8_t" and "__cpp_lib_char8_t" feature test macros.
2313
2314 This option enables functions to be overloaded for ordinary and
2315 UTF-8 strings:
2316
2317 int f(const char *); // #1
2318 int f(const char8_t *); // #2
2319 int v1 = f("text"); // Calls #1
2320 int v2 = f(u8"text"); // Calls #2
2321
2322 and introduces new signatures for user-defined literals:
2323
2324 int operator""_udl1(char8_t);
2325 int v3 = u8'x'_udl1;
2326 int operator""_udl2(const char8_t*, std::size_t);
2327 int v4 = u8"text"_udl2;
2328 template<typename T, T...> int operator""_udl3();
2329 int v5 = u8"text"_udl3;
2330
2331 The change to the types of UTF-8 string and character literals
2332 introduces incompatibilities with ISO C++11 and later standards.
2333 For example, the following code is well-formed under ISO C++11, but
2334 is ill-formed when -fchar8_t is specified.
2335
2336 const char *cp = u8"xx";// error: invalid conversion from
2337 // `const char8_t*' to `const char*'
2338 int f(const char*);
2339 auto v = f(u8"xx"); // error: invalid conversion from
2340 // `const char8_t*' to `const char*'
2341 std::string s{u8"xx"}; // error: no matching function for call to
2342 // `std::basic_string<char>::basic_string()'
2343 using namespace std::literals;
2344 s = u8"xx"s; // error: conversion from
2345 // `basic_string<char8_t>' to non-scalar
2346 // type `basic_string<char>' requested
2347
2348 -fcheck-new
2349 Check that the pointer returned by "operator new" is non-null
2350 before attempting to modify the storage allocated. This check is
2351 normally unnecessary because the C++ standard specifies that
2352 "operator new" only returns 0 if it is declared throw(), in which
2353 case the compiler always checks the return value even without this
2354 option. In all other cases, when "operator new" has a non-empty
2355 exception specification, memory exhaustion is signalled by throwing
2356 "std::bad_alloc". See also new (nothrow).
2357
2358 -fconcepts
2359 -fconcepts-ts
2360 Enable support for the C++ Concepts feature for constraining
2361 template arguments. With -std=c++20 and above, Concepts are part
2362 of the language standard, so -fconcepts defaults to on.
2363
2364 Some constructs that were allowed by the earlier C++ Extensions for
2365 Concepts Technical Specification, ISO 19217 (2015), but didn't make
2366 it into the standard, can additionally be enabled by -fconcepts-ts.
2367
2368 -fconstexpr-depth=n
2369 Set the maximum nested evaluation depth for C++11 constexpr
2370 functions to n. A limit is needed to detect endless recursion
2371 during constant expression evaluation. The minimum specified by
2372 the standard is 512.
2373
2374 -fconstexpr-cache-depth=n
2375 Set the maximum level of nested evaluation depth for C++11
2376 constexpr functions that will be cached to n. This is a heuristic
2377 that trades off compilation speed (when the cache avoids repeated
2378 calculations) against memory consumption (when the cache grows very
2379 large from highly recursive evaluations). The default is 8. Very
2380 few users are likely to want to adjust it, but if your code does
2381 heavy constexpr calculations you might want to experiment to find
2382 which value works best for you.
2383
2384 -fconstexpr-fp-except
2385 Annex F of the C standard specifies that IEC559 floating point
2386 exceptions encountered at compile time should not stop compilation.
2387 C++ compilers have historically not followed this guidance, instead
2388 treating floating point division by zero as non-constant even
2389 though it has a well defined value. This flag tells the compiler
2390 to give Annex F priority over other rules saying that a particular
2391 operation is undefined.
2392
2393 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
2394
2395 -fconstexpr-loop-limit=n
2396 Set the maximum number of iterations for a loop in C++14 constexpr
2397 functions to n. A limit is needed to detect infinite loops during
2398 constant expression evaluation. The default is 262144 (1<<18).
2399
2400 -fconstexpr-ops-limit=n
2401 Set the maximum number of operations during a single constexpr
2402 evaluation. Even when number of iterations of a single loop is
2403 limited with the above limit, if there are several nested loops and
2404 each of them has many iterations but still smaller than the above
2405 limit, or if in a body of some loop or even outside of a loop too
2406 many expressions need to be evaluated, the resulting constexpr
2407 evaluation might take too long. The default is 33554432 (1<<25).
2408
2409 -fcontracts
2410 Enable experimental support for the C++ Contracts feature, as
2411 briefly added to and then removed from the C++20 working paper
2412 (N4820). The implementation also includes proposed enhancements
2413 from papers P1290, P1332, and P1429. This functionality is
2414 intended mostly for those interested in experimentation towards
2415 refining the feature to get it into shape for a future C++
2416 standard.
2417
2418 On violation of a checked contract, the violation handler is
2419 called. Users can replace the violation handler by defining
2420
2421 void
2422 handle_contract_violation (const std::experimental::contract_violation&);
2423
2424 There are different sets of additional flags that can be used
2425 together to specify which contracts will be checked and how, for
2426 N4820 contracts, P1332 contracts, or P1429 contracts; these sets
2427 cannot be used together.
2428
2429 -fcontract-mode=[on|off]
2430 Control whether any contracts have any semantics at all.
2431 Defaults to on.
2432
2433 -fcontract-assumption-mode=[on|off]
2434 [N4820] Control whether contracts with level axiom should have
2435 the assume semantic. Defaults to on.
2436
2437 -fcontract-build-level=[off|default|audit]
2438 [N4820] Specify which level of contracts to generate checks
2439 for. Defaults to default.
2440
2441 -fcontract-continuation-mode=[on|off]
2442 [N4820] Control whether to allow the program to continue
2443 executing after a contract violation. That is, do checked
2444 contracts have the maybe semantic described below rather than
2445 the never semantic. Defaults to off.
2446
2447 -fcontract-role=<name>:<default>,<audit>,<axiom>
2448 [P1332] Specify the concrete semantics for each contract level
2449 of a particular contract role.
2450
2451 -fcontract-semantic=[default|audit|axiom]:<semantic>
2452 [P1429] Specify the concrete semantic for a particular contract
2453 level.
2454
2455 -fcontract-strict-declarations=[on|off]
2456 Control whether to reject adding contracts to a function after
2457 its first declaration. Defaults to off.
2458
2459 The possible concrete semantics for that can be specified with
2460 -fcontract-role or -fcontract-semantic are:
2461
2462 "ignore"
2463 This contract has no effect.
2464
2465 "assume"
2466 This contract is treated like C++23 "[[assume]]".
2467
2468 "check_never_continue"
2469 "never"
2470 "abort"
2471 This contract is checked. If it fails, the violation handler
2472 is called. If the handler returns, "std::terminate" is called.
2473
2474 "check_maybe_continue"
2475 "maybe"
2476 This contract is checked. If it fails, the violation handler
2477 is called. If the handler returns, execution continues
2478 normally.
2479
2480 -fcoroutines
2481 Enable support for the C++ coroutines extension (experimental).
2482
2483 -fno-elide-constructors
2484 The C++ standard allows an implementation to omit creating a
2485 temporary that is only used to initialize another object of the
2486 same type. Specifying this option disables that optimization, and
2487 forces G++ to call the copy constructor in all cases. This option
2488 also causes G++ to call trivial member functions which otherwise
2489 would be expanded inline.
2490
2491 In C++17, the compiler is required to omit these temporaries, but
2492 this option still affects trivial member functions.
2493
2494 -fno-enforce-eh-specs
2495 Don't generate code to check for violation of exception
2496 specifications at run time. This option violates the C++ standard,
2497 but may be useful for reducing code size in production builds, much
2498 like defining "NDEBUG". This does not give user code permission to
2499 throw exceptions in violation of the exception specifications; the
2500 compiler still optimizes based on the specifications, so throwing
2501 an unexpected exception results in undefined behavior at run time.
2502
2503 -fextern-tls-init
2504 -fno-extern-tls-init
2505 The C++11 and OpenMP standards allow "thread_local" and
2506 "threadprivate" variables to have dynamic (runtime) initialization.
2507 To support this, any use of such a variable goes through a wrapper
2508 function that performs any necessary initialization. When the use
2509 and definition of the variable are in the same translation unit,
2510 this overhead can be optimized away, but when the use is in a
2511 different translation unit there is significant overhead even if
2512 the variable doesn't actually need dynamic initialization. If the
2513 programmer can be sure that no use of the variable in a non-
2514 defining TU needs to trigger dynamic initialization (either because
2515 the variable is statically initialized, or a use of the variable in
2516 the defining TU will be executed before any uses in another TU),
2517 they can avoid this overhead with the -fno-extern-tls-init option.
2518
2519 On targets that support symbol aliases, the default is
2520 -fextern-tls-init. On targets that do not support symbol aliases,
2521 the default is -fno-extern-tls-init.
2522
2523 -ffold-simple-inlines
2524 -fno-fold-simple-inlines
2525 Permit the C++ frontend to fold calls to "std::move",
2526 "std::forward", "std::addressof" and "std::as_const". In contrast
2527 to inlining, this means no debug information will be generated for
2528 such calls. Since these functions are rarely interesting to debug,
2529 this flag is enabled by default unless -fno-inline is active.
2530
2531 -fno-gnu-keywords
2532 Do not recognize "typeof" as a keyword, so that code can use this
2533 word as an identifier. You can use the keyword "__typeof__"
2534 instead. This option is implied by the strict ISO C++ dialects:
2535 -ansi, -std=c++98, -std=c++11, etc.
2536
2537 -fimplicit-constexpr
2538 Make inline functions implicitly constexpr, if they satisfy the
2539 requirements for a constexpr function. This option can be used in
2540 C++14 mode or later. This can result in initialization changing
2541 from dynamic to static and other optimizations.
2542
2543 -fno-implicit-templates
2544 Never emit code for non-inline templates that are instantiated
2545 implicitly (i.e. by use); only emit code for explicit
2546 instantiations. If you use this option, you must take care to
2547 structure your code to include all the necessary explicit
2548 instantiations to avoid getting undefined symbols at link time.
2549
2550 -fno-implicit-inline-templates
2551 Don't emit code for implicit instantiations of inline templates,
2552 either. The default is to handle inlines differently so that
2553 compiles with and without optimization need the same set of
2554 explicit instantiations.
2555
2556 -fno-implement-inlines
2557 To save space, do not emit out-of-line copies of inline functions
2558 controlled by "#pragma implementation". This causes linker errors
2559 if these functions are not inlined everywhere they are called.
2560
2561 -fmodules-ts
2562 -fno-modules-ts
2563 Enable support for C++20 modules. The -fno-modules-ts is usually
2564 not needed, as that is the default. Even though this is a C++20
2565 feature, it is not currently implicitly enabled by selecting that
2566 standard version.
2567
2568 -fmodule-header
2569 -fmodule-header=user
2570 -fmodule-header=system
2571 Compile a header file to create an importable header unit.
2572
2573 -fmodule-implicit-inline
2574 Member functions defined in their class definitions are not
2575 implicitly inline for modular code. This is different to
2576 traditional C++ behavior, for good reasons. However, it may result
2577 in a difficulty during code porting. This option makes such
2578 function definitions implicitly inline. It does however generate
2579 an ABI incompatibility, so you must use it everywhere or nowhere.
2580 (Such definitions outside of a named module remain implicitly
2581 inline, regardless.)
2582
2583 -fno-module-lazy
2584 Disable lazy module importing and module mapper creation.
2585
2586 -fmodule-mapper=[hostname]:port[?ident]
2587 -fmodule-mapper=|program[?ident] args...
2588 -fmodule-mapper==socket[?ident]
2589 -fmodule-mapper=<>[inout][?ident]
2590 -fmodule-mapper=<in>out[?ident]
2591 -fmodule-mapper=file[?ident]
2592 An oracle to query for module name to filename mappings. If
2593 unspecified the CXX_MODULE_MAPPER environment variable is used, and
2594 if that is unset, an in-process default is provided.
2595
2596 -fmodule-only
2597 Only emit the Compiled Module Interface, inhibiting any object
2598 file.
2599
2600 -fms-extensions
2601 Disable Wpedantic warnings about constructs used in MFC, such as
2602 implicit int and getting a pointer to member function via non-
2603 standard syntax.
2604
2605 -fnew-inheriting-ctors
2606 Enable the P0136 adjustment to the semantics of C++11 constructor
2607 inheritance. This is part of C++17 but also considered to be a
2608 Defect Report against C++11 and C++14. This flag is enabled by
2609 default unless -fabi-version=10 or lower is specified.
2610
2611 -fnew-ttp-matching
2612 Enable the P0522 resolution to Core issue 150, template template
2613 parameters and default arguments: this allows a template with
2614 default template arguments as an argument for a template template
2615 parameter with fewer template parameters. This flag is enabled by
2616 default for -std=c++17.
2617
2618 -fno-nonansi-builtins
2619 Disable built-in declarations of functions that are not mandated by
2620 ANSI/ISO C. These include "ffs", "alloca", "_exit", "index",
2621 "bzero", "conjf", and other related functions.
2622
2623 -fnothrow-opt
2624 Treat a throw() exception specification as if it were a "noexcept"
2625 specification to reduce or eliminate the text size overhead
2626 relative to a function with no exception specification. If the
2627 function has local variables of types with non-trivial destructors,
2628 the exception specification actually makes the function smaller
2629 because the EH cleanups for those variables can be optimized away.
2630 The semantic effect is that an exception thrown out of a function
2631 with such an exception specification results in a call to
2632 "terminate" rather than "unexpected".
2633
2634 -fno-operator-names
2635 Do not treat the operator name keywords "and", "bitand", "bitor",
2636 "compl", "not", "or" and "xor" as synonyms as keywords.
2637
2638 -fno-optional-diags
2639 Disable diagnostics that the standard says a compiler does not need
2640 to issue. Currently, the only such diagnostic issued by G++ is the
2641 one for a name having multiple meanings within a class.
2642
2643 -fpermissive
2644 Downgrade some diagnostics about nonconformant code from errors to
2645 warnings. Thus, using -fpermissive allows some nonconforming code
2646 to compile.
2647
2648 -fno-pretty-templates
2649 When an error message refers to a specialization of a function
2650 template, the compiler normally prints the signature of the
2651 template followed by the template arguments and any typedefs or
2652 typenames in the signature (e.g. "void f(T) [with T = int]" rather
2653 than "void f(int)") so that it's clear which template is involved.
2654 When an error message refers to a specialization of a class
2655 template, the compiler omits any template arguments that match the
2656 default template arguments for that template. If either of these
2657 behaviors make it harder to understand the error message rather
2658 than easier, you can use -fno-pretty-templates to disable them.
2659
2660 -fno-rtti
2661 Disable generation of information about every class with virtual
2662 functions for use by the C++ run-time type identification features
2663 ("dynamic_cast" and "typeid"). If you don't use those parts of the
2664 language, you can save some space by using this flag. Note that
2665 exception handling uses the same information, but G++ generates it
2666 as needed. The "dynamic_cast" operator can still be used for casts
2667 that do not require run-time type information, i.e. casts to "void
2668 *" or to unambiguous base classes.
2669
2670 Mixing code compiled with -frtti with that compiled with -fno-rtti
2671 may not work. For example, programs may fail to link if a class
2672 compiled with -fno-rtti is used as a base for a class compiled with
2673 -frtti.
2674
2675 -fsized-deallocation
2676 Enable the built-in global declarations
2677
2678 void operator delete (void *, std::size_t) noexcept;
2679 void operator delete[] (void *, std::size_t) noexcept;
2680
2681 as introduced in C++14. This is useful for user-defined
2682 replacement deallocation functions that, for example, use the size
2683 of the object to make deallocation faster. Enabled by default
2684 under -std=c++14 and above. The flag -Wsized-deallocation warns
2685 about places that might want to add a definition.
2686
2687 -fstrict-enums
2688 Allow the compiler to optimize using the assumption that a value of
2689 enumerated type can only be one of the values of the enumeration
2690 (as defined in the C++ standard; basically, a value that can be
2691 represented in the minimum number of bits needed to represent all
2692 the enumerators). This assumption may not be valid if the program
2693 uses a cast to convert an arbitrary integer value to the enumerated
2694 type.
2695
2696 -fstrong-eval-order
2697 Evaluate member access, array subscripting, and shift expressions
2698 in left-to-right order, and evaluate assignment in right-to-left
2699 order, as adopted for C++17. Enabled by default with -std=c++17.
2700 -fstrong-eval-order=some enables just the ordering of member access
2701 and shift expressions, and is the default without -std=c++17.
2702
2703 -ftemplate-backtrace-limit=n
2704 Set the maximum number of template instantiation notes for a single
2705 warning or error to n. The default value is 10.
2706
2707 -ftemplate-depth=n
2708 Set the maximum instantiation depth for template classes to n. A
2709 limit on the template instantiation depth is needed to detect
2710 endless recursions during template class instantiation. ANSI/ISO
2711 C++ conforming programs must not rely on a maximum depth greater
2712 than 17 (changed to 1024 in C++11). The default value is 900, as
2713 the compiler can run out of stack space before hitting 1024 in some
2714 situations.
2715
2716 -fno-threadsafe-statics
2717 Do not emit the extra code to use the routines specified in the C++
2718 ABI for thread-safe initialization of local statics. You can use
2719 this option to reduce code size slightly in code that doesn't need
2720 to be thread-safe.
2721
2722 -fuse-cxa-atexit
2723 Register destructors for objects with static storage duration with
2724 the "__cxa_atexit" function rather than the "atexit" function.
2725 This option is required for fully standards-compliant handling of
2726 static destructors, but only works if your C library supports
2727 "__cxa_atexit".
2728
2729 -fno-use-cxa-get-exception-ptr
2730 Don't use the "__cxa_get_exception_ptr" runtime routine. This
2731 causes "std::uncaught_exception" to be incorrect, but is necessary
2732 if the runtime routine is not available.
2733
2734 -fvisibility-inlines-hidden
2735 This switch declares that the user does not attempt to compare
2736 pointers to inline functions or methods where the addresses of the
2737 two functions are taken in different shared objects.
2738
2739 The effect of this is that GCC may, effectively, mark inline
2740 methods with "__attribute__ ((visibility ("hidden")))" so that they
2741 do not appear in the export table of a DSO and do not require a PLT
2742 indirection when used within the DSO. Enabling this option can
2743 have a dramatic effect on load and link times of a DSO as it
2744 massively reduces the size of the dynamic export table when the
2745 library makes heavy use of templates.
2746
2747 The behavior of this switch is not quite the same as marking the
2748 methods as hidden directly, because it does not affect static
2749 variables local to the function or cause the compiler to deduce
2750 that the function is defined in only one shared object.
2751
2752 You may mark a method as having a visibility explicitly to negate
2753 the effect of the switch for that method. For example, if you do
2754 want to compare pointers to a particular inline method, you might
2755 mark it as having default visibility. Marking the enclosing class
2756 with explicit visibility has no effect.
2757
2758 Explicitly instantiated inline methods are unaffected by this
2759 option as their linkage might otherwise cross a shared library
2760 boundary.
2761
2762 -fvisibility-ms-compat
2763 This flag attempts to use visibility settings to make GCC's C++
2764 linkage model compatible with that of Microsoft Visual Studio.
2765
2766 The flag makes these changes to GCC's linkage model:
2767
2768 1. It sets the default visibility to "hidden", like
2769 -fvisibility=hidden.
2770
2771 2. Types, but not their members, are not hidden by default.
2772
2773 3. The One Definition Rule is relaxed for types without explicit
2774 visibility specifications that are defined in more than one
2775 shared object: those declarations are permitted if they are
2776 permitted when this option is not used.
2777
2778 In new code it is better to use -fvisibility=hidden and export
2779 those classes that are intended to be externally visible.
2780 Unfortunately it is possible for code to rely, perhaps
2781 accidentally, on the Visual Studio behavior.
2782
2783 Among the consequences of these changes are that static data
2784 members of the same type with the same name but defined in
2785 different shared objects are different, so changing one does not
2786 change the other; and that pointers to function members defined in
2787 different shared objects may not compare equal. When this flag is
2788 given, it is a violation of the ODR to define types with the same
2789 name differently.
2790
2791 -fno-weak
2792 Do not use weak symbol support, even if it is provided by the
2793 linker. By default, G++ uses weak symbols if they are available.
2794 This option exists only for testing, and should not be used by end-
2795 users; it results in inferior code and has no benefits. This
2796 option may be removed in a future release of G++.
2797
2798 -fext-numeric-literals (C++ and Objective-C++ only)
2799 Accept imaginary, fixed-point, or machine-defined literal number
2800 suffixes as GNU extensions. When this option is turned off these
2801 suffixes are treated as C++11 user-defined literal numeric
2802 suffixes. This is on by default for all pre-C++11 dialects and all
2803 GNU dialects: -std=c++98, -std=gnu++98, -std=gnu++11, -std=gnu++14.
2804 This option is off by default for ISO C++11 onwards (-std=c++11,
2805 ...).
2806
2807 -nostdinc++
2808 Do not search for header files in the standard directories specific
2809 to C++, but do still search the other standard directories. (This
2810 option is used when building the C++ library.)
2811
2812 -flang-info-include-translate
2813 -flang-info-include-translate-not
2814 -flang-info-include-translate=header
2815 Inform of include translation events. The first will note accepted
2816 include translations, the second will note declined include
2817 translations. The header form will inform of include translations
2818 relating to that specific header. If header is of the form "user"
2819 or "<system>" it will be resolved to a specific user or system
2820 header using the include path.
2821
2822 -flang-info-module-cmi
2823 -flang-info-module-cmi=module
2824 Inform of Compiled Module Interface pathnames. The first will note
2825 all read CMI pathnames. The module form will not reading a
2826 specific module's CMI. module may be a named module or a header-
2827 unit (the latter indicated by either being a pathname containing
2828 directory separators or enclosed in "<>" or "").
2829
2830 -stdlib=libstdc++,libc++
2831 When G++ is configured to support this option, it allows
2832 specification of alternate C++ runtime libraries. Two options are
2833 available: libstdc++ (the default, native C++ runtime for G++) and
2834 libc++ which is the C++ runtime installed on some operating systems
2835 (e.g. Darwin versions from Darwin11 onwards). The option switches
2836 G++ to use the headers from the specified library and to emit
2837 "-lstdc++" or "-lc++" respectively, when a C++ runtime is required
2838 for linking.
2839
2840 In addition, these warning options have meanings only for C++ programs:
2841
2842 -Wabi-tag (C++ and Objective-C++ only)
2843 Warn when a type with an ABI tag is used in a context that does not
2844 have that ABI tag. See C++ Attributes for more information about
2845 ABI tags.
2846
2847 -Wcomma-subscript (C++ and Objective-C++ only)
2848 Warn about uses of a comma expression within a subscripting
2849 expression. This usage was deprecated in C++20 and is going to be
2850 removed in C++23. However, a comma expression wrapped in "( )" is
2851 not deprecated. Example:
2852
2853 void f(int *a, int b, int c) {
2854 a[b,c]; // deprecated in C++20, invalid in C++23
2855 a[(b,c)]; // OK
2856 }
2857
2858 In C++23 it is valid to have comma separated expressions in a
2859 subscript when an overloaded subscript operator is found and
2860 supports the right number and types of arguments. G++ will accept
2861 the formerly valid syntax for code that is not valid in C++23 but
2862 used to be valid but deprecated in C++20 with a pedantic warning
2863 that can be disabled with -Wno-comma-subscript.
2864
2865 Enabled by default with -std=c++20 unless -Wno-deprecated, and with
2866 -std=c++23 regardless of -Wno-deprecated.
2867
2868 -Wctad-maybe-unsupported (C++ and Objective-C++ only)
2869 Warn when performing class template argument deduction (CTAD) on a
2870 type with no explicitly written deduction guides. This warning
2871 will point out cases where CTAD succeeded only because the compiler
2872 synthesized the implicit deduction guides, which might not be what
2873 the programmer intended. Certain style guides allow CTAD only on
2874 types that specifically "opt-in"; i.e., on types that are designed
2875 to support CTAD. This warning can be suppressed with the following
2876 pattern:
2877
2878 struct allow_ctad_t; // any name works
2879 template <typename T> struct S {
2880 S(T) { }
2881 };
2882 // Guide with incomplete parameter type will never be considered.
2883 S(allow_ctad_t) -> S<void>;
2884
2885 -Wctor-dtor-privacy (C++ and Objective-C++ only)
2886 Warn when a class seems unusable because all the constructors or
2887 destructors in that class are private, and it has neither friends
2888 nor public static member functions. Also warn if there are no non-
2889 private methods, and there's at least one private member function
2890 that isn't a constructor or destructor.
2891
2892 -Wdangling-reference (C++ and Objective-C++ only)
2893 Warn when a reference is bound to a temporary whose lifetime has
2894 ended. For example:
2895
2896 int n = 1;
2897 const int& r = std::max(n - 1, n + 1); // r is dangling
2898
2899 In the example above, two temporaries are created, one for each
2900 argument, and a reference to one of the temporaries is returned.
2901 However, both temporaries are destroyed at the end of the full
2902 expression, so the reference "r" is dangling. This warning also
2903 detects dangling references in member initializer lists:
2904
2905 const int& f(const int& i) { return i; }
2906 struct S {
2907 const int &r; // r is dangling
2908 S() : r(f(10)) { }
2909 };
2910
2911 Member functions are checked as well, but only their object
2912 argument:
2913
2914 struct S {
2915 const S& self () { return *this; }
2916 };
2917 const S& s = S().self(); // s is dangling
2918
2919 Certain functions are safe in this respect, for example
2920 "std::use_facet": they take and return a reference, but they don't
2921 return one of its arguments, which can fool the warning. Such
2922 functions can be excluded from the warning by wrapping them in a
2923 "#pragma":
2924
2925 #pragma GCC diagnostic push
2926 #pragma GCC diagnostic ignored "-Wdangling-reference"
2927 const T& foo (const T&) { ... }
2928 #pragma GCC diagnostic pop
2929
2930 -Wdangling-reference also warns about code like
2931
2932 auto p = std::minmax(1, 2);
2933
2934 where "std::minmax" returns "std::pair<const int&, const int&>",
2935 and both references dangle after the end of the full expression
2936 that contains the call to "std::minmax".
2937
2938 This warning is enabled by -Wall.
2939
2940 -Wdelete-non-virtual-dtor (C++ and Objective-C++ only)
2941 Warn when "delete" is used to destroy an instance of a class that
2942 has virtual functions and non-virtual destructor. It is unsafe to
2943 delete an instance of a derived class through a pointer to a base
2944 class if the base class does not have a virtual destructor. This
2945 warning is enabled by -Wall.
2946
2947 -Wdeprecated-copy (C++ and Objective-C++ only)
2948 Warn that the implicit declaration of a copy constructor or copy
2949 assignment operator is deprecated if the class has a user-provided
2950 copy constructor or copy assignment operator, in C++11 and up.
2951 This warning is enabled by -Wextra. With -Wdeprecated-copy-dtor,
2952 also deprecate if the class has a user-provided destructor.
2953
2954 -Wno-deprecated-enum-enum-conversion (C++ and Objective-C++ only)
2955 Disable the warning about the case when the usual arithmetic
2956 conversions are applied on operands where one is of enumeration
2957 type and the other is of a different enumeration type. This
2958 conversion was deprecated in C++20. For example:
2959
2960 enum E1 { e };
2961 enum E2 { f };
2962 int k = f - e;
2963
2964 -Wdeprecated-enum-enum-conversion is enabled by default with
2965 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2966 -Wenum-conversion.
2967
2968 -Wno-deprecated-enum-float-conversion (C++ and Objective-C++ only)
2969 Disable the warning about the case when the usual arithmetic
2970 conversions are applied on operands where one is of enumeration
2971 type and the other is of a floating-point type. This conversion
2972 was deprecated in C++20. For example:
2973
2974 enum E1 { e };
2975 enum E2 { f };
2976 bool b = e <= 3.7;
2977
2978 -Wdeprecated-enum-float-conversion is enabled by default with
2979 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2980 -Wenum-conversion.
2981
2982 -Wno-init-list-lifetime (C++ and Objective-C++ only)
2983 Do not warn about uses of "std::initializer_list" that are likely
2984 to result in dangling pointers. Since the underlying array for an
2985 "initializer_list" is handled like a normal C++ temporary object,
2986 it is easy to inadvertently keep a pointer to the array past the
2987 end of the array's lifetime. For example:
2988
2989 * If a function returns a temporary "initializer_list", or a
2990 local "initializer_list" variable, the array's lifetime ends at
2991 the end of the return statement, so the value returned has a
2992 dangling pointer.
2993
2994 * If a new-expression creates an "initializer_list", the array
2995 only lives until the end of the enclosing full-expression, so
2996 the "initializer_list" in the heap has a dangling pointer.
2997
2998 * When an "initializer_list" variable is assigned from a brace-
2999 enclosed initializer list, the temporary array created for the
3000 right side of the assignment only lives until the end of the
3001 full-expression, so at the next statement the
3002 "initializer_list" variable has a dangling pointer.
3003
3004 // li's initial underlying array lives as long as li
3005 std::initializer_list<int> li = { 1,2,3 };
3006 // assignment changes li to point to a temporary array
3007 li = { 4, 5 };
3008 // now the temporary is gone and li has a dangling pointer
3009 int i = li.begin()[0] // undefined behavior
3010
3011 * When a list constructor stores the "begin" pointer from the
3012 "initializer_list" argument, this doesn't extend the lifetime
3013 of the array, so if a class variable is constructed from a
3014 temporary "initializer_list", the pointer is left dangling by
3015 the end of the variable declaration statement.
3016
3017 -Winvalid-constexpr
3018 Warn when a function never produces a constant expression. In
3019 C++20 and earlier, for every "constexpr" function and function
3020 template, there must be at least one set of function arguments in
3021 at least one instantiation such that an invocation of the function
3022 or constructor could be an evaluated subexpression of a core
3023 constant expression. C++23 removed this restriction, so it's
3024 possible to have a function or a function template marked
3025 "constexpr" for which no invocation satisfies the requirements of a
3026 core constant expression.
3027
3028 This warning is enabled as a pedantic warning by default in C++20
3029 and earlier. In C++23, -Winvalid-constexpr can be turned on, in
3030 which case it will be an ordinary warning. For example:
3031
3032 void f (int& i);
3033 constexpr void
3034 g (int& i)
3035 {
3036 // Warns by default in C++20, in C++23 only with -Winvalid-constexpr.
3037 f(i);
3038 }
3039
3040 -Winvalid-imported-macros
3041 Verify all imported macro definitions are valid at the end of
3042 compilation. This is not enabled by default, as it requires
3043 additional processing to determine. It may be useful when
3044 preparing sets of header-units to ensure consistent macros.
3045
3046 -Wno-literal-suffix (C++ and Objective-C++ only)
3047 Do not warn when a string or character literal is followed by a ud-
3048 suffix which does not begin with an underscore. As a conforming
3049 extension, GCC treats such suffixes as separate preprocessing
3050 tokens in order to maintain backwards compatibility with code that
3051 uses formatting macros from "<inttypes.h>". For example:
3052
3053 #define __STDC_FORMAT_MACROS
3054 #include <inttypes.h>
3055 #include <stdio.h>
3056
3057 int main() {
3058 int64_t i64 = 123;
3059 printf("My int64: %" PRId64"\n", i64);
3060 }
3061
3062 In this case, "PRId64" is treated as a separate preprocessing
3063 token.
3064
3065 This option also controls warnings when a user-defined literal
3066 operator is declared with a literal suffix identifier that doesn't
3067 begin with an underscore. Literal suffix identifiers that don't
3068 begin with an underscore are reserved for future standardization.
3069
3070 These warnings are enabled by default.
3071
3072 -Wno-narrowing (C++ and Objective-C++ only)
3073 For C++11 and later standards, narrowing conversions are diagnosed
3074 by default, as required by the standard. A narrowing conversion
3075 from a constant produces an error, and a narrowing conversion from
3076 a non-constant produces a warning, but -Wno-narrowing suppresses
3077 the diagnostic. Note that this does not affect the meaning of
3078 well-formed code; narrowing conversions are still considered ill-
3079 formed in SFINAE contexts.
3080
3081 With -Wnarrowing in C++98, warn when a narrowing conversion
3082 prohibited by C++11 occurs within { }, e.g.
3083
3084 int i = { 2.2 }; // error: narrowing from double to int
3085
3086 This flag is included in -Wall and -Wc++11-compat.
3087
3088 -Wnoexcept (C++ and Objective-C++ only)
3089 Warn when a noexcept-expression evaluates to false because of a
3090 call to a function that does not have a non-throwing exception
3091 specification (i.e. throw() or "noexcept") but is known by the
3092 compiler to never throw an exception.
3093
3094 -Wnoexcept-type (C++ and Objective-C++ only)
3095 Warn if the C++17 feature making "noexcept" part of a function type
3096 changes the mangled name of a symbol relative to C++14. Enabled by
3097 -Wabi and -Wc++17-compat.
3098
3099 As an example:
3100
3101 template <class T> void f(T t) { t(); };
3102 void g() noexcept;
3103 void h() { f(g); }
3104
3105 In C++14, "f" calls "f<void(*)()>", but in C++17 it calls
3106 "f<void(*)()noexcept>".
3107
3108 -Wclass-memaccess (C++ and Objective-C++ only)
3109 Warn when the destination of a call to a raw memory function such
3110 as "memset" or "memcpy" is an object of class type, and when
3111 writing into such an object might bypass the class non-trivial or
3112 deleted constructor or copy assignment, violate const-correctness
3113 or encapsulation, or corrupt virtual table pointers. Modifying the
3114 representation of such objects may violate invariants maintained by
3115 member functions of the class. For example, the call to "memset"
3116 below is undefined because it modifies a non-trivial class object
3117 and is, therefore, diagnosed. The safe way to either initialize or
3118 clear the storage of objects of such types is by using the
3119 appropriate constructor or assignment operator, if one is
3120 available.
3121
3122 std::string str = "abc";
3123 memset (&str, 0, sizeof str);
3124
3125 The -Wclass-memaccess option is enabled by -Wall. Explicitly
3126 casting the pointer to the class object to "void *" or to a type
3127 that can be safely accessed by the raw memory function suppresses
3128 the warning.
3129
3130 -Wnon-virtual-dtor (C++ and Objective-C++ only)
3131 Warn when a class has virtual functions and an accessible non-
3132 virtual destructor itself or in an accessible polymorphic base
3133 class, in which case it is possible but unsafe to delete an
3134 instance of a derived class through a pointer to the class itself
3135 or base class. This warning is automatically enabled if -Weffc++
3136 is specified. The -Wdelete-non-virtual-dtor option (enabled by
3137 -Wall) should be preferred because it warns about the unsafe cases
3138 without false positives.
3139
3140 -Wregister (C++ and Objective-C++ only)
3141 Warn on uses of the "register" storage class specifier, except when
3142 it is part of the GNU Explicit Register Variables extension. The
3143 use of the "register" keyword as storage class specifier has been
3144 deprecated in C++11 and removed in C++17. Enabled by default with
3145 -std=c++17.
3146
3147 -Wreorder (C++ and Objective-C++ only)
3148 Warn when the order of member initializers given in the code does
3149 not match the order in which they must be executed. For instance:
3150
3151 struct A {
3152 int i;
3153 int j;
3154 A(): j (0), i (1) { }
3155 };
3156
3157 The compiler rearranges the member initializers for "i" and "j" to
3158 match the declaration order of the members, emitting a warning to
3159 that effect. This warning is enabled by -Wall.
3160
3161 -Wno-pessimizing-move (C++ and Objective-C++ only)
3162 This warning warns when a call to "std::move" prevents copy
3163 elision. A typical scenario when copy elision can occur is when
3164 returning in a function with a class return type, when the
3165 expression being returned is the name of a non-volatile automatic
3166 object, and is not a function parameter, and has the same type as
3167 the function return type.
3168
3169 struct T {
3170 ...
3171 };
3172 T fn()
3173 {
3174 T t;
3175 ...
3176 return std::move (t);
3177 }
3178
3179 But in this example, the "std::move" call prevents copy elision.
3180
3181 This warning is enabled by -Wall.
3182
3183 -Wno-redundant-move (C++ and Objective-C++ only)
3184 This warning warns about redundant calls to "std::move"; that is,
3185 when a move operation would have been performed even without the
3186 "std::move" call. This happens because the compiler is forced to
3187 treat the object as if it were an rvalue in certain situations such
3188 as returning a local variable, where copy elision isn't applicable.
3189 Consider:
3190
3191 struct T {
3192 ...
3193 };
3194 T fn(T t)
3195 {
3196 ...
3197 return std::move (t);
3198 }
3199
3200 Here, the "std::move" call is redundant. Because G++ implements
3201 Core Issue 1579, another example is:
3202
3203 struct T { // convertible to U
3204 ...
3205 };
3206 struct U {
3207 ...
3208 };
3209 U fn()
3210 {
3211 T t;
3212 ...
3213 return std::move (t);
3214 }
3215
3216 In this example, copy elision isn't applicable because the type of
3217 the expression being returned and the function return type differ,
3218 yet G++ treats the return value as if it were designated by an
3219 rvalue.
3220
3221 This warning is enabled by -Wextra.
3222
3223 -Wrange-loop-construct (C++ and Objective-C++ only)
3224 This warning warns when a C++ range-based for-loop is creating an
3225 unnecessary copy. This can happen when the range declaration is
3226 not a reference, but probably should be. For example:
3227
3228 struct S { char arr[128]; };
3229 void fn () {
3230 S arr[5];
3231 for (const auto x : arr) { ... }
3232 }
3233
3234 It does not warn when the type being copied is a trivially-copyable
3235 type whose size is less than 64 bytes.
3236
3237 This warning also warns when a loop variable in a range-based for-
3238 loop is initialized with a value of a different type resulting in a
3239 copy. For example:
3240
3241 void fn() {
3242 int arr[10];
3243 for (const double &x : arr) { ... }
3244 }
3245
3246 In the example above, in every iteration of the loop a temporary
3247 value of type "double" is created and destroyed, to which the
3248 reference "const double &" is bound.
3249
3250 This warning is enabled by -Wall.
3251
3252 -Wredundant-tags (C++ and Objective-C++ only)
3253 Warn about redundant class-key and enum-key in references to class
3254 types and enumerated types in contexts where the key can be
3255 eliminated without causing an ambiguity. For example:
3256
3257 struct foo;
3258 struct foo *p; // warn that keyword struct can be eliminated
3259
3260 On the other hand, in this example there is no warning:
3261
3262 struct foo;
3263 void foo (); // "hides" struct foo
3264 void bar (struct foo&); // no warning, keyword struct is necessary
3265
3266 -Wno-subobject-linkage (C++ and Objective-C++ only)
3267 Do not warn if a class type has a base or a field whose type uses
3268 the anonymous namespace or depends on a type with no linkage. If a
3269 type A depends on a type B with no or internal linkage, defining it
3270 in multiple translation units would be an ODR violation because the
3271 meaning of B is different in each translation unit. If A only
3272 appears in a single translation unit, the best way to silence the
3273 warning is to give it internal linkage by putting it in an
3274 anonymous namespace as well. The compiler doesn't give this
3275 warning for types defined in the main .C file, as those are
3276 unlikely to have multiple definitions. -Wsubobject-linkage is
3277 enabled by default.
3278
3279 -Weffc++ (C++ and Objective-C++ only)
3280 Warn about violations of the following style guidelines from Scott
3281 Meyers' Effective C++ series of books:
3282
3283 * Define a copy constructor and an assignment operator for
3284 classes with dynamically-allocated memory.
3285
3286 * Prefer initialization to assignment in constructors.
3287
3288 * Have "operator=" return a reference to *this.
3289
3290 * Don't try to return a reference when you must return an object.
3291
3292 * Distinguish between prefix and postfix forms of increment and
3293 decrement operators.
3294
3295 * Never overload "&&", "||", or ",".
3296
3297 This option also enables -Wnon-virtual-dtor, which is also one of
3298 the effective C++ recommendations. However, the check is extended
3299 to warn about the lack of virtual destructor in accessible non-
3300 polymorphic bases classes too.
3301
3302 When selecting this option, be aware that the standard library
3303 headers do not obey all of these guidelines; use grep -v to filter
3304 out those warnings.
3305
3306 -Wno-exceptions (C++ and Objective-C++ only)
3307 Disable the warning about the case when an exception handler is
3308 shadowed by another handler, which can point out a wrong ordering
3309 of exception handlers.
3310
3311 -Wstrict-null-sentinel (C++ and Objective-C++ only)
3312 Warn about the use of an uncasted "NULL" as sentinel. When
3313 compiling only with GCC this is a valid sentinel, as "NULL" is
3314 defined to "__null". Although it is a null pointer constant rather
3315 than a null pointer, it is guaranteed to be of the same size as a
3316 pointer. But this use is not portable across different compilers.
3317
3318 -Wno-non-template-friend (C++ and Objective-C++ only)
3319 Disable warnings when non-template friend functions are declared
3320 within a template. In very old versions of GCC that predate
3321 implementation of the ISO standard, declarations such as friend int
3322 foo(int), where the name of the friend is an unqualified-id, could
3323 be interpreted as a particular specialization of a template
3324 function; the warning exists to diagnose compatibility problems,
3325 and is enabled by default.
3326
3327 -Wold-style-cast (C++ and Objective-C++ only)
3328 Warn if an old-style (C-style) cast to a non-void type is used
3329 within a C++ program. The new-style casts ("dynamic_cast",
3330 "static_cast", "reinterpret_cast", and "const_cast") are less
3331 vulnerable to unintended effects and much easier to search for.
3332
3333 -Woverloaded-virtual (C++ and Objective-C++ only)
3334 -Woverloaded-virtual=n
3335 Warn when a function declaration hides virtual functions from a
3336 base class. For example, in:
3337
3338 struct A {
3339 virtual void f();
3340 };
3341
3342 struct B: public A {
3343 void f(int); // does not override
3344 };
3345
3346 the "A" class version of "f" is hidden in "B", and code like:
3347
3348 B* b;
3349 b->f();
3350
3351 fails to compile.
3352
3353 In cases where the different signatures are not an accident, the
3354 simplest solution is to add a using-declaration to the derived
3355 class to un-hide the base function, e.g. add "using A::f;" to "B".
3356
3357 The optional level suffix controls the behavior when all the
3358 declarations in the derived class override virtual functions in the
3359 base class, even if not all of the base functions are overridden:
3360
3361 struct C {
3362 virtual void f();
3363 virtual void f(int);
3364 };
3365
3366 struct D: public C {
3367 void f(int); // does override
3368 }
3369
3370 This pattern is less likely to be a mistake; if D is only used
3371 virtually, the user might have decided that the base class
3372 semantics for some of the overloads are fine.
3373
3374 At level 1, this case does not warn; at level 2, it does.
3375 -Woverloaded-virtual by itself selects level 2. Level 1 is
3376 included in -Wall.
3377
3378 -Wno-pmf-conversions (C++ and Objective-C++ only)
3379 Disable the diagnostic for converting a bound pointer to member
3380 function to a plain pointer.
3381
3382 -Wsign-promo (C++ and Objective-C++ only)
3383 Warn when overload resolution chooses a promotion from unsigned or
3384 enumerated type to a signed type, over a conversion to an unsigned
3385 type of the same size. Previous versions of G++ tried to preserve
3386 unsignedness, but the standard mandates the current behavior.
3387
3388 -Wtemplates (C++ and Objective-C++ only)
3389 Warn when a primary template declaration is encountered. Some
3390 coding rules disallow templates, and this may be used to enforce
3391 that rule. The warning is inactive inside a system header file,
3392 such as the STL, so one can still use the STL. One may also
3393 instantiate or specialize templates.
3394
3395 -Wmismatched-new-delete (C++ and Objective-C++ only)
3396 Warn for mismatches between calls to "operator new" or "operator
3397 delete" and the corresponding call to the allocation or
3398 deallocation function. This includes invocations of C++ "operator
3399 delete" with pointers returned from either mismatched forms of
3400 "operator new", or from other functions that allocate objects for
3401 which the "operator delete" isn't a suitable deallocator, as well
3402 as calls to other deallocation functions with pointers returned
3403 from "operator new" for which the deallocation function isn't
3404 suitable.
3405
3406 For example, the "delete" expression in the function below is
3407 diagnosed because it doesn't match the array form of the "new"
3408 expression the pointer argument was returned from. Similarly, the
3409 call to "free" is also diagnosed.
3410
3411 void f ()
3412 {
3413 int *a = new int[n];
3414 delete a; // warning: mismatch in array forms of expressions
3415
3416 char *p = new char[n];
3417 free (p); // warning: mismatch between new and free
3418 }
3419
3420 The related option -Wmismatched-dealloc diagnoses mismatches
3421 involving allocation and deallocation functions other than
3422 "operator new" and "operator delete".
3423
3424 -Wmismatched-new-delete is included in -Wall.
3425
3426 -Wmismatched-tags (C++ and Objective-C++ only)
3427 Warn for declarations of structs, classes, and class templates and
3428 their specializations with a class-key that does not match either
3429 the definition or the first declaration if no definition is
3430 provided.
3431
3432 For example, the declaration of "struct Object" in the argument
3433 list of "draw" triggers the warning. To avoid it, either remove
3434 the redundant class-key "struct" or replace it with "class" to
3435 match its definition.
3436
3437 class Object {
3438 public:
3439 virtual ~Object () = 0;
3440 };
3441 void draw (struct Object*);
3442
3443 It is not wrong to declare a class with the class-key "struct" as
3444 the example above shows. The -Wmismatched-tags option is intended
3445 to help achieve a consistent style of class declarations. In code
3446 that is intended to be portable to Windows-based compilers the
3447 warning helps prevent unresolved references due to the difference
3448 in the mangling of symbols declared with different class-keys. The
3449 option can be used either on its own or in conjunction with
3450 -Wredundant-tags.
3451
3452 -Wmultiple-inheritance (C++ and Objective-C++ only)
3453 Warn when a class is defined with multiple direct base classes.
3454 Some coding rules disallow multiple inheritance, and this may be
3455 used to enforce that rule. The warning is inactive inside a system
3456 header file, such as the STL, so one can still use the STL. One
3457 may also define classes that indirectly use multiple inheritance.
3458
3459 -Wvirtual-inheritance
3460 Warn when a class is defined with a virtual direct base class.
3461 Some coding rules disallow multiple inheritance, and this may be
3462 used to enforce that rule. The warning is inactive inside a system
3463 header file, such as the STL, so one can still use the STL. One
3464 may also define classes that indirectly use virtual inheritance.
3465
3466 -Wno-virtual-move-assign
3467 Suppress warnings about inheriting from a virtual base with a non-
3468 trivial C++11 move assignment operator. This is dangerous because
3469 if the virtual base is reachable along more than one path, it is
3470 moved multiple times, which can mean both objects end up in the
3471 moved-from state. If the move assignment operator is written to
3472 avoid moving from a moved-from object, this warning can be
3473 disabled.
3474
3475 -Wnamespaces
3476 Warn when a namespace definition is opened. Some coding rules
3477 disallow namespaces, and this may be used to enforce that rule.
3478 The warning is inactive inside a system header file, such as the
3479 STL, so one can still use the STL. One may also use using
3480 directives and qualified names.
3481
3482 -Wno-terminate (C++ and Objective-C++ only)
3483 Disable the warning about a throw-expression that will immediately
3484 result in a call to "terminate".
3485
3486 -Wno-vexing-parse (C++ and Objective-C++ only)
3487 Warn about the most vexing parse syntactic ambiguity. This warns
3488 about the cases when a declaration looks like a variable
3489 definition, but the C++ language requires it to be interpreted as a
3490 function declaration. For instance:
3491
3492 void f(double a) {
3493 int i(); // extern int i (void);
3494 int n(int(a)); // extern int n (int);
3495 }
3496
3497 Another example:
3498
3499 struct S { S(int); };
3500 void f(double a) {
3501 S x(int(a)); // extern struct S x (int);
3502 S y(int()); // extern struct S y (int (*) (void));
3503 S z(); // extern struct S z (void);
3504 }
3505
3506 The warning will suggest options how to deal with such an
3507 ambiguity; e.g., it can suggest removing the parentheses or using
3508 braces instead.
3509
3510 This warning is enabled by default.
3511
3512 -Wno-class-conversion (C++ and Objective-C++ only)
3513 Do not warn when a conversion function converts an object to the
3514 same type, to a base class of that type, or to void; such a
3515 conversion function will never be called.
3516
3517 -Wvolatile (C++ and Objective-C++ only)
3518 Warn about deprecated uses of the "volatile" qualifier. This
3519 includes postfix and prefix "++" and "--" expressions of
3520 "volatile"-qualified types, using simple assignments where the left
3521 operand is a "volatile"-qualified non-class type for their value,
3522 compound assignments where the left operand is a
3523 "volatile"-qualified non-class type, "volatile"-qualified function
3524 return type, "volatile"-qualified parameter type, and structured
3525 bindings of a "volatile"-qualified type. This usage was deprecated
3526 in C++20.
3527
3528 Enabled by default with -std=c++20.
3529
3530 -Wzero-as-null-pointer-constant (C++ and Objective-C++ only)
3531 Warn when a literal 0 is used as null pointer constant. This can
3532 be useful to facilitate the conversion to "nullptr" in C++11.
3533
3534 -Waligned-new
3535 Warn about a new-expression of a type that requires greater
3536 alignment than the alignof(std::max_align_t) but uses an allocation
3537 function without an explicit alignment parameter. This option is
3538 enabled by -Wall.
3539
3540 Normally this only warns about global allocation functions, but
3541 -Waligned-new=all also warns about class member allocation
3542 functions.
3543
3544 -Wno-placement-new
3545 -Wplacement-new=n
3546 Warn about placement new expressions with undefined behavior, such
3547 as constructing an object in a buffer that is smaller than the type
3548 of the object. For example, the placement new expression below is
3549 diagnosed because it attempts to construct an array of 64 integers
3550 in a buffer only 64 bytes large.
3551
3552 char buf [64];
3553 new (buf) int[64];
3554
3555 This warning is enabled by default.
3556
3557 -Wplacement-new=1
3558 This is the default warning level of -Wplacement-new. At this
3559 level the warning is not issued for some strictly undefined
3560 constructs that GCC allows as extensions for compatibility with
3561 legacy code. For example, the following "new" expression is
3562 not diagnosed at this level even though it has undefined
3563 behavior according to the C++ standard because it writes past
3564 the end of the one-element array.
3565
3566 struct S { int n, a[1]; };
3567 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
3568 new (s->a)int [32]();
3569
3570 -Wplacement-new=2
3571 At this level, in addition to diagnosing all the same
3572 constructs as at level 1, a diagnostic is also issued for
3573 placement new expressions that construct an object in the last
3574 member of structure whose type is an array of a single element
3575 and whose size is less than the size of the object being
3576 constructed. While the previous example would be diagnosed,
3577 the following construct makes use of the flexible member array
3578 extension to avoid the warning at level 2.
3579
3580 struct S { int n, a[]; };
3581 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
3582 new (s->a)int [32]();
3583
3584 -Wcatch-value
3585 -Wcatch-value=n (C++ and Objective-C++ only)
3586 Warn about catch handlers that do not catch via reference. With
3587 -Wcatch-value=1 (or -Wcatch-value for short) warn about polymorphic
3588 class types that are caught by value. With -Wcatch-value=2 warn
3589 about all class types that are caught by value. With
3590 -Wcatch-value=3 warn about all types that are not caught by
3591 reference. -Wcatch-value is enabled by -Wall.
3592
3593 -Wconditionally-supported (C++ and Objective-C++ only)
3594 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
3595
3596 -Wno-delete-incomplete (C++ and Objective-C++ only)
3597 Do not warn when deleting a pointer to incomplete type, which may
3598 cause undefined behavior at runtime. This warning is enabled by
3599 default.
3600
3601 -Wextra-semi (C++, Objective-C++ only)
3602 Warn about redundant semicolons after in-class function
3603 definitions.
3604
3605 -Wno-inaccessible-base (C++, Objective-C++ only)
3606 This option controls warnings when a base class is inaccessible in
3607 a class derived from it due to ambiguity. The warning is enabled
3608 by default. Note that the warning for ambiguous virtual bases is
3609 enabled by the -Wextra option.
3610
3611 struct A { int a; };
3612
3613 struct B : A { };
3614
3615 struct C : B, A { };
3616
3617 -Wno-inherited-variadic-ctor
3618 Suppress warnings about use of C++11 inheriting constructors when
3619 the base class inherited from has a C variadic constructor; the
3620 warning is on by default because the ellipsis is not inherited.
3621
3622 -Wno-invalid-offsetof (C++ and Objective-C++ only)
3623 Suppress warnings from applying the "offsetof" macro to a non-POD
3624 type. According to the 2014 ISO C++ standard, applying "offsetof"
3625 to a non-standard-layout type is undefined. In existing C++
3626 implementations, however, "offsetof" typically gives meaningful
3627 results. This flag is for users who are aware that they are
3628 writing nonportable code and who have deliberately chosen to ignore
3629 the warning about it.
3630
3631 The restrictions on "offsetof" may be relaxed in a future version
3632 of the C++ standard.
3633
3634 -Wsized-deallocation (C++ and Objective-C++ only)
3635 Warn about a definition of an unsized deallocation function
3636
3637 void operator delete (void *) noexcept;
3638 void operator delete[] (void *) noexcept;
3639
3640 without a definition of the corresponding sized deallocation
3641 function
3642
3643 void operator delete (void *, std::size_t) noexcept;
3644 void operator delete[] (void *, std::size_t) noexcept;
3645
3646 or vice versa. Enabled by -Wextra along with -fsized-deallocation.
3647
3648 -Wsuggest-final-types
3649 Warn about types with virtual methods where code quality would be
3650 improved if the type were declared with the C++11 "final"
3651 specifier, or, if possible, declared in an anonymous namespace.
3652 This allows GCC to more aggressively devirtualize the polymorphic
3653 calls. This warning is more effective with link-time optimization,
3654 where the information about the class hierarchy graph is more
3655 complete.
3656
3657 -Wsuggest-final-methods
3658 Warn about virtual methods where code quality would be improved if
3659 the method were declared with the C++11 "final" specifier, or, if
3660 possible, its type were declared in an anonymous namespace or with
3661 the "final" specifier. This warning is more effective with link-
3662 time optimization, where the information about the class hierarchy
3663 graph is more complete. It is recommended to first consider
3664 suggestions of -Wsuggest-final-types and then rebuild with new
3665 annotations.
3666
3667 -Wsuggest-override
3668 Warn about overriding virtual functions that are not marked with
3669 the "override" keyword.
3670
3671 -Wuse-after-free
3672 -Wuse-after-free=n
3673 Warn about uses of pointers to dynamically allocated objects that
3674 have been rendered indeterminate by a call to a deallocation
3675 function. The warning is enabled at all optimization levels but
3676 may yield different results with optimization than without.
3677
3678 -Wuse-after-free=1
3679 At level 1 the warning attempts to diagnose only unconditional
3680 uses of pointers made indeterminate by a deallocation call or a
3681 successful call to "realloc", regardless of whether or not the
3682 call resulted in an actual reallocatio of memory. This
3683 includes double-"free" calls as well as uses in arithmetic and
3684 relational expressions. Although undefined, uses of
3685 indeterminate pointers in equality (or inequality) expressions
3686 are not diagnosed at this level.
3687
3688 -Wuse-after-free=2
3689 At level 2, in addition to unconditional uses, the warning also
3690 diagnoses conditional uses of pointers made indeterminate by a
3691 deallocation call. As at level 2, uses in equality (or
3692 inequality) expressions are not diagnosed. For example, the
3693 second call to "free" in the following function is diagnosed at
3694 this level:
3695
3696 struct A { int refcount; void *data; };
3697
3698 void release (struct A *p)
3699 {
3700 int refcount = --p->refcount;
3701 free (p);
3702 if (refcount == 0)
3703 free (p->data); // warning: p may be used after free
3704 }
3705
3706 -Wuse-after-free=3
3707 At level 3, the warning also diagnoses uses of indeterminate
3708 pointers in equality expressions. All uses of indeterminate
3709 pointers are undefined but equality tests sometimes appear
3710 after calls to "realloc" as an attempt to determine whether the
3711 call resulted in relocating the object to a different address.
3712 They are diagnosed at a separate level to aid legacy code
3713 gradually transition to safe alternatives. For example, the
3714 equality test in the function below is diagnosed at this level:
3715
3716 void adjust_pointers (int**, int);
3717
3718 void grow (int **p, int n)
3719 {
3720 int **q = (int**)realloc (p, n *= 2);
3721 if (q == p)
3722 return;
3723 adjust_pointers ((int**)q, n);
3724 }
3725
3726 To avoid the warning at this level, store offsets into
3727 allocated memory instead of pointers. This approach obviates
3728 needing to adjust the stored pointers after reallocation.
3729
3730 -Wuse-after-free=2 is included in -Wall.
3731
3732 -Wuseless-cast (C++ and Objective-C++ only)
3733 Warn when an expression is cast to its own type. This warning does
3734 not occur when a class object is converted to a non-reference type
3735 as that is a way to create a temporary:
3736
3737 struct S { };
3738 void g (S&&);
3739 void f (S&& arg)
3740 {
3741 g (S(arg)); // make arg prvalue so that it can bind to S&&
3742 }
3743
3744 -Wno-conversion-null (C++ and Objective-C++ only)
3745 Do not warn for conversions between "NULL" and non-pointer types.
3746 -Wconversion-null is enabled by default.
3747
3748 Options Controlling Objective-C and Objective-C++ Dialects
3749 (NOTE: This manual does not describe the Objective-C and Objective-C++
3750 languages themselves.
3751
3752 This section describes the command-line options that are only
3753 meaningful for Objective-C and Objective-C++ programs. You can also
3754 use most of the language-independent GNU compiler options. For
3755 example, you might compile a file some_class.m like this:
3756
3757 gcc -g -fgnu-runtime -O -c some_class.m
3758
3759 In this example, -fgnu-runtime is an option meant only for Objective-C
3760 and Objective-C++ programs; you can use the other options with any
3761 language supported by GCC.
3762
3763 Note that since Objective-C is an extension of the C language,
3764 Objective-C compilations may also use options specific to the C front-
3765 end (e.g., -Wtraditional). Similarly, Objective-C++ compilations may
3766 use C++-specific options (e.g., -Wabi).
3767
3768 Here is a list of options that are only for compiling Objective-C and
3769 Objective-C++ programs:
3770
3771 -fconstant-string-class=class-name
3772 Use class-name as the name of the class to instantiate for each
3773 literal string specified with the syntax "@"..."". The default
3774 class name is "NXConstantString" if the GNU runtime is being used,
3775 and "NSConstantString" if the NeXT runtime is being used (see
3776 below). The -fconstant-cfstrings option, if also present,
3777 overrides the -fconstant-string-class setting and cause "@"...""
3778 literals to be laid out as constant CoreFoundation strings.
3779
3780 -fgnu-runtime
3781 Generate object code compatible with the standard GNU Objective-C
3782 runtime. This is the default for most types of systems.
3783
3784 -fnext-runtime
3785 Generate output compatible with the NeXT runtime. This is the
3786 default for NeXT-based systems, including Darwin and Mac OS X. The
3787 macro "__NEXT_RUNTIME__" is predefined if (and only if) this option
3788 is used.
3789
3790 -fno-nil-receivers
3791 Assume that all Objective-C message dispatches ("[receiver
3792 message:arg]") in this translation unit ensure that the receiver is
3793 not "nil". This allows for more efficient entry points in the
3794 runtime to be used. This option is only available in conjunction
3795 with the NeXT runtime and ABI version 0 or 1.
3796
3797 -fobjc-abi-version=n
3798 Use version n of the Objective-C ABI for the selected runtime.
3799 This option is currently supported only for the NeXT runtime. In
3800 that case, Version 0 is the traditional (32-bit) ABI without
3801 support for properties and other Objective-C 2.0 additions.
3802 Version 1 is the traditional (32-bit) ABI with support for
3803 properties and other Objective-C 2.0 additions. Version 2 is the
3804 modern (64-bit) ABI. If nothing is specified, the default is
3805 Version 0 on 32-bit target machines, and Version 2 on 64-bit target
3806 machines.
3807
3808 -fobjc-call-cxx-cdtors
3809 For each Objective-C class, check if any of its instance variables
3810 is a C++ object with a non-trivial default constructor. If so,
3811 synthesize a special "- (id) .cxx_construct" instance method which
3812 runs non-trivial default constructors on any such instance
3813 variables, in order, and then return "self". Similarly, check if
3814 any instance variable is a C++ object with a non-trivial
3815 destructor, and if so, synthesize a special "- (void)
3816 .cxx_destruct" method which runs all such default destructors, in
3817 reverse order.
3818
3819 The "- (id) .cxx_construct" and "- (void) .cxx_destruct" methods
3820 thusly generated only operate on instance variables declared in the
3821 current Objective-C class, and not those inherited from
3822 superclasses. It is the responsibility of the Objective-C runtime
3823 to invoke all such methods in an object's inheritance hierarchy.
3824 The "- (id) .cxx_construct" methods are invoked by the runtime
3825 immediately after a new object instance is allocated; the "- (void)
3826 .cxx_destruct" methods are invoked immediately before the runtime
3827 deallocates an object instance.
3828
3829 As of this writing, only the NeXT runtime on Mac OS X 10.4 and
3830 later has support for invoking the "- (id) .cxx_construct" and "-
3831 (void) .cxx_destruct" methods.
3832
3833 -fobjc-direct-dispatch
3834 Allow fast jumps to the message dispatcher. On Darwin this is
3835 accomplished via the comm page.
3836
3837 -fobjc-exceptions
3838 Enable syntactic support for structured exception handling in
3839 Objective-C, similar to what is offered by C++. This option is
3840 required to use the Objective-C keywords @try, @throw, @catch,
3841 @finally and @synchronized. This option is available with both the
3842 GNU runtime and the NeXT runtime (but not available in conjunction
3843 with the NeXT runtime on Mac OS X 10.2 and earlier).
3844
3845 -fobjc-gc
3846 Enable garbage collection (GC) in Objective-C and Objective-C++
3847 programs. This option is only available with the NeXT runtime; the
3848 GNU runtime has a different garbage collection implementation that
3849 does not require special compiler flags.
3850
3851 -fobjc-nilcheck
3852 For the NeXT runtime with version 2 of the ABI, check for a nil
3853 receiver in method invocations before doing the actual method call.
3854 This is the default and can be disabled using -fno-objc-nilcheck.
3855 Class methods and super calls are never checked for nil in this way
3856 no matter what this flag is set to. Currently this flag does
3857 nothing when the GNU runtime, or an older version of the NeXT
3858 runtime ABI, is used.
3859
3860 -fobjc-std=objc1
3861 Conform to the language syntax of Objective-C 1.0, the language
3862 recognized by GCC 4.0. This only affects the Objective-C additions
3863 to the C/C++ language; it does not affect conformance to C/C++
3864 standards, which is controlled by the separate C/C++ dialect option
3865 flags. When this option is used with the Objective-C or
3866 Objective-C++ compiler, any Objective-C syntax that is not
3867 recognized by GCC 4.0 is rejected. This is useful if you need to
3868 make sure that your Objective-C code can be compiled with older
3869 versions of GCC.
3870
3871 -freplace-objc-classes
3872 Emit a special marker instructing ld(1) not to statically link in
3873 the resulting object file, and allow dyld(1) to load it in at run
3874 time instead. This is used in conjunction with the Fix-and-
3875 Continue debugging mode, where the object file in question may be
3876 recompiled and dynamically reloaded in the course of program
3877 execution, without the need to restart the program itself.
3878 Currently, Fix-and-Continue functionality is only available in
3879 conjunction with the NeXT runtime on Mac OS X 10.3 and later.
3880
3881 -fzero-link
3882 When compiling for the NeXT runtime, the compiler ordinarily
3883 replaces calls to objc_getClass("...") (when the name of the class
3884 is known at compile time) with static class references that get
3885 initialized at load time, which improves run-time performance.
3886 Specifying the -fzero-link flag suppresses this behavior and causes
3887 calls to objc_getClass("...") to be retained. This is useful in
3888 Zero-Link debugging mode, since it allows for individual class
3889 implementations to be modified during program execution. The GNU
3890 runtime currently always retains calls to objc_get_class("...")
3891 regardless of command-line options.
3892
3893 -fno-local-ivars
3894 By default instance variables in Objective-C can be accessed as if
3895 they were local variables from within the methods of the class
3896 they're declared in. This can lead to shadowing between instance
3897 variables and other variables declared either locally inside a
3898 class method or globally with the same name. Specifying the
3899 -fno-local-ivars flag disables this behavior thus avoiding variable
3900 shadowing issues.
3901
3902 -fivar-visibility=[public|protected|private|package]
3903 Set the default instance variable visibility to the specified
3904 option so that instance variables declared outside the scope of any
3905 access modifier directives default to the specified visibility.
3906
3907 -gen-decls
3908 Dump interface declarations for all classes seen in the source file
3909 to a file named sourcename.decl.
3910
3911 -Wassign-intercept (Objective-C and Objective-C++ only)
3912 Warn whenever an Objective-C assignment is being intercepted by the
3913 garbage collector.
3914
3915 -Wno-property-assign-default (Objective-C and Objective-C++ only)
3916 Do not warn if a property for an Objective-C object has no assign
3917 semantics specified.
3918
3919 -Wno-protocol (Objective-C and Objective-C++ only)
3920 If a class is declared to implement a protocol, a warning is issued
3921 for every method in the protocol that is not implemented by the
3922 class. The default behavior is to issue a warning for every method
3923 not explicitly implemented in the class, even if a method
3924 implementation is inherited from the superclass. If you use the
3925 -Wno-protocol option, then methods inherited from the superclass
3926 are considered to be implemented, and no warning is issued for
3927 them.
3928
3929 -Wobjc-root-class (Objective-C and Objective-C++ only)
3930 Warn if a class interface lacks a superclass. Most classes will
3931 inherit from "NSObject" (or "Object") for example. When declaring
3932 classes intended to be root classes, the warning can be suppressed
3933 by marking their interfaces with
3934 "__attribute__((objc_root_class))".
3935
3936 -Wselector (Objective-C and Objective-C++ only)
3937 Warn if multiple methods of different types for the same selector
3938 are found during compilation. The check is performed on the list
3939 of methods in the final stage of compilation. Additionally, a
3940 check is performed for each selector appearing in a @selector(...)
3941 expression, and a corresponding method for that selector has been
3942 found during compilation. Because these checks scan the method
3943 table only at the end of compilation, these warnings are not
3944 produced if the final stage of compilation is not reached, for
3945 example because an error is found during compilation, or because
3946 the -fsyntax-only option is being used.
3947
3948 -Wstrict-selector-match (Objective-C and Objective-C++ only)
3949 Warn if multiple methods with differing argument and/or return
3950 types are found for a given selector when attempting to send a
3951 message using this selector to a receiver of type "id" or "Class".
3952 When this flag is off (which is the default behavior), the compiler
3953 omits such warnings if any differences found are confined to types
3954 that share the same size and alignment.
3955
3956 -Wundeclared-selector (Objective-C and Objective-C++ only)
3957 Warn if a @selector(...) expression referring to an undeclared
3958 selector is found. A selector is considered undeclared if no
3959 method with that name has been declared before the @selector(...)
3960 expression, either explicitly in an @interface or @protocol
3961 declaration, or implicitly in an @implementation section. This
3962 option always performs its checks as soon as a @selector(...)
3963 expression is found, while -Wselector only performs its checks in
3964 the final stage of compilation. This also enforces the coding
3965 style convention that methods and selectors must be declared before
3966 being used.
3967
3968 -print-objc-runtime-info
3969 Generate C header describing the largest structure that is passed
3970 by value, if any.
3971
3972 Options to Control Diagnostic Messages Formatting
3973 Traditionally, diagnostic messages have been formatted irrespective of
3974 the output device's aspect (e.g. its width, ...). You can use the
3975 options described below to control the formatting algorithm for
3976 diagnostic messages, e.g. how many characters per line, how often
3977 source location information should be reported. Note that some
3978 language front ends may not honor these options.
3979
3980 -fmessage-length=n
3981 Try to format error messages so that they fit on lines of about n
3982 characters. If n is zero, then no line-wrapping is done; each
3983 error message appears on a single line. This is the default for
3984 all front ends.
3985
3986 Note - this option also affects the display of the #error and
3987 #warning pre-processor directives, and the deprecated
3988 function/type/variable attribute. It does not however affect the
3989 pragma GCC warning and pragma GCC error pragmas.
3990
3991 -fdiagnostics-plain-output
3992 This option requests that diagnostic output look as plain as
3993 possible, which may be useful when running dejagnu or other
3994 utilities that need to parse diagnostics output and prefer that it
3995 remain more stable over time. -fdiagnostics-plain-output is
3996 currently equivalent to the following options:
3997 -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
3998 -fdiagnostics-color=never -fdiagnostics-urls=never
3999 -fdiagnostics-path-format=separate-events In the future, if GCC
4000 changes the default appearance of its diagnostics, the
4001 corresponding option to disable the new behavior will be added to
4002 this list.
4003
4004 -fdiagnostics-show-location=once
4005 Only meaningful in line-wrapping mode. Instructs the diagnostic
4006 messages reporter to emit source location information once; that
4007 is, in case the message is too long to fit on a single physical
4008 line and has to be wrapped, the source location won't be emitted
4009 (as prefix) again, over and over, in subsequent continuation lines.
4010 This is the default behavior.
4011
4012 -fdiagnostics-show-location=every-line
4013 Only meaningful in line-wrapping mode. Instructs the diagnostic
4014 messages reporter to emit the same source location information (as
4015 prefix) for physical lines that result from the process of breaking
4016 a message which is too long to fit on a single line.
4017
4018 -fdiagnostics-color[=WHEN]
4019 -fno-diagnostics-color
4020 Use color in diagnostics. WHEN is never, always, or auto. The
4021 default depends on how the compiler has been configured, it can be
4022 any of the above WHEN options or also never if GCC_COLORS
4023 environment variable isn't present in the environment, and auto
4024 otherwise. auto makes GCC use color only when the standard error
4025 is a terminal, and when not executing in an emacs shell. The forms
4026 -fdiagnostics-color and -fno-diagnostics-color are aliases for
4027 -fdiagnostics-color=always and -fdiagnostics-color=never,
4028 respectively.
4029
4030 The colors are defined by the environment variable GCC_COLORS. Its
4031 value is a colon-separated list of capabilities and Select Graphic
4032 Rendition (SGR) substrings. SGR commands are interpreted by the
4033 terminal or terminal emulator. (See the section in the
4034 documentation of your text terminal for permitted values and their
4035 meanings as character attributes.) These substring values are
4036 integers in decimal representation and can be concatenated with
4037 semicolons. Common values to concatenate include 1 for bold, 4 for
4038 underline, 5 for blink, 7 for inverse, 39 for default foreground
4039 color, 30 to 37 for foreground colors, 90 to 97 for 16-color mode
4040 foreground colors, 38;5;0 to 38;5;255 for 88-color and 256-color
4041 modes foreground colors, 49 for default background color, 40 to 47
4042 for background colors, 100 to 107 for 16-color mode background
4043 colors, and 48;5;0 to 48;5;255 for 88-color and 256-color modes
4044 background colors.
4045
4046 The default GCC_COLORS is
4047
4048 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
4049 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
4050 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
4051 type-diff=01;32:fnname=01;32:targs=35
4052
4053 where 01;31 is bold red, 01;35 is bold magenta, 01;36 is bold cyan,
4054 32 is green, 34 is blue, 01 is bold, and 31 is red. Setting
4055 GCC_COLORS to the empty string disables colors. Supported
4056 capabilities are as follows.
4057
4058 "error="
4059 SGR substring for error: markers.
4060
4061 "warning="
4062 SGR substring for warning: markers.
4063
4064 "note="
4065 SGR substring for note: markers.
4066
4067 "path="
4068 SGR substring for colorizing paths of control-flow events as
4069 printed via -fdiagnostics-path-format=, such as the identifiers
4070 of individual events and lines indicating interprocedural calls
4071 and returns.
4072
4073 "range1="
4074 SGR substring for first additional range.
4075
4076 "range2="
4077 SGR substring for second additional range.
4078
4079 "locus="
4080 SGR substring for location information, file:line or
4081 file:line:column etc.
4082
4083 "quote="
4084 SGR substring for information printed within quotes.
4085
4086 "fnname="
4087 SGR substring for names of C++ functions.
4088
4089 "targs="
4090 SGR substring for C++ function template parameter bindings.
4091
4092 "fixit-insert="
4093 SGR substring for fix-it hints suggesting text to be inserted
4094 or replaced.
4095
4096 "fixit-delete="
4097 SGR substring for fix-it hints suggesting text to be deleted.
4098
4099 "diff-filename="
4100 SGR substring for filename headers within generated patches.
4101
4102 "diff-hunk="
4103 SGR substring for the starts of hunks within generated patches.
4104
4105 "diff-delete="
4106 SGR substring for deleted lines within generated patches.
4107
4108 "diff-insert="
4109 SGR substring for inserted lines within generated patches.
4110
4111 "type-diff="
4112 SGR substring for highlighting mismatching types within
4113 template arguments in the C++ frontend.
4114
4115 -fdiagnostics-urls[=WHEN]
4116 Use escape sequences to embed URLs in diagnostics. For example,
4117 when -fdiagnostics-show-option emits text showing the command-line
4118 option controlling a diagnostic, embed a URL for documentation of
4119 that option.
4120
4121 WHEN is never, always, or auto. auto makes GCC use URL escape
4122 sequences only when the standard error is a terminal, and when not
4123 executing in an emacs shell or any graphical terminal which is
4124 known to be incompatible with this feature, see below.
4125
4126 The default depends on how the compiler has been configured. It
4127 can be any of the above WHEN options.
4128
4129 GCC can also be configured (via the
4130 --with-diagnostics-urls=auto-if-env configure-time option) so that
4131 the default is affected by environment variables. Under such a
4132 configuration, GCC defaults to using auto if either GCC_URLS or
4133 TERM_URLS environment variables are present and non-empty in the
4134 environment of the compiler, or never if neither are.
4135
4136 However, even with -fdiagnostics-urls=always the behavior is
4137 dependent on those environment variables: If GCC_URLS is set to
4138 empty or no, do not embed URLs in diagnostics. If set to st, URLs
4139 use ST escape sequences. If set to bel, the default, URLs use BEL
4140 escape sequences. Any other non-empty value enables the feature.
4141 If GCC_URLS is not set, use TERM_URLS as a fallback. Note: ST is
4142 an ANSI escape sequence, string terminator ESC \, BEL is an ASCII
4143 character, CTRL-G that usually sounds like a beep.
4144
4145 At this time GCC tries to detect also a few terminals that are
4146 known to not implement the URL feature, and have bugs or at least
4147 had bugs in some versions that are still in use, where the URL
4148 escapes are likely to misbehave, i.e. print garbage on the screen.
4149 That list is currently xfce4-terminal, certain known to be buggy
4150 gnome-terminal versions, the linux console, and mingw. This check
4151 can be skipped with the -fdiagnostics-urls=always.
4152
4153 -fno-diagnostics-show-option
4154 By default, each diagnostic emitted includes text indicating the
4155 command-line option that directly controls the diagnostic (if such
4156 an option is known to the diagnostic machinery). Specifying the
4157 -fno-diagnostics-show-option flag suppresses that behavior.
4158
4159 -fno-diagnostics-show-caret
4160 By default, each diagnostic emitted includes the original source
4161 line and a caret ^ indicating the column. This option suppresses
4162 this information. The source line is truncated to n characters, if
4163 the -fmessage-length=n option is given. When the output is done to
4164 the terminal, the width is limited to the width given by the
4165 COLUMNS environment variable or, if not set, to the terminal width.
4166
4167 -fno-diagnostics-show-labels
4168 By default, when printing source code (via
4169 -fdiagnostics-show-caret), diagnostics can label ranges of source
4170 code with pertinent information, such as the types of expressions:
4171
4172 printf ("foo %s bar", long_i + long_j);
4173 ~^ ~~~~~~~~~~~~~~~
4174 | |
4175 char * long int
4176
4177 This option suppresses the printing of these labels (in the example
4178 above, the vertical bars and the "char *" and "long int" text).
4179
4180 -fno-diagnostics-show-cwe
4181 Diagnostic messages can optionally have an associated
4182 CWE ("https://cwe.mitre.org/index.html") identifier. GCC itself
4183 only provides such metadata for some of the -fanalyzer diagnostics.
4184 GCC plugins may also provide diagnostics with such metadata. By
4185 default, if this information is present, it will be printed with
4186 the diagnostic. This option suppresses the printing of this
4187 metadata.
4188
4189 -fno-diagnostics-show-rules
4190 Diagnostic messages can optionally have rules associated with them,
4191 such as from a coding standard, or a specification. GCC itself
4192 does not do this for any of its diagnostics, but plugins may do so.
4193 By default, if this information is present, it will be printed with
4194 the diagnostic. This option suppresses the printing of this
4195 metadata.
4196
4197 -fno-diagnostics-show-line-numbers
4198 By default, when printing source code (via
4199 -fdiagnostics-show-caret), a left margin is printed, showing line
4200 numbers. This option suppresses this left margin.
4201
4202 -fdiagnostics-minimum-margin-width=width
4203 This option controls the minimum width of the left margin printed
4204 by -fdiagnostics-show-line-numbers. It defaults to 6.
4205
4206 -fdiagnostics-parseable-fixits
4207 Emit fix-it hints in a machine-parseable format, suitable for
4208 consumption by IDEs. For each fix-it, a line will be printed after
4209 the relevant diagnostic, starting with the string "fix-it:". For
4210 example:
4211
4212 fix-it:"test.c":{45:3-45:21}:"gtk_widget_show_all"
4213
4214 The location is expressed as a half-open range, expressed as a
4215 count of bytes, starting at byte 1 for the initial column. In the
4216 above example, bytes 3 through 20 of line 45 of "test.c" are to be
4217 replaced with the given string:
4218
4219 00000000011111111112222222222
4220 12345678901234567890123456789
4221 gtk_widget_showall (dlg);
4222 ^^^^^^^^^^^^^^^^^^
4223 gtk_widget_show_all
4224
4225 The filename and replacement string escape backslash as "\\", tab
4226 as "\t", newline as "\n", double quotes as "\"", non-printable
4227 characters as octal (e.g. vertical tab as "\013").
4228
4229 An empty replacement string indicates that the given range is to be
4230 removed. An empty range (e.g. "45:3-45:3") indicates that the
4231 string is to be inserted at the given position.
4232
4233 -fdiagnostics-generate-patch
4234 Print fix-it hints to stderr in unified diff format, after any
4235 diagnostics are printed. For example:
4236
4237 --- test.c
4238 +++ test.c
4239 @ -42,5 +42,5 @
4240
4241 void show_cb(GtkDialog *dlg)
4242 {
4243 - gtk_widget_showall(dlg);
4244 + gtk_widget_show_all(dlg);
4245 }
4246
4247 The diff may or may not be colorized, following the same rules as
4248 for diagnostics (see -fdiagnostics-color).
4249
4250 -fdiagnostics-show-template-tree
4251 In the C++ frontend, when printing diagnostics showing mismatching
4252 template types, such as:
4253
4254 could not convert 'std::map<int, std::vector<double> >()'
4255 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4256
4257 the -fdiagnostics-show-template-tree flag enables printing a tree-
4258 like structure showing the common and differing parts of the types,
4259 such as:
4260
4261 map<
4262 [...],
4263 vector<
4264 [double != float]>>
4265
4266 The parts that differ are highlighted with color ("double" and
4267 "float" in this case).
4268
4269 -fno-elide-type
4270 By default when the C++ frontend prints diagnostics showing
4271 mismatching template types, common parts of the types are printed
4272 as "[...]" to simplify the error message. For example:
4273
4274 could not convert 'std::map<int, std::vector<double> >()'
4275 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4276
4277 Specifying the -fno-elide-type flag suppresses that behavior. This
4278 flag also affects the output of the
4279 -fdiagnostics-show-template-tree flag.
4280
4281 -fdiagnostics-path-format=KIND
4282 Specify how to print paths of control-flow events for diagnostics
4283 that have such a path associated with them.
4284
4285 KIND is none, separate-events, or inline-events, the default.
4286
4287 none means to not print diagnostic paths.
4288
4289 separate-events means to print a separate "note" diagnostic for
4290 each event within the diagnostic. For example:
4291
4292 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
4293 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
4294 test.c:27:3: note: (2) when 'i < count'
4295 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4296
4297 inline-events means to print the events "inline" within the source
4298 code. This view attempts to consolidate the events into runs of
4299 sufficiently-close events, printing them as labelled ranges within
4300 the source.
4301
4302 For example, the same events as above might be printed as:
4303
4304 'test': events 1-3
4305 |
4306 | 25 | list = PyList_New(0);
4307 | | ^~~~~~~~~~~~~
4308 | | |
4309 | | (1) when 'PyList_New' fails, returning NULL
4310 | 26 |
4311 | 27 | for (i = 0; i < count; i++) {
4312 | | ~~~
4313 | | |
4314 | | (2) when 'i < count'
4315 | 28 | item = PyLong_FromLong(random());
4316 | 29 | PyList_Append(list, item);
4317 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
4318 | | |
4319 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4320 |
4321
4322 Interprocedural control flow is shown by grouping the events by
4323 stack frame, and using indentation to show how stack frames are
4324 nested, pushed, and popped.
4325
4326 For example:
4327
4328 'test': events 1-2
4329 |
4330 | 133 | {
4331 | | ^
4332 | | |
4333 | | (1) entering 'test'
4334 | 134 | boxed_int *obj = make_boxed_int (i);
4335 | | ~~~~~~~~~~~~~~~~~~
4336 | | |
4337 | | (2) calling 'make_boxed_int'
4338 |
4339 +--> 'make_boxed_int': events 3-4
4340 |
4341 | 120 | {
4342 | | ^
4343 | | |
4344 | | (3) entering 'make_boxed_int'
4345 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
4346 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4347 | | |
4348 | | (4) calling 'wrapped_malloc'
4349 |
4350 +--> 'wrapped_malloc': events 5-6
4351 |
4352 | 7 | {
4353 | | ^
4354 | | |
4355 | | (5) entering 'wrapped_malloc'
4356 | 8 | return malloc (size);
4357 | | ~~~~~~~~~~~~~
4358 | | |
4359 | | (6) calling 'malloc'
4360 |
4361 <-------------+
4362 |
4363 'test': event 7
4364 |
4365 | 138 | free_boxed_int (obj);
4366 | | ^~~~~~~~~~~~~~~~~~~~
4367 | | |
4368 | | (7) calling 'free_boxed_int'
4369 |
4370 (etc)
4371
4372 -fdiagnostics-show-path-depths
4373 This option provides additional information when printing control-
4374 flow paths associated with a diagnostic.
4375
4376 If this is option is provided then the stack depth will be printed
4377 for each run of events within
4378 -fdiagnostics-path-format=inline-events. If provided with
4379 -fdiagnostics-path-format=separate-events, then the stack depth and
4380 function declaration will be appended when printing each event.
4381
4382 This is intended for use by GCC developers and plugin developers
4383 when debugging diagnostics that report interprocedural control
4384 flow.
4385
4386 -fno-show-column
4387 Do not print column numbers in diagnostics. This may be necessary
4388 if diagnostics are being scanned by a program that does not
4389 understand the column numbers, such as dejagnu.
4390
4391 -fdiagnostics-column-unit=UNIT
4392 Select the units for the column number. This affects traditional
4393 diagnostics (in the absence of -fno-show-column), as well as JSON
4394 format diagnostics if requested.
4395
4396 The default UNIT, display, considers the number of display columns
4397 occupied by each character. This may be larger than the number of
4398 bytes required to encode the character, in the case of tab
4399 characters, or it may be smaller, in the case of multibyte
4400 characters. For example, the character "GREEK SMALL LETTER PI
4401 (U+03C0)" occupies one display column, and its UTF-8 encoding
4402 requires two bytes; the character "SLIGHTLY SMILING FACE (U+1F642)"
4403 occupies two display columns, and its UTF-8 encoding requires four
4404 bytes.
4405
4406 Setting UNIT to byte changes the column number to the raw byte
4407 count in all cases, as was traditionally output by GCC prior to
4408 version 11.1.0.
4409
4410 -fdiagnostics-column-origin=ORIGIN
4411 Select the origin for column numbers, i.e. the column number
4412 assigned to the first column. The default value of 1 corresponds
4413 to traditional GCC behavior and to the GNU style guide. Some
4414 utilities may perform better with an origin of 0; any non-negative
4415 value may be specified.
4416
4417 -fdiagnostics-escape-format=FORMAT
4418 When GCC prints pertinent source lines for a diagnostic it normally
4419 attempts to print the source bytes directly. However, some
4420 diagnostics relate to encoding issues in the source file, such as
4421 malformed UTF-8, or issues with Unicode normalization. These
4422 diagnostics are flagged so that GCC will escape bytes that are not
4423 printable ASCII when printing their pertinent source lines.
4424
4425 This option controls how such bytes should be escaped.
4426
4427 The default FORMAT, unicode displays Unicode characters that are
4428 not printable ASCII in the form <U+XXXX>, and bytes that do not
4429 correspond to a Unicode character validly-encoded in UTF-8-encoded
4430 will be displayed as hexadecimal in the form <XX>.
4431
4432 For example, a source line containing the string before followed by
4433 the Unicode character U+03C0 ("GREEK SMALL LETTER PI", with UTF-8
4434 encoding 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8
4435 trailing byte), followed by the string after will be printed for
4436 such a diagnostic as:
4437
4438 before<U+03C0><BF>after
4439
4440 Setting FORMAT to bytes will display all non-printable-ASCII bytes
4441 in the form <XX>, thus showing the underlying encoding of non-ASCII
4442 Unicode characters. For the example above, the following will be
4443 printed:
4444
4445 before<CF><80><BF>after
4446
4447 -fdiagnostics-format=FORMAT
4448 Select a different format for printing diagnostics. FORMAT is
4449 text, sarif-stderr, sarif-file, json, json-stderr, or json-file.
4450
4451 The default is text.
4452
4453 The sarif-stderr and sarif-file formats both emit diagnostics in
4454 SARIF Version 2.1.0 format, either to stderr, or to a file named
4455 source.sarif, respectively.
4456
4457 The json format is a synonym for json-stderr. The json-stderr and
4458 json-file formats are identical, apart from where the JSON is
4459 emitted to - with the former, the JSON is emitted to stderr,
4460 whereas with json-file it is written to source.gcc.json.
4461
4462 The emitted JSON consists of a top-level JSON array containing JSON
4463 objects representing the diagnostics. The JSON is emitted as one
4464 line, without formatting; the examples below have been formatted
4465 for clarity.
4466
4467 Diagnostics can have child diagnostics. For example, this error
4468 and note:
4469
4470 misleading-indentation.c:15:3: warning: this 'if' clause does not
4471 guard... [-Wmisleading-indentation]
4472 15 | if (flag)
4473 | ^~
4474 misleading-indentation.c:17:5: note: ...this statement, but the latter
4475 is misleadingly indented as if it were guarded by the 'if'
4476 17 | y = 2;
4477 | ^
4478
4479 might be printed in JSON form (after formatting) like this:
4480
4481 [
4482 {
4483 "kind": "warning",
4484 "locations": [
4485 {
4486 "caret": {
4487 "display-column": 3,
4488 "byte-column": 3,
4489 "column": 3,
4490 "file": "misleading-indentation.c",
4491 "line": 15
4492 },
4493 "finish": {
4494 "display-column": 4,
4495 "byte-column": 4,
4496 "column": 4,
4497 "file": "misleading-indentation.c",
4498 "line": 15
4499 }
4500 }
4501 ],
4502 "message": "this \u2018if\u2019 clause does not guard...",
4503 "option": "-Wmisleading-indentation",
4504 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4505 "children": [
4506 {
4507 "kind": "note",
4508 "locations": [
4509 {
4510 "caret": {
4511 "display-column": 5,
4512 "byte-column": 5,
4513 "column": 5,
4514 "file": "misleading-indentation.c",
4515 "line": 17
4516 }
4517 }
4518 ],
4519 "escape-source": false,
4520 "message": "...this statement, but the latter is ..."
4521 }
4522 ]
4523 "escape-source": false,
4524 "column-origin": 1,
4525 }
4526 ]
4527
4528 where the "note" is a child of the "warning".
4529
4530 A diagnostic has a "kind". If this is "warning", then there is an
4531 "option" key describing the command-line option controlling the
4532 warning.
4533
4534 A diagnostic can contain zero or more locations. Each location has
4535 an optional "label" string and up to three positions within it: a
4536 "caret" position and optional "start" and "finish" positions. A
4537 position is described by a "file" name, a "line" number, and three
4538 numbers indicating a column position:
4539
4540 * "display-column" counts display columns, accounting for tabs
4541 and multibyte characters.
4542
4543 * "byte-column" counts raw bytes.
4544
4545 * "column" is equal to one of the previous two, as dictated by
4546 the -fdiagnostics-column-unit option.
4547
4548 All three columns are relative to the origin specified by
4549 -fdiagnostics-column-origin, which is typically equal to 1 but may
4550 be set, for instance, to 0 for compatibility with other utilities
4551 that number columns from 0. The column origin is recorded in the
4552 JSON output in the "column-origin" tag. In the remaining examples
4553 below, the extra column number outputs have been omitted for
4554 brevity.
4555
4556 For example, this error:
4557
4558 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' {aka
4559 'struct s'} and 'T' {aka 'struct t'})
4560 64 | return callee_4a () + callee_4b ();
4561 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4562 | | |
4563 | | T {aka struct t}
4564 | S {aka struct s}
4565
4566 has three locations. Its primary location is at the "+" token at
4567 column 23. It has two secondary locations, describing the left and
4568 right-hand sides of the expression, which have labels. It might be
4569 printed in JSON form as:
4570
4571 {
4572 "children": [],
4573 "kind": "error",
4574 "locations": [
4575 {
4576 "caret": {
4577 "column": 23, "file": "bad-binary-ops.c", "line": 64
4578 }
4579 },
4580 {
4581 "caret": {
4582 "column": 10, "file": "bad-binary-ops.c", "line": 64
4583 },
4584 "finish": {
4585 "column": 21, "file": "bad-binary-ops.c", "line": 64
4586 },
4587 "label": "S {aka struct s}"
4588 },
4589 {
4590 "caret": {
4591 "column": 25, "file": "bad-binary-ops.c", "line": 64
4592 },
4593 "finish": {
4594 "column": 36, "file": "bad-binary-ops.c", "line": 64
4595 },
4596 "label": "T {aka struct t}"
4597 }
4598 ],
4599 "escape-source": false,
4600 "message": "invalid operands to binary + ..."
4601 }
4602
4603 If a diagnostic contains fix-it hints, it has a "fixits" array,
4604 consisting of half-open intervals, similar to the output of
4605 -fdiagnostics-parseable-fixits. For example, this diagnostic with
4606 a replacement fix-it hint:
4607
4608 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4609 mean 'color'?
4610 8 | return ptr->colour;
4611 | ^~~~~~
4612 | color
4613
4614 might be printed in JSON form as:
4615
4616 {
4617 "children": [],
4618 "fixits": [
4619 {
4620 "next": {
4621 "column": 21,
4622 "file": "demo.c",
4623 "line": 8
4624 },
4625 "start": {
4626 "column": 15,
4627 "file": "demo.c",
4628 "line": 8
4629 },
4630 "string": "color"
4631 }
4632 ],
4633 "kind": "error",
4634 "locations": [
4635 {
4636 "caret": {
4637 "column": 15,
4638 "file": "demo.c",
4639 "line": 8
4640 },
4641 "finish": {
4642 "column": 20,
4643 "file": "demo.c",
4644 "line": 8
4645 }
4646 }
4647 ],
4648 "escape-source": false,
4649 "message": "\u2018struct s\u2019 has no member named ..."
4650 }
4651
4652 where the fix-it hint suggests replacing the text from "start" up
4653 to but not including "next" with "string"'s value. Deletions are
4654 expressed via an empty value for "string", insertions by having
4655 "start" equal "next".
4656
4657 If the diagnostic has a path of control-flow events associated with
4658 it, it has a "path" array of objects representing the events. Each
4659 event object has a "description" string, a "location" object, along
4660 with a "function" string and a "depth" number for representing
4661 interprocedural paths. The "function" represents the current
4662 function at that event, and the "depth" represents the stack depth
4663 relative to some baseline: the higher, the more frames are within
4664 the stack.
4665
4666 For example, the intraprocedural example shown for
4667 -fdiagnostics-path-format= might have this JSON for its path:
4668
4669 "path": [
4670 {
4671 "depth": 0,
4672 "description": "when 'PyList_New' fails, returning NULL",
4673 "function": "test",
4674 "location": {
4675 "column": 10,
4676 "file": "test.c",
4677 "line": 25
4678 }
4679 },
4680 {
4681 "depth": 0,
4682 "description": "when 'i < count'",
4683 "function": "test",
4684 "location": {
4685 "column": 3,
4686 "file": "test.c",
4687 "line": 27
4688 }
4689 },
4690 {
4691 "depth": 0,
4692 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
4693 "function": "test",
4694 "location": {
4695 "column": 5,
4696 "file": "test.c",
4697 "line": 29
4698 }
4699 }
4700 ]
4701
4702 Diagnostics have a boolean attribute "escape-source", hinting
4703 whether non-ASCII bytes should be escaped when printing the
4704 pertinent lines of source code ("true" for diagnostics involving
4705 source encoding issues).
4706
4707 Options to Request or Suppress Warnings
4708 Warnings are diagnostic messages that report constructions that are not
4709 inherently erroneous but that are risky or suggest there may have been
4710 an error.
4711
4712 The following language-independent options do not enable specific
4713 warnings but control the kinds of diagnostics produced by GCC.
4714
4715 -fsyntax-only
4716 Check the code for syntax errors, but don't do anything beyond
4717 that.
4718
4719 -fmax-errors=n
4720 Limits the maximum number of error messages to n, at which point
4721 GCC bails out rather than attempting to continue processing the
4722 source code. If n is 0 (the default), there is no limit on the
4723 number of error messages produced. If -Wfatal-errors is also
4724 specified, then -Wfatal-errors takes precedence over this option.
4725
4726 -w Inhibit all warning messages.
4727
4728 -Werror
4729 Make all warnings into errors.
4730
4731 -Werror=
4732 Make the specified warning into an error. The specifier for a
4733 warning is appended; for example -Werror=switch turns the warnings
4734 controlled by -Wswitch into errors. This switch takes a negative
4735 form, to be used to negate -Werror for specific warnings; for
4736 example -Wno-error=switch makes -Wswitch warnings not be errors,
4737 even when -Werror is in effect.
4738
4739 The warning message for each controllable warning includes the
4740 option that controls the warning. That option can then be used
4741 with -Werror= and -Wno-error= as described above. (Printing of the
4742 option in the warning message can be disabled using the
4743 -fno-diagnostics-show-option flag.)
4744
4745 Note that specifying -Werror=foo automatically implies -Wfoo.
4746 However, -Wno-error=foo does not imply anything.
4747
4748 -Wfatal-errors
4749 This option causes the compiler to abort compilation on the first
4750 error occurred rather than trying to keep going and printing
4751 further error messages.
4752
4753 You can request many specific warnings with options beginning with -W,
4754 for example -Wimplicit to request warnings on implicit declarations.
4755 Each of these specific warning options also has a negative form
4756 beginning -Wno- to turn off warnings; for example, -Wno-implicit. This
4757 manual lists only one of the two forms, whichever is not the default.
4758 For further language-specific options also refer to C++ Dialect Options
4759 and Objective-C and Objective-C++ Dialect Options. Additional warnings
4760 can be produced by enabling the static analyzer;
4761
4762 Some options, such as -Wall and -Wextra, turn on other options, such as
4763 -Wunused, which may turn on further options, such as -Wunused-value.
4764 The combined effect of positive and negative forms is that more
4765 specific options have priority over less specific ones, independently
4766 of their position in the command-line. For options of the same
4767 specificity, the last one takes effect. Options enabled or disabled via
4768 pragmas take effect as if they appeared at the end of the command-line.
4769
4770 When an unrecognized warning option is requested (e.g.,
4771 -Wunknown-warning), GCC emits a diagnostic stating that the option is
4772 not recognized. However, if the -Wno- form is used, the behavior is
4773 slightly different: no diagnostic is produced for -Wno-unknown-warning
4774 unless other diagnostics are being produced. This allows the use of
4775 new -Wno- options with old compilers, but if something goes wrong, the
4776 compiler warns that an unrecognized option is present.
4777
4778 The effectiveness of some warnings depends on optimizations also being
4779 enabled. For example -Wsuggest-final-types is more effective with link-
4780 time optimization and some instances of other warnings may not be
4781 issued at all unless optimization is enabled. While optimization in
4782 general improves the efficacy of control and data flow sensitive
4783 warnings, in some cases it may also cause false positives.
4784
4785 -Wpedantic
4786 -pedantic
4787 Issue all the warnings demanded by strict ISO C and ISO C++; reject
4788 all programs that use forbidden extensions, and some other programs
4789 that do not follow ISO C and ISO C++. For ISO C, follows the
4790 version of the ISO C standard specified by any -std option used.
4791
4792 Valid ISO C and ISO C++ programs should compile properly with or
4793 without this option (though a rare few require -ansi or a -std
4794 option specifying the required version of ISO C). However, without
4795 this option, certain GNU extensions and traditional C and C++
4796 features are supported as well. With this option, they are
4797 rejected.
4798
4799 -Wpedantic does not cause warning messages for use of the alternate
4800 keywords whose names begin and end with __. This alternate format
4801 can also be used to disable warnings for non-ISO __intN types, i.e.
4802 __intN__. Pedantic warnings are also disabled in the expression
4803 that follows "__extension__". However, only system header files
4804 should use these escape routes; application programs should avoid
4805 them.
4806
4807 Some users try to use -Wpedantic to check programs for strict ISO C
4808 conformance. They soon find that it does not do quite what they
4809 want: it finds some non-ISO practices, but not all---only those for
4810 which ISO C requires a diagnostic, and some others for which
4811 diagnostics have been added.
4812
4813 A feature to report any failure to conform to ISO C might be useful
4814 in some instances, but would require considerable additional work
4815 and would be quite different from -Wpedantic. We don't have plans
4816 to support such a feature in the near future.
4817
4818 Where the standard specified with -std represents a GNU extended
4819 dialect of C, such as gnu90 or gnu99, there is a corresponding base
4820 standard, the version of ISO C on which the GNU extended dialect is
4821 based. Warnings from -Wpedantic are given where they are required
4822 by the base standard. (It does not make sense for such warnings to
4823 be given only for features not in the specified GNU C dialect,
4824 since by definition the GNU dialects of C include all features the
4825 compiler supports with the given option, and there would be nothing
4826 to warn about.)
4827
4828 -pedantic-errors
4829 Give an error whenever the base standard (see -Wpedantic) requires
4830 a diagnostic, in some cases where there is undefined behavior at
4831 compile-time and in some other cases that do not prevent
4832 compilation of programs that are valid according to the standard.
4833 This is not equivalent to -Werror=pedantic, since there are errors
4834 enabled by this option and not enabled by the latter and vice
4835 versa.
4836
4837 -Wall
4838 This enables all the warnings about constructions that some users
4839 consider questionable, and that are easy to avoid (or modify to
4840 prevent the warning), even in conjunction with macros. This also
4841 enables some language-specific warnings described in C++ Dialect
4842 Options and Objective-C and Objective-C++ Dialect Options.
4843
4844 -Wall turns on the following warning flags:
4845
4846 -Waddress -Warray-bounds=1 (only with -O2) -Warray-compare
4847 -Warray-parameter=2 (C and Objective-C only) -Wbool-compare
4848 -Wbool-operation -Wc++11-compat -Wc++14-compat -Wcatch-value (C++
4849 and Objective-C++ only) -Wchar-subscripts -Wcomment
4850 -Wdangling-pointer=2 -Wduplicate-decl-specifier (C and Objective-C
4851 only) -Wenum-compare (in C/ObjC; this is on by default in C++)
4852 -Wenum-int-mismatch (C and Objective-C only) -Wformat
4853 -Wformat-overflow -Wformat-truncation -Wint-in-bool-context
4854 -Wimplicit (C and Objective-C only) -Wimplicit-int (C and
4855 Objective-C only) -Wimplicit-function-declaration (C and Objective-
4856 C only) -Winit-self (only for C++) -Wlogical-not-parentheses -Wmain
4857 (only for C/ObjC and unless -ffreestanding) -Wmaybe-uninitialized
4858 -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation
4859 (only for C/C++) -Wmismatched-dealloc -Wmismatched-new-delete (only
4860 for C/C++) -Wmissing-attributes -Wmissing-braces (only for C/ObjC)
4861 -Wmultistatement-macros -Wnarrowing (only for C++) -Wnonnull
4862 -Wnonnull-compare -Wopenmp-simd -Wparentheses -Wpessimizing-move
4863 (only for C++) -Wpointer-sign -Wrange-loop-construct (only for C++)
4864 -Wreorder -Wrestrict -Wreturn-type -Wself-move (only for C++)
4865 -Wsequence-point -Wsign-compare (only in C++) -Wsizeof-array-div
4866 -Wsizeof-pointer-div -Wsizeof-pointer-memaccess -Wstrict-aliasing
4867 -Wstrict-overflow=1 -Wswitch -Wtautological-compare -Wtrigraphs
4868 -Wuninitialized -Wunknown-pragmas -Wunused-function -Wunused-label
4869 -Wunused-value -Wunused-variable -Wuse-after-free=2 -Wvla-parameter
4870 (C and Objective-C only) -Wvolatile-register-var
4871 -Wzero-length-bounds
4872
4873 Note that some warning flags are not implied by -Wall. Some of
4874 them warn about constructions that users generally do not consider
4875 questionable, but which occasionally you might wish to check for;
4876 others warn about constructions that are necessary or hard to avoid
4877 in some cases, and there is no simple way to modify the code to
4878 suppress the warning. Some of them are enabled by -Wextra but many
4879 of them must be enabled individually.
4880
4881 -Wextra
4882 This enables some extra warning flags that are not enabled by
4883 -Wall. (This option used to be called -W. The older name is still
4884 supported, but the newer name is more descriptive.)
4885
4886 -Wclobbered -Wcast-function-type -Wdeprecated-copy (C++ only)
4887 -Wempty-body -Wenum-conversion (C only) -Wignored-qualifiers
4888 -Wimplicit-fallthrough=3 -Wmissing-field-initializers
4889 -Wmissing-parameter-type (C only) -Wold-style-declaration (C only)
4890 -Woverride-init -Wsign-compare (C only) -Wstring-compare
4891 -Wredundant-move (only for C++) -Wtype-limits -Wuninitialized
4892 -Wshift-negative-value (in C++11 to C++17 and in C99 and newer)
4893 -Wunused-parameter (only with -Wunused or -Wall)
4894 -Wunused-but-set-parameter (only with -Wunused or -Wall)
4895
4896 The option -Wextra also prints warning messages for the following
4897 cases:
4898
4899 * A pointer is compared against integer zero with "<", "<=", ">",
4900 or ">=".
4901
4902 * (C++ only) An enumerator and a non-enumerator both appear in a
4903 conditional expression.
4904
4905 * (C++ only) Ambiguous virtual bases.
4906
4907 * (C++ only) Subscripting an array that has been declared
4908 "register".
4909
4910 * (C++ only) Taking the address of a variable that has been
4911 declared "register".
4912
4913 * (C++ only) A base class is not initialized in the copy
4914 constructor of a derived class.
4915
4916 -Wabi (C, Objective-C, C++ and Objective-C++ only)
4917 Warn about code affected by ABI changes. This includes code that
4918 may not be compatible with the vendor-neutral C++ ABI as well as
4919 the psABI for the particular target.
4920
4921 Since G++ now defaults to updating the ABI with each major release,
4922 normally -Wabi warns only about C++ ABI compatibility problems if
4923 there is a check added later in a release series for an ABI issue
4924 discovered since the initial release. -Wabi warns about more
4925 things if an older ABI version is selected (with -fabi-version=n).
4926
4927 -Wabi can also be used with an explicit version number to warn
4928 about C++ ABI compatibility with a particular -fabi-version level,
4929 e.g. -Wabi=2 to warn about changes relative to -fabi-version=2.
4930
4931 If an explicit version number is provided and -fabi-compat-version
4932 is not specified, the version number from this option is used for
4933 compatibility aliases. If no explicit version number is provided
4934 with this option, but -fabi-compat-version is specified, that
4935 version number is used for C++ ABI warnings.
4936
4937 Although an effort has been made to warn about all such cases,
4938 there are probably some cases that are not warned about, even
4939 though G++ is generating incompatible code. There may also be
4940 cases where warnings are emitted even though the code that is
4941 generated is compatible.
4942
4943 You should rewrite your code to avoid these warnings if you are
4944 concerned about the fact that code generated by G++ may not be
4945 binary compatible with code generated by other compilers.
4946
4947 Known incompatibilities in -fabi-version=2 (which was the default
4948 from GCC 3.4 to 4.9) include:
4949
4950 * A template with a non-type template parameter of reference type
4951 was mangled incorrectly:
4952
4953 extern int N;
4954 template <int &> struct S {};
4955 void n (S<N>) {2}
4956
4957 This was fixed in -fabi-version=3.
4958
4959 * SIMD vector types declared using "__attribute ((vector_size))"
4960 were mangled in a non-standard way that does not allow for
4961 overloading of functions taking vectors of different sizes.
4962
4963 The mangling was changed in -fabi-version=4.
4964
4965 * "__attribute ((const))" and "noreturn" were mangled as type
4966 qualifiers, and "decltype" of a plain declaration was folded
4967 away.
4968
4969 These mangling issues were fixed in -fabi-version=5.
4970
4971 * Scoped enumerators passed as arguments to a variadic function
4972 are promoted like unscoped enumerators, causing "va_arg" to
4973 complain. On most targets this does not actually affect the
4974 parameter passing ABI, as there is no way to pass an argument
4975 smaller than "int".
4976
4977 Also, the ABI changed the mangling of template argument packs,
4978 "const_cast", "static_cast", prefix increment/decrement, and a
4979 class scope function used as a template argument.
4980
4981 These issues were corrected in -fabi-version=6.
4982
4983 * Lambdas in default argument scope were mangled incorrectly, and
4984 the ABI changed the mangling of "nullptr_t".
4985
4986 These issues were corrected in -fabi-version=7.
4987
4988 * When mangling a function type with function-cv-qualifiers, the
4989 un-qualified function type was incorrectly treated as a
4990 substitution candidate.
4991
4992 This was fixed in -fabi-version=8, the default for GCC 5.1.
4993
4994 * decltype(nullptr) incorrectly had an alignment of 1, leading to
4995 unaligned accesses. Note that this did not affect the ABI of a
4996 function with a "nullptr_t" parameter, as parameters have a
4997 minimum alignment.
4998
4999 This was fixed in -fabi-version=9, the default for GCC 5.2.
5000
5001 * Target-specific attributes that affect the identity of a type,
5002 such as ia32 calling conventions on a function type (stdcall,
5003 regparm, etc.), did not affect the mangled name, leading to
5004 name collisions when function pointers were used as template
5005 arguments.
5006
5007 This was fixed in -fabi-version=10, the default for GCC 6.1.
5008
5009 This option also enables warnings about psABI-related changes. The
5010 known psABI changes at this point include:
5011
5012 * For SysV/x86-64, unions with "long double" members are passed
5013 in memory as specified in psABI. Prior to GCC 4.4, this was
5014 not the case. For example:
5015
5016 union U {
5017 long double ld;
5018 int i;
5019 };
5020
5021 "union U" is now always passed in memory.
5022
5023 -Wno-changes-meaning (C++ and Objective-C++ only)
5024 C++ requires that unqualified uses of a name within a class have
5025 the same meaning in the complete scope of the class, so declaring
5026 the name after using it is ill-formed:
5027
5028 struct A;
5029 struct B1 { A a; typedef A A; }; // warning, 'A' changes meaning
5030 struct B2 { A a; struct A { }; }; // error, 'A' changes meaning
5031
5032 By default, the B1 case is only a warning because the two
5033 declarations have the same type, while the B2 case is an error.
5034 Both diagnostics can be disabled with -Wno-changes-meaning.
5035 Alternately, the error case can be reduced to a warning with
5036 -Wno-error=changes-meaning or -fpermissive.
5037
5038 Both diagnostics are also suppressed by -fms-extensions.
5039
5040 -Wchar-subscripts
5041 Warn if an array subscript has type "char". This is a common cause
5042 of error, as programmers often forget that this type is signed on
5043 some machines. This warning is enabled by -Wall.
5044
5045 -Wno-coverage-mismatch
5046 Warn if feedback profiles do not match when using the -fprofile-use
5047 option. If a source file is changed between compiling with
5048 -fprofile-generate and with -fprofile-use, the files with the
5049 profile feedback can fail to match the source file and GCC cannot
5050 use the profile feedback information. By default, this warning is
5051 enabled and is treated as an error. -Wno-coverage-mismatch can be
5052 used to disable the warning or -Wno-error=coverage-mismatch can be
5053 used to disable the error. Disabling the error for this warning
5054 can result in poorly optimized code and is useful only in the case
5055 of very minor changes such as bug fixes to an existing code-base.
5056 Completely disabling the warning is not recommended.
5057
5058 -Wno-coverage-invalid-line-number
5059 Warn in case a function ends earlier than it begins due to an
5060 invalid linenum macros. The warning is emitted only with
5061 --coverage enabled.
5062
5063 By default, this warning is enabled and is treated as an error.
5064 -Wno-coverage-invalid-line-number can be used to disable the
5065 warning or -Wno-error=coverage-invalid-line-number can be used to
5066 disable the error.
5067
5068 -Wno-cpp (C, Objective-C, C++, Objective-C++ and Fortran only)
5069 Suppress warning messages emitted by "#warning" directives.
5070
5071 -Wdouble-promotion (C, C++, Objective-C and Objective-C++ only)
5072 Give a warning when a value of type "float" is implicitly promoted
5073 to "double". CPUs with a 32-bit "single-precision" floating-point
5074 unit implement "float" in hardware, but emulate "double" in
5075 software. On such a machine, doing computations using "double"
5076 values is much more expensive because of the overhead required for
5077 software emulation.
5078
5079 It is easy to accidentally do computations with "double" because
5080 floating-point literals are implicitly of type "double". For
5081 example, in:
5082
5083 float area(float radius)
5084 {
5085 return 3.14159 * radius * radius;
5086 }
5087
5088 the compiler performs the entire computation with "double" because
5089 the floating-point literal is a "double".
5090
5091 -Wduplicate-decl-specifier (C and Objective-C only)
5092 Warn if a declaration has duplicate "const", "volatile", "restrict"
5093 or "_Atomic" specifier. This warning is enabled by -Wall.
5094
5095 -Wformat
5096 -Wformat=n
5097 Check calls to "printf" and "scanf", etc., to make sure that the
5098 arguments supplied have types appropriate to the format string
5099 specified, and that the conversions specified in the format string
5100 make sense. This includes standard functions, and others specified
5101 by format attributes, in the "printf", "scanf", "strftime" and
5102 "strfmon" (an X/Open extension, not in the C standard) families (or
5103 other target-specific families). Which functions are checked
5104 without format attributes having been specified depends on the
5105 standard version selected, and such checks of functions without the
5106 attribute specified are disabled by -ffreestanding or -fno-builtin.
5107
5108 The formats are checked against the format features supported by
5109 GNU libc version 2.2. These include all ISO C90 and C99 features,
5110 as well as features from the Single Unix Specification and some BSD
5111 and GNU extensions. Other library implementations may not support
5112 all these features; GCC does not support warning about features
5113 that go beyond a particular library's limitations. However, if
5114 -Wpedantic is used with -Wformat, warnings are given about format
5115 features not in the selected standard version (but not for
5116 "strfmon" formats, since those are not in any version of the C
5117 standard).
5118
5119 -Wformat=1
5120 -Wformat
5121 Option -Wformat is equivalent to -Wformat=1, and -Wno-format is
5122 equivalent to -Wformat=0. Since -Wformat also checks for null
5123 format arguments for several functions, -Wformat also implies
5124 -Wnonnull. Some aspects of this level of format checking can
5125 be disabled by the options: -Wno-format-contains-nul,
5126 -Wno-format-extra-args, and -Wno-format-zero-length. -Wformat
5127 is enabled by -Wall.
5128
5129 -Wformat=2
5130 Enable -Wformat plus additional format checks. Currently
5131 equivalent to -Wformat -Wformat-nonliteral -Wformat-security
5132 -Wformat-y2k.
5133
5134 -Wno-format-contains-nul
5135 If -Wformat is specified, do not warn about format strings that
5136 contain NUL bytes.
5137
5138 -Wno-format-extra-args
5139 If -Wformat is specified, do not warn about excess arguments to a
5140 "printf" or "scanf" format function. The C standard specifies that
5141 such arguments are ignored.
5142
5143 Where the unused arguments lie between used arguments that are
5144 specified with $ operand number specifications, normally warnings
5145 are still given, since the implementation could not know what type
5146 to pass to "va_arg" to skip the unused arguments. However, in the
5147 case of "scanf" formats, this option suppresses the warning if the
5148 unused arguments are all pointers, since the Single Unix
5149 Specification says that such unused arguments are allowed.
5150
5151 -Wformat-overflow
5152 -Wformat-overflow=level
5153 Warn about calls to formatted input/output functions such as
5154 "sprintf" and "vsprintf" that might overflow the destination
5155 buffer. When the exact number of bytes written by a format
5156 directive cannot be determined at compile-time it is estimated
5157 based on heuristics that depend on the level argument and on
5158 optimization. While enabling optimization will in most cases
5159 improve the accuracy of the warning, it may also result in false
5160 positives.
5161
5162 -Wformat-overflow
5163 -Wformat-overflow=1
5164 Level 1 of -Wformat-overflow enabled by -Wformat employs a
5165 conservative approach that warns only about calls that most
5166 likely overflow the buffer. At this level, numeric arguments
5167 to format directives with unknown values are assumed to have
5168 the value of one, and strings of unknown length to be empty.
5169 Numeric arguments that are known to be bounded to a subrange of
5170 their type, or string arguments whose output is bounded either
5171 by their directive's precision or by a finite set of string
5172 literals, are assumed to take on the value within the range
5173 that results in the most bytes on output. For example, the
5174 call to "sprintf" below is diagnosed because even with both a
5175 and b equal to zero, the terminating NUL character ('\0')
5176 appended by the function to the destination buffer will be
5177 written past its end. Increasing the size of the buffer by a
5178 single byte is sufficient to avoid the warning, though it may
5179 not be sufficient to avoid the overflow.
5180
5181 void f (int a, int b)
5182 {
5183 char buf [13];
5184 sprintf (buf, "a = %i, b = %i\n", a, b);
5185 }
5186
5187 -Wformat-overflow=2
5188 Level 2 warns also about calls that might overflow the
5189 destination buffer given an argument of sufficient length or
5190 magnitude. At level 2, unknown numeric arguments are assumed
5191 to have the minimum representable value for signed types with a
5192 precision greater than 1, and the maximum representable value
5193 otherwise. Unknown string arguments whose length cannot be
5194 assumed to be bounded either by the directive's precision, or
5195 by a finite set of string literals they may evaluate to, or the
5196 character array they may point to, are assumed to be 1
5197 character long.
5198
5199 At level 2, the call in the example above is again diagnosed,
5200 but this time because with a equal to a 32-bit "INT_MIN" the
5201 first %i directive will write some of its digits beyond the end
5202 of the destination buffer. To make the call safe regardless of
5203 the values of the two variables, the size of the destination
5204 buffer must be increased to at least 34 bytes. GCC includes
5205 the minimum size of the buffer in an informational note
5206 following the warning.
5207
5208 An alternative to increasing the size of the destination buffer
5209 is to constrain the range of formatted values. The maximum
5210 length of string arguments can be bounded by specifying the
5211 precision in the format directive. When numeric arguments of
5212 format directives can be assumed to be bounded by less than the
5213 precision of their type, choosing an appropriate length
5214 modifier to the format specifier will reduce the required
5215 buffer size. For example, if a and b in the example above can
5216 be assumed to be within the precision of the "short int" type
5217 then using either the %hi format directive or casting the
5218 argument to "short" reduces the maximum required size of the
5219 buffer to 24 bytes.
5220
5221 void f (int a, int b)
5222 {
5223 char buf [23];
5224 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
5225 }
5226
5227 -Wno-format-zero-length
5228 If -Wformat is specified, do not warn about zero-length formats.
5229 The C standard specifies that zero-length formats are allowed.
5230
5231 -Wformat-nonliteral
5232 If -Wformat is specified, also warn if the format string is not a
5233 string literal and so cannot be checked, unless the format function
5234 takes its format arguments as a "va_list".
5235
5236 -Wformat-security
5237 If -Wformat is specified, also warn about uses of format functions
5238 that represent possible security problems. At present, this warns
5239 about calls to "printf" and "scanf" functions where the format
5240 string is not a string literal and there are no format arguments,
5241 as in "printf (foo);". This may be a security hole if the format
5242 string came from untrusted input and contains %n. (This is
5243 currently a subset of what -Wformat-nonliteral warns about, but in
5244 future warnings may be added to -Wformat-security that are not
5245 included in -Wformat-nonliteral.)
5246
5247 -Wformat-signedness
5248 If -Wformat is specified, also warn if the format string requires
5249 an unsigned argument and the argument is signed and vice versa.
5250
5251 -Wformat-truncation
5252 -Wformat-truncation=level
5253 Warn about calls to formatted input/output functions such as
5254 "snprintf" and "vsnprintf" that might result in output truncation.
5255 When the exact number of bytes written by a format directive cannot
5256 be determined at compile-time it is estimated based on heuristics
5257 that depend on the level argument and on optimization. While
5258 enabling optimization will in most cases improve the accuracy of
5259 the warning, it may also result in false positives. Except as
5260 noted otherwise, the option uses the same logic -Wformat-overflow.
5261
5262 -Wformat-truncation
5263 -Wformat-truncation=1
5264 Level 1 of -Wformat-truncation enabled by -Wformat employs a
5265 conservative approach that warns only about calls to bounded
5266 functions whose return value is unused and that will most
5267 likely result in output truncation.
5268
5269 -Wformat-truncation=2
5270 Level 2 warns also about calls to bounded functions whose
5271 return value is used and that might result in truncation given
5272 an argument of sufficient length or magnitude.
5273
5274 -Wformat-y2k
5275 If -Wformat is specified, also warn about "strftime" formats that
5276 may yield only a two-digit year.
5277
5278 -Wnonnull
5279 Warn about passing a null pointer for arguments marked as requiring
5280 a non-null value by the "nonnull" function attribute.
5281
5282 -Wnonnull is included in -Wall and -Wformat. It can be disabled
5283 with the -Wno-nonnull option.
5284
5285 -Wnonnull-compare
5286 Warn when comparing an argument marked with the "nonnull" function
5287 attribute against null inside the function.
5288
5289 -Wnonnull-compare is included in -Wall. It can be disabled with
5290 the -Wno-nonnull-compare option.
5291
5292 -Wnull-dereference
5293 Warn if the compiler detects paths that trigger erroneous or
5294 undefined behavior due to dereferencing a null pointer. This
5295 option is only active when -fdelete-null-pointer-checks is active,
5296 which is enabled by optimizations in most targets. The precision
5297 of the warnings depends on the optimization options used.
5298
5299 -Winfinite-recursion
5300 Warn about infinitely recursive calls. The warning is effective at
5301 all optimization levels but requires optimization in order to
5302 detect infinite recursion in calls between two or more functions.
5303 -Winfinite-recursion is included in -Wall.
5304
5305 Compare with -Wanalyzer-infinite-recursion which provides a similar
5306 diagnostic, but is implemented in a different way (as part of
5307 -fanalyzer).
5308
5309 -Winit-self (C, C++, Objective-C and Objective-C++ only)
5310 Warn about uninitialized variables that are initialized with
5311 themselves. Note this option can only be used with the
5312 -Wuninitialized option.
5313
5314 For example, GCC warns about "i" being uninitialized in the
5315 following snippet only when -Winit-self has been specified:
5316
5317 int f()
5318 {
5319 int i = i;
5320 return i;
5321 }
5322
5323 This warning is enabled by -Wall in C++.
5324
5325 -Wno-implicit-int (C and Objective-C only)
5326 This option controls warnings when a declaration does not specify a
5327 type. This warning is enabled by default in C99 and later dialects
5328 of C, and also by -Wall.
5329
5330 -Wno-implicit-function-declaration (C and Objective-C only)
5331 This option controls warnings when a function is used before being
5332 declared. This warning is enabled by default in C99 and later
5333 dialects of C, and also by -Wall. The warning is made into an
5334 error by -pedantic-errors.
5335
5336 -Wimplicit (C and Objective-C only)
5337 Same as -Wimplicit-int and -Wimplicit-function-declaration. This
5338 warning is enabled by -Wall.
5339
5340 -Wimplicit-fallthrough
5341 -Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3 and
5342 -Wno-implicit-fallthrough is the same as -Wimplicit-fallthrough=0.
5343
5344 -Wimplicit-fallthrough=n
5345 Warn when a switch case falls through. For example:
5346
5347 switch (cond)
5348 {
5349 case 1:
5350 a = 1;
5351 break;
5352 case 2:
5353 a = 2;
5354 case 3:
5355 a = 3;
5356 break;
5357 }
5358
5359 This warning does not warn when the last statement of a case cannot
5360 fall through, e.g. when there is a return statement or a call to
5361 function declared with the noreturn attribute.
5362 -Wimplicit-fallthrough= also takes into account control flow
5363 statements, such as ifs, and only warns when appropriate. E.g.
5364
5365 switch (cond)
5366 {
5367 case 1:
5368 if (i > 3) {
5369 bar (5);
5370 break;
5371 } else if (i < 1) {
5372 bar (0);
5373 } else
5374 return;
5375 default:
5376 ...
5377 }
5378
5379 Since there are occasions where a switch case fall through is
5380 desirable, GCC provides an attribute, "__attribute__
5381 ((fallthrough))", that is to be used along with a null statement to
5382 suppress this warning that would normally occur:
5383
5384 switch (cond)
5385 {
5386 case 1:
5387 bar (0);
5388 __attribute__ ((fallthrough));
5389 default:
5390 ...
5391 }
5392
5393 C++17 provides a standard way to suppress the
5394 -Wimplicit-fallthrough warning using "[[fallthrough]];" instead of
5395 the GNU attribute. In C++11 or C++14 users can use
5396 "[[gnu::fallthrough]];", which is a GNU extension. Instead of
5397 these attributes, it is also possible to add a fallthrough comment
5398 to silence the warning. The whole body of the C or C++ style
5399 comment should match the given regular expressions listed below.
5400 The option argument n specifies what kind of comments are accepted:
5401
5402 *<-Wimplicit-fallthrough=0 disables the warning altogether.>
5403 *<-Wimplicit-fallthrough=1 matches ".*" regular>
5404 expression, any comment is used as fallthrough comment.
5405
5406 *<-Wimplicit-fallthrough=2 case insensitively matches>
5407 ".*falls?[ \t-]*thr(ough|u).*" regular expression.
5408
5409 *<-Wimplicit-fallthrough=3 case sensitively matches one of the>
5410 following regular expressions:
5411
5412 *<"-fallthrough">
5413 *<"@fallthrough@">
5414 *<"lint -fallthrough[ \t]*">
5415 *<"[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?FALL(S |
5416 |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?">
5417 *<"[ \t.!]*(Else,? |Intentional(ly)? )?Fall((s |
5418 |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?">
5419 *<"[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?fall(s |
5420 |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?">
5421 *<-Wimplicit-fallthrough=4 case sensitively matches one of the>
5422 following regular expressions:
5423
5424 *<"-fallthrough">
5425 *<"@fallthrough@">
5426 *<"lint -fallthrough[ \t]*">
5427 *<"[ \t]*FALLTHR(OUGH|U)[ \t]*">
5428 *<-Wimplicit-fallthrough=5 doesn't recognize any comments as>
5429 fallthrough comments, only attributes disable the warning.
5430
5431 The comment needs to be followed after optional whitespace and
5432 other comments by "case" or "default" keywords or by a user label
5433 that precedes some "case" or "default" label.
5434
5435 switch (cond)
5436 {
5437 case 1:
5438 bar (0);
5439 /* FALLTHRU */
5440 default:
5441 ...
5442 }
5443
5444 The -Wimplicit-fallthrough=3 warning is enabled by -Wextra.
5445
5446 -Wno-if-not-aligned (C, C++, Objective-C and Objective-C++ only)
5447 Control if warnings triggered by the "warn_if_not_aligned"
5448 attribute should be issued. These warnings are enabled by default.
5449
5450 -Wignored-qualifiers (C and C++ only)
5451 Warn if the return type of a function has a type qualifier such as
5452 "const". For ISO C such a type qualifier has no effect, since the
5453 value returned by a function is not an lvalue. For C++, the
5454 warning is only emitted for scalar types or "void". ISO C
5455 prohibits qualified "void" return types on function definitions, so
5456 such return types always receive a warning even without this
5457 option.
5458
5459 This warning is also enabled by -Wextra.
5460
5461 -Wno-ignored-attributes (C and C++ only)
5462 This option controls warnings when an attribute is ignored. This
5463 is different from the -Wattributes option in that it warns whenever
5464 the compiler decides to drop an attribute, not that the attribute
5465 is either unknown, used in a wrong place, etc. This warning is
5466 enabled by default.
5467
5468 -Wmain
5469 Warn if the type of "main" is suspicious. "main" should be a
5470 function with external linkage, returning int, taking either zero
5471 arguments, two, or three arguments of appropriate types. This
5472 warning is enabled by default in C++ and is enabled by either -Wall
5473 or -Wpedantic.
5474
5475 -Wmisleading-indentation (C and C++ only)
5476 Warn when the indentation of the code does not reflect the block
5477 structure. Specifically, a warning is issued for "if", "else",
5478 "while", and "for" clauses with a guarded statement that does not
5479 use braces, followed by an unguarded statement with the same
5480 indentation.
5481
5482 In the following example, the call to "bar" is misleadingly
5483 indented as if it were guarded by the "if" conditional.
5484
5485 if (some_condition ())
5486 foo ();
5487 bar (); /* Gotcha: this is not guarded by the "if". */
5488
5489 In the case of mixed tabs and spaces, the warning uses the
5490 -ftabstop= option to determine if the statements line up
5491 (defaulting to 8).
5492
5493 The warning is not issued for code involving multiline preprocessor
5494 logic such as the following example.
5495
5496 if (flagA)
5497 foo (0);
5498 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5499 if (flagB)
5500 #endif
5501 foo (1);
5502
5503 The warning is not issued after a "#line" directive, since this
5504 typically indicates autogenerated code, and no assumptions can be
5505 made about the layout of the file that the directive references.
5506
5507 This warning is enabled by -Wall in C and C++.
5508
5509 -Wmissing-attributes
5510 Warn when a declaration of a function is missing one or more
5511 attributes that a related function is declared with and whose
5512 absence may adversely affect the correctness or efficiency of
5513 generated code. For example, the warning is issued for
5514 declarations of aliases that use attributes to specify less
5515 restrictive requirements than those of their targets. This
5516 typically represents a potential optimization opportunity. By
5517 contrast, the -Wattribute-alias=2 option controls warnings issued
5518 when the alias is more restrictive than the target, which could
5519 lead to incorrect code generation. Attributes considered include
5520 "alloc_align", "alloc_size", "cold", "const", "hot", "leaf",
5521 "malloc", "nonnull", "noreturn", "nothrow", "pure",
5522 "returns_nonnull", and "returns_twice".
5523
5524 In C++, the warning is issued when an explicit specialization of a
5525 primary template declared with attribute "alloc_align",
5526 "alloc_size", "assume_aligned", "format", "format_arg", "malloc",
5527 or "nonnull" is declared without it. Attributes "deprecated",
5528 "error", and "warning" suppress the warning..
5529
5530 You can use the "copy" attribute to apply the same set of
5531 attributes to a declaration as that on another declaration without
5532 explicitly enumerating the attributes. This attribute can be
5533 applied to declarations of functions, variables, or types.
5534
5535 -Wmissing-attributes is enabled by -Wall.
5536
5537 For example, since the declaration of the primary function template
5538 below makes use of both attribute "malloc" and "alloc_size" the
5539 declaration of the explicit specialization of the template is
5540 diagnosed because it is missing one of the attributes.
5541
5542 template <class T>
5543 T* __attribute__ ((malloc, alloc_size (1)))
5544 allocate (size_t);
5545
5546 template <>
5547 void* __attribute__ ((malloc)) // missing alloc_size
5548 allocate<void> (size_t);
5549
5550 -Wmissing-braces
5551 Warn if an aggregate or union initializer is not fully bracketed.
5552 In the following example, the initializer for "a" is not fully
5553 bracketed, but that for "b" is fully bracketed.
5554
5555 int a[2][2] = { 0, 1, 2, 3 };
5556 int b[2][2] = { { 0, 1 }, { 2, 3 } };
5557
5558 This warning is enabled by -Wall.
5559
5560 -Wmissing-include-dirs (C, C++, Objective-C, Objective-C++ and Fortran
5561 only)
5562 Warn if a user-supplied include directory does not exist. This
5563 opions is disabled by default for C, C++, Objective-C and
5564 Objective-C++. For Fortran, it is partially enabled by default by
5565 warning for -I and -J, only.
5566
5567 -Wno-missing-profile
5568 This option controls warnings if feedback profiles are missing when
5569 using the -fprofile-use option. This option diagnoses those cases
5570 where a new function or a new file is added between compiling with
5571 -fprofile-generate and with -fprofile-use, without regenerating the
5572 profiles. In these cases, the profile feedback data files do not
5573 contain any profile feedback information for the newly added
5574 function or file respectively. Also, in the case when profile
5575 count data (.gcda) files are removed, GCC cannot use any profile
5576 feedback information. In all these cases, warnings are issued to
5577 inform you that a profile generation step is due. Ignoring the
5578 warning can result in poorly optimized code. -Wno-missing-profile
5579 can be used to disable the warning, but this is not recommended and
5580 should be done only when non-existent profile data is justified.
5581
5582 -Wmismatched-dealloc
5583 Warn for calls to deallocation functions with pointer arguments
5584 returned from from allocations functions for which the former isn't
5585 a suitable deallocator. A pair of functions can be associated as
5586 matching allocators and deallocators by use of attribute "malloc".
5587 Unless disabled by the -fno-builtin option the standard functions
5588 "calloc", "malloc", "realloc", and "free", as well as the
5589 corresponding forms of C++ "operator new" and "operator delete" are
5590 implicitly associated as matching allocators and deallocators. In
5591 the following example "mydealloc" is the deallocator for pointers
5592 returned from "myalloc".
5593
5594 void mydealloc (void*);
5595
5596 __attribute__ ((malloc (mydealloc, 1))) void*
5597 myalloc (size_t);
5598
5599 void f (void)
5600 {
5601 void *p = myalloc (32);
5602 // ...use p...
5603 free (p); // warning: not a matching deallocator for myalloc
5604 mydealloc (p); // ok
5605 }
5606
5607 In C++, the related option -Wmismatched-new-delete diagnoses
5608 mismatches involving either "operator new" or "operator delete".
5609
5610 Option -Wmismatched-dealloc is included in -Wall.
5611
5612 -Wmultistatement-macros
5613 Warn about unsafe multiple statement macros that appear to be
5614 guarded by a clause such as "if", "else", "for", "switch", or
5615 "while", in which only the first statement is actually guarded
5616 after the macro is expanded.
5617
5618 For example:
5619
5620 #define DOIT x++; y++
5621 if (c)
5622 DOIT;
5623
5624 will increment "y" unconditionally, not just when "c" holds. The
5625 can usually be fixed by wrapping the macro in a do-while loop:
5626
5627 #define DOIT do { x++; y++; } while (0)
5628 if (c)
5629 DOIT;
5630
5631 This warning is enabled by -Wall in C and C++.
5632
5633 -Wparentheses
5634 Warn if parentheses are omitted in certain contexts, such as when
5635 there is an assignment in a context where a truth value is
5636 expected, or when operators are nested whose precedence people
5637 often get confused about.
5638
5639 Also warn if a comparison like "x<=y<=z" appears; this is
5640 equivalent to "(x<=y ? 1 : 0) <= z", which is a different
5641 interpretation from that of ordinary mathematical notation.
5642
5643 Also warn for dangerous uses of the GNU extension to "?:" with
5644 omitted middle operand. When the condition in the "?": operator is
5645 a boolean expression, the omitted value is always 1. Often
5646 programmers expect it to be a value computed inside the conditional
5647 expression instead.
5648
5649 For C++ this also warns for some cases of unnecessary parentheses
5650 in declarations, which can indicate an attempt at a function call
5651 instead of a declaration:
5652
5653 {
5654 // Declares a local variable called mymutex.
5655 std::unique_lock<std::mutex> (mymutex);
5656 // User meant std::unique_lock<std::mutex> lock (mymutex);
5657 }
5658
5659 This warning is enabled by -Wall.
5660
5661 -Wno-self-move (C++ and Objective-C++ only)
5662 This warning warns when a value is moved to itself with
5663 "std::move". Such a "std::move" typically has no effect.
5664
5665 struct T {
5666 ...
5667 };
5668 void fn()
5669 {
5670 T t;
5671 ...
5672 t = std::move (t);
5673 }
5674
5675 This warning is enabled by -Wall.
5676
5677 -Wsequence-point
5678 Warn about code that may have undefined semantics because of
5679 violations of sequence point rules in the C and C++ standards.
5680
5681 The C and C++ standards define the order in which expressions in a
5682 C/C++ program are evaluated in terms of sequence points, which
5683 represent a partial ordering between the execution of parts of the
5684 program: those executed before the sequence point, and those
5685 executed after it. These occur after the evaluation of a full
5686 expression (one which is not part of a larger expression), after
5687 the evaluation of the first operand of a "&&", "||", "? :" or ","
5688 (comma) operator, before a function is called (but after the
5689 evaluation of its arguments and the expression denoting the called
5690 function), and in certain other places. Other than as expressed by
5691 the sequence point rules, the order of evaluation of subexpressions
5692 of an expression is not specified. All these rules describe only a
5693 partial order rather than a total order, since, for example, if two
5694 functions are called within one expression with no sequence point
5695 between them, the order in which the functions are called is not
5696 specified. However, the standards committee have ruled that
5697 function calls do not overlap.
5698
5699 It is not specified when between sequence points modifications to
5700 the values of objects take effect. Programs whose behavior depends
5701 on this have undefined behavior; the C and C++ standards specify
5702 that "Between the previous and next sequence point an object shall
5703 have its stored value modified at most once by the evaluation of an
5704 expression. Furthermore, the prior value shall be read only to
5705 determine the value to be stored.". If a program breaks these
5706 rules, the results on any particular implementation are entirely
5707 unpredictable.
5708
5709 Examples of code with undefined behavior are "a = a++;", "a[n] =
5710 b[n++]" and "a[i++] = i;". Some more complicated cases are not
5711 diagnosed by this option, and it may give an occasional false
5712 positive result, but in general it has been found fairly effective
5713 at detecting this sort of problem in programs.
5714
5715 The C++17 standard will define the order of evaluation of operands
5716 in more cases: in particular it requires that the right-hand side
5717 of an assignment be evaluated before the left-hand side, so the
5718 above examples are no longer undefined. But this option will still
5719 warn about them, to help people avoid writing code that is
5720 undefined in C and earlier revisions of C++.
5721
5722 The standard is worded confusingly, therefore there is some debate
5723 over the precise meaning of the sequence point rules in subtle
5724 cases. Links to discussions of the problem, including proposed
5725 formal definitions, may be found on the GCC readings page, at
5726 <https://gcc.gnu.org/readings.html>.
5727
5728 This warning is enabled by -Wall for C and C++.
5729
5730 -Wno-return-local-addr
5731 Do not warn about returning a pointer (or in C++, a reference) to a
5732 variable that goes out of scope after the function returns.
5733
5734 -Wreturn-type
5735 Warn whenever a function is defined with a return type that
5736 defaults to "int". Also warn about any "return" statement with no
5737 return value in a function whose return type is not "void" (falling
5738 off the end of the function body is considered returning without a
5739 value).
5740
5741 For C only, warn about a "return" statement with an expression in a
5742 function whose return type is "void", unless the expression type is
5743 also "void". As a GNU extension, the latter case is accepted
5744 without a warning unless -Wpedantic is used. Attempting to use the
5745 return value of a non-"void" function other than "main" that flows
5746 off the end by reaching the closing curly brace that terminates the
5747 function is undefined.
5748
5749 Unlike in C, in C++, flowing off the end of a non-"void" function
5750 other than "main" results in undefined behavior even when the value
5751 of the function is not used.
5752
5753 This warning is enabled by default in C++ and by -Wall otherwise.
5754
5755 -Wno-shift-count-negative
5756 Controls warnings if a shift count is negative. This warning is
5757 enabled by default.
5758
5759 -Wno-shift-count-overflow
5760 Controls warnings if a shift count is greater than or equal to the
5761 bit width of the type. This warning is enabled by default.
5762
5763 -Wshift-negative-value
5764 Warn if left shifting a negative value. This warning is enabled by
5765 -Wextra in C99 (and newer) and C++11 to C++17 modes.
5766
5767 -Wno-shift-overflow
5768 -Wshift-overflow=n
5769 These options control warnings about left shift overflows.
5770
5771 -Wshift-overflow=1
5772 This is the warning level of -Wshift-overflow and is enabled by
5773 default in C99 and C++11 modes (and newer). This warning level
5774 does not warn about left-shifting 1 into the sign bit.
5775 (However, in C, such an overflow is still rejected in contexts
5776 where an integer constant expression is required.) No warning
5777 is emitted in C++20 mode (and newer), as signed left shifts
5778 always wrap.
5779
5780 -Wshift-overflow=2
5781 This warning level also warns about left-shifting 1 into the
5782 sign bit, unless C++14 mode (or newer) is active.
5783
5784 -Wswitch
5785 Warn whenever a "switch" statement has an index of enumerated type
5786 and lacks a "case" for one or more of the named codes of that
5787 enumeration. (The presence of a "default" label prevents this
5788 warning.) "case" labels outside the enumeration range also provoke
5789 warnings when this option is used (even if there is a "default"
5790 label). This warning is enabled by -Wall.
5791
5792 -Wswitch-default
5793 Warn whenever a "switch" statement does not have a "default" case.
5794
5795 -Wswitch-enum
5796 Warn whenever a "switch" statement has an index of enumerated type
5797 and lacks a "case" for one or more of the named codes of that
5798 enumeration. "case" labels outside the enumeration range also
5799 provoke warnings when this option is used. The only difference
5800 between -Wswitch and this option is that this option gives a
5801 warning about an omitted enumeration code even if there is a
5802 "default" label.
5803
5804 -Wno-switch-bool
5805 Do not warn when a "switch" statement has an index of boolean type
5806 and the case values are outside the range of a boolean type. It is
5807 possible to suppress this warning by casting the controlling
5808 expression to a type other than "bool". For example:
5809
5810 switch ((int) (a == 4))
5811 {
5812 ...
5813 }
5814
5815 This warning is enabled by default for C and C++ programs.
5816
5817 -Wno-switch-outside-range
5818 This option controls warnings when a "switch" case has a value that
5819 is outside of its respective type range. This warning is enabled
5820 by default for C and C++ programs.
5821
5822 -Wno-switch-unreachable
5823 Do not warn when a "switch" statement contains statements between
5824 the controlling expression and the first case label, which will
5825 never be executed. For example:
5826
5827 switch (cond)
5828 {
5829 i = 15;
5830 ...
5831 case 5:
5832 ...
5833 }
5834
5835 -Wswitch-unreachable does not warn if the statement between the
5836 controlling expression and the first case label is just a
5837 declaration:
5838
5839 switch (cond)
5840 {
5841 int i;
5842 ...
5843 case 5:
5844 i = 5;
5845 ...
5846 }
5847
5848 This warning is enabled by default for C and C++ programs.
5849
5850 -Wsync-nand (C and C++ only)
5851 Warn when "__sync_fetch_and_nand" and "__sync_nand_and_fetch"
5852 built-in functions are used. These functions changed semantics in
5853 GCC 4.4.
5854
5855 -Wtrivial-auto-var-init
5856 Warn when "-ftrivial-auto-var-init" cannot initialize the automatic
5857 variable. A common situation is an automatic variable that is
5858 declared between the controlling expression and the first case
5859 label of a "switch" statement.
5860
5861 -Wunused-but-set-parameter
5862 Warn whenever a function parameter is assigned to, but otherwise
5863 unused (aside from its declaration).
5864
5865 To suppress this warning use the "unused" attribute.
5866
5867 This warning is also enabled by -Wunused together with -Wextra.
5868
5869 -Wunused-but-set-variable
5870 Warn whenever a local variable is assigned to, but otherwise unused
5871 (aside from its declaration). This warning is enabled by -Wall.
5872
5873 To suppress this warning use the "unused" attribute.
5874
5875 This warning is also enabled by -Wunused, which is enabled by
5876 -Wall.
5877
5878 -Wunused-function
5879 Warn whenever a static function is declared but not defined or a
5880 non-inline static function is unused. This warning is enabled by
5881 -Wall.
5882
5883 -Wunused-label
5884 Warn whenever a label is declared but not used. This warning is
5885 enabled by -Wall.
5886
5887 To suppress this warning use the "unused" attribute.
5888
5889 -Wunused-local-typedefs (C, Objective-C, C++ and Objective-C++ only)
5890 Warn when a typedef locally defined in a function is not used.
5891 This warning is enabled by -Wall.
5892
5893 -Wunused-parameter
5894 Warn whenever a function parameter is unused aside from its
5895 declaration.
5896
5897 To suppress this warning use the "unused" attribute.
5898
5899 -Wno-unused-result
5900 Do not warn if a caller of a function marked with attribute
5901 "warn_unused_result" does not use its return value. The default is
5902 -Wunused-result.
5903
5904 -Wunused-variable
5905 Warn whenever a local or static variable is unused aside from its
5906 declaration. This option implies -Wunused-const-variable=1 for C,
5907 but not for C++. This warning is enabled by -Wall.
5908
5909 To suppress this warning use the "unused" attribute.
5910
5911 -Wunused-const-variable
5912 -Wunused-const-variable=n
5913 Warn whenever a constant static variable is unused aside from its
5914 declaration. -Wunused-const-variable=1 is enabled by
5915 -Wunused-variable for C, but not for C++. In C this declares
5916 variable storage, but in C++ this is not an error since const
5917 variables take the place of "#define"s.
5918
5919 To suppress this warning use the "unused" attribute.
5920
5921 -Wunused-const-variable=1
5922 This is the warning level that is enabled by -Wunused-variable
5923 for C. It warns only about unused static const variables
5924 defined in the main compilation unit, but not about static
5925 const variables declared in any header included.
5926
5927 -Wunused-const-variable=2
5928 This warning level also warns for unused constant static
5929 variables in headers (excluding system headers). This is the
5930 warning level of -Wunused-const-variable and must be explicitly
5931 requested since in C++ this isn't an error and in C it might be
5932 harder to clean up all headers included.
5933
5934 -Wunused-value
5935 Warn whenever a statement computes a result that is explicitly not
5936 used. To suppress this warning cast the unused expression to
5937 "void". This includes an expression-statement or the left-hand side
5938 of a comma expression that contains no side effects. For example,
5939 an expression such as "x[i,j]" causes a warning, while
5940 "x[(void)i,j]" does not.
5941
5942 This warning is enabled by -Wall.
5943
5944 -Wunused
5945 All the above -Wunused options combined.
5946
5947 In order to get a warning about an unused function parameter, you
5948 must either specify -Wextra -Wunused (note that -Wall implies
5949 -Wunused), or separately specify -Wunused-parameter.
5950
5951 -Wuninitialized
5952 Warn if an object with automatic or allocated storage duration is
5953 used without having been initialized. In C++, also warn if a non-
5954 static reference or non-static "const" member appears in a class
5955 without constructors.
5956
5957 In addition, passing a pointer (or in C++, a reference) to an
5958 uninitialized object to a "const"-qualified argument of a built-in
5959 function known to read the object is also diagnosed by this
5960 warning. (-Wmaybe-uninitialized is issued for ordinary functions.)
5961
5962 If you want to warn about code that uses the uninitialized value of
5963 the variable in its own initializer, use the -Winit-self option.
5964
5965 These warnings occur for individual uninitialized elements of
5966 structure, union or array variables as well as for variables that
5967 are uninitialized as a whole. They do not occur for variables or
5968 elements declared "volatile". Because these warnings depend on
5969 optimization, the exact variables or elements for which there are
5970 warnings depend on the precise optimization options and version of
5971 GCC used.
5972
5973 Note that there may be no warning about a variable that is used
5974 only to compute a value that itself is never used, because such
5975 computations may be deleted by data flow analysis before the
5976 warnings are printed.
5977
5978 In C++, this warning also warns about using uninitialized objects
5979 in member-initializer-lists. For example, GCC warns about "b"
5980 being uninitialized in the following snippet:
5981
5982 struct A {
5983 int a;
5984 int b;
5985 A() : a(b) { }
5986 };
5987
5988 -Wno-invalid-memory-model
5989 This option controls warnings for invocations of __atomic Builtins,
5990 __sync Builtins, and the C11 atomic generic functions with a memory
5991 consistency argument that is either invalid for the operation or
5992 outside the range of values of the "memory_order" enumeration. For
5993 example, since the "__atomic_store" and "__atomic_store_n" built-
5994 ins are only defined for the relaxed, release, and sequentially
5995 consistent memory orders the following code is diagnosed:
5996
5997 void store (int *i)
5998 {
5999 __atomic_store_n (i, 0, memory_order_consume);
6000 }
6001
6002 -Winvalid-memory-model is enabled by default.
6003
6004 -Wmaybe-uninitialized
6005 For an object with automatic or allocated storage duration, if
6006 there exists a path from the function entry to a use of the object
6007 that is initialized, but there exist some other paths for which the
6008 object is not initialized, the compiler emits a warning if it
6009 cannot prove the uninitialized paths are not executed at run time.
6010
6011 In addition, passing a pointer (or in C++, a reference) to an
6012 uninitialized object to a "const"-qualified function argument is
6013 also diagnosed by this warning. (-Wuninitialized is issued for
6014 built-in functions known to read the object.) Annotating the
6015 function with attribute "access (none)" indicates that the argument
6016 isn't used to access the object and avoids the warning.
6017
6018 These warnings are only possible in optimizing compilation, because
6019 otherwise GCC does not keep track of the state of variables.
6020
6021 These warnings are made optional because GCC may not be able to
6022 determine when the code is correct in spite of appearing to have an
6023 error. Here is one example of how this can happen:
6024
6025 {
6026 int x;
6027 switch (y)
6028 {
6029 case 1: x = 1;
6030 break;
6031 case 2: x = 4;
6032 break;
6033 case 3: x = 5;
6034 }
6035 foo (x);
6036 }
6037
6038 If the value of "y" is always 1, 2 or 3, then "x" is always
6039 initialized, but GCC doesn't know this. To suppress the warning,
6040 you need to provide a default case with assert(0) or similar code.
6041
6042 This option also warns when a non-volatile automatic variable might
6043 be changed by a call to "longjmp". The compiler sees only the
6044 calls to "setjmp". It cannot know where "longjmp" will be called;
6045 in fact, a signal handler could call it at any point in the code.
6046 As a result, you may get a warning even when there is in fact no
6047 problem because "longjmp" cannot in fact be called at the place
6048 that would cause a problem.
6049
6050 Some spurious warnings can be avoided if you declare all the
6051 functions you use that never return as "noreturn".
6052
6053 This warning is enabled by -Wall or -Wextra.
6054
6055 -Wunknown-pragmas
6056 Warn when a "#pragma" directive is encountered that is not
6057 understood by GCC. If this command-line option is used, warnings
6058 are even issued for unknown pragmas in system header files. This
6059 is not the case if the warnings are only enabled by the -Wall
6060 command-line option.
6061
6062 -Wno-pragmas
6063 Do not warn about misuses of pragmas, such as incorrect parameters,
6064 invalid syntax, or conflicts between pragmas. See also
6065 -Wunknown-pragmas.
6066
6067 -Wno-prio-ctor-dtor
6068 Do not warn if a priority from 0 to 100 is used for constructor or
6069 destructor. The use of constructor and destructor attributes allow
6070 you to assign a priority to the constructor/destructor to control
6071 its order of execution before "main" is called or after it returns.
6072 The priority values must be greater than 100 as the compiler
6073 reserves priority values between 0--100 for the implementation.
6074
6075 -Wstrict-aliasing
6076 This option is only active when -fstrict-aliasing is active. It
6077 warns about code that might break the strict aliasing rules that
6078 the compiler is using for optimization. The warning does not catch
6079 all cases, but does attempt to catch the more common pitfalls. It
6080 is included in -Wall. It is equivalent to -Wstrict-aliasing=3
6081
6082 -Wstrict-aliasing=n
6083 This option is only active when -fstrict-aliasing is active. It
6084 warns about code that might break the strict aliasing rules that
6085 the compiler is using for optimization. Higher levels correspond
6086 to higher accuracy (fewer false positives). Higher levels also
6087 correspond to more effort, similar to the way -O works.
6088 -Wstrict-aliasing is equivalent to -Wstrict-aliasing=3.
6089
6090 Level 1: Most aggressive, quick, least accurate. Possibly useful
6091 when higher levels do not warn but -fstrict-aliasing still breaks
6092 the code, as it has very few false negatives. However, it has many
6093 false positives. Warns for all pointer conversions between
6094 possibly incompatible types, even if never dereferenced. Runs in
6095 the front end only.
6096
6097 Level 2: Aggressive, quick, not too precise. May still have many
6098 false positives (not as many as level 1 though), and few false
6099 negatives (but possibly more than level 1). Unlike level 1, it
6100 only warns when an address is taken. Warns about incomplete types.
6101 Runs in the front end only.
6102
6103 Level 3 (default for -Wstrict-aliasing): Should have very few false
6104 positives and few false negatives. Slightly slower than levels 1
6105 or 2 when optimization is enabled. Takes care of the common
6106 pun+dereference pattern in the front end: "*(int*)&some_float". If
6107 optimization is enabled, it also runs in the back end, where it
6108 deals with multiple statement cases using flow-sensitive points-to
6109 information. Only warns when the converted pointer is
6110 dereferenced. Does not warn about incomplete types.
6111
6112 -Wstrict-overflow
6113 -Wstrict-overflow=n
6114 This option is only active when signed overflow is undefined. It
6115 warns about cases where the compiler optimizes based on the
6116 assumption that signed overflow does not occur. Note that it does
6117 not warn about all cases where the code might overflow: it only
6118 warns about cases where the compiler implements some optimization.
6119 Thus this warning depends on the optimization level.
6120
6121 An optimization that assumes that signed overflow does not occur is
6122 perfectly safe if the values of the variables involved are such
6123 that overflow never does, in fact, occur. Therefore this warning
6124 can easily give a false positive: a warning about code that is not
6125 actually a problem. To help focus on important issues, several
6126 warning levels are defined. No warnings are issued for the use of
6127 undefined signed overflow when estimating how many iterations a
6128 loop requires, in particular when determining whether a loop will
6129 be executed at all.
6130
6131 -Wstrict-overflow=1
6132 Warn about cases that are both questionable and easy to avoid.
6133 For example the compiler simplifies "x + 1 > x" to 1. This
6134 level of -Wstrict-overflow is enabled by -Wall; higher levels
6135 are not, and must be explicitly requested.
6136
6137 -Wstrict-overflow=2
6138 Also warn about other cases where a comparison is simplified to
6139 a constant. For example: "abs (x) >= 0". This can only be
6140 simplified when signed integer overflow is undefined, because
6141 "abs (INT_MIN)" overflows to "INT_MIN", which is less than
6142 zero. -Wstrict-overflow (with no level) is the same as
6143 -Wstrict-overflow=2.
6144
6145 -Wstrict-overflow=3
6146 Also warn about other cases where a comparison is simplified.
6147 For example: "x + 1 > 1" is simplified to "x > 0".
6148
6149 -Wstrict-overflow=4
6150 Also warn about other simplifications not covered by the above
6151 cases. For example: "(x * 10) / 5" is simplified to "x * 2".
6152
6153 -Wstrict-overflow=5
6154 Also warn about cases where the compiler reduces the magnitude
6155 of a constant involved in a comparison. For example: "x + 2 >
6156 y" is simplified to "x + 1 >= y". This is reported only at the
6157 highest warning level because this simplification applies to
6158 many comparisons, so this warning level gives a very large
6159 number of false positives.
6160
6161 -Wstring-compare
6162 Warn for calls to "strcmp" and "strncmp" whose result is determined
6163 to be either zero or non-zero in tests for such equality owing to
6164 the length of one argument being greater than the size of the array
6165 the other argument is stored in (or the bound in the case of
6166 "strncmp"). Such calls could be mistakes. For example, the call
6167 to "strcmp" below is diagnosed because its result is necessarily
6168 non-zero irrespective of the contents of the array "a".
6169
6170 extern char a[4];
6171 void f (char *d)
6172 {
6173 strcpy (d, "string");
6174 ...
6175 if (0 == strcmp (a, d)) // cannot be true
6176 puts ("a and d are the same");
6177 }
6178
6179 -Wstring-compare is enabled by -Wextra.
6180
6181 -Wno-stringop-overflow
6182 -Wstringop-overflow
6183 -Wstringop-overflow=type
6184 Warn for calls to string manipulation functions such as "memcpy"
6185 and "strcpy" that are determined to overflow the destination
6186 buffer. The optional argument is one greater than the type of
6187 Object Size Checking to perform to determine the size of the
6188 destination. The argument is meaningful only for functions that
6189 operate on character arrays but not for raw memory functions like
6190 "memcpy" which always make use of Object Size type-0. The option
6191 also warns for calls that specify a size in excess of the largest
6192 possible object or at most "SIZE_MAX / 2" bytes. The option
6193 produces the best results with optimization enabled but can detect
6194 a small subset of simple buffer overflows even without optimization
6195 in calls to the GCC built-in functions like "__builtin_memcpy" that
6196 correspond to the standard functions. In any case, the option
6197 warns about just a subset of buffer overflows detected by the
6198 corresponding overflow checking built-ins. For example, the option
6199 issues a warning for the "strcpy" call below because it copies at
6200 least 5 characters (the string "blue" including the terminating
6201 NUL) into the buffer of size 4.
6202
6203 enum Color { blue, purple, yellow };
6204 const char* f (enum Color clr)
6205 {
6206 static char buf [4];
6207 const char *str;
6208 switch (clr)
6209 {
6210 case blue: str = "blue"; break;
6211 case purple: str = "purple"; break;
6212 case yellow: str = "yellow"; break;
6213 }
6214
6215 return strcpy (buf, str); // warning here
6216 }
6217
6218 Option -Wstringop-overflow=2 is enabled by default.
6219
6220 -Wstringop-overflow
6221 -Wstringop-overflow=1
6222 The -Wstringop-overflow=1 option uses type-zero Object Size
6223 Checking to determine the sizes of destination objects. At
6224 this setting the option does not warn for writes past the end
6225 of subobjects of larger objects accessed by pointers unless the
6226 size of the largest surrounding object is known. When the
6227 destination may be one of several objects it is assumed to be
6228 the largest one of them. On Linux systems, when optimization
6229 is enabled at this setting the option warns for the same code
6230 as when the "_FORTIFY_SOURCE" macro is defined to a non-zero
6231 value.
6232
6233 -Wstringop-overflow=2
6234 The -Wstringop-overflow=2 option uses type-one Object Size
6235 Checking to determine the sizes of destination objects. At
6236 this setting the option warns about overflows when writing to
6237 members of the largest complete objects whose exact size is
6238 known. However, it does not warn for excessive writes to the
6239 same members of unknown objects referenced by pointers since
6240 they may point to arrays containing unknown numbers of
6241 elements. This is the default setting of the option.
6242
6243 -Wstringop-overflow=3
6244 The -Wstringop-overflow=3 option uses type-two Object Size
6245 Checking to determine the sizes of destination objects. At
6246 this setting the option warns about overflowing the smallest
6247 object or data member. This is the most restrictive setting of
6248 the option that may result in warnings for safe code.
6249
6250 -Wstringop-overflow=4
6251 The -Wstringop-overflow=4 option uses type-three Object Size
6252 Checking to determine the sizes of destination objects. At
6253 this setting the option warns about overflowing any data
6254 members, and when the destination is one of several objects it
6255 uses the size of the largest of them to decide whether to issue
6256 a warning. Similarly to -Wstringop-overflow=3 this setting of
6257 the option may result in warnings for benign code.
6258
6259 -Wno-stringop-overread
6260 Warn for calls to string manipulation functions such as "memchr",
6261 or "strcpy" that are determined to read past the end of the source
6262 sequence.
6263
6264 Option -Wstringop-overread is enabled by default.
6265
6266 -Wno-stringop-truncation
6267 Do not warn for calls to bounded string manipulation functions such
6268 as "strncat", "strncpy", and "stpncpy" that may either truncate the
6269 copied string or leave the destination unchanged.
6270
6271 In the following example, the call to "strncat" specifies a bound
6272 that is less than the length of the source string. As a result,
6273 the copy of the source will be truncated and so the call is
6274 diagnosed. To avoid the warning use "bufsize - strlen (buf) - 1)"
6275 as the bound.
6276
6277 void append (char *buf, size_t bufsize)
6278 {
6279 strncat (buf, ".txt", 3);
6280 }
6281
6282 As another example, the following call to "strncpy" results in
6283 copying to "d" just the characters preceding the terminating NUL,
6284 without appending the NUL to the end. Assuming the result of
6285 "strncpy" is necessarily a NUL-terminated string is a common
6286 mistake, and so the call is diagnosed. To avoid the warning when
6287 the result is not expected to be NUL-terminated, call "memcpy"
6288 instead.
6289
6290 void copy (char *d, const char *s)
6291 {
6292 strncpy (d, s, strlen (s));
6293 }
6294
6295 In the following example, the call to "strncpy" specifies the size
6296 of the destination buffer as the bound. If the length of the
6297 source string is equal to or greater than this size the result of
6298 the copy will not be NUL-terminated. Therefore, the call is also
6299 diagnosed. To avoid the warning, specify "sizeof buf - 1" as the
6300 bound and set the last element of the buffer to "NUL".
6301
6302 void copy (const char *s)
6303 {
6304 char buf[80];
6305 strncpy (buf, s, sizeof buf);
6306 ...
6307 }
6308
6309 In situations where a character array is intended to store a
6310 sequence of bytes with no terminating "NUL" such an array may be
6311 annotated with attribute "nonstring" to avoid this warning. Such
6312 arrays, however, are not suitable arguments to functions that
6313 expect "NUL"-terminated strings. To help detect accidental misuses
6314 of such arrays GCC issues warnings unless it can prove that the use
6315 is safe.
6316
6317 -Wstrict-flex-arrays
6318 Warn about inproper usages of flexible array members according to
6319 the level of the "strict_flex_array (level)" attribute attached to
6320 the trailing array field of a structure if it's available,
6321 otherwise according to the level of the option
6322 -fstrict-flex-arrays=level.
6323
6324 This option is effective only when level is bigger than 0.
6325 Otherwise, it will be ignored with a warning.
6326
6327 when level=1, warnings will be issued for a trailing array
6328 reference of a structure that have 2 or more elements if the
6329 trailing array is referenced as a flexible array member.
6330
6331 when level=2, in addition to level=1, additional warnings will be
6332 issued for a trailing one-element array reference of a structure if
6333 the array is referenced as a flexible array member.
6334
6335 when level=3, in addition to level=2, additional warnings will be
6336 issued for a trailing zero-length array reference of a structure if
6337 the array is referenced as a flexible array member.
6338
6339 -Wsuggest-attribute=[pure|const|noreturn|format|cold|malloc]
6340 Warn for cases where adding an attribute may be beneficial. The
6341 attributes currently supported are listed below.
6342
6343 -Wsuggest-attribute=pure
6344 -Wsuggest-attribute=const
6345 -Wsuggest-attribute=noreturn
6346 -Wmissing-noreturn
6347 -Wsuggest-attribute=malloc
6348 Warn about functions that might be candidates for attributes
6349 "pure", "const" or "noreturn" or "malloc". The compiler only
6350 warns for functions visible in other compilation units or (in
6351 the case of "pure" and "const") if it cannot prove that the
6352 function returns normally. A function returns normally if it
6353 doesn't contain an infinite loop or return abnormally by
6354 throwing, calling "abort" or trapping. This analysis requires
6355 option -fipa-pure-const, which is enabled by default at -O and
6356 higher. Higher optimization levels improve the accuracy of the
6357 analysis.
6358
6359 -Wsuggest-attribute=format
6360 -Wmissing-format-attribute
6361 Warn about function pointers that might be candidates for
6362 "format" attributes. Note these are only possible candidates,
6363 not absolute ones. GCC guesses that function pointers with
6364 "format" attributes that are used in assignment,
6365 initialization, parameter passing or return statements should
6366 have a corresponding "format" attribute in the resulting type.
6367 I.e. the left-hand side of the assignment or initialization,
6368 the type of the parameter variable, or the return type of the
6369 containing function respectively should also have a "format"
6370 attribute to avoid the warning.
6371
6372 GCC also warns about function definitions that might be
6373 candidates for "format" attributes. Again, these are only
6374 possible candidates. GCC guesses that "format" attributes
6375 might be appropriate for any function that calls a function
6376 like "vprintf" or "vscanf", but this might not always be the
6377 case, and some functions for which "format" attributes are
6378 appropriate may not be detected.
6379
6380 -Wsuggest-attribute=cold
6381 Warn about functions that might be candidates for "cold"
6382 attribute. This is based on static detection and generally
6383 only warns about functions which always leads to a call to
6384 another "cold" function such as wrappers of C++ "throw" or
6385 fatal error reporting functions leading to "abort".
6386
6387 -Walloc-zero
6388 Warn about calls to allocation functions decorated with attribute
6389 "alloc_size" that specify zero bytes, including those to the built-
6390 in forms of the functions "aligned_alloc", "alloca", "calloc",
6391 "malloc", and "realloc". Because the behavior of these functions
6392 when called with a zero size differs among implementations (and in
6393 the case of "realloc" has been deprecated) relying on it may result
6394 in subtle portability bugs and should be avoided.
6395
6396 -Walloc-size-larger-than=byte-size
6397 Warn about calls to functions decorated with attribute "alloc_size"
6398 that attempt to allocate objects larger than the specified number
6399 of bytes, or where the result of the size computation in an integer
6400 type with infinite precision would exceed the value of PTRDIFF_MAX
6401 on the target. -Walloc-size-larger-than=PTRDIFF_MAX is enabled by
6402 default. Warnings controlled by the option can be disabled either
6403 by specifying byte-size of SIZE_MAX or more or by
6404 -Wno-alloc-size-larger-than.
6405
6406 -Wno-alloc-size-larger-than
6407 Disable -Walloc-size-larger-than= warnings. The option is
6408 equivalent to -Walloc-size-larger-than=SIZE_MAX or larger.
6409
6410 -Walloca
6411 This option warns on all uses of "alloca" in the source.
6412
6413 -Walloca-larger-than=byte-size
6414 This option warns on calls to "alloca" with an integer argument
6415 whose value is either zero, or that is not bounded by a controlling
6416 predicate that limits its value to at most byte-size. It also
6417 warns for calls to "alloca" where the bound value is unknown.
6418 Arguments of non-integer types are considered unbounded even if
6419 they appear to be constrained to the expected range.
6420
6421 For example, a bounded case of "alloca" could be:
6422
6423 void func (size_t n)
6424 {
6425 void *p;
6426 if (n <= 1000)
6427 p = alloca (n);
6428 else
6429 p = malloc (n);
6430 f (p);
6431 }
6432
6433 In the above example, passing "-Walloca-larger-than=1000" would not
6434 issue a warning because the call to "alloca" is known to be at most
6435 1000 bytes. However, if "-Walloca-larger-than=500" were passed,
6436 the compiler would emit a warning.
6437
6438 Unbounded uses, on the other hand, are uses of "alloca" with no
6439 controlling predicate constraining its integer argument. For
6440 example:
6441
6442 void func ()
6443 {
6444 void *p = alloca (n);
6445 f (p);
6446 }
6447
6448 If "-Walloca-larger-than=500" were passed, the above would trigger
6449 a warning, but this time because of the lack of bounds checking.
6450
6451 Note, that even seemingly correct code involving signed integers
6452 could cause a warning:
6453
6454 void func (signed int n)
6455 {
6456 if (n < 500)
6457 {
6458 p = alloca (n);
6459 f (p);
6460 }
6461 }
6462
6463 In the above example, n could be negative, causing a larger than
6464 expected argument to be implicitly cast into the "alloca" call.
6465
6466 This option also warns when "alloca" is used in a loop.
6467
6468 -Walloca-larger-than=PTRDIFF_MAX is enabled by default but is
6469 usually only effective when -ftree-vrp is active (default for -O2
6470 and above).
6471
6472 See also -Wvla-larger-than=byte-size.
6473
6474 -Wno-alloca-larger-than
6475 Disable -Walloca-larger-than= warnings. The option is equivalent
6476 to -Walloca-larger-than=SIZE_MAX or larger.
6477
6478 -Warith-conversion
6479 Do warn about implicit conversions from arithmetic operations even
6480 when conversion of the operands to the same type cannot change
6481 their values. This affects warnings from -Wconversion,
6482 -Wfloat-conversion, and -Wsign-conversion.
6483
6484 void f (char c, int i)
6485 {
6486 c = c + i; // warns with B<-Wconversion>
6487 c = c + 1; // only warns with B<-Warith-conversion>
6488 }
6489
6490 -Warray-bounds
6491 -Warray-bounds=n
6492 Warn about out of bounds subscripts or offsets into arrays. This
6493 warning is enabled by -Wall. It is more effective when -ftree-vrp
6494 is active (the default for -O2 and above) but a subset of instances
6495 are issued even without optimization.
6496
6497 By default, the trailing array of a structure will be treated as a
6498 flexible array member by -Warray-bounds or -Warray-bounds=n if it
6499 is declared as either a flexible array member per C99 standard
6500 onwards ([]), a GCC zero-length array extension ([0]), or an one-
6501 element array ([1]). As a result, out of bounds subscripts or
6502 offsets into zero-length arrays or one-element arrays are not
6503 warned by default.
6504
6505 You can add the option -fstrict-flex-arrays or
6506 -fstrict-flex-arrays=level to control how this option treat
6507 trailing array of a structure as a flexible array member:
6508
6509 when level<=1, no change to the default behavior.
6510
6511 when level=2, additional warnings will be issued for out of bounds
6512 subscripts or offsets into one-element arrays;
6513
6514 when level=3, in addition to level=2, additional warnings will be
6515 issued for out of bounds subscripts or offsets into zero-length
6516 arrays.
6517
6518 -Warray-bounds=1
6519 This is the default warning level of -Warray-bounds and is
6520 enabled by -Wall; higher levels are not, and must be explicitly
6521 requested.
6522
6523 -Warray-bounds=2
6524 This warning level also warns about the intermediate results of
6525 pointer arithmetic that may yield out of bounds values. This
6526 warning level may give a larger number of false positives and
6527 is deactivated by default.
6528
6529 -Warray-compare
6530 Warn about equality and relational comparisons between two operands
6531 of array type. This comparison was deprecated in C++20. For
6532 example:
6533
6534 int arr1[5];
6535 int arr2[5];
6536 bool same = arr1 == arr2;
6537
6538 -Warray-compare is enabled by -Wall.
6539
6540 -Warray-parameter
6541 -Warray-parameter=n
6542 Warn about redeclarations of functions involving arguments of array
6543 or pointer types of inconsistent kinds or forms, and enable the
6544 detection of out-of-bounds accesses to such parameters by warnings
6545 such as -Warray-bounds.
6546
6547 If the first function declaration uses the array form the bound
6548 specified in the array is assumed to be the minimum number of
6549 elements expected to be provided in calls to the function and the
6550 maximum number of elements accessed by it. Failing to provide
6551 arguments of sufficient size or accessing more than the maximum
6552 number of elements may be diagnosed by warnings such as
6553 -Warray-bounds. At level 1 the warning diagnoses inconsistencies
6554 involving array parameters declared using the "T[static N]" form.
6555
6556 For example, the warning triggers for the following redeclarations
6557 because the first one allows an array of any size to be passed to
6558 "f" while the second one with the keyword "static" specifies that
6559 the array argument must have at least four elements.
6560
6561 void f (int[static 4]);
6562 void f (int[]); // warning (inconsistent array form)
6563
6564 void g (void)
6565 {
6566 int *p = (int *)malloc (4);
6567 f (p); // warning (array too small)
6568 ...
6569 }
6570
6571 At level 2 the warning also triggers for redeclarations involving
6572 any other inconsistency in array or pointer argument forms denoting
6573 array sizes. Pointers and arrays of unspecified bound are
6574 considered equivalent and do not trigger a warning.
6575
6576 void g (int*);
6577 void g (int[]); // no warning
6578 void g (int[8]); // warning (inconsistent array bound)
6579
6580 -Warray-parameter=2 is included in -Wall. The -Wvla-parameter
6581 option triggers warnings for similar inconsistencies involving
6582 Variable Length Array arguments.
6583
6584 -Wattribute-alias=n
6585 -Wno-attribute-alias
6586 Warn about declarations using the "alias" and similar attributes
6587 whose target is incompatible with the type of the alias.
6588
6589 -Wattribute-alias=1
6590 The default warning level of the -Wattribute-alias option
6591 diagnoses incompatibilities between the type of the alias
6592 declaration and that of its target. Such incompatibilities are
6593 typically indicative of bugs.
6594
6595 -Wattribute-alias=2
6596 At this level -Wattribute-alias also diagnoses cases where the
6597 attributes of the alias declaration are more restrictive than
6598 the attributes applied to its target. These mismatches can
6599 potentially result in incorrect code generation. In other
6600 cases they may be benign and could be resolved simply by adding
6601 the missing attribute to the target. For comparison, see the
6602 -Wmissing-attributes option, which controls diagnostics when
6603 the alias declaration is less restrictive than the target,
6604 rather than more restrictive.
6605
6606 Attributes considered include "alloc_align", "alloc_size",
6607 "cold", "const", "hot", "leaf", "malloc", "nonnull",
6608 "noreturn", "nothrow", "pure", "returns_nonnull", and
6609 "returns_twice".
6610
6611 -Wattribute-alias is equivalent to -Wattribute-alias=1. This is
6612 the default. You can disable these warnings with either
6613 -Wno-attribute-alias or -Wattribute-alias=0.
6614
6615 -Wbidi-chars=[none|unpaired|any|ucn]
6616 Warn about possibly misleading UTF-8 bidirectional control
6617 characters in comments, string literals, character constants, and
6618 identifiers. Such characters can change left-to-right writing
6619 direction into right-to-left (and vice versa), which can cause
6620 confusion between the logical order and visual order. This may be
6621 dangerous; for instance, it may seem that a piece of code is not
6622 commented out, whereas it in fact is.
6623
6624 There are three levels of warning supported by GCC. The default is
6625 -Wbidi-chars=unpaired, which warns about improperly terminated bidi
6626 contexts. -Wbidi-chars=none turns the warning off.
6627 -Wbidi-chars=any warns about any use of bidirectional control
6628 characters.
6629
6630 By default, this warning does not warn about UCNs. It is, however,
6631 possible to turn on such checking by using
6632 -Wbidi-chars=unpaired,ucn or -Wbidi-chars=any,ucn. Using
6633 -Wbidi-chars=ucn is valid, and is equivalent to
6634 -Wbidi-chars=unpaired,ucn, if no previous -Wbidi-chars=any was
6635 specified.
6636
6637 -Wbool-compare
6638 Warn about boolean expression compared with an integer value
6639 different from "true"/"false". For instance, the following
6640 comparison is always false:
6641
6642 int n = 5;
6643 ...
6644 if ((n > 1) == 2) { ... }
6645
6646 This warning is enabled by -Wall.
6647
6648 -Wbool-operation
6649 Warn about suspicious operations on expressions of a boolean type.
6650 For instance, bitwise negation of a boolean is very likely a bug in
6651 the program. For C, this warning also warns about incrementing or
6652 decrementing a boolean, which rarely makes sense. (In C++,
6653 decrementing a boolean is always invalid. Incrementing a boolean
6654 is invalid in C++17, and deprecated otherwise.)
6655
6656 This warning is enabled by -Wall.
6657
6658 -Wduplicated-branches
6659 Warn when an if-else has identical branches. This warning detects
6660 cases like
6661
6662 if (p != NULL)
6663 return 0;
6664 else
6665 return 0;
6666
6667 It doesn't warn when both branches contain just a null statement.
6668 This warning also warn for conditional operators:
6669
6670 int i = x ? *p : *p;
6671
6672 -Wduplicated-cond
6673 Warn about duplicated conditions in an if-else-if chain. For
6674 instance, warn for the following code:
6675
6676 if (p->q != NULL) { ... }
6677 else if (p->q != NULL) { ... }
6678
6679 -Wframe-address
6680 Warn when the __builtin_frame_address or __builtin_return_address
6681 is called with an argument greater than 0. Such calls may return
6682 indeterminate values or crash the program. The warning is included
6683 in -Wall.
6684
6685 -Wno-discarded-qualifiers (C and Objective-C only)
6686 Do not warn if type qualifiers on pointers are being discarded.
6687 Typically, the compiler warns if a "const char *" variable is
6688 passed to a function that takes a "char *" parameter. This option
6689 can be used to suppress such a warning.
6690
6691 -Wno-discarded-array-qualifiers (C and Objective-C only)
6692 Do not warn if type qualifiers on arrays which are pointer targets
6693 are being discarded. Typically, the compiler warns if a "const int
6694 (*)[]" variable is passed to a function that takes a "int (*)[]"
6695 parameter. This option can be used to suppress such a warning.
6696
6697 -Wno-incompatible-pointer-types (C and Objective-C only)
6698 Do not warn when there is a conversion between pointers that have
6699 incompatible types. This warning is for cases not covered by
6700 -Wno-pointer-sign, which warns for pointer argument passing or
6701 assignment with different signedness.
6702
6703 -Wno-int-conversion (C and Objective-C only)
6704 Do not warn about incompatible integer to pointer and pointer to
6705 integer conversions. This warning is about implicit conversions;
6706 for explicit conversions the warnings -Wno-int-to-pointer-cast and
6707 -Wno-pointer-to-int-cast may be used.
6708
6709 -Wzero-length-bounds
6710 Warn about accesses to elements of zero-length array members that
6711 might overlap other members of the same object. Declaring interior
6712 zero-length arrays is discouraged because accesses to them are
6713 undefined.
6714
6715 For example, the first two stores in function "bad" are diagnosed
6716 because the array elements overlap the subsequent members "b" and
6717 "c". The third store is diagnosed by -Warray-bounds because it is
6718 beyond the bounds of the enclosing object.
6719
6720 struct X { int a[0]; int b, c; };
6721 struct X x;
6722
6723 void bad (void)
6724 {
6725 x.a[0] = 0; // -Wzero-length-bounds
6726 x.a[1] = 1; // -Wzero-length-bounds
6727 x.a[2] = 2; // -Warray-bounds
6728 }
6729
6730 Option -Wzero-length-bounds is enabled by -Warray-bounds.
6731
6732 -Wno-div-by-zero
6733 Do not warn about compile-time integer division by zero. Floating-
6734 point division by zero is not warned about, as it can be a
6735 legitimate way of obtaining infinities and NaNs.
6736
6737 -Wsystem-headers
6738 Print warning messages for constructs found in system header files.
6739 Warnings from system headers are normally suppressed, on the
6740 assumption that they usually do not indicate real problems and
6741 would only make the compiler output harder to read. Using this
6742 command-line option tells GCC to emit warnings from system headers
6743 as if they occurred in user code. However, note that using -Wall
6744 in conjunction with this option does not warn about unknown pragmas
6745 in system headers---for that, -Wunknown-pragmas must also be used.
6746
6747 -Wtautological-compare
6748 Warn if a self-comparison always evaluates to true or false. This
6749 warning detects various mistakes such as:
6750
6751 int i = 1;
6752 ...
6753 if (i > i) { ... }
6754
6755 This warning also warns about bitwise comparisons that always
6756 evaluate to true or false, for instance:
6757
6758 if ((a & 16) == 10) { ... }
6759
6760 will always be false.
6761
6762 This warning is enabled by -Wall.
6763
6764 -Wtrampolines
6765 Warn about trampolines generated for pointers to nested functions.
6766 A trampoline is a small piece of data or code that is created at
6767 run time on the stack when the address of a nested function is
6768 taken, and is used to call the nested function indirectly. For
6769 some targets, it is made up of data only and thus requires no
6770 special treatment. But, for most targets, it is made up of code
6771 and thus requires the stack to be made executable in order for the
6772 program to work properly.
6773
6774 -Wfloat-equal
6775 Warn if floating-point values are used in equality comparisons.
6776
6777 The idea behind this is that sometimes it is convenient (for the
6778 programmer) to consider floating-point values as approximations to
6779 infinitely precise real numbers. If you are doing this, then you
6780 need to compute (by analyzing the code, or in some other way) the
6781 maximum or likely maximum error that the computation introduces,
6782 and allow for it when performing comparisons (and when producing
6783 output, but that's a different problem). In particular, instead of
6784 testing for equality, you should check to see whether the two
6785 values have ranges that overlap; and this is done with the
6786 relational operators, so equality comparisons are probably
6787 mistaken.
6788
6789 -Wtraditional (C and Objective-C only)
6790 Warn about certain constructs that behave differently in
6791 traditional and ISO C. Also warn about ISO C constructs that have
6792 no traditional C equivalent, and/or problematic constructs that
6793 should be avoided.
6794
6795 * Macro parameters that appear within string literals in the
6796 macro body. In traditional C macro replacement takes place
6797 within string literals, but in ISO C it does not.
6798
6799 * In traditional C, some preprocessor directives did not exist.
6800 Traditional preprocessors only considered a line to be a
6801 directive if the # appeared in column 1 on the line. Therefore
6802 -Wtraditional warns about directives that traditional C
6803 understands but ignores because the # does not appear as the
6804 first character on the line. It also suggests you hide
6805 directives like "#pragma" not understood by traditional C by
6806 indenting them. Some traditional implementations do not
6807 recognize "#elif", so this option suggests avoiding it
6808 altogether.
6809
6810 * A function-like macro that appears without arguments.
6811
6812 * The unary plus operator.
6813
6814 * The U integer constant suffix, or the F or L floating-point
6815 constant suffixes. (Traditional C does support the L suffix on
6816 integer constants.) Note, these suffixes appear in macros
6817 defined in the system headers of most modern systems, e.g. the
6818 _MIN/_MAX macros in "<limits.h>". Use of these macros in user
6819 code might normally lead to spurious warnings, however GCC's
6820 integrated preprocessor has enough context to avoid warning in
6821 these cases.
6822
6823 * A function declared external in one block and then used after
6824 the end of the block.
6825
6826 * A "switch" statement has an operand of type "long".
6827
6828 * A non-"static" function declaration follows a "static" one.
6829 This construct is not accepted by some traditional C compilers.
6830
6831 * The ISO type of an integer constant has a different width or
6832 signedness from its traditional type. This warning is only
6833 issued if the base of the constant is ten. I.e. hexadecimal or
6834 octal values, which typically represent bit patterns, are not
6835 warned about.
6836
6837 * Usage of ISO string concatenation is detected.
6838
6839 * Initialization of automatic aggregates.
6840
6841 * Identifier conflicts with labels. Traditional C lacks a
6842 separate namespace for labels.
6843
6844 * Initialization of unions. If the initializer is zero, the
6845 warning is omitted. This is done under the assumption that the
6846 zero initializer in user code appears conditioned on e.g.
6847 "__STDC__" to avoid missing initializer warnings and relies on
6848 default initialization to zero in the traditional C case.
6849
6850 * Conversions by prototypes between fixed/floating-point values
6851 and vice versa. The absence of these prototypes when compiling
6852 with traditional C causes serious problems. This is a subset
6853 of the possible conversion warnings; for the full set use
6854 -Wtraditional-conversion.
6855
6856 * Use of ISO C style function definitions. This warning
6857 intentionally is not issued for prototype declarations or
6858 variadic functions because these ISO C features appear in your
6859 code when using libiberty's traditional C compatibility macros,
6860 "PARAMS" and "VPARAMS". This warning is also bypassed for
6861 nested functions because that feature is already a GCC
6862 extension and thus not relevant to traditional C compatibility.
6863
6864 -Wtraditional-conversion (C and Objective-C only)
6865 Warn if a prototype causes a type conversion that is different from
6866 what would happen to the same argument in the absence of a
6867 prototype. This includes conversions of fixed point to floating
6868 and vice versa, and conversions changing the width or signedness of
6869 a fixed-point argument except when the same as the default
6870 promotion.
6871
6872 -Wdeclaration-after-statement (C and Objective-C only)
6873 Warn when a declaration is found after a statement in a block.
6874 This construct, known from C++, was introduced with ISO C99 and is
6875 by default allowed in GCC. It is not supported by ISO C90.
6876
6877 -Wshadow
6878 Warn whenever a local variable or type declaration shadows another
6879 variable, parameter, type, class member (in C++), or instance
6880 variable (in Objective-C) or whenever a built-in function is
6881 shadowed. Note that in C++, the compiler warns if a local variable
6882 shadows an explicit typedef, but not if it shadows a
6883 struct/class/enum. If this warning is enabled, it includes also
6884 all instances of local shadowing. This means that
6885 -Wno-shadow=local and -Wno-shadow=compatible-local are ignored when
6886 -Wshadow is used. Same as -Wshadow=global.
6887
6888 -Wno-shadow-ivar (Objective-C only)
6889 Do not warn whenever a local variable shadows an instance variable
6890 in an Objective-C method.
6891
6892 -Wshadow=global
6893 Warn for any shadowing. Same as -Wshadow.
6894
6895 -Wshadow=local
6896 Warn when a local variable shadows another local variable or
6897 parameter.
6898
6899 -Wshadow=compatible-local
6900 Warn when a local variable shadows another local variable or
6901 parameter whose type is compatible with that of the shadowing
6902 variable. In C++, type compatibility here means the type of the
6903 shadowing variable can be converted to that of the shadowed
6904 variable. The creation of this flag (in addition to
6905 -Wshadow=local) is based on the idea that when a local variable
6906 shadows another one of incompatible type, it is most likely
6907 intentional, not a bug or typo, as shown in the following example:
6908
6909 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6910 {
6911 for (int i = 0; i < N; ++i)
6912 {
6913 ...
6914 }
6915 ...
6916 }
6917
6918 Since the two variable "i" in the example above have incompatible
6919 types, enabling only -Wshadow=compatible-local does not emit a
6920 warning. Because their types are incompatible, if a programmer
6921 accidentally uses one in place of the other, type checking is
6922 expected to catch that and emit an error or warning. Use of this
6923 flag instead of -Wshadow=local can possibly reduce the number of
6924 warnings triggered by intentional shadowing. Note that this also
6925 means that shadowing "const char *i" by "char *i" does not emit a
6926 warning.
6927
6928 This warning is also enabled by -Wshadow=local.
6929
6930 -Wlarger-than=byte-size
6931 Warn whenever an object is defined whose size exceeds byte-size.
6932 -Wlarger-than=PTRDIFF_MAX is enabled by default. Warnings
6933 controlled by the option can be disabled either by specifying byte-
6934 size of SIZE_MAX or more or by -Wno-larger-than.
6935
6936 Also warn for calls to bounded functions such as "memchr" or
6937 "strnlen" that specify a bound greater than the largest possible
6938 object, which is PTRDIFF_MAX bytes by default. These warnings can
6939 only be disabled by -Wno-larger-than.
6940
6941 -Wno-larger-than
6942 Disable -Wlarger-than= warnings. The option is equivalent to
6943 -Wlarger-than=SIZE_MAX or larger.
6944
6945 -Wframe-larger-than=byte-size
6946 Warn if the size of a function frame exceeds byte-size. The
6947 computation done to determine the stack frame size is approximate
6948 and not conservative. The actual requirements may be somewhat
6949 greater than byte-size even if you do not get a warning. In
6950 addition, any space allocated via "alloca", variable-length arrays,
6951 or related constructs is not included by the compiler when
6952 determining whether or not to issue a warning.
6953 -Wframe-larger-than=PTRDIFF_MAX is enabled by default. Warnings
6954 controlled by the option can be disabled either by specifying byte-
6955 size of SIZE_MAX or more or by -Wno-frame-larger-than.
6956
6957 -Wno-frame-larger-than
6958 Disable -Wframe-larger-than= warnings. The option is equivalent to
6959 -Wframe-larger-than=SIZE_MAX or larger.
6960
6961 -Wfree-nonheap-object
6962 Warn when attempting to deallocate an object that was either not
6963 allocated on the heap, or by using a pointer that was not returned
6964 from a prior call to the corresponding allocation function. For
6965 example, because the call to "stpcpy" returns a pointer to the
6966 terminating nul character and not to the beginning of the object,
6967 the call to "free" below is diagnosed.
6968
6969 void f (char *p)
6970 {
6971 p = stpcpy (p, "abc");
6972 // ...
6973 free (p); // warning
6974 }
6975
6976 -Wfree-nonheap-object is included in -Wall.
6977
6978 -Wstack-usage=byte-size
6979 Warn if the stack usage of a function might exceed byte-size. The
6980 computation done to determine the stack usage is conservative. Any
6981 space allocated via "alloca", variable-length arrays, or related
6982 constructs is included by the compiler when determining whether or
6983 not to issue a warning.
6984
6985 The message is in keeping with the output of -fstack-usage.
6986
6987 * If the stack usage is fully static but exceeds the specified
6988 amount, it's:
6989
6990 warning: stack usage is 1120 bytes
6991
6992 * If the stack usage is (partly) dynamic but bounded, it's:
6993
6994 warning: stack usage might be 1648 bytes
6995
6996 * If the stack usage is (partly) dynamic and not bounded, it's:
6997
6998 warning: stack usage might be unbounded
6999
7000 -Wstack-usage=PTRDIFF_MAX is enabled by default. Warnings
7001 controlled by the option can be disabled either by specifying byte-
7002 size of SIZE_MAX or more or by -Wno-stack-usage.
7003
7004 -Wno-stack-usage
7005 Disable -Wstack-usage= warnings. The option is equivalent to
7006 -Wstack-usage=SIZE_MAX or larger.
7007
7008 -Wunsafe-loop-optimizations
7009 Warn if the loop cannot be optimized because the compiler cannot
7010 assume anything on the bounds of the loop indices. With
7011 -funsafe-loop-optimizations warn if the compiler makes such
7012 assumptions.
7013
7014 -Wno-pedantic-ms-format (MinGW targets only)
7015 When used in combination with -Wformat and -pedantic without GNU
7016 extensions, this option disables the warnings about non-ISO
7017 "printf" / "scanf" format width specifiers "I32", "I64", and "I"
7018 used on Windows targets, which depend on the MS runtime.
7019
7020 -Wpointer-arith
7021 Warn about anything that depends on the "size of" a function type
7022 or of "void". GNU C assigns these types a size of 1, for
7023 convenience in calculations with "void *" pointers and pointers to
7024 functions. In C++, warn also when an arithmetic operation involves
7025 "NULL". This warning is also enabled by -Wpedantic.
7026
7027 -Wno-pointer-compare
7028 Do not warn if a pointer is compared with a zero character
7029 constant. This usually means that the pointer was meant to be
7030 dereferenced. For example:
7031
7032 const char *p = foo ();
7033 if (p == '\0')
7034 return 42;
7035
7036 Note that the code above is invalid in C++11.
7037
7038 This warning is enabled by default.
7039
7040 -Wtsan
7041 Warn about unsupported features in ThreadSanitizer.
7042
7043 ThreadSanitizer does not support "std::atomic_thread_fence" and can
7044 report false positives.
7045
7046 This warning is enabled by default.
7047
7048 -Wtype-limits
7049 Warn if a comparison is always true or always false due to the
7050 limited range of the data type, but do not warn for constant
7051 expressions. For example, warn if an unsigned variable is compared
7052 against zero with "<" or ">=". This warning is also enabled by
7053 -Wextra.
7054
7055 -Wabsolute-value (C and Objective-C only)
7056 Warn for calls to standard functions that compute the absolute
7057 value of an argument when a more appropriate standard function is
7058 available. For example, calling abs(3.14) triggers the warning
7059 because the appropriate function to call to compute the absolute
7060 value of a double argument is "fabs". The option also triggers
7061 warnings when the argument in a call to such a function has an
7062 unsigned type. This warning can be suppressed with an explicit
7063 type cast and it is also enabled by -Wextra.
7064
7065 -Wcomment
7066 -Wcomments
7067 Warn whenever a comment-start sequence /* appears in a /* comment,
7068 or whenever a backslash-newline appears in a // comment. This
7069 warning is enabled by -Wall.
7070
7071 -Wtrigraphs
7072 Warn if any trigraphs are encountered that might change the meaning
7073 of the program. Trigraphs within comments are not warned about,
7074 except those that would form escaped newlines.
7075
7076 This option is implied by -Wall. If -Wall is not given, this
7077 option is still enabled unless trigraphs are enabled. To get
7078 trigraph conversion without warnings, but get the other -Wall
7079 warnings, use -trigraphs -Wall -Wno-trigraphs.
7080
7081 -Wundef
7082 Warn if an undefined identifier is evaluated in an "#if" directive.
7083 Such identifiers are replaced with zero.
7084
7085 -Wexpansion-to-defined
7086 Warn whenever defined is encountered in the expansion of a macro
7087 (including the case where the macro is expanded by an #if
7088 directive). Such usage is not portable. This warning is also
7089 enabled by -Wpedantic and -Wextra.
7090
7091 -Wunused-macros
7092 Warn about macros defined in the main file that are unused. A
7093 macro is used if it is expanded or tested for existence at least
7094 once. The preprocessor also warns if the macro has not been used
7095 at the time it is redefined or undefined.
7096
7097 Built-in macros, macros defined on the command line, and macros
7098 defined in include files are not warned about.
7099
7100 Note: If a macro is actually used, but only used in skipped
7101 conditional blocks, then the preprocessor reports it as unused. To
7102 avoid the warning in such a case, you might improve the scope of
7103 the macro's definition by, for example, moving it into the first
7104 skipped block. Alternatively, you could provide a dummy use with
7105 something like:
7106
7107 #if defined the_macro_causing_the_warning
7108 #endif
7109
7110 -Wno-endif-labels
7111 Do not warn whenever an "#else" or an "#endif" are followed by
7112 text. This sometimes happens in older programs with code of the
7113 form
7114
7115 #if FOO
7116 ...
7117 #else FOO
7118 ...
7119 #endif FOO
7120
7121 The second and third "FOO" should be in comments. This warning is
7122 on by default.
7123
7124 -Wbad-function-cast (C and Objective-C only)
7125 Warn when a function call is cast to a non-matching type. For
7126 example, warn if a call to a function returning an integer type is
7127 cast to a pointer type.
7128
7129 -Wc90-c99-compat (C and Objective-C only)
7130 Warn about features not present in ISO C90, but present in ISO C99.
7131 For instance, warn about use of variable length arrays, "long long"
7132 type, "bool" type, compound literals, designated initializers, and
7133 so on. This option is independent of the standards mode. Warnings
7134 are disabled in the expression that follows "__extension__".
7135
7136 -Wc99-c11-compat (C and Objective-C only)
7137 Warn about features not present in ISO C99, but present in ISO C11.
7138 For instance, warn about use of anonymous structures and unions,
7139 "_Atomic" type qualifier, "_Thread_local" storage-class specifier,
7140 "_Alignas" specifier, "Alignof" operator, "_Generic" keyword, and
7141 so on. This option is independent of the standards mode. Warnings
7142 are disabled in the expression that follows "__extension__".
7143
7144 -Wc11-c2x-compat (C and Objective-C only)
7145 Warn about features not present in ISO C11, but present in ISO C2X.
7146 For instance, warn about omitting the string in "_Static_assert",
7147 use of [[]] syntax for attributes, use of decimal floating-point
7148 types, and so on. This option is independent of the standards
7149 mode. Warnings are disabled in the expression that follows
7150 "__extension__".
7151
7152 -Wc++-compat (C and Objective-C only)
7153 Warn about ISO C constructs that are outside of the common subset
7154 of ISO C and ISO C++, e.g. request for implicit conversion from
7155 "void *" to a pointer to non-"void" type.
7156
7157 -Wc++11-compat (C++ and Objective-C++ only)
7158 Warn about C++ constructs whose meaning differs between ISO C++
7159 1998 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are
7160 keywords in ISO C++ 2011. This warning turns on -Wnarrowing and is
7161 enabled by -Wall.
7162
7163 -Wc++14-compat (C++ and Objective-C++ only)
7164 Warn about C++ constructs whose meaning differs between ISO C++
7165 2011 and ISO C++ 2014. This warning is enabled by -Wall.
7166
7167 -Wc++17-compat (C++ and Objective-C++ only)
7168 Warn about C++ constructs whose meaning differs between ISO C++
7169 2014 and ISO C++ 2017. This warning is enabled by -Wall.
7170
7171 -Wc++20-compat (C++ and Objective-C++ only)
7172 Warn about C++ constructs whose meaning differs between ISO C++
7173 2017 and ISO C++ 2020. This warning is enabled by -Wall.
7174
7175 -Wno-c++11-extensions (C++ and Objective-C++ only)
7176 Do not warn about C++11 constructs in code being compiled using an
7177 older C++ standard. Even without this option, some C++11
7178 constructs will only be diagnosed if -Wpedantic is used.
7179
7180 -Wno-c++14-extensions (C++ and Objective-C++ only)
7181 Do not warn about C++14 constructs in code being compiled using an
7182 older C++ standard. Even without this option, some C++14
7183 constructs will only be diagnosed if -Wpedantic is used.
7184
7185 -Wno-c++17-extensions (C++ and Objective-C++ only)
7186 Do not warn about C++17 constructs in code being compiled using an
7187 older C++ standard. Even without this option, some C++17
7188 constructs will only be diagnosed if -Wpedantic is used.
7189
7190 -Wno-c++20-extensions (C++ and Objective-C++ only)
7191 Do not warn about C++20 constructs in code being compiled using an
7192 older C++ standard. Even without this option, some C++20
7193 constructs will only be diagnosed if -Wpedantic is used.
7194
7195 -Wno-c++23-extensions (C++ and Objective-C++ only)
7196 Do not warn about C++23 constructs in code being compiled using an
7197 older C++ standard. Even without this option, some C++23
7198 constructs will only be diagnosed if -Wpedantic is used.
7199
7200 -Wcast-qual
7201 Warn whenever a pointer is cast so as to remove a type qualifier
7202 from the target type. For example, warn if a "const char *" is
7203 cast to an ordinary "char *".
7204
7205 Also warn when making a cast that introduces a type qualifier in an
7206 unsafe way. For example, casting "char **" to "const char **" is
7207 unsafe, as in this example:
7208
7209 /* p is char ** value. */
7210 const char **q = (const char **) p;
7211 /* Assignment of readonly string to const char * is OK. */
7212 *q = "string";
7213 /* Now char** pointer points to read-only memory. */
7214 **p = 'b';
7215
7216 -Wcast-align
7217 Warn whenever a pointer is cast such that the required alignment of
7218 the target is increased. For example, warn if a "char *" is cast
7219 to an "int *" on machines where integers can only be accessed at
7220 two- or four-byte boundaries.
7221
7222 -Wcast-align=strict
7223 Warn whenever a pointer is cast such that the required alignment of
7224 the target is increased. For example, warn if a "char *" is cast
7225 to an "int *" regardless of the target machine.
7226
7227 -Wcast-function-type
7228 Warn when a function pointer is cast to an incompatible function
7229 pointer. In a cast involving function types with a variable
7230 argument list only the types of initial arguments that are provided
7231 are considered. Any parameter of pointer-type matches any other
7232 pointer-type. Any benign differences in integral types are
7233 ignored, like "int" vs. "long" on ILP32 targets. Likewise type
7234 qualifiers are ignored. The function type "void (*) (void)" is
7235 special and matches everything, which can be used to suppress this
7236 warning. In a cast involving pointer to member types this warning
7237 warns whenever the type cast is changing the pointer to member
7238 type. This warning is enabled by -Wextra.
7239
7240 -Wwrite-strings
7241 When compiling C, give string constants the type "const
7242 char[length]" so that copying the address of one into a non-"const"
7243 "char *" pointer produces a warning. These warnings help you find
7244 at compile time code that can try to write into a string constant,
7245 but only if you have been very careful about using "const" in
7246 declarations and prototypes. Otherwise, it is just a nuisance.
7247 This is why we did not make -Wall request these warnings.
7248
7249 When compiling C++, warn about the deprecated conversion from
7250 string literals to "char *". This warning is enabled by default
7251 for C++ programs.
7252
7253 -Wclobbered
7254 Warn for variables that might be changed by "longjmp" or "vfork".
7255 This warning is also enabled by -Wextra.
7256
7257 -Wno-complain-wrong-lang
7258 By default, language front ends complain when a command-line option
7259 is valid, but not applicable to that front end. This may be
7260 disabled with -Wno-complain-wrong-lang, which is mostly useful when
7261 invoking a single compiler driver for multiple source files written
7262 in different languages, for example:
7263
7264 $ g++ -fno-rtti a.cc b.f90
7265
7266 The driver g++ invokes the C++ front end to compile a.cc and the
7267 Fortran front end to compile b.f90. The latter front end diagnoses
7268 f951: Warning: command-line option '-fno-rtti' is valid for
7269 C++/D/ObjC++ but not for Fortran, which may be disabled with
7270 -Wno-complain-wrong-lang.
7271
7272 -Wconversion
7273 Warn for implicit conversions that may alter a value. This includes
7274 conversions between real and integer, like "abs (x)" when "x" is
7275 "double"; conversions between signed and unsigned, like "unsigned
7276 ui = -1"; and conversions to smaller types, like "sqrtf (M_PI)". Do
7277 not warn for explicit casts like "abs ((int) x)" and "ui =
7278 (unsigned) -1", or if the value is not changed by the conversion
7279 like in "abs (2.0)". Warnings about conversions between signed and
7280 unsigned integers can be disabled by using -Wno-sign-conversion.
7281
7282 For C++, also warn for confusing overload resolution for user-
7283 defined conversions; and conversions that never use a type
7284 conversion operator: conversions to "void", the same type, a base
7285 class or a reference to them. Warnings about conversions between
7286 signed and unsigned integers are disabled by default in C++ unless
7287 -Wsign-conversion is explicitly enabled.
7288
7289 Warnings about conversion from arithmetic on a small type back to
7290 that type are only given with -Warith-conversion.
7291
7292 -Wdangling-else
7293 Warn about constructions where there may be confusion to which "if"
7294 statement an "else" branch belongs. Here is an example of such a
7295 case:
7296
7297 {
7298 if (a)
7299 if (b)
7300 foo ();
7301 else
7302 bar ();
7303 }
7304
7305 In C/C++, every "else" branch belongs to the innermost possible
7306 "if" statement, which in this example is "if (b)". This is often
7307 not what the programmer expected, as illustrated in the above
7308 example by indentation the programmer chose. When there is the
7309 potential for this confusion, GCC issues a warning when this flag
7310 is specified. To eliminate the warning, add explicit braces around
7311 the innermost "if" statement so there is no way the "else" can
7312 belong to the enclosing "if". The resulting code looks like this:
7313
7314 {
7315 if (a)
7316 {
7317 if (b)
7318 foo ();
7319 else
7320 bar ();
7321 }
7322 }
7323
7324 This warning is enabled by -Wparentheses.
7325
7326 -Wdangling-pointer
7327 -Wdangling-pointer=n
7328 Warn about uses of pointers (or C++ references) to objects with
7329 automatic storage duration after their lifetime has ended. This
7330 includes local variables declared in nested blocks, compound
7331 literals and other unnamed temporary objects. In addition, warn
7332 about storing the address of such objects in escaped pointers. The
7333 warning is enabled at all optimization levels but may yield
7334 different results with optimization than without.
7335
7336 -Wdangling-pointer=1
7337 At level 1 the warning diagnoses only unconditional uses of
7338 dangling pointers. For example
7339
7340 int f (int c1, int c2, x)
7341 {
7342 char *p = strchr ((char[]){ c1, c2 }, c3);
7343 // warning: dangling pointer to a compound literal
7344 return p ? *p : 'x';
7345 }
7346
7347 In the following function the store of the address of the local
7348 variable "x" in the escaped pointer *p also triggers the
7349 warning.
7350
7351 void g (int **p)
7352 {
7353 int x = 7;
7354 // warning: storing the address of a local variable in *p
7355 *p = &x;
7356 }
7357
7358 -Wdangling-pointer=2
7359 At level 2, in addition to unconditional uses the warning also
7360 diagnoses conditional uses of dangling pointers.
7361
7362 For example, because the array a in the following function is
7363 out of scope when the pointer s that was set to point is used,
7364 the warning triggers at this level.
7365
7366 void f (char *s)
7367 {
7368 if (!s)
7369 {
7370 char a[12] = "tmpname";
7371 s = a;
7372 }
7373 // warning: dangling pointer to a may be used
7374 strcat (s, ".tmp");
7375 ...
7376 }
7377
7378 -Wdangling-pointer=2 is included in -Wall.
7379
7380 -Wdate-time
7381 Warn when macros "__TIME__", "__DATE__" or "__TIMESTAMP__" are
7382 encountered as they might prevent bit-wise-identical reproducible
7383 compilations.
7384
7385 -Wempty-body
7386 Warn if an empty body occurs in an "if", "else" or "do while"
7387 statement. This warning is also enabled by -Wextra.
7388
7389 -Wno-endif-labels
7390 Do not warn about stray tokens after "#else" and "#endif".
7391
7392 -Wenum-compare
7393 Warn about a comparison between values of different enumerated
7394 types. In C++ enumerated type mismatches in conditional
7395 expressions are also diagnosed and the warning is enabled by
7396 default. In C this warning is enabled by -Wall.
7397
7398 -Wenum-conversion
7399 Warn when a value of enumerated type is implicitly converted to a
7400 different enumerated type. This warning is enabled by -Wextra in
7401 C.
7402
7403 -Wenum-int-mismatch (C and Objective-C only)
7404 Warn about mismatches between an enumerated type and an integer
7405 type in declarations. For example:
7406
7407 enum E { l = -1, z = 0, g = 1 };
7408 int foo(void);
7409 enum E foo(void);
7410
7411 In C, an enumerated type is compatible with "char", a signed
7412 integer type, or an unsigned integer type. However, since the
7413 choice of the underlying type of an enumerated type is
7414 implementation-defined, such mismatches may cause portability
7415 issues. In C++, such mismatches are an error. In C, this warning
7416 is enabled by -Wall and -Wc++-compat.
7417
7418 -Wjump-misses-init (C, Objective-C only)
7419 Warn if a "goto" statement or a "switch" statement jumps forward
7420 across the initialization of a variable, or jumps backward to a
7421 label after the variable has been initialized. This only warns
7422 about variables that are initialized when they are declared. This
7423 warning is only supported for C and Objective-C; in C++ this sort
7424 of branch is an error in any case.
7425
7426 -Wjump-misses-init is included in -Wc++-compat. It can be disabled
7427 with the -Wno-jump-misses-init option.
7428
7429 -Wsign-compare
7430 Warn when a comparison between signed and unsigned values could
7431 produce an incorrect result when the signed value is converted to
7432 unsigned. In C++, this warning is also enabled by -Wall. In C, it
7433 is also enabled by -Wextra.
7434
7435 -Wsign-conversion
7436 Warn for implicit conversions that may change the sign of an
7437 integer value, like assigning a signed integer expression to an
7438 unsigned integer variable. An explicit cast silences the warning.
7439 In C, this option is enabled also by -Wconversion.
7440
7441 -Wfloat-conversion
7442 Warn for implicit conversions that reduce the precision of a real
7443 value. This includes conversions from real to integer, and from
7444 higher precision real to lower precision real values. This option
7445 is also enabled by -Wconversion.
7446
7447 -Wno-scalar-storage-order
7448 Do not warn on suspicious constructs involving reverse scalar
7449 storage order.
7450
7451 -Wsizeof-array-div
7452 Warn about divisions of two sizeof operators when the first one is
7453 applied to an array and the divisor does not equal the size of the
7454 array element. In such a case, the computation will not yield the
7455 number of elements in the array, which is likely what the user
7456 intended. This warning warns e.g. about
7457
7458 int fn ()
7459 {
7460 int arr[10];
7461 return sizeof (arr) / sizeof (short);
7462 }
7463
7464 This warning is enabled by -Wall.
7465
7466 -Wsizeof-pointer-div
7467 Warn for suspicious divisions of two sizeof expressions that divide
7468 the pointer size by the element size, which is the usual way to
7469 compute the array size but won't work out correctly with pointers.
7470 This warning warns e.g. about "sizeof (ptr) / sizeof (ptr[0])" if
7471 "ptr" is not an array, but a pointer. This warning is enabled by
7472 -Wall.
7473
7474 -Wsizeof-pointer-memaccess
7475 Warn for suspicious length parameters to certain string and memory
7476 built-in functions if the argument uses "sizeof". This warning
7477 triggers for example for "memset (ptr, 0, sizeof (ptr));" if "ptr"
7478 is not an array, but a pointer, and suggests a possible fix, or
7479 about "memcpy (&foo, ptr, sizeof (&foo));".
7480 -Wsizeof-pointer-memaccess also warns about calls to bounded string
7481 copy functions like "strncat" or "strncpy" that specify as the
7482 bound a "sizeof" expression of the source array. For example, in
7483 the following function the call to "strncat" specifies the size of
7484 the source string as the bound. That is almost certainly a mistake
7485 and so the call is diagnosed.
7486
7487 void make_file (const char *name)
7488 {
7489 char path[PATH_MAX];
7490 strncpy (path, name, sizeof path - 1);
7491 strncat (path, ".text", sizeof ".text");
7492 ...
7493 }
7494
7495 The -Wsizeof-pointer-memaccess option is enabled by -Wall.
7496
7497 -Wno-sizeof-array-argument
7498 Do not warn when the "sizeof" operator is applied to a parameter
7499 that is declared as an array in a function definition. This
7500 warning is enabled by default for C and C++ programs.
7501
7502 -Wmemset-elt-size
7503 Warn for suspicious calls to the "memset" built-in function, if the
7504 first argument references an array, and the third argument is a
7505 number equal to the number of elements, but not equal to the size
7506 of the array in memory. This indicates that the user has omitted a
7507 multiplication by the element size. This warning is enabled by
7508 -Wall.
7509
7510 -Wmemset-transposed-args
7511 Warn for suspicious calls to the "memset" built-in function where
7512 the second argument is not zero and the third argument is zero.
7513 For example, the call "memset (buf, sizeof buf, 0)" is diagnosed
7514 because "memset (buf, 0, sizeof buf)" was meant instead. The
7515 diagnostic is only emitted if the third argument is a literal zero.
7516 Otherwise, if it is an expression that is folded to zero, or a cast
7517 of zero to some type, it is far less likely that the arguments have
7518 been mistakenly transposed and no warning is emitted. This warning
7519 is enabled by -Wall.
7520
7521 -Waddress
7522 Warn about suspicious uses of address expressions. These include
7523 comparing the address of a function or a declared object to the
7524 null pointer constant such as in
7525
7526 void f (void);
7527 void g (void)
7528 {
7529 if (!f) // warning: expression evaluates to false
7530 abort ();
7531 }
7532
7533 comparisons of a pointer to a string literal, such as in
7534
7535 void f (const char *x)
7536 {
7537 if (x == "abc") // warning: expression evaluates to false
7538 puts ("equal");
7539 }
7540
7541 and tests of the results of pointer addition or subtraction for
7542 equality to null, such as in
7543
7544 void f (const int *p, int i)
7545 {
7546 return p + i == NULL;
7547 }
7548
7549 Such uses typically indicate a programmer error: the address of
7550 most functions and objects necessarily evaluates to true (the
7551 exception are weak symbols), so their use in a conditional might
7552 indicate missing parentheses in a function call or a missing
7553 dereference in an array expression. The subset of the warning for
7554 object pointers can be suppressed by casting the pointer operand to
7555 an integer type such as "intptr_t" or "uintptr_t". Comparisons
7556 against string literals result in unspecified behavior and are not
7557 portable, and suggest the intent was to call "strcmp". The warning
7558 is suppressed if the suspicious expression is the result of macro
7559 expansion. -Waddress warning is enabled by -Wall.
7560
7561 -Wno-address-of-packed-member
7562 Do not warn when the address of packed member of struct or union is
7563 taken, which usually results in an unaligned pointer value. This
7564 is enabled by default.
7565
7566 -Wlogical-op
7567 Warn about suspicious uses of logical operators in expressions.
7568 This includes using logical operators in contexts where a bit-wise
7569 operator is likely to be expected. Also warns when the operands of
7570 a logical operator are the same:
7571
7572 extern int a;
7573 if (a < 0 && a < 0) { ... }
7574
7575 -Wlogical-not-parentheses
7576 Warn about logical not used on the left hand side operand of a
7577 comparison. This option does not warn if the right operand is
7578 considered to be a boolean expression. Its purpose is to detect
7579 suspicious code like the following:
7580
7581 int a;
7582 ...
7583 if (!a > 1) { ... }
7584
7585 It is possible to suppress the warning by wrapping the LHS into
7586 parentheses:
7587
7588 if ((!a) > 1) { ... }
7589
7590 This warning is enabled by -Wall.
7591
7592 -Waggregate-return
7593 Warn if any functions that return structures or unions are defined
7594 or called. (In languages where you can return an array, this also
7595 elicits a warning.)
7596
7597 -Wno-aggressive-loop-optimizations
7598 Warn if in a loop with constant number of iterations the compiler
7599 detects undefined behavior in some statement during one or more of
7600 the iterations.
7601
7602 -Wno-attributes
7603 Do not warn if an unexpected "__attribute__" is used, such as
7604 unrecognized attributes, function attributes applied to variables,
7605 etc. This does not stop errors for incorrect use of supported
7606 attributes.
7607
7608 Additionally, using -Wno-attributes=, it is possible to suppress
7609 warnings about unknown scoped attributes (in C++11 and C2X). For
7610 example, -Wno-attributes=vendor::attr disables warning about the
7611 following declaration:
7612
7613 [[vendor::attr]] void f();
7614
7615 It is also possible to disable warning about all attributes in a
7616 namespace using -Wno-attributes=vendor:: which prevents warning
7617 about both of these declarations:
7618
7619 [[vendor::safe]] void f();
7620 [[vendor::unsafe]] void f2();
7621
7622 Note that -Wno-attributes= does not imply -Wno-attributes.
7623
7624 -Wno-builtin-declaration-mismatch
7625 Warn if a built-in function is declared with an incompatible
7626 signature or as a non-function, or when a built-in function
7627 declared with a type that does not include a prototype is called
7628 with arguments whose promoted types do not match those expected by
7629 the function. When -Wextra is specified, also warn when a built-in
7630 function that takes arguments is declared without a prototype. The
7631 -Wbuiltin-declaration-mismatch warning is enabled by default. To
7632 avoid the warning include the appropriate header to bring the
7633 prototypes of built-in functions into scope.
7634
7635 For example, the call to "memset" below is diagnosed by the warning
7636 because the function expects a value of type "size_t" as its
7637 argument but the type of 32 is "int". With -Wextra, the
7638 declaration of the function is diagnosed as well.
7639
7640 extern void* memset ();
7641 void f (void *d)
7642 {
7643 memset (d, '\0', 32);
7644 }
7645
7646 -Wno-builtin-macro-redefined
7647 Do not warn if certain built-in macros are redefined. This
7648 suppresses warnings for redefinition of "__TIMESTAMP__",
7649 "__TIME__", "__DATE__", "__FILE__", and "__BASE_FILE__".
7650
7651 -Wstrict-prototypes (C and Objective-C only)
7652 Warn if a function is declared or defined without specifying the
7653 argument types. (An old-style function definition is permitted
7654 without a warning if preceded by a declaration that specifies the
7655 argument types.)
7656
7657 -Wold-style-declaration (C and Objective-C only)
7658 Warn for obsolescent usages, according to the C Standard, in a
7659 declaration. For example, warn if storage-class specifiers like
7660 "static" are not the first things in a declaration. This warning
7661 is also enabled by -Wextra.
7662
7663 -Wold-style-definition (C and Objective-C only)
7664 Warn if an old-style function definition is used. A warning is
7665 given even if there is a previous prototype. A definition using ()
7666 is not considered an old-style definition in C2X mode, because it
7667 is equivalent to (void) in that case, but is considered an old-
7668 style definition for older standards.
7669
7670 -Wmissing-parameter-type (C and Objective-C only)
7671 A function parameter is declared without a type specifier in
7672 K&R-style functions:
7673
7674 void foo(bar) { }
7675
7676 This warning is also enabled by -Wextra.
7677
7678 -Wmissing-prototypes (C and Objective-C only)
7679 Warn if a global function is defined without a previous prototype
7680 declaration. This warning is issued even if the definition itself
7681 provides a prototype. Use this option to detect global functions
7682 that do not have a matching prototype declaration in a header file.
7683 This option is not valid for C++ because all function declarations
7684 provide prototypes and a non-matching declaration declares an
7685 overload rather than conflict with an earlier declaration. Use
7686 -Wmissing-declarations to detect missing declarations in C++.
7687
7688 -Wmissing-declarations
7689 Warn if a global function is defined without a previous
7690 declaration. Do so even if the definition itself provides a
7691 prototype. Use this option to detect global functions that are not
7692 declared in header files. In C, no warnings are issued for
7693 functions with previous non-prototype declarations; use
7694 -Wmissing-prototypes to detect missing prototypes. In C++, no
7695 warnings are issued for function templates, or for inline
7696 functions, or for functions in anonymous namespaces.
7697
7698 -Wmissing-field-initializers
7699 Warn if a structure's initializer has some fields missing. For
7700 example, the following code causes such a warning, because "x.h" is
7701 implicitly zero:
7702
7703 struct s { int f, g, h; };
7704 struct s x = { 3, 4 };
7705
7706 This option does not warn about designated initializers, so the
7707 following modification does not trigger a warning:
7708
7709 struct s { int f, g, h; };
7710 struct s x = { .f = 3, .g = 4 };
7711
7712 In C this option does not warn about the universal zero initializer
7713 { 0 }:
7714
7715 struct s { int f, g, h; };
7716 struct s x = { 0 };
7717
7718 Likewise, in C++ this option does not warn about the empty { }
7719 initializer, for example:
7720
7721 struct s { int f, g, h; };
7722 s x = { };
7723
7724 This warning is included in -Wextra. To get other -Wextra warnings
7725 without this one, use -Wextra -Wno-missing-field-initializers.
7726
7727 -Wno-missing-requires
7728 By default, the compiler warns about a concept-id appearing as a
7729 C++20 simple-requirement:
7730
7731 bool satisfied = requires { C<T> };
7732
7733 Here satisfied will be true if C<T> is a valid expression, which it
7734 is for all T. Presumably the user meant to write
7735
7736 bool satisfied = requires { requires C<T> };
7737
7738 so satisfied is only true if concept C is satisfied for type T.
7739
7740 This warning can be disabled with -Wno-missing-requires.
7741
7742 -Wno-missing-template-keyword
7743 The member access tokens ., -> and :: must be followed by the
7744 "template" keyword if the parent object is dependent and the member
7745 being named is a template.
7746
7747 template <class X>
7748 void DoStuff (X x)
7749 {
7750 x.template DoSomeOtherStuff<X>(); // Good.
7751 x.DoMoreStuff<X>(); // Warning, x is dependent.
7752 }
7753
7754 In rare cases it is possible to get false positives. To silence
7755 this, wrap the expression in parentheses. For example, the
7756 following is treated as a template, even where m and N are
7757 integers:
7758
7759 void NotATemplate (my_class t)
7760 {
7761 int N = 5;
7762
7763 bool test = t.m < N > (0); // Treated as a template.
7764 test = (t.m < N) > (0); // Same meaning, but not treated as a template.
7765 }
7766
7767 This warning can be disabled with -Wno-missing-template-keyword.
7768
7769 -Wno-multichar
7770 Do not warn if a multicharacter constant ('FOOF') is used. Usually
7771 they indicate a typo in the user's code, as they have
7772 implementation-defined values, and should not be used in portable
7773 code.
7774
7775 -Wnormalized=[none|id|nfc|nfkc]
7776 In ISO C and ISO C++, two identifiers are different if they are
7777 different sequences of characters. However, sometimes when
7778 characters outside the basic ASCII character set are used, you can
7779 have two different character sequences that look the same. To
7780 avoid confusion, the ISO 10646 standard sets out some normalization
7781 rules which when applied ensure that two sequences that look the
7782 same are turned into the same sequence. GCC can warn you if you
7783 are using identifiers that have not been normalized; this option
7784 controls that warning.
7785
7786 There are four levels of warning supported by GCC. The default is
7787 -Wnormalized=nfc, which warns about any identifier that is not in
7788 the ISO 10646 "C" normalized form, NFC. NFC is the recommended
7789 form for most uses. It is equivalent to -Wnormalized.
7790
7791 Unfortunately, there are some characters allowed in identifiers by
7792 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7793 identifiers. That is, there's no way to use these symbols in
7794 portable ISO C or C++ and have all your identifiers in NFC.
7795 -Wnormalized=id suppresses the warning for these characters. It is
7796 hoped that future versions of the standards involved will correct
7797 this, which is why this option is not the default.
7798
7799 You can switch the warning off for all characters by writing
7800 -Wnormalized=none or -Wno-normalized. You should only do this if
7801 you are using some other normalization scheme (like "D"), because
7802 otherwise you can easily create bugs that are literally impossible
7803 to see.
7804
7805 Some characters in ISO 10646 have distinct meanings but look
7806 identical in some fonts or display methodologies, especially once
7807 formatting has been applied. For instance "\u207F", "SUPERSCRIPT
7808 LATIN SMALL LETTER N", displays just like a regular "n" that has
7809 been placed in a superscript. ISO 10646 defines the NFKC
7810 normalization scheme to convert all these into a standard form as
7811 well, and GCC warns if your code is not in NFKC if you use
7812 -Wnormalized=nfkc. This warning is comparable to warning about
7813 every identifier that contains the letter O because it might be
7814 confused with the digit 0, and so is not the default, but may be
7815 useful as a local coding convention if the programming environment
7816 cannot be fixed to display these characters distinctly.
7817
7818 -Wno-attribute-warning
7819 Do not warn about usage of functions declared with "warning"
7820 attribute. By default, this warning is enabled.
7821 -Wno-attribute-warning can be used to disable the warning or
7822 -Wno-error=attribute-warning can be used to disable the error when
7823 compiled with -Werror flag.
7824
7825 -Wno-deprecated
7826 Do not warn about usage of deprecated features.
7827
7828 -Wno-deprecated-declarations
7829 Do not warn about uses of functions, variables, and types marked as
7830 deprecated by using the "deprecated" attribute.
7831
7832 -Wno-overflow
7833 Do not warn about compile-time overflow in constant expressions.
7834
7835 -Wno-odr
7836 Warn about One Definition Rule violations during link-time
7837 optimization. Enabled by default.
7838
7839 -Wopenacc-parallelism
7840 Warn about potentially suboptimal choices related to OpenACC
7841 parallelism.
7842
7843 -Wopenmp-simd
7844 Warn if the vectorizer cost model overrides the OpenMP simd
7845 directive set by user. The -fsimd-cost-model=unlimited option can
7846 be used to relax the cost model.
7847
7848 -Woverride-init (C and Objective-C only)
7849 Warn if an initialized field without side effects is overridden
7850 when using designated initializers.
7851
7852 This warning is included in -Wextra. To get other -Wextra warnings
7853 without this one, use -Wextra -Wno-override-init.
7854
7855 -Wno-override-init-side-effects (C and Objective-C only)
7856 Do not warn if an initialized field with side effects is overridden
7857 when using designated initializers. This warning is enabled by
7858 default.
7859
7860 -Wpacked
7861 Warn if a structure is given the packed attribute, but the packed
7862 attribute has no effect on the layout or size of the structure.
7863 Such structures may be mis-aligned for little benefit. For
7864 instance, in this code, the variable "f.x" in "struct bar" is
7865 misaligned even though "struct bar" does not itself have the packed
7866 attribute:
7867
7868 struct foo {
7869 int x;
7870 char a, b, c, d;
7871 } __attribute__((packed));
7872 struct bar {
7873 char z;
7874 struct foo f;
7875 };
7876
7877 -Wnopacked-bitfield-compat
7878 The 4.1, 4.2 and 4.3 series of GCC ignore the "packed" attribute on
7879 bit-fields of type "char". This was fixed in GCC 4.4 but the
7880 change can lead to differences in the structure layout. GCC
7881 informs you when the offset of such a field has changed in GCC 4.4.
7882 For example there is no longer a 4-bit padding between field "a"
7883 and "b" in this structure:
7884
7885 struct foo
7886 {
7887 char a:4;
7888 char b:8;
7889 } __attribute__ ((packed));
7890
7891 This warning is enabled by default. Use
7892 -Wno-packed-bitfield-compat to disable this warning.
7893
7894 -Wpacked-not-aligned (C, C++, Objective-C and Objective-C++ only)
7895 Warn if a structure field with explicitly specified alignment in a
7896 packed struct or union is misaligned. For example, a warning will
7897 be issued on "struct S", like, "warning: alignment 1 of 'struct S'
7898 is less than 8", in this code:
7899
7900 struct __attribute__ ((aligned (8))) S8 { char a[8]; };
7901 struct __attribute__ ((packed)) S {
7902 struct S8 s8;
7903 };
7904
7905 This warning is enabled by -Wall.
7906
7907 -Wpadded
7908 Warn if padding is included in a structure, either to align an
7909 element of the structure or to align the whole structure.
7910 Sometimes when this happens it is possible to rearrange the fields
7911 of the structure to reduce the padding and so make the structure
7912 smaller.
7913
7914 -Wredundant-decls
7915 Warn if anything is declared more than once in the same scope, even
7916 in cases where multiple declaration is valid and changes nothing.
7917
7918 -Wrestrict
7919 Warn when an object referenced by a "restrict"-qualified parameter
7920 (or, in C++, a "__restrict"-qualified parameter) is aliased by
7921 another argument, or when copies between such objects overlap. For
7922 example, the call to the "strcpy" function below attempts to
7923 truncate the string by replacing its initial characters with the
7924 last four. However, because the call writes the terminating NUL
7925 into "a[4]", the copies overlap and the call is diagnosed.
7926
7927 void foo (void)
7928 {
7929 char a[] = "abcd1234";
7930 strcpy (a, a + 4);
7931 ...
7932 }
7933
7934 The -Wrestrict option detects some instances of simple overlap even
7935 without optimization but works best at -O2 and above. It is
7936 included in -Wall.
7937
7938 -Wnested-externs (C and Objective-C only)
7939 Warn if an "extern" declaration is encountered within a function.
7940
7941 -Winline
7942 Warn if a function that is declared as inline cannot be inlined.
7943 Even with this option, the compiler does not warn about failures to
7944 inline functions declared in system headers.
7945
7946 The compiler uses a variety of heuristics to determine whether or
7947 not to inline a function. For example, the compiler takes into
7948 account the size of the function being inlined and the amount of
7949 inlining that has already been done in the current function.
7950 Therefore, seemingly insignificant changes in the source program
7951 can cause the warnings produced by -Winline to appear or disappear.
7952
7953 -Winterference-size
7954 Warn about use of C++17
7955 "std::hardware_destructive_interference_size" without specifying
7956 its value with --param destructive-interference-size. Also warn
7957 about questionable values for that option.
7958
7959 This variable is intended to be used for controlling class layout,
7960 to avoid false sharing in concurrent code:
7961
7962 struct independent_fields {
7963 alignas(std::hardware_destructive_interference_size)
7964 std::atomic<int> one;
7965 alignas(std::hardware_destructive_interference_size)
7966 std::atomic<int> two;
7967 };
7968
7969 Here one and two are intended to be far enough apart that stores to
7970 one won't require accesses to the other to reload the cache line.
7971
7972 By default, --param destructive-interference-size and --param
7973 constructive-interference-size are set based on the current -mtune
7974 option, typically to the L1 cache line size for the particular
7975 target CPU, sometimes to a range if tuning for a generic target.
7976 So all translation units that depend on ABI compatibility for the
7977 use of these variables must be compiled with the same -mtune (or
7978 -mcpu).
7979
7980 If ABI stability is important, such as if the use is in a header
7981 for a library, you should probably not use the hardware
7982 interference size variables at all. Alternatively, you can force a
7983 particular value with --param.
7984
7985 If you are confident that your use of the variable does not affect
7986 ABI outside a single build of your project, you can turn off the
7987 warning with -Wno-interference-size.
7988
7989 -Wint-in-bool-context
7990 Warn for suspicious use of integer values where boolean values are
7991 expected, such as conditional expressions (?:) using non-boolean
7992 integer constants in boolean context, like "if (a <= b ? 2 : 3)".
7993 Or left shifting of signed integers in boolean context, like "for
7994 (a = 0; 1 << a; a++);". Likewise for all kinds of multiplications
7995 regardless of the data type. This warning is enabled by -Wall.
7996
7997 -Wno-int-to-pointer-cast
7998 Suppress warnings from casts to pointer type of an integer of a
7999 different size. In C++, casting to a pointer type of smaller size
8000 is an error. Wint-to-pointer-cast is enabled by default.
8001
8002 -Wno-pointer-to-int-cast (C and Objective-C only)
8003 Suppress warnings from casts from a pointer to an integer type of a
8004 different size.
8005
8006 -Winvalid-pch
8007 Warn if a precompiled header is found in the search path but cannot
8008 be used.
8009
8010 -Winvalid-utf8
8011 Warn if an invalid UTF-8 character is found. This warning is on by
8012 default for C++23 if -finput-charset=UTF-8 is used and turned into
8013 error with -pedantic-errors.
8014
8015 -Wno-unicode
8016 Don't diagnose invalid forms of delimited or named escape sequences
8017 which are treated as separate tokens. Wunicode is enabled by
8018 default.
8019
8020 -Wlong-long
8021 Warn if "long long" type is used. This is enabled by either
8022 -Wpedantic or -Wtraditional in ISO C90 and C++98 modes. To inhibit
8023 the warning messages, use -Wno-long-long.
8024
8025 -Wvariadic-macros
8026 Warn if variadic macros are used in ISO C90 mode, or if the GNU
8027 alternate syntax is used in ISO C99 mode. This is enabled by
8028 either -Wpedantic or -Wtraditional. To inhibit the warning
8029 messages, use -Wno-variadic-macros.
8030
8031 -Wno-varargs
8032 Do not warn upon questionable usage of the macros used to handle
8033 variable arguments like "va_start". These warnings are enabled by
8034 default.
8035
8036 -Wvector-operation-performance
8037 Warn if vector operation is not implemented via SIMD capabilities
8038 of the architecture. Mainly useful for the performance tuning.
8039 Vector operation can be implemented "piecewise", which means that
8040 the scalar operation is performed on every vector element; "in
8041 parallel", which means that the vector operation is implemented
8042 using scalars of wider type, which normally is more performance
8043 efficient; and "as a single scalar", which means that vector fits
8044 into a scalar type.
8045
8046 -Wvla
8047 Warn if a variable-length array is used in the code. -Wno-vla
8048 prevents the -Wpedantic warning of the variable-length array.
8049
8050 -Wvla-larger-than=byte-size
8051 If this option is used, the compiler warns for declarations of
8052 variable-length arrays whose size is either unbounded, or bounded
8053 by an argument that allows the array size to exceed byte-size
8054 bytes. This is similar to how -Walloca-larger-than=byte-size
8055 works, but with variable-length arrays.
8056
8057 Note that GCC may optimize small variable-length arrays of a known
8058 value into plain arrays, so this warning may not get triggered for
8059 such arrays.
8060
8061 -Wvla-larger-than=PTRDIFF_MAX is enabled by default but is
8062 typically only effective when -ftree-vrp is active (default for -O2
8063 and above).
8064
8065 See also -Walloca-larger-than=byte-size.
8066
8067 -Wno-vla-larger-than
8068 Disable -Wvla-larger-than= warnings. The option is equivalent to
8069 -Wvla-larger-than=SIZE_MAX or larger.
8070
8071 -Wvla-parameter
8072 Warn about redeclarations of functions involving arguments of
8073 Variable Length Array types of inconsistent kinds or forms, and
8074 enable the detection of out-of-bounds accesses to such parameters
8075 by warnings such as -Warray-bounds.
8076
8077 If the first function declaration uses the VLA form the bound
8078 specified in the array is assumed to be the minimum number of
8079 elements expected to be provided in calls to the function and the
8080 maximum number of elements accessed by it. Failing to provide
8081 arguments of sufficient size or accessing more than the maximum
8082 number of elements may be diagnosed.
8083
8084 For example, the warning triggers for the following redeclarations
8085 because the first one allows an array of any size to be passed to
8086 "f" while the second one specifies that the array argument must
8087 have at least "n" elements. In addition, calling "f" with the
8088 associated VLA bound parameter in excess of the actual VLA bound
8089 triggers a warning as well.
8090
8091 void f (int n, int[n]);
8092 // warning: argument 2 previously declared as a VLA
8093 void f (int, int[]);
8094
8095 void g (int n)
8096 {
8097 if (n > 4)
8098 return;
8099 int a[n];
8100 // warning: access to a by f may be out of bounds
8101 f (sizeof a, a);
8102 ...
8103 }
8104
8105 -Wvla-parameter is included in -Wall. The -Warray-parameter option
8106 triggers warnings for similar problems involving ordinary array
8107 arguments.
8108
8109 -Wvolatile-register-var
8110 Warn if a register variable is declared volatile. The volatile
8111 modifier does not inhibit all optimizations that may eliminate
8112 reads and/or writes to register variables. This warning is enabled
8113 by -Wall.
8114
8115 -Wxor-used-as-pow (C, C++, Objective-C and Objective-C++ only)
8116 Warn about uses of "^", the exclusive or operator, where it appears
8117 the user meant exponentiation. Specifically, the warning occurs
8118 when the left-hand side is the decimal constant 2 or 10 and the
8119 right-hand side is also a decimal constant.
8120
8121 In C and C++, "^" means exclusive or, whereas in some other
8122 languages (e.g. TeX and some versions of BASIC) it means
8123 exponentiation.
8124
8125 This warning is enabled by default. It can be silenced by
8126 converting one of the operands to hexadecimal.
8127
8128 -Wdisabled-optimization
8129 Warn if a requested optimization pass is disabled. This warning
8130 does not generally indicate that there is anything wrong with your
8131 code; it merely indicates that GCC's optimizers are unable to
8132 handle the code effectively. Often, the problem is that your code
8133 is too big or too complex; GCC refuses to optimize programs when
8134 the optimization itself is likely to take inordinate amounts of
8135 time.
8136
8137 -Wpointer-sign (C and Objective-C only)
8138 Warn for pointer argument passing or assignment with different
8139 signedness. This option is only supported for C and Objective-C.
8140 It is implied by -Wall and by -Wpedantic, which can be disabled
8141 with -Wno-pointer-sign.
8142
8143 -Wstack-protector
8144 This option is only active when -fstack-protector is active. It
8145 warns about functions that are not protected against stack
8146 smashing.
8147
8148 -Woverlength-strings
8149 Warn about string constants that are longer than the "minimum
8150 maximum" length specified in the C standard. Modern compilers
8151 generally allow string constants that are much longer than the
8152 standard's minimum limit, but very portable programs should avoid
8153 using longer strings.
8154
8155 The limit applies after string constant concatenation, and does not
8156 count the trailing NUL. In C90, the limit was 509 characters; in
8157 C99, it was raised to 4095. C++98 does not specify a normative
8158 minimum maximum, so we do not diagnose overlength strings in C++.
8159
8160 This option is implied by -Wpedantic, and can be disabled with
8161 -Wno-overlength-strings.
8162
8163 -Wunsuffixed-float-constants (C and Objective-C only)
8164 Issue a warning for any floating constant that does not have a
8165 suffix. When used together with -Wsystem-headers it warns about
8166 such constants in system header files. This can be useful when
8167 preparing code to use with the "FLOAT_CONST_DECIMAL64" pragma from
8168 the decimal floating-point extension to C99.
8169
8170 -Wno-lto-type-mismatch
8171 During the link-time optimization, do not warn about type
8172 mismatches in global declarations from different compilation units.
8173 Requires -flto to be enabled. Enabled by default.
8174
8175 -Wno-designated-init (C and Objective-C only)
8176 Suppress warnings when a positional initializer is used to
8177 initialize a structure that has been marked with the
8178 "designated_init" attribute.
8179
8180 Options That Control Static Analysis
8181 -fanalyzer
8182 This option enables an static analysis of program flow which looks
8183 for "interesting" interprocedural paths through the code, and
8184 issues warnings for problems found on them.
8185
8186 This analysis is much more expensive than other GCC warnings.
8187
8188 In technical terms, it performs coverage-guided symbolic execution
8189 of the code being compiled. It is neither sound nor complete: it
8190 can have false positives and false negatives. It is a bug-finding
8191 tool, rather than a tool for proving program correctness.
8192
8193 The analyzer is only suitable for use on C code in this release.
8194
8195 Enabling this option effectively enables the following warnings:
8196
8197 -Wanalyzer-allocation-size -Wanalyzer-deref-before-check
8198 -Wanalyzer-double-fclose -Wanalyzer-double-free
8199 -Wanalyzer-exposure-through-output-file
8200 -Wanalyzer-exposure-through-uninit-copy
8201 -Wanalyzer-fd-access-mode-mismatch -Wanalyzer-fd-double-close
8202 -Wanalyzer-fd-leak -Wanalyzer-fd-phase-mismatch
8203 -Wanalyzer-fd-type-mismatch -Wanalyzer-fd-use-after-close
8204 -Wanalyzer-fd-use-without-check -Wanalyzer-file-leak
8205 -Wanalyzer-free-of-non-heap -Wanalyzer-imprecise-fp-arithmetic
8206 -Wanalyzer-infinite-recursion -Wanalyzer-jump-through-null
8207 -Wanalyzer-malloc-leak -Wanalyzer-mismatching-deallocation
8208 -Wanalyzer-null-argument -Wanalyzer-null-dereference
8209 -Wanalyzer-out-of-bounds -Wanalyzer-possible-null-argument
8210 -Wanalyzer-possible-null-dereference -Wanalyzer-putenv-of-auto-var
8211 -Wanalyzer-shift-count-negative -Wanalyzer-shift-count-overflow
8212 -Wanalyzer-stale-setjmp-buffer
8213 -Wanalyzer-unsafe-call-within-signal-handler
8214 -Wanalyzer-use-after-free
8215 -Wanalyzer-use-of-pointer-in-stale-stack-frame
8216 -Wanalyzer-use-of-uninitialized-value
8217 -Wanalyzer-va-arg-type-mismatch -Wanalyzer-va-list-exhausted
8218 -Wanalyzer-va-list-leak -Wanalyzer-va-list-use-after-va-end
8219 -Wanalyzer-write-to-const -Wanalyzer-write-to-string-literal
8220
8221 This option is only available if GCC was configured with analyzer
8222 support enabled.
8223
8224 -Wanalyzer-too-complex
8225 If -fanalyzer is enabled, the analyzer uses various heuristics to
8226 attempt to explore the control flow and data flow in the program,
8227 but these can be defeated by sufficiently complicated code.
8228
8229 By default, the analysis silently stops if the code is too
8230 complicated for the analyzer to fully explore and it reaches an
8231 internal limit. The -Wanalyzer-too-complex option warns if this
8232 occurs.
8233
8234 -Wno-analyzer-allocation-size
8235 This warning requires -fanalyzer, which enables it; to disable it,
8236 use -Wno-analyzer-allocation-size.
8237
8238 This diagnostic warns for paths through the code in which a pointer
8239 to a buffer is assigned to point at a buffer with a size that is
8240 not a multiple of "sizeof (*pointer)".
8241
8242 See CWE-131: Incorrect Calculation of Buffer Size
8243 ("https://cwe.mitre.org/data/definitions/131.html").
8244
8245 -Wno-analyzer-deref-before-check
8246 This warning requires -fanalyzer, which enables it; use
8247 -Wno-analyzer-deref-before-check to disable it.
8248
8249 This diagnostic warns for paths through the code in which a pointer
8250 is checked for "NULL" *after* it has already been dereferenced,
8251 suggesting that the pointer could have been NULL. Such cases
8252 suggest that the check for NULL is either redundant, or that it
8253 needs to be moved to before the pointer is dereferenced.
8254
8255 This diagnostic also considers values passed to a function argument
8256 marked with "__attribute__((nonnull))" as requiring a non-NULL
8257 value, and thus will complain if such values are checked for "NULL"
8258 after returning from such a function call.
8259
8260 This diagnostic is unlikely to be reported when any level of
8261 optimization is enabled, as GCC's optimization logic will typically
8262 consider such checks for NULL as being redundant, and optimize them
8263 away before the analyzer "sees" them. Hence optimization should be
8264 disabled when attempting to trigger this diagnostic.
8265
8266 -Wno-analyzer-double-fclose
8267 This warning requires -fanalyzer, which enables it; use
8268 -Wno-analyzer-double-fclose to disable it.
8269
8270 This diagnostic warns for paths through the code in which a "FILE
8271 *" can have "fclose" called on it more than once.
8272
8273 See CWE-1341: Multiple Releases of Same Resource or Handle
8274 ("https://cwe.mitre.org/data/definitions/1341.html").
8275
8276 -Wno-analyzer-double-free
8277 This warning requires -fanalyzer, which enables it; use
8278 -Wno-analyzer-double-free to disable it.
8279
8280 This diagnostic warns for paths through the code in which a pointer
8281 can have a deallocator called on it more than once, either "free",
8282 or a deallocator referenced by attribute "malloc".
8283
8284 See CWE-415: Double Free
8285 ("https://cwe.mitre.org/data/definitions/415.html").
8286
8287 -Wno-analyzer-exposure-through-output-file
8288 This warning requires -fanalyzer, which enables it; use
8289 -Wno-analyzer-exposure-through-output-file to disable it.
8290
8291 This diagnostic warns for paths through the code in which a
8292 security-sensitive value is written to an output file (such as
8293 writing a password to a log file).
8294
8295 See CWE-532: Information Exposure Through Log Files
8296 ("https://cwe.mitre.org/data/definitions/532.html").
8297
8298 -Wanalyzer-exposure-through-uninit-copy
8299 This warning requires both -fanalyzer and the use of a plugin to
8300 specify a function that copies across a "trust boundary". Use
8301 -Wno-analyzer-exposure-through-uninit-copy to disable it.
8302
8303 This diagnostic warns for "infoleaks" - paths through the code in
8304 which uninitialized values are copied across a security boundary
8305 (such as code within an OS kernel that copies a partially-
8306 initialized struct on the stack to user space).
8307
8308 See CWE-200: Exposure of Sensitive Information to an Unauthorized
8309 Actor ("https://cwe.mitre.org/data/definitions/200.html").
8310
8311 -Wno-analyzer-fd-access-mode-mismatch
8312 This warning requires -fanalyzer, which enables it; use
8313 -Wno-analyzer-fd-access-mode-mismatch to disable it.
8314
8315 This diagnostic warns for paths through code in which a "read" on a
8316 write-only file descriptor is attempted, or vice versa.
8317
8318 This diagnostic also warns for code paths in a which a function
8319 with attribute "fd_arg_read (N)" is called with a file descriptor
8320 opened with "O_WRONLY" at referenced argument "N" or a function
8321 with attribute "fd_arg_write (N)" is called with a file descriptor
8322 opened with "O_RDONLY" at referenced argument N.
8323
8324 -Wno-analyzer-fd-double-close
8325 This warning requires -fanalyzer, which enables it; use
8326 -Wno-analyzer-fd-double-close to disable it.
8327
8328 This diagnostic warns for paths through code in which a file
8329 descriptor can be closed more than once.
8330
8331 See CWE-1341: Multiple Releases of Same Resource or Handle
8332 ("https://cwe.mitre.org/data/definitions/1341.html").
8333
8334 -Wno-analyzer-fd-leak
8335 This warning requires -fanalyzer, which enables it; use
8336 -Wno-analyzer-fd-leak to disable it.
8337
8338 This diagnostic warns for paths through code in which an open file
8339 descriptor is leaked.
8340
8341 See CWE-775: Missing Release of File Descriptor or Handle after
8342 Effective Lifetime
8343 ("https://cwe.mitre.org/data/definitions/775.html").
8344
8345 -Wno-analyzer-fd-phase-mismatch
8346 This warning requires -fanalyzer, which enables it; use
8347 -Wno-analyzer-fd-phase-mismatch to disable it.
8348
8349 This diagnostic warns for paths through code in which an operation
8350 is attempted in the wrong phase of a file descriptor's lifetime.
8351 For example, it will warn on attempts to call "accept" on a stream
8352 socket that has not yet had "listen" successfully called on it.
8353
8354 See CWE-666: Operation on Resource in Wrong Phase of Lifetime
8355 ("https://cwe.mitre.org/data/definitions/666.html").
8356
8357 -Wno-analyzer-fd-type-mismatch
8358 This warning requires -fanalyzer, which enables it; use
8359 -Wno-analyzer-fd-type-mismatch to disable it.
8360
8361 This diagnostic warns for paths through code in which an operation
8362 is attempted on the wrong type of file descriptor. For example, it
8363 will warn on attempts to use socket operations on a file descriptor
8364 obtained via "open", or when attempting to use a stream socket
8365 operation on a datagram socket.
8366
8367 -Wno-analyzer-fd-use-after-close
8368 This warning requires -fanalyzer, which enables it; use
8369 -Wno-analyzer-fd-use-after-close to disable it.
8370
8371 This diagnostic warns for paths through code in which a read or
8372 write is called on a closed file descriptor.
8373
8374 This diagnostic also warns for paths through code in which a
8375 function with attribute "fd_arg (N)" or "fd_arg_read (N)" or
8376 "fd_arg_write (N)" is called with a closed file descriptor at
8377 referenced argument "N".
8378
8379 -Wno-analyzer-fd-use-without-check
8380 This warning requires -fanalyzer, which enables it; use
8381 -Wno-analyzer-fd-use-without-check to disable it.
8382
8383 This diagnostic warns for paths through code in which a file
8384 descriptor is used without being checked for validity.
8385
8386 This diagnostic also warns for paths through code in which a
8387 function with attribute "fd_arg (N)" or "fd_arg_read (N)" or
8388 "fd_arg_write (N)" is called with a file descriptor, at referenced
8389 argument "N", without being checked for validity.
8390
8391 -Wno-analyzer-file-leak
8392 This warning requires -fanalyzer, which enables it; use
8393 -Wno-analyzer-file-leak to disable it.
8394
8395 This diagnostic warns for paths through the code in which a
8396 "<stdio.h>" "FILE *" stream object is leaked.
8397
8398 See CWE-775: Missing Release of File Descriptor or Handle after
8399 Effective Lifetime
8400 ("https://cwe.mitre.org/data/definitions/775.html").
8401
8402 -Wno-analyzer-free-of-non-heap
8403 This warning requires -fanalyzer, which enables it; use
8404 -Wno-analyzer-free-of-non-heap to disable it.
8405
8406 This diagnostic warns for paths through the code in which "free" is
8407 called on a non-heap pointer (e.g. an on-stack buffer, or a
8408 global).
8409
8410 See CWE-590: Free of Memory not on the Heap
8411 ("https://cwe.mitre.org/data/definitions/590.html").
8412
8413 -Wno-analyzer-imprecise-fp-arithmetic
8414 This warning requires -fanalyzer, which enables it; use
8415 -Wno-analyzer-imprecise-fp-arithmetic to disable it.
8416
8417 This diagnostic warns for paths through the code in which floating-
8418 point arithmetic is used in locations where precise computation is
8419 needed. This diagnostic only warns on use of floating-point
8420 operands inside the calculation of an allocation size at the
8421 moment.
8422
8423 -Wno-analyzer-infinite-recursion
8424 This warning requires -fanalyzer, which enables it; use
8425 -Wno-analyzer-infinite-recursion to disable it.
8426
8427 This diagnostics warns for paths through the code which appear to
8428 lead to infinite recursion.
8429
8430 Specifically, when the analyzer "sees" a recursive call, it will
8431 compare the state of memory at the entry to the new frame with that
8432 at the entry to the previous frame of that function on the stack.
8433 The warning is issued if nothing in memory appears to be changing;
8434 any changes observed to parameters or globals are assumed to lead
8435 to termination of the recursion and thus suppress the warning.
8436
8437 This diagnostic is likely to miss cases of infinite recursion that
8438 are convered to iteration by the optimizer before the analyzer
8439 "sees" them. Hence optimization should be disabled when attempting
8440 to trigger this diagnostic.
8441
8442 Compare with -Winfinite-recursion, which provides a similar
8443 diagnostic, but is implemented in a different way.
8444
8445 -Wno-analyzer-jump-through-null
8446 This warning requires -fanalyzer, which enables it; use
8447 -Wno-analyzer-jump-through-null to disable it.
8448
8449 This diagnostic warns for paths through the code in which a "NULL"
8450 function pointer is called.
8451
8452 -Wno-analyzer-malloc-leak
8453 This warning requires -fanalyzer, which enables it; use
8454 -Wno-analyzer-malloc-leak to disable it.
8455
8456 This diagnostic warns for paths through the code in which a pointer
8457 allocated via an allocator is leaked: either "malloc", or a
8458 function marked with attribute "malloc".
8459
8460 See CWE-401: Missing Release of Memory after Effective Lifetime
8461 ("https://cwe.mitre.org/data/definitions/401.html").
8462
8463 -Wno-analyzer-mismatching-deallocation
8464 This warning requires -fanalyzer, which enables it; use
8465 -Wno-analyzer-mismatching-deallocation to disable it.
8466
8467 This diagnostic warns for paths through the code in which the wrong
8468 deallocation function is called on a pointer value, based on which
8469 function was used to allocate the pointer value. The diagnostic
8470 will warn about mismatches between "free", scalar "delete" and
8471 vector "delete[]", and those marked as allocator/deallocator pairs
8472 using attribute "malloc".
8473
8474 See CWE-762: Mismatched Memory Management Routines
8475 ("https://cwe.mitre.org/data/definitions/762.html").
8476
8477 -Wno-analyzer-out-of-bounds
8478 This warning requires -fanalyzer, which enables it; use
8479 -Wno-analyzer-out-of-bounds to disable it.
8480
8481 This diagnostic warns for paths through the code in which a buffer
8482 is definitely read or written out-of-bounds. The diagnostic
8483 applies for cases where the analyzer is able to determine a
8484 constant offset and for accesses past the end of a buffer, also a
8485 constant capacity. Further, the diagnostic does limited checking
8486 for accesses past the end when the offset as well as the capacity
8487 is symbolic.
8488
8489 See CWE-119: Improper Restriction of Operations within the Bounds
8490 of a Memory Buffer
8491 ("https://cwe.mitre.org/data/definitions/119.html").
8492
8493 -Wno-analyzer-possible-null-argument
8494 This warning requires -fanalyzer, which enables it; use
8495 -Wno-analyzer-possible-null-argument to disable it.
8496
8497 This diagnostic warns for paths through the code in which a
8498 possibly-NULL value is passed to a function argument marked with
8499 "__attribute__((nonnull))" as requiring a non-NULL value.
8500
8501 See CWE-690: Unchecked Return Value to NULL Pointer Dereference
8502 ("https://cwe.mitre.org/data/definitions/690.html").
8503
8504 -Wno-analyzer-possible-null-dereference
8505 This warning requires -fanalyzer, which enables it; use
8506 -Wno-analyzer-possible-null-dereference to disable it.
8507
8508 This diagnostic warns for paths through the code in which a
8509 possibly-NULL value is dereferenced.
8510
8511 See CWE-690: Unchecked Return Value to NULL Pointer Dereference
8512 ("https://cwe.mitre.org/data/definitions/690.html").
8513
8514 -Wno-analyzer-null-argument
8515 This warning requires -fanalyzer, which enables it; use
8516 -Wno-analyzer-null-argument to disable it.
8517
8518 This diagnostic warns for paths through the code in which a value
8519 known to be NULL is passed to a function argument marked with
8520 "__attribute__((nonnull))" as requiring a non-NULL value.
8521
8522 See CWE-476: NULL Pointer Dereference
8523 ("https://cwe.mitre.org/data/definitions/476.html").
8524
8525 -Wno-analyzer-null-dereference
8526 This warning requires -fanalyzer, which enables it; use
8527 -Wno-analyzer-null-dereference to disable it.
8528
8529 This diagnostic warns for paths through the code in which a value
8530 known to be NULL is dereferenced.
8531
8532 See CWE-476: NULL Pointer Dereference
8533 ("https://cwe.mitre.org/data/definitions/476.html").
8534
8535 -Wno-analyzer-putenv-of-auto-var
8536 This warning requires -fanalyzer, which enables it; use
8537 -Wno-analyzer-putenv-of-auto-var to disable it.
8538
8539 This diagnostic warns for paths through the code in which a call to
8540 "putenv" is passed a pointer to an automatic variable or an on-
8541 stack buffer.
8542
8543 See POS34-C. Do not call putenv() with a pointer to an automatic
8544 variable as the argument
8545 ("https://wiki.sei.cmu.edu/confluence/x/6NYxBQ").
8546
8547 -Wno-analyzer-shift-count-negative
8548 This warning requires -fanalyzer, which enables it; use
8549 -Wno-analyzer-shift-count-negative to disable it.
8550
8551 This diagnostic warns for paths through the code in which a shift
8552 is attempted with a negative count. It is analogous to the
8553 -Wshift-count-negative diagnostic implemented in the C/C++ front
8554 ends, but is implemented based on analyzing interprocedural paths,
8555 rather than merely parsing the syntax tree. However, the analyzer
8556 does not prioritize detection of such paths, so false negatives are
8557 more likely relative to other warnings.
8558
8559 -Wno-analyzer-shift-count-overflow
8560 This warning requires -fanalyzer, which enables it; use
8561 -Wno-analyzer-shift-count-overflow to disable it.
8562
8563 This diagnostic warns for paths through the code in which a shift
8564 is attempted with a count greater than or equal to the precision of
8565 the operand's type. It is analogous to the -Wshift-count-overflow
8566 diagnostic implemented in the C/C++ front ends, but is implemented
8567 based on analyzing interprocedural paths, rather than merely
8568 parsing the syntax tree. However, the analyzer does not prioritize
8569 detection of such paths, so false negatives are more likely
8570 relative to other warnings.
8571
8572 -Wno-analyzer-stale-setjmp-buffer
8573 This warning requires -fanalyzer, which enables it; use
8574 -Wno-analyzer-stale-setjmp-buffer to disable it.
8575
8576 This diagnostic warns for paths through the code in which "longjmp"
8577 is called to rewind to a "jmp_buf" relating to a "setjmp" call in a
8578 function that has returned.
8579
8580 When "setjmp" is called on a "jmp_buf" to record a rewind location,
8581 it records the stack frame. The stack frame becomes invalid when
8582 the function containing the "setjmp" call returns. Attempting to
8583 rewind to it via "longjmp" would reference a stack frame that no
8584 longer exists, and likely lead to a crash (or worse).
8585
8586 -Wno-analyzer-tainted-allocation-size
8587 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8588 to enable it; use -Wno-analyzer-tainted-allocation-size to disable
8589 it.
8590
8591 This diagnostic warns for paths through the code in which a value
8592 that could be under an attacker's control is used as the size of an
8593 allocation without being sanitized, so that an attacker could
8594 inject an excessively large allocation and potentially cause a
8595 denial of service attack.
8596
8597 See CWE-789: Memory Allocation with Excessive Size Value
8598 ("https://cwe.mitre.org/data/definitions/789.html").
8599
8600 -Wno-analyzer-tainted-assertion
8601 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8602 to enable it; use -Wno-analyzer-tainted-assertion to disable it.
8603
8604 This diagnostic warns for paths through the code in which a value
8605 that could be under an attacker's control is used as part of a
8606 condition without being first sanitized, and that condition guards
8607 a call to a function marked with attribute "noreturn" (such as the
8608 function "__builtin_unreachable"). Such functions typically
8609 indicate abnormal termination of the program, such as for assertion
8610 failure handlers. For example:
8611
8612 assert (some_tainted_value < SOME_LIMIT);
8613
8614 In such cases:
8615
8616 * when assertion-checking is enabled: an attacker could trigger a
8617 denial of service by injecting an assertion failure
8618
8619 * when assertion-checking is disabled, such as by defining
8620 "NDEBUG", an attacker could inject data that subverts the
8621 process, since it presumably violates a precondition that is
8622 being assumed by the code.
8623
8624 Note that when assertion-checking is disabled, the assertions are
8625 typically removed by the preprocessor before the analyzer has a
8626 chance to "see" them, so this diagnostic can only generate warnings
8627 on builds in which assertion-checking is enabled.
8628
8629 For the purpose of this warning, any function marked with attribute
8630 "noreturn" is considered as a possible assertion failure handler,
8631 including "__builtin_unreachable". Note that these functions are
8632 sometimes removed by the optimizer before the analyzer "sees" them.
8633 Hence optimization should be disabled when attempting to trigger
8634 this diagnostic.
8635
8636 See CWE-617: Reachable Assertion
8637 ("https://cwe.mitre.org/data/definitions/617.html").
8638
8639 The warning can also report problematic constructions such as
8640
8641 switch (some_tainted_value) {
8642 case 0:
8643 /* [...etc; various valid cases omitted...] */
8644 break;
8645
8646 default:
8647 __builtin_unreachable (); /* BUG: attacker can trigger this */
8648 }
8649
8650 despite the above not being an assertion failure, strictly
8651 speaking.
8652
8653 -Wno-analyzer-tainted-array-index
8654 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8655 to enable it; use -Wno-analyzer-tainted-array-index to disable it.
8656
8657 This diagnostic warns for paths through the code in which a value
8658 that could be under an attacker's control is used as the index of
8659 an array access without being sanitized, so that an attacker could
8660 inject an out-of-bounds access.
8661
8662 See CWE-129: Improper Validation of Array Index
8663 ("https://cwe.mitre.org/data/definitions/129.html").
8664
8665 -Wno-analyzer-tainted-divisor
8666 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8667 to enable it; use -Wno-analyzer-tainted-divisor to disable it.
8668
8669 This diagnostic warns for paths through the code in which a value
8670 that could be under an attacker's control is used as the divisor in
8671 a division or modulus operation without being sanitized, so that an
8672 attacker could inject a division-by-zero.
8673
8674 See CWE-369: Divide By Zero
8675 ("https://cwe.mitre.org/data/definitions/369.html").
8676
8677 -Wno-analyzer-tainted-offset
8678 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8679 to enable it; use -Wno-analyzer-tainted-offset to disable it.
8680
8681 This diagnostic warns for paths through the code in which a value
8682 that could be under an attacker's control is used as a pointer
8683 offset without being sanitized, so that an attacker could inject an
8684 out-of-bounds access.
8685
8686 See CWE-823: Use of Out-of-range Pointer Offset
8687 ("https://cwe.mitre.org/data/definitions/823.html").
8688
8689 -Wno-analyzer-tainted-size
8690 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8691 to enable it; use -Wno-analyzer-tainted-size to disable it.
8692
8693 This diagnostic warns for paths through the code in which a value
8694 that could be under an attacker's control is used as the size of an
8695 operation such as "memset" without being sanitized, so that an
8696 attacker could inject an out-of-bounds access.
8697
8698 See CWE-129: Improper Validation of Array Index
8699 ("https://cwe.mitre.org/data/definitions/129.html").
8700
8701 -Wno-analyzer-unsafe-call-within-signal-handler
8702 This warning requires -fanalyzer, which enables it; use
8703 -Wno-analyzer-unsafe-call-within-signal-handler to disable it.
8704
8705 This diagnostic warns for paths through the code in which a
8706 function known to be async-signal-unsafe (such as "fprintf") is
8707 called from a signal handler.
8708
8709 See CWE-479: Signal Handler Use of a Non-reentrant Function
8710 ("https://cwe.mitre.org/data/definitions/479.html").
8711
8712 -Wno-analyzer-use-after-free
8713 This warning requires -fanalyzer, which enables it; use
8714 -Wno-analyzer-use-after-free to disable it.
8715
8716 This diagnostic warns for paths through the code in which a pointer
8717 is used after a deallocator is called on it: either "free", or a
8718 deallocator referenced by attribute "malloc".
8719
8720 See CWE-416: Use After Free
8721 ("https://cwe.mitre.org/data/definitions/416.html").
8722
8723 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
8724 This warning requires -fanalyzer, which enables it; use
8725 -Wno-analyzer-use-of-pointer-in-stale-stack-frame to disable it.
8726
8727 This diagnostic warns for paths through the code in which a pointer
8728 is dereferenced that points to a variable in a stale stack frame.
8729
8730 -Wno-analyzer-va-arg-type-mismatch
8731 This warning requires -fanalyzer, which enables it; use
8732 -Wno-analyzer-va-arg-type-mismatch to disable it.
8733
8734 This diagnostic warns for interprocedural paths through the code
8735 for which the analyzer detects an attempt to use "va_arg" to
8736 extract a value passed to a variadic call, but uses a type that
8737 does not match that of the expression passed to the call.
8738
8739 See CWE-686: Function Call With Incorrect Argument Type
8740 ("https://cwe.mitre.org/data/definitions/686.html").
8741
8742 -Wno-analyzer-va-list-exhausted
8743 This warning requires -fanalyzer, which enables it; use
8744 -Wno-analyzer-va-list-exhausted to disable it.
8745
8746 This diagnostic warns for interprocedural paths through the code
8747 for which the analyzer detects an attempt to use "va_arg" to access
8748 the next value passed to a variadic call, but all of the values in
8749 the "va_list" have already been consumed.
8750
8751 See CWE-685: Function Call With Incorrect Number of Arguments
8752 ("https://cwe.mitre.org/data/definitions/685.html").
8753
8754 -Wno-analyzer-va-list-leak
8755 This warning requires -fanalyzer, which enables it; use
8756 -Wno-analyzer-va-list-leak to disable it.
8757
8758 This diagnostic warns for interprocedural paths through the code
8759 for which the analyzer detects that "va_start" or "va_copy" has
8760 been called on a "va_list" without a corresponding call to
8761 "va_end".
8762
8763 -Wno-analyzer-va-list-use-after-va-end
8764 This warning requires -fanalyzer, which enables it; use
8765 -Wno-analyzer-va-list-use-after-va-end to disable it.
8766
8767 This diagnostic warns for interprocedural paths through the code
8768 for which the analyzer detects an attempt to use a "va_list" after
8769 "va_end" has been called on it. "va_list".
8770
8771 -Wno-analyzer-write-to-const
8772 This warning requires -fanalyzer, which enables it; use
8773 -Wno-analyzer-write-to-const to disable it.
8774
8775 This diagnostic warns for paths through the code in which the
8776 analyzer detects an attempt to write through a pointer to a "const"
8777 object. However, the analyzer does not prioritize detection of
8778 such paths, so false negatives are more likely relative to other
8779 warnings.
8780
8781 -Wno-analyzer-write-to-string-literal
8782 This warning requires -fanalyzer, which enables it; use
8783 -Wno-analyzer-write-to-string-literal to disable it.
8784
8785 This diagnostic warns for paths through the code in which the
8786 analyzer detects an attempt to write through a pointer to a string
8787 literal. However, the analyzer does not prioritize detection of
8788 such paths, so false negatives are more likely relative to other
8789 warnings.
8790
8791 -Wno-analyzer-use-of-uninitialized-value
8792 This warning requires -fanalyzer, which enables it; use
8793 -Wno-analyzer-use-of-uninitialized-value to disable it.
8794
8795 This diagnostic warns for paths through the code in which an
8796 uninitialized value is used.
8797
8798 See CWE-457: Use of Uninitialized Variable
8799 ("https://cwe.mitre.org/data/definitions/457.html").
8800
8801 The analyzer has hardcoded knowledge about the behavior of the
8802 following memory-management functions:
8803
8804 *<"alloca">
8805 *<The built-in functions "__builtin_alloc",>
8806 "__builtin_alloc_with_align", @item "__builtin_calloc",
8807 "__builtin_free", "__builtin_malloc", "__builtin_memcpy",
8808 "__builtin_memcpy_chk", "__builtin_memset", "__builtin_memset_chk",
8809 "__builtin_realloc", "__builtin_stack_restore", and
8810 "__builtin_stack_save"
8811
8812 *<"calloc">
8813 *<"free">
8814 *<"malloc">
8815 *<"memset">
8816 *<"operator delete">
8817 *<"operator delete []">
8818 *<"operator new">
8819 *<"operator new []">
8820 *<"realloc">
8821 *<"strdup">
8822 *<"strndup">
8823
8824 of the following functions for working with file descriptors:
8825
8826 *<"open">
8827 *<"close">
8828 *<"creat">
8829 *<"dup", "dup2" and "dup3">
8830 *<"isatty">
8831 *<"pipe", and "pipe2">
8832 *<"read">
8833 *<"write">
8834 *<"socket", "bind", "listen", "accept", and "connect">
8835
8836 of the following functions for working with "<stdio.h>" streams:
8837
8838 *<The built-in functions "__builtin_fprintf",>
8839 "__builtin_fprintf_unlocked", "__builtin_fputc",
8840 "__builtin_fputc_unlocked", "__builtin_fputs",
8841 "__builtin_fputs_unlocked", "__builtin_fwrite",
8842 "__builtin_fwrite_unlocked", "__builtin_printf",
8843 "__builtin_printf_unlocked", "__builtin_putc", "__builtin_putchar",
8844 "__builtin_putchar_unlocked", "__builtin_putc_unlocked",
8845 "__builtin_puts", "__builtin_puts_unlocked", "__builtin_vfprintf",
8846 and "__builtin_vprintf"
8847
8848 *<"fopen">
8849 *<"fclose">
8850 *<"ferror">
8851 *<"fgets">
8852 *<"fgets_unlocked">
8853 *<"fileno">
8854 *<"fread">
8855 *<"getc">
8856 *<"getchar">
8857 *<"fprintf">
8858 *<"printf">
8859 *<"fwrite">
8860
8861 and of the following functions:
8862
8863 *<The built-in functions "__builtin_expect",>
8864 "__builtin_expect_with_probability", "__builtin_strchr",
8865 "__builtin_strcpy", "__builtin_strcpy_chk", "__builtin_strlen",
8866 "__builtin_va_copy", and "__builtin_va_start"
8867
8868 *<The GNU extensions "error" and "error_at_line">
8869 *<"getpass">
8870 *<"longjmp">
8871 *<"putenv">
8872 *<"setjmp">
8873 *<"siglongjmp">
8874 *<"signal">
8875 *<"sigsetjmp">
8876 *<"strchr">
8877 *<"strlen">
8878
8879 In addition, various functions with an "__analyzer_" prefix have
8880 special meaning to the analyzer, described in the GCC Internals manual.
8881
8882 Pertinent parameters for controlling the exploration are:
8883
8884 *<--param analyzer-bb-explosion-factor=value>
8885 *<--param analyzer-max-enodes-per-program-point=value>
8886 *<--param analyzer-max-recursion-depth=value>
8887 *<--param analyzer-min-snodes-for-call-summary=value>
8888
8889 The following options control the analyzer.
8890
8891 -fanalyzer-call-summaries
8892 Simplify interprocedural analysis by computing the effect of
8893 certain calls, rather than exploring all paths through the function
8894 from callsite to each possible return.
8895
8896 If enabled, call summaries are only used for functions with more
8897 than one call site, and that are sufficiently complicated (as per
8898 --param analyzer-min-snodes-for-call-summary=value).
8899
8900 -fanalyzer-checker=name
8901 Restrict the analyzer to run just the named checker, and enable it.
8902
8903 Some checkers are disabled by default (even with -fanalyzer), such
8904 as the "taint" checker that implements
8905 -Wanalyzer-tainted-array-index, and this option is required to
8906 enable them.
8907
8908 Note: currently, -fanalyzer-checker=taint disables the following
8909 warnings from -fanalyzer:
8910
8911 -Wanalyzer-deref-before-check -Wanalyzer-double-fclose
8912 -Wanalyzer-double-free -Wanalyzer-exposure-through-output-file
8913 -Wanalyzer-fd-access-mode-mismatch -Wanalyzer-fd-double-close
8914 -Wanalyzer-fd-leak -Wanalyzer-fd-use-after-close
8915 -Wanalyzer-fd-use-without-check -Wanalyzer-file-leak
8916 -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak
8917 -Wanalyzer-mismatching-deallocation -Wanalyzer-null-argument
8918 -Wanalyzer-null-dereference -Wanalyzer-possible-null-argument
8919 -Wanalyzer-possible-null-dereference
8920 -Wanalyzer-unsafe-call-within-signal-handler
8921 -Wanalyzer-use-after-free -Wanalyzer-va-list-leak
8922 -Wanalyzer-va-list-use-after-va-end
8923
8924 -fno-analyzer-feasibility
8925 This option is intended for analyzer developers.
8926
8927 By default the analyzer verifies that there is a feasible control
8928 flow path for each diagnostic it emits: that the conditions that
8929 hold are not mutually exclusive. Diagnostics for which no feasible
8930 path can be found are rejected. This filtering can be suppressed
8931 with -fno-analyzer-feasibility, for debugging issues in this code.
8932
8933 -fanalyzer-fine-grained
8934 This option is intended for analyzer developers.
8935
8936 Internally the analyzer builds an "exploded graph" that combines
8937 control flow graphs with data flow information.
8938
8939 By default, an edge in this graph can contain the effects of a run
8940 of multiple statements within a basic block. With
8941 -fanalyzer-fine-grained, each statement gets its own edge.
8942
8943 -fanalyzer-show-duplicate-count
8944 This option is intended for analyzer developers: if multiple
8945 diagnostics have been detected as being duplicates of each other,
8946 it emits a note when reporting the best diagnostic, giving the
8947 number of additional diagnostics that were suppressed by the
8948 deduplication logic.
8949
8950 -fno-analyzer-state-merge
8951 This option is intended for analyzer developers.
8952
8953 By default the analyzer attempts to simplify analysis by merging
8954 sufficiently similar states at each program point as it builds its
8955 "exploded graph". With -fno-analyzer-state-merge this merging can
8956 be suppressed, for debugging state-handling issues.
8957
8958 -fno-analyzer-state-purge
8959 This option is intended for analyzer developers.
8960
8961 By default the analyzer attempts to simplify analysis by purging
8962 aspects of state at a program point that appear to no longer be
8963 relevant e.g. the values of locals that aren't accessed later in
8964 the function and which aren't relevant to leak analysis.
8965
8966 With -fno-analyzer-state-purge this purging of state can be
8967 suppressed, for debugging state-handling issues.
8968
8969 -fno-analyzer-suppress-followups
8970 This option is intended for analyzer developers.
8971
8972 By default the analyzer will stop exploring an execution path after
8973 encountering certain diagnostics, in order to avoid potentially
8974 issuing a cascade of follow-up diagnostics.
8975
8976 The diagnostics that terminate analysis along a path are:
8977
8978 *<-Wanalyzer-null-argument>
8979 *<-Wanalyzer-null-dereference>
8980 *<-Wanalyzer-use-after-free>
8981 *<-Wanalyzer-use-of-pointer-in-stale-stack-frame>
8982 *<-Wanalyzer-use-of-uninitialized-value>
8983
8984 With -fno-analyzer-suppress-followups the analyzer will continue to
8985 explore such paths even after such diagnostics, which may be
8986 helpful for debugging issues in the analyzer, or for
8987 microbenchmarks for detecting undefined behavior.
8988
8989 -fanalyzer-transitivity
8990 This option enables transitivity of constraints within the
8991 analyzer.
8992
8993 -fno-analyzer-undo-inlining
8994 This option is intended for analyzer developers.
8995
8996 -fanalyzer runs relatively late compared to other code analysis
8997 tools, and some optimizations have already been applied to the
8998 code. In particular function inlining may have occurred, leading
8999 to the interprocedural execution paths emitted by the analyzer
9000 containing function frames that don't correspond to those in the
9001 original source code.
9002
9003 By default the analyzer attempts to reconstruct the original
9004 function frames, and to emit events showing the inlined calls.
9005
9006 With -fno-analyzer-undo-inlining this attempt to reconstruct the
9007 original frame information can be be disabled, which may be of help
9008 when debugging issues in the analyzer.
9009
9010 -fanalyzer-verbose-edges
9011 This option is intended for analyzer developers. It enables more
9012 verbose, lower-level detail in the descriptions of control flow
9013 within diagnostic paths.
9014
9015 -fanalyzer-verbose-state-changes
9016 This option is intended for analyzer developers. It enables more
9017 verbose, lower-level detail in the descriptions of events relating
9018 to state machines within diagnostic paths.
9019
9020 -fanalyzer-verbosity=level
9021 This option controls the complexity of the control flow paths that
9022 are emitted for analyzer diagnostics.
9023
9024 The level can be one of:
9025
9026 0 At this level, interprocedural call and return events are
9027 displayed, along with the most pertinent state-change events
9028 relating to a diagnostic. For example, for a double-"free"
9029 diagnostic, both calls to "free" will be shown.
9030
9031 1 As per the previous level, but also show events for the entry
9032 to each function.
9033
9034 2 As per the previous level, but also show events relating to
9035 control flow that are significant to triggering the issue (e.g.
9036 "true path taken" at a conditional).
9037
9038 This level is the default.
9039
9040 3 As per the previous level, but show all control flow events,
9041 not just significant ones.
9042
9043 4 This level is intended for analyzer developers; it adds various
9044 other events intended for debugging the analyzer.
9045
9046 -fdump-analyzer
9047 Dump internal details about what the analyzer is doing to
9048 file.analyzer.txt. -fdump-analyzer-stderr overrides this option.
9049
9050 -fdump-analyzer-stderr
9051 Dump internal details about what the analyzer is doing to stderr.
9052 This option overrides -fdump-analyzer.
9053
9054 -fdump-analyzer-callgraph
9055 Dump a representation of the call graph suitable for viewing with
9056 GraphViz to file.callgraph.dot.
9057
9058 -fdump-analyzer-exploded-graph
9059 Dump a representation of the "exploded graph" suitable for viewing
9060 with GraphViz to file.eg.dot. Nodes are color-coded based on
9061 state-machine states to emphasize state changes.
9062
9063 -fdump-analyzer-exploded-nodes
9064 Emit diagnostics showing where nodes in the "exploded graph" are in
9065 relation to the program source.
9066
9067 -fdump-analyzer-exploded-nodes-2
9068 Dump a textual representation of the "exploded graph" to
9069 file.eg.txt.
9070
9071 -fdump-analyzer-exploded-nodes-3
9072 Dump a textual representation of the "exploded graph" to one dump
9073 file per node, to file.eg-id.txt. This is typically a large number
9074 of dump files.
9075
9076 -fdump-analyzer-exploded-paths
9077 Dump a textual representation of the "exploded path" for each
9078 diagnostic to file.idx.kind.epath.txt.
9079
9080 -fdump-analyzer-feasibility
9081 Dump internal details about the analyzer's search for feasible
9082 paths. The details are written in a form suitable for viewing with
9083 GraphViz to filenames of the form file.*.fg.dot, file.*.tg.dot, and
9084 file.*.fpath.txt.
9085
9086 -fdump-analyzer-json
9087 Dump a compressed JSON representation of analyzer internals to
9088 file.analyzer.json.gz. The precise format is subject to change.
9089
9090 -fdump-analyzer-state-purge
9091 As per -fdump-analyzer-supergraph, dump a representation of the
9092 "supergraph" suitable for viewing with GraphViz, but annotate the
9093 graph with information on what state will be purged at each node.
9094 The graph is written to file.state-purge.dot.
9095
9096 -fdump-analyzer-supergraph
9097 Dump representations of the "supergraph" suitable for viewing with
9098 GraphViz to file.supergraph.dot and to file.supergraph-eg.dot.
9099 These show all of the control flow graphs in the program, with
9100 interprocedural edges for calls and returns. The second dump
9101 contains annotations showing nodes in the "exploded graph" and
9102 diagnostics associated with them.
9103
9104 -fdump-analyzer-untracked
9105 Emit custom warnings with internal details intended for analyzer
9106 developers.
9107
9108 Options for Debugging Your Program
9109 To tell GCC to emit extra information for use by a debugger, in almost
9110 all cases you need only to add -g to your other options. Some debug
9111 formats can co-exist (like DWARF with CTF) when each of them is enabled
9112 explicitly by adding the respective command line option to your other
9113 options.
9114
9115 GCC allows you to use -g with -O. The shortcuts taken by optimized
9116 code may occasionally be surprising: some variables you declared may
9117 not exist at all; flow of control may briefly move where you did not
9118 expect it; some statements may not be executed because they compute
9119 constant results or their values are already at hand; some statements
9120 may execute in different places because they have been moved out of
9121 loops. Nevertheless it is possible to debug optimized output. This
9122 makes it reasonable to use the optimizer for programs that might have
9123 bugs.
9124
9125 If you are not using some other optimization option, consider using -Og
9126 with -g. With no -O option at all, some compiler passes that collect
9127 information useful for debugging do not run at all, so that -Og may
9128 result in a better debugging experience.
9129
9130 -g Produce debugging information in the operating system's native
9131 format (stabs, COFF, XCOFF, or DWARF). GDB can work with this
9132 debugging information.
9133
9134 On most systems that use stabs format, -g enables use of extra
9135 debugging information that only GDB can use; this extra information
9136 makes debugging work better in GDB but probably makes other
9137 debuggers crash or refuse to read the program. If you want to
9138 control for certain whether to generate the extra information, use
9139 -gvms (see below).
9140
9141 -ggdb
9142 Produce debugging information for use by GDB. This means to use
9143 the most expressive format available (DWARF, stabs, or the native
9144 format if neither of those are supported), including GDB extensions
9145 if at all possible.
9146
9147 -gdwarf
9148 -gdwarf-version
9149 Produce debugging information in DWARF format (if that is
9150 supported). The value of version may be either 2, 3, 4 or 5; the
9151 default version for most targets is 5 (with the exception of
9152 VxWorks, TPF and Darwin/Mac OS X, which default to version 2, and
9153 AIX, which defaults to version 4).
9154
9155 Note that with DWARF Version 2, some ports require and always use
9156 some non-conflicting DWARF 3 extensions in the unwind tables.
9157
9158 Version 4 may require GDB 7.0 and -fvar-tracking-assignments for
9159 maximum benefit. Version 5 requires GDB 8.0 or higher.
9160
9161 GCC no longer supports DWARF Version 1, which is substantially
9162 different than Version 2 and later. For historical reasons, some
9163 other DWARF-related options such as -fno-dwarf2-cfi-asm) retain a
9164 reference to DWARF Version 2 in their names, but apply to all
9165 currently-supported versions of DWARF.
9166
9167 -gbtf
9168 Request BTF debug information. BTF is the default debugging format
9169 for the eBPF target. On other targets, like x86, BTF debug
9170 information can be generated along with DWARF debug information
9171 when both of the debug formats are enabled explicitly via their
9172 respective command line options.
9173
9174 -gctf
9175 -gctflevel
9176 Request CTF debug information and use level to specify how much CTF
9177 debug information should be produced. If -gctf is specified
9178 without a value for level, the default level of CTF debug
9179 information is 2.
9180
9181 CTF debug information can be generated along with DWARF debug
9182 information when both of the debug formats are enabled explicitly
9183 via their respective command line options.
9184
9185 Level 0 produces no CTF debug information at all. Thus, -gctf0
9186 negates -gctf.
9187
9188 Level 1 produces CTF information for tracebacks only. This
9189 includes callsite information, but does not include type
9190 information.
9191
9192 Level 2 produces type information for entities (functions, data
9193 objects etc.) at file-scope or global-scope only.
9194
9195 -gvms
9196 Produce debugging information in Alpha/VMS debug format (if that is
9197 supported). This is the format used by DEBUG on Alpha/VMS systems.
9198
9199 -glevel
9200 -ggdblevel
9201 -gvmslevel
9202 Request debugging information and also use level to specify how
9203 much information. The default level is 2.
9204
9205 Level 0 produces no debug information at all. Thus, -g0 negates
9206 -g.
9207
9208 Level 1 produces minimal information, enough for making backtraces
9209 in parts of the program that you don't plan to debug. This
9210 includes descriptions of functions and external variables, and line
9211 number tables, but no information about local variables.
9212
9213 Level 3 includes extra information, such as all the macro
9214 definitions present in the program. Some debuggers support macro
9215 expansion when you use -g3.
9216
9217 If you use multiple -g options, with or without level numbers, the
9218 last such option is the one that is effective.
9219
9220 -gdwarf does not accept a concatenated debug level, to avoid
9221 confusion with -gdwarf-level. Instead use an additional -glevel
9222 option to change the debug level for DWARF.
9223
9224 -fno-eliminate-unused-debug-symbols
9225 By default, no debug information is produced for symbols that are
9226 not actually used. Use this option if you want debug information
9227 for all symbols.
9228
9229 -femit-class-debug-always
9230 Instead of emitting debugging information for a C++ class in only
9231 one object file, emit it in all object files using the class. This
9232 option should be used only with debuggers that are unable to handle
9233 the way GCC normally emits debugging information for classes
9234 because using this option increases the size of debugging
9235 information by as much as a factor of two.
9236
9237 -fno-merge-debug-strings
9238 Direct the linker to not merge together strings in the debugging
9239 information that are identical in different object files. Merging
9240 is not supported by all assemblers or linkers. Merging decreases
9241 the size of the debug information in the output file at the cost of
9242 increasing link processing time. Merging is enabled by default.
9243
9244 -fdebug-prefix-map=old=new
9245 When compiling files residing in directory old, record debugging
9246 information describing them as if the files resided in directory
9247 new instead. This can be used to replace a build-time path with an
9248 install-time path in the debug info. It can also be used to change
9249 an absolute path to a relative path by using . for new. This can
9250 give more reproducible builds, which are location independent, but
9251 may require an extra command to tell GDB where to find the source
9252 files. See also -ffile-prefix-map and -fcanon-prefix-map.
9253
9254 -fvar-tracking
9255 Run variable tracking pass. It computes where variables are stored
9256 at each position in code. Better debugging information is then
9257 generated (if the debugging information format supports this
9258 information).
9259
9260 It is enabled by default when compiling with optimization (-Os, -O,
9261 -O2, ...), debugging information (-g) and the debug info format
9262 supports it.
9263
9264 -fvar-tracking-assignments
9265 Annotate assignments to user variables early in the compilation and
9266 attempt to carry the annotations over throughout the compilation
9267 all the way to the end, in an attempt to improve debug information
9268 while optimizing. Use of -gdwarf-4 is recommended along with it.
9269
9270 It can be enabled even if var-tracking is disabled, in which case
9271 annotations are created and maintained, but discarded at the end.
9272 By default, this flag is enabled together with -fvar-tracking,
9273 except when selective scheduling is enabled.
9274
9275 -gsplit-dwarf
9276 If DWARF debugging information is enabled, separate as much
9277 debugging information as possible into a separate output file with
9278 the extension .dwo. This option allows the build system to avoid
9279 linking files with debug information. To be useful, this option
9280 requires a debugger capable of reading .dwo files.
9281
9282 -gdwarf32
9283 -gdwarf64
9284 If DWARF debugging information is enabled, the -gdwarf32 selects
9285 the 32-bit DWARF format and the -gdwarf64 selects the 64-bit DWARF
9286 format. The default is target specific, on most targets it is
9287 -gdwarf32 though. The 32-bit DWARF format is smaller, but can't
9288 support more than 2GiB of debug information in any of the DWARF
9289 debug information sections. The 64-bit DWARF format allows larger
9290 debug information and might not be well supported by all consumers
9291 yet.
9292
9293 -gdescribe-dies
9294 Add description attributes to some DWARF DIEs that have no name
9295 attribute, such as artificial variables, external references and
9296 call site parameter DIEs.
9297
9298 -gpubnames
9299 Generate DWARF ".debug_pubnames" and ".debug_pubtypes" sections.
9300
9301 -ggnu-pubnames
9302 Generate ".debug_pubnames" and ".debug_pubtypes" sections in a
9303 format suitable for conversion into a GDB index. This option is
9304 only useful with a linker that can produce GDB index version 7.
9305
9306 -fdebug-types-section
9307 When using DWARF Version 4 or higher, type DIEs can be put into
9308 their own ".debug_types" section instead of making them part of the
9309 ".debug_info" section. It is more efficient to put them in a
9310 separate comdat section since the linker can then remove
9311 duplicates. But not all DWARF consumers support ".debug_types"
9312 sections yet and on some objects ".debug_types" produces larger
9313 instead of smaller debugging information.
9314
9315 -grecord-gcc-switches
9316 -gno-record-gcc-switches
9317 This switch causes the command-line options used to invoke the
9318 compiler that may affect code generation to be appended to the
9319 DW_AT_producer attribute in DWARF debugging information. The
9320 options are concatenated with spaces separating them from each
9321 other and from the compiler version. It is enabled by default.
9322 See also -frecord-gcc-switches for another way of storing compiler
9323 options into the object file.
9324
9325 -gstrict-dwarf
9326 Disallow using extensions of later DWARF standard version than
9327 selected with -gdwarf-version. On most targets using non-
9328 conflicting DWARF extensions from later standard versions is
9329 allowed.
9330
9331 -gno-strict-dwarf
9332 Allow using extensions of later DWARF standard version than
9333 selected with -gdwarf-version.
9334
9335 -gas-loc-support
9336 Inform the compiler that the assembler supports ".loc" directives.
9337 It may then use them for the assembler to generate DWARF2+ line
9338 number tables.
9339
9340 This is generally desirable, because assembler-generated line-
9341 number tables are a lot more compact than those the compiler can
9342 generate itself.
9343
9344 This option will be enabled by default if, at GCC configure time,
9345 the assembler was found to support such directives.
9346
9347 -gno-as-loc-support
9348 Force GCC to generate DWARF2+ line number tables internally, if
9349 DWARF2+ line number tables are to be generated.
9350
9351 -gas-locview-support
9352 Inform the compiler that the assembler supports "view" assignment
9353 and reset assertion checking in ".loc" directives.
9354
9355 This option will be enabled by default if, at GCC configure time,
9356 the assembler was found to support them.
9357
9358 -gno-as-locview-support
9359 Force GCC to assign view numbers internally, if
9360 -gvariable-location-views are explicitly requested.
9361
9362 -gcolumn-info
9363 -gno-column-info
9364 Emit location column information into DWARF debugging information,
9365 rather than just file and line. This option is enabled by default.
9366
9367 -gstatement-frontiers
9368 -gno-statement-frontiers
9369 This option causes GCC to create markers in the internal
9370 representation at the beginning of statements, and to keep them
9371 roughly in place throughout compilation, using them to guide the
9372 output of "is_stmt" markers in the line number table. This is
9373 enabled by default when compiling with optimization (-Os, -O1, -O2,
9374 ...), and outputting DWARF 2 debug information at the normal level.
9375
9376 -gvariable-location-views
9377 -gvariable-location-views=incompat5
9378 -gno-variable-location-views
9379 Augment variable location lists with progressive view numbers
9380 implied from the line number table. This enables debug information
9381 consumers to inspect state at certain points of the program, even
9382 if no instructions associated with the corresponding source
9383 locations are present at that point. If the assembler lacks
9384 support for view numbers in line number tables, this will cause the
9385 compiler to emit the line number table, which generally makes them
9386 somewhat less compact. The augmented line number tables and
9387 location lists are fully backward-compatible, so they can be
9388 consumed by debug information consumers that are not aware of these
9389 augmentations, but they won't derive any benefit from them either.
9390
9391 This is enabled by default when outputting DWARF 2 debug
9392 information at the normal level, as long as there is assembler
9393 support, -fvar-tracking-assignments is enabled and -gstrict-dwarf
9394 is not. When assembler support is not available, this may still be
9395 enabled, but it will force GCC to output internal line number
9396 tables, and if -ginternal-reset-location-views is not enabled, that
9397 will most certainly lead to silently mismatching location views.
9398
9399 There is a proposed representation for view numbers that is not
9400 backward compatible with the location list format introduced in
9401 DWARF 5, that can be enabled with
9402 -gvariable-location-views=incompat5. This option may be removed in
9403 the future, is only provided as a reference implementation of the
9404 proposed representation. Debug information consumers are not
9405 expected to support this extended format, and they would be
9406 rendered unable to decode location lists using it.
9407
9408 -ginternal-reset-location-views
9409 -gno-internal-reset-location-views
9410 Attempt to determine location views that can be omitted from
9411 location view lists. This requires the compiler to have very
9412 accurate insn length estimates, which isn't always the case, and it
9413 may cause incorrect view lists to be generated silently when using
9414 an assembler that does not support location view lists. The GNU
9415 assembler will flag any such error as a "view number mismatch".
9416 This is only enabled on ports that define a reliable estimation
9417 function.
9418
9419 -ginline-points
9420 -gno-inline-points
9421 Generate extended debug information for inlined functions.
9422 Location view tracking markers are inserted at inlined entry
9423 points, so that address and view numbers can be computed and output
9424 in debug information. This can be enabled independently of
9425 location views, in which case the view numbers won't be output, but
9426 it can only be enabled along with statement frontiers, and it is
9427 only enabled by default if location views are enabled.
9428
9429 -gz[=type]
9430 Produce compressed debug sections in DWARF format, if that is
9431 supported. If type is not given, the default type depends on the
9432 capabilities of the assembler and linker used. type may be one of
9433 none (don't compress debug sections), or zlib (use zlib compression
9434 in ELF gABI format). If the linker doesn't support writing
9435 compressed debug sections, the option is rejected. Otherwise, if
9436 the assembler does not support them, -gz is silently ignored when
9437 producing object files.
9438
9439 -femit-struct-debug-baseonly
9440 Emit debug information for struct-like types only when the base
9441 name of the compilation source file matches the base name of file
9442 in which the struct is defined.
9443
9444 This option substantially reduces the size of debugging
9445 information, but at significant potential loss in type information
9446 to the debugger. See -femit-struct-debug-reduced for a less
9447 aggressive option. See -femit-struct-debug-detailed for more
9448 detailed control.
9449
9450 This option works only with DWARF debug output.
9451
9452 -femit-struct-debug-reduced
9453 Emit debug information for struct-like types only when the base
9454 name of the compilation source file matches the base name of file
9455 in which the type is defined, unless the struct is a template or
9456 defined in a system header.
9457
9458 This option significantly reduces the size of debugging
9459 information, with some potential loss in type information to the
9460 debugger. See -femit-struct-debug-baseonly for a more aggressive
9461 option. See -femit-struct-debug-detailed for more detailed
9462 control.
9463
9464 This option works only with DWARF debug output.
9465
9466 -femit-struct-debug-detailed[=spec-list]
9467 Specify the struct-like types for which the compiler generates
9468 debug information. The intent is to reduce duplicate struct debug
9469 information between different object files within the same program.
9470
9471 This option is a detailed version of -femit-struct-debug-reduced
9472 and -femit-struct-debug-baseonly, which serves for most needs.
9473
9474 A specification has the
9475 syntax[dir:|ind:][ord:|gen:](any|sys|base|none)
9476
9477 The optional first word limits the specification to structs that
9478 are used directly (dir:) or used indirectly (ind:). A struct type
9479 is used directly when it is the type of a variable, member.
9480 Indirect uses arise through pointers to structs. That is, when use
9481 of an incomplete struct is valid, the use is indirect. An example
9482 is struct one direct; struct two * indirect;.
9483
9484 The optional second word limits the specification to ordinary
9485 structs (ord:) or generic structs (gen:). Generic structs are a
9486 bit complicated to explain. For C++, these are non-explicit
9487 specializations of template classes, or non-template classes within
9488 the above. Other programming languages have generics, but
9489 -femit-struct-debug-detailed does not yet implement them.
9490
9491 The third word specifies the source files for those structs for
9492 which the compiler should emit debug information. The values none
9493 and any have the normal meaning. The value base means that the
9494 base of name of the file in which the type declaration appears must
9495 match the base of the name of the main compilation file. In
9496 practice, this means that when compiling foo.c, debug information
9497 is generated for types declared in that file and foo.h, but not
9498 other header files. The value sys means those types satisfying
9499 base or declared in system or compiler headers.
9500
9501 You may need to experiment to determine the best settings for your
9502 application.
9503
9504 The default is -femit-struct-debug-detailed=all.
9505
9506 This option works only with DWARF debug output.
9507
9508 -fno-dwarf2-cfi-asm
9509 Emit DWARF unwind info as compiler generated ".eh_frame" section
9510 instead of using GAS ".cfi_*" directives.
9511
9512 -fno-eliminate-unused-debug-types
9513 Normally, when producing DWARF output, GCC avoids producing debug
9514 symbol output for types that are nowhere used in the source file
9515 being compiled. Sometimes it is useful to have GCC emit debugging
9516 information for all types declared in a compilation unit,
9517 regardless of whether or not they are actually used in that
9518 compilation unit, for example if, in the debugger, you want to cast
9519 a value to a type that is not actually used in your program (but is
9520 declared). More often, however, this results in a significant
9521 amount of wasted space.
9522
9523 Options That Control Optimization
9524 These options control various sorts of optimizations.
9525
9526 Without any optimization option, the compiler's goal is to reduce the
9527 cost of compilation and to make debugging produce the expected results.
9528 Statements are independent: if you stop the program with a breakpoint
9529 between statements, you can then assign a new value to any variable or
9530 change the program counter to any other statement in the function and
9531 get exactly the results you expect from the source code.
9532
9533 Turning on optimization flags makes the compiler attempt to improve the
9534 performance and/or code size at the expense of compilation time and
9535 possibly the ability to debug the program.
9536
9537 The compiler performs optimization based on the knowledge it has of the
9538 program. Compiling multiple files at once to a single output file mode
9539 allows the compiler to use information gained from all of the files
9540 when compiling each of them.
9541
9542 Not all optimizations are controlled directly by a flag. Only
9543 optimizations that have a flag are listed in this section.
9544
9545 Most optimizations are completely disabled at -O0 or if an -O level is
9546 not set on the command line, even if individual optimization flags are
9547 specified. Similarly, -Og suppresses many optimization passes.
9548
9549 Depending on the target and how GCC was configured, a slightly
9550 different set of optimizations may be enabled at each -O level than
9551 those listed here. You can invoke GCC with -Q --help=optimizers to
9552 find out the exact set of optimizations that are enabled at each level.
9553
9554 -O
9555 -O1 Optimize. Optimizing compilation takes somewhat more time, and a
9556 lot more memory for a large function.
9557
9558 With -O, the compiler tries to reduce code size and execution time,
9559 without performing any optimizations that take a great deal of
9560 compilation time.
9561
9562 -O turns on the following optimization flags:
9563
9564 -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments
9565 -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch
9566 -fdse -fforward-propagate -fguess-branch-probability
9567 -fif-conversion -fif-conversion2 -finline-functions-called-once
9568 -fipa-modref -fipa-profile -fipa-pure-const -fipa-reference
9569 -fipa-reference-addressable -fmerge-constants
9570 -fmove-loop-invariants -fmove-loop-stores -fomit-frame-pointer
9571 -freorder-blocks -fshrink-wrap -fshrink-wrap-separate
9572 -fsplit-wide-types -fssa-backprop -fssa-phiopt -ftree-bit-ccp
9573 -ftree-ccp -ftree-ch -ftree-coalesce-vars -ftree-copy-prop
9574 -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-forwprop
9575 -ftree-fre -ftree-phiprop -ftree-pta -ftree-scev-cprop -ftree-sink
9576 -ftree-slsr -ftree-sra -ftree-ter -funit-at-a-time
9577
9578 -O2 Optimize even more. GCC performs nearly all supported
9579 optimizations that do not involve a space-speed tradeoff. As
9580 compared to -O, this option increases both compilation time and the
9581 performance of the generated code.
9582
9583 -O2 turns on all optimization flags specified by -O1. It also
9584 turns on the following optimization flags:
9585
9586 -falign-functions -falign-jumps -falign-labels -falign-loops
9587 -fcaller-saves -fcode-hoisting -fcrossjumping -fcse-follow-jumps
9588 -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize
9589 -fdevirtualize-speculatively -fexpensive-optimizations
9590 -ffinite-loops -fgcse -fgcse-lm -fhoist-adjacent-loads
9591 -finline-functions -finline-small-functions -findirect-inlining
9592 -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fipa-vrp
9593 -fisolate-erroneous-paths-dereference -flra-remat
9594 -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining
9595 -fpeephole2 -freorder-blocks-algorithm=stc
9596 -freorder-blocks-and-partition -freorder-functions
9597 -frerun-cse-after-loop -fschedule-insns -fschedule-insns2
9598 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing
9599 -fthread-jumps -ftree-builtin-call-dce -ftree-loop-vectorize
9600 -ftree-pre -ftree-slp-vectorize -ftree-switch-conversion
9601 -ftree-tail-merge -ftree-vrp -fvect-cost-model=very-cheap
9602
9603 Please note the warning under -fgcse about invoking -O2 on programs
9604 that use computed gotos.
9605
9606 -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2
9607 and also turns on the following optimization flags:
9608
9609 -fgcse-after-reload -fipa-cp-clone -floop-interchange
9610 -floop-unroll-and-jam -fpeel-loops -fpredictive-commoning
9611 -fsplit-loops -fsplit-paths -ftree-loop-distribution
9612 -ftree-partial-pre -funswitch-loops -fvect-cost-model=dynamic
9613 -fversion-loops-for-strides
9614
9615 -O0 Reduce compilation time and make debugging produce the expected
9616 results. This is the default.
9617
9618 -Os Optimize for size. -Os enables all -O2 optimizations except those
9619 that often increase code size:
9620
9621 -falign-functions -falign-jumps -falign-labels -falign-loops
9622 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc
9623
9624 It also enables -finline-functions, causes the compiler to tune for
9625 code size rather than execution speed, and performs further
9626 optimizations designed to reduce code size.
9627
9628 -Ofast
9629 Disregard strict standards compliance. -Ofast enables all -O3
9630 optimizations. It also enables optimizations that are not valid
9631 for all standard-compliant programs. It turns on -ffast-math,
9632 -fallow-store-data-races and the Fortran-specific -fstack-arrays,
9633 unless -fmax-stack-var-size is specified, and -fno-protect-parens.
9634 It turns off -fsemantic-interposition.
9635
9636 -Og Optimize debugging experience. -Og should be the optimization
9637 level of choice for the standard edit-compile-debug cycle, offering
9638 a reasonable level of optimization while maintaining fast
9639 compilation and a good debugging experience. It is a better choice
9640 than -O0 for producing debuggable code because some compiler passes
9641 that collect debug information are disabled at -O0.
9642
9643 Like -O0, -Og completely disables a number of optimization passes
9644 so that individual options controlling them have no effect.
9645 Otherwise -Og enables all -O1 optimization flags except for those
9646 that may interfere with debugging:
9647
9648 -fbranch-count-reg -fdelayed-branch -fdse -fif-conversion
9649 -fif-conversion2 -finline-functions-called-once
9650 -fmove-loop-invariants -fmove-loop-stores -fssa-phiopt
9651 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra
9652
9653 -Oz Optimize aggressively for size rather than speed. This may
9654 increase the number of instructions executed if those instructions
9655 require fewer bytes to encode. -Oz behaves similarly to -Os
9656 including enabling most -O2 optimizations.
9657
9658 If you use multiple -O options, with or without level numbers, the last
9659 such option is the one that is effective.
9660
9661 Options of the form -fflag specify machine-independent flags. Most
9662 flags have both positive and negative forms; the negative form of -ffoo
9663 is -fno-foo. In the table below, only one of the forms is listed---the
9664 one you typically use. You can figure out the other form by either
9665 removing no- or adding it.
9666
9667 The following options control specific optimizations. They are either
9668 activated by -O options or are related to ones that are. You can use
9669 the following flags in the rare cases when "fine-tuning" of
9670 optimizations to be performed is desired.
9671
9672 -fno-defer-pop
9673 For machines that must pop arguments after a function call, always
9674 pop the arguments as soon as each function returns. At levels -O1
9675 and higher, -fdefer-pop is the default; this allows the compiler to
9676 let arguments accumulate on the stack for several function calls
9677 and pop them all at once.
9678
9679 -fforward-propagate
9680 Perform a forward propagation pass on RTL. The pass tries to
9681 combine two instructions and checks if the result can be
9682 simplified. If loop unrolling is active, two passes are performed
9683 and the second is scheduled after loop unrolling.
9684
9685 This option is enabled by default at optimization levels -O1, -O2,
9686 -O3, -Os.
9687
9688 -ffp-contract=style
9689 -ffp-contract=off disables floating-point expression contraction.
9690 -ffp-contract=fast enables floating-point expression contraction
9691 such as forming of fused multiply-add operations if the target has
9692 native support for them. -ffp-contract=on enables floating-point
9693 expression contraction if allowed by the language standard. This
9694 is currently not implemented and treated equal to
9695 -ffp-contract=off.
9696
9697 The default is -ffp-contract=fast.
9698
9699 -fomit-frame-pointer
9700 Omit the frame pointer in functions that don't need one. This
9701 avoids the instructions to save, set up and restore the frame
9702 pointer; on many targets it also makes an extra register available.
9703
9704 On some targets this flag has no effect because the standard
9705 calling sequence always uses a frame pointer, so it cannot be
9706 omitted.
9707
9708 Note that -fno-omit-frame-pointer doesn't guarantee the frame
9709 pointer is used in all functions. Several targets always omit the
9710 frame pointer in leaf functions.
9711
9712 Enabled by default at -O1 and higher.
9713
9714 -foptimize-sibling-calls
9715 Optimize sibling and tail recursive calls.
9716
9717 Enabled at levels -O2, -O3, -Os.
9718
9719 -foptimize-strlen
9720 Optimize various standard C string functions (e.g. "strlen",
9721 "strchr" or "strcpy") and their "_FORTIFY_SOURCE" counterparts into
9722 faster alternatives.
9723
9724 Enabled at levels -O2, -O3.
9725
9726 -fno-inline
9727 Do not expand any functions inline apart from those marked with the
9728 "always_inline" attribute. This is the default when not
9729 optimizing.
9730
9731 Single functions can be exempted from inlining by marking them with
9732 the "noinline" attribute.
9733
9734 -finline-small-functions
9735 Integrate functions into their callers when their body is smaller
9736 than expected function call code (so overall size of program gets
9737 smaller). The compiler heuristically decides which functions are
9738 simple enough to be worth integrating in this way. This inlining
9739 applies to all functions, even those not declared inline.
9740
9741 Enabled at levels -O2, -O3, -Os.
9742
9743 -findirect-inlining
9744 Inline also indirect calls that are discovered to be known at
9745 compile time thanks to previous inlining. This option has any
9746 effect only when inlining itself is turned on by the
9747 -finline-functions or -finline-small-functions options.
9748
9749 Enabled at levels -O2, -O3, -Os.
9750
9751 -finline-functions
9752 Consider all functions for inlining, even if they are not declared
9753 inline. The compiler heuristically decides which functions are
9754 worth integrating in this way.
9755
9756 If all calls to a given function are integrated, and the function
9757 is declared "static", then the function is normally not output as
9758 assembler code in its own right.
9759
9760 Enabled at levels -O2, -O3, -Os. Also enabled by -fprofile-use and
9761 -fauto-profile.
9762
9763 -finline-functions-called-once
9764 Consider all "static" functions called once for inlining into their
9765 caller even if they are not marked "inline". If a call to a given
9766 function is integrated, then the function is not output as
9767 assembler code in its own right.
9768
9769 Enabled at levels -O1, -O2, -O3 and -Os, but not -Og.
9770
9771 -fearly-inlining
9772 Inline functions marked by "always_inline" and functions whose body
9773 seems smaller than the function call overhead early before doing
9774 -fprofile-generate instrumentation and real inlining pass. Doing
9775 so makes profiling significantly cheaper and usually inlining
9776 faster on programs having large chains of nested wrapper functions.
9777
9778 Enabled by default.
9779
9780 -fipa-sra
9781 Perform interprocedural scalar replacement of aggregates, removal
9782 of unused parameters and replacement of parameters passed by
9783 reference by parameters passed by value.
9784
9785 Enabled at levels -O2, -O3 and -Os.
9786
9787 -finline-limit=n
9788 By default, GCC limits the size of functions that can be inlined.
9789 This flag allows coarse control of this limit. n is the size of
9790 functions that can be inlined in number of pseudo instructions.
9791
9792 Inlining is actually controlled by a number of parameters, which
9793 may be specified individually by using --param name=value. The
9794 -finline-limit=n option sets some of these parameters as follows:
9795
9796 max-inline-insns-single
9797 is set to n/2.
9798
9799 max-inline-insns-auto
9800 is set to n/2.
9801
9802 See below for a documentation of the individual parameters
9803 controlling inlining and for the defaults of these parameters.
9804
9805 Note: there may be no value to -finline-limit that results in
9806 default behavior.
9807
9808 Note: pseudo instruction represents, in this particular context, an
9809 abstract measurement of function's size. In no way does it
9810 represent a count of assembly instructions and as such its exact
9811 meaning might change from one release to an another.
9812
9813 -fno-keep-inline-dllexport
9814 This is a more fine-grained version of -fkeep-inline-functions,
9815 which applies only to functions that are declared using the
9816 "dllexport" attribute or declspec.
9817
9818 -fkeep-inline-functions
9819 In C, emit "static" functions that are declared "inline" into the
9820 object file, even if the function has been inlined into all of its
9821 callers. This switch does not affect functions using the "extern
9822 inline" extension in GNU C90. In C++, emit any and all inline
9823 functions into the object file.
9824
9825 -fkeep-static-functions
9826 Emit "static" functions into the object file, even if the function
9827 is never used.
9828
9829 -fkeep-static-consts
9830 Emit variables declared "static const" when optimization isn't
9831 turned on, even if the variables aren't referenced.
9832
9833 GCC enables this option by default. If you want to force the
9834 compiler to check if a variable is referenced, regardless of
9835 whether or not optimization is turned on, use the
9836 -fno-keep-static-consts option.
9837
9838 -fmerge-constants
9839 Attempt to merge identical constants (string constants and
9840 floating-point constants) across compilation units.
9841
9842 This option is the default for optimized compilation if the
9843 assembler and linker support it. Use -fno-merge-constants to
9844 inhibit this behavior.
9845
9846 Enabled at levels -O1, -O2, -O3, -Os.
9847
9848 -fmerge-all-constants
9849 Attempt to merge identical constants and identical variables.
9850
9851 This option implies -fmerge-constants. In addition to
9852 -fmerge-constants this considers e.g. even constant initialized
9853 arrays or initialized constant variables with integral or floating-
9854 point types. Languages like C or C++ require each variable,
9855 including multiple instances of the same variable in recursive
9856 calls, to have distinct locations, so using this option results in
9857 non-conforming behavior.
9858
9859 -fmodulo-sched
9860 Perform swing modulo scheduling immediately before the first
9861 scheduling pass. This pass looks at innermost loops and reorders
9862 their instructions by overlapping different iterations.
9863
9864 -fmodulo-sched-allow-regmoves
9865 Perform more aggressive SMS-based modulo scheduling with register
9866 moves allowed. By setting this flag certain anti-dependences edges
9867 are deleted, which triggers the generation of reg-moves based on
9868 the life-range analysis. This option is effective only with
9869 -fmodulo-sched enabled.
9870
9871 -fno-branch-count-reg
9872 Disable the optimization pass that scans for opportunities to use
9873 "decrement and branch" instructions on a count register instead of
9874 instruction sequences that decrement a register, compare it against
9875 zero, and then branch based upon the result. This option is only
9876 meaningful on architectures that support such instructions, which
9877 include x86, PowerPC, IA-64 and S/390. Note that the
9878 -fno-branch-count-reg option doesn't remove the decrement and
9879 branch instructions from the generated instruction stream
9880 introduced by other optimization passes.
9881
9882 The default is -fbranch-count-reg at -O1 and higher, except for
9883 -Og.
9884
9885 -fno-function-cse
9886 Do not put function addresses in registers; make each instruction
9887 that calls a constant function contain the function's address
9888 explicitly.
9889
9890 This option results in less efficient code, but some strange hacks
9891 that alter the assembler output may be confused by the
9892 optimizations performed when this option is not used.
9893
9894 The default is -ffunction-cse
9895
9896 -fno-zero-initialized-in-bss
9897 If the target supports a BSS section, GCC by default puts variables
9898 that are initialized to zero into BSS. This can save space in the
9899 resulting code.
9900
9901 This option turns off this behavior because some programs
9902 explicitly rely on variables going to the data section---e.g., so
9903 that the resulting executable can find the beginning of that
9904 section and/or make assumptions based on that.
9905
9906 The default is -fzero-initialized-in-bss.
9907
9908 -fthread-jumps
9909 Perform optimizations that check to see if a jump branches to a
9910 location where another comparison subsumed by the first is found.
9911 If so, the first branch is redirected to either the destination of
9912 the second branch or a point immediately following it, depending on
9913 whether the condition is known to be true or false.
9914
9915 Enabled at levels -O1, -O2, -O3, -Os.
9916
9917 -fsplit-wide-types
9918 When using a type that occupies multiple registers, such as "long
9919 long" on a 32-bit system, split the registers apart and allocate
9920 them independently. This normally generates better code for those
9921 types, but may make debugging more difficult.
9922
9923 Enabled at levels -O1, -O2, -O3, -Os.
9924
9925 -fsplit-wide-types-early
9926 Fully split wide types early, instead of very late. This option
9927 has no effect unless -fsplit-wide-types is turned on.
9928
9929 This is the default on some targets.
9930
9931 -fcse-follow-jumps
9932 In common subexpression elimination (CSE), scan through jump
9933 instructions when the target of the jump is not reached by any
9934 other path. For example, when CSE encounters an "if" statement
9935 with an "else" clause, CSE follows the jump when the condition
9936 tested is false.
9937
9938 Enabled at levels -O2, -O3, -Os.
9939
9940 -fcse-skip-blocks
9941 This is similar to -fcse-follow-jumps, but causes CSE to follow
9942 jumps that conditionally skip over blocks. When CSE encounters a
9943 simple "if" statement with no else clause, -fcse-skip-blocks causes
9944 CSE to follow the jump around the body of the "if".
9945
9946 Enabled at levels -O2, -O3, -Os.
9947
9948 -frerun-cse-after-loop
9949 Re-run common subexpression elimination after loop optimizations
9950 are performed.
9951
9952 Enabled at levels -O2, -O3, -Os.
9953
9954 -fgcse
9955 Perform a global common subexpression elimination pass. This pass
9956 also performs global constant and copy propagation.
9957
9958 Note: When compiling a program using computed gotos, a GCC
9959 extension, you may get better run-time performance if you disable
9960 the global common subexpression elimination pass by adding
9961 -fno-gcse to the command line.
9962
9963 Enabled at levels -O2, -O3, -Os.
9964
9965 -fgcse-lm
9966 When -fgcse-lm is enabled, global common subexpression elimination
9967 attempts to move loads that are only killed by stores into
9968 themselves. This allows a loop containing a load/store sequence to
9969 be changed to a load outside the loop, and a copy/store within the
9970 loop.
9971
9972 Enabled by default when -fgcse is enabled.
9973
9974 -fgcse-sm
9975 When -fgcse-sm is enabled, a store motion pass is run after global
9976 common subexpression elimination. This pass attempts to move
9977 stores out of loops. When used in conjunction with -fgcse-lm,
9978 loops containing a load/store sequence can be changed to a load
9979 before the loop and a store after the loop.
9980
9981 Not enabled at any optimization level.
9982
9983 -fgcse-las
9984 When -fgcse-las is enabled, the global common subexpression
9985 elimination pass eliminates redundant loads that come after stores
9986 to the same memory location (both partial and full redundancies).
9987
9988 Not enabled at any optimization level.
9989
9990 -fgcse-after-reload
9991 When -fgcse-after-reload is enabled, a redundant load elimination
9992 pass is performed after reload. The purpose of this pass is to
9993 clean up redundant spilling.
9994
9995 Enabled by -O3, -fprofile-use and -fauto-profile.
9996
9997 -faggressive-loop-optimizations
9998 This option tells the loop optimizer to use language constraints to
9999 derive bounds for the number of iterations of a loop. This assumes
10000 that loop code does not invoke undefined behavior by for example
10001 causing signed integer overflows or out-of-bound array accesses.
10002 The bounds for the number of iterations of a loop are used to guide
10003 loop unrolling and peeling and loop exit test optimizations. This
10004 option is enabled by default.
10005
10006 -funconstrained-commons
10007 This option tells the compiler that variables declared in common
10008 blocks (e.g. Fortran) may later be overridden with longer trailing
10009 arrays. This prevents certain optimizations that depend on knowing
10010 the array bounds.
10011
10012 -fcrossjumping
10013 Perform cross-jumping transformation. This transformation unifies
10014 equivalent code and saves code size. The resulting code may or may
10015 not perform better than without cross-jumping.
10016
10017 Enabled at levels -O2, -O3, -Os.
10018
10019 -fauto-inc-dec
10020 Combine increments or decrements of addresses with memory accesses.
10021 This pass is always skipped on architectures that do not have
10022 instructions to support this. Enabled by default at -O1 and higher
10023 on architectures that support this.
10024
10025 -fdce
10026 Perform dead code elimination (DCE) on RTL. Enabled by default at
10027 -O1 and higher.
10028
10029 -fdse
10030 Perform dead store elimination (DSE) on RTL. Enabled by default at
10031 -O1 and higher.
10032
10033 -fif-conversion
10034 Attempt to transform conditional jumps into branch-less
10035 equivalents. This includes use of conditional moves, min, max, set
10036 flags and abs instructions, and some tricks doable by standard
10037 arithmetics. The use of conditional execution on chips where it is
10038 available is controlled by -fif-conversion2.
10039
10040 Enabled at levels -O1, -O2, -O3, -Os, but not with -Og.
10041
10042 -fif-conversion2
10043 Use conditional execution (where available) to transform
10044 conditional jumps into branch-less equivalents.
10045
10046 Enabled at levels -O1, -O2, -O3, -Os, but not with -Og.
10047
10048 -fdeclone-ctor-dtor
10049 The C++ ABI requires multiple entry points for constructors and
10050 destructors: one for a base subobject, one for a complete object,
10051 and one for a virtual destructor that calls operator delete
10052 afterwards. For a hierarchy with virtual bases, the base and
10053 complete variants are clones, which means two copies of the
10054 function. With this option, the base and complete variants are
10055 changed to be thunks that call a common implementation.
10056
10057 Enabled by -Os.
10058
10059 -fdelete-null-pointer-checks
10060 Assume that programs cannot safely dereference null pointers, and
10061 that no code or data element resides at address zero. This option
10062 enables simple constant folding optimizations at all optimization
10063 levels. In addition, other optimization passes in GCC use this
10064 flag to control global dataflow analyses that eliminate useless
10065 checks for null pointers; these assume that a memory access to
10066 address zero always results in a trap, so that if a pointer is
10067 checked after it has already been dereferenced, it cannot be null.
10068
10069 Note however that in some environments this assumption is not true.
10070 Use -fno-delete-null-pointer-checks to disable this optimization
10071 for programs that depend on that behavior.
10072
10073 This option is enabled by default on most targets. On Nios II ELF,
10074 it defaults to off. On AVR and MSP430, this option is completely
10075 disabled.
10076
10077 Passes that use the dataflow information are enabled independently
10078 at different optimization levels.
10079
10080 -fdevirtualize
10081 Attempt to convert calls to virtual functions to direct calls.
10082 This is done both within a procedure and interprocedurally as part
10083 of indirect inlining (-findirect-inlining) and interprocedural
10084 constant propagation (-fipa-cp). Enabled at levels -O2, -O3, -Os.
10085
10086 -fdevirtualize-speculatively
10087 Attempt to convert calls to virtual functions to speculative direct
10088 calls. Based on the analysis of the type inheritance graph,
10089 determine for a given call the set of likely targets. If the set is
10090 small, preferably of size 1, change the call into a conditional
10091 deciding between direct and indirect calls. The speculative calls
10092 enable more optimizations, such as inlining. When they seem
10093 useless after further optimization, they are converted back into
10094 original form.
10095
10096 -fdevirtualize-at-ltrans
10097 Stream extra information needed for aggressive devirtualization
10098 when running the link-time optimizer in local transformation mode.
10099 This option enables more devirtualization but significantly
10100 increases the size of streamed data. For this reason it is disabled
10101 by default.
10102
10103 -fexpensive-optimizations
10104 Perform a number of minor optimizations that are relatively
10105 expensive.
10106
10107 Enabled at levels -O2, -O3, -Os.
10108
10109 -free
10110 Attempt to remove redundant extension instructions. This is
10111 especially helpful for the x86-64 architecture, which implicitly
10112 zero-extends in 64-bit registers after writing to their lower
10113 32-bit half.
10114
10115 Enabled for Alpha, AArch64 and x86 at levels -O2, -O3, -Os.
10116
10117 -fno-lifetime-dse
10118 In C++ the value of an object is only affected by changes within
10119 its lifetime: when the constructor begins, the object has an
10120 indeterminate value, and any changes during the lifetime of the
10121 object are dead when the object is destroyed. Normally dead store
10122 elimination will take advantage of this; if your code relies on the
10123 value of the object storage persisting beyond the lifetime of the
10124 object, you can use this flag to disable this optimization. To
10125 preserve stores before the constructor starts (e.g. because your
10126 operator new clears the object storage) but still treat the object
10127 as dead after the destructor, you can use -flifetime-dse=1. The
10128 default behavior can be explicitly selected with -flifetime-dse=2.
10129 -flifetime-dse=0 is equivalent to -fno-lifetime-dse.
10130
10131 -flive-range-shrinkage
10132 Attempt to decrease register pressure through register live range
10133 shrinkage. This is helpful for fast processors with small or
10134 moderate size register sets.
10135
10136 -fira-algorithm=algorithm
10137 Use the specified coloring algorithm for the integrated register
10138 allocator. The algorithm argument can be priority, which specifies
10139 Chow's priority coloring, or CB, which specifies Chaitin-Briggs
10140 coloring. Chaitin-Briggs coloring is not implemented for all
10141 architectures, but for those targets that do support it, it is the
10142 default because it generates better code.
10143
10144 -fira-region=region
10145 Use specified regions for the integrated register allocator. The
10146 region argument should be one of the following:
10147
10148 all Use all loops as register allocation regions. This can give
10149 the best results for machines with a small and/or irregular
10150 register set.
10151
10152 mixed
10153 Use all loops except for loops with small register pressure as
10154 the regions. This value usually gives the best results in most
10155 cases and for most architectures, and is enabled by default
10156 when compiling with optimization for speed (-O, -O2, ...).
10157
10158 one Use all functions as a single region. This typically results
10159 in the smallest code size, and is enabled by default for -Os or
10160 -O0.
10161
10162 -fira-hoist-pressure
10163 Use IRA to evaluate register pressure in the code hoisting pass for
10164 decisions to hoist expressions. This option usually results in
10165 smaller code, but it can slow the compiler down.
10166
10167 This option is enabled at level -Os for all targets.
10168
10169 -fira-loop-pressure
10170 Use IRA to evaluate register pressure in loops for decisions to
10171 move loop invariants. This option usually results in generation of
10172 faster and smaller code on machines with large register files (>=
10173 32 registers), but it can slow the compiler down.
10174
10175 This option is enabled at level -O3 for some targets.
10176
10177 -fno-ira-share-save-slots
10178 Disable sharing of stack slots used for saving call-used hard
10179 registers living through a call. Each hard register gets a
10180 separate stack slot, and as a result function stack frames are
10181 larger.
10182
10183 -fno-ira-share-spill-slots
10184 Disable sharing of stack slots allocated for pseudo-registers.
10185 Each pseudo-register that does not get a hard register gets a
10186 separate stack slot, and as a result function stack frames are
10187 larger.
10188
10189 -flra-remat
10190 Enable CFG-sensitive rematerialization in LRA. Instead of loading
10191 values of spilled pseudos, LRA tries to rematerialize (recalculate)
10192 values if it is profitable.
10193
10194 Enabled at levels -O2, -O3, -Os.
10195
10196 -fdelayed-branch
10197 If supported for the target machine, attempt to reorder
10198 instructions to exploit instruction slots available after delayed
10199 branch instructions.
10200
10201 Enabled at levels -O1, -O2, -O3, -Os, but not at -Og.
10202
10203 -fschedule-insns
10204 If supported for the target machine, attempt to reorder
10205 instructions to eliminate execution stalls due to required data
10206 being unavailable. This helps machines that have slow floating
10207 point or memory load instructions by allowing other instructions to
10208 be issued until the result of the load or floating-point
10209 instruction is required.
10210
10211 Enabled at levels -O2, -O3.
10212
10213 -fschedule-insns2
10214 Similar to -fschedule-insns, but requests an additional pass of
10215 instruction scheduling after register allocation has been done.
10216 This is especially useful on machines with a relatively small
10217 number of registers and where memory load instructions take more
10218 than one cycle.
10219
10220 Enabled at levels -O2, -O3, -Os.
10221
10222 -fno-sched-interblock
10223 Disable instruction scheduling across basic blocks, which is
10224 normally enabled when scheduling before register allocation, i.e.
10225 with -fschedule-insns or at -O2 or higher.
10226
10227 -fno-sched-spec
10228 Disable speculative motion of non-load instructions, which is
10229 normally enabled when scheduling before register allocation, i.e.
10230 with -fschedule-insns or at -O2 or higher.
10231
10232 -fsched-pressure
10233 Enable register pressure sensitive insn scheduling before register
10234 allocation. This only makes sense when scheduling before register
10235 allocation is enabled, i.e. with -fschedule-insns or at -O2 or
10236 higher. Usage of this option can improve the generated code and
10237 decrease its size by preventing register pressure increase above
10238 the number of available hard registers and subsequent spills in
10239 register allocation.
10240
10241 -fsched-spec-load
10242 Allow speculative motion of some load instructions. This only
10243 makes sense when scheduling before register allocation, i.e. with
10244 -fschedule-insns or at -O2 or higher.
10245
10246 -fsched-spec-load-dangerous
10247 Allow speculative motion of more load instructions. This only
10248 makes sense when scheduling before register allocation, i.e. with
10249 -fschedule-insns or at -O2 or higher.
10250
10251 -fsched-stalled-insns
10252 -fsched-stalled-insns=n
10253 Define how many insns (if any) can be moved prematurely from the
10254 queue of stalled insns into the ready list during the second
10255 scheduling pass. -fno-sched-stalled-insns means that no insns are
10256 moved prematurely, -fsched-stalled-insns=0 means there is no limit
10257 on how many queued insns can be moved prematurely.
10258 -fsched-stalled-insns without a value is equivalent to
10259 -fsched-stalled-insns=1.
10260
10261 -fsched-stalled-insns-dep
10262 -fsched-stalled-insns-dep=n
10263 Define how many insn groups (cycles) are examined for a dependency
10264 on a stalled insn that is a candidate for premature removal from
10265 the queue of stalled insns. This has an effect only during the
10266 second scheduling pass, and only if -fsched-stalled-insns is used.
10267 -fno-sched-stalled-insns-dep is equivalent to
10268 -fsched-stalled-insns-dep=0. -fsched-stalled-insns-dep without a
10269 value is equivalent to -fsched-stalled-insns-dep=1.
10270
10271 -fsched2-use-superblocks
10272 When scheduling after register allocation, use superblock
10273 scheduling. This allows motion across basic block boundaries,
10274 resulting in faster schedules. This option is experimental, as not
10275 all machine descriptions used by GCC model the CPU closely enough
10276 to avoid unreliable results from the algorithm.
10277
10278 This only makes sense when scheduling after register allocation,
10279 i.e. with -fschedule-insns2 or at -O2 or higher.
10280
10281 -fsched-group-heuristic
10282 Enable the group heuristic in the scheduler. This heuristic favors
10283 the instruction that belongs to a schedule group. This is enabled
10284 by default when scheduling is enabled, i.e. with -fschedule-insns
10285 or -fschedule-insns2 or at -O2 or higher.
10286
10287 -fsched-critical-path-heuristic
10288 Enable the critical-path heuristic in the scheduler. This
10289 heuristic favors instructions on the critical path. This is
10290 enabled by default when scheduling is enabled, i.e. with
10291 -fschedule-insns or -fschedule-insns2 or at -O2 or higher.
10292
10293 -fsched-spec-insn-heuristic
10294 Enable the speculative instruction heuristic in the scheduler.
10295 This heuristic favors speculative instructions with greater
10296 dependency weakness. This is enabled by default when scheduling is
10297 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
10298 or higher.
10299
10300 -fsched-rank-heuristic
10301 Enable the rank heuristic in the scheduler. This heuristic favors
10302 the instruction belonging to a basic block with greater size or
10303 frequency. This is enabled by default when scheduling is enabled,
10304 i.e. with -fschedule-insns or -fschedule-insns2 or at -O2 or
10305 higher.
10306
10307 -fsched-last-insn-heuristic
10308 Enable the last-instruction heuristic in the scheduler. This
10309 heuristic favors the instruction that is less dependent on the last
10310 instruction scheduled. This is enabled by default when scheduling
10311 is enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at
10312 -O2 or higher.
10313
10314 -fsched-dep-count-heuristic
10315 Enable the dependent-count heuristic in the scheduler. This
10316 heuristic favors the instruction that has more instructions
10317 depending on it. This is enabled by default when scheduling is
10318 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
10319 or higher.
10320
10321 -freschedule-modulo-scheduled-loops
10322 Modulo scheduling is performed before traditional scheduling. If a
10323 loop is modulo scheduled, later scheduling passes may change its
10324 schedule. Use this option to control that behavior.
10325
10326 -fselective-scheduling
10327 Schedule instructions using selective scheduling algorithm.
10328 Selective scheduling runs instead of the first scheduler pass.
10329
10330 -fselective-scheduling2
10331 Schedule instructions using selective scheduling algorithm.
10332 Selective scheduling runs instead of the second scheduler pass.
10333
10334 -fsel-sched-pipelining
10335 Enable software pipelining of innermost loops during selective
10336 scheduling. This option has no effect unless one of
10337 -fselective-scheduling or -fselective-scheduling2 is turned on.
10338
10339 -fsel-sched-pipelining-outer-loops
10340 When pipelining loops during selective scheduling, also pipeline
10341 outer loops. This option has no effect unless
10342 -fsel-sched-pipelining is turned on.
10343
10344 -fsemantic-interposition
10345 Some object formats, like ELF, allow interposing of symbols by the
10346 dynamic linker. This means that for symbols exported from the DSO,
10347 the compiler cannot perform interprocedural propagation, inlining
10348 and other optimizations in anticipation that the function or
10349 variable in question may change. While this feature is useful, for
10350 example, to rewrite memory allocation functions by a debugging
10351 implementation, it is expensive in the terms of code quality. With
10352 -fno-semantic-interposition the compiler assumes that if
10353 interposition happens for functions the overwriting function will
10354 have precisely the same semantics (and side effects). Similarly if
10355 interposition happens for variables, the constructor of the
10356 variable will be the same. The flag has no effect for functions
10357 explicitly declared inline (where it is never allowed for
10358 interposition to change semantics) and for symbols explicitly
10359 declared weak.
10360
10361 -fshrink-wrap
10362 Emit function prologues only before parts of the function that need
10363 it, rather than at the top of the function. This flag is enabled
10364 by default at -O and higher.
10365
10366 -fshrink-wrap-separate
10367 Shrink-wrap separate parts of the prologue and epilogue separately,
10368 so that those parts are only executed when needed. This option is
10369 on by default, but has no effect unless -fshrink-wrap is also
10370 turned on and the target supports this.
10371
10372 -fcaller-saves
10373 Enable allocation of values to registers that are clobbered by
10374 function calls, by emitting extra instructions to save and restore
10375 the registers around such calls. Such allocation is done only when
10376 it seems to result in better code.
10377
10378 This option is always enabled by default on certain machines,
10379 usually those which have no call-preserved registers to use
10380 instead.
10381
10382 Enabled at levels -O2, -O3, -Os.
10383
10384 -fcombine-stack-adjustments
10385 Tracks stack adjustments (pushes and pops) and stack memory
10386 references and then tries to find ways to combine them.
10387
10388 Enabled by default at -O1 and higher.
10389
10390 -fipa-ra
10391 Use caller save registers for allocation if those registers are not
10392 used by any called function. In that case it is not necessary to
10393 save and restore them around calls. This is only possible if
10394 called functions are part of same compilation unit as current
10395 function and they are compiled before it.
10396
10397 Enabled at levels -O2, -O3, -Os, however the option is disabled if
10398 generated code will be instrumented for profiling (-p, or -pg) or
10399 if callee's register usage cannot be known exactly (this happens on
10400 targets that do not expose prologues and epilogues in RTL).
10401
10402 -fconserve-stack
10403 Attempt to minimize stack usage. The compiler attempts to use less
10404 stack space, even if that makes the program slower. This option
10405 implies setting the large-stack-frame parameter to 100 and the
10406 large-stack-frame-growth parameter to 400.
10407
10408 -ftree-reassoc
10409 Perform reassociation on trees. This flag is enabled by default at
10410 -O1 and higher.
10411
10412 -fcode-hoisting
10413 Perform code hoisting. Code hoisting tries to move the evaluation
10414 of expressions executed on all paths to the function exit as early
10415 as possible. This is especially useful as a code size
10416 optimization, but it often helps for code speed as well. This flag
10417 is enabled by default at -O2 and higher.
10418
10419 -ftree-pre
10420 Perform partial redundancy elimination (PRE) on trees. This flag
10421 is enabled by default at -O2 and -O3.
10422
10423 -ftree-partial-pre
10424 Make partial redundancy elimination (PRE) more aggressive. This
10425 flag is enabled by default at -O3.
10426
10427 -ftree-forwprop
10428 Perform forward propagation on trees. This flag is enabled by
10429 default at -O1 and higher.
10430
10431 -ftree-fre
10432 Perform full redundancy elimination (FRE) on trees. The difference
10433 between FRE and PRE is that FRE only considers expressions that are
10434 computed on all paths leading to the redundant computation. This
10435 analysis is faster than PRE, though it exposes fewer redundancies.
10436 This flag is enabled by default at -O1 and higher.
10437
10438 -ftree-phiprop
10439 Perform hoisting of loads from conditional pointers on trees. This
10440 pass is enabled by default at -O1 and higher.
10441
10442 -fhoist-adjacent-loads
10443 Speculatively hoist loads from both branches of an if-then-else if
10444 the loads are from adjacent locations in the same structure and the
10445 target architecture has a conditional move instruction. This flag
10446 is enabled by default at -O2 and higher.
10447
10448 -ftree-copy-prop
10449 Perform copy propagation on trees. This pass eliminates
10450 unnecessary copy operations. This flag is enabled by default at
10451 -O1 and higher.
10452
10453 -fipa-pure-const
10454 Discover which functions are pure or constant. Enabled by default
10455 at -O1 and higher.
10456
10457 -fipa-reference
10458 Discover which static variables do not escape the compilation unit.
10459 Enabled by default at -O1 and higher.
10460
10461 -fipa-reference-addressable
10462 Discover read-only, write-only and non-addressable static
10463 variables. Enabled by default at -O1 and higher.
10464
10465 -fipa-stack-alignment
10466 Reduce stack alignment on call sites if possible. Enabled by
10467 default.
10468
10469 -fipa-pta
10470 Perform interprocedural pointer analysis and interprocedural
10471 modification and reference analysis. This option can cause
10472 excessive memory and compile-time usage on large compilation units.
10473 It is not enabled by default at any optimization level.
10474
10475 -fipa-profile
10476 Perform interprocedural profile propagation. The functions called
10477 only from cold functions are marked as cold. Also functions
10478 executed once (such as "cold", "noreturn", static constructors or
10479 destructors) are identified. Cold functions and loop less parts of
10480 functions executed once are then optimized for size. Enabled by
10481 default at -O1 and higher.
10482
10483 -fipa-modref
10484 Perform interprocedural mod/ref analysis. This optimization
10485 analyzes the side effects of functions (memory locations that are
10486 modified or referenced) and enables better optimization across the
10487 function call boundary. This flag is enabled by default at -O1 and
10488 higher.
10489
10490 -fipa-cp
10491 Perform interprocedural constant propagation. This optimization
10492 analyzes the program to determine when values passed to functions
10493 are constants and then optimizes accordingly. This optimization
10494 can substantially increase performance if the application has
10495 constants passed to functions. This flag is enabled by default at
10496 -O2, -Os and -O3. It is also enabled by -fprofile-use and
10497 -fauto-profile.
10498
10499 -fipa-cp-clone
10500 Perform function cloning to make interprocedural constant
10501 propagation stronger. When enabled, interprocedural constant
10502 propagation performs function cloning when externally visible
10503 function can be called with constant arguments. Because this
10504 optimization can create multiple copies of functions, it may
10505 significantly increase code size (see --param
10506 ipa-cp-unit-growth=value). This flag is enabled by default at -O3.
10507 It is also enabled by -fprofile-use and -fauto-profile.
10508
10509 -fipa-bit-cp
10510 When enabled, perform interprocedural bitwise constant propagation.
10511 This flag is enabled by default at -O2 and by -fprofile-use and
10512 -fauto-profile. It requires that -fipa-cp is enabled.
10513
10514 -fipa-vrp
10515 When enabled, perform interprocedural propagation of value ranges.
10516 This flag is enabled by default at -O2. It requires that -fipa-cp
10517 is enabled.
10518
10519 -fipa-icf
10520 Perform Identical Code Folding for functions and read-only
10521 variables. The optimization reduces code size and may disturb
10522 unwind stacks by replacing a function by equivalent one with a
10523 different name. The optimization works more effectively with link-
10524 time optimization enabled.
10525
10526 Although the behavior is similar to the Gold Linker's ICF
10527 optimization, GCC ICF works on different levels and thus the
10528 optimizations are not same - there are equivalences that are found
10529 only by GCC and equivalences found only by Gold.
10530
10531 This flag is enabled by default at -O2 and -Os.
10532
10533 -flive-patching=level
10534 Control GCC's optimizations to produce output suitable for live-
10535 patching.
10536
10537 If the compiler's optimization uses a function's body or
10538 information extracted from its body to optimize/change another
10539 function, the latter is called an impacted function of the former.
10540 If a function is patched, its impacted functions should be patched
10541 too.
10542
10543 The impacted functions are determined by the compiler's
10544 interprocedural optimizations. For example, a caller is impacted
10545 when inlining a function into its caller, cloning a function and
10546 changing its caller to call this new clone, or extracting a
10547 function's pureness/constness information to optimize its direct or
10548 indirect callers, etc.
10549
10550 Usually, the more IPA optimizations enabled, the larger the number
10551 of impacted functions for each function. In order to control the
10552 number of impacted functions and more easily compute the list of
10553 impacted function, IPA optimizations can be partially enabled at
10554 two different levels.
10555
10556 The level argument should be one of the following:
10557
10558 inline-clone
10559 Only enable inlining and cloning optimizations, which includes
10560 inlining, cloning, interprocedural scalar replacement of
10561 aggregates and partial inlining. As a result, when patching a
10562 function, all its callers and its clones' callers are impacted,
10563 therefore need to be patched as well.
10564
10565 -flive-patching=inline-clone disables the following
10566 optimization flags: -fwhole-program -fipa-pta -fipa-reference
10567 -fipa-ra -fipa-icf -fipa-icf-functions -fipa-icf-variables
10568 -fipa-bit-cp -fipa-vrp -fipa-pure-const
10569 -fipa-reference-addressable -fipa-stack-alignment -fipa-modref
10570
10571 inline-only-static
10572 Only enable inlining of static functions. As a result, when
10573 patching a static function, all its callers are impacted and so
10574 need to be patched as well.
10575
10576 In addition to all the flags that -flive-patching=inline-clone
10577 disables, -flive-patching=inline-only-static disables the
10578 following additional optimization flags: -fipa-cp-clone
10579 -fipa-sra -fpartial-inlining -fipa-cp
10580
10581 When -flive-patching is specified without any value, the default
10582 value is inline-clone.
10583
10584 This flag is disabled by default.
10585
10586 Note that -flive-patching is not supported with link-time
10587 optimization (-flto).
10588
10589 -fisolate-erroneous-paths-dereference
10590 Detect paths that trigger erroneous or undefined behavior due to
10591 dereferencing a null pointer. Isolate those paths from the main
10592 control flow and turn the statement with erroneous or undefined
10593 behavior into a trap. This flag is enabled by default at -O2 and
10594 higher and depends on -fdelete-null-pointer-checks also being
10595 enabled.
10596
10597 -fisolate-erroneous-paths-attribute
10598 Detect paths that trigger erroneous or undefined behavior due to a
10599 null value being used in a way forbidden by a "returns_nonnull" or
10600 "nonnull" attribute. Isolate those paths from the main control
10601 flow and turn the statement with erroneous or undefined behavior
10602 into a trap. This is not currently enabled, but may be enabled by
10603 -O2 in the future.
10604
10605 -ftree-sink
10606 Perform forward store motion on trees. This flag is enabled by
10607 default at -O1 and higher.
10608
10609 -ftree-bit-ccp
10610 Perform sparse conditional bit constant propagation on trees and
10611 propagate pointer alignment information. This pass only operates
10612 on local scalar variables and is enabled by default at -O1 and
10613 higher, except for -Og. It requires that -ftree-ccp is enabled.
10614
10615 -ftree-ccp
10616 Perform sparse conditional constant propagation (CCP) on trees.
10617 This pass only operates on local scalar variables and is enabled by
10618 default at -O1 and higher.
10619
10620 -fssa-backprop
10621 Propagate information about uses of a value up the definition chain
10622 in order to simplify the definitions. For example, this pass
10623 strips sign operations if the sign of a value never matters. The
10624 flag is enabled by default at -O1 and higher.
10625
10626 -fssa-phiopt
10627 Perform pattern matching on SSA PHI nodes to optimize conditional
10628 code. This pass is enabled by default at -O1 and higher, except
10629 for -Og.
10630
10631 -ftree-switch-conversion
10632 Perform conversion of simple initializations in a switch to
10633 initializations from a scalar array. This flag is enabled by
10634 default at -O2 and higher.
10635
10636 -ftree-tail-merge
10637 Look for identical code sequences. When found, replace one with a
10638 jump to the other. This optimization is known as tail merging or
10639 cross jumping. This flag is enabled by default at -O2 and higher.
10640 The compilation time in this pass can be limited using max-tail-
10641 merge-comparisons parameter and max-tail-merge-iterations
10642 parameter.
10643
10644 -ftree-dce
10645 Perform dead code elimination (DCE) on trees. This flag is enabled
10646 by default at -O1 and higher.
10647
10648 -ftree-builtin-call-dce
10649 Perform conditional dead code elimination (DCE) for calls to built-
10650 in functions that may set "errno" but are otherwise free of side
10651 effects. This flag is enabled by default at -O2 and higher if -Os
10652 is not also specified.
10653
10654 -ffinite-loops
10655 Assume that a loop with an exit will eventually take the exit and
10656 not loop indefinitely. This allows the compiler to remove loops
10657 that otherwise have no side-effects, not considering eventual
10658 endless looping as such.
10659
10660 This option is enabled by default at -O2 for C++ with -std=c++11 or
10661 higher.
10662
10663 -ftree-dominator-opts
10664 Perform a variety of simple scalar cleanups (constant/copy
10665 propagation, redundancy elimination, range propagation and
10666 expression simplification) based on a dominator tree traversal.
10667 This also performs jump threading (to reduce jumps to jumps). This
10668 flag is enabled by default at -O1 and higher.
10669
10670 -ftree-dse
10671 Perform dead store elimination (DSE) on trees. A dead store is a
10672 store into a memory location that is later overwritten by another
10673 store without any intervening loads. In this case the earlier
10674 store can be deleted. This flag is enabled by default at -O1 and
10675 higher.
10676
10677 -ftree-ch
10678 Perform loop header copying on trees. This is beneficial since it
10679 increases effectiveness of code motion optimizations. It also
10680 saves one jump. This flag is enabled by default at -O1 and higher.
10681 It is not enabled for -Os, since it usually increases code size.
10682
10683 -ftree-loop-optimize
10684 Perform loop optimizations on trees. This flag is enabled by
10685 default at -O1 and higher.
10686
10687 -ftree-loop-linear
10688 -floop-strip-mine
10689 -floop-block
10690 Perform loop nest optimizations. Same as -floop-nest-optimize. To
10691 use this code transformation, GCC has to be configured with
10692 --with-isl to enable the Graphite loop transformation
10693 infrastructure.
10694
10695 -fgraphite-identity
10696 Enable the identity transformation for graphite. For every SCoP we
10697 generate the polyhedral representation and transform it back to
10698 gimple. Using -fgraphite-identity we can check the costs or
10699 benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation. Some
10700 minimal optimizations are also performed by the code generator isl,
10701 like index splitting and dead code elimination in loops.
10702
10703 -floop-nest-optimize
10704 Enable the isl based loop nest optimizer. This is a generic loop
10705 nest optimizer based on the Pluto optimization algorithms. It
10706 calculates a loop structure optimized for data-locality and
10707 parallelism. This option is experimental.
10708
10709 -floop-parallelize-all
10710 Use the Graphite data dependence analysis to identify loops that
10711 can be parallelized. Parallelize all the loops that can be
10712 analyzed to not contain loop carried dependences without checking
10713 that it is profitable to parallelize the loops.
10714
10715 -ftree-coalesce-vars
10716 While transforming the program out of the SSA representation,
10717 attempt to reduce copying by coalescing versions of different user-
10718 defined variables, instead of just compiler temporaries. This may
10719 severely limit the ability to debug an optimized program compiled
10720 with -fno-var-tracking-assignments. In the negated form, this flag
10721 prevents SSA coalescing of user variables. This option is enabled
10722 by default if optimization is enabled, and it does very little
10723 otherwise.
10724
10725 -ftree-loop-if-convert
10726 Attempt to transform conditional jumps in the innermost loops to
10727 branch-less equivalents. The intent is to remove control-flow from
10728 the innermost loops in order to improve the ability of the
10729 vectorization pass to handle these loops. This is enabled by
10730 default if vectorization is enabled.
10731
10732 -ftree-loop-distribution
10733 Perform loop distribution. This flag can improve cache performance
10734 on big loop bodies and allow further loop optimizations, like
10735 parallelization or vectorization, to take place. For example, the
10736 loop
10737
10738 DO I = 1, N
10739 A(I) = B(I) + C
10740 D(I) = E(I) * F
10741 ENDDO
10742
10743 is transformed to
10744
10745 DO I = 1, N
10746 A(I) = B(I) + C
10747 ENDDO
10748 DO I = 1, N
10749 D(I) = E(I) * F
10750 ENDDO
10751
10752 This flag is enabled by default at -O3. It is also enabled by
10753 -fprofile-use and -fauto-profile.
10754
10755 -ftree-loop-distribute-patterns
10756 Perform loop distribution of patterns that can be code generated
10757 with calls to a library. This flag is enabled by default at -O2
10758 and higher, and by -fprofile-use and -fauto-profile.
10759
10760 This pass distributes the initialization loops and generates a call
10761 to memset zero. For example, the loop
10762
10763 DO I = 1, N
10764 A(I) = 0
10765 B(I) = A(I) + I
10766 ENDDO
10767
10768 is transformed to
10769
10770 DO I = 1, N
10771 A(I) = 0
10772 ENDDO
10773 DO I = 1, N
10774 B(I) = A(I) + I
10775 ENDDO
10776
10777 and the initialization loop is transformed into a call to memset
10778 zero. This flag is enabled by default at -O3. It is also enabled
10779 by -fprofile-use and -fauto-profile.
10780
10781 -floop-interchange
10782 Perform loop interchange outside of graphite. This flag can
10783 improve cache performance on loop nest and allow further loop
10784 optimizations, like vectorization, to take place. For example, the
10785 loop
10786
10787 for (int i = 0; i < N; i++)
10788 for (int j = 0; j < N; j++)
10789 for (int k = 0; k < N; k++)
10790 c[i][j] = c[i][j] + a[i][k]*b[k][j];
10791
10792 is transformed to
10793
10794 for (int i = 0; i < N; i++)
10795 for (int k = 0; k < N; k++)
10796 for (int j = 0; j < N; j++)
10797 c[i][j] = c[i][j] + a[i][k]*b[k][j];
10798
10799 This flag is enabled by default at -O3. It is also enabled by
10800 -fprofile-use and -fauto-profile.
10801
10802 -floop-unroll-and-jam
10803 Apply unroll and jam transformations on feasible loops. In a loop
10804 nest this unrolls the outer loop by some factor and fuses the
10805 resulting multiple inner loops. This flag is enabled by default at
10806 -O3. It is also enabled by -fprofile-use and -fauto-profile.
10807
10808 -ftree-loop-im
10809 Perform loop invariant motion on trees. This pass moves only
10810 invariants that are hard to handle at RTL level (function calls,
10811 operations that expand to nontrivial sequences of insns). With
10812 -funswitch-loops it also moves operands of conditions that are
10813 invariant out of the loop, so that we can use just trivial
10814 invariantness analysis in loop unswitching. The pass also includes
10815 store motion.
10816
10817 -ftree-loop-ivcanon
10818 Create a canonical counter for number of iterations in loops for
10819 which determining number of iterations requires complicated
10820 analysis. Later optimizations then may determine the number
10821 easily. Useful especially in connection with unrolling.
10822
10823 -ftree-scev-cprop
10824 Perform final value replacement. If a variable is modified in a
10825 loop in such a way that its value when exiting the loop can be
10826 determined using only its initial value and the number of loop
10827 iterations, replace uses of the final value by such a computation,
10828 provided it is sufficiently cheap. This reduces data dependencies
10829 and may allow further simplifications. Enabled by default at -O1
10830 and higher.
10831
10832 -fivopts
10833 Perform induction variable optimizations (strength reduction,
10834 induction variable merging and induction variable elimination) on
10835 trees.
10836
10837 -ftree-parallelize-loops=n
10838 Parallelize loops, i.e., split their iteration space to run in n
10839 threads. This is only possible for loops whose iterations are
10840 independent and can be arbitrarily reordered. The optimization is
10841 only profitable on multiprocessor machines, for loops that are CPU-
10842 intensive, rather than constrained e.g. by memory bandwidth. This
10843 option implies -pthread, and thus is only supported on targets that
10844 have support for -pthread.
10845
10846 -ftree-pta
10847 Perform function-local points-to analysis on trees. This flag is
10848 enabled by default at -O1 and higher, except for -Og.
10849
10850 -ftree-sra
10851 Perform scalar replacement of aggregates. This pass replaces
10852 structure references with scalars to prevent committing structures
10853 to memory too early. This flag is enabled by default at -O1 and
10854 higher, except for -Og.
10855
10856 -fstore-merging
10857 Perform merging of narrow stores to consecutive memory addresses.
10858 This pass merges contiguous stores of immediate values narrower
10859 than a word into fewer wider stores to reduce the number of
10860 instructions. This is enabled by default at -O2 and higher as well
10861 as -Os.
10862
10863 -ftree-ter
10864 Perform temporary expression replacement during the SSA->normal
10865 phase. Single use/single def temporaries are replaced at their use
10866 location with their defining expression. This results in non-
10867 GIMPLE code, but gives the expanders much more complex trees to
10868 work on resulting in better RTL generation. This is enabled by
10869 default at -O1 and higher.
10870
10871 -ftree-slsr
10872 Perform straight-line strength reduction on trees. This recognizes
10873 related expressions involving multiplications and replaces them by
10874 less expensive calculations when possible. This is enabled by
10875 default at -O1 and higher.
10876
10877 -ftree-vectorize
10878 Perform vectorization on trees. This flag enables
10879 -ftree-loop-vectorize and -ftree-slp-vectorize if not explicitly
10880 specified.
10881
10882 -ftree-loop-vectorize
10883 Perform loop vectorization on trees. This flag is enabled by
10884 default at -O2 and by -ftree-vectorize, -fprofile-use, and
10885 -fauto-profile.
10886
10887 -ftree-slp-vectorize
10888 Perform basic block vectorization on trees. This flag is enabled by
10889 default at -O2 and by -ftree-vectorize, -fprofile-use, and
10890 -fauto-profile.
10891
10892 -ftrivial-auto-var-init=choice
10893 Initialize automatic variables with either a pattern or with zeroes
10894 to increase the security and predictability of a program by
10895 preventing uninitialized memory disclosure and use. GCC still
10896 considers an automatic variable that doesn't have an explicit
10897 initializer as uninitialized, -Wuninitialized and
10898 -Wanalyzer-use-of-uninitialized-value will still report warning
10899 messages on such automatic variables and the compiler will perform
10900 optimization as if the variable were uninitialized. With this
10901 option, GCC will also initialize any padding of automatic variables
10902 that have structure or union types to zeroes. However, the current
10903 implementation cannot initialize automatic variables that are
10904 declared between the controlling expression and the first case of a
10905 "switch" statement. Using -Wtrivial-auto-var-init to report all
10906 such cases.
10907
10908 The three values of choice are:
10909
10910 * uninitialized doesn't initialize any automatic variables. This
10911 is C and C++'s default.
10912
10913 * pattern Initialize automatic variables with values which will
10914 likely transform logic bugs into crashes down the line, are
10915 easily recognized in a crash dump and without being values that
10916 programmers can rely on for useful program semantics. The
10917 current value is byte-repeatable pattern with byte "0xFE". The
10918 values used for pattern initialization might be changed in the
10919 future.
10920
10921 * zero Initialize automatic variables with zeroes.
10922
10923 The default is uninitialized.
10924
10925 You can control this behavior for a specific variable by using the
10926 variable attribute "uninitialized".
10927
10928 -fvect-cost-model=model
10929 Alter the cost model used for vectorization. The model argument
10930 should be one of unlimited, dynamic, cheap or very-cheap. With the
10931 unlimited model the vectorized code-path is assumed to be
10932 profitable while with the dynamic model a runtime check guards the
10933 vectorized code-path to enable it only for iteration counts that
10934 will likely execute faster than when executing the original scalar
10935 loop. The cheap model disables vectorization of loops where doing
10936 so would be cost prohibitive for example due to required runtime
10937 checks for data dependence or alignment but otherwise is equal to
10938 the dynamic model. The very-cheap model only allows vectorization
10939 if the vector code would entirely replace the scalar code that is
10940 being vectorized. For example, if each iteration of a vectorized
10941 loop would only be able to handle exactly four iterations of the
10942 scalar loop, the very-cheap model would only allow vectorization if
10943 the scalar iteration count is known to be a multiple of four.
10944
10945 The default cost model depends on other optimization flags and is
10946 either dynamic or cheap.
10947
10948 -fsimd-cost-model=model
10949 Alter the cost model used for vectorization of loops marked with
10950 the OpenMP simd directive. The model argument should be one of
10951 unlimited, dynamic, cheap. All values of model have the same
10952 meaning as described in -fvect-cost-model and by default a cost
10953 model defined with -fvect-cost-model is used.
10954
10955 -ftree-vrp
10956 Perform Value Range Propagation on trees. This is similar to the
10957 constant propagation pass, but instead of values, ranges of values
10958 are propagated. This allows the optimizers to remove unnecessary
10959 range checks like array bound checks and null pointer checks. This
10960 is enabled by default at -O2 and higher. Null pointer check
10961 elimination is only done if -fdelete-null-pointer-checks is
10962 enabled.
10963
10964 -fsplit-paths
10965 Split paths leading to loop backedges. This can improve dead code
10966 elimination and common subexpression elimination. This is enabled
10967 by default at -O3 and above.
10968
10969 -fsplit-ivs-in-unroller
10970 Enables expression of values of induction variables in later
10971 iterations of the unrolled loop using the value in the first
10972 iteration. This breaks long dependency chains, thus improving
10973 efficiency of the scheduling passes.
10974
10975 A combination of -fweb and CSE is often sufficient to obtain the
10976 same effect. However, that is not reliable in cases where the loop
10977 body is more complicated than a single basic block. It also does
10978 not work at all on some architectures due to restrictions in the
10979 CSE pass.
10980
10981 This optimization is enabled by default.
10982
10983 -fvariable-expansion-in-unroller
10984 With this option, the compiler creates multiple copies of some
10985 local variables when unrolling a loop, which can result in superior
10986 code.
10987
10988 This optimization is enabled by default for PowerPC targets, but
10989 disabled by default otherwise.
10990
10991 -fpartial-inlining
10992 Inline parts of functions. This option has any effect only when
10993 inlining itself is turned on by the -finline-functions or
10994 -finline-small-functions options.
10995
10996 Enabled at levels -O2, -O3, -Os.
10997
10998 -fpredictive-commoning
10999 Perform predictive commoning optimization, i.e., reusing
11000 computations (especially memory loads and stores) performed in
11001 previous iterations of loops.
11002
11003 This option is enabled at level -O3. It is also enabled by
11004 -fprofile-use and -fauto-profile.
11005
11006 -fprefetch-loop-arrays
11007 If supported by the target machine, generate instructions to
11008 prefetch memory to improve the performance of loops that access
11009 large arrays.
11010
11011 This option may generate better or worse code; results are highly
11012 dependent on the structure of loops within the source code.
11013
11014 Disabled at level -Os.
11015
11016 -fno-printf-return-value
11017 Do not substitute constants for known return value of formatted
11018 output functions such as "sprintf", "snprintf", "vsprintf", and
11019 "vsnprintf" (but not "printf" of "fprintf"). This transformation
11020 allows GCC to optimize or even eliminate branches based on the
11021 known return value of these functions called with arguments that
11022 are either constant, or whose values are known to be in a range
11023 that makes determining the exact return value possible. For
11024 example, when -fprintf-return-value is in effect, both the branch
11025 and the body of the "if" statement (but not the call to "snprint")
11026 can be optimized away when "i" is a 32-bit or smaller integer
11027 because the return value is guaranteed to be at most 8.
11028
11029 char buf[9];
11030 if (snprintf (buf, "%08x", i) >= sizeof buf)
11031 ...
11032
11033 The -fprintf-return-value option relies on other optimizations and
11034 yields best results with -O2 and above. It works in tandem with
11035 the -Wformat-overflow and -Wformat-truncation options. The
11036 -fprintf-return-value option is enabled by default.
11037
11038 -fno-peephole
11039 -fno-peephole2
11040 Disable any machine-specific peephole optimizations. The
11041 difference between -fno-peephole and -fno-peephole2 is in how they
11042 are implemented in the compiler; some targets use one, some use the
11043 other, a few use both.
11044
11045 -fpeephole is enabled by default. -fpeephole2 enabled at levels
11046 -O2, -O3, -Os.
11047
11048 -fno-guess-branch-probability
11049 Do not guess branch probabilities using heuristics.
11050
11051 GCC uses heuristics to guess branch probabilities if they are not
11052 provided by profiling feedback (-fprofile-arcs). These heuristics
11053 are based on the control flow graph. If some branch probabilities
11054 are specified by "__builtin_expect", then the heuristics are used
11055 to guess branch probabilities for the rest of the control flow
11056 graph, taking the "__builtin_expect" info into account. The
11057 interactions between the heuristics and "__builtin_expect" can be
11058 complex, and in some cases, it may be useful to disable the
11059 heuristics so that the effects of "__builtin_expect" are easier to
11060 understand.
11061
11062 It is also possible to specify expected probability of the
11063 expression with "__builtin_expect_with_probability" built-in
11064 function.
11065
11066 The default is -fguess-branch-probability at levels -O, -O2, -O3,
11067 -Os.
11068
11069 -freorder-blocks
11070 Reorder basic blocks in the compiled function in order to reduce
11071 number of taken branches and improve code locality.
11072
11073 Enabled at levels -O1, -O2, -O3, -Os.
11074
11075 -freorder-blocks-algorithm=algorithm
11076 Use the specified algorithm for basic block reordering. The
11077 algorithm argument can be simple, which does not increase code size
11078 (except sometimes due to secondary effects like alignment), or stc,
11079 the "software trace cache" algorithm, which tries to put all often
11080 executed code together, minimizing the number of branches executed
11081 by making extra copies of code.
11082
11083 The default is simple at levels -O1, -Os, and stc at levels -O2,
11084 -O3.
11085
11086 -freorder-blocks-and-partition
11087 In addition to reordering basic blocks in the compiled function, in
11088 order to reduce number of taken branches, partitions hot and cold
11089 basic blocks into separate sections of the assembly and .o files,
11090 to improve paging and cache locality performance.
11091
11092 This optimization is automatically turned off in the presence of
11093 exception handling or unwind tables (on targets using
11094 setjump/longjump or target specific scheme), for linkonce sections,
11095 for functions with a user-defined section attribute and on any
11096 architecture that does not support named sections. When
11097 -fsplit-stack is used this option is not enabled by default (to
11098 avoid linker errors), but may be enabled explicitly (if using a
11099 working linker).
11100
11101 Enabled for x86 at levels -O2, -O3, -Os.
11102
11103 -freorder-functions
11104 Reorder functions in the object file in order to improve code
11105 locality. This is implemented by using special subsections
11106 ".text.hot" for most frequently executed functions and
11107 ".text.unlikely" for unlikely executed functions. Reordering is
11108 done by the linker so object file format must support named
11109 sections and linker must place them in a reasonable way.
11110
11111 This option isn't effective unless you either provide profile
11112 feedback (see -fprofile-arcs for details) or manually annotate
11113 functions with "hot" or "cold" attributes.
11114
11115 Enabled at levels -O2, -O3, -Os.
11116
11117 -fstrict-aliasing
11118 Allow the compiler to assume the strictest aliasing rules
11119 applicable to the language being compiled. For C (and C++), this
11120 activates optimizations based on the type of expressions. In
11121 particular, an object of one type is assumed never to reside at the
11122 same address as an object of a different type, unless the types are
11123 almost the same. For example, an "unsigned int" can alias an
11124 "int", but not a "void*" or a "double". A character type may alias
11125 any other type.
11126
11127 Pay special attention to code like this:
11128
11129 union a_union {
11130 int i;
11131 double d;
11132 };
11133
11134 int f() {
11135 union a_union t;
11136 t.d = 3.0;
11137 return t.i;
11138 }
11139
11140 The practice of reading from a different union member than the one
11141 most recently written to (called "type-punning") is common. Even
11142 with -fstrict-aliasing, type-punning is allowed, provided the
11143 memory is accessed through the union type. So, the code above
11144 works as expected. However, this code might not:
11145
11146 int f() {
11147 union a_union t;
11148 int* ip;
11149 t.d = 3.0;
11150 ip = &t.i;
11151 return *ip;
11152 }
11153
11154 Similarly, access by taking the address, casting the resulting
11155 pointer and dereferencing the result has undefined behavior, even
11156 if the cast uses a union type, e.g.:
11157
11158 int f() {
11159 double d = 3.0;
11160 return ((union a_union *) &d)->i;
11161 }
11162
11163 The -fstrict-aliasing option is enabled at levels -O2, -O3, -Os.
11164
11165 -fipa-strict-aliasing
11166 Controls whether rules of -fstrict-aliasing are applied across
11167 function boundaries. Note that if multiple functions gets inlined
11168 into a single function the memory accesses are no longer considered
11169 to be crossing a function boundary.
11170
11171 The -fipa-strict-aliasing option is enabled by default and is
11172 effective only in combination with -fstrict-aliasing.
11173
11174 -falign-functions
11175 -falign-functions=n
11176 -falign-functions=n:m
11177 -falign-functions=n:m:n2
11178 -falign-functions=n:m:n2:m2
11179 Align the start of functions to the next power-of-two greater than
11180 or equal to n, skipping up to m-1 bytes. This ensures that at
11181 least the first m bytes of the function can be fetched by the CPU
11182 without crossing an n-byte alignment boundary.
11183
11184 If m is not specified, it defaults to n.
11185
11186 Examples: -falign-functions=32 aligns functions to the next 32-byte
11187 boundary, -falign-functions=24 aligns to the next 32-byte boundary
11188 only if this can be done by skipping 23 bytes or less,
11189 -falign-functions=32:7 aligns to the next 32-byte boundary only if
11190 this can be done by skipping 6 bytes or less.
11191
11192 The second pair of n2:m2 values allows you to specify a secondary
11193 alignment: -falign-functions=64:7:32:3 aligns to the next 64-byte
11194 boundary if this can be done by skipping 6 bytes or less, otherwise
11195 aligns to the next 32-byte boundary if this can be done by skipping
11196 2 bytes or less. If m2 is not specified, it defaults to n2.
11197
11198 Some assemblers only support this flag when n is a power of two; in
11199 that case, it is rounded up.
11200
11201 -fno-align-functions and -falign-functions=1 are equivalent and
11202 mean that functions are not aligned.
11203
11204 If n is not specified or is zero, use a machine-dependent default.
11205 The maximum allowed n option value is 65536.
11206
11207 Enabled at levels -O2, -O3.
11208
11209 -flimit-function-alignment
11210 If this option is enabled, the compiler tries to avoid
11211 unnecessarily overaligning functions. It attempts to instruct the
11212 assembler to align by the amount specified by -falign-functions,
11213 but not to skip more bytes than the size of the function.
11214
11215 -falign-labels
11216 -falign-labels=n
11217 -falign-labels=n:m
11218 -falign-labels=n:m:n2
11219 -falign-labels=n:m:n2:m2
11220 Align all branch targets to a power-of-two boundary.
11221
11222 Parameters of this option are analogous to the -falign-functions
11223 option. -fno-align-labels and -falign-labels=1 are equivalent and
11224 mean that labels are not aligned.
11225
11226 If -falign-loops or -falign-jumps are applicable and are greater
11227 than this value, then their values are used instead.
11228
11229 If n is not specified or is zero, use a machine-dependent default
11230 which is very likely to be 1, meaning no alignment. The maximum
11231 allowed n option value is 65536.
11232
11233 Enabled at levels -O2, -O3.
11234
11235 -falign-loops
11236 -falign-loops=n
11237 -falign-loops=n:m
11238 -falign-loops=n:m:n2
11239 -falign-loops=n:m:n2:m2
11240 Align loops to a power-of-two boundary. If the loops are executed
11241 many times, this makes up for any execution of the dummy padding
11242 instructions.
11243
11244 If -falign-labels is greater than this value, then its value is
11245 used instead.
11246
11247 Parameters of this option are analogous to the -falign-functions
11248 option. -fno-align-loops and -falign-loops=1 are equivalent and
11249 mean that loops are not aligned. The maximum allowed n option
11250 value is 65536.
11251
11252 If n is not specified or is zero, use a machine-dependent default.
11253
11254 Enabled at levels -O2, -O3.
11255
11256 -falign-jumps
11257 -falign-jumps=n
11258 -falign-jumps=n:m
11259 -falign-jumps=n:m:n2
11260 -falign-jumps=n:m:n2:m2
11261 Align branch targets to a power-of-two boundary, for branch targets
11262 where the targets can only be reached by jumping. In this case, no
11263 dummy operations need be executed.
11264
11265 If -falign-labels is greater than this value, then its value is
11266 used instead.
11267
11268 Parameters of this option are analogous to the -falign-functions
11269 option. -fno-align-jumps and -falign-jumps=1 are equivalent and
11270 mean that loops are not aligned.
11271
11272 If n is not specified or is zero, use a machine-dependent default.
11273 The maximum allowed n option value is 65536.
11274
11275 Enabled at levels -O2, -O3.
11276
11277 -fno-allocation-dce
11278 Do not remove unused C++ allocations in dead code elimination.
11279
11280 -fallow-store-data-races
11281 Allow the compiler to perform optimizations that may introduce new
11282 data races on stores, without proving that the variable cannot be
11283 concurrently accessed by other threads. Does not affect
11284 optimization of local data. It is safe to use this option if it is
11285 known that global data will not be accessed by multiple threads.
11286
11287 Examples of optimizations enabled by -fallow-store-data-races
11288 include hoisting or if-conversions that may cause a value that was
11289 already in memory to be re-written with that same value. Such re-
11290 writing is safe in a single threaded context but may be unsafe in a
11291 multi-threaded context. Note that on some processors, if-
11292 conversions may be required in order to enable vectorization.
11293
11294 Enabled at level -Ofast.
11295
11296 -funit-at-a-time
11297 This option is left for compatibility reasons. -funit-at-a-time has
11298 no effect, while -fno-unit-at-a-time implies -fno-toplevel-reorder
11299 and -fno-section-anchors.
11300
11301 Enabled by default.
11302
11303 -fno-toplevel-reorder
11304 Do not reorder top-level functions, variables, and "asm"
11305 statements. Output them in the same order that they appear in the
11306 input file. When this option is used, unreferenced static
11307 variables are not removed. This option is intended to support
11308 existing code that relies on a particular ordering. For new code,
11309 it is better to use attributes when possible.
11310
11311 -ftoplevel-reorder is the default at -O1 and higher, and also at
11312 -O0 if -fsection-anchors is explicitly requested. Additionally
11313 -fno-toplevel-reorder implies -fno-section-anchors.
11314
11315 -funreachable-traps
11316 With this option, the compiler turns calls to
11317 "__builtin_unreachable" into traps, instead of using them for
11318 optimization. This also affects any such calls implicitly
11319 generated by the compiler.
11320
11321 This option has the same effect as -fsanitize=unreachable
11322 -fsanitize-trap=unreachable, but does not affect the values of
11323 those options. If -fsanitize=unreachable is enabled, that option
11324 takes priority over this one.
11325
11326 This option is enabled by default at -O0 and -Og.
11327
11328 -fweb
11329 Constructs webs as commonly used for register allocation purposes
11330 and assign each web individual pseudo register. This allows the
11331 register allocation pass to operate on pseudos directly, but also
11332 strengthens several other optimization passes, such as CSE, loop
11333 optimizer and trivial dead code remover. It can, however, make
11334 debugging impossible, since variables no longer stay in a "home
11335 register".
11336
11337 Enabled by default with -funroll-loops.
11338
11339 -fwhole-program
11340 Assume that the current compilation unit represents the whole
11341 program being compiled. All public functions and variables with
11342 the exception of "main" and those merged by attribute
11343 "externally_visible" become static functions and in effect are
11344 optimized more aggressively by interprocedural optimizers.
11345
11346 With -flto this option has a limited use. In most cases the
11347 precise list of symbols used or exported from the binary is known
11348 the resolution info passed to the link-time optimizer by the linker
11349 plugin. It is still useful if no linker plugin is used or during
11350 incremental link step when final code is produced (with -flto
11351 -flinker-output=nolto-rel).
11352
11353 -flto[=n]
11354 This option runs the standard link-time optimizer. When invoked
11355 with source code, it generates GIMPLE (one of GCC's internal
11356 representations) and writes it to special ELF sections in the
11357 object file. When the object files are linked together, all the
11358 function bodies are read from these ELF sections and instantiated
11359 as if they had been part of the same translation unit.
11360
11361 To use the link-time optimizer, -flto and optimization options
11362 should be specified at compile time and during the final link. It
11363 is recommended that you compile all the files participating in the
11364 same link with the same options and also specify those options at
11365 link time. For example:
11366
11367 gcc -c -O2 -flto foo.c
11368 gcc -c -O2 -flto bar.c
11369 gcc -o myprog -flto -O2 foo.o bar.o
11370
11371 The first two invocations to GCC save a bytecode representation of
11372 GIMPLE into special ELF sections inside foo.o and bar.o. The final
11373 invocation reads the GIMPLE bytecode from foo.o and bar.o, merges
11374 the two files into a single internal image, and compiles the result
11375 as usual. Since both foo.o and bar.o are merged into a single
11376 image, this causes all the interprocedural analyses and
11377 optimizations in GCC to work across the two files as if they were a
11378 single one. This means, for example, that the inliner is able to
11379 inline functions in bar.o into functions in foo.o and vice-versa.
11380
11381 Another (simpler) way to enable link-time optimization is:
11382
11383 gcc -o myprog -flto -O2 foo.c bar.c
11384
11385 The above generates bytecode for foo.c and bar.c, merges them
11386 together into a single GIMPLE representation and optimizes them as
11387 usual to produce myprog.
11388
11389 The important thing to keep in mind is that to enable link-time
11390 optimizations you need to use the GCC driver to perform the link
11391 step. GCC automatically performs link-time optimization if any of
11392 the objects involved were compiled with the -flto command-line
11393 option. You can always override the automatic decision to do link-
11394 time optimization by passing -fno-lto to the link command.
11395
11396 To make whole program optimization effective, it is necessary to
11397 make certain whole program assumptions. The compiler needs to know
11398 what functions and variables can be accessed by libraries and
11399 runtime outside of the link-time optimized unit. When supported by
11400 the linker, the linker plugin (see -fuse-linker-plugin) passes
11401 information to the compiler about used and externally visible
11402 symbols. When the linker plugin is not available, -fwhole-program
11403 should be used to allow the compiler to make these assumptions,
11404 which leads to more aggressive optimization decisions.
11405
11406 When a file is compiled with -flto without -fuse-linker-plugin, the
11407 generated object file is larger than a regular object file because
11408 it contains GIMPLE bytecodes and the usual final code (see
11409 -ffat-lto-objects). This means that object files with LTO
11410 information can be linked as normal object files; if -fno-lto is
11411 passed to the linker, no interprocedural optimizations are applied.
11412 Note that when -fno-fat-lto-objects is enabled the compile stage is
11413 faster but you cannot perform a regular, non-LTO link on them.
11414
11415 When producing the final binary, GCC only applies link-time
11416 optimizations to those files that contain bytecode. Therefore, you
11417 can mix and match object files and libraries with GIMPLE bytecodes
11418 and final object code. GCC automatically selects which files to
11419 optimize in LTO mode and which files to link without further
11420 processing.
11421
11422 Generally, options specified at link time override those specified
11423 at compile time, although in some cases GCC attempts to infer link-
11424 time options from the settings used to compile the input files.
11425
11426 If you do not specify an optimization level option -O at link time,
11427 then GCC uses the highest optimization level used when compiling
11428 the object files. Note that it is generally ineffective to specify
11429 an optimization level option only at link time and not at compile
11430 time, for two reasons. First, compiling without optimization
11431 suppresses compiler passes that gather information needed for
11432 effective optimization at link time. Second, some early
11433 optimization passes can be performed only at compile time and not
11434 at link time.
11435
11436 There are some code generation flags preserved by GCC when
11437 generating bytecodes, as they need to be used during the final
11438 link. Currently, the following options and their settings are
11439 taken from the first object file that explicitly specifies them:
11440 -fcommon, -fexceptions, -fnon-call-exceptions, -fgnu-tm and all the
11441 -m target flags.
11442
11443 The following options -fPIC, -fpic, -fpie and -fPIE are combined
11444 based on the following scheme:
11445
11446 B<-fPIC> + B<-fpic> = B<-fpic>
11447 B<-fPIC> + B<-fno-pic> = B<-fno-pic>
11448 B<-fpic/-fPIC> + (no option) = (no option)
11449 B<-fPIC> + B<-fPIE> = B<-fPIE>
11450 B<-fpic> + B<-fPIE> = B<-fpie>
11451 B<-fPIC/-fpic> + B<-fpie> = B<-fpie>
11452
11453 Certain ABI-changing flags are required to match in all compilation
11454 units, and trying to override this at link time with a conflicting
11455 value is ignored. This includes options such as
11456 -freg-struct-return and -fpcc-struct-return.
11457
11458 Other options such as -ffp-contract, -fno-strict-overflow, -fwrapv,
11459 -fno-trapv or -fno-strict-aliasing are passed through to the link
11460 stage and merged conservatively for conflicting translation units.
11461 Specifically -fno-strict-overflow, -fwrapv and -fno-trapv take
11462 precedence; and for example -ffp-contract=off takes precedence over
11463 -ffp-contract=fast. You can override them at link time.
11464
11465 Diagnostic options such as -Wstringop-overflow are passed through
11466 to the link stage and their setting matches that of the compile-
11467 step at function granularity. Note that this matters only for
11468 diagnostics emitted during optimization. Note that code transforms
11469 such as inlining can lead to warnings being enabled or disabled for
11470 regions if code not consistent with the setting at compile time.
11471
11472 When you need to pass options to the assembler via -Wa or
11473 -Xassembler make sure to either compile such translation units with
11474 -fno-lto or consistently use the same assembler options on all
11475 translation units. You can alternatively also specify assembler
11476 options at LTO link time.
11477
11478 To enable debug info generation you need to supply -g at compile
11479 time. If any of the input files at link time were built with debug
11480 info generation enabled the link will enable debug info generation
11481 as well. Any elaborate debug info settings like the dwarf level
11482 -gdwarf-5 need to be explicitly repeated at the linker command line
11483 and mixing different settings in different translation units is
11484 discouraged.
11485
11486 If LTO encounters objects with C linkage declared with incompatible
11487 types in separate translation units to be linked together
11488 (undefined behavior according to ISO C99 6.2.7), a non-fatal
11489 diagnostic may be issued. The behavior is still undefined at run
11490 time. Similar diagnostics may be raised for other languages.
11491
11492 Another feature of LTO is that it is possible to apply
11493 interprocedural optimizations on files written in different
11494 languages:
11495
11496 gcc -c -flto foo.c
11497 g++ -c -flto bar.cc
11498 gfortran -c -flto baz.f90
11499 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
11500
11501 Notice that the final link is done with g++ to get the C++ runtime
11502 libraries and -lgfortran is added to get the Fortran runtime
11503 libraries. In general, when mixing languages in LTO mode, you
11504 should use the same link command options as when mixing languages
11505 in a regular (non-LTO) compilation.
11506
11507 If object files containing GIMPLE bytecode are stored in a library
11508 archive, say libfoo.a, it is possible to extract and use them in an
11509 LTO link if you are using a linker with plugin support. To create
11510 static libraries suitable for LTO, use gcc-ar and gcc-ranlib
11511 instead of ar and ranlib; to show the symbols of object files with
11512 GIMPLE bytecode, use gcc-nm. Those commands require that ar,
11513 ranlib and nm have been compiled with plugin support. At link
11514 time, use the flag -fuse-linker-plugin to ensure that the library
11515 participates in the LTO optimization process:
11516
11517 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
11518
11519 With the linker plugin enabled, the linker extracts the needed
11520 GIMPLE files from libfoo.a and passes them on to the running GCC to
11521 make them part of the aggregated GIMPLE image to be optimized.
11522
11523 If you are not using a linker with plugin support and/or do not
11524 enable the linker plugin, then the objects inside libfoo.a are
11525 extracted and linked as usual, but they do not participate in the
11526 LTO optimization process. In order to make a static library
11527 suitable for both LTO optimization and usual linkage, compile its
11528 object files with -flto -ffat-lto-objects.
11529
11530 Link-time optimizations do not require the presence of the whole
11531 program to operate. If the program does not require any symbols to
11532 be exported, it is possible to combine -flto and -fwhole-program to
11533 allow the interprocedural optimizers to use more aggressive
11534 assumptions which may lead to improved optimization opportunities.
11535 Use of -fwhole-program is not needed when linker plugin is active
11536 (see -fuse-linker-plugin).
11537
11538 The current implementation of LTO makes no attempt to generate
11539 bytecode that is portable between different types of hosts. The
11540 bytecode files are versioned and there is a strict version check,
11541 so bytecode files generated in one version of GCC do not work with
11542 an older or newer version of GCC.
11543
11544 Link-time optimization does not work well with generation of
11545 debugging information on systems other than those using a
11546 combination of ELF and DWARF.
11547
11548 If you specify the optional n, the optimization and code generation
11549 done at link time is executed in parallel using n parallel jobs by
11550 utilizing an installed make program. The environment variable MAKE
11551 may be used to override the program used.
11552
11553 You can also specify -flto=jobserver to use GNU make's job server
11554 mode to determine the number of parallel jobs. This is useful when
11555 the Makefile calling GCC is already executing in parallel. You
11556 must prepend a + to the command recipe in the parent Makefile for
11557 this to work. This option likely only works if MAKE is GNU make.
11558 Even without the option value, GCC tries to automatically detect a
11559 running GNU make's job server.
11560
11561 Use -flto=auto to use GNU make's job server, if available, or
11562 otherwise fall back to autodetection of the number of CPU threads
11563 present in your system.
11564
11565 -flto-partition=alg
11566 Specify the partitioning algorithm used by the link-time optimizer.
11567 The value is either 1to1 to specify a partitioning mirroring the
11568 original source files or balanced to specify partitioning into
11569 equally sized chunks (whenever possible) or max to create new
11570 partition for every symbol where possible. Specifying none as an
11571 algorithm disables partitioning and streaming completely. The
11572 default value is balanced. While 1to1 can be used as an workaround
11573 for various code ordering issues, the max partitioning is intended
11574 for internal testing only. The value one specifies that exactly
11575 one partition should be used while the value none bypasses
11576 partitioning and executes the link-time optimization step directly
11577 from the WPA phase.
11578
11579 -flto-compression-level=n
11580 This option specifies the level of compression used for
11581 intermediate language written to LTO object files, and is only
11582 meaningful in conjunction with LTO mode (-flto). GCC currently
11583 supports two LTO compression algorithms. For zstd, valid values are
11584 0 (no compression) to 19 (maximum compression), while zlib supports
11585 values from 0 to 9. Values outside this range are clamped to
11586 either minimum or maximum of the supported values. If the option
11587 is not given, a default balanced compression setting is used.
11588
11589 -fuse-linker-plugin
11590 Enables the use of a linker plugin during link-time optimization.
11591 This option relies on plugin support in the linker, which is
11592 available in gold or in GNU ld 2.21 or newer.
11593
11594 This option enables the extraction of object files with GIMPLE
11595 bytecode out of library archives. This improves the quality of
11596 optimization by exposing more code to the link-time optimizer.
11597 This information specifies what symbols can be accessed externally
11598 (by non-LTO object or during dynamic linking). Resulting code
11599 quality improvements on binaries (and shared libraries that use
11600 hidden visibility) are similar to -fwhole-program. See -flto for a
11601 description of the effect of this flag and how to use it.
11602
11603 This option is enabled by default when LTO support in GCC is
11604 enabled and GCC was configured for use with a linker supporting
11605 plugins (GNU ld 2.21 or newer or gold).
11606
11607 -ffat-lto-objects
11608 Fat LTO objects are object files that contain both the intermediate
11609 language and the object code. This makes them usable for both LTO
11610 linking and normal linking. This option is effective only when
11611 compiling with -flto and is ignored at link time.
11612
11613 -fno-fat-lto-objects improves compilation time over plain LTO, but
11614 requires the complete toolchain to be aware of LTO. It requires a
11615 linker with linker plugin support for basic functionality.
11616 Additionally, nm, ar and ranlib need to support linker plugins to
11617 allow a full-featured build environment (capable of building static
11618 libraries etc). GCC provides the gcc-ar, gcc-nm, gcc-ranlib
11619 wrappers to pass the right options to these tools. With non fat LTO
11620 makefiles need to be modified to use them.
11621
11622 Note that modern binutils provide plugin auto-load mechanism.
11623 Installing the linker plugin into $libdir/bfd-plugins has the same
11624 effect as usage of the command wrappers (gcc-ar, gcc-nm and gcc-
11625 ranlib).
11626
11627 The default is -fno-fat-lto-objects on targets with linker plugin
11628 support.
11629
11630 -fcompare-elim
11631 After register allocation and post-register allocation instruction
11632 splitting, identify arithmetic instructions that compute processor
11633 flags similar to a comparison operation based on that arithmetic.
11634 If possible, eliminate the explicit comparison operation.
11635
11636 This pass only applies to certain targets that cannot explicitly
11637 represent the comparison operation before register allocation is
11638 complete.
11639
11640 Enabled at levels -O1, -O2, -O3, -Os.
11641
11642 -fcprop-registers
11643 After register allocation and post-register allocation instruction
11644 splitting, perform a copy-propagation pass to try to reduce
11645 scheduling dependencies and occasionally eliminate the copy.
11646
11647 Enabled at levels -O1, -O2, -O3, -Os.
11648
11649 -fprofile-correction
11650 Profiles collected using an instrumented binary for multi-threaded
11651 programs may be inconsistent due to missed counter updates. When
11652 this option is specified, GCC uses heuristics to correct or smooth
11653 out such inconsistencies. By default, GCC emits an error message
11654 when an inconsistent profile is detected.
11655
11656 This option is enabled by -fauto-profile.
11657
11658 -fprofile-partial-training
11659 With "-fprofile-use" all portions of programs not executed during
11660 train run are optimized agressively for size rather than speed. In
11661 some cases it is not practical to train all possible hot paths in
11662 the program. (For example, program may contain functions specific
11663 for a given hardware and trianing may not cover all hardware
11664 configurations program is run on.) With
11665 "-fprofile-partial-training" profile feedback will be ignored for
11666 all functions not executed during the train run leading them to be
11667 optimized as if they were compiled without profile feedback. This
11668 leads to better performance when train run is not representative
11669 but also leads to significantly bigger code.
11670
11671 -fprofile-use
11672 -fprofile-use=path
11673 Enable profile feedback-directed optimizations, and the following
11674 optimizations, many of which are generally profitable only with
11675 profile feedback available:
11676
11677 -fbranch-probabilities -fprofile-values -funroll-loops
11678 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
11679 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
11680 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
11681 -ftree-slp-vectorize -fvect-cost-model=dynamic
11682 -ftree-loop-distribute-patterns -fprofile-reorder-functions
11683
11684 Before you can use this option, you must first generate profiling
11685 information.
11686
11687 By default, GCC emits an error message if the feedback profiles do
11688 not match the source code. This error can be turned into a warning
11689 by using -Wno-error=coverage-mismatch. Note this may result in
11690 poorly optimized code. Additionally, by default, GCC also emits a
11691 warning message if the feedback profiles do not exist (see
11692 -Wmissing-profile).
11693
11694 If path is specified, GCC looks at the path to find the profile
11695 feedback data files. See -fprofile-dir.
11696
11697 -fauto-profile
11698 -fauto-profile=path
11699 Enable sampling-based feedback-directed optimizations, and the
11700 following optimizations, many of which are generally profitable
11701 only with profile feedback available:
11702
11703 -fbranch-probabilities -fprofile-values -funroll-loops
11704 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
11705 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
11706 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
11707 -ftree-slp-vectorize -fvect-cost-model=dynamic
11708 -ftree-loop-distribute-patterns -fprofile-correction
11709
11710 path is the name of a file containing AutoFDO profile information.
11711 If omitted, it defaults to fbdata.afdo in the current directory.
11712
11713 Producing an AutoFDO profile data file requires running your
11714 program with the perf utility on a supported GNU/Linux target
11715 system. For more information, see <https://perf.wiki.kernel.org/>.
11716
11717 E.g.
11718
11719 perf record -e br_inst_retired:near_taken -b -o perf.data \
11720 -- your_program
11721
11722 Then use the create_gcov tool to convert the raw profile data to a
11723 format that can be used by GCC. You must also supply the
11724 unstripped binary for your program to this tool. See
11725 <https://github.com/google/autofdo>.
11726
11727 E.g.
11728
11729 create_gcov --binary=your_program.unstripped --profile=perf.data \
11730 --gcov=profile.afdo
11731
11732 The following options control compiler behavior regarding floating-
11733 point arithmetic. These options trade off between speed and
11734 correctness. All must be specifically enabled.
11735
11736 -ffloat-store
11737 Do not store floating-point variables in registers, and inhibit
11738 other options that might change whether a floating-point value is
11739 taken from a register or memory.
11740
11741 This option prevents undesirable excess precision on machines such
11742 as the 68000 where the floating registers (of the 68881) keep more
11743 precision than a "double" is supposed to have. Similarly for the
11744 x86 architecture. For most programs, the excess precision does
11745 only good, but a few programs rely on the precise definition of
11746 IEEE floating point. Use -ffloat-store for such programs, after
11747 modifying them to store all pertinent intermediate computations
11748 into variables.
11749
11750 -fexcess-precision=style
11751 This option allows further control over excess precision on
11752 machines where floating-point operations occur in a format with
11753 more precision or range than the IEEE standard and interchange
11754 floating-point types. By default, -fexcess-precision=fast is in
11755 effect; this means that operations may be carried out in a wider
11756 precision than the types specified in the source if that would
11757 result in faster code, and it is unpredictable when rounding to the
11758 types specified in the source code takes place. When compiling C
11759 or C++, if -fexcess-precision=standard is specified then excess
11760 precision follows the rules specified in ISO C99 or C++; in
11761 particular, both casts and assignments cause values to be rounded
11762 to their semantic types (whereas -ffloat-store only affects
11763 assignments). This option is enabled by default for C or C++ if a
11764 strict conformance option such as -std=c99 or -std=c++17 is used.
11765 -ffast-math enables -fexcess-precision=fast by default regardless
11766 of whether a strict conformance option is used.
11767
11768 -fexcess-precision=standard is not implemented for languages other
11769 than C or C++. On the x86, it has no effect if -mfpmath=sse or
11770 -mfpmath=sse+387 is specified; in the former case, IEEE semantics
11771 apply without excess precision, and in the latter, rounding is
11772 unpredictable.
11773
11774 -ffast-math
11775 Sets the options -fno-math-errno, -funsafe-math-optimizations,
11776 -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans,
11777 -fcx-limited-range and -fexcess-precision=fast.
11778
11779 This option causes the preprocessor macro "__FAST_MATH__" to be
11780 defined.
11781
11782 This option is not turned on by any -O option besides -Ofast since
11783 it can result in incorrect output for programs that depend on an
11784 exact implementation of IEEE or ISO rules/specifications for math
11785 functions. It may, however, yield faster code for programs that do
11786 not require the guarantees of these specifications.
11787
11788 -fno-math-errno
11789 Do not set "errno" after calling math functions that are executed
11790 with a single instruction, e.g., "sqrt". A program that relies on
11791 IEEE exceptions for math error handling may want to use this flag
11792 for speed while maintaining IEEE arithmetic compatibility.
11793
11794 This option is not turned on by any -O option since it can result
11795 in incorrect output for programs that depend on an exact
11796 implementation of IEEE or ISO rules/specifications for math
11797 functions. It may, however, yield faster code for programs that do
11798 not require the guarantees of these specifications.
11799
11800 The default is -fmath-errno.
11801
11802 On Darwin systems, the math library never sets "errno". There is
11803 therefore no reason for the compiler to consider the possibility
11804 that it might, and -fno-math-errno is the default.
11805
11806 -funsafe-math-optimizations
11807 Allow optimizations for floating-point arithmetic that (a) assume
11808 that arguments and results are valid and (b) may violate IEEE or
11809 ANSI standards. When used at link time, it may include libraries
11810 or startup files that change the default FPU control word or other
11811 similar optimizations.
11812
11813 This option is not turned on by any -O option since it can result
11814 in incorrect output for programs that depend on an exact
11815 implementation of IEEE or ISO rules/specifications for math
11816 functions. It may, however, yield faster code for programs that do
11817 not require the guarantees of these specifications. Enables
11818 -fno-signed-zeros, -fno-trapping-math, -fassociative-math and
11819 -freciprocal-math.
11820
11821 The default is -fno-unsafe-math-optimizations.
11822
11823 -fassociative-math
11824 Allow re-association of operands in series of floating-point
11825 operations. This violates the ISO C and C++ language standard by
11826 possibly changing computation result. NOTE: re-ordering may change
11827 the sign of zero as well as ignore NaNs and inhibit or create
11828 underflow or overflow (and thus cannot be used on code that relies
11829 on rounding behavior like "(x + 2**52) - 2**52". May also reorder
11830 floating-point comparisons and thus may not be used when ordered
11831 comparisons are required. This option requires that both
11832 -fno-signed-zeros and -fno-trapping-math be in effect. Moreover,
11833 it doesn't make much sense with -frounding-math. For Fortran the
11834 option is automatically enabled when both -fno-signed-zeros and
11835 -fno-trapping-math are in effect.
11836
11837 The default is -fno-associative-math.
11838
11839 -freciprocal-math
11840 Allow the reciprocal of a value to be used instead of dividing by
11841 the value if this enables optimizations. For example "x / y" can
11842 be replaced with "x * (1/y)", which is useful if "(1/y)" is subject
11843 to common subexpression elimination. Note that this loses
11844 precision and increases the number of flops operating on the value.
11845
11846 The default is -fno-reciprocal-math.
11847
11848 -ffinite-math-only
11849 Allow optimizations for floating-point arithmetic that assume that
11850 arguments and results are not NaNs or +-Infs.
11851
11852 This option is not turned on by any -O option since it can result
11853 in incorrect output for programs that depend on an exact
11854 implementation of IEEE or ISO rules/specifications for math
11855 functions. It may, however, yield faster code for programs that do
11856 not require the guarantees of these specifications.
11857
11858 The default is -fno-finite-math-only.
11859
11860 -fno-signed-zeros
11861 Allow optimizations for floating-point arithmetic that ignore the
11862 signedness of zero. IEEE arithmetic specifies the behavior of
11863 distinct +0.0 and -0.0 values, which then prohibits simplification
11864 of expressions such as x+0.0 or 0.0*x (even with
11865 -ffinite-math-only). This option implies that the sign of a zero
11866 result isn't significant.
11867
11868 The default is -fsigned-zeros.
11869
11870 -fno-trapping-math
11871 Compile code assuming that floating-point operations cannot
11872 generate user-visible traps. These traps include division by zero,
11873 overflow, underflow, inexact result and invalid operation. This
11874 option requires that -fno-signaling-nans be in effect. Setting
11875 this option may allow faster code if one relies on "non-stop" IEEE
11876 arithmetic, for example.
11877
11878 This option should never be turned on by any -O option since it can
11879 result in incorrect output for programs that depend on an exact
11880 implementation of IEEE or ISO rules/specifications for math
11881 functions.
11882
11883 The default is -ftrapping-math.
11884
11885 Future versions of GCC may provide finer control of this setting
11886 using C99's "FENV_ACCESS" pragma. This command-line option will be
11887 used along with -frounding-math to specify the default state for
11888 "FENV_ACCESS".
11889
11890 -frounding-math
11891 Disable transformations and optimizations that assume default
11892 floating-point rounding behavior. This is round-to-zero for all
11893 floating point to integer conversions, and round-to-nearest for all
11894 other arithmetic truncations. This option should be specified for
11895 programs that change the FP rounding mode dynamically, or that may
11896 be executed with a non-default rounding mode. This option disables
11897 constant folding of floating-point expressions at compile time
11898 (which may be affected by rounding mode) and arithmetic
11899 transformations that are unsafe in the presence of sign-dependent
11900 rounding modes.
11901
11902 The default is -fno-rounding-math.
11903
11904 This option is experimental and does not currently guarantee to
11905 disable all GCC optimizations that are affected by rounding mode.
11906 Future versions of GCC may provide finer control of this setting
11907 using C99's "FENV_ACCESS" pragma. This command-line option will be
11908 used along with -ftrapping-math to specify the default state for
11909 "FENV_ACCESS".
11910
11911 -fsignaling-nans
11912 Compile code assuming that IEEE signaling NaNs may generate user-
11913 visible traps during floating-point operations. Setting this
11914 option disables optimizations that may change the number of
11915 exceptions visible with signaling NaNs. This option implies
11916 -ftrapping-math.
11917
11918 This option causes the preprocessor macro "__SUPPORT_SNAN__" to be
11919 defined.
11920
11921 The default is -fno-signaling-nans.
11922
11923 This option is experimental and does not currently guarantee to
11924 disable all GCC optimizations that affect signaling NaN behavior.
11925
11926 -fno-fp-int-builtin-inexact
11927 Do not allow the built-in functions "ceil", "floor", "round" and
11928 "trunc", and their "float" and "long double" variants, to generate
11929 code that raises the "inexact" floating-point exception for
11930 noninteger arguments. ISO C99 and C11 allow these functions to
11931 raise the "inexact" exception, but ISO/IEC TS 18661-1:2014, the C
11932 bindings to IEEE 754-2008, as integrated into ISO C2X, does not
11933 allow these functions to do so.
11934
11935 The default is -ffp-int-builtin-inexact, allowing the exception to
11936 be raised, unless C2X or a later C standard is selected. This
11937 option does nothing unless -ftrapping-math is in effect.
11938
11939 Even if -fno-fp-int-builtin-inexact is used, if the functions
11940 generate a call to a library function then the "inexact" exception
11941 may be raised if the library implementation does not follow TS
11942 18661.
11943
11944 -fsingle-precision-constant
11945 Treat floating-point constants as single precision instead of
11946 implicitly converting them to double-precision constants.
11947
11948 -fcx-limited-range
11949 When enabled, this option states that a range reduction step is not
11950 needed when performing complex division. Also, there is no
11951 checking whether the result of a complex multiplication or division
11952 is "NaN + I*NaN", with an attempt to rescue the situation in that
11953 case. The default is -fno-cx-limited-range, but is enabled by
11954 -ffast-math.
11955
11956 This option controls the default setting of the ISO C99
11957 "CX_LIMITED_RANGE" pragma. Nevertheless, the option applies to all
11958 languages.
11959
11960 -fcx-fortran-rules
11961 Complex multiplication and division follow Fortran rules. Range
11962 reduction is done as part of complex division, but there is no
11963 checking whether the result of a complex multiplication or division
11964 is "NaN + I*NaN", with an attempt to rescue the situation in that
11965 case.
11966
11967 The default is -fno-cx-fortran-rules.
11968
11969 The following options control optimizations that may improve
11970 performance, but are not enabled by any -O options. This section
11971 includes experimental options that may produce broken code.
11972
11973 -fbranch-probabilities
11974 After running a program compiled with -fprofile-arcs, you can
11975 compile it a second time using -fbranch-probabilities, to improve
11976 optimizations based on the number of times each branch was taken.
11977 When a program compiled with -fprofile-arcs exits, it saves arc
11978 execution counts to a file called sourcename.gcda for each source
11979 file. The information in this data file is very dependent on the
11980 structure of the generated code, so you must use the same source
11981 code and the same optimization options for both compilations. See
11982 details about the file naming in -fprofile-arcs.
11983
11984 With -fbranch-probabilities, GCC puts a REG_BR_PROB note on each
11985 JUMP_INSN and CALL_INSN. These can be used to improve
11986 optimization. Currently, they are only used in one place: in
11987 reorg.cc, instead of guessing which path a branch is most likely to
11988 take, the REG_BR_PROB values are used to exactly determine which
11989 path is taken more often.
11990
11991 Enabled by -fprofile-use and -fauto-profile.
11992
11993 -fprofile-values
11994 If combined with -fprofile-arcs, it adds code so that some data
11995 about values of expressions in the program is gathered.
11996
11997 With -fbranch-probabilities, it reads back the data gathered from
11998 profiling values of expressions for usage in optimizations.
11999
12000 Enabled by -fprofile-generate, -fprofile-use, and -fauto-profile.
12001
12002 -fprofile-reorder-functions
12003 Function reordering based on profile instrumentation collects first
12004 time of execution of a function and orders these functions in
12005 ascending order.
12006
12007 Enabled with -fprofile-use.
12008
12009 -fvpt
12010 If combined with -fprofile-arcs, this option instructs the compiler
12011 to add code to gather information about values of expressions.
12012
12013 With -fbranch-probabilities, it reads back the data gathered and
12014 actually performs the optimizations based on them. Currently the
12015 optimizations include specialization of division operations using
12016 the knowledge about the value of the denominator.
12017
12018 Enabled with -fprofile-use and -fauto-profile.
12019
12020 -frename-registers
12021 Attempt to avoid false dependencies in scheduled code by making use
12022 of registers left over after register allocation. This
12023 optimization most benefits processors with lots of registers.
12024 Depending on the debug information format adopted by the target,
12025 however, it can make debugging impossible, since variables no
12026 longer stay in a "home register".
12027
12028 Enabled by default with -funroll-loops.
12029
12030 -fschedule-fusion
12031 Performs a target dependent pass over the instruction stream to
12032 schedule instructions of same type together because target machine
12033 can execute them more efficiently if they are adjacent to each
12034 other in the instruction flow.
12035
12036 Enabled at levels -O2, -O3, -Os.
12037
12038 -ftracer
12039 Perform tail duplication to enlarge superblock size. This
12040 transformation simplifies the control flow of the function allowing
12041 other optimizations to do a better job.
12042
12043 Enabled by -fprofile-use and -fauto-profile.
12044
12045 -funroll-loops
12046 Unroll loops whose number of iterations can be determined at
12047 compile time or upon entry to the loop. -funroll-loops implies
12048 -frerun-cse-after-loop, -fweb and -frename-registers. It also
12049 turns on complete loop peeling (i.e. complete removal of loops with
12050 a small constant number of iterations). This option makes code
12051 larger, and may or may not make it run faster.
12052
12053 Enabled by -fprofile-use and -fauto-profile.
12054
12055 -funroll-all-loops
12056 Unroll all loops, even if their number of iterations is uncertain
12057 when the loop is entered. This usually makes programs run more
12058 slowly. -funroll-all-loops implies the same options as
12059 -funroll-loops.
12060
12061 -fpeel-loops
12062 Peels loops for which there is enough information that they do not
12063 roll much (from profile feedback or static analysis). It also
12064 turns on complete loop peeling (i.e. complete removal of loops with
12065 small constant number of iterations).
12066
12067 Enabled by -O3, -fprofile-use, and -fauto-profile.
12068
12069 -fmove-loop-invariants
12070 Enables the loop invariant motion pass in the RTL loop optimizer.
12071 Enabled at level -O1 and higher, except for -Og.
12072
12073 -fmove-loop-stores
12074 Enables the loop store motion pass in the GIMPLE loop optimizer.
12075 This moves invariant stores to after the end of the loop in
12076 exchange for carrying the stored value in a register across the
12077 iteration. Note for this option to have an effect -ftree-loop-im
12078 has to be enabled as well. Enabled at level -O1 and higher, except
12079 for -Og.
12080
12081 -fsplit-loops
12082 Split a loop into two if it contains a condition that's always true
12083 for one side of the iteration space and false for the other.
12084
12085 Enabled by -fprofile-use and -fauto-profile.
12086
12087 -funswitch-loops
12088 Move branches with loop invariant conditions out of the loop, with
12089 duplicates of the loop on both branches (modified according to
12090 result of the condition).
12091
12092 Enabled by -fprofile-use and -fauto-profile.
12093
12094 -fversion-loops-for-strides
12095 If a loop iterates over an array with a variable stride, create
12096 another version of the loop that assumes the stride is always one.
12097 For example:
12098
12099 for (int i = 0; i < n; ++i)
12100 x[i * stride] = ...;
12101
12102 becomes:
12103
12104 if (stride == 1)
12105 for (int i = 0; i < n; ++i)
12106 x[i] = ...;
12107 else
12108 for (int i = 0; i < n; ++i)
12109 x[i * stride] = ...;
12110
12111 This is particularly useful for assumed-shape arrays in Fortran
12112 where (for example) it allows better vectorization assuming
12113 contiguous accesses. This flag is enabled by default at -O3. It
12114 is also enabled by -fprofile-use and -fauto-profile.
12115
12116 -ffunction-sections
12117 -fdata-sections
12118 Place each function or data item into its own section in the output
12119 file if the target supports arbitrary sections. The name of the
12120 function or the name of the data item determines the section's name
12121 in the output file.
12122
12123 Use these options on systems where the linker can perform
12124 optimizations to improve locality of reference in the instruction
12125 space. Most systems using the ELF object format have linkers with
12126 such optimizations. On AIX, the linker rearranges sections
12127 (CSECTs) based on the call graph. The performance impact varies.
12128
12129 Together with a linker garbage collection (linker --gc-sections
12130 option) these options may lead to smaller statically-linked
12131 executables (after stripping).
12132
12133 On ELF/DWARF systems these options do not degenerate the quality of
12134 the debug information. There could be issues with other object
12135 files/debug info formats.
12136
12137 Only use these options when there are significant benefits from
12138 doing so. When you specify these options, the assembler and linker
12139 create larger object and executable files and are also slower.
12140 These options affect code generation. They prevent optimizations
12141 by the compiler and assembler using relative locations inside a
12142 translation unit since the locations are unknown until link time.
12143 An example of such an optimization is relaxing calls to short call
12144 instructions.
12145
12146 -fstdarg-opt
12147 Optimize the prologue of variadic argument functions with respect
12148 to usage of those arguments.
12149
12150 -fsection-anchors
12151 Try to reduce the number of symbolic address calculations by using
12152 shared "anchor" symbols to address nearby objects. This
12153 transformation can help to reduce the number of GOT entries and GOT
12154 accesses on some targets.
12155
12156 For example, the implementation of the following function "foo":
12157
12158 static int a, b, c;
12159 int foo (void) { return a + b + c; }
12160
12161 usually calculates the addresses of all three variables, but if you
12162 compile it with -fsection-anchors, it accesses the variables from a
12163 common anchor point instead. The effect is similar to the
12164 following pseudocode (which isn't valid C):
12165
12166 int foo (void)
12167 {
12168 register int *xr = &x;
12169 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
12170 }
12171
12172 Not all targets support this option.
12173
12174 -fzero-call-used-regs=choice
12175 Zero call-used registers at function return to increase program
12176 security by either mitigating Return-Oriented Programming (ROP)
12177 attacks or preventing information leakage through registers.
12178
12179 The possible values of choice are the same as for the
12180 "zero_call_used_regs" attribute. The default is skip.
12181
12182 You can control this behavior for a specific function by using the
12183 function attribute "zero_call_used_regs".
12184
12185 --param name=value
12186 In some places, GCC uses various constants to control the amount of
12187 optimization that is done. For example, GCC does not inline
12188 functions that contain more than a certain number of instructions.
12189 You can control some of these constants on the command line using
12190 the --param option.
12191
12192 The names of specific parameters, and the meaning of the values,
12193 are tied to the internals of the compiler, and are subject to
12194 change without notice in future releases.
12195
12196 In order to get the minimal, maximal and default values of a
12197 parameter, use the --help=param -Q options.
12198
12199 In each case, the value is an integer. The following choices of
12200 name are recognized for all targets:
12201
12202 predictable-branch-outcome
12203 When branch is predicted to be taken with probability lower
12204 than this threshold (in percent), then it is considered well
12205 predictable.
12206
12207 max-rtl-if-conversion-insns
12208 RTL if-conversion tries to remove conditional branches around a
12209 block and replace them with conditionally executed
12210 instructions. This parameter gives the maximum number of
12211 instructions in a block which should be considered for if-
12212 conversion. The compiler will also use other heuristics to
12213 decide whether if-conversion is likely to be profitable.
12214
12215 max-rtl-if-conversion-predictable-cost
12216 RTL if-conversion will try to remove conditional branches
12217 around a block and replace them with conditionally executed
12218 instructions. These parameters give the maximum permissible
12219 cost for the sequence that would be generated by if-conversion
12220 depending on whether the branch is statically determined to be
12221 predictable or not. The units for this parameter are the same
12222 as those for the GCC internal seq_cost metric. The compiler
12223 will try to provide a reasonable default for this parameter
12224 using the BRANCH_COST target macro.
12225
12226 max-crossjump-edges
12227 The maximum number of incoming edges to consider for cross-
12228 jumping. The algorithm used by -fcrossjumping is O(N^2) in the
12229 number of edges incoming to each block. Increasing values mean
12230 more aggressive optimization, making the compilation time
12231 increase with probably small improvement in executable size.
12232
12233 min-crossjump-insns
12234 The minimum number of instructions that must be matched at the
12235 end of two blocks before cross-jumping is performed on them.
12236 This value is ignored in the case where all instructions in the
12237 block being cross-jumped from are matched.
12238
12239 max-grow-copy-bb-insns
12240 The maximum code size expansion factor when copying basic
12241 blocks instead of jumping. The expansion is relative to a jump
12242 instruction.
12243
12244 max-goto-duplication-insns
12245 The maximum number of instructions to duplicate to a block that
12246 jumps to a computed goto. To avoid O(N^2) behavior in a number
12247 of passes, GCC factors computed gotos early in the compilation
12248 process, and unfactors them as late as possible. Only computed
12249 jumps at the end of a basic blocks with no more than max-goto-
12250 duplication-insns are unfactored.
12251
12252 max-delay-slot-insn-search
12253 The maximum number of instructions to consider when looking for
12254 an instruction to fill a delay slot. If more than this
12255 arbitrary number of instructions are searched, the time savings
12256 from filling the delay slot are minimal, so stop searching.
12257 Increasing values mean more aggressive optimization, making the
12258 compilation time increase with probably small improvement in
12259 execution time.
12260
12261 max-delay-slot-live-search
12262 When trying to fill delay slots, the maximum number of
12263 instructions to consider when searching for a block with valid
12264 live register information. Increasing this arbitrarily chosen
12265 value means more aggressive optimization, increasing the
12266 compilation time. This parameter should be removed when the
12267 delay slot code is rewritten to maintain the control-flow
12268 graph.
12269
12270 max-gcse-memory
12271 The approximate maximum amount of memory in "kB" that can be
12272 allocated in order to perform the global common subexpression
12273 elimination optimization. If more memory than specified is
12274 required, the optimization is not done.
12275
12276 max-gcse-insertion-ratio
12277 If the ratio of expression insertions to deletions is larger
12278 than this value for any expression, then RTL PRE inserts or
12279 removes the expression and thus leaves partially redundant
12280 computations in the instruction stream.
12281
12282 max-pending-list-length
12283 The maximum number of pending dependencies scheduling allows
12284 before flushing the current state and starting over. Large
12285 functions with few branches or calls can create excessively
12286 large lists which needlessly consume memory and resources.
12287
12288 max-modulo-backtrack-attempts
12289 The maximum number of backtrack attempts the scheduler should
12290 make when modulo scheduling a loop. Larger values can
12291 exponentially increase compilation time.
12292
12293 max-inline-functions-called-once-loop-depth
12294 Maximal loop depth of a call considered by inline heuristics
12295 that tries to inline all functions called once.
12296
12297 max-inline-functions-called-once-insns
12298 Maximal estimated size of functions produced while inlining
12299 functions called once.
12300
12301 max-inline-insns-single
12302 Several parameters control the tree inliner used in GCC. This
12303 number sets the maximum number of instructions (counted in
12304 GCC's internal representation) in a single function that the
12305 tree inliner considers for inlining. This only affects
12306 functions declared inline and methods implemented in a class
12307 declaration (C++).
12308
12309 max-inline-insns-auto
12310 When you use -finline-functions (included in -O3), a lot of
12311 functions that would otherwise not be considered for inlining
12312 by the compiler are investigated. To those functions, a
12313 different (more restrictive) limit compared to functions
12314 declared inline can be applied (--param max-inline-insns-auto).
12315
12316 max-inline-insns-small
12317 This is bound applied to calls which are considered relevant
12318 with -finline-small-functions.
12319
12320 max-inline-insns-size
12321 This is bound applied to calls which are optimized for size.
12322 Small growth may be desirable to anticipate optimization
12323 oppurtunities exposed by inlining.
12324
12325 uninlined-function-insns
12326 Number of instructions accounted by inliner for function
12327 overhead such as function prologue and epilogue.
12328
12329 uninlined-function-time
12330 Extra time accounted by inliner for function overhead such as
12331 time needed to execute function prologue and epilogue.
12332
12333 inline-heuristics-hint-percent
12334 The scale (in percents) applied to inline-insns-single,
12335 inline-insns-single-O2, inline-insns-auto when inline
12336 heuristics hints that inlining is very profitable (will enable
12337 later optimizations).
12338
12339 uninlined-thunk-insns
12340 uninlined-thunk-time
12341 Same as --param uninlined-function-insns and --param uninlined-
12342 function-time but applied to function thunks.
12343
12344 inline-min-speedup
12345 When estimated performance improvement of caller + callee
12346 runtime exceeds this threshold (in percent), the function can
12347 be inlined regardless of the limit on --param max-inline-insns-
12348 single and --param max-inline-insns-auto.
12349
12350 large-function-insns
12351 The limit specifying really large functions. For functions
12352 larger than this limit after inlining, inlining is constrained
12353 by --param large-function-growth. This parameter is useful
12354 primarily to avoid extreme compilation time caused by non-
12355 linear algorithms used by the back end.
12356
12357 large-function-growth
12358 Specifies maximal growth of large function caused by inlining
12359 in percents. For example, parameter value 100 limits large
12360 function growth to 2.0 times the original size.
12361
12362 large-unit-insns
12363 The limit specifying large translation unit. Growth caused by
12364 inlining of units larger than this limit is limited by --param
12365 inline-unit-growth. For small units this might be too tight.
12366 For example, consider a unit consisting of function A that is
12367 inline and B that just calls A three times. If B is small
12368 relative to A, the growth of unit is 300\% and yet such
12369 inlining is very sane. For very large units consisting of
12370 small inlineable functions, however, the overall unit growth
12371 limit is needed to avoid exponential explosion of code size.
12372 Thus for smaller units, the size is increased to --param large-
12373 unit-insns before applying --param inline-unit-growth.
12374
12375 lazy-modules
12376 Maximum number of concurrently open C++ module files when lazy
12377 loading.
12378
12379 inline-unit-growth
12380 Specifies maximal overall growth of the compilation unit caused
12381 by inlining. For example, parameter value 20 limits unit
12382 growth to 1.2 times the original size. Cold functions (either
12383 marked cold via an attribute or by profile feedback) are not
12384 accounted into the unit size.
12385
12386 ipa-cp-unit-growth
12387 Specifies maximal overall growth of the compilation unit caused
12388 by interprocedural constant propagation. For example,
12389 parameter value 10 limits unit growth to 1.1 times the original
12390 size.
12391
12392 ipa-cp-large-unit-insns
12393 The size of translation unit that IPA-CP pass considers large.
12394
12395 large-stack-frame
12396 The limit specifying large stack frames. While inlining the
12397 algorithm is trying to not grow past this limit too much.
12398
12399 large-stack-frame-growth
12400 Specifies maximal growth of large stack frames caused by
12401 inlining in percents. For example, parameter value 1000 limits
12402 large stack frame growth to 11 times the original size.
12403
12404 max-inline-insns-recursive
12405 max-inline-insns-recursive-auto
12406 Specifies the maximum number of instructions an out-of-line
12407 copy of a self-recursive inline function can grow into by
12408 performing recursive inlining.
12409
12410 --param max-inline-insns-recursive applies to functions
12411 declared inline. For functions not declared inline, recursive
12412 inlining happens only when -finline-functions (included in -O3)
12413 is enabled; --param max-inline-insns-recursive-auto applies
12414 instead.
12415
12416 max-inline-recursive-depth
12417 max-inline-recursive-depth-auto
12418 Specifies the maximum recursion depth used for recursive
12419 inlining.
12420
12421 --param max-inline-recursive-depth applies to functions
12422 declared inline. For functions not declared inline, recursive
12423 inlining happens only when -finline-functions (included in -O3)
12424 is enabled; --param max-inline-recursive-depth-auto applies
12425 instead.
12426
12427 min-inline-recursive-probability
12428 Recursive inlining is profitable only for function having deep
12429 recursion in average and can hurt for function having little
12430 recursion depth by increasing the prologue size or complexity
12431 of function body to other optimizers.
12432
12433 When profile feedback is available (see -fprofile-generate) the
12434 actual recursion depth can be guessed from the probability that
12435 function recurses via a given call expression. This parameter
12436 limits inlining only to call expressions whose probability
12437 exceeds the given threshold (in percents).
12438
12439 early-inlining-insns
12440 Specify growth that the early inliner can make. In effect it
12441 increases the amount of inlining for code having a large
12442 abstraction penalty.
12443
12444 max-early-inliner-iterations
12445 Limit of iterations of the early inliner. This basically
12446 bounds the number of nested indirect calls the early inliner
12447 can resolve. Deeper chains are still handled by late inlining.
12448
12449 comdat-sharing-probability
12450 Probability (in percent) that C++ inline function with comdat
12451 visibility are shared across multiple compilation units.
12452
12453 modref-max-bases
12454 modref-max-refs
12455 modref-max-accesses
12456 Specifies the maximal number of base pointers, references and
12457 accesses stored for a single function by mod/ref analysis.
12458
12459 modref-max-tests
12460 Specifies the maxmal number of tests alias oracle can perform
12461 to disambiguate memory locations using the mod/ref information.
12462 This parameter ought to be bigger than --param modref-max-bases
12463 and --param modref-max-refs.
12464
12465 modref-max-depth
12466 Specifies the maximum depth of DFS walk used by modref escape
12467 analysis. Setting to 0 disables the analysis completely.
12468
12469 modref-max-escape-points
12470 Specifies the maximum number of escape points tracked by modref
12471 per SSA-name.
12472
12473 modref-max-adjustments
12474 Specifies the maximum number the access range is enlarged
12475 during modref dataflow analysis.
12476
12477 profile-func-internal-id
12478 A parameter to control whether to use function internal id in
12479 profile database lookup. If the value is 0, the compiler uses
12480 an id that is based on function assembler name and filename,
12481 which makes old profile data more tolerant to source changes
12482 such as function reordering etc.
12483
12484 min-vect-loop-bound
12485 The minimum number of iterations under which loops are not
12486 vectorized when -ftree-vectorize is used. The number of
12487 iterations after vectorization needs to be greater than the
12488 value specified by this option to allow vectorization.
12489
12490 gcse-cost-distance-ratio
12491 Scaling factor in calculation of maximum distance an expression
12492 can be moved by GCSE optimizations. This is currently
12493 supported only in the code hoisting pass. The bigger the
12494 ratio, the more aggressive code hoisting is with simple
12495 expressions, i.e., the expressions that have cost less than
12496 gcse-unrestricted-cost. Specifying 0 disables hoisting of
12497 simple expressions.
12498
12499 gcse-unrestricted-cost
12500 Cost, roughly measured as the cost of a single typical machine
12501 instruction, at which GCSE optimizations do not constrain the
12502 distance an expression can travel. This is currently supported
12503 only in the code hoisting pass. The lesser the cost, the more
12504 aggressive code hoisting is. Specifying 0 allows all
12505 expressions to travel unrestricted distances.
12506
12507 max-hoist-depth
12508 The depth of search in the dominator tree for expressions to
12509 hoist. This is used to avoid quadratic behavior in hoisting
12510 algorithm. The value of 0 does not limit on the search, but
12511 may slow down compilation of huge functions.
12512
12513 max-tail-merge-comparisons
12514 The maximum amount of similar bbs to compare a bb with. This
12515 is used to avoid quadratic behavior in tree tail merging.
12516
12517 max-tail-merge-iterations
12518 The maximum amount of iterations of the pass over the function.
12519 This is used to limit compilation time in tree tail merging.
12520
12521 store-merging-allow-unaligned
12522 Allow the store merging pass to introduce unaligned stores if
12523 it is legal to do so.
12524
12525 max-stores-to-merge
12526 The maximum number of stores to attempt to merge into wider
12527 stores in the store merging pass.
12528
12529 max-store-chains-to-track
12530 The maximum number of store chains to track at the same time in
12531 the attempt to merge them into wider stores in the store
12532 merging pass.
12533
12534 max-stores-to-track
12535 The maximum number of stores to track at the same time in the
12536 attemt to to merge them into wider stores in the store merging
12537 pass.
12538
12539 max-unrolled-insns
12540 The maximum number of instructions that a loop may have to be
12541 unrolled. If a loop is unrolled, this parameter also
12542 determines how many times the loop code is unrolled.
12543
12544 max-average-unrolled-insns
12545 The maximum number of instructions biased by probabilities of
12546 their execution that a loop may have to be unrolled. If a loop
12547 is unrolled, this parameter also determines how many times the
12548 loop code is unrolled.
12549
12550 max-unroll-times
12551 The maximum number of unrollings of a single loop.
12552
12553 max-peeled-insns
12554 The maximum number of instructions that a loop may have to be
12555 peeled. If a loop is peeled, this parameter also determines
12556 how many times the loop code is peeled.
12557
12558 max-peel-times
12559 The maximum number of peelings of a single loop.
12560
12561 max-peel-branches
12562 The maximum number of branches on the hot path through the
12563 peeled sequence.
12564
12565 max-completely-peeled-insns
12566 The maximum number of insns of a completely peeled loop.
12567
12568 max-completely-peel-times
12569 The maximum number of iterations of a loop to be suitable for
12570 complete peeling.
12571
12572 max-completely-peel-loop-nest-depth
12573 The maximum depth of a loop nest suitable for complete peeling.
12574
12575 max-unswitch-insns
12576 The maximum number of insns of an unswitched loop.
12577
12578 max-unswitch-depth
12579 The maximum depth of a loop nest to be unswitched.
12580
12581 lim-expensive
12582 The minimum cost of an expensive expression in the loop
12583 invariant motion.
12584
12585 min-loop-cond-split-prob
12586 When FDO profile information is available, min-loop-cond-split-
12587 prob specifies minimum threshold for probability of semi-
12588 invariant condition statement to trigger loop split.
12589
12590 iv-consider-all-candidates-bound
12591 Bound on number of candidates for induction variables, below
12592 which all candidates are considered for each use in induction
12593 variable optimizations. If there are more candidates than
12594 this, only the most relevant ones are considered to avoid
12595 quadratic time complexity.
12596
12597 iv-max-considered-uses
12598 The induction variable optimizations give up on loops that
12599 contain more induction variable uses.
12600
12601 iv-always-prune-cand-set-bound
12602 If the number of candidates in the set is smaller than this
12603 value, always try to remove unnecessary ivs from the set when
12604 adding a new one.
12605
12606 avg-loop-niter
12607 Average number of iterations of a loop.
12608
12609 dse-max-object-size
12610 Maximum size (in bytes) of objects tracked bytewise by dead
12611 store elimination. Larger values may result in larger
12612 compilation times.
12613
12614 dse-max-alias-queries-per-store
12615 Maximum number of queries into the alias oracle per store.
12616 Larger values result in larger compilation times and may result
12617 in more removed dead stores.
12618
12619 scev-max-expr-size
12620 Bound on size of expressions used in the scalar evolutions
12621 analyzer. Large expressions slow the analyzer.
12622
12623 scev-max-expr-complexity
12624 Bound on the complexity of the expressions in the scalar
12625 evolutions analyzer. Complex expressions slow the analyzer.
12626
12627 max-tree-if-conversion-phi-args
12628 Maximum number of arguments in a PHI supported by TREE if
12629 conversion unless the loop is marked with simd pragma.
12630
12631 vect-max-layout-candidates
12632 The maximum number of possible vector layouts (such as
12633 permutations) to consider when optimizing to-be-vectorized
12634 code.
12635
12636 vect-max-version-for-alignment-checks
12637 The maximum number of run-time checks that can be performed
12638 when doing loop versioning for alignment in the vectorizer.
12639
12640 vect-max-version-for-alias-checks
12641 The maximum number of run-time checks that can be performed
12642 when doing loop versioning for alias in the vectorizer.
12643
12644 vect-max-peeling-for-alignment
12645 The maximum number of loop peels to enhance access alignment
12646 for vectorizer. Value -1 means no limit.
12647
12648 max-iterations-to-track
12649 The maximum number of iterations of a loop the brute-force
12650 algorithm for analysis of the number of iterations of the loop
12651 tries to evaluate.
12652
12653 hot-bb-count-fraction
12654 The denominator n of fraction 1/n of the maximal execution
12655 count of a basic block in the entire program that a basic block
12656 needs to at least have in order to be considered hot. The
12657 default is 10000, which means that a basic block is considered
12658 hot if its execution count is greater than 1/10000 of the
12659 maximal execution count. 0 means that it is never considered
12660 hot. Used in non-LTO mode.
12661
12662 hot-bb-count-ws-permille
12663 The number of most executed permilles, ranging from 0 to 1000,
12664 of the profiled execution of the entire program to which the
12665 execution count of a basic block must be part of in order to be
12666 considered hot. The default is 990, which means that a basic
12667 block is considered hot if its execution count contributes to
12668 the upper 990 permilles, or 99.0%, of the profiled execution of
12669 the entire program. 0 means that it is never considered hot.
12670 Used in LTO mode.
12671
12672 hot-bb-frequency-fraction
12673 The denominator n of fraction 1/n of the execution frequency of
12674 the entry block of a function that a basic block of this
12675 function needs to at least have in order to be considered hot.
12676 The default is 1000, which means that a basic block is
12677 considered hot in a function if it is executed more frequently
12678 than 1/1000 of the frequency of the entry block of the
12679 function. 0 means that it is never considered hot.
12680
12681 unlikely-bb-count-fraction
12682 The denominator n of fraction 1/n of the number of profiled
12683 runs of the entire program below which the execution count of a
12684 basic block must be in order for the basic block to be
12685 considered unlikely executed. The default is 20, which means
12686 that a basic block is considered unlikely executed if it is
12687 executed in fewer than 1/20, or 5%, of the runs of the program.
12688 0 means that it is always considered unlikely executed.
12689
12690 max-predicted-iterations
12691 The maximum number of loop iterations we predict statically.
12692 This is useful in cases where a function contains a single loop
12693 with known bound and another loop with unknown bound. The
12694 known number of iterations is predicted correctly, while the
12695 unknown number of iterations average to roughly 10. This means
12696 that the loop without bounds appears artificially cold relative
12697 to the other one.
12698
12699 builtin-expect-probability
12700 Control the probability of the expression having the specified
12701 value. This parameter takes a percentage (i.e. 0 ... 100) as
12702 input.
12703
12704 builtin-string-cmp-inline-length
12705 The maximum length of a constant string for a builtin string
12706 cmp call eligible for inlining.
12707
12708 align-threshold
12709 Select fraction of the maximal frequency of executions of a
12710 basic block in a function to align the basic block.
12711
12712 align-loop-iterations
12713 A loop expected to iterate at least the selected number of
12714 iterations is aligned.
12715
12716 tracer-dynamic-coverage
12717 tracer-dynamic-coverage-feedback
12718 This value is used to limit superblock formation once the given
12719 percentage of executed instructions is covered. This limits
12720 unnecessary code size expansion.
12721
12722 The tracer-dynamic-coverage-feedback parameter is used only
12723 when profile feedback is available. The real profiles (as
12724 opposed to statically estimated ones) are much less balanced
12725 allowing the threshold to be larger value.
12726
12727 tracer-max-code-growth
12728 Stop tail duplication once code growth has reached given
12729 percentage. This is a rather artificial limit, as most of the
12730 duplicates are eliminated later in cross jumping, so it may be
12731 set to much higher values than is the desired code growth.
12732
12733 tracer-min-branch-ratio
12734 Stop reverse growth when the reverse probability of best edge
12735 is less than this threshold (in percent).
12736
12737 tracer-min-branch-probability
12738 tracer-min-branch-probability-feedback
12739 Stop forward growth if the best edge has probability lower than
12740 this threshold.
12741
12742 Similarly to tracer-dynamic-coverage two parameters are
12743 provided. tracer-min-branch-probability-feedback is used for
12744 compilation with profile feedback and tracer-min-branch-
12745 probability compilation without. The value for compilation
12746 with profile feedback needs to be more conservative (higher) in
12747 order to make tracer effective.
12748
12749 stack-clash-protection-guard-size
12750 Specify the size of the operating system provided stack guard
12751 as 2 raised to num bytes. Higher values may reduce the number
12752 of explicit probes, but a value larger than the operating
12753 system provided guard will leave code vulnerable to stack clash
12754 style attacks.
12755
12756 stack-clash-protection-probe-interval
12757 Stack clash protection involves probing stack space as it is
12758 allocated. This param controls the maximum distance between
12759 probes into the stack as 2 raised to num bytes. Higher values
12760 may reduce the number of explicit probes, but a value larger
12761 than the operating system provided guard will leave code
12762 vulnerable to stack clash style attacks.
12763
12764 max-cse-path-length
12765 The maximum number of basic blocks on path that CSE considers.
12766
12767 max-cse-insns
12768 The maximum number of instructions CSE processes before
12769 flushing.
12770
12771 ggc-min-expand
12772 GCC uses a garbage collector to manage its own memory
12773 allocation. This parameter specifies the minimum percentage by
12774 which the garbage collector's heap should be allowed to expand
12775 between collections. Tuning this may improve compilation
12776 speed; it has no effect on code generation.
12777
12778 The default is 30% + 70% * (RAM/1GB) with an upper bound of
12779 100% when RAM >= 1GB. If "getrlimit" is available, the notion
12780 of "RAM" is the smallest of actual RAM and "RLIMIT_DATA" or
12781 "RLIMIT_AS". If GCC is not able to calculate RAM on a
12782 particular platform, the lower bound of 30% is used. Setting
12783 this parameter and ggc-min-heapsize to zero causes a full
12784 collection to occur at every opportunity. This is extremely
12785 slow, but can be useful for debugging.
12786
12787 ggc-min-heapsize
12788 Minimum size of the garbage collector's heap before it begins
12789 bothering to collect garbage. The first collection occurs
12790 after the heap expands by ggc-min-expand% beyond ggc-min-
12791 heapsize. Again, tuning this may improve compilation speed,
12792 and has no effect on code generation.
12793
12794 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit
12795 that tries to ensure that RLIMIT_DATA or RLIMIT_AS are not
12796 exceeded, but with a lower bound of 4096 (four megabytes) and
12797 an upper bound of 131072 (128 megabytes). If GCC is not able
12798 to calculate RAM on a particular platform, the lower bound is
12799 used. Setting this parameter very large effectively disables
12800 garbage collection. Setting this parameter and ggc-min-expand
12801 to zero causes a full collection to occur at every opportunity.
12802
12803 max-reload-search-insns
12804 The maximum number of instruction reload should look backward
12805 for equivalent register. Increasing values mean more
12806 aggressive optimization, making the compilation time increase
12807 with probably slightly better performance.
12808
12809 max-cselib-memory-locations
12810 The maximum number of memory locations cselib should take into
12811 account. Increasing values mean more aggressive optimization,
12812 making the compilation time increase with probably slightly
12813 better performance.
12814
12815 max-sched-ready-insns
12816 The maximum number of instructions ready to be issued the
12817 scheduler should consider at any given time during the first
12818 scheduling pass. Increasing values mean more thorough
12819 searches, making the compilation time increase with probably
12820 little benefit.
12821
12822 max-sched-region-blocks
12823 The maximum number of blocks in a region to be considered for
12824 interblock scheduling.
12825
12826 max-pipeline-region-blocks
12827 The maximum number of blocks in a region to be considered for
12828 pipelining in the selective scheduler.
12829
12830 max-sched-region-insns
12831 The maximum number of insns in a region to be considered for
12832 interblock scheduling.
12833
12834 max-pipeline-region-insns
12835 The maximum number of insns in a region to be considered for
12836 pipelining in the selective scheduler.
12837
12838 min-spec-prob
12839 The minimum probability (in percents) of reaching a source
12840 block for interblock speculative scheduling.
12841
12842 max-sched-extend-regions-iters
12843 The maximum number of iterations through CFG to extend regions.
12844 A value of 0 disables region extensions.
12845
12846 max-sched-insn-conflict-delay
12847 The maximum conflict delay for an insn to be considered for
12848 speculative motion.
12849
12850 sched-spec-prob-cutoff
12851 The minimal probability of speculation success (in percents),
12852 so that speculative insns are scheduled.
12853
12854 sched-state-edge-prob-cutoff
12855 The minimum probability an edge must have for the scheduler to
12856 save its state across it.
12857
12858 sched-mem-true-dep-cost
12859 Minimal distance (in CPU cycles) between store and load
12860 targeting same memory locations.
12861
12862 selsched-max-lookahead
12863 The maximum size of the lookahead window of selective
12864 scheduling. It is a depth of search for available
12865 instructions.
12866
12867 selsched-max-sched-times
12868 The maximum number of times that an instruction is scheduled
12869 during selective scheduling. This is the limit on the number
12870 of iterations through which the instruction may be pipelined.
12871
12872 selsched-insns-to-rename
12873 The maximum number of best instructions in the ready list that
12874 are considered for renaming in the selective scheduler.
12875
12876 sms-min-sc
12877 The minimum value of stage count that swing modulo scheduler
12878 generates.
12879
12880 max-last-value-rtl
12881 The maximum size measured as number of RTLs that can be
12882 recorded in an expression in combiner for a pseudo register as
12883 last known value of that register.
12884
12885 max-combine-insns
12886 The maximum number of instructions the RTL combiner tries to
12887 combine.
12888
12889 integer-share-limit
12890 Small integer constants can use a shared data structure,
12891 reducing the compiler's memory usage and increasing its speed.
12892 This sets the maximum value of a shared integer constant.
12893
12894 ssp-buffer-size
12895 The minimum size of buffers (i.e. arrays) that receive stack
12896 smashing protection when -fstack-protector is used.
12897
12898 min-size-for-stack-sharing
12899 The minimum size of variables taking part in stack slot sharing
12900 when not optimizing.
12901
12902 max-jump-thread-duplication-stmts
12903 Maximum number of statements allowed in a block that needs to
12904 be duplicated when threading jumps.
12905
12906 max-jump-thread-paths
12907 The maximum number of paths to consider when searching for jump
12908 threading opportunities. When arriving at a block, incoming
12909 edges are only considered if the number of paths to be searched
12910 so far multiplied by the number of incoming edges does not
12911 exhaust the specified maximum number of paths to consider.
12912
12913 max-fields-for-field-sensitive
12914 Maximum number of fields in a structure treated in a field
12915 sensitive manner during pointer analysis.
12916
12917 prefetch-latency
12918 Estimate on average number of instructions that are executed
12919 before prefetch finishes. The distance prefetched ahead is
12920 proportional to this constant. Increasing this number may also
12921 lead to less streams being prefetched (see simultaneous-
12922 prefetches).
12923
12924 simultaneous-prefetches
12925 Maximum number of prefetches that can run at the same time.
12926
12927 l1-cache-line-size
12928 The size of cache line in L1 data cache, in bytes.
12929
12930 l1-cache-size
12931 The size of L1 data cache, in kilobytes.
12932
12933 l2-cache-size
12934 The size of L2 data cache, in kilobytes.
12935
12936 prefetch-dynamic-strides
12937 Whether the loop array prefetch pass should issue software
12938 prefetch hints for strides that are non-constant. In some
12939 cases this may be beneficial, though the fact the stride is
12940 non-constant may make it hard to predict when there is clear
12941 benefit to issuing these hints.
12942
12943 Set to 1 if the prefetch hints should be issued for non-
12944 constant strides. Set to 0 if prefetch hints should be issued
12945 only for strides that are known to be constant and below
12946 prefetch-minimum-stride.
12947
12948 prefetch-minimum-stride
12949 Minimum constant stride, in bytes, to start using prefetch
12950 hints for. If the stride is less than this threshold, prefetch
12951 hints will not be issued.
12952
12953 This setting is useful for processors that have hardware
12954 prefetchers, in which case there may be conflicts between the
12955 hardware prefetchers and the software prefetchers. If the
12956 hardware prefetchers have a maximum stride they can handle, it
12957 should be used here to improve the use of software prefetchers.
12958
12959 A value of -1 means we don't have a threshold and therefore
12960 prefetch hints can be issued for any constant stride.
12961
12962 This setting is only useful for strides that are known and
12963 constant.
12964
12965 destructive-interference-size
12966 constructive-interference-size
12967 The values for the C++17 variables
12968 "std::hardware_destructive_interference_size" and
12969 "std::hardware_constructive_interference_size". The
12970 destructive interference size is the minimum recommended offset
12971 between two independent concurrently-accessed objects; the
12972 constructive interference size is the maximum recommended size
12973 of contiguous memory accessed together. Typically both will be
12974 the size of an L1 cache line for the target, in bytes. For a
12975 generic target covering a range of L1 cache line sizes,
12976 typically the constructive interference size will be the small
12977 end of the range and the destructive size will be the large
12978 end.
12979
12980 The destructive interference size is intended to be used for
12981 layout, and thus has ABI impact. The default value is not
12982 expected to be stable, and on some targets varies with -mtune,
12983 so use of this variable in a context where ABI stability is
12984 important, such as the public interface of a library, is
12985 strongly discouraged; if it is used in that context, users can
12986 stabilize the value using this option.
12987
12988 The constructive interference size is less sensitive, as it is
12989 typically only used in a static_assert to make sure that a type
12990 fits within a cache line.
12991
12992 See also -Winterference-size.
12993
12994 loop-interchange-max-num-stmts
12995 The maximum number of stmts in a loop to be interchanged.
12996
12997 loop-interchange-stride-ratio
12998 The minimum ratio between stride of two loops for interchange
12999 to be profitable.
13000
13001 min-insn-to-prefetch-ratio
13002 The minimum ratio between the number of instructions and the
13003 number of prefetches to enable prefetching in a loop.
13004
13005 prefetch-min-insn-to-mem-ratio
13006 The minimum ratio between the number of instructions and the
13007 number of memory references to enable prefetching in a loop.
13008
13009 use-canonical-types
13010 Whether the compiler should use the "canonical" type system.
13011 Should always be 1, which uses a more efficient internal
13012 mechanism for comparing types in C++ and Objective-C++.
13013 However, if bugs in the canonical type system are causing
13014 compilation failures, set this value to 0 to disable canonical
13015 types.
13016
13017 switch-conversion-max-branch-ratio
13018 Switch initialization conversion refuses to create arrays that
13019 are bigger than switch-conversion-max-branch-ratio times the
13020 number of branches in the switch.
13021
13022 max-partial-antic-length
13023 Maximum length of the partial antic set computed during the
13024 tree partial redundancy elimination optimization (-ftree-pre)
13025 when optimizing at -O3 and above. For some sorts of source
13026 code the enhanced partial redundancy elimination optimization
13027 can run away, consuming all of the memory available on the host
13028 machine. This parameter sets a limit on the length of the sets
13029 that are computed, which prevents the runaway behavior.
13030 Setting a value of 0 for this parameter allows an unlimited set
13031 length.
13032
13033 rpo-vn-max-loop-depth
13034 Maximum loop depth that is value-numbered optimistically. When
13035 the limit hits the innermost rpo-vn-max-loop-depth loops and
13036 the outermost loop in the loop nest are value-numbered
13037 optimistically and the remaining ones not.
13038
13039 sccvn-max-alias-queries-per-access
13040 Maximum number of alias-oracle queries we perform when looking
13041 for redundancies for loads and stores. If this limit is hit
13042 the search is aborted and the load or store is not considered
13043 redundant. The number of queries is algorithmically limited to
13044 the number of stores on all paths from the load to the function
13045 entry.
13046
13047 ira-max-loops-num
13048 IRA uses regional register allocation by default. If a
13049 function contains more loops than the number given by this
13050 parameter, only at most the given number of the most
13051 frequently-executed loops form regions for regional register
13052 allocation.
13053
13054 ira-max-conflict-table-size
13055 Although IRA uses a sophisticated algorithm to compress the
13056 conflict table, the table can still require excessive amounts
13057 of memory for huge functions. If the conflict table for a
13058 function could be more than the size in MB given by this
13059 parameter, the register allocator instead uses a faster,
13060 simpler, and lower-quality algorithm that does not require
13061 building a pseudo-register conflict table.
13062
13063 ira-loop-reserved-regs
13064 IRA can be used to evaluate more accurate register pressure in
13065 loops for decisions to move loop invariants (see -O3). The
13066 number of available registers reserved for some other purposes
13067 is given by this parameter. Default of the parameter is the
13068 best found from numerous experiments.
13069
13070 ira-consider-dup-in-all-alts
13071 Make IRA to consider matching constraint (duplicated operand
13072 number) heavily in all available alternatives for preferred
13073 register class. If it is set as zero, it means IRA only
13074 respects the matching constraint when it's in the only
13075 available alternative with an appropriate register class.
13076 Otherwise, it means IRA will check all available alternatives
13077 for preferred register class even if it has found some choice
13078 with an appropriate register class and respect the found
13079 qualified matching constraint.
13080
13081 ira-simple-lra-insn-threshold
13082 Approximate function insn number in 1K units triggering simple
13083 local RA.
13084
13085 lra-inheritance-ebb-probability-cutoff
13086 LRA tries to reuse values reloaded in registers in subsequent
13087 insns. This optimization is called inheritance. EBB is used
13088 as a region to do this optimization. The parameter defines a
13089 minimal fall-through edge probability in percentage used to add
13090 BB to inheritance EBB in LRA. The default value was chosen
13091 from numerous runs of SPEC2000 on x86-64.
13092
13093 loop-invariant-max-bbs-in-loop
13094 Loop invariant motion can be very expensive, both in
13095 compilation time and in amount of needed compile-time memory,
13096 with very large loops. Loops with more basic blocks than this
13097 parameter won't have loop invariant motion optimization
13098 performed on them.
13099
13100 loop-max-datarefs-for-datadeps
13101 Building data dependencies is expensive for very large loops.
13102 This parameter limits the number of data references in loops
13103 that are considered for data dependence analysis. These large
13104 loops are no handled by the optimizations using loop data
13105 dependencies.
13106
13107 max-vartrack-size
13108 Sets a maximum number of hash table slots to use during
13109 variable tracking dataflow analysis of any function. If this
13110 limit is exceeded with variable tracking at assignments
13111 enabled, analysis for that function is retried without it,
13112 after removing all debug insns from the function. If the limit
13113 is exceeded even without debug insns, var tracking analysis is
13114 completely disabled for the function. Setting the parameter to
13115 zero makes it unlimited.
13116
13117 max-vartrack-expr-depth
13118 Sets a maximum number of recursion levels when attempting to
13119 map variable names or debug temporaries to value expressions.
13120 This trades compilation time for more complete debug
13121 information. If this is set too low, value expressions that
13122 are available and could be represented in debug information may
13123 end up not being used; setting this higher may enable the
13124 compiler to find more complex debug expressions, but compile
13125 time and memory use may grow.
13126
13127 max-debug-marker-count
13128 Sets a threshold on the number of debug markers (e.g. begin
13129 stmt markers) to avoid complexity explosion at inlining or
13130 expanding to RTL. If a function has more such gimple stmts
13131 than the set limit, such stmts will be dropped from the inlined
13132 copy of a function, and from its RTL expansion.
13133
13134 min-nondebug-insn-uid
13135 Use uids starting at this parameter for nondebug insns. The
13136 range below the parameter is reserved exclusively for debug
13137 insns created by -fvar-tracking-assignments, but debug insns
13138 may get (non-overlapping) uids above it if the reserved range
13139 is exhausted.
13140
13141 ipa-sra-deref-prob-threshold
13142 IPA-SRA replaces a pointer which is known not be NULL with one
13143 or more new parameters only when the probability (in percent,
13144 relative to function entry) of it being dereferenced is higher
13145 than this parameter.
13146
13147 ipa-sra-ptr-growth-factor
13148 IPA-SRA replaces a pointer to an aggregate with one or more new
13149 parameters only when their cumulative size is less or equal to
13150 ipa-sra-ptr-growth-factor times the size of the original
13151 pointer parameter.
13152
13153 ipa-sra-ptrwrap-growth-factor
13154 Additional maximum allowed growth of total size of new
13155 parameters that ipa-sra replaces a pointer to an aggregate
13156 with, if it points to a local variable that the caller only
13157 writes to and passes it as an argument to other functions.
13158
13159 ipa-sra-max-replacements
13160 Maximum pieces of an aggregate that IPA-SRA tracks. As a
13161 consequence, it is also the maximum number of replacements of a
13162 formal parameter.
13163
13164 sra-max-scalarization-size-Ospeed
13165 sra-max-scalarization-size-Osize
13166 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA)
13167 aim to replace scalar parts of aggregates with uses of
13168 independent scalar variables. These parameters control the
13169 maximum size, in storage units, of aggregate which is
13170 considered for replacement when compiling for speed (sra-max-
13171 scalarization-size-Ospeed) or size (sra-max-scalarization-size-
13172 Osize) respectively.
13173
13174 sra-max-propagations
13175 The maximum number of artificial accesses that Scalar
13176 Replacement of Aggregates (SRA) will track, per one local
13177 variable, in order to facilitate copy propagation.
13178
13179 tm-max-aggregate-size
13180 When making copies of thread-local variables in a transaction,
13181 this parameter specifies the size in bytes after which
13182 variables are saved with the logging functions as opposed to
13183 save/restore code sequence pairs. This option only applies
13184 when using -fgnu-tm.
13185
13186 graphite-max-nb-scop-params
13187 To avoid exponential effects in the Graphite loop transforms,
13188 the number of parameters in a Static Control Part (SCoP) is
13189 bounded. A value of zero can be used to lift the bound. A
13190 variable whose value is unknown at compilation time and defined
13191 outside a SCoP is a parameter of the SCoP.
13192
13193 loop-block-tile-size
13194 Loop blocking or strip mining transforms, enabled with
13195 -floop-block or -floop-strip-mine, strip mine each loop in the
13196 loop nest by a given number of iterations. The strip length
13197 can be changed using the loop-block-tile-size parameter.
13198
13199 ipa-jump-function-lookups
13200 Specifies number of statements visited during jump function
13201 offset discovery.
13202
13203 ipa-cp-value-list-size
13204 IPA-CP attempts to track all possible values and types passed
13205 to a function's parameter in order to propagate them and
13206 perform devirtualization. ipa-cp-value-list-size is the
13207 maximum number of values and types it stores per one formal
13208 parameter of a function.
13209
13210 ipa-cp-eval-threshold
13211 IPA-CP calculates its own score of cloning profitability
13212 heuristics and performs those cloning opportunities with scores
13213 that exceed ipa-cp-eval-threshold.
13214
13215 ipa-cp-max-recursive-depth
13216 Maximum depth of recursive cloning for self-recursive function.
13217
13218 ipa-cp-min-recursive-probability
13219 Recursive cloning only when the probability of call being
13220 executed exceeds the parameter.
13221
13222 ipa-cp-profile-count-base
13223 When using -fprofile-use option, IPA-CP will consider the
13224 measured execution count of a call graph edge at this
13225 percentage position in their histogram as the basis for its
13226 heuristics calculation.
13227
13228 ipa-cp-recursive-freq-factor
13229 The number of times interprocedural copy propagation expects
13230 recursive functions to call themselves.
13231
13232 ipa-cp-recursion-penalty
13233 Percentage penalty the recursive functions will receive when
13234 they are evaluated for cloning.
13235
13236 ipa-cp-single-call-penalty
13237 Percentage penalty functions containing a single call to
13238 another function will receive when they are evaluated for
13239 cloning.
13240
13241 ipa-max-agg-items
13242 IPA-CP is also capable to propagate a number of scalar values
13243 passed in an aggregate. ipa-max-agg-items controls the maximum
13244 number of such values per one parameter.
13245
13246 ipa-cp-loop-hint-bonus
13247 When IPA-CP determines that a cloning candidate would make the
13248 number of iterations of a loop known, it adds a bonus of ipa-
13249 cp-loop-hint-bonus to the profitability score of the candidate.
13250
13251 ipa-max-loop-predicates
13252 The maximum number of different predicates IPA will use to
13253 describe when loops in a function have known properties.
13254
13255 ipa-max-aa-steps
13256 During its analysis of function bodies, IPA-CP employs alias
13257 analysis in order to track values pointed to by function
13258 parameters. In order not spend too much time analyzing huge
13259 functions, it gives up and consider all memory clobbered after
13260 examining ipa-max-aa-steps statements modifying memory.
13261
13262 ipa-max-switch-predicate-bounds
13263 Maximal number of boundary endpoints of case ranges of switch
13264 statement. For switch exceeding this limit, IPA-CP will not
13265 construct cloning cost predicate, which is used to estimate
13266 cloning benefit, for default case of the switch statement.
13267
13268 ipa-max-param-expr-ops
13269 IPA-CP will analyze conditional statement that references some
13270 function parameter to estimate benefit for cloning upon certain
13271 constant value. But if number of operations in a parameter
13272 expression exceeds ipa-max-param-expr-ops, the expression is
13273 treated as complicated one, and is not handled by IPA analysis.
13274
13275 lto-partitions
13276 Specify desired number of partitions produced during WHOPR
13277 compilation. The number of partitions should exceed the number
13278 of CPUs used for compilation.
13279
13280 lto-min-partition
13281 Size of minimal partition for WHOPR (in estimated
13282 instructions). This prevents expenses of splitting very small
13283 programs into too many partitions.
13284
13285 lto-max-partition
13286 Size of max partition for WHOPR (in estimated instructions).
13287 to provide an upper bound for individual size of partition.
13288 Meant to be used only with balanced partitioning.
13289
13290 lto-max-streaming-parallelism
13291 Maximal number of parallel processes used for LTO streaming.
13292
13293 cxx-max-namespaces-for-diagnostic-help
13294 The maximum number of namespaces to consult for suggestions
13295 when C++ name lookup fails for an identifier.
13296
13297 sink-frequency-threshold
13298 The maximum relative execution frequency (in percents) of the
13299 target block relative to a statement's original block to allow
13300 statement sinking of a statement. Larger numbers result in
13301 more aggressive statement sinking. A small positive adjustment
13302 is applied for statements with memory operands as those are
13303 even more profitable so sink.
13304
13305 max-stores-to-sink
13306 The maximum number of conditional store pairs that can be sunk.
13307 Set to 0 if either vectorization (-ftree-vectorize) or if-
13308 conversion (-ftree-loop-if-convert) is disabled.
13309
13310 case-values-threshold
13311 The smallest number of different values for which it is best to
13312 use a jump-table instead of a tree of conditional branches. If
13313 the value is 0, use the default for the machine.
13314
13315 jump-table-max-growth-ratio-for-size
13316 The maximum code size growth ratio when expanding into a jump
13317 table (in percent). The parameter is used when optimizing for
13318 size.
13319
13320 jump-table-max-growth-ratio-for-speed
13321 The maximum code size growth ratio when expanding into a jump
13322 table (in percent). The parameter is used when optimizing for
13323 speed.
13324
13325 tree-reassoc-width
13326 Set the maximum number of instructions executed in parallel in
13327 reassociated tree. This parameter overrides target dependent
13328 heuristics used by default if has non zero value.
13329
13330 sched-pressure-algorithm
13331 Choose between the two available implementations of
13332 -fsched-pressure. Algorithm 1 is the original implementation
13333 and is the more likely to prevent instructions from being
13334 reordered. Algorithm 2 was designed to be a compromise between
13335 the relatively conservative approach taken by algorithm 1 and
13336 the rather aggressive approach taken by the default scheduler.
13337 It relies more heavily on having a regular register file and
13338 accurate register pressure classes. See haifa-sched.cc in the
13339 GCC sources for more details.
13340
13341 The default choice depends on the target.
13342
13343 max-slsr-cand-scan
13344 Set the maximum number of existing candidates that are
13345 considered when seeking a basis for a new straight-line
13346 strength reduction candidate.
13347
13348 asan-globals
13349 Enable buffer overflow detection for global objects. This kind
13350 of protection is enabled by default if you are using
13351 -fsanitize=address option. To disable global objects
13352 protection use --param asan-globals=0.
13353
13354 asan-stack
13355 Enable buffer overflow detection for stack objects. This kind
13356 of protection is enabled by default when using
13357 -fsanitize=address. To disable stack protection use --param
13358 asan-stack=0 option.
13359
13360 asan-instrument-reads
13361 Enable buffer overflow detection for memory reads. This kind
13362 of protection is enabled by default when using
13363 -fsanitize=address. To disable memory reads protection use
13364 --param asan-instrument-reads=0.
13365
13366 asan-instrument-writes
13367 Enable buffer overflow detection for memory writes. This kind
13368 of protection is enabled by default when using
13369 -fsanitize=address. To disable memory writes protection use
13370 --param asan-instrument-writes=0 option.
13371
13372 asan-memintrin
13373 Enable detection for built-in functions. This kind of
13374 protection is enabled by default when using -fsanitize=address.
13375 To disable built-in functions protection use --param
13376 asan-memintrin=0.
13377
13378 asan-use-after-return
13379 Enable detection of use-after-return. This kind of protection
13380 is enabled by default when using the -fsanitize=address option.
13381 To disable it use --param asan-use-after-return=0.
13382
13383 Note: By default the check is disabled at run time. To enable
13384 it, add "detect_stack_use_after_return=1" to the environment
13385 variable ASAN_OPTIONS.
13386
13387 asan-instrumentation-with-call-threshold
13388 If number of memory accesses in function being instrumented is
13389 greater or equal to this number, use callbacks instead of
13390 inline checks. E.g. to disable inline code use --param
13391 asan-instrumentation-with-call-threshold=0.
13392
13393 asan-kernel-mem-intrinsic-prefix
13394 If nonzero, prefix calls to "memcpy", "memset" and "memmove"
13395 with __asan_ or __hwasan_ for -fsanitize=kernel-address or
13396 -fsanitize=kernel-hwaddress, respectively.
13397
13398 hwasan-instrument-stack
13399 Enable hwasan instrumentation of statically sized stack-
13400 allocated variables. This kind of instrumentation is enabled
13401 by default when using -fsanitize=hwaddress and disabled by
13402 default when using -fsanitize=kernel-hwaddress. To disable
13403 stack instrumentation use --param hwasan-instrument-stack=0,
13404 and to enable it use --param hwasan-instrument-stack=1.
13405
13406 hwasan-random-frame-tag
13407 When using stack instrumentation, decide tags for stack
13408 variables using a deterministic sequence beginning at a random
13409 tag for each frame. With this parameter unset tags are chosen
13410 using the same sequence but beginning from 1. This is enabled
13411 by default for -fsanitize=hwaddress and unavailable for
13412 -fsanitize=kernel-hwaddress. To disable it use --param
13413 hwasan-random-frame-tag=0.
13414
13415 hwasan-instrument-allocas
13416 Enable hwasan instrumentation of dynamically sized stack-
13417 allocated variables. This kind of instrumentation is enabled
13418 by default when using -fsanitize=hwaddress and disabled by
13419 default when using -fsanitize=kernel-hwaddress. To disable
13420 instrumentation of such variables use --param
13421 hwasan-instrument-allocas=0, and to enable it use --param
13422 hwasan-instrument-allocas=1.
13423
13424 hwasan-instrument-reads
13425 Enable hwasan checks on memory reads. Instrumentation of reads
13426 is enabled by default for both -fsanitize=hwaddress and
13427 -fsanitize=kernel-hwaddress. To disable checking memory reads
13428 use --param hwasan-instrument-reads=0.
13429
13430 hwasan-instrument-writes
13431 Enable hwasan checks on memory writes. Instrumentation of
13432 writes is enabled by default for both -fsanitize=hwaddress and
13433 -fsanitize=kernel-hwaddress. To disable checking memory writes
13434 use --param hwasan-instrument-writes=0.
13435
13436 hwasan-instrument-mem-intrinsics
13437 Enable hwasan instrumentation of builtin functions.
13438 Instrumentation of these builtin functions is enabled by
13439 default for both -fsanitize=hwaddress and
13440 -fsanitize=kernel-hwaddress. To disable instrumentation of
13441 builtin functions use --param
13442 hwasan-instrument-mem-intrinsics=0.
13443
13444 use-after-scope-direct-emission-threshold
13445 If the size of a local variable in bytes is smaller or equal to
13446 this number, directly poison (or unpoison) shadow memory
13447 instead of using run-time callbacks.
13448
13449 tsan-distinguish-volatile
13450 Emit special instrumentation for accesses to volatiles.
13451
13452 tsan-instrument-func-entry-exit
13453 Emit instrumentation calls to __tsan_func_entry() and
13454 __tsan_func_exit().
13455
13456 max-fsm-thread-path-insns
13457 Maximum number of instructions to copy when duplicating blocks
13458 on a finite state automaton jump thread path.
13459
13460 threader-debug
13461 threader-debug=[none|all] Enables verbose dumping of the
13462 threader solver.
13463
13464 parloops-chunk-size
13465 Chunk size of omp schedule for loops parallelized by parloops.
13466
13467 parloops-schedule
13468 Schedule type of omp schedule for loops parallelized by
13469 parloops (static, dynamic, guided, auto, runtime).
13470
13471 parloops-min-per-thread
13472 The minimum number of iterations per thread of an innermost
13473 parallelized loop for which the parallelized variant is
13474 preferred over the single threaded one. Note that for a
13475 parallelized loop nest the minimum number of iterations of the
13476 outermost loop per thread is two.
13477
13478 max-ssa-name-query-depth
13479 Maximum depth of recursion when querying properties of SSA
13480 names in things like fold routines. One level of recursion
13481 corresponds to following a use-def chain.
13482
13483 max-speculative-devirt-maydefs
13484 The maximum number of may-defs we analyze when looking for a
13485 must-def specifying the dynamic type of an object that invokes
13486 a virtual call we may be able to devirtualize speculatively.
13487
13488 evrp-sparse-threshold
13489 Maximum number of basic blocks before EVRP uses a sparse cache.
13490
13491 ranger-debug
13492 Specifies the type of debug output to be issued for ranges.
13493
13494 evrp-switch-limit
13495 Specifies the maximum number of switch cases before EVRP
13496 ignores a switch.
13497
13498 unroll-jam-min-percent
13499 The minimum percentage of memory references that must be
13500 optimized away for the unroll-and-jam transformation to be
13501 considered profitable.
13502
13503 unroll-jam-max-unroll
13504 The maximum number of times the outer loop should be unrolled
13505 by the unroll-and-jam transformation.
13506
13507 max-rtl-if-conversion-unpredictable-cost
13508 Maximum permissible cost for the sequence that would be
13509 generated by the RTL if-conversion pass for a branch that is
13510 considered unpredictable.
13511
13512 max-variable-expansions-in-unroller
13513 If -fvariable-expansion-in-unroller is used, the maximum number
13514 of times that an individual variable will be expanded during
13515 loop unrolling.
13516
13517 partial-inlining-entry-probability
13518 Maximum probability of the entry BB of split region (in percent
13519 relative to entry BB of the function) to make partial inlining
13520 happen.
13521
13522 max-tracked-strlens
13523 Maximum number of strings for which strlen optimization pass
13524 will track string lengths.
13525
13526 gcse-after-reload-partial-fraction
13527 The threshold ratio for performing partial redundancy
13528 elimination after reload.
13529
13530 gcse-after-reload-critical-fraction
13531 The threshold ratio of critical edges execution count that
13532 permit performing redundancy elimination after reload.
13533
13534 max-loop-header-insns
13535 The maximum number of insns in loop header duplicated by the
13536 copy loop headers pass.
13537
13538 vect-epilogues-nomask
13539 Enable loop epilogue vectorization using smaller vector size.
13540
13541 vect-partial-vector-usage
13542 Controls when the loop vectorizer considers using partial
13543 vector loads and stores as an alternative to falling back to
13544 scalar code. 0 stops the vectorizer from ever using partial
13545 vector loads and stores. 1 allows partial vector loads and
13546 stores if vectorization removes the need for the code to
13547 iterate. 2 allows partial vector loads and stores in all
13548 loops. The parameter only has an effect on targets that
13549 support partial vector loads and stores.
13550
13551 vect-inner-loop-cost-factor
13552 The maximum factor which the loop vectorizer applies to the
13553 cost of statements in an inner loop relative to the loop being
13554 vectorized. The factor applied is the maximum of the estimated
13555 number of iterations of the inner loop and this parameter. The
13556 default value of this parameter is 50.
13557
13558 vect-induction-float
13559 Enable loop vectorization of floating point inductions.
13560
13561 avoid-fma-max-bits
13562 Maximum number of bits for which we avoid creating FMAs.
13563
13564 sms-loop-average-count-threshold
13565 A threshold on the average loop count considered by the swing
13566 modulo scheduler.
13567
13568 sms-dfa-history
13569 The number of cycles the swing modulo scheduler considers when
13570 checking conflicts using DFA.
13571
13572 graphite-allow-codegen-errors
13573 Whether codegen errors should be ICEs when -fchecking.
13574
13575 sms-max-ii-factor
13576 A factor for tuning the upper bound that swing modulo scheduler
13577 uses for scheduling a loop.
13578
13579 lra-max-considered-reload-pseudos
13580 The max number of reload pseudos which are considered during
13581 spilling a non-reload pseudo.
13582
13583 max-pow-sqrt-depth
13584 Maximum depth of sqrt chains to use when synthesizing
13585 exponentiation by a real constant.
13586
13587 max-dse-active-local-stores
13588 Maximum number of active local stores in RTL dead store
13589 elimination.
13590
13591 asan-instrument-allocas
13592 Enable asan allocas/VLAs protection.
13593
13594 max-iterations-computation-cost
13595 Bound on the cost of an expression to compute the number of
13596 iterations.
13597
13598 max-isl-operations
13599 Maximum number of isl operations, 0 means unlimited.
13600
13601 graphite-max-arrays-per-scop
13602 Maximum number of arrays per scop.
13603
13604 max-vartrack-reverse-op-size
13605 Max. size of loc list for which reverse ops should be added.
13606
13607 fsm-scale-path-stmts
13608 Scale factor to apply to the number of statements in a
13609 threading path crossing a loop backedge when comparing to
13610 --param=max-jump-thread-duplication-stmts.
13611
13612 uninit-control-dep-attempts
13613 Maximum number of nested calls to search for control
13614 dependencies during uninitialized variable analysis.
13615
13616 sched-autopref-queue-depth
13617 Hardware autoprefetcher scheduler model control flag. Number
13618 of lookahead cycles the model looks into; at ' ' only enable
13619 instruction sorting heuristic.
13620
13621 loop-versioning-max-inner-insns
13622 The maximum number of instructions that an inner loop can have
13623 before the loop versioning pass considers it too big to copy.
13624
13625 loop-versioning-max-outer-insns
13626 The maximum number of instructions that an outer loop can have
13627 before the loop versioning pass considers it too big to copy,
13628 discounting any instructions in inner loops that directly
13629 benefit from versioning.
13630
13631 ssa-name-def-chain-limit
13632 The maximum number of SSA_NAME assignments to follow in
13633 determining a property of a variable such as its value. This
13634 limits the number of iterations or recursive calls GCC performs
13635 when optimizing certain statements or when determining their
13636 validity prior to issuing diagnostics.
13637
13638 store-merging-max-size
13639 Maximum size of a single store merging region in bytes.
13640
13641 hash-table-verification-limit
13642 The number of elements for which hash table verification is
13643 done for each searched element.
13644
13645 max-find-base-term-values
13646 Maximum number of VALUEs handled during a single find_base_term
13647 call.
13648
13649 analyzer-max-enodes-per-program-point
13650 The maximum number of exploded nodes per program point within
13651 the analyzer, before terminating analysis of that point.
13652
13653 analyzer-max-constraints
13654 The maximum number of constraints per state.
13655
13656 analyzer-min-snodes-for-call-summary
13657 The minimum number of supernodes within a function for the
13658 analyzer to consider summarizing its effects at call sites.
13659
13660 analyzer-max-enodes-for-full-dump
13661 The maximum depth of exploded nodes that should appear in a dot
13662 dump before switching to a less verbose format.
13663
13664 analyzer-max-recursion-depth
13665 The maximum number of times a callsite can appear in a call
13666 stack within the analyzer, before terminating analysis of a
13667 call that would recurse deeper.
13668
13669 analyzer-max-svalue-depth
13670 The maximum depth of a symbolic value, before approximating the
13671 value as unknown.
13672
13673 analyzer-max-infeasible-edges
13674 The maximum number of infeasible edges to reject before
13675 declaring a diagnostic as infeasible.
13676
13677 gimple-fe-computed-hot-bb-threshold
13678 The number of executions of a basic block which is considered
13679 hot. The parameter is used only in GIMPLE FE.
13680
13681 analyzer-bb-explosion-factor
13682 The maximum number of 'after supernode' exploded nodes within
13683 the analyzer per supernode, before terminating analysis.
13684
13685 ranger-logical-depth
13686 Maximum depth of logical expression evaluation ranger will look
13687 through when evaluating outgoing edge ranges.
13688
13689 ranger-recompute-depth
13690 Maximum depth of instruction chains to consider for
13691 recomputation in the outgoing range calculator.
13692
13693 relation-block-limit
13694 Maximum number of relations the oracle will register in a basic
13695 block.
13696
13697 min-pagesize
13698 Minimum page size for warning purposes.
13699
13700 openacc-kernels
13701 Specify mode of OpenACC `kernels' constructs handling. With
13702 --param=openacc-kernels=decompose, OpenACC `kernels' constructs
13703 are decomposed into parts, a sequence of compute constructs,
13704 each then handled individually. This is work in progress.
13705 With --param=openacc-kernels=parloops, OpenACC `kernels'
13706 constructs are handled by the parloops pass, en bloc. This is
13707 the current default.
13708
13709 openacc-privatization
13710 Control whether the -fopt-info-omp-note and applicable
13711 -fdump-tree-*-details options emit OpenACC privatization
13712 diagnostics. With --param=openacc-privatization=quiet, don't
13713 diagnose. This is the current default. With
13714 --param=openacc-privatization=noisy, do diagnose.
13715
13716 The following choices of name are available on AArch64 targets:
13717
13718 aarch64-sve-compare-costs
13719 When vectorizing for SVE, consider using "unpacked" vectors for
13720 smaller elements and use the cost model to pick the cheapest
13721 approach. Also use the cost model to choose between SVE and
13722 Advanced SIMD vectorization.
13723
13724 Using unpacked vectors includes storing smaller elements in
13725 larger containers and accessing elements with extending loads
13726 and truncating stores.
13727
13728 aarch64-float-recp-precision
13729 The number of Newton iterations for calculating the reciprocal
13730 for float type. The precision of division is proportional to
13731 this param when division approximation is enabled. The default
13732 value is 1.
13733
13734 aarch64-double-recp-precision
13735 The number of Newton iterations for calculating the reciprocal
13736 for double type. The precision of division is propotional to
13737 this param when division approximation is enabled. The default
13738 value is 2.
13739
13740 aarch64-autovec-preference
13741 Force an ISA selection strategy for auto-vectorization.
13742 Accepts values from 0 to 4, inclusive.
13743
13744 0 Use the default heuristics.
13745
13746 1 Use only Advanced SIMD for auto-vectorization.
13747
13748 2 Use only SVE for auto-vectorization.
13749
13750 3 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when
13751 the costs are deemed equal.
13752
13753 4 Use both Advanced SIMD and SVE. Prefer SVE when the costs
13754 are deemed equal.
13755
13756 The default value is 0.
13757
13758 aarch64-loop-vect-issue-rate-niters
13759 The tuning for some AArch64 CPUs tries to take both latencies
13760 and issue rates into account when deciding whether a loop
13761 should be vectorized using SVE, vectorized using Advanced SIMD,
13762 or not vectorized at all. If this parameter is set to n, GCC
13763 will not use this heuristic for loops that are known to execute
13764 in fewer than n Advanced SIMD iterations.
13765
13766 aarch64-vect-unroll-limit
13767 The vectorizer will use available tuning information to
13768 determine whether it would be beneficial to unroll the main
13769 vectorized loop and by how much. This parameter set's the
13770 upper bound of how much the vectorizer will unroll the main
13771 loop. The default value is four.
13772
13773 The following choices of name are available on i386 and x86_64
13774 targets:
13775
13776 x86-stlf-window-ninsns
13777 Instructions number above which STFL stall penalty can be
13778 compensated.
13779
13780 x86-stv-max-visits
13781 The maximum number of use and def visits when discovering a STV
13782 chain before the discovery is aborted.
13783
13784 Program Instrumentation Options
13785 GCC supports a number of command-line options that control adding run-
13786 time instrumentation to the code it normally generates. For example,
13787 one purpose of instrumentation is collect profiling statistics for use
13788 in finding program hot spots, code coverage analysis, or profile-guided
13789 optimizations. Another class of program instrumentation is adding run-
13790 time checking to detect programming errors like invalid pointer
13791 dereferences or out-of-bounds array accesses, as well as deliberately
13792 hostile attacks such as stack smashing or C++ vtable hijacking. There
13793 is also a general hook which can be used to implement other forms of
13794 tracing or function-level instrumentation for debug or program analysis
13795 purposes.
13796
13797 -p
13798 -pg Generate extra code to write profile information suitable for the
13799 analysis program prof (for -p) or gprof (for -pg). You must use
13800 this option when compiling the source files you want data about,
13801 and you must also use it when linking.
13802
13803 You can use the function attribute "no_instrument_function" to
13804 suppress profiling of individual functions when compiling with
13805 these options.
13806
13807 -fprofile-arcs
13808 Add code so that program flow arcs are instrumented. During
13809 execution the program records how many times each branch and call
13810 is executed and how many times it is taken or returns. On targets
13811 that support constructors with priority support, profiling properly
13812 handles constructors, destructors and C++ constructors (and
13813 destructors) of classes which are used as a type of a global
13814 variable.
13815
13816 When the compiled program exits it saves this data to a file called
13817 auxname.gcda for each source file. The data may be used for
13818 profile-directed optimizations (-fbranch-probabilities), or for
13819 test coverage analysis (-ftest-coverage). Each object file's
13820 auxname is generated from the name of the output file, if
13821 explicitly specified and it is not the final executable, otherwise
13822 it is the basename of the source file. In both cases any suffix is
13823 removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda
13824 for output file specified as -o dir/foo.o).
13825
13826 Note that if a command line directly links source files, the
13827 corresponding .gcda files will be prefixed with the unsuffixed name
13828 of the output file. E.g. "gcc a.c b.c -o binary" would generate
13829 binary-a.gcda and binary-b.gcda files.
13830
13831 --coverage
13832 This option is used to compile and link code instrumented for
13833 coverage analysis. The option is a synonym for -fprofile-arcs
13834 -ftest-coverage (when compiling) and -lgcov (when linking). See
13835 the documentation for those options for more details.
13836
13837 * Compile the source files with -fprofile-arcs plus optimization
13838 and code generation options. For test coverage analysis, use
13839 the additional -ftest-coverage option. You do not need to
13840 profile every source file in a program.
13841
13842 * Compile the source files additionally with -fprofile-abs-path
13843 to create absolute path names in the .gcno files. This allows
13844 gcov to find the correct sources in projects where compilations
13845 occur with different working directories.
13846
13847 * Link your object files with -lgcov or -fprofile-arcs (the
13848 latter implies the former).
13849
13850 * Run the program on a representative workload to generate the
13851 arc profile information. This may be repeated any number of
13852 times. You can run concurrent instances of your program, and
13853 provided that the file system supports locking, the data files
13854 will be correctly updated. Unless a strict ISO C dialect
13855 option is in effect, "fork" calls are detected and correctly
13856 handled without double counting.
13857
13858 Moreover, an object file can be recompiled multiple times and
13859 the corresponding .gcda file merges as long as the source file
13860 and the compiler options are unchanged.
13861
13862 * For profile-directed optimizations, compile the source files
13863 again with the same optimization and code generation options
13864 plus -fbranch-probabilities.
13865
13866 * For test coverage analysis, use gcov to produce human readable
13867 information from the .gcno and .gcda files. Refer to the gcov
13868 documentation for further information.
13869
13870 With -fprofile-arcs, for each function of your program GCC creates
13871 a program flow graph, then finds a spanning tree for the graph.
13872 Only arcs that are not on the spanning tree have to be
13873 instrumented: the compiler adds code to count the number of times
13874 that these arcs are executed. When an arc is the only exit or only
13875 entrance to a block, the instrumentation code can be added to the
13876 block; otherwise, a new basic block must be created to hold the
13877 instrumentation code.
13878
13879 -ftest-coverage
13880 Produce a notes file that the gcov code-coverage utility can use to
13881 show program coverage. Each source file's note file is called
13882 auxname.gcno. Refer to the -fprofile-arcs option above for a
13883 description of auxname and instructions on how to generate test
13884 coverage data. Coverage data matches the source files more closely
13885 if you do not optimize.
13886
13887 -fprofile-abs-path
13888 Automatically convert relative source file names to absolute path
13889 names in the .gcno files. This allows gcov to find the correct
13890 sources in projects where compilations occur with different working
13891 directories.
13892
13893 -fprofile-dir=path
13894 Set the directory to search for the profile data files in to path.
13895 This option affects only the profile data generated by
13896 -fprofile-generate, -ftest-coverage, -fprofile-arcs and used by
13897 -fprofile-use and -fbranch-probabilities and its related options.
13898 Both absolute and relative paths can be used. By default, GCC uses
13899 the current directory as path, thus the profile data file appears
13900 in the same directory as the object file. In order to prevent the
13901 file name clashing, if the object file name is not an absolute
13902 path, we mangle the absolute path of the sourcename.gcda file and
13903 use it as the file name of a .gcda file. See details about the
13904 file naming in -fprofile-arcs. See similar option -fprofile-note.
13905
13906 When an executable is run in a massive parallel environment, it is
13907 recommended to save profile to different folders. That can be done
13908 with variables in path that are exported during run-time:
13909
13910 %p process ID.
13911
13912 %q{VAR}
13913 value of environment variable VAR
13914
13915 -fprofile-generate
13916 -fprofile-generate=path
13917 Enable options usually used for instrumenting application to
13918 produce profile useful for later recompilation with profile
13919 feedback based optimization. You must use -fprofile-generate both
13920 when compiling and when linking your program.
13921
13922 The following options are enabled: -fprofile-arcs,
13923 -fprofile-values, -finline-functions, and -fipa-bit-cp.
13924
13925 If path is specified, GCC looks at the path to find the profile
13926 feedback data files. See -fprofile-dir.
13927
13928 To optimize the program based on the collected profile information,
13929 use -fprofile-use.
13930
13931 -fprofile-info-section
13932 -fprofile-info-section=name
13933 Register the profile information in the specified section instead
13934 of using a constructor/destructor. The section name is name if it
13935 is specified, otherwise the section name defaults to ".gcov_info".
13936 A pointer to the profile information generated by -fprofile-arcs is
13937 placed in the specified section for each translation unit. This
13938 option disables the profile information registration through a
13939 constructor and it disables the profile information processing
13940 through a destructor. This option is not intended to be used in
13941 hosted environments such as GNU/Linux. It targets freestanding
13942 environments (for example embedded systems) with limited resources
13943 which do not support constructors/destructors or the C library file
13944 I/O.
13945
13946 The linker could collect the input sections in a continuous memory
13947 block and define start and end symbols. A GNU linker script
13948 example which defines a linker output section follows:
13949
13950 .gcov_info :
13951 {
13952 PROVIDE (__gcov_info_start = .);
13953 KEEP (*(.gcov_info))
13954 PROVIDE (__gcov_info_end = .);
13955 }
13956
13957 The program could dump the profiling information registered in this
13958 linker set for example like this:
13959
13960 #include <gcov.h>
13961 #include <stdio.h>
13962 #include <stdlib.h>
13963
13964 extern const struct gcov_info *const __gcov_info_start[];
13965 extern const struct gcov_info *const __gcov_info_end[];
13966
13967 static void
13968 dump (const void *d, unsigned n, void *arg)
13969 {
13970 const unsigned char *c = d;
13971
13972 for (unsigned i = 0; i < n; ++i)
13973 printf ("%02x", c[i]);
13974 }
13975
13976 static void
13977 filename (const char *f, void *arg)
13978 {
13979 __gcov_filename_to_gcfn (f, dump, arg );
13980 }
13981
13982 static void *
13983 allocate (unsigned length, void *arg)
13984 {
13985 return malloc (length);
13986 }
13987
13988 static void
13989 dump_gcov_info (void)
13990 {
13991 const struct gcov_info *const *info = __gcov_info_start;
13992 const struct gcov_info *const *end = __gcov_info_end;
13993
13994 /* Obfuscate variable to prevent compiler optimizations. */
13995 __asm__ ("" : "+r" (info));
13996
13997 while (info != end)
13998 {
13999 void *arg = NULL;
14000 __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
14001 putchar ('\n');
14002 ++info;
14003 }
14004 }
14005
14006 int
14007 main (void)
14008 {
14009 dump_gcov_info ();
14010 return 0;
14011 }
14012
14013 The merge-stream subcommand of gcov-tool may be used to deserialize
14014 the data stream generated by the "__gcov_filename_to_gcfn" and
14015 "__gcov_info_to_gcda" functions and merge the profile information
14016 into .gcda files on the host filesystem.
14017
14018 -fprofile-note=path
14019 If path is specified, GCC saves .gcno file into path location. If
14020 you combine the option with multiple source files, the .gcno file
14021 will be overwritten.
14022
14023 -fprofile-prefix-path=path
14024 This option can be used in combination with
14025 profile-generate=profile_dir and profile-use=profile_dir to inform
14026 GCC where is the base directory of built source tree. By default
14027 profile_dir will contain files with mangled absolute paths of all
14028 object files in the built project. This is not desirable when
14029 directory used to build the instrumented binary differs from the
14030 directory used to build the binary optimized with profile feedback
14031 because the profile data will not be found during the optimized
14032 build. In such setups -fprofile-prefix-path=path with path
14033 pointing to the base directory of the build can be used to strip
14034 the irrelevant part of the path and keep all file names relative to
14035 the main build directory.
14036
14037 -fprofile-prefix-map=old=new
14038 When compiling files residing in directory old, record profiling
14039 information (with --coverage) describing them as if the files
14040 resided in directory new instead. See also -ffile-prefix-map and
14041 -fcanon-prefix-map.
14042
14043 -fprofile-update=method
14044 Alter the update method for an application instrumented for profile
14045 feedback based optimization. The method argument should be one of
14046 single, atomic or prefer-atomic. The first one is useful for
14047 single-threaded applications, while the second one prevents profile
14048 corruption by emitting thread-safe code.
14049
14050 Warning: When an application does not properly join all threads (or
14051 creates an detached thread), a profile file can be still corrupted.
14052
14053 Using prefer-atomic would be transformed either to atomic, when
14054 supported by a target, or to single otherwise. The GCC driver
14055 automatically selects prefer-atomic when -pthread is present in the
14056 command line.
14057
14058 -fprofile-filter-files=regex
14059 Instrument only functions from files whose name matches any of the
14060 regular expressions (separated by semi-colons).
14061
14062 For example, -fprofile-filter-files=main\.c;module.*\.c will
14063 instrument only main.c and all C files starting with 'module'.
14064
14065 -fprofile-exclude-files=regex
14066 Instrument only functions from files whose name does not match any
14067 of the regular expressions (separated by semi-colons).
14068
14069 For example, -fprofile-exclude-files=/usr/.* will prevent
14070 instrumentation of all files that are located in the /usr/ folder.
14071
14072 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
14073 Control level of reproducibility of profile gathered by
14074 "-fprofile-generate". This makes it possible to rebuild program
14075 with same outcome which is useful, for example, for distribution
14076 packages.
14077
14078 With -fprofile-reproducible=serial the profile gathered by
14079 -fprofile-generate is reproducible provided the trained program
14080 behaves the same at each invocation of the train run, it is not
14081 multi-threaded and profile data streaming is always done in the
14082 same order. Note that profile streaming happens at the end of
14083 program run but also before "fork" function is invoked.
14084
14085 Note that it is quite common that execution counts of some part of
14086 programs depends, for example, on length of temporary file names or
14087 memory space randomization (that may affect hash-table collision
14088 rate). Such non-reproducible part of programs may be annotated by
14089 "no_instrument_function" function attribute. gcov-dump with -l can
14090 be used to dump gathered data and verify that they are indeed
14091 reproducible.
14092
14093 With -fprofile-reproducible=parallel-runs collected profile stays
14094 reproducible regardless the order of streaming of the data into
14095 gcda files. This setting makes it possible to run multiple
14096 instances of instrumented program in parallel (such as with "make
14097 -j"). This reduces quality of gathered data, in particular of
14098 indirect call profiling.
14099
14100 -fsanitize=address
14101 Enable AddressSanitizer, a fast memory error detector. Memory
14102 access instructions are instrumented to detect out-of-bounds and
14103 use-after-free bugs. The option enables
14104 -fsanitize-address-use-after-scope. See
14105 <https://github.com/google/sanitizers/wiki/AddressSanitizer> for
14106 more details. The run-time behavior can be influenced using the
14107 ASAN_OPTIONS environment variable. When set to "help=1", the
14108 available options are shown at startup of the instrumented program.
14109 See
14110 <https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags>
14111 for a list of supported options. The option cannot be combined
14112 with -fsanitize=thread or -fsanitize=hwaddress. Note that the only
14113 target -fsanitize=hwaddress is currently supported on is AArch64.
14114
14115 To get more accurate stack traces, it is possible to use options
14116 such as -O0, -O1, or -Og (which, for instance, prevent most
14117 function inlining), -fno-optimize-sibling-calls (which prevents
14118 optimizing sibling and tail recursive calls; this option is
14119 implicit for -O0, -O1, or -Og), or -fno-ipa-icf (which disables
14120 Identical Code Folding for functions). Since multiple runs of the
14121 program may yield backtraces with different addresses due to ASLR
14122 (Address Space Layout Randomization), it may be desirable to turn
14123 ASLR off. On Linux, this can be achieved with setarch `uname -m`
14124 -R ./prog.
14125
14126 -fsanitize=kernel-address
14127 Enable AddressSanitizer for Linux kernel. See
14128 <https://github.com/google/kernel-sanitizers> for more details.
14129
14130 -fsanitize=hwaddress
14131 Enable Hardware-assisted AddressSanitizer, which uses a hardware
14132 ability to ignore the top byte of a pointer to allow the detection
14133 of memory errors with a low memory overhead. Memory access
14134 instructions are instrumented to detect out-of-bounds and use-
14135 after-free bugs. The option enables
14136 -fsanitize-address-use-after-scope. See
14137 <https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html>
14138 for more details. The run-time behavior can be influenced using
14139 the HWASAN_OPTIONS environment variable. When set to "help=1", the
14140 available options are shown at startup of the instrumented program.
14141 The option cannot be combined with -fsanitize=thread or
14142 -fsanitize=address, and is currently only available on AArch64.
14143
14144 -fsanitize=kernel-hwaddress
14145 Enable Hardware-assisted AddressSanitizer for compilation of the
14146 Linux kernel. Similar to -fsanitize=kernel-address but using an
14147 alternate instrumentation method, and similar to
14148 -fsanitize=hwaddress but with instrumentation differences necessary
14149 for compiling the Linux kernel. These differences are to avoid
14150 hwasan library initialization calls and to account for the stack
14151 pointer having a different value in its top byte.
14152
14153 Note: This option has different defaults to the
14154 -fsanitize=hwaddress. Instrumenting the stack and alloca calls are
14155 not on by default but are still possible by specifying the command-
14156 line options --param hwasan-instrument-stack=1 and --param
14157 hwasan-instrument-allocas=1 respectively. Using a random frame tag
14158 is not implemented for kernel instrumentation.
14159
14160 -fsanitize=pointer-compare
14161 Instrument comparison operation (<, <=, >, >=) with pointer
14162 operands. The option must be combined with either
14163 -fsanitize=kernel-address or -fsanitize=address The option cannot
14164 be combined with -fsanitize=thread. Note: By default the check is
14165 disabled at run time. To enable it, add
14166 "detect_invalid_pointer_pairs=2" to the environment variable
14167 ASAN_OPTIONS. Using "detect_invalid_pointer_pairs=1" detects
14168 invalid operation only when both pointers are non-null.
14169
14170 -fsanitize=pointer-subtract
14171 Instrument subtraction with pointer operands. The option must be
14172 combined with either -fsanitize=kernel-address or
14173 -fsanitize=address The option cannot be combined with
14174 -fsanitize=thread. Note: By default the check is disabled at run
14175 time. To enable it, add "detect_invalid_pointer_pairs=2" to the
14176 environment variable ASAN_OPTIONS. Using
14177 "detect_invalid_pointer_pairs=1" detects invalid operation only
14178 when both pointers are non-null.
14179
14180 -fsanitize=shadow-call-stack
14181 Enable ShadowCallStack, a security enhancement mechanism used to
14182 protect programs against return address overwrites (e.g. stack
14183 buffer overflows.) It works by saving a function's return address
14184 to a separately allocated shadow call stack in the function
14185 prologue and restoring the return address from the shadow call
14186 stack in the function epilogue. Instrumentation only occurs in
14187 functions that need to save the return address to the stack.
14188
14189 Currently it only supports the aarch64 platform. It is
14190 specifically designed for linux kernels that enable the
14191 CONFIG_SHADOW_CALL_STACK option. For the user space programs,
14192 runtime support is not currently provided in libc and libgcc.
14193 Users who want to use this feature in user space need to provide
14194 their own support for the runtime. It should be noted that this
14195 may cause the ABI rules to be broken.
14196
14197 On aarch64, the instrumentation makes use of the platform register
14198 "x18". This generally means that any code that may run on the same
14199 thread as code compiled with ShadowCallStack must be compiled with
14200 the flag -ffixed-x18, otherwise functions compiled without
14201 -ffixed-x18 might clobber "x18" and so corrupt the shadow stack
14202 pointer.
14203
14204 Also, because there is no userspace runtime support, code compiled
14205 with ShadowCallStack cannot use exception handling. Use
14206 -fno-exceptions to turn off exceptions.
14207
14208 See <https://clang.llvm.org/docs/ShadowCallStack.html> for more
14209 details.
14210
14211 -fsanitize=thread
14212 Enable ThreadSanitizer, a fast data race detector. Memory access
14213 instructions are instrumented to detect data race bugs. See
14214 <https://github.com/google/sanitizers/wiki#threadsanitizer> for
14215 more details. The run-time behavior can be influenced using the
14216 TSAN_OPTIONS environment variable; see
14217 <https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags>
14218 for a list of supported options. The option cannot be combined
14219 with -fsanitize=address, -fsanitize=leak.
14220
14221 Note that sanitized atomic builtins cannot throw exceptions when
14222 operating on invalid memory addresses with non-call exceptions
14223 (-fnon-call-exceptions).
14224
14225 -fsanitize=leak
14226 Enable LeakSanitizer, a memory leak detector. This option only
14227 matters for linking of executables. The executable is linked
14228 against a library that overrides "malloc" and other allocator
14229 functions. See
14230 <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
14231 for more details. The run-time behavior can be influenced using
14232 the LSAN_OPTIONS environment variable. The option cannot be
14233 combined with -fsanitize=thread.
14234
14235 -fsanitize=undefined
14236 Enable UndefinedBehaviorSanitizer, a fast undefined behavior
14237 detector. Various computations are instrumented to detect
14238 undefined behavior at runtime. See
14239 <https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html> for
14240 more details. The run-time behavior can be influenced using the
14241 UBSAN_OPTIONS environment variable. Current suboptions are:
14242
14243 -fsanitize=shift
14244 This option enables checking that the result of a shift
14245 operation is not undefined. Note that what exactly is
14246 considered undefined differs slightly between C and C++, as
14247 well as between ISO C90 and C99, etc. This option has two
14248 suboptions, -fsanitize=shift-base and
14249 -fsanitize=shift-exponent.
14250
14251 -fsanitize=shift-exponent
14252 This option enables checking that the second argument of a
14253 shift operation is not negative and is smaller than the
14254 precision of the promoted first argument.
14255
14256 -fsanitize=shift-base
14257 If the second argument of a shift operation is within range,
14258 check that the result of a shift operation is not undefined.
14259 Note that what exactly is considered undefined differs slightly
14260 between C and C++, as well as between ISO C90 and C99, etc.
14261
14262 -fsanitize=integer-divide-by-zero
14263 Detect integer division by zero.
14264
14265 -fsanitize=unreachable
14266 With this option, the compiler turns the
14267 "__builtin_unreachable" call into a diagnostics message call
14268 instead. When reaching the "__builtin_unreachable" call, the
14269 behavior is undefined.
14270
14271 -fsanitize=vla-bound
14272 This option instructs the compiler to check that the size of a
14273 variable length array is positive.
14274
14275 -fsanitize=null
14276 This option enables pointer checking. Particularly, the
14277 application built with this option turned on will issue an
14278 error message when it tries to dereference a NULL pointer, or
14279 if a reference (possibly an rvalue reference) is bound to a
14280 NULL pointer, or if a method is invoked on an object pointed by
14281 a NULL pointer.
14282
14283 -fsanitize=return
14284 This option enables return statement checking. Programs built
14285 with this option turned on will issue an error message when the
14286 end of a non-void function is reached without actually
14287 returning a value. This option works in C++ only.
14288
14289 -fsanitize=signed-integer-overflow
14290 This option enables signed integer overflow checking. We check
14291 that the result of "+", "*", and both unary and binary "-" does
14292 not overflow in the signed arithmetics. This also detects
14293 "INT_MIN / -1" signed division. Note, integer promotion rules
14294 must be taken into account. That is, the following is not an
14295 overflow:
14296
14297 signed char a = SCHAR_MAX;
14298 a++;
14299
14300 -fsanitize=bounds
14301 This option enables instrumentation of array bounds. Various
14302 out of bounds accesses are detected. Flexible array members,
14303 flexible array member-like arrays, and initializers of
14304 variables with static storage are not instrumented, with the
14305 exception of flexible array member-like arrays for which
14306 "-fstrict-flex-arrays" or "-fstrict-flex-arrays=" options or
14307 "strict_flex_array" attributes say they shouldn't be treated
14308 like flexible array member-like arrays.
14309
14310 -fsanitize=bounds-strict
14311 This option enables strict instrumentation of array bounds.
14312 Most out of bounds accesses are detected, including flexible
14313 array member-like arrays. Initializers of variables with
14314 static storage are not instrumented.
14315
14316 -fsanitize=alignment
14317 This option enables checking of alignment of pointers when they
14318 are dereferenced, or when a reference is bound to
14319 insufficiently aligned target, or when a method or constructor
14320 is invoked on insufficiently aligned object.
14321
14322 -fsanitize=object-size
14323 This option enables instrumentation of memory references using
14324 the "__builtin_dynamic_object_size" function. Various out of
14325 bounds pointer accesses are detected.
14326
14327 -fsanitize=float-divide-by-zero
14328 Detect floating-point division by zero. Unlike other similar
14329 options, -fsanitize=float-divide-by-zero is not enabled by
14330 -fsanitize=undefined, since floating-point division by zero can
14331 be a legitimate way of obtaining infinities and NaNs.
14332
14333 -fsanitize=float-cast-overflow
14334 This option enables floating-point type to integer conversion
14335 checking. We check that the result of the conversion does not
14336 overflow. Unlike other similar options,
14337 -fsanitize=float-cast-overflow is not enabled by
14338 -fsanitize=undefined. This option does not work well with
14339 "FE_INVALID" exceptions enabled.
14340
14341 -fsanitize=nonnull-attribute
14342 This option enables instrumentation of calls, checking whether
14343 null values are not passed to arguments marked as requiring a
14344 non-null value by the "nonnull" function attribute.
14345
14346 -fsanitize=returns-nonnull-attribute
14347 This option enables instrumentation of return statements in
14348 functions marked with "returns_nonnull" function attribute, to
14349 detect returning of null values from such functions.
14350
14351 -fsanitize=bool
14352 This option enables instrumentation of loads from bool. If a
14353 value other than 0/1 is loaded, a run-time error is issued.
14354
14355 -fsanitize=enum
14356 This option enables instrumentation of loads from an enum type.
14357 If a value outside the range of values for the enum type is
14358 loaded, a run-time error is issued.
14359
14360 -fsanitize=vptr
14361 This option enables instrumentation of C++ member function
14362 calls, member accesses and some conversions between pointers to
14363 base and derived classes, to verify the referenced object has
14364 the correct dynamic type.
14365
14366 -fsanitize=pointer-overflow
14367 This option enables instrumentation of pointer arithmetics. If
14368 the pointer arithmetics overflows, a run-time error is issued.
14369
14370 -fsanitize=builtin
14371 This option enables instrumentation of arguments to selected
14372 builtin functions. If an invalid value is passed to such
14373 arguments, a run-time error is issued. E.g. passing 0 as the
14374 argument to "__builtin_ctz" or "__builtin_clz" invokes
14375 undefined behavior and is diagnosed by this option.
14376
14377 Note that sanitizers tend to increase the rate of false positive
14378 warnings, most notably those around -Wmaybe-uninitialized. We
14379 recommend against combining -Werror and [the use of] sanitizers.
14380
14381 While -ftrapv causes traps for signed overflows to be emitted,
14382 -fsanitize=undefined gives a diagnostic message. This currently
14383 works only for the C family of languages.
14384
14385 -fno-sanitize=all
14386 This option disables all previously enabled sanitizers.
14387 -fsanitize=all is not allowed, as some sanitizers cannot be used
14388 together.
14389
14390 -fasan-shadow-offset=number
14391 This option forces GCC to use custom shadow offset in
14392 AddressSanitizer checks. It is useful for experimenting with
14393 different shadow memory layouts in Kernel AddressSanitizer.
14394
14395 -fsanitize-sections=s1,s2,...
14396 Sanitize global variables in selected user-defined sections. si
14397 may contain wildcards.
14398
14399 -fsanitize-recover[=opts]
14400 -fsanitize-recover= controls error recovery mode for sanitizers
14401 mentioned in comma-separated list of opts. Enabling this option
14402 for a sanitizer component causes it to attempt to continue running
14403 the program as if no error happened. This means multiple runtime
14404 errors can be reported in a single program run, and the exit code
14405 of the program may indicate success even when errors have been
14406 reported. The -fno-sanitize-recover= option can be used to alter
14407 this behavior: only the first detected error is reported and
14408 program then exits with a non-zero exit code.
14409
14410 Currently this feature only works for -fsanitize=undefined (and its
14411 suboptions except for -fsanitize=unreachable and
14412 -fsanitize=return), -fsanitize=float-cast-overflow,
14413 -fsanitize=float-divide-by-zero, -fsanitize=bounds-strict,
14414 -fsanitize=kernel-address and -fsanitize=address. For these
14415 sanitizers error recovery is turned on by default, except
14416 -fsanitize=address, for which this feature is experimental.
14417 -fsanitize-recover=all and -fno-sanitize-recover=all is also
14418 accepted, the former enables recovery for all sanitizers that
14419 support it, the latter disables recovery for all sanitizers that
14420 support it.
14421
14422 Even if a recovery mode is turned on the compiler side, it needs to
14423 be also enabled on the runtime library side, otherwise the failures
14424 are still fatal. The runtime library defaults to "halt_on_error=0"
14425 for ThreadSanitizer and UndefinedBehaviorSanitizer, while default
14426 value for AddressSanitizer is "halt_on_error=1". This can be
14427 overridden through setting the "halt_on_error" flag in the
14428 corresponding environment variable.
14429
14430 Syntax without an explicit opts parameter is deprecated. It is
14431 equivalent to specifying an opts list of:
14432
14433 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
14434
14435 -fsanitize-address-use-after-scope
14436 Enable sanitization of local variables to detect use-after-scope
14437 bugs. The option sets -fstack-reuse to none.
14438
14439 -fsanitize-trap[=opts]
14440 The -fsanitize-trap= option instructs the compiler to report for
14441 sanitizers mentioned in comma-separated list of opts undefined
14442 behavior using "__builtin_trap" rather than a "libubsan" library
14443 routine. If this option is enabled for certain sanitizer, it takes
14444 precedence over the -fsanitizer-recover= for that sanitizer,
14445 "__builtin_trap" will be emitted and be fatal regardless of whether
14446 recovery is enabled or disabled using -fsanitize-recover=.
14447
14448 The advantage of this is that the "libubsan" library is not needed
14449 and is not linked in, so this is usable even in freestanding
14450 environments.
14451
14452 Currently this feature works with -fsanitize=undefined (and its
14453 suboptions except for -fsanitize=vptr),
14454 -fsanitize=float-cast-overflow, -fsanitize=float-divide-by-zero and
14455 -fsanitize=bounds-strict. "-fsanitize-trap=all" can be also
14456 specified, which enables it for "undefined" suboptions,
14457 -fsanitize=float-cast-overflow, -fsanitize=float-divide-by-zero and
14458 -fsanitize=bounds-strict. If "-fsanitize-trap=undefined" or
14459 "-fsanitize-trap=all" is used and "-fsanitize=vptr" is enabled on
14460 the command line, the instrumentation is silently ignored as the
14461 instrumentation always needs "libubsan" support,
14462 -fsanitize-trap=vptr is not allowed.
14463
14464 -fsanitize-undefined-trap-on-error
14465 The -fsanitize-undefined-trap-on-error option is deprecated
14466 equivalent of -fsanitize-trap=all.
14467
14468 -fsanitize-coverage=trace-pc
14469 Enable coverage-guided fuzzing code instrumentation. Inserts a
14470 call to "__sanitizer_cov_trace_pc" into every basic block.
14471
14472 -fsanitize-coverage=trace-cmp
14473 Enable dataflow guided fuzzing code instrumentation. Inserts a
14474 call to "__sanitizer_cov_trace_cmp1", "__sanitizer_cov_trace_cmp2",
14475 "__sanitizer_cov_trace_cmp4" or "__sanitizer_cov_trace_cmp8" for
14476 integral comparison with both operands variable or
14477 "__sanitizer_cov_trace_const_cmp1",
14478 "__sanitizer_cov_trace_const_cmp2",
14479 "__sanitizer_cov_trace_const_cmp4" or
14480 "__sanitizer_cov_trace_const_cmp8" for integral comparison with one
14481 operand constant, "__sanitizer_cov_trace_cmpf" or
14482 "__sanitizer_cov_trace_cmpd" for float or double comparisons and
14483 "__sanitizer_cov_trace_switch" for switch statements.
14484
14485 -fcf-protection=[full|branch|return|none|check]
14486 Enable code instrumentation of control-flow transfers to increase
14487 program security by checking that target addresses of control-flow
14488 transfer instructions (such as indirect function call, function
14489 return, indirect jump) are valid. This prevents diverting the flow
14490 of control to an unexpected target. This is intended to protect
14491 against such threats as Return-oriented Programming (ROP), and
14492 similarly call/jmp-oriented programming (COP/JOP).
14493
14494 The value "branch" tells the compiler to implement checking of
14495 validity of control-flow transfer at the point of indirect branch
14496 instructions, i.e. call/jmp instructions. The value "return"
14497 implements checking of validity at the point of returning from a
14498 function. The value "full" is an alias for specifying both
14499 "branch" and "return". The value "none" turns off instrumentation.
14500
14501 The value "check" is used for the final link with link-time
14502 optimization (LTO). An error is issued if LTO object files are
14503 compiled with different -fcf-protection values. The value "check"
14504 is ignored at the compile time.
14505
14506 The macro "__CET__" is defined when -fcf-protection is used. The
14507 first bit of "__CET__" is set to 1 for the value "branch" and the
14508 second bit of "__CET__" is set to 1 for the "return".
14509
14510 You can also use the "nocf_check" attribute to identify which
14511 functions and calls should be skipped from instrumentation.
14512
14513 Currently the x86 GNU/Linux target provides an implementation based
14514 on Intel Control-flow Enforcement Technology (CET) which works for
14515 i686 processor or newer.
14516
14517 -fharden-compares
14518 For every logical test that survives gimple optimizations and is
14519 not the condition in a conditional branch (for example, conditions
14520 tested for conditional moves, or to store in boolean variables),
14521 emit extra code to compute and verify the reversed condition, and
14522 to call "__builtin_trap" if the results do not match. Use with
14523 -fharden-conditional-branches to cover all conditionals.
14524
14525 -fharden-conditional-branches
14526 For every non-vectorized conditional branch that survives gimple
14527 optimizations, emit extra code to compute and verify the reversed
14528 condition, and to call "__builtin_trap" if the result is
14529 unexpected. Use with -fharden-compares to cover all conditionals.
14530
14531 -fstack-protector
14532 Emit extra code to check for buffer overflows, such as stack
14533 smashing attacks. This is done by adding a guard variable to
14534 functions with vulnerable objects. This includes functions that
14535 call "alloca", and functions with buffers larger than or equal to 8
14536 bytes. The guards are initialized when a function is entered and
14537 then checked when the function exits. If a guard check fails, an
14538 error message is printed and the program exits. Only variables
14539 that are actually allocated on the stack are considered, optimized
14540 away variables or variables allocated in registers don't count.
14541
14542 -fstack-protector-all
14543 Like -fstack-protector except that all functions are protected.
14544
14545 -fstack-protector-strong
14546 Like -fstack-protector but includes additional functions to be
14547 protected --- those that have local array definitions, or have
14548 references to local frame addresses. Only variables that are
14549 actually allocated on the stack are considered, optimized away
14550 variables or variables allocated in registers don't count.
14551
14552 -fstack-protector-explicit
14553 Like -fstack-protector but only protects those functions which have
14554 the "stack_protect" attribute.
14555
14556 -fstack-check
14557 Generate code to verify that you do not go beyond the boundary of
14558 the stack. You should specify this flag if you are running in an
14559 environment with multiple threads, but you only rarely need to
14560 specify it in a single-threaded environment since stack overflow is
14561 automatically detected on nearly all systems if there is only one
14562 stack.
14563
14564 Note that this switch does not actually cause checking to be done;
14565 the operating system or the language runtime must do that. The
14566 switch causes generation of code to ensure that they see the stack
14567 being extended.
14568
14569 You can additionally specify a string parameter: no means no
14570 checking, generic means force the use of old-style checking,
14571 specific means use the best checking method and is equivalent to
14572 bare -fstack-check.
14573
14574 Old-style checking is a generic mechanism that requires no specific
14575 target support in the compiler but comes with the following
14576 drawbacks:
14577
14578 1. Modified allocation strategy for large objects: they are always
14579 allocated dynamically if their size exceeds a fixed threshold.
14580 Note this may change the semantics of some code.
14581
14582 2. Fixed limit on the size of the static frame of functions: when
14583 it is topped by a particular function, stack checking is not
14584 reliable and a warning is issued by the compiler.
14585
14586 3. Inefficiency: because of both the modified allocation strategy
14587 and the generic implementation, code performance is hampered.
14588
14589 Note that old-style stack checking is also the fallback method for
14590 specific if no target support has been added in the compiler.
14591
14592 -fstack-check= is designed for Ada's needs to detect infinite
14593 recursion and stack overflows. specific is an excellent choice
14594 when compiling Ada code. It is not generally sufficient to protect
14595 against stack-clash attacks. To protect against those you want
14596 -fstack-clash-protection.
14597
14598 -fstack-clash-protection
14599 Generate code to prevent stack clash style attacks. When this
14600 option is enabled, the compiler will only allocate one page of
14601 stack space at a time and each page is accessed immediately after
14602 allocation. Thus, it prevents allocations from jumping over any
14603 stack guard page provided by the operating system.
14604
14605 Most targets do not fully support stack clash protection. However,
14606 on those targets -fstack-clash-protection will protect dynamic
14607 stack allocations. -fstack-clash-protection may also provide
14608 limited protection for static stack allocations if the target
14609 supports -fstack-check=specific.
14610
14611 -fstack-limit-register=reg
14612 -fstack-limit-symbol=sym
14613 -fno-stack-limit
14614 Generate code to ensure that the stack does not grow beyond a
14615 certain value, either the value of a register or the address of a
14616 symbol. If a larger stack is required, a signal is raised at run
14617 time. For most targets, the signal is raised before the stack
14618 overruns the boundary, so it is possible to catch the signal
14619 without taking special precautions.
14620
14621 For instance, if the stack starts at absolute address 0x80000000
14622 and grows downwards, you can use the flags
14623 -fstack-limit-symbol=__stack_limit and
14624 -Wl,--defsym,__stack_limit=0x7ffe0000 to enforce a stack limit of
14625 128KB. Note that this may only work with the GNU linker.
14626
14627 You can locally override stack limit checking by using the
14628 "no_stack_limit" function attribute.
14629
14630 -fsplit-stack
14631 Generate code to automatically split the stack before it overflows.
14632 The resulting program has a discontiguous stack which can only
14633 overflow if the program is unable to allocate any more memory.
14634 This is most useful when running threaded programs, as it is no
14635 longer necessary to calculate a good stack size to use for each
14636 thread. This is currently only implemented for the x86 targets
14637 running GNU/Linux.
14638
14639 When code compiled with -fsplit-stack calls code compiled without
14640 -fsplit-stack, there may not be much stack space available for the
14641 latter code to run. If compiling all code, including library code,
14642 with -fsplit-stack is not an option, then the linker can fix up
14643 these calls so that the code compiled without -fsplit-stack always
14644 has a large stack. Support for this is implemented in the gold
14645 linker in GNU binutils release 2.21 and later.
14646
14647 -fvtable-verify=[std|preinit|none]
14648 This option is only available when compiling C++ code. It turns on
14649 (or off, if using -fvtable-verify=none) the security feature that
14650 verifies at run time, for every virtual call, that the vtable
14651 pointer through which the call is made is valid for the type of the
14652 object, and has not been corrupted or overwritten. If an invalid
14653 vtable pointer is detected at run time, an error is reported and
14654 execution of the program is immediately halted.
14655
14656 This option causes run-time data structures to be built at program
14657 startup, which are used for verifying the vtable pointers. The
14658 options std and preinit control the timing of when these data
14659 structures are built. In both cases the data structures are built
14660 before execution reaches "main". Using -fvtable-verify=std causes
14661 the data structures to be built after shared libraries have been
14662 loaded and initialized. -fvtable-verify=preinit causes them to be
14663 built before shared libraries have been loaded and initialized.
14664
14665 If this option appears multiple times in the command line with
14666 different values specified, none takes highest priority over both
14667 std and preinit; preinit takes priority over std.
14668
14669 -fvtv-debug
14670 When used in conjunction with -fvtable-verify=std or
14671 -fvtable-verify=preinit, causes debug versions of the runtime
14672 functions for the vtable verification feature to be called. This
14673 flag also causes the compiler to log information about which vtable
14674 pointers it finds for each class. This information is written to a
14675 file named vtv_set_ptr_data.log in the directory named by the
14676 environment variable VTV_LOGS_DIR if that is defined or the current
14677 working directory otherwise.
14678
14679 Note: This feature appends data to the log file. If you want a
14680 fresh log file, be sure to delete any existing one.
14681
14682 -fvtv-counts
14683 This is a debugging flag. When used in conjunction with
14684 -fvtable-verify=std or -fvtable-verify=preinit, this causes the
14685 compiler to keep track of the total number of virtual calls it
14686 encounters and the number of verifications it inserts. It also
14687 counts the number of calls to certain run-time library functions
14688 that it inserts and logs this information for each compilation
14689 unit. The compiler writes this information to a file named
14690 vtv_count_data.log in the directory named by the environment
14691 variable VTV_LOGS_DIR if that is defined or the current working
14692 directory otherwise. It also counts the size of the vtable pointer
14693 sets for each class, and writes this information to
14694 vtv_class_set_sizes.log in the same directory.
14695
14696 Note: This feature appends data to the log files. To get fresh
14697 log files, be sure to delete any existing ones.
14698
14699 -finstrument-functions
14700 Generate instrumentation calls for entry and exit to functions.
14701 Just after function entry and just before function exit, the
14702 following profiling functions are called with the address of the
14703 current function and its call site. (On some platforms,
14704 "__builtin_return_address" does not work beyond the current
14705 function, so the call site information may not be available to the
14706 profiling functions otherwise.)
14707
14708 void __cyg_profile_func_enter (void *this_fn,
14709 void *call_site);
14710 void __cyg_profile_func_exit (void *this_fn,
14711 void *call_site);
14712
14713 The first argument is the address of the start of the current
14714 function, which may be looked up exactly in the symbol table.
14715
14716 This instrumentation is also done for functions expanded inline in
14717 other functions. The profiling calls indicate where, conceptually,
14718 the inline function is entered and exited. This means that
14719 addressable versions of such functions must be available. If all
14720 your uses of a function are expanded inline, this may mean an
14721 additional expansion of code size. If you use "extern inline" in
14722 your C code, an addressable version of such functions must be
14723 provided. (This is normally the case anyway, but if you get lucky
14724 and the optimizer always expands the functions inline, you might
14725 have gotten away without providing static copies.)
14726
14727 A function may be given the attribute "no_instrument_function", in
14728 which case this instrumentation is not done. This can be used, for
14729 example, for the profiling functions listed above, high-priority
14730 interrupt routines, and any functions from which the profiling
14731 functions cannot safely be called (perhaps signal handlers, if the
14732 profiling routines generate output or allocate memory).
14733
14734 -finstrument-functions-once
14735 This is similar to -finstrument-functions, but the profiling
14736 functions are called only once per instrumented function, i.e. the
14737 first profiling function is called after the first entry into the
14738 instrumented function and the second profiling function is called
14739 before the exit corresponding to this first entry.
14740
14741 The definition of "once" for the purpose of this option is a little
14742 vague because the implementation is not protected against data
14743 races. As a result, the implementation only guarantees that the
14744 profiling functions are called at least once per process and at
14745 most once per thread, but the calls are always paired, that is to
14746 say, if a thread calls the first function, then it will call the
14747 second function, unless it never reaches the exit of the
14748 instrumented function.
14749
14750 -finstrument-functions-exclude-file-list=file,file,...
14751 Set the list of functions that are excluded from instrumentation
14752 (see the description of -finstrument-functions). If the file that
14753 contains a function definition matches with one of file, then that
14754 function is not instrumented. The match is done on substrings: if
14755 the file parameter is a substring of the file name, it is
14756 considered to be a match.
14757
14758 For example:
14759
14760 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
14761
14762 excludes any inline function defined in files whose pathnames
14763 contain /bits/stl or include/sys.
14764
14765 If, for some reason, you want to include letter , in one of sym,
14766 write ,. For example,
14767 -finstrument-functions-exclude-file-list=',,tmp' (note the single
14768 quote surrounding the option).
14769
14770 -finstrument-functions-exclude-function-list=sym,sym,...
14771 This is similar to -finstrument-functions-exclude-file-list, but
14772 this option sets the list of function names to be excluded from
14773 instrumentation. The function name to be matched is its user-
14774 visible name, such as "vector<int> blah(const vector<int> &)", not
14775 the internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The
14776 match is done on substrings: if the sym parameter is a substring of
14777 the function name, it is considered to be a match. For C99 and C++
14778 extended identifiers, the function name must be given in UTF-8, not
14779 using universal character names.
14780
14781 -fpatchable-function-entry=N[,M]
14782 Generate N NOPs right at the beginning of each function, with the
14783 function entry point before the Mth NOP. If M is omitted, it
14784 defaults to 0 so the function entry points to the address just at
14785 the first NOP. The NOP instructions reserve extra space which can
14786 be used to patch in any desired instrumentation at run time,
14787 provided that the code segment is writable. The amount of space is
14788 controllable indirectly via the number of NOPs; the NOP instruction
14789 used corresponds to the instruction emitted by the internal GCC
14790 back-end interface "gen_nop". This behavior is target-specific and
14791 may also depend on the architecture variant and/or other
14792 compilation options.
14793
14794 For run-time identification, the starting addresses of these areas,
14795 which correspond to their respective function entries minus M, are
14796 additionally collected in the "__patchable_function_entries"
14797 section of the resulting binary.
14798
14799 Note that the value of "__attribute__ ((patchable_function_entry
14800 (N,M)))" takes precedence over command-line option
14801 -fpatchable-function-entry=N,M. This can be used to increase the
14802 area size or to remove it completely on a single function. If
14803 "N=0", no pad location is recorded.
14804
14805 The NOP instructions are inserted at---and maybe before, depending
14806 on M---the function entry address, even before the prologue. On
14807 PowerPC with the ELFv2 ABI, for a function with dual entry points,
14808 the local entry point is this function entry address.
14809
14810 The maximum value of N and M is 65535. On PowerPC with the ELFv2
14811 ABI, for a function with dual entry points, the supported values
14812 for M are 0, 2, 6 and 14.
14813
14814 Options Controlling the Preprocessor
14815 These options control the C preprocessor, which is run on each C source
14816 file before actual compilation.
14817
14818 If you use the -E option, nothing is done except preprocessing. Some
14819 of these options make sense only together with -E because they cause
14820 the preprocessor output to be unsuitable for actual compilation.
14821
14822 In addition to the options listed here, there are a number of options
14823 to control search paths for include files documented in Directory
14824 Options. Options to control preprocessor diagnostics are listed in
14825 Warning Options.
14826
14827 -D name
14828 Predefine name as a macro, with definition 1.
14829
14830 -D name=definition
14831 The contents of definition are tokenized and processed as if they
14832 appeared during translation phase three in a #define directive. In
14833 particular, the definition is truncated by embedded newline
14834 characters.
14835
14836 If you are invoking the preprocessor from a shell or shell-like
14837 program you may need to use the shell's quoting syntax to protect
14838 characters such as spaces that have a meaning in the shell syntax.
14839
14840 If you wish to define a function-like macro on the command line,
14841 write its argument list with surrounding parentheses before the
14842 equals sign (if any). Parentheses are meaningful to most shells,
14843 so you should quote the option. With sh and csh,
14844 -D'name(args...)=definition' works.
14845
14846 -D and -U options are processed in the order they are given on the
14847 command line. All -imacros file and -include file options are
14848 processed after all -D and -U options.
14849
14850 -U name
14851 Cancel any previous definition of name, either built in or provided
14852 with a -D option.
14853
14854 -include file
14855 Process file as if "#include "file"" appeared as the first line of
14856 the primary source file. However, the first directory searched for
14857 file is the preprocessor's working directory instead of the
14858 directory containing the main source file. If not found there, it
14859 is searched for in the remainder of the "#include "..."" search
14860 chain as normal.
14861
14862 If multiple -include options are given, the files are included in
14863 the order they appear on the command line.
14864
14865 -imacros file
14866 Exactly like -include, except that any output produced by scanning
14867 file is thrown away. Macros it defines remain defined. This
14868 allows you to acquire all the macros from a header without also
14869 processing its declarations.
14870
14871 All files specified by -imacros are processed before all files
14872 specified by -include.
14873
14874 -undef
14875 Do not predefine any system-specific or GCC-specific macros. The
14876 standard predefined macros remain defined.
14877
14878 -pthread
14879 Define additional macros required for using the POSIX threads
14880 library. You should use this option consistently for both
14881 compilation and linking. This option is supported on GNU/Linux
14882 targets, most other Unix derivatives, and also on x86 Cygwin and
14883 MinGW targets.
14884
14885 -M Instead of outputting the result of preprocessing, output a rule
14886 suitable for make describing the dependencies of the main source
14887 file. The preprocessor outputs one make rule containing the object
14888 file name for that source file, a colon, and the names of all the
14889 included files, including those coming from -include or -imacros
14890 command-line options.
14891
14892 Unless specified explicitly (with -MT or -MQ), the object file name
14893 consists of the name of the source file with any suffix replaced
14894 with object file suffix and with any leading directory parts
14895 removed. If there are many included files then the rule is split
14896 into several lines using \-newline. The rule has no commands.
14897
14898 This option does not suppress the preprocessor's debug output, such
14899 as -dM. To avoid mixing such debug output with the dependency
14900 rules you should explicitly specify the dependency output file with
14901 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
14902 Debug output is still sent to the regular output stream as normal.
14903
14904 Passing -M to the driver implies -E, and suppresses warnings with
14905 an implicit -w.
14906
14907 -MM Like -M but do not mention header files that are found in system
14908 header directories, nor header files that are included, directly or
14909 indirectly, from such a header.
14910
14911 This implies that the choice of angle brackets or double quotes in
14912 an #include directive does not in itself determine whether that
14913 header appears in -MM dependency output.
14914
14915 -MF file
14916 When used with -M or -MM, specifies a file to write the
14917 dependencies to. If no -MF switch is given the preprocessor sends
14918 the rules to the same place it would send preprocessed output.
14919
14920 When used with the driver options -MD or -MMD, -MF overrides the
14921 default dependency output file.
14922
14923 If file is -, then the dependencies are written to stdout.
14924
14925 -MG In conjunction with an option such as -M requesting dependency
14926 generation, -MG assumes missing header files are generated files
14927 and adds them to the dependency list without raising an error. The
14928 dependency filename is taken directly from the "#include" directive
14929 without prepending any path. -MG also suppresses preprocessed
14930 output, as a missing header file renders this useless.
14931
14932 This feature is used in automatic updating of makefiles.
14933
14934 -Mno-modules
14935 Disable dependency generation for compiled module interfaces.
14936
14937 -MP This option instructs CPP to add a phony target for each dependency
14938 other than the main file, causing each to depend on nothing. These
14939 dummy rules work around errors make gives if you remove header
14940 files without updating the Makefile to match.
14941
14942 This is typical output:
14943
14944 test.o: test.c test.h
14945
14946 test.h:
14947
14948 -MT target
14949 Change the target of the rule emitted by dependency generation. By
14950 default CPP takes the name of the main input file, deletes any
14951 directory components and any file suffix such as .c, and appends
14952 the platform's usual object suffix. The result is the target.
14953
14954 An -MT option sets the target to be exactly the string you specify.
14955 If you want multiple targets, you can specify them as a single
14956 argument to -MT, or use multiple -MT options.
14957
14958 For example, -MT '$(objpfx)foo.o' might give
14959
14960 $(objpfx)foo.o: foo.c
14961
14962 -MQ target
14963 Same as -MT, but it quotes any characters which are special to
14964 Make. -MQ '$(objpfx)foo.o' gives
14965
14966 $$(objpfx)foo.o: foo.c
14967
14968 The default target is automatically quoted, as if it were given
14969 with -MQ.
14970
14971 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
14972 The driver determines file based on whether an -o option is given.
14973 If it is, the driver uses its argument but with a suffix of .d,
14974 otherwise it takes the name of the input file, removes any
14975 directory components and suffix, and applies a .d suffix.
14976
14977 If -MD is used in conjunction with -E, any -o switch is understood
14978 to specify the dependency output file, but if used without -E, each
14979 -o is understood to specify a target object file.
14980
14981 Since -E is not implied, -MD can be used to generate a dependency
14982 output file as a side effect of the compilation process.
14983
14984 -MMD
14985 Like -MD except mention only user header files, not system header
14986 files.
14987
14988 -fpreprocessed
14989 Indicate to the preprocessor that the input file has already been
14990 preprocessed. This suppresses things like macro expansion,
14991 trigraph conversion, escaped newline splicing, and processing of
14992 most directives. The preprocessor still recognizes and removes
14993 comments, so that you can pass a file preprocessed with -C to the
14994 compiler without problems. In this mode the integrated
14995 preprocessor is little more than a tokenizer for the front ends.
14996
14997 -fpreprocessed is implicit if the input file has one of the
14998 extensions .i, .ii or .mi. These are the extensions that GCC uses
14999 for preprocessed files created by -save-temps.
15000
15001 -fdirectives-only
15002 When preprocessing, handle directives, but do not expand macros.
15003
15004 The option's behavior depends on the -E and -fpreprocessed options.
15005
15006 With -E, preprocessing is limited to the handling of directives
15007 such as "#define", "#ifdef", and "#error". Other preprocessor
15008 operations, such as macro expansion and trigraph conversion are not
15009 performed. In addition, the -dD option is implicitly enabled.
15010
15011 With -fpreprocessed, predefinition of command line and most builtin
15012 macros is disabled. Macros such as "__LINE__", which are
15013 contextually dependent, are handled normally. This enables
15014 compilation of files previously preprocessed with "-E
15015 -fdirectives-only".
15016
15017 With both -E and -fpreprocessed, the rules for -fpreprocessed take
15018 precedence. This enables full preprocessing of files previously
15019 preprocessed with "-E -fdirectives-only".
15020
15021 -fdollars-in-identifiers
15022 Accept $ in identifiers.
15023
15024 -fextended-identifiers
15025 Accept universal character names and extended characters in
15026 identifiers. This option is enabled by default for C99 (and later
15027 C standard versions) and C++.
15028
15029 -fno-canonical-system-headers
15030 When preprocessing, do not shorten system header paths with
15031 canonicalization.
15032
15033 -fmax-include-depth=depth
15034 Set the maximum depth of the nested #include. The default is 200.
15035
15036 -ftabstop=width
15037 Set the distance between tab stops. This helps the preprocessor
15038 report correct column numbers in warnings or errors, even if tabs
15039 appear on the line. If the value is less than 1 or greater than
15040 100, the option is ignored. The default is 8.
15041
15042 -ftrack-macro-expansion[=level]
15043 Track locations of tokens across macro expansions. This allows the
15044 compiler to emit diagnostic about the current macro expansion stack
15045 when a compilation error occurs in a macro expansion. Using this
15046 option makes the preprocessor and the compiler consume more memory.
15047 The level parameter can be used to choose the level of precision of
15048 token location tracking thus decreasing the memory consumption if
15049 necessary. Value 0 of level de-activates this option. Value 1
15050 tracks tokens locations in a degraded mode for the sake of minimal
15051 memory overhead. In this mode all tokens resulting from the
15052 expansion of an argument of a function-like macro have the same
15053 location. Value 2 tracks tokens locations completely. This value is
15054 the most memory hungry. When this option is given no argument, the
15055 default parameter value is 2.
15056
15057 Note that "-ftrack-macro-expansion=2" is activated by default.
15058
15059 -fmacro-prefix-map=old=new
15060 When preprocessing files residing in directory old, expand the
15061 "__FILE__" and "__BASE_FILE__" macros as if the files resided in
15062 directory new instead. This can be used to change an absolute path
15063 to a relative path by using . for new which can result in more
15064 reproducible builds that are location independent. This option
15065 also affects "__builtin_FILE()" during compilation. See also
15066 -ffile-prefix-map and -fcanon-prefix-map.
15067
15068 -fexec-charset=charset
15069 Set the execution character set, used for string and character
15070 constants. The default is UTF-8. charset can be any encoding
15071 supported by the system's "iconv" library routine.
15072
15073 -fwide-exec-charset=charset
15074 Set the wide execution character set, used for wide string and
15075 character constants. The default is one of UTF-32BE, UTF-32LE,
15076 UTF-16BE, or UTF-16LE, whichever corresponds to the width of
15077 "wchar_t" and the big-endian or little-endian byte order being used
15078 for code generation. As with -fexec-charset, charset can be any
15079 encoding supported by the system's "iconv" library routine;
15080 however, you will have problems with encodings that do not fit
15081 exactly in "wchar_t".
15082
15083 -finput-charset=charset
15084 Set the input character set, used for translation from the
15085 character set of the input file to the source character set used by
15086 GCC. If the locale does not specify, or GCC cannot get this
15087 information from the locale, the default is UTF-8. This can be
15088 overridden by either the locale or this command-line option.
15089 Currently the command-line option takes precedence if there's a
15090 conflict. charset can be any encoding supported by the system's
15091 "iconv" library routine.
15092
15093 -fpch-deps
15094 When using precompiled headers, this flag causes the dependency-
15095 output flags to also list the files from the precompiled header's
15096 dependencies. If not specified, only the precompiled header are
15097 listed and not the files that were used to create it, because those
15098 files are not consulted when a precompiled header is used.
15099
15100 -fpch-preprocess
15101 This option allows use of a precompiled header together with -E.
15102 It inserts a special "#pragma", "#pragma GCC pch_preprocess
15103 "filename"" in the output to mark the place where the precompiled
15104 header was found, and its filename. When -fpreprocessed is in use,
15105 GCC recognizes this "#pragma" and loads the PCH.
15106
15107 This option is off by default, because the resulting preprocessed
15108 output is only really suitable as input to GCC. It is switched on
15109 by -save-temps.
15110
15111 You should not write this "#pragma" in your own code, but it is
15112 safe to edit the filename if the PCH file is available in a
15113 different location. The filename may be absolute or it may be
15114 relative to GCC's current directory.
15115
15116 -fworking-directory
15117 Enable generation of linemarkers in the preprocessor output that
15118 let the compiler know the current working directory at the time of
15119 preprocessing. When this option is enabled, the preprocessor
15120 emits, after the initial linemarker, a second linemarker with the
15121 current working directory followed by two slashes. GCC uses this
15122 directory, when it's present in the preprocessed input, as the
15123 directory emitted as the current working directory in some
15124 debugging information formats. This option is implicitly enabled
15125 if debugging information is enabled, but this can be inhibited with
15126 the negated form -fno-working-directory. If the -P flag is present
15127 in the command line, this option has no effect, since no "#line"
15128 directives are emitted whatsoever.
15129
15130 -A predicate=answer
15131 Make an assertion with the predicate predicate and answer answer.
15132 This form is preferred to the older form -A predicate(answer),
15133 which is still supported, because it does not use shell special
15134 characters.
15135
15136 -A -predicate=answer
15137 Cancel an assertion with the predicate predicate and answer answer.
15138
15139 -C Do not discard comments. All comments are passed through to the
15140 output file, except for comments in processed directives, which are
15141 deleted along with the directive.
15142
15143 You should be prepared for side effects when using -C; it causes
15144 the preprocessor to treat comments as tokens in their own right.
15145 For example, comments appearing at the start of what would be a
15146 directive line have the effect of turning that line into an
15147 ordinary source line, since the first token on the line is no
15148 longer a #.
15149
15150 -CC Do not discard comments, including during macro expansion. This is
15151 like -C, except that comments contained within macros are also
15152 passed through to the output file where the macro is expanded.
15153
15154 In addition to the side effects of the -C option, the -CC option
15155 causes all C++-style comments inside a macro to be converted to
15156 C-style comments. This is to prevent later use of that macro from
15157 inadvertently commenting out the remainder of the source line.
15158
15159 The -CC option is generally used to support lint comments.
15160
15161 -P Inhibit generation of linemarkers in the output from the
15162 preprocessor. This might be useful when running the preprocessor
15163 on something that is not C code, and will be sent to a program
15164 which might be confused by the linemarkers.
15165
15166 -traditional
15167 -traditional-cpp
15168 Try to imitate the behavior of pre-standard C preprocessors, as
15169 opposed to ISO C preprocessors. See the GNU CPP manual for
15170 details.
15171
15172 Note that GCC does not otherwise attempt to emulate a pre-standard
15173 C compiler, and these options are only supported with the -E
15174 switch, or when invoking CPP explicitly.
15175
15176 -trigraphs
15177 Support ISO C trigraphs. These are three-character sequences, all
15178 starting with ??, that are defined by ISO C to stand for single
15179 characters. For example, ??/ stands for \, so '??/n' is a
15180 character constant for a newline.
15181
15182 The nine trigraphs and their replacements are
15183
15184 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
15185 Replacement: [ ] { } # \ ^ | ~
15186
15187 By default, GCC ignores trigraphs, but in standard-conforming modes
15188 it converts them. See the -std and -ansi options.
15189
15190 -remap
15191 Enable special code to work around file systems which only permit
15192 very short file names, such as MS-DOS.
15193
15194 -H Print the name of each header file used, in addition to other
15195 normal activities. Each name is indented to show how deep in the
15196 #include stack it is. Precompiled header files are also printed,
15197 even if they are found to be invalid; an invalid precompiled header
15198 file is printed with ...x and a valid one with ...! .
15199
15200 -dletters
15201 Says to make debugging dumps during compilation as specified by
15202 letters. The flags documented here are those relevant to the
15203 preprocessor. Other letters are interpreted by the compiler
15204 proper, or reserved for future versions of GCC, and so are silently
15205 ignored. If you specify letters whose behavior conflicts, the
15206 result is undefined.
15207
15208 -dM Instead of the normal output, generate a list of #define
15209 directives for all the macros defined during the execution of
15210 the preprocessor, including predefined macros. This gives you
15211 a way of finding out what is predefined in your version of the
15212 preprocessor. Assuming you have no file foo.h, the command
15213
15214 touch foo.h; cpp -dM foo.h
15215
15216 shows all the predefined macros.
15217
15218 If you use -dM without the -E option, -dM is interpreted as a
15219 synonym for -fdump-rtl-mach.
15220
15221 -dD Like -dM except in two respects: it does not include the
15222 predefined macros, and it outputs both the #define directives
15223 and the result of preprocessing. Both kinds of output go to
15224 the standard output file.
15225
15226 -dN Like -dD, but emit only the macro names, not their expansions.
15227
15228 -dI Output #include directives in addition to the result of
15229 preprocessing.
15230
15231 -dU Like -dD except that only macros that are expanded, or whose
15232 definedness is tested in preprocessor directives, are output;
15233 the output is delayed until the use or test of the macro; and
15234 #undef directives are also output for macros tested but
15235 undefined at the time.
15236
15237 -fdebug-cpp
15238 This option is only useful for debugging GCC. When used from CPP
15239 or with -E, it dumps debugging information about location maps.
15240 Every token in the output is preceded by the dump of the map its
15241 location belongs to.
15242
15243 When used from GCC without -E, this option has no effect.
15244
15245 -Wp,option
15246 You can use -Wp,option to bypass the compiler driver and pass
15247 option directly through to the preprocessor. If option contains
15248 commas, it is split into multiple options at the commas. However,
15249 many options are modified, translated or interpreted by the
15250 compiler driver before being passed to the preprocessor, and -Wp
15251 forcibly bypasses this phase. The preprocessor's direct interface
15252 is undocumented and subject to change, so whenever possible you
15253 should avoid using -Wp and let the driver handle the options
15254 instead.
15255
15256 -Xpreprocessor option
15257 Pass option as an option to the preprocessor. You can use this to
15258 supply system-specific preprocessor options that GCC does not
15259 recognize.
15260
15261 If you want to pass an option that takes an argument, you must use
15262 -Xpreprocessor twice, once for the option and once for the
15263 argument.
15264
15265 -no-integrated-cpp
15266 Perform preprocessing as a separate pass before compilation. By
15267 default, GCC performs preprocessing as an integrated part of input
15268 tokenization and parsing. If this option is provided, the
15269 appropriate language front end (cc1, cc1plus, or cc1obj for C, C++,
15270 and Objective-C, respectively) is instead invoked twice, once for
15271 preprocessing only and once for actual compilation of the
15272 preprocessed input. This option may be useful in conjunction with
15273 the -B or -wrapper options to specify an alternate preprocessor or
15274 perform additional processing of the program source between normal
15275 preprocessing and compilation.
15276
15277 -flarge-source-files
15278 Adjust GCC to expect large source files, at the expense of slower
15279 compilation and higher memory usage.
15280
15281 Specifically, GCC normally tracks both column numbers and line
15282 numbers within source files and it normally prints both of these
15283 numbers in diagnostics. However, once it has processed a certain
15284 number of source lines, it stops tracking column numbers and only
15285 tracks line numbers. This means that diagnostics for later lines
15286 do not include column numbers. It also means that options like
15287 -Wmisleading-indentation cease to work at that point, although the
15288 compiler prints a note if this happens. Passing
15289 -flarge-source-files significantly increases the number of source
15290 lines that GCC can process before it stops tracking columns.
15291
15292 Passing Options to the Assembler
15293 You can pass options to the assembler.
15294
15295 -Wa,option
15296 Pass option as an option to the assembler. If option contains
15297 commas, it is split into multiple options at the commas.
15298
15299 -Xassembler option
15300 Pass option as an option to the assembler. You can use this to
15301 supply system-specific assembler options that GCC does not
15302 recognize.
15303
15304 If you want to pass an option that takes an argument, you must use
15305 -Xassembler twice, once for the option and once for the argument.
15306
15307 Options for Linking
15308 These options come into play when the compiler links object files into
15309 an executable output file. They are meaningless if the compiler is not
15310 doing a link step.
15311
15312 object-file-name
15313 A file name that does not end in a special recognized suffix is
15314 considered to name an object file or library. (Object files are
15315 distinguished from libraries by the linker according to the file
15316 contents.) If linking is done, these object files are used as
15317 input to the linker.
15318
15319 -c
15320 -S
15321 -E If any of these options is used, then the linker is not run, and
15322 object file names should not be used as arguments.
15323
15324 -flinker-output=type
15325 This option controls code generation of the link-time optimizer.
15326 By default the linker output is automatically determined by the
15327 linker plugin. For debugging the compiler and if incremental
15328 linking with a non-LTO object file is desired, it may be useful to
15329 control the type manually.
15330
15331 If type is exec, code generation produces a static binary. In this
15332 case -fpic and -fpie are both disabled.
15333
15334 If type is dyn, code generation produces a shared library. In this
15335 case -fpic or -fPIC is preserved, but not enabled automatically.
15336 This allows to build shared libraries without position-independent
15337 code on architectures where this is possible, i.e. on x86.
15338
15339 If type is pie, code generation produces an -fpie executable. This
15340 results in similar optimizations as exec except that -fpie is not
15341 disabled if specified at compilation time.
15342
15343 If type is rel, the compiler assumes that incremental linking is
15344 done. The sections containing intermediate code for link-time
15345 optimization are merged, pre-optimized, and output to the resulting
15346 object file. In addition, if -ffat-lto-objects is specified, binary
15347 code is produced for future non-LTO linking. The object file
15348 produced by incremental linking is smaller than a static library
15349 produced from the same object files. At link time the result of
15350 incremental linking also loads faster than a static library
15351 assuming that the majority of objects in the library are used.
15352
15353 Finally nolto-rel configures the compiler for incremental linking
15354 where code generation is forced, a final binary is produced, and
15355 the intermediate code for later link-time optimization is stripped.
15356 When multiple object files are linked together the resulting code
15357 is better optimized than with link-time optimizations disabled (for
15358 example, cross-module inlining happens), but most of benefits of
15359 whole program optimizations are lost.
15360
15361 During the incremental link (by -r) the linker plugin defaults to
15362 rel. With current interfaces to GNU Binutils it is however not
15363 possible to incrementally link LTO objects and non-LTO objects into
15364 a single mixed object file. If any of object files in incremental
15365 link cannot be used for link-time optimization, the linker plugin
15366 issues a warning and uses nolto-rel. To maintain whole program
15367 optimization, it is recommended to link such objects into static
15368 library instead. Alternatively it is possible to use H.J. Lu's
15369 binutils with support for mixed objects.
15370
15371 -fuse-ld=bfd
15372 Use the bfd linker instead of the default linker.
15373
15374 -fuse-ld=gold
15375 Use the gold linker instead of the default linker.
15376
15377 -fuse-ld=lld
15378 Use the LLVM lld linker instead of the default linker.
15379
15380 -fuse-ld=mold
15381 Use the Modern Linker (mold) instead of the default linker.
15382
15383 -llibrary
15384 -l library
15385 Search the library named library when linking. (The second
15386 alternative with the library as a separate argument is only for
15387 POSIX compliance and is not recommended.)
15388
15389 The -l option is passed directly to the linker by GCC. Refer to
15390 your linker documentation for exact details. The general
15391 description below applies to the GNU linker.
15392
15393 The linker searches a standard list of directories for the library.
15394 The directories searched include several standard system
15395 directories plus any that you specify with -L.
15396
15397 Static libraries are archives of object files, and have file names
15398 like liblibrary.a. Some targets also support shared libraries,
15399 which typically have names like liblibrary.so. If both static and
15400 shared libraries are found, the linker gives preference to linking
15401 with the shared library unless the -static option is used.
15402
15403 It makes a difference where in the command you write this option;
15404 the linker searches and processes libraries and object files in the
15405 order they are specified. Thus, foo.o -lz bar.o searches library z
15406 after file foo.o but before bar.o. If bar.o refers to functions in
15407 z, those functions may not be loaded.
15408
15409 -lobjc
15410 You need this special case of the -l option in order to link an
15411 Objective-C or Objective-C++ program.
15412
15413 -nostartfiles
15414 Do not use the standard system startup files when linking. The
15415 standard system libraries are used normally, unless -nostdlib,
15416 -nolibc, or -nodefaultlibs is used.
15417
15418 -nodefaultlibs
15419 Do not use the standard system libraries when linking. Only the
15420 libraries you specify are passed to the linker, and options
15421 specifying linkage of the system libraries, such as -static-libgcc
15422 or -shared-libgcc, are ignored. The standard startup files are
15423 used normally, unless -nostartfiles is used.
15424
15425 The compiler may generate calls to "memcmp", "memset", "memcpy" and
15426 "memmove". These entries are usually resolved by entries in libc.
15427 These entry points should be supplied through some other mechanism
15428 when this option is specified.
15429
15430 -nolibc
15431 Do not use the C library or system libraries tightly coupled with
15432 it when linking. Still link with the startup files, libgcc or
15433 toolchain provided language support libraries such as libgnat,
15434 libgfortran or libstdc++ unless options preventing their inclusion
15435 are used as well. This typically removes -lc from the link command
15436 line, as well as system libraries that normally go with it and
15437 become meaningless when absence of a C library is assumed, for
15438 example -lpthread or -lm in some configurations. This is intended
15439 for bare-board targets when there is indeed no C library available.
15440
15441 -nostdlib
15442 Do not use the standard system startup files or libraries when
15443 linking. No startup files and only the libraries you specify are
15444 passed to the linker, and options specifying linkage of the system
15445 libraries, such as -static-libgcc or -shared-libgcc, are ignored.
15446
15447 The compiler may generate calls to "memcmp", "memset", "memcpy" and
15448 "memmove". These entries are usually resolved by entries in libc.
15449 These entry points should be supplied through some other mechanism
15450 when this option is specified.
15451
15452 One of the standard libraries bypassed by -nostdlib and
15453 -nodefaultlibs is libgcc.a, a library of internal subroutines which
15454 GCC uses to overcome shortcomings of particular machines, or
15455 special needs for some languages.
15456
15457 In most cases, you need libgcc.a even when you want to avoid other
15458 standard libraries. In other words, when you specify -nostdlib or
15459 -nodefaultlibs you should usually specify -lgcc as well. This
15460 ensures that you have no unresolved references to internal GCC
15461 library subroutines. (An example of such an internal subroutine is
15462 "__main", used to ensure C++ constructors are called.)
15463
15464 -nostdlib++
15465 Do not implicitly link with standard C++ libraries.
15466
15467 -e entry
15468 --entry=entry
15469 Specify that the program entry point is entry. The argument is
15470 interpreted by the linker; the GNU linker accepts either a symbol
15471 name or an address.
15472
15473 -pie
15474 Produce a dynamically linked position independent executable on
15475 targets that support it. For predictable results, you must also
15476 specify the same set of options used for compilation (-fpie, -fPIE,
15477 or model suboptions) when you specify this linker option.
15478
15479 -no-pie
15480 Don't produce a dynamically linked position independent executable.
15481
15482 -static-pie
15483 Produce a static position independent executable on targets that
15484 support it. A static position independent executable is similar to
15485 a static executable, but can be loaded at any address without a
15486 dynamic linker. For predictable results, you must also specify the
15487 same set of options used for compilation (-fpie, -fPIE, or model
15488 suboptions) when you specify this linker option.
15489
15490 -pthread
15491 Link with the POSIX threads library. This option is supported on
15492 GNU/Linux targets, most other Unix derivatives, and also on x86
15493 Cygwin and MinGW targets. On some targets this option also sets
15494 flags for the preprocessor, so it should be used consistently for
15495 both compilation and linking.
15496
15497 -r Produce a relocatable object as output. This is also known as
15498 partial linking.
15499
15500 -rdynamic
15501 Pass the flag -export-dynamic to the ELF linker, on targets that
15502 support it. This instructs the linker to add all symbols, not only
15503 used ones, to the dynamic symbol table. This option is needed for
15504 some uses of "dlopen" or to allow obtaining backtraces from within
15505 a program.
15506
15507 -s Remove all symbol table and relocation information from the
15508 executable.
15509
15510 -static
15511 On systems that support dynamic linking, this overrides -pie and
15512 prevents linking with the shared libraries. On other systems, this
15513 option has no effect.
15514
15515 -shared
15516 Produce a shared object which can then be linked with other objects
15517 to form an executable. Not all systems support this option. For
15518 predictable results, you must also specify the same set of options
15519 used for compilation (-fpic, -fPIC, or model suboptions) when you
15520 specify this linker option.[1]
15521
15522 -shared-libgcc
15523 -static-libgcc
15524 On systems that provide libgcc as a shared library, these options
15525 force the use of either the shared or static version, respectively.
15526 If no shared version of libgcc was built when the compiler was
15527 configured, these options have no effect.
15528
15529 There are several situations in which an application should use the
15530 shared libgcc instead of the static version. The most common of
15531 these is when the application wishes to throw and catch exceptions
15532 across different shared libraries. In that case, each of the
15533 libraries as well as the application itself should use the shared
15534 libgcc.
15535
15536 Therefore, the G++ driver automatically adds -shared-libgcc
15537 whenever you build a shared library or a main executable, because
15538 C++ programs typically use exceptions, so this is the right thing
15539 to do.
15540
15541 If, instead, you use the GCC driver to create shared libraries, you
15542 may find that they are not always linked with the shared libgcc.
15543 If GCC finds, at its configuration time, that you have a non-GNU
15544 linker or a GNU linker that does not support option --eh-frame-hdr,
15545 it links the shared version of libgcc into shared libraries by
15546 default. Otherwise, it takes advantage of the linker and optimizes
15547 away the linking with the shared version of libgcc, linking with
15548 the static version of libgcc by default. This allows exceptions to
15549 propagate through such shared libraries, without incurring
15550 relocation costs at library load time.
15551
15552 However, if a library or main executable is supposed to throw or
15553 catch exceptions, you must link it using the G++ driver, or using
15554 the option -shared-libgcc, such that it is linked with the shared
15555 libgcc.
15556
15557 -static-libasan
15558 When the -fsanitize=address option is used to link a program, the
15559 GCC driver automatically links against libasan. If libasan is
15560 available as a shared library, and the -static option is not used,
15561 then this links against the shared version of libasan. The
15562 -static-libasan option directs the GCC driver to link libasan
15563 statically, without necessarily linking other libraries statically.
15564
15565 -static-libtsan
15566 When the -fsanitize=thread option is used to link a program, the
15567 GCC driver automatically links against libtsan. If libtsan is
15568 available as a shared library, and the -static option is not used,
15569 then this links against the shared version of libtsan. The
15570 -static-libtsan option directs the GCC driver to link libtsan
15571 statically, without necessarily linking other libraries statically.
15572
15573 -static-liblsan
15574 When the -fsanitize=leak option is used to link a program, the GCC
15575 driver automatically links against liblsan. If liblsan is
15576 available as a shared library, and the -static option is not used,
15577 then this links against the shared version of liblsan. The
15578 -static-liblsan option directs the GCC driver to link liblsan
15579 statically, without necessarily linking other libraries statically.
15580
15581 -static-libubsan
15582 When the -fsanitize=undefined option is used to link a program, the
15583 GCC driver automatically links against libubsan. If libubsan is
15584 available as a shared library, and the -static option is not used,
15585 then this links against the shared version of libubsan. The
15586 -static-libubsan option directs the GCC driver to link libubsan
15587 statically, without necessarily linking other libraries statically.
15588
15589 -static-libstdc++
15590 When the g++ program is used to link a C++ program, it normally
15591 automatically links against libstdc++. If libstdc++ is available
15592 as a shared library, and the -static option is not used, then this
15593 links against the shared version of libstdc++. That is normally
15594 fine. However, it is sometimes useful to freeze the version of
15595 libstdc++ used by the program without going all the way to a fully
15596 static link. The -static-libstdc++ option directs the g++ driver
15597 to link libstdc++ statically, without necessarily linking other
15598 libraries statically.
15599
15600 -symbolic
15601 Bind references to global symbols when building a shared object.
15602 Warn about any unresolved references (unless overridden by the link
15603 editor option -Xlinker -z -Xlinker defs). Only a few systems
15604 support this option.
15605
15606 -T script
15607 Use script as the linker script. This option is supported by most
15608 systems using the GNU linker. On some targets, such as bare-board
15609 targets without an operating system, the -T option may be required
15610 when linking to avoid references to undefined symbols.
15611
15612 -Xlinker option
15613 Pass option as an option to the linker. You can use this to supply
15614 system-specific linker options that GCC does not recognize.
15615
15616 If you want to pass an option that takes a separate argument, you
15617 must use -Xlinker twice, once for the option and once for the
15618 argument. For example, to pass -assert definitions, you must write
15619 -Xlinker -assert -Xlinker definitions. It does not work to write
15620 -Xlinker "-assert definitions", because this passes the entire
15621 string as a single argument, which is not what the linker expects.
15622
15623 When using the GNU linker, it is usually more convenient to pass
15624 arguments to linker options using the option=value syntax than as
15625 separate arguments. For example, you can specify -Xlinker
15626 -Map=output.map rather than -Xlinker -Map -Xlinker output.map.
15627 Other linkers may not support this syntax for command-line options.
15628
15629 -Wl,option
15630 Pass option as an option to the linker. If option contains commas,
15631 it is split into multiple options at the commas. You can use this
15632 syntax to pass an argument to the option. For example,
15633 -Wl,-Map,output.map passes -Map output.map to the linker. When
15634 using the GNU linker, you can also get the same effect with
15635 -Wl,-Map=output.map.
15636
15637 -u symbol
15638 Pretend the symbol symbol is undefined, to force linking of library
15639 modules to define it. You can use -u multiple times with different
15640 symbols to force loading of additional library modules.
15641
15642 -z keyword
15643 -z is passed directly on to the linker along with the keyword
15644 keyword. See the section in the documentation of your linker for
15645 permitted values and their meanings.
15646
15647 Options for Directory Search
15648 These options specify directories to search for header files, for
15649 libraries and for parts of the compiler:
15650
15651 -I dir
15652 -iquote dir
15653 -isystem dir
15654 -idirafter dir
15655 Add the directory dir to the list of directories to be searched for
15656 header files during preprocessing. If dir begins with = or
15657 $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix;
15658 see --sysroot and -isysroot.
15659
15660 Directories specified with -iquote apply only to the quote form of
15661 the directive, "#include "file"". Directories specified with -I,
15662 -isystem, or -idirafter apply to lookup for both the
15663 "#include "file"" and "#include <file>" directives.
15664
15665 You can specify any number or combination of these options on the
15666 command line to search for header files in several directories.
15667 The lookup order is as follows:
15668
15669 1. For the quote form of the include directive, the directory of
15670 the current file is searched first.
15671
15672 2. For the quote form of the include directive, the directories
15673 specified by -iquote options are searched in left-to-right
15674 order, as they appear on the command line.
15675
15676 3. Directories specified with -I options are scanned in left-to-
15677 right order.
15678
15679 4. Directories specified with -isystem options are scanned in
15680 left-to-right order.
15681
15682 5. Standard system directories are scanned.
15683
15684 6. Directories specified with -idirafter options are scanned in
15685 left-to-right order.
15686
15687 You can use -I to override a system header file, substituting your
15688 own version, since these directories are searched before the
15689 standard system header file directories. However, you should not
15690 use this option to add directories that contain vendor-supplied
15691 system header files; use -isystem for that.
15692
15693 The -isystem and -idirafter options also mark the directory as a
15694 system directory, so that it gets the same special treatment that
15695 is applied to the standard system directories.
15696
15697 If a standard system include directory, or a directory specified
15698 with -isystem, is also specified with -I, the -I option is ignored.
15699 The directory is still searched but as a system directory at its
15700 normal position in the system include chain. This is to ensure
15701 that GCC's procedure to fix buggy system headers and the ordering
15702 for the "#include_next" directive are not inadvertently changed.
15703 If you really need to change the search order for system
15704 directories, use the -nostdinc and/or -isystem options.
15705
15706 -I- Split the include path. This option has been deprecated. Please
15707 use -iquote instead for -I directories before the -I- and remove
15708 the -I- option.
15709
15710 Any directories specified with -I options before -I- are searched
15711 only for headers requested with "#include "file""; they are not
15712 searched for "#include <file>". If additional directories are
15713 specified with -I options after the -I-, those directories are
15714 searched for all #include directives.
15715
15716 In addition, -I- inhibits the use of the directory of the current
15717 file directory as the first search directory for "#include "file"".
15718 There is no way to override this effect of -I-.
15719
15720 -iprefix prefix
15721 Specify prefix as the prefix for subsequent -iwithprefix options.
15722 If the prefix represents a directory, you should include the final
15723 /.
15724
15725 -iwithprefix dir
15726 -iwithprefixbefore dir
15727 Append dir to the prefix specified previously with -iprefix, and
15728 add the resulting directory to the include search path.
15729 -iwithprefixbefore puts it in the same place -I would; -iwithprefix
15730 puts it where -idirafter would.
15731
15732 -isysroot dir
15733 This option is like the --sysroot option, but applies only to
15734 header files (except for Darwin targets, where it applies to both
15735 header files and libraries). See the --sysroot option for more
15736 information.
15737
15738 -imultilib dir
15739 Use dir as a subdirectory of the directory containing target-
15740 specific C++ headers.
15741
15742 -nostdinc
15743 Do not search the standard system directories for header files.
15744 Only the directories explicitly specified with -I, -iquote,
15745 -isystem, and/or -idirafter options (and the directory of the
15746 current file, if appropriate) are searched.
15747
15748 -nostdinc++
15749 Do not search for header files in the C++-specific standard
15750 directories, but do still search the other standard directories.
15751 (This option is used when building the C++ library.)
15752
15753 -iplugindir=dir
15754 Set the directory to search for plugins that are passed by
15755 -fplugin=name instead of -fplugin=path/name.so. This option is not
15756 meant to be used by the user, but only passed by the driver.
15757
15758 -Ldir
15759 Add directory dir to the list of directories to be searched for -l.
15760
15761 -Bprefix
15762 This option specifies where to find the executables, libraries,
15763 include files, and data files of the compiler itself.
15764
15765 The compiler driver program runs one or more of the subprograms
15766 cpp, cc1, as and ld. It tries prefix as a prefix for each program
15767 it tries to run, both with and without machine/version/ for the
15768 corresponding target machine and compiler version.
15769
15770 For each subprogram to be run, the compiler driver first tries the
15771 -B prefix, if any. If that name is not found, or if -B is not
15772 specified, the driver tries two standard prefixes, /usr/lib/gcc/
15773 and /usr/local/lib/gcc/. If neither of those results in a file
15774 name that is found, the unmodified program name is searched for
15775 using the directories specified in your PATH environment variable.
15776
15777 The compiler checks to see if the path provided by -B refers to a
15778 directory, and if necessary it adds a directory separator character
15779 at the end of the path.
15780
15781 -B prefixes that effectively specify directory names also apply to
15782 libraries in the linker, because the compiler translates these
15783 options into -L options for the linker. They also apply to include
15784 files in the preprocessor, because the compiler translates these
15785 options into -isystem options for the preprocessor. In this case,
15786 the compiler appends include to the prefix.
15787
15788 The runtime support file libgcc.a can also be searched for using
15789 the -B prefix, if needed. If it is not found there, the two
15790 standard prefixes above are tried, and that is all. The file is
15791 left out of the link if it is not found by those means.
15792
15793 Another way to specify a prefix much like the -B prefix is to use
15794 the environment variable GCC_EXEC_PREFIX.
15795
15796 As a special kludge, if the path provided by -B is [dir/]stageN/,
15797 where N is a number in the range 0 to 9, then it is replaced by
15798 [dir/]include. This is to help with boot-strapping the compiler.
15799
15800 -no-canonical-prefixes
15801 Do not expand any symbolic links, resolve references to /../ or
15802 /./, or make the path absolute when generating a relative prefix.
15803
15804 --sysroot=dir
15805 Use dir as the logical root directory for headers and libraries.
15806 For example, if the compiler normally searches for headers in
15807 /usr/include and libraries in /usr/lib, it instead searches
15808 dir/usr/include and dir/usr/lib.
15809
15810 If you use both this option and the -isysroot option, then the
15811 --sysroot option applies to libraries, but the -isysroot option
15812 applies to header files.
15813
15814 The GNU linker (beginning with version 2.16) has the necessary
15815 support for this option. If your linker does not support this
15816 option, the header file aspect of --sysroot still works, but the
15817 library aspect does not.
15818
15819 --no-sysroot-suffix
15820 For some targets, a suffix is added to the root directory specified
15821 with --sysroot, depending on the other options used, so that
15822 headers may for example be found in dir/suffix/usr/include instead
15823 of dir/usr/include. This option disables the addition of such a
15824 suffix.
15825
15826 Options for Code Generation Conventions
15827 These machine-independent options control the interface conventions
15828 used in code generation.
15829
15830 Most of them have both positive and negative forms; the negative form
15831 of -ffoo is -fno-foo. In the table below, only one of the forms is
15832 listed---the one that is not the default. You can figure out the other
15833 form by either removing no- or adding it.
15834
15835 -fstack-reuse=reuse-level
15836 This option controls stack space reuse for user declared local/auto
15837 variables and compiler generated temporaries. reuse_level can be
15838 all, named_vars, or none. all enables stack reuse for all local
15839 variables and temporaries, named_vars enables the reuse only for
15840 user defined local variables with names, and none disables stack
15841 reuse completely. The default value is all. The option is needed
15842 when the program extends the lifetime of a scoped local variable or
15843 a compiler generated temporary beyond the end point defined by the
15844 language. When a lifetime of a variable ends, and if the variable
15845 lives in memory, the optimizing compiler has the freedom to reuse
15846 its stack space with other temporaries or scoped local variables
15847 whose live range does not overlap with it. Legacy code extending
15848 local lifetime is likely to break with the stack reuse
15849 optimization.
15850
15851 For example,
15852
15853 int *p;
15854 {
15855 int local1;
15856
15857 p = &local1;
15858 local1 = 10;
15859 ....
15860 }
15861 {
15862 int local2;
15863 local2 = 20;
15864 ...
15865 }
15866
15867 if (*p == 10) // out of scope use of local1
15868 {
15869
15870 }
15871
15872 Another example:
15873
15874 struct A
15875 {
15876 A(int k) : i(k), j(k) { }
15877 int i;
15878 int j;
15879 };
15880
15881 A *ap;
15882
15883 void foo(const A& ar)
15884 {
15885 ap = &ar;
15886 }
15887
15888 void bar()
15889 {
15890 foo(A(10)); // temp object's lifetime ends when foo returns
15891
15892 {
15893 A a(20);
15894 ....
15895 }
15896 ap->i+= 10; // ap references out of scope temp whose space
15897 // is reused with a. What is the value of ap->i?
15898 }
15899
15900 The lifetime of a compiler generated temporary is well defined by
15901 the C++ standard. When a lifetime of a temporary ends, and if the
15902 temporary lives in memory, the optimizing compiler has the freedom
15903 to reuse its stack space with other temporaries or scoped local
15904 variables whose live range does not overlap with it. However some
15905 of the legacy code relies on the behavior of older compilers in
15906 which temporaries' stack space is not reused, the aggressive stack
15907 reuse can lead to runtime errors. This option is used to control
15908 the temporary stack reuse optimization.
15909
15910 -ftrapv
15911 This option generates traps for signed overflow on addition,
15912 subtraction, multiplication operations. The options -ftrapv and
15913 -fwrapv override each other, so using -ftrapv -fwrapv on the
15914 command-line results in -fwrapv being effective. Note that only
15915 active options override, so using -ftrapv -fwrapv -fno-wrapv on the
15916 command-line results in -ftrapv being effective.
15917
15918 -fwrapv
15919 This option instructs the compiler to assume that signed arithmetic
15920 overflow of addition, subtraction and multiplication wraps around
15921 using twos-complement representation. This flag enables some
15922 optimizations and disables others. The options -ftrapv and -fwrapv
15923 override each other, so using -ftrapv -fwrapv on the command-line
15924 results in -fwrapv being effective. Note that only active options
15925 override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
15926 results in -ftrapv being effective.
15927
15928 -fwrapv-pointer
15929 This option instructs the compiler to assume that pointer
15930 arithmetic overflow on addition and subtraction wraps around using
15931 twos-complement representation. This flag disables some
15932 optimizations which assume pointer overflow is invalid.
15933
15934 -fstrict-overflow
15935 This option implies -fno-wrapv -fno-wrapv-pointer and when negated
15936 implies -fwrapv -fwrapv-pointer.
15937
15938 -fexceptions
15939 Enable exception handling. Generates extra code needed to
15940 propagate exceptions. For some targets, this implies GCC generates
15941 frame unwind information for all functions, which can produce
15942 significant data size overhead, although it does not affect
15943 execution. If you do not specify this option, GCC enables it by
15944 default for languages like C++ that normally require exception
15945 handling, and disables it for languages like C that do not normally
15946 require it. However, you may need to enable this option when
15947 compiling C code that needs to interoperate properly with exception
15948 handlers written in C++. You may also wish to disable this option
15949 if you are compiling older C++ programs that don't use exception
15950 handling.
15951
15952 -fnon-call-exceptions
15953 Generate code that allows trapping instructions to throw
15954 exceptions. Note that this requires platform-specific runtime
15955 support that does not exist everywhere. Moreover, it only allows
15956 trapping instructions to throw exceptions, i.e. memory references
15957 or floating-point instructions. It does not allow exceptions to be
15958 thrown from arbitrary signal handlers such as "SIGALRM". This
15959 enables -fexceptions.
15960
15961 -fdelete-dead-exceptions
15962 Consider that instructions that may throw exceptions but don't
15963 otherwise contribute to the execution of the program can be
15964 optimized away. This does not affect calls to functions except
15965 those with the "pure" or "const" attributes. This option is
15966 enabled by default for the Ada and C++ compilers, as permitted by
15967 the language specifications. Optimization passes that cause dead
15968 exceptions to be removed are enabled independently at different
15969 optimization levels.
15970
15971 -funwind-tables
15972 Similar to -fexceptions, except that it just generates any needed
15973 static data, but does not affect the generated code in any other
15974 way. You normally do not need to enable this option; instead, a
15975 language processor that needs this handling enables it on your
15976 behalf.
15977
15978 -fasynchronous-unwind-tables
15979 Generate unwind table in DWARF format, if supported by target
15980 machine. The table is exact at each instruction boundary, so it
15981 can be used for stack unwinding from asynchronous events (such as
15982 debugger or garbage collector).
15983
15984 -fno-gnu-unique
15985 On systems with recent GNU assembler and C library, the C++
15986 compiler uses the "STB_GNU_UNIQUE" binding to make sure that
15987 definitions of template static data members and static local
15988 variables in inline functions are unique even in the presence of
15989 "RTLD_LOCAL"; this is necessary to avoid problems with a library
15990 used by two different "RTLD_LOCAL" plugins depending on a
15991 definition in one of them and therefore disagreeing with the other
15992 one about the binding of the symbol. But this causes "dlclose" to
15993 be ignored for affected DSOs; if your program relies on
15994 reinitialization of a DSO via "dlclose" and "dlopen", you can use
15995 -fno-gnu-unique.
15996
15997 -fpcc-struct-return
15998 Return "short" "struct" and "union" values in memory like longer
15999 ones, rather than in registers. This convention is less efficient,
16000 but it has the advantage of allowing intercallability between GCC-
16001 compiled files and files compiled with other compilers,
16002 particularly the Portable C Compiler (pcc).
16003
16004 The precise convention for returning structures in memory depends
16005 on the target configuration macros.
16006
16007 Short structures and unions are those whose size and alignment
16008 match that of some integer type.
16009
16010 Warning: code compiled with the -fpcc-struct-return switch is not
16011 binary compatible with code compiled with the -freg-struct-return
16012 switch. Use it to conform to a non-default application binary
16013 interface.
16014
16015 -freg-struct-return
16016 Return "struct" and "union" values in registers when possible.
16017 This is more efficient for small structures than
16018 -fpcc-struct-return.
16019
16020 If you specify neither -fpcc-struct-return nor -freg-struct-return,
16021 GCC defaults to whichever convention is standard for the target.
16022 If there is no standard convention, GCC defaults to
16023 -fpcc-struct-return, except on targets where GCC is the principal
16024 compiler. In those cases, we can choose the standard, and we chose
16025 the more efficient register return alternative.
16026
16027 Warning: code compiled with the -freg-struct-return switch is not
16028 binary compatible with code compiled with the -fpcc-struct-return
16029 switch. Use it to conform to a non-default application binary
16030 interface.
16031
16032 -fshort-enums
16033 Allocate to an "enum" type only as many bytes as it needs for the
16034 declared range of possible values. Specifically, the "enum" type
16035 is equivalent to the smallest integer type that has enough room.
16036
16037 Warning: the -fshort-enums switch causes GCC to generate code that
16038 is not binary compatible with code generated without that switch.
16039 Use it to conform to a non-default application binary interface.
16040
16041 -fshort-wchar
16042 Override the underlying type for "wchar_t" to be "short unsigned
16043 int" instead of the default for the target. This option is useful
16044 for building programs to run under WINE.
16045
16046 Warning: the -fshort-wchar switch causes GCC to generate code that
16047 is not binary compatible with code generated without that switch.
16048 Use it to conform to a non-default application binary interface.
16049
16050 -fcommon
16051 In C code, this option controls the placement of global variables
16052 defined without an initializer, known as tentative definitions in
16053 the C standard. Tentative definitions are distinct from
16054 declarations of a variable with the "extern" keyword, which do not
16055 allocate storage.
16056
16057 The default is -fno-common, which specifies that the compiler
16058 places uninitialized global variables in the BSS section of the
16059 object file. This inhibits the merging of tentative definitions by
16060 the linker so you get a multiple-definition error if the same
16061 variable is accidentally defined in more than one compilation unit.
16062
16063 The -fcommon places uninitialized global variables in a common
16064 block. This allows the linker to resolve all tentative definitions
16065 of the same variable in different compilation units to the same
16066 object, or to a non-tentative definition. This behavior is
16067 inconsistent with C++, and on many targets implies a speed and code
16068 size penalty on global variable references. It is mainly useful to
16069 enable legacy code to link without errors.
16070
16071 -fno-ident
16072 Ignore the "#ident" directive.
16073
16074 -finhibit-size-directive
16075 Don't output a ".size" assembler directive, or anything else that
16076 would cause trouble if the function is split in the middle, and the
16077 two halves are placed at locations far apart in memory. This
16078 option is used when compiling crtstuff.c; you should not need to
16079 use it for anything else.
16080
16081 -fverbose-asm
16082 Put extra commentary information in the generated assembly code to
16083 make it more readable. This option is generally only of use to
16084 those who actually need to read the generated assembly code
16085 (perhaps while debugging the compiler itself).
16086
16087 -fno-verbose-asm, the default, causes the extra information to be
16088 omitted and is useful when comparing two assembler files.
16089
16090 The added comments include:
16091
16092 * information on the compiler version and command-line options,
16093
16094 * the source code lines associated with the assembly
16095 instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE,
16096
16097 * hints on which high-level expressions correspond to the various
16098 assembly instruction operands.
16099
16100 For example, given this C source file:
16101
16102 int test (int n)
16103 {
16104 int i;
16105 int total = 0;
16106
16107 for (i = 0; i < n; i++)
16108 total += i * i;
16109
16110 return total;
16111 }
16112
16113 compiling to (x86_64) assembly via -S and emitting the result
16114 direct to stdout via -o -
16115
16116 gcc -S test.c -fverbose-asm -Os -o -
16117
16118 gives output similar to this:
16119
16120 .file "test.c"
16121 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
16122 [...snip...]
16123 # options passed:
16124 [...snip...]
16125
16126 .text
16127 .globl test
16128 .type test, @function
16129 test:
16130 .LFB0:
16131 .cfi_startproc
16132 # test.c:4: int total = 0;
16133 xorl %eax, %eax # <retval>
16134 # test.c:6: for (i = 0; i < n; i++)
16135 xorl %edx, %edx # i
16136 .L2:
16137 # test.c:6: for (i = 0; i < n; i++)
16138 cmpl %edi, %edx # n, i
16139 jge .L5 #,
16140 # test.c:7: total += i * i;
16141 movl %edx, %ecx # i, tmp92
16142 imull %edx, %ecx # i, tmp92
16143 # test.c:6: for (i = 0; i < n; i++)
16144 incl %edx # i
16145 # test.c:7: total += i * i;
16146 addl %ecx, %eax # tmp92, <retval>
16147 jmp .L2 #
16148 .L5:
16149 # test.c:10: }
16150 ret
16151 .cfi_endproc
16152 .LFE0:
16153 .size test, .-test
16154 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
16155 .section .note.GNU-stack,"",@progbits
16156
16157 The comments are intended for humans rather than machines and hence
16158 the precise format of the comments is subject to change.
16159
16160 -frecord-gcc-switches
16161 This switch causes the command line used to invoke the compiler to
16162 be recorded into the object file that is being created. This
16163 switch is only implemented on some targets and the exact format of
16164 the recording is target and binary file format dependent, but it
16165 usually takes the form of a section containing ASCII text. This
16166 switch is related to the -fverbose-asm switch, but that switch only
16167 records information in the assembler output file as comments, so it
16168 never reaches the object file. See also -grecord-gcc-switches for
16169 another way of storing compiler options into the object file.
16170
16171 -fpic
16172 Generate position-independent code (PIC) suitable for use in a
16173 shared library, if supported for the target machine. Such code
16174 accesses all constant addresses through a global offset table
16175 (GOT). The dynamic loader resolves the GOT entries when the
16176 program starts (the dynamic loader is not part of GCC; it is part
16177 of the operating system). If the GOT size for the linked
16178 executable exceeds a machine-specific maximum size, you get an
16179 error message from the linker indicating that -fpic does not work;
16180 in that case, recompile with -fPIC instead. (These maximums are 8k
16181 on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The
16182 x86 has no such limit.)
16183
16184 Position-independent code requires special support, and therefore
16185 works only on certain machines. For the x86, GCC supports PIC for
16186 System V but not for the Sun 386i. Code generated for the IBM
16187 RS/6000 is always position-independent.
16188
16189 When this flag is set, the macros "__pic__" and "__PIC__" are
16190 defined to 1.
16191
16192 -fPIC
16193 If supported for the target machine, emit position-independent
16194 code, suitable for dynamic linking and avoiding any limit on the
16195 size of the global offset table. This option makes a difference on
16196 AArch64, m68k, PowerPC and SPARC.
16197
16198 Position-independent code requires special support, and therefore
16199 works only on certain machines.
16200
16201 When this flag is set, the macros "__pic__" and "__PIC__" are
16202 defined to 2.
16203
16204 -fpie
16205 -fPIE
16206 These options are similar to -fpic and -fPIC, but the generated
16207 position-independent code can be only linked into executables.
16208 Usually these options are used to compile code that will be linked
16209 using the -pie GCC option.
16210
16211 -fpie and -fPIE both define the macros "__pie__" and "__PIE__".
16212 The macros have the value 1 for -fpie and 2 for -fPIE.
16213
16214 -fno-plt
16215 Do not use the PLT for external function calls in position-
16216 independent code. Instead, load the callee address at call sites
16217 from the GOT and branch to it. This leads to more efficient code
16218 by eliminating PLT stubs and exposing GOT loads to optimizations.
16219 On architectures such as 32-bit x86 where PLT stubs expect the GOT
16220 pointer in a specific register, this gives more register allocation
16221 freedom to the compiler. Lazy binding requires use of the PLT;
16222 with -fno-plt all external symbols are resolved at load time.
16223
16224 Alternatively, the function attribute "noplt" can be used to avoid
16225 calls through the PLT for specific external functions.
16226
16227 In position-dependent code, a few targets also convert calls to
16228 functions that are marked to not use the PLT to use the GOT
16229 instead.
16230
16231 -fno-jump-tables
16232 Do not use jump tables for switch statements even where it would be
16233 more efficient than other code generation strategies. This option
16234 is of use in conjunction with -fpic or -fPIC for building code that
16235 forms part of a dynamic linker and cannot reference the address of
16236 a jump table. On some targets, jump tables do not require a GOT
16237 and this option is not needed.
16238
16239 -fno-bit-tests
16240 Do not use bit tests for switch statements even where it would be
16241 more efficient than other code generation strategies.
16242
16243 -ffixed-reg
16244 Treat the register named reg as a fixed register; generated code
16245 should never refer to it (except perhaps as a stack pointer, frame
16246 pointer or in some other fixed role).
16247
16248 reg must be the name of a register. The register names accepted
16249 are machine-specific and are defined in the "REGISTER_NAMES" macro
16250 in the machine description macro file.
16251
16252 This flag does not have a negative form, because it specifies a
16253 three-way choice.
16254
16255 -fcall-used-reg
16256 Treat the register named reg as an allocable register that is
16257 clobbered by function calls. It may be allocated for temporaries
16258 or variables that do not live across a call. Functions compiled
16259 this way do not save and restore the register reg.
16260
16261 It is an error to use this flag with the frame pointer or stack
16262 pointer. Use of this flag for other registers that have fixed
16263 pervasive roles in the machine's execution model produces
16264 disastrous results.
16265
16266 This flag does not have a negative form, because it specifies a
16267 three-way choice.
16268
16269 -fcall-saved-reg
16270 Treat the register named reg as an allocable register saved by
16271 functions. It may be allocated even for temporaries or variables
16272 that live across a call. Functions compiled this way save and
16273 restore the register reg if they use it.
16274
16275 It is an error to use this flag with the frame pointer or stack
16276 pointer. Use of this flag for other registers that have fixed
16277 pervasive roles in the machine's execution model produces
16278 disastrous results.
16279
16280 A different sort of disaster results from the use of this flag for
16281 a register in which function values may be returned.
16282
16283 This flag does not have a negative form, because it specifies a
16284 three-way choice.
16285
16286 -fpack-struct[=n]
16287 Without a value specified, pack all structure members together
16288 without holes. When a value is specified (which must be a small
16289 power of two), pack structure members according to this value,
16290 representing the maximum alignment (that is, objects with default
16291 alignment requirements larger than this are output potentially
16292 unaligned at the next fitting location.
16293
16294 Warning: the -fpack-struct switch causes GCC to generate code that
16295 is not binary compatible with code generated without that switch.
16296 Additionally, it makes the code suboptimal. Use it to conform to a
16297 non-default application binary interface.
16298
16299 -fleading-underscore
16300 This option and its counterpart, -fno-leading-underscore, forcibly
16301 change the way C symbols are represented in the object file. One
16302 use is to help link with legacy assembly code.
16303
16304 Warning: the -fleading-underscore switch causes GCC to generate
16305 code that is not binary compatible with code generated without that
16306 switch. Use it to conform to a non-default application binary
16307 interface. Not all targets provide complete support for this
16308 switch.
16309
16310 -ftls-model=model
16311 Alter the thread-local storage model to be used. The model
16312 argument should be one of global-dynamic, local-dynamic, initial-
16313 exec or local-exec. Note that the choice is subject to
16314 optimization: the compiler may use a more efficient model for
16315 symbols not visible outside of the translation unit, or if -fpic is
16316 not given on the command line.
16317
16318 The default without -fpic is initial-exec; with -fpic the default
16319 is global-dynamic.
16320
16321 -ftrampolines
16322 For targets that normally need trampolines for nested functions,
16323 always generate them instead of using descriptors. Otherwise, for
16324 targets that do not need them, like for example HP-PA or IA-64, do
16325 nothing.
16326
16327 A trampoline is a small piece of code that is created at run time
16328 on the stack when the address of a nested function is taken, and is
16329 used to call the nested function indirectly. Therefore, it
16330 requires the stack to be made executable in order for the program
16331 to work properly.
16332
16333 -fno-trampolines is enabled by default on a language by language
16334 basis to let the compiler avoid generating them, if it computes
16335 that this is safe, and replace them with descriptors. Descriptors
16336 are made up of data only, but the generated code must be prepared
16337 to deal with them. As of this writing, -fno-trampolines is enabled
16338 by default only for Ada.
16339
16340 Moreover, code compiled with -ftrampolines and code compiled with
16341 -fno-trampolines are not binary compatible if nested functions are
16342 present. This option must therefore be used on a program-wide
16343 basis and be manipulated with extreme care.
16344
16345 For languages other than Ada, the "-ftrampolines" and
16346 "-fno-trampolines" options currently have no effect, and
16347 trampolines are always generated on platforms that need them for
16348 nested functions.
16349
16350 -fvisibility=[default|internal|hidden|protected]
16351 Set the default ELF image symbol visibility to the specified
16352 option---all symbols are marked with this unless overridden within
16353 the code. Using this feature can very substantially improve
16354 linking and load times of shared object libraries, produce more
16355 optimized code, provide near-perfect API export and prevent symbol
16356 clashes. It is strongly recommended that you use this in any
16357 shared objects you distribute.
16358
16359 Despite the nomenclature, default always means public; i.e.,
16360 available to be linked against from outside the shared object.
16361 protected and internal are pretty useless in real-world usage so
16362 the only other commonly used option is hidden. The default if
16363 -fvisibility isn't specified is default, i.e., make every symbol
16364 public.
16365
16366 A good explanation of the benefits offered by ensuring ELF symbols
16367 have the correct visibility is given by "How To Write Shared
16368 Libraries" by Ulrich Drepper (which can be found at
16369 <https://www.akkadia.org/drepper/>)---however a superior solution
16370 made possible by this option to marking things hidden when the
16371 default is public is to make the default hidden and mark things
16372 public. This is the norm with DLLs on Windows and with
16373 -fvisibility=hidden and "__attribute__ ((visibility("default")))"
16374 instead of "__declspec(dllexport)" you get almost identical
16375 semantics with identical syntax. This is a great boon to those
16376 working with cross-platform projects.
16377
16378 For those adding visibility support to existing code, you may find
16379 "#pragma GCC visibility" of use. This works by you enclosing the
16380 declarations you wish to set visibility for with (for example)
16381 "#pragma GCC visibility push(hidden)" and "#pragma GCC visibility
16382 pop". Bear in mind that symbol visibility should be viewed as part
16383 of the API interface contract and thus all new code should always
16384 specify visibility when it is not the default; i.e., declarations
16385 only for use within the local DSO should always be marked
16386 explicitly as hidden as so to avoid PLT indirection
16387 overheads---making this abundantly clear also aids readability and
16388 self-documentation of the code. Note that due to ISO C++
16389 specification requirements, "operator new" and "operator delete"
16390 must always be of default visibility.
16391
16392 Be aware that headers from outside your project, in particular
16393 system headers and headers from any other library you use, may not
16394 be expecting to be compiled with visibility other than the default.
16395 You may need to explicitly say "#pragma GCC visibility
16396 push(default)" before including any such headers.
16397
16398 "extern" declarations are not affected by -fvisibility, so a lot of
16399 code can be recompiled with -fvisibility=hidden with no
16400 modifications. However, this means that calls to "extern"
16401 functions with no explicit visibility use the PLT, so it is more
16402 effective to use "__attribute ((visibility))" and/or "#pragma GCC
16403 visibility" to tell the compiler which "extern" declarations should
16404 be treated as hidden.
16405
16406 Note that -fvisibility does affect C++ vague linkage entities. This
16407 means that, for instance, an exception class that is be thrown
16408 between DSOs must be explicitly marked with default visibility so
16409 that the type_info nodes are unified between the DSOs.
16410
16411 An overview of these techniques, their benefits and how to use them
16412 is at <https://gcc.gnu.org/wiki/Visibility>.
16413
16414 -fstrict-volatile-bitfields
16415 This option should be used if accesses to volatile bit-fields (or
16416 other structure fields, although the compiler usually honors those
16417 types anyway) should use a single access of the width of the
16418 field's type, aligned to a natural alignment if possible. For
16419 example, targets with memory-mapped peripheral registers might
16420 require all such accesses to be 16 bits wide; with this flag you
16421 can declare all peripheral bit-fields as "unsigned short" (assuming
16422 short is 16 bits on these targets) to force GCC to use 16-bit
16423 accesses instead of, perhaps, a more efficient 32-bit access.
16424
16425 If this option is disabled, the compiler uses the most efficient
16426 instruction. In the previous example, that might be a 32-bit load
16427 instruction, even though that accesses bytes that do not contain
16428 any portion of the bit-field, or memory-mapped registers unrelated
16429 to the one being updated.
16430
16431 In some cases, such as when the "packed" attribute is applied to a
16432 structure field, it may not be possible to access the field with a
16433 single read or write that is correctly aligned for the target
16434 machine. In this case GCC falls back to generating multiple
16435 accesses rather than code that will fault or truncate the result at
16436 run time.
16437
16438 Note: Due to restrictions of the C/C++11 memory model, write
16439 accesses are not allowed to touch non bit-field members. It is
16440 therefore recommended to define all bits of the field's type as
16441 bit-field members.
16442
16443 The default value of this option is determined by the application
16444 binary interface for the target processor.
16445
16446 -fsync-libcalls
16447 This option controls whether any out-of-line instance of the
16448 "__sync" family of functions may be used to implement the C++11
16449 "__atomic" family of functions.
16450
16451 The default value of this option is enabled, thus the only useful
16452 form of the option is -fno-sync-libcalls. This option is used in
16453 the implementation of the libatomic runtime library.
16454
16455 GCC Developer Options
16456 This section describes command-line options that are primarily of
16457 interest to GCC developers, including options to support compiler
16458 testing and investigation of compiler bugs and compile-time performance
16459 problems. This includes options that produce debug dumps at various
16460 points in the compilation; that print statistics such as memory use and
16461 execution time; and that print information about GCC's configuration,
16462 such as where it searches for libraries. You should rarely need to use
16463 any of these options for ordinary compilation and linking tasks.
16464
16465 Many developer options that cause GCC to dump output to a file take an
16466 optional =filename suffix. You can specify stdout or - to dump to
16467 standard output, and stderr for standard error.
16468
16469 If =filename is omitted, a default dump file name is constructed by
16470 concatenating the base dump file name, a pass number, phase letter, and
16471 pass name. The base dump file name is the name of output file produced
16472 by the compiler if explicitly specified and not an executable;
16473 otherwise it is the source file name. The pass number is determined by
16474 the order passes are registered with the compiler's pass manager. This
16475 is generally the same as the order of execution, but passes registered
16476 by plugins, target-specific passes, or passes that are otherwise
16477 registered late are numbered higher than the pass named final, even if
16478 they are executed earlier. The phase letter is one of i (inter-
16479 procedural analysis), l (language-specific), r (RTL), or t (tree). The
16480 files are created in the directory of the output file.
16481
16482 -fcallgraph-info
16483 -fcallgraph-info=MARKERS
16484 Makes the compiler output callgraph information for the program, on
16485 a per-object-file basis. The information is generated in the
16486 common VCG format. It can be decorated with additional, per-node
16487 and/or per-edge information, if a list of comma-separated markers
16488 is additionally specified. When the "su" marker is specified, the
16489 callgraph is decorated with stack usage information; it is
16490 equivalent to -fstack-usage. When the "da" marker is specified,
16491 the callgraph is decorated with information about dynamically
16492 allocated objects.
16493
16494 When compiling with -flto, no callgraph information is output along
16495 with the object file. At LTO link time, -fcallgraph-info may
16496 generate multiple callgraph information files next to intermediate
16497 LTO output files.
16498
16499 -dletters
16500 -fdump-rtl-pass
16501 -fdump-rtl-pass=filename
16502 Says to make debugging dumps during compilation at times specified
16503 by letters. This is used for debugging the RTL-based passes of the
16504 compiler.
16505
16506 Some -dletters switches have different meaning when -E is used for
16507 preprocessing.
16508
16509 Debug dumps can be enabled with a -fdump-rtl switch or some -d
16510 option letters. Here are the possible letters for use in pass and
16511 letters, and their meanings:
16512
16513 -fdump-rtl-alignments
16514 Dump after branch alignments have been computed.
16515
16516 -fdump-rtl-asmcons
16517 Dump after fixing rtl statements that have unsatisfied in/out
16518 constraints.
16519
16520 -fdump-rtl-auto_inc_dec
16521 Dump after auto-inc-dec discovery. This pass is only run on
16522 architectures that have auto inc or auto dec instructions.
16523
16524 -fdump-rtl-barriers
16525 Dump after cleaning up the barrier instructions.
16526
16527 -fdump-rtl-bbpart
16528 Dump after partitioning hot and cold basic blocks.
16529
16530 -fdump-rtl-bbro
16531 Dump after block reordering.
16532
16533 -fdump-rtl-btl1
16534 -fdump-rtl-btl2
16535 -fdump-rtl-btl1 and -fdump-rtl-btl2 enable dumping after the
16536 two branch target load optimization passes.
16537
16538 -fdump-rtl-bypass
16539 Dump after jump bypassing and control flow optimizations.
16540
16541 -fdump-rtl-combine
16542 Dump after the RTL instruction combination pass.
16543
16544 -fdump-rtl-compgotos
16545 Dump after duplicating the computed gotos.
16546
16547 -fdump-rtl-ce1
16548 -fdump-rtl-ce2
16549 -fdump-rtl-ce3
16550 -fdump-rtl-ce1, -fdump-rtl-ce2, and -fdump-rtl-ce3 enable
16551 dumping after the three if conversion passes.
16552
16553 -fdump-rtl-cprop_hardreg
16554 Dump after hard register copy propagation.
16555
16556 -fdump-rtl-csa
16557 Dump after combining stack adjustments.
16558
16559 -fdump-rtl-cse1
16560 -fdump-rtl-cse2
16561 -fdump-rtl-cse1 and -fdump-rtl-cse2 enable dumping after the
16562 two common subexpression elimination passes.
16563
16564 -fdump-rtl-dce
16565 Dump after the standalone dead code elimination passes.
16566
16567 -fdump-rtl-dbr
16568 Dump after delayed branch scheduling.
16569
16570 -fdump-rtl-dce1
16571 -fdump-rtl-dce2
16572 -fdump-rtl-dce1 and -fdump-rtl-dce2 enable dumping after the
16573 two dead store elimination passes.
16574
16575 -fdump-rtl-eh
16576 Dump after finalization of EH handling code.
16577
16578 -fdump-rtl-eh_ranges
16579 Dump after conversion of EH handling range regions.
16580
16581 -fdump-rtl-expand
16582 Dump after RTL generation.
16583
16584 -fdump-rtl-fwprop1
16585 -fdump-rtl-fwprop2
16586 -fdump-rtl-fwprop1 and -fdump-rtl-fwprop2 enable dumping after
16587 the two forward propagation passes.
16588
16589 -fdump-rtl-gcse1
16590 -fdump-rtl-gcse2
16591 -fdump-rtl-gcse1 and -fdump-rtl-gcse2 enable dumping after
16592 global common subexpression elimination.
16593
16594 -fdump-rtl-init-regs
16595 Dump after the initialization of the registers.
16596
16597 -fdump-rtl-initvals
16598 Dump after the computation of the initial value sets.
16599
16600 -fdump-rtl-into_cfglayout
16601 Dump after converting to cfglayout mode.
16602
16603 -fdump-rtl-ira
16604 Dump after iterated register allocation.
16605
16606 -fdump-rtl-jump
16607 Dump after the second jump optimization.
16608
16609 -fdump-rtl-loop2
16610 -fdump-rtl-loop2 enables dumping after the rtl loop
16611 optimization passes.
16612
16613 -fdump-rtl-mach
16614 Dump after performing the machine dependent reorganization
16615 pass, if that pass exists.
16616
16617 -fdump-rtl-mode_sw
16618 Dump after removing redundant mode switches.
16619
16620 -fdump-rtl-rnreg
16621 Dump after register renumbering.
16622
16623 -fdump-rtl-outof_cfglayout
16624 Dump after converting from cfglayout mode.
16625
16626 -fdump-rtl-peephole2
16627 Dump after the peephole pass.
16628
16629 -fdump-rtl-postreload
16630 Dump after post-reload optimizations.
16631
16632 -fdump-rtl-pro_and_epilogue
16633 Dump after generating the function prologues and epilogues.
16634
16635 -fdump-rtl-sched1
16636 -fdump-rtl-sched2
16637 -fdump-rtl-sched1 and -fdump-rtl-sched2 enable dumping after
16638 the basic block scheduling passes.
16639
16640 -fdump-rtl-ree
16641 Dump after sign/zero extension elimination.
16642
16643 -fdump-rtl-seqabstr
16644 Dump after common sequence discovery.
16645
16646 -fdump-rtl-shorten
16647 Dump after shortening branches.
16648
16649 -fdump-rtl-sibling
16650 Dump after sibling call optimizations.
16651
16652 -fdump-rtl-split1
16653 -fdump-rtl-split2
16654 -fdump-rtl-split3
16655 -fdump-rtl-split4
16656 -fdump-rtl-split5
16657 These options enable dumping after five rounds of instruction
16658 splitting.
16659
16660 -fdump-rtl-sms
16661 Dump after modulo scheduling. This pass is only run on some
16662 architectures.
16663
16664 -fdump-rtl-stack
16665 Dump after conversion from GCC's "flat register file" registers
16666 to the x87's stack-like registers. This pass is only run on
16667 x86 variants.
16668
16669 -fdump-rtl-subreg1
16670 -fdump-rtl-subreg2
16671 -fdump-rtl-subreg1 and -fdump-rtl-subreg2 enable dumping after
16672 the two subreg expansion passes.
16673
16674 -fdump-rtl-unshare
16675 Dump after all rtl has been unshared.
16676
16677 -fdump-rtl-vartrack
16678 Dump after variable tracking.
16679
16680 -fdump-rtl-vregs
16681 Dump after converting virtual registers to hard registers.
16682
16683 -fdump-rtl-web
16684 Dump after live range splitting.
16685
16686 -fdump-rtl-regclass
16687 -fdump-rtl-subregs_of_mode_init
16688 -fdump-rtl-subregs_of_mode_finish
16689 -fdump-rtl-dfinit
16690 -fdump-rtl-dfinish
16691 These dumps are defined but always produce empty files.
16692
16693 -da
16694 -fdump-rtl-all
16695 Produce all the dumps listed above.
16696
16697 -dA Annotate the assembler output with miscellaneous debugging
16698 information.
16699
16700 -dD Dump all macro definitions, at the end of preprocessing, in
16701 addition to normal output.
16702
16703 -dH Produce a core dump whenever an error occurs.
16704
16705 -dp Annotate the assembler output with a comment indicating which
16706 pattern and alternative is used. The length and cost of each
16707 instruction are also printed.
16708
16709 -dP Dump the RTL in the assembler output as a comment before each
16710 instruction. Also turns on -dp annotation.
16711
16712 -dx Just generate RTL for a function instead of compiling it.
16713 Usually used with -fdump-rtl-expand.
16714
16715 -fdump-debug
16716 Dump debugging information generated during the debug generation
16717 phase.
16718
16719 -fdump-earlydebug
16720 Dump debugging information generated during the early debug
16721 generation phase.
16722
16723 -fdump-noaddr
16724 When doing debugging dumps, suppress address output. This makes it
16725 more feasible to use diff on debugging dumps for compiler
16726 invocations with different compiler binaries and/or different text
16727 / bss / data / heap / stack / dso start locations.
16728
16729 -freport-bug
16730 Collect and dump debug information into a temporary file if an
16731 internal compiler error (ICE) occurs.
16732
16733 -fdump-unnumbered
16734 When doing debugging dumps, suppress instruction numbers and
16735 address output. This makes it more feasible to use diff on
16736 debugging dumps for compiler invocations with different options, in
16737 particular with and without -g.
16738
16739 -fdump-unnumbered-links
16740 When doing debugging dumps (see -d option above), suppress
16741 instruction numbers for the links to the previous and next
16742 instructions in a sequence.
16743
16744 -fdump-ipa-switch
16745 -fdump-ipa-switch-options
16746 Control the dumping at various stages of inter-procedural analysis
16747 language tree to a file. The file name is generated by appending a
16748 switch specific suffix to the source file name, and the file is
16749 created in the same directory as the output file. The following
16750 dumps are possible:
16751
16752 all Enables all inter-procedural analysis dumps.
16753
16754 cgraph
16755 Dumps information about call-graph optimization, unused
16756 function removal, and inlining decisions.
16757
16758 inline
16759 Dump after function inlining.
16760
16761 Additionally, the options -optimized, -missed, -note, and -all can
16762 be provided, with the same meaning as for -fopt-info, defaulting to
16763 -optimized.
16764
16765 For example, -fdump-ipa-inline-optimized-missed will emit
16766 information on callsites that were inlined, along with callsites
16767 that were not inlined.
16768
16769 By default, the dump will contain messages about successful
16770 optimizations (equivalent to -optimized) together with low-level
16771 details about the analysis.
16772
16773 -fdump-lang
16774 Dump language-specific information. The file name is made by
16775 appending .lang to the source file name.
16776
16777 -fdump-lang-all
16778 -fdump-lang-switch
16779 -fdump-lang-switch-options
16780 -fdump-lang-switch-options=filename
16781 Control the dumping of language-specific information. The options
16782 and filename portions behave as described in the -fdump-tree
16783 option. The following switch values are accepted:
16784
16785 all Enable all language-specific dumps.
16786
16787 class
16788 Dump class hierarchy information. Virtual table information is
16789 emitted unless 'slim' is specified. This option is applicable
16790 to C++ only.
16791
16792 module
16793 Dump module information. Options lineno (locations), graph
16794 (reachability), blocks (clusters), uid (serialization), alias
16795 (mergeable), asmname (Elrond), eh (mapper) & vops (macros) may
16796 provide additional information. This option is applicable to
16797 C++ only.
16798
16799 raw Dump the raw internal tree data. This option is applicable to
16800 C++ only.
16801
16802 -fdump-passes
16803 Print on stderr the list of optimization passes that are turned on
16804 and off by the current command-line options.
16805
16806 -fdump-statistics-option
16807 Enable and control dumping of pass statistics in a separate file.
16808 The file name is generated by appending a suffix ending in
16809 .statistics to the source file name, and the file is created in the
16810 same directory as the output file. If the -option form is used,
16811 -stats causes counters to be summed over the whole compilation unit
16812 while -details dumps every event as the passes generate them. The
16813 default with no option is to sum counters for each function
16814 compiled.
16815
16816 -fdump-tree-all
16817 -fdump-tree-switch
16818 -fdump-tree-switch-options
16819 -fdump-tree-switch-options=filename
16820 Control the dumping at various stages of processing the
16821 intermediate language tree to a file. If the -options form is
16822 used, options is a list of - separated options which control the
16823 details of the dump. Not all options are applicable to all dumps;
16824 those that are not meaningful are ignored. The following options
16825 are available
16826
16827 address
16828 Print the address of each node. Usually this is not meaningful
16829 as it changes according to the environment and source file.
16830 Its primary use is for tying up a dump file with a debug
16831 environment.
16832
16833 asmname
16834 If "DECL_ASSEMBLER_NAME" has been set for a given decl, use
16835 that in the dump instead of "DECL_NAME". Its primary use is
16836 ease of use working backward from mangled names in the assembly
16837 file.
16838
16839 slim
16840 When dumping front-end intermediate representations, inhibit
16841 dumping of members of a scope or body of a function merely
16842 because that scope has been reached. Only dump such items when
16843 they are directly reachable by some other path.
16844
16845 When dumping pretty-printed trees, this option inhibits dumping
16846 the bodies of control structures.
16847
16848 When dumping RTL, print the RTL in slim (condensed) form
16849 instead of the default LISP-like representation.
16850
16851 raw Print a raw representation of the tree. By default, trees are
16852 pretty-printed into a C-like representation.
16853
16854 details
16855 Enable more detailed dumps (not honored by every dump option).
16856 Also include information from the optimization passes.
16857
16858 stats
16859 Enable dumping various statistics about the pass (not honored
16860 by every dump option).
16861
16862 blocks
16863 Enable showing basic block boundaries (disabled in raw dumps).
16864
16865 graph
16866 For each of the other indicated dump files (-fdump-rtl-pass),
16867 dump a representation of the control flow graph suitable for
16868 viewing with GraphViz to file.passid.pass.dot. Each function
16869 in the file is pretty-printed as a subgraph, so that GraphViz
16870 can render them all in a single plot.
16871
16872 This option currently only works for RTL dumps, and the RTL is
16873 always dumped in slim form.
16874
16875 vops
16876 Enable showing virtual operands for every statement.
16877
16878 lineno
16879 Enable showing line numbers for statements.
16880
16881 uid Enable showing the unique ID ("DECL_UID") for each variable.
16882
16883 verbose
16884 Enable showing the tree dump for each statement.
16885
16886 eh Enable showing the EH region number holding each statement.
16887
16888 scev
16889 Enable showing scalar evolution analysis details.
16890
16891 optimized
16892 Enable showing optimization information (only available in
16893 certain passes).
16894
16895 missed
16896 Enable showing missed optimization information (only available
16897 in certain passes).
16898
16899 note
16900 Enable other detailed optimization information (only available
16901 in certain passes).
16902
16903 all Turn on all options, except raw, slim, verbose and lineno.
16904
16905 optall
16906 Turn on all optimization options, i.e., optimized, missed, and
16907 note.
16908
16909 To determine what tree dumps are available or find the dump for a
16910 pass of interest follow the steps below.
16911
16912 1. Invoke GCC with -fdump-passes and in the stderr output look for
16913 a code that corresponds to the pass you are interested in. For
16914 example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2"
16915 correspond to the three Value Range Propagation passes. The
16916 number at the end distinguishes distinct invocations of the
16917 same pass.
16918
16919 2. To enable the creation of the dump file, append the pass code
16920 to the -fdump- option prefix and invoke GCC with it. For
16921 example, to enable the dump from the Early Value Range
16922 Propagation pass, invoke GCC with the -fdump-tree-evrp option.
16923 Optionally, you may specify the name of the dump file. If you
16924 don't specify one, GCC creates as described below.
16925
16926 3. Find the pass dump in a file whose name is composed of three
16927 components separated by a period: the name of the source file
16928 GCC was invoked to compile, a numeric suffix indicating the
16929 pass number followed by the letter t for tree passes (and the
16930 letter r for RTL passes), and finally the pass code. For
16931 example, the Early VRP pass dump might be in a file named
16932 myfile.c.038t.evrp in the current working directory. Note that
16933 the numeric codes are not stable and may change from one
16934 version of GCC to another.
16935
16936 -fopt-info
16937 -fopt-info-options
16938 -fopt-info-options=filename
16939 Controls optimization dumps from various optimization passes. If
16940 the -options form is used, options is a list of - separated option
16941 keywords to select the dump details and optimizations.
16942
16943 The options can be divided into three groups:
16944
16945 1. options describing what kinds of messages should be emitted,
16946
16947 2. options describing the verbosity of the dump, and
16948
16949 3. options describing which optimizations should be included.
16950
16951 The options from each group can be freely mixed as they are non-
16952 overlapping. However, in case of any conflicts, the later options
16953 override the earlier options on the command line.
16954
16955 The following options control which kinds of messages should be
16956 emitted:
16957
16958 optimized
16959 Print information when an optimization is successfully applied.
16960 It is up to a pass to decide which information is relevant. For
16961 example, the vectorizer passes print the source location of
16962 loops which are successfully vectorized.
16963
16964 missed
16965 Print information about missed optimizations. Individual passes
16966 control which information to include in the output.
16967
16968 note
16969 Print verbose information about optimizations, such as certain
16970 transformations, more detailed messages about decisions etc.
16971
16972 all Print detailed optimization information. This includes
16973 optimized, missed, and note.
16974
16975 The following option controls the dump verbosity:
16976
16977 internals
16978 By default, only "high-level" messages are emitted. This option
16979 enables additional, more detailed, messages, which are likely
16980 to only be of interest to GCC developers.
16981
16982 One or more of the following option keywords can be used to
16983 describe a group of optimizations:
16984
16985 ipa Enable dumps from all interprocedural optimizations.
16986
16987 loop
16988 Enable dumps from all loop optimizations.
16989
16990 inline
16991 Enable dumps from all inlining optimizations.
16992
16993 omp Enable dumps from all OMP (Offloading and Multi Processing)
16994 optimizations.
16995
16996 vec Enable dumps from all vectorization optimizations.
16997
16998 optall
16999 Enable dumps from all optimizations. This is a superset of the
17000 optimization groups listed above.
17001
17002 If options is omitted, it defaults to optimized-optall, which means
17003 to dump messages about successful optimizations from all the
17004 passes, omitting messages that are treated as "internals".
17005
17006 If the filename is provided, then the dumps from all the applicable
17007 optimizations are concatenated into the filename. Otherwise the
17008 dump is output onto stderr. Though multiple -fopt-info options are
17009 accepted, only one of them can include a filename. If other
17010 filenames are provided then all but the first such option are
17011 ignored.
17012
17013 Note that the output filename is overwritten in case of multiple
17014 translation units. If a combined output from multiple translation
17015 units is desired, stderr should be used instead.
17016
17017 In the following example, the optimization info is output to
17018 stderr:
17019
17020 gcc -O3 -fopt-info
17021
17022 This example:
17023
17024 gcc -O3 -fopt-info-missed=missed.all
17025
17026 outputs missed optimization report from all the passes into
17027 missed.all, and this one:
17028
17029 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
17030
17031 prints information about missed optimization opportunities from
17032 vectorization passes on stderr. Note that -fopt-info-vec-missed is
17033 equivalent to -fopt-info-missed-vec. The order of the optimization
17034 group names and message types listed after -fopt-info does not
17035 matter.
17036
17037 As another example,
17038
17039 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
17040
17041 outputs information about missed optimizations as well as optimized
17042 locations from all the inlining passes into inline.txt.
17043
17044 Finally, consider:
17045
17046 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
17047
17048 Here the two output filenames vec.miss and loop.opt are in conflict
17049 since only one output file is allowed. In this case, only the first
17050 option takes effect and the subsequent options are ignored. Thus
17051 only vec.miss is produced which contains dumps from the vectorizer
17052 about missed opportunities.
17053
17054 -fsave-optimization-record
17055 Write a SRCFILE.opt-record.json.gz file detailing what
17056 optimizations were performed, for those optimizations that support
17057 -fopt-info.
17058
17059 This option is experimental and the format of the data within the
17060 compressed JSON file is subject to change.
17061
17062 It is roughly equivalent to a machine-readable version of
17063 -fopt-info-all, as a collection of messages with source file, line
17064 number and column number, with the following additional data for
17065 each message:
17066
17067 * the execution count of the code being optimized, along with
17068 metadata about whether this was from actual profile data, or
17069 just an estimate, allowing consumers to prioritize messages by
17070 code hotness,
17071
17072 * the function name of the code being optimized, where
17073 applicable,
17074
17075 * the "inlining chain" for the code being optimized, so that when
17076 a function is inlined into several different places (which
17077 might themselves be inlined), the reader can distinguish
17078 between the copies,
17079
17080 * objects identifying those parts of the message that refer to
17081 expressions, statements or symbol-table nodes, which of these
17082 categories they are, and, when available, their source code
17083 location,
17084
17085 * the GCC pass that emitted the message, and
17086
17087 * the location in GCC's own code from which the message was
17088 emitted
17089
17090 Additionally, some messages are logically nested within other
17091 messages, reflecting implementation details of the optimization
17092 passes.
17093
17094 -fsched-verbose=n
17095 On targets that use instruction scheduling, this option controls
17096 the amount of debugging output the scheduler prints to the dump
17097 files.
17098
17099 For n greater than zero, -fsched-verbose outputs the same
17100 information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n
17101 greater than one, it also output basic block probabilities,
17102 detailed ready list information and unit/insn info. For n greater
17103 than two, it includes RTL at abort point, control-flow and regions
17104 info. And for n over four, -fsched-verbose also includes
17105 dependence info.
17106
17107 -fenable-kind-pass
17108 -fdisable-kind-pass=range-list
17109 This is a set of options that are used to explicitly disable/enable
17110 optimization passes. These options are intended for use for
17111 debugging GCC. Compiler users should use regular options for
17112 enabling/disabling passes instead.
17113
17114 -fdisable-ipa-pass
17115 Disable IPA pass pass. pass is the pass name. If the same pass
17116 is statically invoked in the compiler multiple times, the pass
17117 name should be appended with a sequential number starting from
17118 1.
17119
17120 -fdisable-rtl-pass
17121 -fdisable-rtl-pass=range-list
17122 Disable RTL pass pass. pass is the pass name. If the same
17123 pass is statically invoked in the compiler multiple times, the
17124 pass name should be appended with a sequential number starting
17125 from 1. range-list is a comma-separated list of function
17126 ranges or assembler names. Each range is a number pair
17127 separated by a colon. The range is inclusive in both ends. If
17128 the range is trivial, the number pair can be simplified as a
17129 single number. If the function's call graph node's uid falls
17130 within one of the specified ranges, the pass is disabled for
17131 that function. The uid is shown in the function header of a
17132 dump file, and the pass names can be dumped by using option
17133 -fdump-passes.
17134
17135 -fdisable-tree-pass
17136 -fdisable-tree-pass=range-list
17137 Disable tree pass pass. See -fdisable-rtl for the description
17138 of option arguments.
17139
17140 -fenable-ipa-pass
17141 Enable IPA pass pass. pass is the pass name. If the same pass
17142 is statically invoked in the compiler multiple times, the pass
17143 name should be appended with a sequential number starting from
17144 1.
17145
17146 -fenable-rtl-pass
17147 -fenable-rtl-pass=range-list
17148 Enable RTL pass pass. See -fdisable-rtl for option argument
17149 description and examples.
17150
17151 -fenable-tree-pass
17152 -fenable-tree-pass=range-list
17153 Enable tree pass pass. See -fdisable-rtl for the description
17154 of option arguments.
17155
17156 Here are some examples showing uses of these options.
17157
17158 # disable ccp1 for all functions
17159 -fdisable-tree-ccp1
17160 # disable complete unroll for function whose cgraph node uid is 1
17161 -fenable-tree-cunroll=1
17162 # disable gcse2 for functions at the following ranges [1,1],
17163 # [300,400], and [400,1000]
17164 # disable gcse2 for functions foo and foo2
17165 -fdisable-rtl-gcse2=foo,foo2
17166 # disable early inlining
17167 -fdisable-tree-einline
17168 # disable ipa inlining
17169 -fdisable-ipa-inline
17170 # enable tree full unroll
17171 -fenable-tree-unroll
17172
17173 -fchecking
17174 -fchecking=n
17175 Enable internal consistency checking. The default depends on the
17176 compiler configuration. -fchecking=2 enables further internal
17177 consistency checking that might affect code generation.
17178
17179 -frandom-seed=string
17180 This option provides a seed that GCC uses in place of random
17181 numbers in generating certain symbol names that have to be
17182 different in every compiled file. It is also used to place unique
17183 stamps in coverage data files and the object files that produce
17184 them. You can use the -frandom-seed option to produce reproducibly
17185 identical object files.
17186
17187 The string can either be a number (decimal, octal or hex) or an
17188 arbitrary string (in which case it's converted to a number by
17189 computing CRC32).
17190
17191 The string should be different for every file you compile.
17192
17193 -save-temps
17194 Store the usual "temporary" intermediate files permanently; name
17195 them as auxiliary output files, as specified described under
17196 -dumpbase and -dumpdir.
17197
17198 When used in combination with the -x command-line option,
17199 -save-temps is sensible enough to avoid overwriting an input source
17200 file with the same extension as an intermediate file. The
17201 corresponding intermediate file may be obtained by renaming the
17202 source file before using -save-temps.
17203
17204 -save-temps=cwd
17205 Equivalent to -save-temps -dumpdir ./.
17206
17207 -save-temps=obj
17208 Equivalent to -save-temps -dumpdir outdir/, where outdir/ is the
17209 directory of the output file specified after the -o option,
17210 including any directory separators. If the -o option is not used,
17211 the -save-temps=obj switch behaves like -save-temps=cwd.
17212
17213 -time[=file]
17214 Report the CPU time taken by each subprocess in the compilation
17215 sequence. For C source files, this is the compiler proper and
17216 assembler (plus the linker if linking is done).
17217
17218 Without the specification of an output file, the output looks like
17219 this:
17220
17221 # cc1 0.12 0.01
17222 # as 0.00 0.01
17223
17224 The first number on each line is the "user time", that is time
17225 spent executing the program itself. The second number is "system
17226 time", time spent executing operating system routines on behalf of
17227 the program. Both numbers are in seconds.
17228
17229 With the specification of an output file, the output is appended to
17230 the named file, and it looks like this:
17231
17232 0.12 0.01 cc1 <options>
17233 0.00 0.01 as <options>
17234
17235 The "user time" and the "system time" are moved before the program
17236 name, and the options passed to the program are displayed, so that
17237 one can later tell what file was being compiled, and with which
17238 options.
17239
17240 -fdump-final-insns[=file]
17241 Dump the final internal representation (RTL) to file. If the
17242 optional argument is omitted (or if file is "."), the name of the
17243 dump file is determined by appending ".gkd" to the dump base name,
17244 see -dumpbase.
17245
17246 -fcompare-debug[=opts]
17247 If no error occurs during compilation, run the compiler a second
17248 time, adding opts and -fcompare-debug-second to the arguments
17249 passed to the second compilation. Dump the final internal
17250 representation in both compilations, and print an error if they
17251 differ.
17252
17253 If the equal sign is omitted, the default -gtoggle is used.
17254
17255 The environment variable GCC_COMPARE_DEBUG, if defined, non-empty
17256 and nonzero, implicitly enables -fcompare-debug. If
17257 GCC_COMPARE_DEBUG is defined to a string starting with a dash, then
17258 it is used for opts, otherwise the default -gtoggle is used.
17259
17260 -fcompare-debug=, with the equal sign but without opts, is
17261 equivalent to -fno-compare-debug, which disables the dumping of the
17262 final representation and the second compilation, preventing even
17263 GCC_COMPARE_DEBUG from taking effect.
17264
17265 To verify full coverage during -fcompare-debug testing, set
17266 GCC_COMPARE_DEBUG to say -fcompare-debug-not-overridden, which GCC
17267 rejects as an invalid option in any actual compilation (rather than
17268 preprocessing, assembly or linking). To get just a warning,
17269 setting GCC_COMPARE_DEBUG to -w%n-fcompare-debug not overridden
17270 will do.
17271
17272 -fcompare-debug-second
17273 This option is implicitly passed to the compiler for the second
17274 compilation requested by -fcompare-debug, along with options to
17275 silence warnings, and omitting other options that would cause the
17276 compiler to produce output to files or to standard output as a side
17277 effect. Dump files and preserved temporary files are renamed so as
17278 to contain the ".gk" additional extension during the second
17279 compilation, to avoid overwriting those generated by the first.
17280
17281 When this option is passed to the compiler driver, it causes the
17282 first compilation to be skipped, which makes it useful for little
17283 other than debugging the compiler proper.
17284
17285 -gtoggle
17286 Turn off generation of debug info, if leaving out this option
17287 generates it, or turn it on at level 2 otherwise. The position of
17288 this argument in the command line does not matter; it takes effect
17289 after all other options are processed, and it does so only once, no
17290 matter how many times it is given. This is mainly intended to be
17291 used with -fcompare-debug.
17292
17293 -fvar-tracking-assignments-toggle
17294 Toggle -fvar-tracking-assignments, in the same way that -gtoggle
17295 toggles -g.
17296
17297 -Q Makes the compiler print out each function name as it is compiled,
17298 and print some statistics about each pass when it finishes.
17299
17300 -ftime-report
17301 Makes the compiler print some statistics about the time consumed by
17302 each pass when it finishes.
17303
17304 -ftime-report-details
17305 Record the time consumed by infrastructure parts separately for
17306 each pass.
17307
17308 -fira-verbose=n
17309 Control the verbosity of the dump file for the integrated register
17310 allocator. The default value is 5. If the value n is greater or
17311 equal to 10, the dump output is sent to stderr using the same
17312 format as n minus 10.
17313
17314 -flto-report
17315 Prints a report with internal details on the workings of the link-
17316 time optimizer. The contents of this report vary from version to
17317 version. It is meant to be useful to GCC developers when
17318 processing object files in LTO mode (via -flto).
17319
17320 Disabled by default.
17321
17322 -flto-report-wpa
17323 Like -flto-report, but only print for the WPA phase of link-time
17324 optimization.
17325
17326 -fmem-report
17327 Makes the compiler print some statistics about permanent memory
17328 allocation when it finishes.
17329
17330 -fmem-report-wpa
17331 Makes the compiler print some statistics about permanent memory
17332 allocation for the WPA phase only.
17333
17334 -fpre-ipa-mem-report
17335 -fpost-ipa-mem-report
17336 Makes the compiler print some statistics about permanent memory
17337 allocation before or after interprocedural optimization.
17338
17339 -fmultiflags
17340 This option enables multilib-aware "TFLAGS" to be used to build
17341 target libraries with options different from those the compiler is
17342 configured to use by default, through the use of specs
17343
17344 Like "TFLAGS", this allows the target libraries to be built for
17345 portable baseline environments, while the compiler defaults to more
17346 demanding ones. That's useful because users can easily override
17347 the defaults the compiler is configured to use to build their own
17348 programs, if the defaults are not ideal for their target
17349 environment, whereas rebuilding the runtime libraries is usually
17350 not as easy or desirable.
17351
17352 Unlike "TFLAGS", the use of specs enables different flags to be
17353 selected for different multilibs. The way to accomplish that is to
17354 build with make TFLAGS=-fmultiflags, after configuring
17355 --with-specs=%{fmultiflags:...}.
17356
17357 This option is discarded by the driver once it's done processing
17358 driver self spec.
17359
17360 It is also useful to check that "TFLAGS" are being used to build
17361 all target libraries, by configuring a non-bootstrap compiler
17362 --with-specs='%{!fmultiflags:%emissing TFLAGS}' and building the
17363 compiler and target libraries.
17364
17365 -fprofile-report
17366 Makes the compiler print some statistics about consistency of the
17367 (estimated) profile and effect of individual passes.
17368
17369 -fstack-usage
17370 Makes the compiler output stack usage information for the program,
17371 on a per-function basis. The filename for the dump is made by
17372 appending .su to the auxname. auxname is generated from the name
17373 of the output file, if explicitly specified and it is not an
17374 executable, otherwise it is the basename of the source file. An
17375 entry is made up of three fields:
17376
17377 * The name of the function.
17378
17379 * A number of bytes.
17380
17381 * One or more qualifiers: "static", "dynamic", "bounded".
17382
17383 The qualifier "static" means that the function manipulates the
17384 stack statically: a fixed number of bytes are allocated for the
17385 frame on function entry and released on function exit; no stack
17386 adjustments are otherwise made in the function. The second field
17387 is this fixed number of bytes.
17388
17389 The qualifier "dynamic" means that the function manipulates the
17390 stack dynamically: in addition to the static allocation described
17391 above, stack adjustments are made in the body of the function, for
17392 example to push/pop arguments around function calls. If the
17393 qualifier "bounded" is also present, the amount of these
17394 adjustments is bounded at compile time and the second field is an
17395 upper bound of the total amount of stack used by the function. If
17396 it is not present, the amount of these adjustments is not bounded
17397 at compile time and the second field only represents the bounded
17398 part.
17399
17400 -fstats
17401 Emit statistics about front-end processing at the end of the
17402 compilation. This option is supported only by the C++ front end,
17403 and the information is generally only useful to the G++ development
17404 team.
17405
17406 -fdbg-cnt-list
17407 Print the name and the counter upper bound for all debug counters.
17408
17409 -fdbg-cnt=counter-value-list
17410 Set the internal debug counter lower and upper bound. counter-
17411 value-list is a comma-separated list of
17412 name:lower_bound1-upper_bound1 [:lower_bound2-upper_bound2...]
17413 tuples which sets the name of the counter and list of closed
17414 intervals. The lower_bound is optional and is zero initialized if
17415 not set. For example, with -fdbg-cnt=dce:2-4:10-11,tail_call:10,
17416 dbg_cnt(dce) returns true only for second, third, fourth, tenth and
17417 eleventh invocation. For dbg_cnt(tail_call) true is returned for
17418 first 10 invocations.
17419
17420 -print-file-name=library
17421 Print the full absolute name of the library file library that would
17422 be used when linking---and don't do anything else. With this
17423 option, GCC does not compile or link anything; it just prints the
17424 file name.
17425
17426 -print-multi-directory
17427 Print the directory name corresponding to the multilib selected by
17428 any other switches present in the command line. This directory is
17429 supposed to exist in GCC_EXEC_PREFIX.
17430
17431 -print-multi-lib
17432 Print the mapping from multilib directory names to compiler
17433 switches that enable them. The directory name is separated from
17434 the switches by ;, and each switch starts with an @ instead of the
17435 -, without spaces between multiple switches. This is supposed to
17436 ease shell processing.
17437
17438 -print-multi-os-directory
17439 Print the path to OS libraries for the selected multilib, relative
17440 to some lib subdirectory. If OS libraries are present in the lib
17441 subdirectory and no multilibs are used, this is usually just ., if
17442 OS libraries are present in libsuffix sibling directories this
17443 prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are
17444 present in lib/subdir subdirectories it prints e.g. amd64, sparcv9
17445 or ev6.
17446
17447 -print-multiarch
17448 Print the path to OS libraries for the selected multiarch, relative
17449 to some lib subdirectory.
17450
17451 -print-prog-name=program
17452 Like -print-file-name, but searches for a program such as cpp.
17453
17454 -print-libgcc-file-name
17455 Same as -print-file-name=libgcc.a.
17456
17457 This is useful when you use -nostdlib or -nodefaultlibs but you do
17458 want to link with libgcc.a. You can do:
17459
17460 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
17461
17462 -print-search-dirs
17463 Print the name of the configured installation directory and a list
17464 of program and library directories gcc searches---and don't do
17465 anything else.
17466
17467 This is useful when gcc prints the error message installation
17468 problem, cannot exec cpp0: No such file or directory. To resolve
17469 this you either need to put cpp0 and the other compiler components
17470 where gcc expects to find them, or you can set the environment
17471 variable GCC_EXEC_PREFIX to the directory where you installed them.
17472 Don't forget the trailing /.
17473
17474 -print-sysroot
17475 Print the target sysroot directory that is used during compilation.
17476 This is the target sysroot specified either at configure time or
17477 using the --sysroot option, possibly with an extra suffix that
17478 depends on compilation options. If no target sysroot is specified,
17479 the option prints nothing.
17480
17481 -print-sysroot-headers-suffix
17482 Print the suffix added to the target sysroot when searching for
17483 headers, or give an error if the compiler is not configured with
17484 such a suffix---and don't do anything else.
17485
17486 -dumpmachine
17487 Print the compiler's target machine (for example,
17488 i686-pc-linux-gnu)---and don't do anything else.
17489
17490 -dumpversion
17491 Print the compiler version (for example, 3.0, 6.3.0 or 7)---and
17492 don't do anything else. This is the compiler version used in
17493 filesystem paths and specs. Depending on how the compiler has been
17494 configured it can be just a single number (major version), two
17495 numbers separated by a dot (major and minor version) or three
17496 numbers separated by dots (major, minor and patchlevel version).
17497
17498 -dumpfullversion
17499 Print the full compiler version---and don't do anything else. The
17500 output is always three numbers separated by dots, major, minor and
17501 patchlevel version.
17502
17503 -dumpspecs
17504 Print the compiler's built-in specs---and don't do anything else.
17505 (This is used when GCC itself is being built.)
17506
17507 Machine-Dependent Options
17508 Each target machine supported by GCC can have its own options---for
17509 example, to allow you to compile for a particular processor variant or
17510 ABI, or to control optimizations specific to that machine. By
17511 convention, the names of machine-specific options start with -m.
17512
17513 Some configurations of the compiler also support additional target-
17514 specific options, usually for compatibility with other compilers on the
17515 same platform.
17516
17517 AArch64 Options
17518
17519 These options are defined for AArch64 implementations:
17520
17521 -mabi=name
17522 Generate code for the specified data model. Permissible values are
17523 ilp32 for SysV-like data model where int, long int and pointers are
17524 32 bits, and lp64 for SysV-like data model where int is 32 bits,
17525 but long int and pointers are 64 bits.
17526
17527 The default depends on the specific target configuration. Note
17528 that the LP64 and ILP32 ABIs are not link-compatible; you must
17529 compile your entire program with the same ABI, and link with a
17530 compatible set of libraries.
17531
17532 -mbig-endian
17533 Generate big-endian code. This is the default when GCC is
17534 configured for an aarch64_be-*-* target.
17535
17536 -mgeneral-regs-only
17537 Generate code which uses only the general-purpose registers. This
17538 will prevent the compiler from using floating-point and Advanced
17539 SIMD registers but will not impose any restrictions on the
17540 assembler.
17541
17542 -mlittle-endian
17543 Generate little-endian code. This is the default when GCC is
17544 configured for an aarch64-*-* but not an aarch64_be-*-* target.
17545
17546 -mcmodel=tiny
17547 Generate code for the tiny code model. The program and its
17548 statically defined symbols must be within 1MB of each other.
17549 Programs can be statically or dynamically linked.
17550
17551 -mcmodel=small
17552 Generate code for the small code model. The program and its
17553 statically defined symbols must be within 4GB of each other.
17554 Programs can be statically or dynamically linked. This is the
17555 default code model.
17556
17557 -mcmodel=large
17558 Generate code for the large code model. This makes no assumptions
17559 about addresses and sizes of sections. Programs can be statically
17560 linked only. The -mcmodel=large option is incompatible with
17561 -mabi=ilp32, -fpic and -fPIC.
17562
17563 -mstrict-align
17564 -mno-strict-align
17565 Avoid or allow generating memory accesses that may not be aligned
17566 on a natural object boundary as described in the architecture
17567 specification.
17568
17569 -momit-leaf-frame-pointer
17570 -mno-omit-leaf-frame-pointer
17571 Omit or keep the frame pointer in leaf functions. The former
17572 behavior is the default.
17573
17574 -mstack-protector-guard=guard
17575 -mstack-protector-guard-reg=reg
17576 -mstack-protector-guard-offset=offset
17577 Generate stack protection code using canary at guard. Supported
17578 locations are global for a global canary or sysreg for a canary in
17579 an appropriate system register.
17580
17581 With the latter choice the options -mstack-protector-guard-reg=reg
17582 and -mstack-protector-guard-offset=offset furthermore specify which
17583 system register to use as base register for reading the canary, and
17584 from what offset from that base register. There is no default
17585 register or offset as this is entirely for use within the Linux
17586 kernel.
17587
17588 -mtls-dialect=desc
17589 Use TLS descriptors as the thread-local storage mechanism for
17590 dynamic accesses of TLS variables. This is the default.
17591
17592 -mtls-dialect=traditional
17593 Use traditional TLS as the thread-local storage mechanism for
17594 dynamic accesses of TLS variables.
17595
17596 -mtls-size=size
17597 Specify bit size of immediate TLS offsets. Valid values are 12,
17598 24, 32, 48. This option requires binutils 2.26 or newer.
17599
17600 -mfix-cortex-a53-835769
17601 -mno-fix-cortex-a53-835769
17602 Enable or disable the workaround for the ARM Cortex-A53 erratum
17603 number 835769. This involves inserting a NOP instruction between
17604 memory instructions and 64-bit integer multiply-accumulate
17605 instructions.
17606
17607 -mfix-cortex-a53-843419
17608 -mno-fix-cortex-a53-843419
17609 Enable or disable the workaround for the ARM Cortex-A53 erratum
17610 number 843419. This erratum workaround is made at link time and
17611 this will only pass the corresponding flag to the linker.
17612
17613 -mlow-precision-recip-sqrt
17614 -mno-low-precision-recip-sqrt
17615 Enable or disable the reciprocal square root approximation. This
17616 option only has an effect if -ffast-math or
17617 -funsafe-math-optimizations is used as well. Enabling this reduces
17618 precision of reciprocal square root results to about 16 bits for
17619 single precision and to 32 bits for double precision.
17620
17621 -mlow-precision-sqrt
17622 -mno-low-precision-sqrt
17623 Enable or disable the square root approximation. This option only
17624 has an effect if -ffast-math or -funsafe-math-optimizations is used
17625 as well. Enabling this reduces precision of square root results to
17626 about 16 bits for single precision and to 32 bits for double
17627 precision. If enabled, it implies -mlow-precision-recip-sqrt.
17628
17629 -mlow-precision-div
17630 -mno-low-precision-div
17631 Enable or disable the division approximation. This option only has
17632 an effect if -ffast-math or -funsafe-math-optimizations is used as
17633 well. Enabling this reduces precision of division results to about
17634 16 bits for single precision and to 32 bits for double precision.
17635
17636 -mtrack-speculation
17637 -mno-track-speculation
17638 Enable or disable generation of additional code to track
17639 speculative execution through conditional branches. The tracking
17640 state can then be used by the compiler when expanding calls to
17641 "__builtin_speculation_safe_copy" to permit a more efficient code
17642 sequence to be generated.
17643
17644 -moutline-atomics
17645 -mno-outline-atomics
17646 Enable or disable calls to out-of-line helpers to implement atomic
17647 operations. These helpers will, at runtime, determine if the LSE
17648 instructions from ARMv8.1-A can be used; if not, they will use the
17649 load/store-exclusive instructions that are present in the base
17650 ARMv8.0 ISA.
17651
17652 This option is only applicable when compiling for the base ARMv8.0
17653 instruction set. If using a later revision, e.g. -march=armv8.1-a
17654 or -march=armv8-a+lse, the ARMv8.1-Atomics instructions will be
17655 used directly. The same applies when using -mcpu= when the
17656 selected cpu supports the lse feature. This option is on by
17657 default.
17658
17659 -march=name
17660 Specify the name of the target architecture and, optionally, one or
17661 more feature modifiers. This option has the form
17662 -march=arch{+[no]feature}*.
17663
17664 The table below summarizes the permissible values for arch and the
17665 features that they enable by default:
17666
17667 arch value : Architecture : Includes by default
17668 armv8-a : Armv8-A : +fp, +simd
17669 armv8.1-a : Armv8.1-A : armv8-a, +crc, +lse, +rdma
17670 armv8.2-a : Armv8.2-A : armv8.1-a
17671 armv8.3-a : Armv8.3-A : armv8.2-a, +pauth
17672 armv8.4-a : Armv8.4-A : armv8.3-a, +flagm, +fp16fml, +dotprod
17673 armv8.5-a : Armv8.5-A : armv8.4-a, +sb, +ssbs, +predres
17674 armv8.6-a : Armv8.6-A : armv8.5-a, +bf16, +i8mm
17675 armv8.7-a : Armv8.7-A : armv8.6-a, +ls64
17676 armv8.8-a : Armv8.8-a : armv8.7-a, +mops
17677 armv9-a : Armv9-A : armv8.5-a, +sve, +sve2
17678 armv9.1-a : Armv9.1-A : armv9-a, +bf16, +i8mm
17679 armv9.2-a : Armv9.2-A : armv9.1-a, +ls64
17680 armv9.3-a : Armv9.3-A : armv9.2-a, +mops
17681 armv8-r : Armv8-R : armv8-r
17682
17683 The value native is available on native AArch64 GNU/Linux and
17684 causes the compiler to pick the architecture of the host system.
17685 This option has no effect if the compiler is unable to recognize
17686 the architecture of the host system,
17687
17688 The permissible values for feature are listed in the sub-section on
17689 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
17690 Where conflicting feature modifiers are specified, the right-most
17691 feature is used.
17692
17693 GCC uses name to determine what kind of instructions it can emit
17694 when generating assembly code. If -march is specified without
17695 either of -mtune or -mcpu also being specified, the code is tuned
17696 to perform well across a range of target processors implementing
17697 the target architecture.
17698
17699 -mtune=name
17700 Specify the name of the target processor for which GCC should tune
17701 the performance of the code. Permissible values for this option
17702 are: generic, cortex-a35, cortex-a53, cortex-a55, cortex-a57,
17703 cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae,
17704 cortex-a77, cortex-a65, cortex-a65ae, cortex-a34, cortex-a78,
17705 cortex-a78ae, cortex-a78c, ares, exynos-m1, emag, falkor,
17706 neoverse-512tvb, neoverse-e1, neoverse-n1, neoverse-n2,
17707 neoverse-v1, neoverse-v2, qdf24xx, saphira, phecda, xgene1, vulcan,
17708 octeontx, octeontx81, octeontx83, octeontx2, octeontx2t98,
17709 octeontx2t96 octeontx2t93, octeontx2f95, octeontx2f95n,
17710 octeontx2f95mm, a64fx, thunderx, thunderxt88, thunderxt88p1,
17711 thunderxt81, tsv110, thunderxt83, thunderx2t99, thunderx3t110,
17712 zeus, cortex-a57.cortex-a53, cortex-a72.cortex-a53,
17713 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
17714 cortex-a75.cortex-a55, cortex-a76.cortex-a55, cortex-r82,
17715 cortex-x1, cortex-x1c, cortex-x2, cortex-x3, cortex-a510,
17716 cortex-a710, cortex-a715, ampere1, ampere1a, and native.
17717
17718 The values cortex-a57.cortex-a53, cortex-a72.cortex-a53,
17719 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
17720 cortex-a75.cortex-a55, cortex-a76.cortex-a55 specify that GCC
17721 should tune for a big.LITTLE system.
17722
17723 The value neoverse-512tvb specifies that GCC should tune for
17724 Neoverse cores that (a) implement SVE and (b) have a total vector
17725 bandwidth of 512 bits per cycle. In other words, the option tells
17726 GCC to tune for Neoverse cores that can execute 4 128-bit Advanced
17727 SIMD arithmetic instructions a cycle and that can execute an
17728 equivalent number of SVE arithmetic instructions per cycle (2 for
17729 256-bit SVE, 4 for 128-bit SVE). This is more general than tuning
17730 for a specific core like Neoverse V1 but is more specific than the
17731 default tuning described below.
17732
17733 Additionally on native AArch64 GNU/Linux systems the value native
17734 tunes performance to the host system. This option has no effect if
17735 the compiler is unable to recognize the processor of the host
17736 system.
17737
17738 Where none of -mtune=, -mcpu= or -march= are specified, the code is
17739 tuned to perform well across a range of target processors.
17740
17741 This option cannot be suffixed by feature modifiers.
17742
17743 -mcpu=name
17744 Specify the name of the target processor, optionally suffixed by
17745 one or more feature modifiers. This option has the form
17746 -mcpu=cpu{+[no]feature}*, where the permissible values for cpu are
17747 the same as those available for -mtune. The permissible values for
17748 feature are documented in the sub-section on
17749 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
17750 Where conflicting feature modifiers are specified, the right-most
17751 feature is used.
17752
17753 GCC uses name to determine what kind of instructions it can emit
17754 when generating assembly code (as if by -march) and to determine
17755 the target processor for which to tune for performance (as if by
17756 -mtune). Where this option is used in conjunction with -march or
17757 -mtune, those options take precedence over the appropriate part of
17758 this option.
17759
17760 -mcpu=neoverse-512tvb is special in that it does not refer to a
17761 specific core, but instead refers to all Neoverse cores that (a)
17762 implement SVE and (b) have a total vector bandwidth of 512 bits a
17763 cycle. Unless overridden by -march, -mcpu=neoverse-512tvb
17764 generates code that can run on a Neoverse V1 core, since Neoverse
17765 V1 is the first Neoverse core with these properties. Unless
17766 overridden by -mtune, -mcpu=neoverse-512tvb tunes code in the same
17767 way as for -mtune=neoverse-512tvb.
17768
17769 -moverride=string
17770 Override tuning decisions made by the back-end in response to a
17771 -mtune= switch. The syntax, semantics, and accepted values for
17772 string in this option are not guaranteed to be consistent across
17773 releases.
17774
17775 This option is only intended to be useful when developing GCC.
17776
17777 -mverbose-cost-dump
17778 Enable verbose cost model dumping in the debug dump files. This
17779 option is provided for use in debugging the compiler.
17780
17781 -mpc-relative-literal-loads
17782 -mno-pc-relative-literal-loads
17783 Enable or disable PC-relative literal loads. With this option
17784 literal pools are accessed using a single instruction and emitted
17785 after each function. This limits the maximum size of functions to
17786 1MB. This is enabled by default for -mcmodel=tiny.
17787
17788 -msign-return-address=scope
17789 Select the function scope on which return address signing will be
17790 applied. Permissible values are none, which disables return
17791 address signing, non-leaf, which enables pointer signing for
17792 functions which are not leaf functions, and all, which enables
17793 pointer signing for all functions. The default value is none. This
17794 option has been deprecated by -mbranch-protection.
17795
17796 -mbranch-protection=none|standard|pac-ret[+leaf+b-key]|bti
17797 Select the branch protection features to use. none is the default
17798 and turns off all types of branch protection. standard turns on
17799 all types of branch protection features. If a feature has
17800 additional tuning options, then standard sets it to its standard
17801 level. pac-ret[+leaf] turns on return address signing to its
17802 standard level: signing functions that save the return address to
17803 memory (non-leaf functions will practically always do this) using
17804 the a-key. The optional argument leaf can be used to extend the
17805 signing to include leaf functions. The optional argument b-key can
17806 be used to sign the functions with the B-key instead of the A-key.
17807 bti turns on branch target identification mechanism.
17808
17809 -mharden-sls=opts
17810 Enable compiler hardening against straight line speculation (SLS).
17811 opts is a comma-separated list of the following options:
17812
17813 retbr
17814 blr
17815
17816 In addition, -mharden-sls=all enables all SLS hardening while
17817 -mharden-sls=none disables all SLS hardening.
17818
17819 -msve-vector-bits=bits
17820 Specify the number of bits in an SVE vector register. This option
17821 only has an effect when SVE is enabled.
17822
17823 GCC supports two forms of SVE code generation: "vector-length
17824 agnostic" output that works with any size of vector register and
17825 "vector-length specific" output that allows GCC to make assumptions
17826 about the vector length when it is useful for optimization reasons.
17827 The possible values of bits are: scalable, 128, 256, 512, 1024 and
17828 2048. Specifying scalable selects vector-length agnostic output.
17829 At present -msve-vector-bits=128 also generates vector-length
17830 agnostic output for big-endian targets. All other values generate
17831 vector-length specific code. The behavior of these values may
17832 change in future releases and no value except scalable should be
17833 relied on for producing code that is portable across different
17834 hardware SVE vector lengths.
17835
17836 The default is -msve-vector-bits=scalable, which produces vector-
17837 length agnostic code.
17838
17839 -march and -mcpu Feature Modifiers
17840
17841 Feature modifiers used with -march and -mcpu can be any of the
17842 following and their inverses nofeature:
17843
17844 crc Enable CRC extension. This is on by default for -march=armv8.1-a.
17845
17846 crypto
17847 Enable Crypto extension. This also enables Advanced SIMD and
17848 floating-point instructions.
17849
17850 fp Enable floating-point instructions. This is on by default for all
17851 possible values for options -march and -mcpu.
17852
17853 simd
17854 Enable Advanced SIMD instructions. This also enables floating-
17855 point instructions. This is on by default for all possible values
17856 for options -march and -mcpu.
17857
17858 sve Enable Scalable Vector Extension instructions. This also enables
17859 Advanced SIMD and floating-point instructions.
17860
17861 lse Enable Large System Extension instructions. This is on by default
17862 for -march=armv8.1-a.
17863
17864 rdma
17865 Enable Round Double Multiply Accumulate instructions. This is on
17866 by default for -march=armv8.1-a.
17867
17868 fp16
17869 Enable FP16 extension. This also enables floating-point
17870 instructions.
17871
17872 fp16fml
17873 Enable FP16 fmla extension. This also enables FP16 extensions and
17874 floating-point instructions. This option is enabled by default for
17875 -march=armv8.4-a. Use of this option with architectures prior to
17876 Armv8.2-A is not supported.
17877
17878 rcpc
17879 Enable the RCpc extension. This enables the use of the LDAPR
17880 instructions for load-acquire atomic semantics, and passes it on to
17881 the assembler, enabling inline asm statements to use instructions
17882 from the RCpc extension.
17883
17884 dotprod
17885 Enable the Dot Product extension. This also enables Advanced SIMD
17886 instructions.
17887
17888 aes Enable the Armv8-a aes and pmull crypto extension. This also
17889 enables Advanced SIMD instructions.
17890
17891 sha2
17892 Enable the Armv8-a sha2 crypto extension. This also enables
17893 Advanced SIMD instructions.
17894
17895 sha3
17896 Enable the sha512 and sha3 crypto extension. This also enables
17897 Advanced SIMD instructions. Use of this option with architectures
17898 prior to Armv8.2-A is not supported.
17899
17900 sm4 Enable the sm3 and sm4 crypto extension. This also enables
17901 Advanced SIMD instructions. Use of this option with architectures
17902 prior to Armv8.2-A is not supported.
17903
17904 profile
17905 Enable the Statistical Profiling extension. This option is only to
17906 enable the extension at the assembler level and does not affect
17907 code generation.
17908
17909 rng Enable the Armv8.5-a Random Number instructions. This option is
17910 only to enable the extension at the assembler level and does not
17911 affect code generation.
17912
17913 memtag
17914 Enable the Armv8.5-a Memory Tagging Extensions. Use of this option
17915 with architectures prior to Armv8.5-A is not supported.
17916
17917 sb Enable the Armv8-a Speculation Barrier instruction. This option is
17918 only to enable the extension at the assembler level and does not
17919 affect code generation. This option is enabled by default for
17920 -march=armv8.5-a.
17921
17922 ssbs
17923 Enable the Armv8-a Speculative Store Bypass Safe instruction. This
17924 option is only to enable the extension at the assembler level and
17925 does not affect code generation. This option is enabled by default
17926 for -march=armv8.5-a.
17927
17928 predres
17929 Enable the Armv8-a Execution and Data Prediction Restriction
17930 instructions. This option is only to enable the extension at the
17931 assembler level and does not affect code generation. This option
17932 is enabled by default for -march=armv8.5-a.
17933
17934 sve2
17935 Enable the Armv8-a Scalable Vector Extension 2. This also enables
17936 SVE instructions.
17937
17938 sve2-bitperm
17939 Enable SVE2 bitperm instructions. This also enables SVE2
17940 instructions.
17941
17942 sve2-sm4
17943 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
17944
17945 sve2-aes
17946 Enable SVE2 aes instructions. This also enables SVE2 instructions.
17947
17948 sve2-sha3
17949 Enable SVE2 sha3 instructions. This also enables SVE2
17950 instructions.
17951
17952 tme Enable the Transactional Memory Extension.
17953
17954 i8mm
17955 Enable 8-bit Integer Matrix Multiply instructions. This also
17956 enables Advanced SIMD and floating-point instructions. This option
17957 is enabled by default for -march=armv8.6-a. Use of this option
17958 with architectures prior to Armv8.2-A is not supported.
17959
17960 f32mm
17961 Enable 32-bit Floating point Matrix Multiply instructions. This
17962 also enables SVE instructions. Use of this option with
17963 architectures prior to Armv8.2-A is not supported.
17964
17965 f64mm
17966 Enable 64-bit Floating point Matrix Multiply instructions. This
17967 also enables SVE instructions. Use of this option with
17968 architectures prior to Armv8.2-A is not supported.
17969
17970 bf16
17971 Enable brain half-precision floating-point instructions. This also
17972 enables Advanced SIMD and floating-point instructions. This option
17973 is enabled by default for -march=armv8.6-a. Use of this option
17974 with architectures prior to Armv8.2-A is not supported.
17975
17976 ls64
17977 Enable the 64-byte atomic load and store instructions for
17978 accelerators. This option is enabled by default for
17979 -march=armv8.7-a.
17980
17981 mops
17982 Enable the instructions to accelerate memory operations like
17983 "memcpy", "memmove", "memset". This option is enabled by default
17984 for -march=armv8.8-a
17985
17986 flagm
17987 Enable the Flag Manipulation instructions Extension.
17988
17989 pauth
17990 Enable the Pointer Authentication Extension.
17991
17992 cssc
17993 Enable the Common Short Sequence Compression instructions.
17994
17995 Feature crypto implies aes, sha2, and simd, which implies fp.
17996 Conversely, nofp implies nosimd, which implies nocrypto, noaes and
17997 nosha2.
17998
17999 Adapteva Epiphany Options
18000
18001 These -m options are defined for Adapteva Epiphany:
18002
18003 -mhalf-reg-file
18004 Don't allocate any register in the range "r32"..."r63". That
18005 allows code to run on hardware variants that lack these registers.
18006
18007 -mprefer-short-insn-regs
18008 Preferentially allocate registers that allow short instruction
18009 generation. This can result in increased instruction count, so
18010 this may either reduce or increase overall code size.
18011
18012 -mbranch-cost=num
18013 Set the cost of branches to roughly num "simple" instructions.
18014 This cost is only a heuristic and is not guaranteed to produce
18015 consistent results across releases.
18016
18017 -mcmove
18018 Enable the generation of conditional moves.
18019
18020 -mnops=num
18021 Emit num NOPs before every other generated instruction.
18022
18023 -mno-soft-cmpsf
18024 For single-precision floating-point comparisons, emit an "fsub"
18025 instruction and test the flags. This is faster than a software
18026 comparison, but can get incorrect results in the presence of NaNs,
18027 or when two different small numbers are compared such that their
18028 difference is calculated as zero. The default is -msoft-cmpsf,
18029 which uses slower, but IEEE-compliant, software comparisons.
18030
18031 -mstack-offset=num
18032 Set the offset between the top of the stack and the stack pointer.
18033 E.g., a value of 8 means that the eight bytes in the range
18034 "sp+0...sp+7" can be used by leaf functions without stack
18035 allocation. Values other than 8 or 16 are untested and unlikely to
18036 work. Note also that this option changes the ABI; compiling a
18037 program with a different stack offset than the libraries have been
18038 compiled with generally does not work. This option can be useful
18039 if you want to evaluate if a different stack offset would give you
18040 better code, but to actually use a different stack offset to build
18041 working programs, it is recommended to configure the toolchain with
18042 the appropriate --with-stack-offset=num option.
18043
18044 -mno-round-nearest
18045 Make the scheduler assume that the rounding mode has been set to
18046 truncating. The default is -mround-nearest.
18047
18048 -mlong-calls
18049 If not otherwise specified by an attribute, assume all calls might
18050 be beyond the offset range of the "b" / "bl" instructions, and
18051 therefore load the function address into a register before
18052 performing a (otherwise direct) call. This is the default.
18053
18054 -mshort-calls
18055 If not otherwise specified by an attribute, assume all direct calls
18056 are in the range of the "b" / "bl" instructions, so use these
18057 instructions for direct calls. The default is -mlong-calls.
18058
18059 -msmall16
18060 Assume addresses can be loaded as 16-bit unsigned values. This
18061 does not apply to function addresses for which -mlong-calls
18062 semantics are in effect.
18063
18064 -mfp-mode=mode
18065 Set the prevailing mode of the floating-point unit. This
18066 determines the floating-point mode that is provided and expected at
18067 function call and return time. Making this mode match the mode you
18068 predominantly need at function start can make your programs smaller
18069 and faster by avoiding unnecessary mode switches.
18070
18071 mode can be set to one the following values:
18072
18073 caller
18074 Any mode at function entry is valid, and retained or restored
18075 when the function returns, and when it calls other functions.
18076 This mode is useful for compiling libraries or other
18077 compilation units you might want to incorporate into different
18078 programs with different prevailing FPU modes, and the
18079 convenience of being able to use a single object file outweighs
18080 the size and speed overhead for any extra mode switching that
18081 might be needed, compared with what would be needed with a more
18082 specific choice of prevailing FPU mode.
18083
18084 truncate
18085 This is the mode used for floating-point calculations with
18086 truncating (i.e. round towards zero) rounding mode. That
18087 includes conversion from floating point to integer.
18088
18089 round-nearest
18090 This is the mode used for floating-point calculations with
18091 round-to-nearest-or-even rounding mode.
18092
18093 int This is the mode used to perform integer calculations in the
18094 FPU, e.g. integer multiply, or integer multiply-and-
18095 accumulate.
18096
18097 The default is -mfp-mode=caller
18098
18099 -mno-split-lohi
18100 -mno-postinc
18101 -mno-postmodify
18102 Code generation tweaks that disable, respectively, splitting of
18103 32-bit loads, generation of post-increment addresses, and
18104 generation of post-modify addresses. The defaults are msplit-lohi,
18105 -mpost-inc, and -mpost-modify.
18106
18107 -mnovect-double
18108 Change the preferred SIMD mode to SImode. The default is
18109 -mvect-double, which uses DImode as preferred SIMD mode.
18110
18111 -max-vect-align=num
18112 The maximum alignment for SIMD vector mode types. num may be 4 or
18113 8. The default is 8. Note that this is an ABI change, even though
18114 many library function interfaces are unaffected if they don't use
18115 SIMD vector modes in places that affect size and/or alignment of
18116 relevant types.
18117
18118 -msplit-vecmove-early
18119 Split vector moves into single word moves before reload. In theory
18120 this can give better register allocation, but so far the reverse
18121 seems to be generally the case.
18122
18123 -m1reg-reg
18124 Specify a register to hold the constant -1, which makes loading
18125 small negative constants and certain bitmasks faster. Allowable
18126 values for reg are r43 and r63, which specify use of that register
18127 as a fixed register, and none, which means that no register is used
18128 for this purpose. The default is -m1reg-none.
18129
18130 AMD GCN Options
18131
18132 These options are defined specifically for the AMD GCN port.
18133
18134 -march=gpu
18135 -mtune=gpu
18136 Set architecture type or tuning for gpu. Supported values for gpu
18137 are
18138
18139 fiji
18140 Compile for GCN3 Fiji devices (gfx803).
18141
18142 gfx900
18143 Compile for GCN5 Vega 10 devices (gfx900).
18144
18145 gfx906
18146 Compile for GCN5 Vega 20 devices (gfx906).
18147
18148 gfx908
18149 Compile for CDNA1 Instinct MI100 series devices (gfx908).
18150
18151 gfx90a
18152 Compile for CDNA2 Instinct MI200 series devices (gfx90a).
18153
18154 -msram-ecc=on
18155 -msram-ecc=off
18156 -msram-ecc=any
18157 Compile binaries suitable for devices with the SRAM-ECC feature
18158 enabled, disabled, or either mode. This feature can be enabled
18159 per-process on some devices. The compiled code must match the
18160 device mode. The default is any, for devices that support it.
18161
18162 -mstack-size=bytes
18163 Specify how many bytes of stack space will be requested for each
18164 GPU thread (wave-front). Beware that there may be many threads and
18165 limited memory available. The size of the stack allocation may
18166 also have an impact on run-time performance. The default is 32KB
18167 when using OpenACC or OpenMP, and 1MB otherwise.
18168
18169 -mxnack
18170 Compile binaries suitable for devices with the XNACK feature
18171 enabled. Some devices always require XNACK and some allow the user
18172 to configure XNACK. The compiled code must match the device mode.
18173 The default is -mno-xnack. At present this option is a placeholder
18174 for support that is not yet implemented.
18175
18176 ARC Options
18177
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
18813 These -m options are defined for the ARM port:
18814
18815 -mabi=name
18816 Generate code for the specified ABI. Permissible values are: apcs-
18817 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
18818
18819 -mapcs-frame
18820 Generate a stack frame that is compliant with the ARM Procedure
18821 Call Standard for all functions, even if this is not strictly
18822 necessary for correct execution of the code. Specifying
18823 -fomit-frame-pointer with this option causes the stack frames not
18824 to be generated for leaf functions. The default is
18825 -mno-apcs-frame. This option is deprecated.
18826
18827 -mapcs
18828 This is a synonym for -mapcs-frame and is deprecated.
18829
18830 -mthumb-interwork
18831 Generate code that supports calling between the ARM and Thumb
18832 instruction sets. Without this option, on pre-v5 architectures,
18833 the two instruction sets cannot be reliably used inside one
18834 program. The default is -mno-thumb-interwork, since slightly
18835 larger code is generated when -mthumb-interwork is specified. In
18836 AAPCS configurations this option is meaningless.
18837
18838 -mno-sched-prolog
18839 Prevent the reordering of instructions in the function prologue, or
18840 the merging of those instruction with the instructions in the
18841 function's body. This means that all functions start with a
18842 recognizable set of instructions (or in fact one of a choice from a
18843 small set of different function prologues), and this information
18844 can be used to locate the start of functions inside an executable
18845 piece of code. The default is -msched-prolog.
18846
18847 -mfloat-abi=name
18848 Specifies which floating-point ABI to use. Permissible values are:
18849 soft, softfp and hard.
18850
18851 Specifying soft causes GCC to generate output containing library
18852 calls for floating-point operations. softfp allows the generation
18853 of code using hardware floating-point instructions, but still uses
18854 the soft-float calling conventions. hard allows generation of
18855 floating-point instructions and uses FPU-specific calling
18856 conventions.
18857
18858 The default depends on the specific target configuration. Note
18859 that the hard-float and soft-float ABIs are not link-compatible;
18860 you must compile your entire program with the same ABI, and link
18861 with a compatible set of libraries.
18862
18863 -mgeneral-regs-only
18864 Generate code which uses only the general-purpose registers. This
18865 will prevent the compiler from using floating-point and Advanced
18866 SIMD registers but will not impose any restrictions on the
18867 assembler.
18868
18869 -mlittle-endian
18870 Generate code for a processor running in little-endian mode. This
18871 is the default for all standard configurations.
18872
18873 -mbig-endian
18874 Generate code for a processor running in big-endian mode; the
18875 default is to compile code for a little-endian processor.
18876
18877 -mbe8
18878 -mbe32
18879 When linking a big-endian image select between BE8 and BE32
18880 formats. The option has no effect for little-endian images and is
18881 ignored. The default is dependent on the selected target
18882 architecture. For ARMv6 and later architectures the default is
18883 BE8, for older architectures the default is BE32. BE32 format has
18884 been deprecated by ARM.
18885
18886 -march=name[+extension...]
18887 This specifies the name of the target ARM architecture. GCC uses
18888 this name to determine what kind of instructions it can emit when
18889 generating assembly code. This option can be used in conjunction
18890 with or instead of the -mcpu= option.
18891
18892 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
18893 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
18894 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
18895 armv8.6-a, armv9-a, armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m,
18896 armv7e-m, armv8-m.base, armv8-m.main, armv8.1-m.main, armv9-a,
18897 iwmmxt and iwmmxt2.
18898
18899 Additionally, the following architectures, which lack support for
18900 the Thumb execution state, are recognized but support is
18901 deprecated: armv4.
18902
18903 Many of the architectures support extensions. These can be added
18904 by appending +extension to the architecture name. Extension
18905 options are processed in order and capabilities accumulate. An
18906 extension will also enable any necessary base extensions upon which
18907 it depends. For example, the +crypto extension will always enable
18908 the +simd extension. The exception to the additive construction is
18909 for extensions that are prefixed with +no...: these extensions
18910 disable the specified option and any other extensions that may
18911 depend on the presence of that extension.
18912
18913 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
18914 writing -march=armv7-a+vfpv4 since the +simd option is entirely
18915 disabled by the +nofp option that follows it.
18916
18917 Most extension names are generically named, but have an effect that
18918 is dependent upon the architecture to which it is applied. For
18919 example, the +simd option can be applied to both armv7-a and
18920 armv8-a architectures, but will enable the original ARMv7-A
18921 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
18922 for armv8-a.
18923
18924 The table below lists the supported extensions for each
18925 architecture. Architectures not mentioned do not support any
18926 extensions.
18927
18928 armv5te
18929 armv6
18930 armv6j
18931 armv6k
18932 armv6kz
18933 armv6t2
18934 armv6z
18935 armv6zk
18936 +fp The VFPv2 floating-point instructions. The extension
18937 +vfpv2 can be used as an alias for this extension.
18938
18939 +nofp
18940 Disable the floating-point instructions.
18941
18942 armv7
18943 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
18944 architectures.
18945
18946 +fp The VFPv3 floating-point instructions, with 16 double-
18947 precision registers. The extension +vfpv3-d16 can be used
18948 as an alias for this extension. Note that floating-point
18949 is not supported by the base ARMv7-M architecture, but is
18950 compatible with both the ARMv7-A and ARMv7-R architectures.
18951
18952 +nofp
18953 Disable the floating-point instructions.
18954
18955 armv7-a
18956 +mp The multiprocessing extension.
18957
18958 +sec
18959 The security extension.
18960
18961 +fp The VFPv3 floating-point instructions, with 16 double-
18962 precision registers. The extension +vfpv3-d16 can be used
18963 as an alias for this extension.
18964
18965 +simd
18966 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
18967 instructions. The extensions +neon and +neon-vfpv3 can be
18968 used as aliases for this extension.
18969
18970 +vfpv3
18971 The VFPv3 floating-point instructions, with 32 double-
18972 precision registers.
18973
18974 +vfpv3-d16-fp16
18975 The VFPv3 floating-point instructions, with 16 double-
18976 precision registers and the half-precision floating-point
18977 conversion operations.
18978
18979 +vfpv3-fp16
18980 The VFPv3 floating-point instructions, with 32 double-
18981 precision registers and the half-precision floating-point
18982 conversion operations.
18983
18984 +vfpv4-d16
18985 The VFPv4 floating-point instructions, with 16 double-
18986 precision registers.
18987
18988 +vfpv4
18989 The VFPv4 floating-point instructions, with 32 double-
18990 precision registers.
18991
18992 +neon-fp16
18993 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
18994 instructions, with the half-precision floating-point
18995 conversion operations.
18996
18997 +neon-vfpv4
18998 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
18999 instructions.
19000
19001 +nosimd
19002 Disable the Advanced SIMD instructions (does not disable
19003 floating point).
19004
19005 +nofp
19006 Disable the floating-point and Advanced SIMD instructions.
19007
19008 armv7ve
19009 The extended version of the ARMv7-A architecture with support
19010 for virtualization.
19011
19012 +fp The VFPv4 floating-point instructions, with 16 double-
19013 precision registers. The extension +vfpv4-d16 can be used
19014 as an alias for this extension.
19015
19016 +simd
19017 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
19018 instructions. The extension +neon-vfpv4 can be used as an
19019 alias for this extension.
19020
19021 +vfpv3-d16
19022 The VFPv3 floating-point instructions, with 16 double-
19023 precision registers.
19024
19025 +vfpv3
19026 The VFPv3 floating-point instructions, with 32 double-
19027 precision registers.
19028
19029 +vfpv3-d16-fp16
19030 The VFPv3 floating-point instructions, with 16 double-
19031 precision registers and the half-precision floating-point
19032 conversion operations.
19033
19034 +vfpv3-fp16
19035 The VFPv3 floating-point instructions, with 32 double-
19036 precision registers and the half-precision floating-point
19037 conversion operations.
19038
19039 +vfpv4-d16
19040 The VFPv4 floating-point instructions, with 16 double-
19041 precision registers.
19042
19043 +vfpv4
19044 The VFPv4 floating-point instructions, with 32 double-
19045 precision registers.
19046
19047 +neon
19048 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
19049 instructions. The extension +neon-vfpv3 can be used as an
19050 alias for this extension.
19051
19052 +neon-fp16
19053 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
19054 instructions, with the half-precision floating-point
19055 conversion operations.
19056
19057 +nosimd
19058 Disable the Advanced SIMD instructions (does not disable
19059 floating point).
19060
19061 +nofp
19062 Disable the floating-point and Advanced SIMD instructions.
19063
19064 armv8-a
19065 +crc
19066 The Cyclic Redundancy Check (CRC) instructions.
19067
19068 +simd
19069 The ARMv8-A Advanced SIMD and floating-point instructions.
19070
19071 +crypto
19072 The cryptographic instructions.
19073
19074 +nocrypto
19075 Disable the cryptographic instructions.
19076
19077 +nofp
19078 Disable the floating-point, Advanced SIMD and cryptographic
19079 instructions.
19080
19081 +sb Speculation Barrier Instruction.
19082
19083 +predres
19084 Execution and Data Prediction Restriction Instructions.
19085
19086 armv8.1-a
19087 +simd
19088 The ARMv8.1-A Advanced SIMD and floating-point
19089 instructions.
19090
19091 +crypto
19092 The cryptographic instructions. This also enables the
19093 Advanced SIMD and floating-point instructions.
19094
19095 +nocrypto
19096 Disable the cryptographic instructions.
19097
19098 +nofp
19099 Disable the floating-point, Advanced SIMD and cryptographic
19100 instructions.
19101
19102 +sb Speculation Barrier Instruction.
19103
19104 +predres
19105 Execution and Data Prediction Restriction Instructions.
19106
19107 armv8.2-a
19108 armv8.3-a
19109 +fp16
19110 The half-precision floating-point data processing
19111 instructions. This also enables the Advanced SIMD and
19112 floating-point instructions.
19113
19114 +fp16fml
19115 The half-precision floating-point fmla extension. This
19116 also enables the half-precision floating-point extension
19117 and Advanced SIMD and floating-point instructions.
19118
19119 +simd
19120 The ARMv8.1-A Advanced SIMD and floating-point
19121 instructions.
19122
19123 +crypto
19124 The cryptographic instructions. This also enables the
19125 Advanced SIMD and floating-point instructions.
19126
19127 +dotprod
19128 Enable the Dot Product extension. This also enables
19129 Advanced SIMD instructions.
19130
19131 +nocrypto
19132 Disable the cryptographic extension.
19133
19134 +nofp
19135 Disable the floating-point, Advanced SIMD and cryptographic
19136 instructions.
19137
19138 +sb Speculation Barrier Instruction.
19139
19140 +predres
19141 Execution and Data Prediction Restriction Instructions.
19142
19143 +i8mm
19144 8-bit Integer Matrix Multiply instructions. This also
19145 enables Advanced SIMD and floating-point instructions.
19146
19147 +bf16
19148 Brain half-precision floating-point instructions. This
19149 also enables Advanced SIMD and floating-point instructions.
19150
19151 armv8.4-a
19152 +fp16
19153 The half-precision floating-point data processing
19154 instructions. This also enables the Advanced SIMD and
19155 floating-point instructions as well as the Dot Product
19156 extension and the half-precision floating-point fmla
19157 extension.
19158
19159 +simd
19160 The ARMv8.3-A Advanced SIMD and floating-point instructions
19161 as well as the Dot Product extension.
19162
19163 +crypto
19164 The cryptographic instructions. This also enables the
19165 Advanced SIMD and floating-point instructions as well as
19166 the Dot Product extension.
19167
19168 +nocrypto
19169 Disable the cryptographic extension.
19170
19171 +nofp
19172 Disable the floating-point, Advanced SIMD and cryptographic
19173 instructions.
19174
19175 +sb Speculation Barrier Instruction.
19176
19177 +predres
19178 Execution and Data Prediction Restriction Instructions.
19179
19180 +i8mm
19181 8-bit Integer Matrix Multiply instructions. This also
19182 enables Advanced SIMD and floating-point instructions.
19183
19184 +bf16
19185 Brain half-precision floating-point instructions. This
19186 also enables Advanced SIMD and floating-point instructions.
19187
19188 armv8.5-a
19189 +fp16
19190 The half-precision floating-point data processing
19191 instructions. This also enables the Advanced SIMD and
19192 floating-point instructions as well as the Dot Product
19193 extension and the half-precision floating-point fmla
19194 extension.
19195
19196 +simd
19197 The ARMv8.3-A Advanced SIMD and floating-point instructions
19198 as well as the Dot Product extension.
19199
19200 +crypto
19201 The cryptographic instructions. This also enables the
19202 Advanced SIMD and floating-point instructions as well as
19203 the Dot Product extension.
19204
19205 +nocrypto
19206 Disable the cryptographic extension.
19207
19208 +nofp
19209 Disable the floating-point, Advanced SIMD and cryptographic
19210 instructions.
19211
19212 +i8mm
19213 8-bit Integer Matrix Multiply instructions. This also
19214 enables Advanced SIMD and floating-point instructions.
19215
19216 +bf16
19217 Brain half-precision floating-point instructions. This
19218 also enables Advanced SIMD and floating-point instructions.
19219
19220 armv8.6-a
19221 +fp16
19222 The half-precision floating-point data processing
19223 instructions. This also enables the Advanced SIMD and
19224 floating-point instructions as well as the Dot Product
19225 extension and the half-precision floating-point fmla
19226 extension.
19227
19228 +simd
19229 The ARMv8.3-A Advanced SIMD and floating-point instructions
19230 as well as the Dot Product extension.
19231
19232 +crypto
19233 The cryptographic instructions. This also enables the
19234 Advanced SIMD and floating-point instructions as well as
19235 the Dot Product extension.
19236
19237 +nocrypto
19238 Disable the cryptographic extension.
19239
19240 +nofp
19241 Disable the floating-point, Advanced SIMD and cryptographic
19242 instructions.
19243
19244 +i8mm
19245 8-bit Integer Matrix Multiply instructions. This also
19246 enables Advanced SIMD and floating-point instructions.
19247
19248 +bf16
19249 Brain half-precision floating-point instructions. This
19250 also enables Advanced SIMD and floating-point instructions.
19251
19252 armv7-r
19253 +fp.sp
19254 The single-precision VFPv3 floating-point instructions.
19255 The extension +vfpv3xd can be used as an alias for this
19256 extension.
19257
19258 +fp The VFPv3 floating-point instructions with 16 double-
19259 precision registers. The extension +vfpv3-d16 can be used
19260 as an alias for this extension.
19261
19262 +vfpv3xd-d16-fp16
19263 The single-precision VFPv3 floating-point instructions with
19264 16 double-precision registers and the half-precision
19265 floating-point conversion operations.
19266
19267 +vfpv3-d16-fp16
19268 The VFPv3 floating-point instructions with 16 double-
19269 precision registers and the half-precision floating-point
19270 conversion operations.
19271
19272 +nofp
19273 Disable the floating-point extension.
19274
19275 +idiv
19276 The ARM-state integer division instructions.
19277
19278 +noidiv
19279 Disable the ARM-state integer division extension.
19280
19281 armv7e-m
19282 +fp The single-precision VFPv4 floating-point instructions.
19283
19284 +fpv5
19285 The single-precision FPv5 floating-point instructions.
19286
19287 +fp.dp
19288 The single- and double-precision FPv5 floating-point
19289 instructions.
19290
19291 +nofp
19292 Disable the floating-point extensions.
19293
19294 armv8.1-m.main
19295 +dsp
19296 The DSP instructions.
19297
19298 +mve
19299 The M-Profile Vector Extension (MVE) integer instructions.
19300
19301 +mve.fp
19302 The M-Profile Vector Extension (MVE) integer and single
19303 precision floating-point instructions.
19304
19305 +fp The single-precision floating-point instructions.
19306
19307 +fp.dp
19308 The single- and double-precision floating-point
19309 instructions.
19310
19311 +nofp
19312 Disable the floating-point extension.
19313
19314 +cdecp0, +cdecp1, ... , +cdecp7
19315 Enable the Custom Datapath Extension (CDE) on selected
19316 coprocessors according to the numbers given in the options
19317 in the range 0 to 7.
19318
19319 +pacbti
19320 Enable the Pointer Authentication and Branch Target
19321 Identification Extension.
19322
19323 armv8-m.main
19324 +dsp
19325 The DSP instructions.
19326
19327 +nodsp
19328 Disable the DSP extension.
19329
19330 +fp The single-precision floating-point instructions.
19331
19332 +fp.dp
19333 The single- and double-precision floating-point
19334 instructions.
19335
19336 +nofp
19337 Disable the floating-point extension.
19338
19339 +cdecp0, +cdecp1, ... , +cdecp7
19340 Enable the Custom Datapath Extension (CDE) on selected
19341 coprocessors according to the numbers given in the options
19342 in the range 0 to 7.
19343
19344 armv8-r
19345 +crc
19346 The Cyclic Redundancy Check (CRC) instructions.
19347
19348 +fp.sp
19349 The single-precision FPv5 floating-point instructions.
19350
19351 +simd
19352 The ARMv8-A Advanced SIMD and floating-point instructions.
19353
19354 +crypto
19355 The cryptographic instructions.
19356
19357 +nocrypto
19358 Disable the cryptographic instructions.
19359
19360 +nofp
19361 Disable the floating-point, Advanced SIMD and cryptographic
19362 instructions.
19363
19364 -march=native causes the compiler to auto-detect the architecture
19365 of the build computer. At present, this feature is only supported
19366 on GNU/Linux, and not all architectures are recognized. If the
19367 auto-detect is unsuccessful the option has no effect.
19368
19369 -mtune=name
19370 This option specifies the name of the target ARM processor for
19371 which GCC should tune the performance of the code. For some ARM
19372 implementations better performance can be obtained by using this
19373 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
19374 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
19375 strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t, arm922t,
19376 arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t, arm9tdmi,
19377 arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e, arm1022e,
19378 arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp, arm1156t2-s,
19379 arm1156t2f-s, arm1176jz-s, arm1176jzf-s, generic-armv7-a,
19380 cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
19381 cortex-a17, cortex-a32, cortex-a35, cortex-a53, cortex-a55,
19382 cortex-a57, cortex-a72, cortex-a73, cortex-a75, cortex-a76,
19383 cortex-a76ae, cortex-a77, cortex-a78, cortex-a78ae, cortex-a78c,
19384 cortex-a710, ares, cortex-r4, cortex-r4f, cortex-r5, cortex-r7,
19385 cortex-r8, cortex-r52, cortex-r52plus, cortex-m0, cortex-m0plus,
19386 cortex-m1, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33,
19387 cortex-m35p, cortex-m55, cortex-m85, cortex-x1, cortex-x1c,
19388 cortex-m1.small-multiply, cortex-m0.small-multiply,
19389 cortex-m0plus.small-multiply, exynos-m1, marvell-pj4, neoverse-n1,
19390 neoverse-n2, neoverse-v1, xscale, iwmmxt, iwmmxt2, ep9312, fa526,
19391 fa626, fa606te, fa626te, fmp626, fa726te, star-mc1, xgene1.
19392
19393 Additionally, this option can specify that GCC should tune the
19394 performance of the code for a big.LITTLE system. Permissible names
19395 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
19396 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
19397 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
19398 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
19399
19400 -mtune=generic-arch specifies that GCC should tune the performance
19401 for a blend of processors within architecture arch. The aim is to
19402 generate code that run well on the current most popular processors,
19403 balancing between optimizations that benefit some CPUs in the
19404 range, and avoiding performance pitfalls of other CPUs. The
19405 effects of this option may change in future GCC versions as CPU
19406 models come and go.
19407
19408 -mtune permits the same extension options as -mcpu, but the
19409 extension options do not affect the tuning of the generated code.
19410
19411 -mtune=native causes the compiler to auto-detect the CPU of the
19412 build computer. At present, this feature is only supported on
19413 GNU/Linux, and not all architectures are recognized. If the auto-
19414 detect is unsuccessful the option has no effect.
19415
19416 -mcpu=name[+extension...]
19417 This specifies the name of the target ARM processor. GCC uses this
19418 name to derive the name of the target ARM architecture (as if
19419 specified by -march) and the ARM processor type for which to tune
19420 for performance (as if specified by -mtune). Where this option is
19421 used in conjunction with -march or -mtune, those options take
19422 precedence over the appropriate part of this option.
19423
19424 Many of the supported CPUs implement optional architectural
19425 extensions. Where this is so the architectural extensions are
19426 normally enabled by default. If implementations that lack the
19427 extension exist, then the extension syntax can be used to disable
19428 those extensions that have been omitted. For floating-point and
19429 Advanced SIMD (Neon) instructions, the settings of the options
19430 -mfloat-abi and -mfpu must also be considered: floating-point and
19431 Advanced SIMD instructions will only be used if -mfloat-abi is not
19432 set to soft; and any setting of -mfpu other than auto will override
19433 the available floating-point and SIMD extension instructions.
19434
19435 For example, cortex-a9 can be found in three major configurations:
19436 integer only, with just a floating-point unit or with floating-
19437 point and Advanced SIMD. The default is to enable all the
19438 instructions, but the extensions +nosimd and +nofp can be used to
19439 disable just the SIMD or both the SIMD and floating-point
19440 instructions respectively.
19441
19442 Permissible names for this option are the same as those for -mtune.
19443
19444 The following extension options are common to the listed CPUs:
19445
19446 +nodsp
19447 Disable the DSP instructions on cortex-m33, cortex-m35p,
19448 cortex-m55 and cortex-m85. Also disable the M-Profile Vector
19449 Extension (MVE) integer and single precision floating-point
19450 instructions on cortex-m55 and cortex-m85.
19451
19452 +nopacbti
19453 Disable the Pointer Authentication and Branch Target
19454 Identification Extension on cortex-m85.
19455
19456 +nomve
19457 Disable the M-Profile Vector Extension (MVE) integer and single
19458 precision floating-point instructions on cortex-m55 and
19459 cortex-m85.
19460
19461 +nomve.fp
19462 Disable the M-Profile Vector Extension (MVE) single precision
19463 floating-point instructions on cortex-m55 and cortex-m85.
19464
19465 +cdecp0, +cdecp1, ... , +cdecp7
19466 Enable the Custom Datapath Extension (CDE) on selected
19467 coprocessors according to the numbers given in the options in
19468 the range 0 to 7 on cortex-m55.
19469
19470 +nofp
19471 Disables the floating-point instructions on arm9e, arm946e-s,
19472 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
19473 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
19474 cortex-m7, cortex-m33, cortex-m35p cortex-m4, cortex-m7,
19475 cortex-m33, cortex-m35p, cortex-m55 and cortex-m85. Disables
19476 the floating-point and SIMD instructions on generic-armv7-a,
19477 cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a12,
19478 cortex-a15, cortex-a17, cortex-a15.cortex-a7,
19479 cortex-a17.cortex-a7, cortex-a32, cortex-a35, cortex-a53 and
19480 cortex-a55.
19481
19482 +nofp.dp
19483 Disables the double-precision component of the floating-point
19484 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52,
19485 cortex-r52plus and cortex-m7.
19486
19487 +nosimd
19488 Disables the SIMD (but not floating-point) instructions on
19489 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
19490
19491 +crypto
19492 Enables the cryptographic instructions on cortex-a32,
19493 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
19494 cortex-a73, cortex-a75, exynos-m1, xgene1,
19495 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
19496 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
19497 cortex-a75.cortex-a55.
19498
19499 Additionally the generic-armv7-a pseudo target defaults to VFPv3
19500 with 16 double-precision registers. It supports the following
19501 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
19502 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
19503 neon-vfpv4. The meanings are the same as for the extensions to
19504 -march=armv7-a.
19505
19506 -mcpu=generic-arch is also permissible, and is equivalent to
19507 -march=arch -mtune=generic-arch. See -mtune for more information.
19508
19509 -mcpu=native causes the compiler to auto-detect the CPU of the
19510 build computer. At present, this feature is only supported on
19511 GNU/Linux, and not all architectures are recognized. If the auto-
19512 detect is unsuccessful the option has no effect.
19513
19514 -mfpu=name
19515 This specifies what floating-point hardware (or hardware emulation)
19516 is available on the target. Permissible names are: auto, vfpv2,
19517 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
19518 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
19519 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
19520 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
19521 and vfp is an alias for vfpv2.
19522
19523 The setting auto is the default and is special. It causes the
19524 compiler to select the floating-point and Advanced SIMD
19525 instructions based on the settings of -mcpu and -march.
19526
19527 If the selected floating-point hardware includes the NEON extension
19528 (e.g. -mfpu=neon), note that floating-point operations are not
19529 generated by GCC's auto-vectorization pass unless
19530 -funsafe-math-optimizations is also specified. This is because
19531 NEON hardware does not fully implement the IEEE 754 standard for
19532 floating-point arithmetic (in particular denormal values are
19533 treated as zero), so the use of NEON instructions may lead to a
19534 loss of precision.
19535
19536 You can also set the fpu name at function level by using the
19537 target("fpu=") function attributes or pragmas.
19538
19539 -mfp16-format=name
19540 Specify the format of the "__fp16" half-precision floating-point
19541 type. Permissible names are none, ieee, and alternative; the
19542 default is none, in which case the "__fp16" type is not defined.
19543
19544 -mstructure-size-boundary=n
19545 The sizes of all structures and unions are rounded up to a multiple
19546 of the number of bits set by this option. Permissible values are
19547 8, 32 and 64. The default value varies for different toolchains.
19548 For the COFF targeted toolchain the default value is 8. A value of
19549 64 is only allowed if the underlying ABI supports it.
19550
19551 Specifying a larger number can produce faster, more efficient code,
19552 but can also increase the size of the program. Different values
19553 are potentially incompatible. Code compiled with one value cannot
19554 necessarily expect to work with code or libraries compiled with
19555 another value, if they exchange information using structures or
19556 unions.
19557
19558 This option is deprecated.
19559
19560 -mabort-on-noreturn
19561 Generate a call to the function "abort" at the end of a "noreturn"
19562 function. It is executed if the function tries to return.
19563
19564 -mlong-calls
19565 -mno-long-calls
19566 Tells the compiler to perform function calls by first loading the
19567 address of the function into a register and then performing a
19568 subroutine call on this register. This switch is needed if the
19569 target function lies outside of the 64-megabyte addressing range of
19570 the offset-based version of subroutine call instruction.
19571
19572 Even if this switch is enabled, not all function calls are turned
19573 into long calls. The heuristic is that static functions, functions
19574 that have the "short_call" attribute, functions that are inside the
19575 scope of a "#pragma no_long_calls" directive, and functions whose
19576 definitions have already been compiled within the current
19577 compilation unit are not turned into long calls. The exceptions to
19578 this rule are that weak function definitions, functions with the
19579 "long_call" attribute or the "section" attribute, and functions
19580 that are within the scope of a "#pragma long_calls" directive are
19581 always turned into long calls.
19582
19583 This feature is not enabled by default. Specifying -mno-long-calls
19584 restores the default behavior, as does placing the function calls
19585 within the scope of a "#pragma long_calls_off" directive. Note
19586 these switches have no effect on how the compiler generates code to
19587 handle function calls via function pointers.
19588
19589 -msingle-pic-base
19590 Treat the register used for PIC addressing as read-only, rather
19591 than loading it in the prologue for each function. The runtime
19592 system is responsible for initializing this register with an
19593 appropriate value before execution begins.
19594
19595 -mpic-register=reg
19596 Specify the register to be used for PIC addressing. For standard
19597 PIC base case, the default is any suitable register determined by
19598 compiler. For single PIC base case, the default is R9 if target is
19599 EABI based or stack-checking is enabled, otherwise the default is
19600 R10.
19601
19602 -mpic-data-is-text-relative
19603 Assume that the displacement between the text and data segments is
19604 fixed at static link time. This permits using PC-relative
19605 addressing operations to access data known to be in the data
19606 segment. For non-VxWorks RTP targets, this option is enabled by
19607 default. When disabled on such targets, it will enable
19608 -msingle-pic-base by default.
19609
19610 -mpoke-function-name
19611 Write the name of each function into the text section, directly
19612 preceding the function prologue. The generated code is similar to
19613 this:
19614
19615 t0
19616 .ascii "arm_poke_function_name", 0
19617 .align
19618 t1
19619 .word 0xff000000 + (t1 - t0)
19620 arm_poke_function_name
19621 mov ip, sp
19622 stmfd sp!, {fp, ip, lr, pc}
19623 sub fp, ip, #4
19624
19625 When performing a stack backtrace, code can inspect the value of
19626 "pc" stored at "fp + 0". If the trace function then looks at
19627 location "pc - 12" and the top 8 bits are set, then we know that
19628 there is a function name embedded immediately preceding this
19629 location and has length "((pc[-3]) & 0xff000000)".
19630
19631 -mthumb
19632 -marm
19633 Select between generating code that executes in ARM and Thumb
19634 states. The default for most configurations is to generate code
19635 that executes in ARM state, but the default can be changed by
19636 configuring GCC with the --with-mode=state configure option.
19637
19638 You can also override the ARM and Thumb mode for each function by
19639 using the target("thumb") and target("arm") function attributes or
19640 pragmas.
19641
19642 -mflip-thumb
19643 Switch ARM/Thumb modes on alternating functions. This option is
19644 provided for regression testing of mixed Thumb/ARM code generation,
19645 and is not intended for ordinary use in compiling code.
19646
19647 -mtpcs-frame
19648 Generate a stack frame that is compliant with the Thumb Procedure
19649 Call Standard for all non-leaf functions. (A leaf function is one
19650 that does not call any other functions.) The default is
19651 -mno-tpcs-frame.
19652
19653 -mtpcs-leaf-frame
19654 Generate a stack frame that is compliant with the Thumb Procedure
19655 Call Standard for all leaf functions. (A leaf function is one that
19656 does not call any other functions.) The default is
19657 -mno-apcs-leaf-frame.
19658
19659 -mcallee-super-interworking
19660 Gives all externally visible functions in the file being compiled
19661 an ARM instruction set header which switches to Thumb mode before
19662 executing the rest of the function. This allows these functions to
19663 be called from non-interworking code. This option is not valid in
19664 AAPCS configurations because interworking is enabled by default.
19665
19666 -mcaller-super-interworking
19667 Allows calls via function pointers (including virtual functions) to
19668 execute correctly regardless of whether the target code has been
19669 compiled for interworking or not. There is a small overhead in the
19670 cost of executing a function pointer if this option is enabled.
19671 This option is not valid in AAPCS configurations because
19672 interworking is enabled by default.
19673
19674 -mtp=name
19675 Specify the access model for the thread local storage pointer. The
19676 valid models are soft, which generates calls to "__aeabi_read_tp",
19677 cp15, which fetches the thread pointer from "cp15" directly
19678 (supported in the arm6k architecture), and auto, which uses the
19679 best available method for the selected processor. The default
19680 setting is auto.
19681
19682 -mtls-dialect=dialect
19683 Specify the dialect to use for accessing thread local storage. Two
19684 dialects are supported---gnu and gnu2. The gnu dialect selects the
19685 original GNU scheme for supporting local and global dynamic TLS
19686 models. The gnu2 dialect selects the GNU descriptor scheme, which
19687 provides better performance for shared libraries. The GNU
19688 descriptor scheme is compatible with the original scheme, but does
19689 require new assembler, linker and library support. Initial and
19690 local exec TLS models are unaffected by this option and always use
19691 the original scheme.
19692
19693 -mword-relocations
19694 Only generate absolute relocations on word-sized values (i.e.
19695 R_ARM_ABS32). This is enabled by default on targets (uClinux,
19696 SymbianOS) where the runtime loader imposes this restriction, and
19697 when -fpic or -fPIC is specified. This option conflicts with
19698 -mslow-flash-data.
19699
19700 -mfix-cortex-m3-ldrd
19701 Some Cortex-M3 cores can cause data corruption when "ldrd"
19702 instructions with overlapping destination and base registers are
19703 used. This option avoids generating these instructions. This
19704 option is enabled by default when -mcpu=cortex-m3 is specified.
19705
19706 -mfix-cortex-a57-aes-1742098
19707 -mno-fix-cortex-a57-aes-1742098
19708 -mfix-cortex-a72-aes-1655431
19709 -mno-fix-cortex-a72-aes-1655431
19710 Enable (disable) mitigation for an erratum on Cortex-A57 and
19711 Cortex-A72 that affects the AES cryptographic instructions. This
19712 option is enabled by default when either -mcpu=cortex-a57 or
19713 -mcpu=cortex-a72 is specified.
19714
19715 -munaligned-access
19716 -mno-unaligned-access
19717 Enables (or disables) reading and writing of 16- and 32- bit values
19718 from addresses that are not 16- or 32- bit aligned. By default
19719 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
19720 ARMv8-M Baseline architectures, and enabled for all other
19721 architectures. If unaligned access is not enabled then words in
19722 packed data structures are accessed a byte at a time.
19723
19724 The ARM attribute "Tag_CPU_unaligned_access" is set in the
19725 generated object file to either true or false, depending upon the
19726 setting of this option. If unaligned access is enabled then the
19727 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
19728
19729 -mneon-for-64bits
19730 This option is deprecated and has no effect.
19731
19732 -mslow-flash-data
19733 Assume loading data from flash is slower than fetching instruction.
19734 Therefore literal load is minimized for better performance. This
19735 option is only supported when compiling for ARMv7 M-profile and off
19736 by default. It conflicts with -mword-relocations.
19737
19738 -masm-syntax-unified
19739 Assume inline assembler is using unified asm syntax. The default
19740 is currently off which implies divided syntax. This option has no
19741 impact on Thumb2. However, this may change in future releases of
19742 GCC. Divided syntax should be considered deprecated.
19743
19744 -mrestrict-it
19745 Restricts generation of IT blocks to conform to the rules of
19746 ARMv8-A. IT blocks can only contain a single 16-bit instruction
19747 from a select set of instructions. This option is on by default for
19748 ARMv8-A Thumb mode.
19749
19750 -mprint-tune-info
19751 Print CPU tuning information as comment in assembler file. This is
19752 an option used only for regression testing of the compiler and not
19753 intended for ordinary use in compiling code. This option is
19754 disabled by default.
19755
19756 -mverbose-cost-dump
19757 Enable verbose cost model dumping in the debug dump files. This
19758 option is provided for use in debugging the compiler.
19759
19760 -mpure-code
19761 Do not allow constant data to be placed in code sections.
19762 Additionally, when compiling for ELF object format give all text
19763 sections the ELF processor-specific section attribute
19764 "SHF_ARM_PURECODE". This option is only available when generating
19765 non-pic code for M-profile targets.
19766
19767 -mcmse
19768 Generate secure code as per the "ARMv8-M Security Extensions:
19769 Requirements on Development Tools Engineering Specification", which
19770 can be found on
19771 <https://developer.arm.com/documentation/ecm0359818/latest/>.
19772
19773 -mfix-cmse-cve-2021-35465
19774 Mitigate against a potential security issue with the "VLLDM"
19775 instruction in some M-profile devices when using CMSE
19776 (CVE-2021-365465). This option is enabled by default when the
19777 option -mcpu= is used with "cortex-m33", "cortex-m35p",
19778 "cortex-m55", "cortex-m85" or "star-mc1". The option
19779 -mno-fix-cmse-cve-2021-35465 can be used to disable the mitigation.
19780
19781 -mstack-protector-guard=guard
19782 -mstack-protector-guard-offset=offset
19783 Generate stack protection code using canary at guard. Supported
19784 locations are global for a global canary or tls for a canary
19785 accessible via the TLS register. The option
19786 -mstack-protector-guard-offset= is for use with
19787 -fstack-protector-guard=tls and not for use in user-land code.
19788
19789 -mfdpic
19790 -mno-fdpic
19791 Select the FDPIC ABI, which uses 64-bit function descriptors to
19792 represent pointers to functions. When the compiler is configured
19793 for "arm-*-uclinuxfdpiceabi" targets, this option is on by default
19794 and implies -fPIE if none of the PIC/PIE-related options is
19795 provided. On other targets, it only enables the FDPIC-specific
19796 code generation features, and the user should explicitly provide
19797 the PIC/PIE-related options as needed.
19798
19799 Note that static linking is not supported because it would still
19800 involve the dynamic linker when the program self-relocates. If
19801 such behavior is acceptable, use -static and -Wl,-dynamic-linker
19802 options.
19803
19804 The opposite -mno-fdpic option is useful (and required) to build
19805 the Linux kernel using the same ("arm-*-uclinuxfdpiceabi")
19806 toolchain as the one used to build the userland programs.
19807
19808 -mbranch-protection=none|standard|pac-ret[+leaf][+bti]|bti[+pac-
19809 ret[+leaf]]
19810 Enable branch protection features (armv8.1-m.main only). none
19811 generate code without branch protection or return address signing.
19812 standard[+leaf] generate code with all branch protection features
19813 enabled at their standard level. pac-ret[+leaf] generate code with
19814 return address signing set to its standard level, which is to sign
19815 all functions that save the return address to memory. leaf When
19816 return address signing is enabled, also sign leaf functions even if
19817 they do not write the return address to memory. +bti Add landing-
19818 pad instructions at the permitted targets of indirect branch
19819 instructions.
19820
19821 If the +pacbti architecture extension is not enabled, then all
19822 branch protection and return address signing operations are
19823 constrained to use only the instructions defined in the
19824 architectural-NOP space. The generated code will remain backwards-
19825 compatible with earlier versions of the architecture, but the
19826 additional security can be enabled at run time on processors that
19827 support the PACBTI extension.
19828
19829 Branch target enforcement using BTI can only be enabled at runtime
19830 if all code in the application has been compiled with at least
19831 -mbranch-protection=bti.
19832
19833 Any setting other than none is supported only on armv8-m.main or
19834 later.
19835
19836 The default is to generate code without branch protection or return
19837 address signing.
19838
19839 AVR Options
19840
19841 These options are defined for AVR implementations:
19842
19843 -mmcu=mcu
19844 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
19845
19846 The default for this option is avr2.
19847
19848 GCC supports the following AVR devices and ISAs:
19849
19850 "avr2"
19851 "Classic" devices with up to 8 KiB of program memory. mcu =
19852 "attiny22", "attiny26", "at90s2313", "at90s2323", "at90s2333",
19853 "at90s2343", "at90s4414", "at90s4433", "at90s4434",
19854 "at90c8534", "at90s8515", "at90s8535".
19855
19856 "avr25"
19857 "Classic" devices with up to 8 KiB of program memory and with
19858 the "MOVW" instruction. mcu = "attiny13", "attiny13a",
19859 "attiny24", "attiny24a", "attiny25", "attiny261", "attiny261a",
19860 "attiny2313", "attiny2313a", "attiny43u", "attiny44",
19861 "attiny44a", "attiny45", "attiny48", "attiny441", "attiny461",
19862 "attiny461a", "attiny4313", "attiny84", "attiny84a",
19863 "attiny85", "attiny87", "attiny88", "attiny828", "attiny841",
19864 "attiny861", "attiny861a", "ata5272", "ata6616c", "at86rf401".
19865
19866 "avr3"
19867 "Classic" devices with 16 KiB up to 64 KiB of program memory.
19868 mcu = "at76c711", "at43usb355".
19869
19870 "avr31"
19871 "Classic" devices with 128 KiB of program memory. mcu =
19872 "atmega103", "at43usb320".
19873
19874 "avr35"
19875 "Classic" devices with 16 KiB up to 64 KiB of program memory
19876 and with the "MOVW" instruction. mcu = "attiny167",
19877 "attiny1634", "atmega8u2", "atmega16u2", "atmega32u2",
19878 "ata5505", "ata6617c", "ata664251", "at90usb82", "at90usb162".
19879
19880 "avr4"
19881 "Enhanced" devices with up to 8 KiB of program memory. mcu =
19882 "atmega48", "atmega48a", "atmega48p", "atmega48pa",
19883 "atmega48pb", "atmega8", "atmega8a", "atmega8hva", "atmega88",
19884 "atmega88a", "atmega88p", "atmega88pa", "atmega88pb",
19885 "atmega8515", "atmega8535", "ata6285", "ata6286", "ata6289",
19886 "ata6612c", "at90pwm1", "at90pwm2", "at90pwm2b", "at90pwm3",
19887 "at90pwm3b", "at90pwm81".
19888
19889 "avr5"
19890 "Enhanced" devices with 16 KiB up to 64 KiB of program memory.
19891 mcu = "atmega16", "atmega16a", "atmega16hva", "atmega16hva2",
19892 "atmega16hvb", "atmega16hvbrevb", "atmega16m1", "atmega16u4",
19893 "atmega161", "atmega162", "atmega163", "atmega164a",
19894 "atmega164p", "atmega164pa", "atmega165", "atmega165a",
19895 "atmega165p", "atmega165pa", "atmega168", "atmega168a",
19896 "atmega168p", "atmega168pa", "atmega168pb", "atmega169",
19897 "atmega169a", "atmega169p", "atmega169pa", "atmega32",
19898 "atmega32a", "atmega32c1", "atmega32hvb", "atmega32hvbrevb",
19899 "atmega32m1", "atmega32u4", "atmega32u6", "atmega323",
19900 "atmega324a", "atmega324p", "atmega324pa", "atmega324pb",
19901 "atmega325", "atmega325a", "atmega325p", "atmega325pa",
19902 "atmega328", "atmega328p", "atmega328pb", "atmega329",
19903 "atmega329a", "atmega329p", "atmega329pa", "atmega3250",
19904 "atmega3250a", "atmega3250p", "atmega3250pa", "atmega3290",
19905 "atmega3290a", "atmega3290p", "atmega3290pa", "atmega406",
19906 "atmega64", "atmega64a", "atmega64c1", "atmega64hve",
19907 "atmega64hve2", "atmega64m1", "atmega64rfr2", "atmega640",
19908 "atmega644", "atmega644a", "atmega644p", "atmega644pa",
19909 "atmega644rfr2", "atmega645", "atmega645a", "atmega645p",
19910 "atmega649", "atmega649a", "atmega649p", "atmega6450",
19911 "atmega6450a", "atmega6450p", "atmega6490", "atmega6490a",
19912 "atmega6490p", "ata5795", "ata5790", "ata5790n", "ata5791",
19913 "ata6613c", "ata6614q", "ata5782", "ata5831", "ata8210",
19914 "ata8510", "ata5702m322", "at90pwm161", "at90pwm216",
19915 "at90pwm316", "at90can32", "at90can64", "at90scr100",
19916 "at90usb646", "at90usb647", "at94k", "m3000".
19917
19918 "avr51"
19919 "Enhanced" devices with 128 KiB of program memory. mcu =
19920 "atmega128", "atmega128a", "atmega128rfa1", "atmega128rfr2",
19921 "atmega1280", "atmega1281", "atmega1284", "atmega1284p",
19922 "atmega1284rfr2", "at90can128", "at90usb1286", "at90usb1287".
19923
19924 "avr6"
19925 "Enhanced" devices with 3-byte PC, i.e. with more than 128 KiB
19926 of program memory. mcu = "atmega256rfr2", "atmega2560",
19927 "atmega2561", "atmega2564rfr2".
19928
19929 "avrxmega2"
19930 "XMEGA" devices with more than 8 KiB and up to 64 KiB of
19931 program memory. mcu = "atxmega8e5", "atxmega16a4",
19932 "atxmega16a4u", "atxmega16c4", "atxmega16d4", "atxmega16e5",
19933 "atxmega32a4", "atxmega32a4u", "atxmega32c3", "atxmega32c4",
19934 "atxmega32d3", "atxmega32d4", "atxmega32e5", "avr64da28",
19935 "avr64da32", "avr64da48", "avr64da64", "avr64db28",
19936 "avr64db32", "avr64db48", "avr64db64".
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 "attiny804", "attiny806", "attiny807", "attiny814",
19945 "attiny816", "attiny817", "attiny1604", "attiny1606",
19946 "attiny1607", "attiny1614", "attiny1616", "attiny1617",
19947 "attiny3214", "attiny3216", "attiny3217", "atmega808",
19948 "atmega809", "atmega1608", "atmega1609", "atmega3208",
19949 "atmega3209", "atmega4808", "atmega4809", "avr32da28",
19950 "avr32da32", "avr32da48", "avr32db28", "avr32db32",
19951 "avr32db48".
19952
19953 "avrxmega4"
19954 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
19955 program memory. mcu = "atxmega64a3", "atxmega64a3u",
19956 "atxmega64a4u", "atxmega64b1", "atxmega64b3", "atxmega64c3",
19957 "atxmega64d3", "atxmega64d4", "avr128da28", "avr128da32",
19958 "avr128da48", "avr128da64", "avr128db28", "avr128db32",
19959 "avr128db48", "avr128db64".
19960
19961 "avrxmega5"
19962 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
19963 program memory and more than 64 KiB of RAM. mcu =
19964 "atxmega64a1", "atxmega64a1u".
19965
19966 "avrxmega6"
19967 "XMEGA" devices with more than 128 KiB of program memory. mcu
19968 = "atxmega128a3", "atxmega128a3u", "atxmega128b1",
19969 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
19970 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
19971 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
19972 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
19973 "atxmega256d3", "atxmega384c3", "atxmega384d3".
19974
19975 "avrxmega7"
19976 "XMEGA" devices with more than 128 KiB of program memory and
19977 more than 64 KiB of RAM. mcu = "atxmega128a1",
19978 "atxmega128a1u", "atxmega128a4u".
19979
19980 "avrtiny"
19981 "TINY" Tiny core devices with 512 B up to 4 KiB of program
19982 memory. mcu = "attiny4", "attiny5", "attiny9", "attiny10",
19983 "attiny20", "attiny40".
19984
19985 "avr1"
19986 This ISA is implemented by the minimal AVR core and supported
19987 for assembler only. mcu = "attiny11", "attiny12", "attiny15",
19988 "attiny28", "at90s1200".
19989
19990 -mabsdata
19991 Assume that all data in static storage can be accessed by LDS / STS
19992 instructions. This option has only an effect on reduced Tiny
19993 devices like ATtiny40. See also the "absdata" AVR Variable
19994 Attributes,variable attribute.
19995
19996 -maccumulate-args
19997 Accumulate outgoing function arguments and acquire/release the
19998 needed stack space for outgoing function arguments once in function
19999 prologue/epilogue. Without this option, outgoing arguments are
20000 pushed before calling a function and popped afterwards.
20001
20002 Popping the arguments after the function call can be expensive on
20003 AVR so that accumulating the stack space might lead to smaller
20004 executables because arguments need not be removed from the stack
20005 after such a function call.
20006
20007 This option can lead to reduced code size for functions that
20008 perform several calls to functions that get their arguments on the
20009 stack like calls to printf-like functions.
20010
20011 -mbranch-cost=cost
20012 Set the branch costs for conditional branch instructions to cost.
20013 Reasonable values for cost are small, non-negative integers. The
20014 default branch cost is 0.
20015
20016 -mcall-prologues
20017 Functions prologues/epilogues are expanded as calls to appropriate
20018 subroutines. Code size is smaller.
20019
20020 -mdouble=bits
20021 -mlong-double=bits
20022 Set the size (in bits) of the "double" or "long double" type,
20023 respectively. Possible values for bits are 32 and 64. Whether or
20024 not a specific value for bits is allowed depends on the
20025 "--with-double=" and "--with-long-double=" configure options
20026 ("https://gcc.gnu.org/install/configure.html#avr"), and the same
20027 applies for the default values of the options.
20028
20029 -mgas-isr-prologues
20030 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
20031 instruction supported by GNU Binutils. If this option is on, the
20032 feature can still be disabled for individual ISRs by means of the
20033 AVR Function Attributes,,"no_gccisr" function attribute. This
20034 feature is activated per default if optimization is on (but not
20035 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
20036 PR21683 ("https://sourceware.org/PR21683").
20037
20038 -mint8
20039 Assume "int" to be 8-bit integer. This affects the sizes of all
20040 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
20041 and "long long" is 4 bytes. Please note that this option does not
20042 conform to the C standards, but it results in smaller code size.
20043
20044 -mmain-is-OS_task
20045 Do not save registers in "main". The effect is the same like
20046 attaching attribute AVR Function Attributes,,"OS_task" to "main".
20047 It is activated per default if optimization is on.
20048
20049 -mn-flash=num
20050 Assume that the flash memory has a size of num times 64 KiB.
20051
20052 -mno-interrupts
20053 Generated code is not compatible with hardware interrupts. Code
20054 size is smaller.
20055
20056 -mrelax
20057 Try to replace "CALL" resp. "JMP" instruction by the shorter
20058 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
20059 just adds the --mlink-relax option to the assembler's command line
20060 and the --relax option to the linker's command line.
20061
20062 Jump relaxing is performed by the linker because jump offsets are
20063 not known before code is located. Therefore, the assembler code
20064 generated by the compiler is the same, but the instructions in the
20065 executable may differ from instructions in the assembler code.
20066
20067 Relaxing must be turned on if linker stubs are needed, see the
20068 section on "EIND" and linker stubs below.
20069
20070 -mrmw
20071 Assume that the device supports the Read-Modify-Write instructions
20072 "XCH", "LAC", "LAS" and "LAT".
20073
20074 -mshort-calls
20075 Assume that "RJMP" and "RCALL" can target the whole program memory.
20076
20077 This option is used internally for multilib selection. It is not
20078 an optimization option, and you don't need to set it by hand.
20079
20080 -msp8
20081 Treat the stack pointer register as an 8-bit register, i.e. assume
20082 the high byte of the stack pointer is zero. In general, you don't
20083 need to set this option by hand.
20084
20085 This option is used internally by the compiler to select and build
20086 multilibs for architectures "avr2" and "avr25". These
20087 architectures mix devices with and without "SPH". For any setting
20088 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
20089 removes this option from the compiler proper's command line,
20090 because the compiler then knows if the device or architecture has
20091 an 8-bit stack pointer and thus no "SPH" register or not.
20092
20093 -mstrict-X
20094 Use address register "X" in a way proposed by the hardware. This
20095 means that "X" is only used in indirect, post-increment or pre-
20096 decrement addressing.
20097
20098 Without this option, the "X" register may be used in the same way
20099 as "Y" or "Z" which then is emulated by additional instructions.
20100 For example, loading a value with "X+const" addressing with a small
20101 non-negative "const < 64" to a register Rn is performed as
20102
20103 adiw r26, const ; X += const
20104 ld <Rn>, X ; <Rn> = *X
20105 sbiw r26, const ; X -= const
20106
20107 -mtiny-stack
20108 Only change the lower 8 bits of the stack pointer.
20109
20110 -mfract-convert-truncate
20111 Allow to use truncation instead of rounding towards zero for
20112 fractional fixed-point types.
20113
20114 -nodevicelib
20115 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
20116
20117 -nodevicespecs
20118 Don't add -specs=device-specs/specs-mcu to the compiler driver's
20119 command line. The user takes responsibility for supplying the sub-
20120 processes like compiler proper, assembler and linker with
20121 appropriate command line options. This means that the user has to
20122 supply her private device specs file by means of -specs=path-to-
20123 specs-file. There is no more need for option -mmcu=mcu.
20124
20125 This option can also serve as a replacement for the older way of
20126 specifying custom device-specs files that needed -B some-path to
20127 point to a directory which contains a folder named "device-specs"
20128 which contains a specs file named "specs-mcu", where mcu was
20129 specified by -mmcu=mcu.
20130
20131 -Waddr-space-convert
20132 Warn about conversions between address spaces in the case where the
20133 resulting address space is not contained in the incoming address
20134 space.
20135
20136 -Wmisspelled-isr
20137 Warn if the ISR is misspelled, i.e. without __vector prefix.
20138 Enabled by default.
20139
20140 "EIND" and Devices with More Than 128 Ki Bytes of Flash
20141
20142 Pointers in the implementation are 16 bits wide. The address of a
20143 function or label is represented as word address so that indirect jumps
20144 and calls can target any code address in the range of 64 Ki words.
20145
20146 In order to facilitate indirect jump on devices with more than 128 Ki
20147 bytes of program memory space, there is a special function register
20148 called "EIND" that serves as most significant part of the target
20149 address when "EICALL" or "EIJMP" instructions are used.
20150
20151 Indirect jumps and calls on these devices are handled as follows by the
20152 compiler and are subject to some limitations:
20153
20154 * The compiler never sets "EIND".
20155
20156 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
20157 instructions or might read "EIND" directly in order to emulate an
20158 indirect call/jump by means of a "RET" instruction.
20159
20160 * The compiler assumes that "EIND" never changes during the startup
20161 code or during the application. In particular, "EIND" is not
20162 saved/restored in function or interrupt service routine
20163 prologue/epilogue.
20164
20165 * For indirect calls to functions and computed goto, the linker
20166 generates stubs. Stubs are jump pads sometimes also called
20167 trampolines. Thus, the indirect call/jump jumps to such a stub.
20168 The stub contains a direct jump to the desired address.
20169
20170 * Linker relaxation must be turned on so that the linker generates
20171 the stubs correctly in all situations. See the compiler option
20172 -mrelax and the linker option --relax. There are corner cases
20173 where the linker is supposed to generate stubs but aborts without
20174 relaxation and without a helpful error message.
20175
20176 * The default linker script is arranged for code with "EIND = 0". If
20177 code is supposed to work for a setup with "EIND != 0", a custom
20178 linker script has to be used in order to place the sections whose
20179 name start with ".trampolines" into the segment where "EIND" points
20180 to.
20181
20182 * The startup code from libgcc never sets "EIND". Notice that
20183 startup code is a blend of code from libgcc and AVR-LibC. For the
20184 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
20185 ("https://www.nongnu.org/avr-libc/user-manual/").
20186
20187 * It is legitimate for user-specific startup code to set up "EIND"
20188 early, for example by means of initialization code located in
20189 section ".init3". Such code runs prior to general startup code that
20190 initializes RAM and calls constructors, but after the bit of
20191 startup code from AVR-LibC that sets "EIND" to the segment where
20192 the vector table is located.
20193
20194 #include <avr/io.h>
20195
20196 static void
20197 __attribute__((section(".init3"),naked,used,no_instrument_function))
20198 init3_set_eind (void)
20199 {
20200 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
20201 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
20202 }
20203
20204 The "__trampolines_start" symbol is defined in the linker script.
20205
20206 * Stubs are generated automatically by the linker if the following
20207 two conditions are met:
20208
20209 -<The address of a label is taken by means of the "gs" modifier>
20210 (short for generate stubs) like so:
20211
20212 LDI r24, lo8(gs(<func>))
20213 LDI r25, hi8(gs(<func>))
20214
20215 -<The final location of that label is in a code segment>
20216 outside the segment where the stubs are located.
20217
20218 * The compiler emits such "gs" modifiers for code labels in the
20219 following situations:
20220
20221 -<Taking address of a function or code label.>
20222 -<Computed goto.>
20223 -<If prologue-save function is used, see -mcall-prologues>
20224 command-line option.
20225
20226 -<Switch/case dispatch tables. If you do not want such dispatch>
20227 tables you can specify the -fno-jump-tables command-line
20228 option.
20229
20230 -<C and C++ constructors/destructors called during
20231 startup/shutdown.>
20232 -<If the tools hit a gs() modifier explained above.>
20233 * Jumping to non-symbolic addresses like so is not supported:
20234
20235 int main (void)
20236 {
20237 /* Call function at word address 0x2 */
20238 return ((int(*)(void)) 0x2)();
20239 }
20240
20241 Instead, a stub has to be set up, i.e. the function has to be
20242 called through a symbol ("func_4" in the example):
20243
20244 int main (void)
20245 {
20246 extern int func_4 (void);
20247
20248 /* Call function at byte address 0x4 */
20249 return func_4();
20250 }
20251
20252 and the application be linked with -Wl,--defsym,func_4=0x4.
20253 Alternatively, "func_4" can be defined in the linker script.
20254
20255 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
20256 Registers
20257
20258 Some AVR devices support memories larger than the 64 KiB range that can
20259 be accessed with 16-bit pointers. To access memory locations outside
20260 this 64 KiB range, the content of a "RAMP" register is used as high
20261 part of the address: The "X", "Y", "Z" address register is concatenated
20262 with the "RAMPX", "RAMPY", "RAMPZ" special function register,
20263 respectively, to get a wide address. Similarly, "RAMPD" is used
20264 together with direct addressing.
20265
20266 * The startup code initializes the "RAMP" special function registers
20267 with zero.
20268
20269 * If a AVR Named Address Spaces,named address space other than
20270 generic or "__flash" is used, then "RAMPZ" is set as needed before
20271 the operation.
20272
20273 * If the device supports RAM larger than 64 KiB and the compiler
20274 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
20275 reset to zero after the operation.
20276
20277 * If the device comes with a specific "RAMP" register, the ISR
20278 prologue/epilogue saves/restores that SFR and initializes it with
20279 zero in case the ISR code might (implicitly) use it.
20280
20281 * RAM larger than 64 KiB is not supported by GCC for AVR targets. If
20282 you use inline assembler to read from locations outside the 16-bit
20283 address range and change one of the "RAMP" registers, you must
20284 reset it to zero after the access.
20285
20286 AVR Built-in Macros
20287
20288 GCC defines several built-in macros so that the user code can test for
20289 the presence or absence of features. Almost any of the following
20290 built-in macros are deduced from device capabilities and thus triggered
20291 by the -mmcu= command-line option.
20292
20293 For even more AVR-specific built-in macros see AVR Named Address Spaces
20294 and AVR Built-in Functions.
20295
20296 "__AVR_ARCH__"
20297 Build-in macro that resolves to a decimal number that identifies
20298 the architecture and depends on the -mmcu=mcu option. Possible
20299 values are:
20300
20301 2, 25, 3, 31, 35, 4, 5, 51, 6
20302
20303 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
20304 "avr51", "avr6",
20305
20306 respectively and
20307
20308 100, 102, 103, 104, 105, 106, 107
20309
20310 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
20311 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
20312 specifies a device, this built-in macro is set accordingly. For
20313 example, with -mmcu=atmega8 the macro is defined to 4.
20314
20315 "__AVR_Device__"
20316 Setting -mmcu=device defines this built-in macro which reflects the
20317 device's name. For example, -mmcu=atmega8 defines the built-in
20318 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
20319 "__AVR_ATtiny261A__", etc.
20320
20321 The built-in macros' names follow the scheme "__AVR_Device__" where
20322 Device is the device name as from the AVR user manual. The
20323 difference between Device in the built-in macro and device in
20324 -mmcu=device is that the latter is always lowercase.
20325
20326 If device is not a device but only a core architecture like avr51,
20327 this macro is not defined.
20328
20329 "__AVR_DEVICE_NAME__"
20330 Setting -mmcu=device defines this built-in macro to the device's
20331 name. For example, with -mmcu=atmega8 the macro is defined to
20332 "atmega8".
20333
20334 If device is not a device but only a core architecture like avr51,
20335 this macro is not defined.
20336
20337 "__AVR_XMEGA__"
20338 The device / architecture belongs to the XMEGA family of devices.
20339
20340 "__AVR_HAVE_ELPM__"
20341 The device has the "ELPM" instruction.
20342
20343 "__AVR_HAVE_ELPMX__"
20344 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
20345
20346 "__AVR_HAVE_MOVW__"
20347 The device has the "MOVW" instruction to perform 16-bit register-
20348 register moves.
20349
20350 "__AVR_HAVE_LPMX__"
20351 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
20352
20353 "__AVR_HAVE_MUL__"
20354 The device has a hardware multiplier.
20355
20356 "__AVR_HAVE_JMP_CALL__"
20357 The device has the "JMP" and "CALL" instructions. This is the case
20358 for devices with more than 8 KiB of program memory.
20359
20360 "__AVR_HAVE_EIJMP_EICALL__"
20361 "__AVR_3_BYTE_PC__"
20362 The device has the "EIJMP" and "EICALL" instructions. This is the
20363 case for devices with more than 128 KiB of program memory. This
20364 also means that the program counter (PC) is 3 bytes wide.
20365
20366 "__AVR_2_BYTE_PC__"
20367 The program counter (PC) is 2 bytes wide. This is the case for
20368 devices with up to 128 KiB of program memory.
20369
20370 "__AVR_HAVE_8BIT_SP__"
20371 "__AVR_HAVE_16BIT_SP__"
20372 The stack pointer (SP) register is treated as 8-bit respectively
20373 16-bit register by the compiler. The definition of these macros is
20374 affected by -mtiny-stack.
20375
20376 "__AVR_HAVE_SPH__"
20377 "__AVR_SP8__"
20378 The device has the SPH (high part of stack pointer) special
20379 function register or has an 8-bit stack pointer, respectively. The
20380 definition of these macros is affected by -mmcu= and in the cases
20381 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
20382
20383 "__AVR_HAVE_RAMPD__"
20384 "__AVR_HAVE_RAMPX__"
20385 "__AVR_HAVE_RAMPY__"
20386 "__AVR_HAVE_RAMPZ__"
20387 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
20388 function register, respectively.
20389
20390 "__NO_INTERRUPTS__"
20391 This macro reflects the -mno-interrupts command-line option.
20392
20393 "__AVR_ERRATA_SKIP__"
20394 "__AVR_ERRATA_SKIP_JMP_CALL__"
20395 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
20396 instructions because of a hardware erratum. Skip instructions are
20397 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
20398 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
20399
20400 "__AVR_ISA_RMW__"
20401 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
20402 LAT).
20403
20404 "__AVR_SFR_OFFSET__=offset"
20405 Instructions that can address I/O special function registers
20406 directly like "IN", "OUT", "SBI", etc. may use a different address
20407 as if addressed by an instruction to access RAM like "LD" or "STS".
20408 This offset depends on the device architecture and has to be
20409 subtracted from the RAM address in order to get the respective I/O
20410 address.
20411
20412 "__AVR_SHORT_CALLS__"
20413 The -mshort-calls command line option is set.
20414
20415 "__AVR_PM_BASE_ADDRESS__=addr"
20416 Some devices support reading from flash memory by means of "LD*"
20417 instructions. The flash memory is seen in the data address space
20418 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
20419 defined, this feature is not available. If defined, the address
20420 space is linear and there is no need to put ".rodata" into RAM.
20421 This is handled by the default linker description file, and is
20422 currently available for "avrtiny" and "avrxmega3". Even more
20423 convenient, there is no need to use address spaces like "__flash"
20424 or features like attribute "progmem" and "pgm_read_*".
20425
20426 "__WITH_AVRLIBC__"
20427 The compiler is configured to be used together with AVR-Libc. See
20428 the --with-avrlibc configure option.
20429
20430 "__HAVE_DOUBLE_MULTILIB__"
20431 Defined if -mdouble= acts as a multilib option.
20432
20433 "__HAVE_DOUBLE32__"
20434 "__HAVE_DOUBLE64__"
20435 Defined if the compiler supports 32-bit double resp. 64-bit double.
20436 The actual layout is specified by option -mdouble=.
20437
20438 "__DEFAULT_DOUBLE__"
20439 The size in bits of "double" if -mdouble= is not set. To test the
20440 layout of "double" in a program, use the built-in macro
20441 "__SIZEOF_DOUBLE__".
20442
20443 "__HAVE_LONG_DOUBLE32__"
20444 "__HAVE_LONG_DOUBLE64__"
20445 "__HAVE_LONG_DOUBLE_MULTILIB__"
20446 "__DEFAULT_LONG_DOUBLE__"
20447 Same as above, but for "long double" instead of "double".
20448
20449 "__WITH_DOUBLE_COMPARISON__"
20450 Reflects the "--with-double-comparison={tristate|bool|libf7}"
20451 configure option ("https://gcc.gnu.org/install/configure.html#avr")
20452 and is defined to 2 or 3.
20453
20454 "__WITH_LIBF7_LIBGCC__"
20455 "__WITH_LIBF7_MATH__"
20456 "__WITH_LIBF7_MATH_SYMBOLS__"
20457 Reflects the "--with-libf7={libgcc|math|math-symbols}"
20458 configure option
20459 ("https://gcc.gnu.org/install/configure.html#avr").
20460
20461 Blackfin Options
20462
20463 -mcpu=cpu[-sirevision]
20464 Specifies the name of the target Blackfin processor. Currently,
20465 cpu can be one of bf512, bf514, bf516, bf518, bf522, bf523, bf524,
20466 bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf536, bf537,
20467 bf538, bf539, bf542, bf544, bf547, bf548, bf549, bf542m, bf544m,
20468 bf547m, bf548m, bf549m, bf561, bf592.
20469
20470 The optional sirevision specifies the silicon revision of the
20471 target Blackfin processor. Any workarounds available for the
20472 targeted silicon revision are enabled. If sirevision is none, no
20473 workarounds are enabled. If sirevision is any, all workarounds for
20474 the targeted processor are enabled. The "__SILICON_REVISION__"
20475 macro is defined to two hexadecimal digits representing the major
20476 and minor numbers in the silicon revision. If sirevision is none,
20477 the "__SILICON_REVISION__" is not defined. If sirevision is any,
20478 the "__SILICON_REVISION__" is defined to be 0xffff. If this
20479 optional sirevision is not used, GCC assumes the latest known
20480 silicon revision of the targeted Blackfin processor.
20481
20482 GCC defines a preprocessor macro for the specified cpu. For the
20483 bfin-elf toolchain, this option causes the hardware BSP provided by
20484 libgloss to be linked in if -msim is not given.
20485
20486 Without this option, bf532 is used as the processor by default.
20487
20488 Note that support for bf561 is incomplete. For bf561, only the
20489 preprocessor macro is defined.
20490
20491 -msim
20492 Specifies that the program will be run on the simulator. This
20493 causes the simulator BSP provided by libgloss to be linked in.
20494 This option has effect only for bfin-elf toolchain. Certain other
20495 options, such as -mid-shared-library and -mfdpic, imply -msim.
20496
20497 -momit-leaf-frame-pointer
20498 Don't keep the frame pointer in a register for leaf functions.
20499 This avoids the instructions to save, set up and restore frame
20500 pointers and makes an extra register available in leaf functions.
20501
20502 -mspecld-anomaly
20503 When enabled, the compiler ensures that the generated code does not
20504 contain speculative loads after jump instructions. If this option
20505 is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
20506
20507 -mno-specld-anomaly
20508 Don't generate extra code to prevent speculative loads from
20509 occurring.
20510
20511 -mcsync-anomaly
20512 When enabled, the compiler ensures that the generated code does not
20513 contain CSYNC or SSYNC instructions too soon after conditional
20514 branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS"
20515 is defined.
20516
20517 -mno-csync-anomaly
20518 Don't generate extra code to prevent CSYNC or SSYNC instructions
20519 from occurring too soon after a conditional branch.
20520
20521 -mlow64k
20522 When enabled, the compiler is free to take advantage of the
20523 knowledge that the entire program fits into the low 64k of memory.
20524
20525 -mno-low64k
20526 Assume that the program is arbitrarily large. This is the default.
20527
20528 -mstack-check-l1
20529 Do stack checking using information placed into L1 scratchpad
20530 memory by the uClinux kernel.
20531
20532 -mid-shared-library
20533 Generate code that supports shared libraries via the library ID
20534 method. This allows for execute in place and shared libraries in
20535 an environment without virtual memory management. This option
20536 implies -fPIC. With a bfin-elf target, this option implies -msim.
20537
20538 -mno-id-shared-library
20539 Generate code that doesn't assume ID-based shared libraries are
20540 being used. This is the default.
20541
20542 -mleaf-id-shared-library
20543 Generate code that supports shared libraries via the library ID
20544 method, but assumes that this library or executable won't link
20545 against any other ID shared libraries. That allows the compiler to
20546 use faster code for jumps and calls.
20547
20548 -mno-leaf-id-shared-library
20549 Do not assume that the code being compiled won't link against any
20550 ID shared libraries. Slower code is generated for jump and call
20551 insns.
20552
20553 -mshared-library-id=n
20554 Specifies the identification number of the ID-based shared library
20555 being compiled. Specifying a value of 0 generates more compact
20556 code; specifying other values forces the allocation of that number
20557 to the current library but is no more space- or time-efficient than
20558 omitting this option.
20559
20560 -msep-data
20561 Generate code that allows the data segment to be located in a
20562 different area of memory from the text segment. This allows for
20563 execute in place in an environment without virtual memory
20564 management by eliminating relocations against the text section.
20565
20566 -mno-sep-data
20567 Generate code that assumes that the data segment follows the text
20568 segment. This is the default.
20569
20570 -mlong-calls
20571 -mno-long-calls
20572 Tells the compiler to perform function calls by first loading the
20573 address of the function into a register and then performing a
20574 subroutine call on this register. This switch is needed if the
20575 target function lies outside of the 24-bit addressing range of the
20576 offset-based version of subroutine call instruction.
20577
20578 This feature is not enabled by default. Specifying -mno-long-calls
20579 restores the default behavior. Note these switches have no effect
20580 on how the compiler generates code to handle function calls via
20581 function pointers.
20582
20583 -mfast-fp
20584 Link with the fast floating-point library. This library relaxes
20585 some of the IEEE floating-point standard's rules for checking
20586 inputs against Not-a-Number (NAN), in the interest of performance.
20587
20588 -minline-plt
20589 Enable inlining of PLT entries in function calls to functions that
20590 are not known to bind locally. It has no effect without -mfdpic.
20591
20592 -mmulticore
20593 Build a standalone application for multicore Blackfin processors.
20594 This option causes proper start files and link scripts supporting
20595 multicore to be used, and defines the macro "__BFIN_MULTICORE". It
20596 can only be used with -mcpu=bf561[-sirevision].
20597
20598 This option can be used with -mcorea or -mcoreb, which selects the
20599 one-application-per-core programming model. Without -mcorea or
20600 -mcoreb, the single-application/dual-core programming model is
20601 used. In this model, the main function of Core B should be named as
20602 "coreb_main".
20603
20604 If this option is not used, the single-core application programming
20605 model is used.
20606
20607 -mcorea
20608 Build a standalone application for Core A of BF561 when using the
20609 one-application-per-core programming model. Proper start files and
20610 link scripts are used to support Core A, and the macro
20611 "__BFIN_COREA" is defined. This option can only be used in
20612 conjunction with -mmulticore.
20613
20614 -mcoreb
20615 Build a standalone application for Core B of BF561 when using the
20616 one-application-per-core programming model. Proper start files and
20617 link scripts are used to support Core B, and the macro
20618 "__BFIN_COREB" is defined. When this option is used, "coreb_main"
20619 should be used instead of "main". This option can only be used in
20620 conjunction with -mmulticore.
20621
20622 -msdram
20623 Build a standalone application for SDRAM. Proper start files and
20624 link scripts are used to put the application into SDRAM, and the
20625 macro "__BFIN_SDRAM" is defined. The loader should initialize
20626 SDRAM before loading the application.
20627
20628 -micplb
20629 Assume that ICPLBs are enabled at run time. This has an effect on
20630 certain anomaly workarounds. For Linux targets, the default is to
20631 assume ICPLBs are enabled; for standalone applications the default
20632 is off.
20633
20634 C6X Options
20635
20636 -march=name
20637 This specifies the name of the target architecture. GCC uses this
20638 name to determine what kind of instructions it can emit when
20639 generating assembly code. Permissible names are: c62x, c64x,
20640 c64x+, c67x, c67x+, c674x.
20641
20642 -mbig-endian
20643 Generate code for a big-endian target.
20644
20645 -mlittle-endian
20646 Generate code for a little-endian target. This is the default.
20647
20648 -msim
20649 Choose startup files and linker script suitable for the simulator.
20650
20651 -msdata=default
20652 Put small global and static data in the ".neardata" section, which
20653 is pointed to by register "B14". Put small uninitialized global
20654 and static data in the ".bss" section, which is adjacent to the
20655 ".neardata" section. Put small read-only data into the ".rodata"
20656 section. The corresponding sections used for large pieces of data
20657 are ".fardata", ".far" and ".const".
20658
20659 -msdata=all
20660 Put all data, not just small objects, into the sections reserved
20661 for small data, and use addressing relative to the "B14" register
20662 to access them.
20663
20664 -msdata=none
20665 Make no use of the sections reserved for small data, and use
20666 absolute addresses to access all data. Put all initialized global
20667 and static data in the ".fardata" section, and all uninitialized
20668 data in the ".far" section. Put all constant data into the
20669 ".const" section.
20670
20671 CRIS Options
20672
20673 These options are defined specifically for the CRIS ports.
20674
20675 -march=architecture-type
20676 -mcpu=architecture-type
20677 Generate code for the specified architecture. The choices for
20678 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
20679 ETRAX 100, and ETRAX 100 LX. Default is v0.
20680
20681 -mtune=architecture-type
20682 Tune to architecture-type everything applicable about the generated
20683 code, except for the ABI and the set of available instructions.
20684 The choices for architecture-type are the same as for
20685 -march=architecture-type.
20686
20687 -mmax-stack-frame=n
20688 Warn when the stack frame of a function exceeds n bytes.
20689
20690 -metrax4
20691 -metrax100
20692 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
20693 -march=v8 respectively.
20694
20695 -mmul-bug-workaround
20696 -mno-mul-bug-workaround
20697 Work around a bug in the "muls" and "mulu" instructions for CPU
20698 models where it applies. This option is disabled by default.
20699
20700 -mpdebug
20701 Enable CRIS-specific verbose debug-related information in the
20702 assembly code. This option also has the effect of turning off the
20703 #NO_APP formatted-code indicator to the assembler at the beginning
20704 of the assembly file.
20705
20706 -mcc-init
20707 Do not use condition-code results from previous instruction; always
20708 emit compare and test instructions before use of condition codes.
20709
20710 -mno-side-effects
20711 Do not emit instructions with side effects in addressing modes
20712 other than post-increment.
20713
20714 -mstack-align
20715 -mno-stack-align
20716 -mdata-align
20717 -mno-data-align
20718 -mconst-align
20719 -mno-const-align
20720 These options (no- options) arrange (eliminate arrangements) for
20721 the stack frame, individual data and constants to be aligned for
20722 the maximum single data access size for the chosen CPU model. The
20723 default is to arrange for 32-bit alignment. ABI details such as
20724 structure layout are not affected by these options.
20725
20726 -m32-bit
20727 -m16-bit
20728 -m8-bit
20729 Similar to the stack- data- and const-align options above, these
20730 options arrange for stack frame, writable data and constants to all
20731 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
20732 alignment.
20733
20734 -mno-prologue-epilogue
20735 -mprologue-epilogue
20736 With -mno-prologue-epilogue, the normal function prologue and
20737 epilogue which set up the stack frame are omitted and no return
20738 instructions or return sequences are generated in the code. Use
20739 this option only together with visual inspection of the compiled
20740 code: no warnings or errors are generated when call-saved registers
20741 must be saved, or storage for local variables needs to be
20742 allocated.
20743
20744 -melf
20745 Legacy no-op option.
20746
20747 -sim
20748 This option arranges to link with input-output functions from a
20749 simulator library. Code, initialized data and zero-initialized
20750 data are allocated consecutively.
20751
20752 -sim2
20753 Like -sim, but pass linker options to locate initialized data at
20754 0x40000000 and zero-initialized data at 0x80000000.
20755
20756 C-SKY Options
20757
20758 GCC supports these options when compiling for C-SKY V2 processors.
20759
20760 -march=arch
20761 Specify the C-SKY target architecture. Valid values for arch are:
20762 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
20763
20764 -mcpu=cpu
20765 Specify the C-SKY target processor. Valid values for cpu are:
20766 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
20767 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
20768 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
20769 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
20770 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
20771 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
20772 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
20773 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
20774 ck810tv, ck810ft, and ck810ftv.
20775
20776 -mbig-endian
20777 -EB
20778 -mlittle-endian
20779 -EL Select big- or little-endian code. The default is little-endian.
20780
20781 -mfloat-abi=name
20782 Specifies which floating-point ABI to use. Permissible values are:
20783 soft, softfp and hard.
20784
20785 Specifying soft causes GCC to generate output containing library
20786 calls for floating-point operations. softfp allows the generation
20787 of code using hardware floating-point instructions, but still uses
20788 the soft-float calling conventions. hard allows generation of
20789 floating-point instructions and uses FPU-specific calling
20790 conventions.
20791
20792 The default depends on the specific target configuration. Note
20793 that the hard-float and soft-float ABIs are not link-compatible;
20794 you must compile your entire program with the same ABI, and link
20795 with a compatible set of libraries.
20796
20797 -mhard-float
20798 -msoft-float
20799 Select hardware or software floating-point implementations. The
20800 default is soft float.
20801
20802 -mdouble-float
20803 -mno-double-float
20804 When -mhard-float is in effect, enable generation of double-
20805 precision float instructions. This is the default except when
20806 compiling for CK803.
20807
20808 -mfdivdu
20809 -mno-fdivdu
20810 When -mhard-float is in effect, enable generation of "frecipd",
20811 "fsqrtd", and "fdivd" instructions. This is the default except
20812 when compiling for CK803.
20813
20814 -mfpu=fpu
20815 Select the floating-point processor. This option can only be used
20816 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
20817 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
20818 and fpv2_divd (-mdouble-float -mdivdu).
20819
20820 -melrw
20821 -mno-elrw
20822 Enable the extended "lrw" instruction. This option defaults to on
20823 for CK801 and off otherwise.
20824
20825 -mistack
20826 -mno-istack
20827 Enable interrupt stack instructions; the default is off.
20828
20829 The -mistack option is required to handle the "interrupt" and "isr"
20830 function attributes.
20831
20832 -mmp
20833 Enable multiprocessor instructions; the default is off.
20834
20835 -mcp
20836 Enable coprocessor instructions; the default is off.
20837
20838 -mcache
20839 Enable coprocessor instructions; the default is off.
20840
20841 -msecurity
20842 Enable C-SKY security instructions; the default is off.
20843
20844 -mtrust
20845 Enable C-SKY trust instructions; the default is off.
20846
20847 -mdsp
20848 -medsp
20849 -mvdsp
20850 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
20851 respectively. All of these options default to off.
20852
20853 -mdiv
20854 -mno-div
20855 Generate divide instructions. Default is off.
20856
20857 -msmart
20858 -mno-smart
20859 Generate code for Smart Mode, using only registers numbered 0-7 to
20860 allow use of 16-bit instructions. This option is ignored for CK801
20861 where this is the required behavior, and it defaults to on for
20862 CK802. For other targets, the default is off.
20863
20864 -mhigh-registers
20865 -mno-high-registers
20866 Generate code using the high registers numbered 16-31. This option
20867 is not supported on CK801, CK802, or CK803, and is enabled by
20868 default for other processors.
20869
20870 -manchor
20871 -mno-anchor
20872 Generate code using global anchor symbol addresses.
20873
20874 -mpushpop
20875 -mno-pushpop
20876 Generate code using "push" and "pop" instructions. This option
20877 defaults to on.
20878
20879 -mmultiple-stld
20880 -mstm
20881 -mno-multiple-stld
20882 -mno-stm
20883 Generate code using "stm" and "ldm" instructions. This option
20884 isn't supported on CK801 but is enabled by default on other
20885 processors.
20886
20887 -mconstpool
20888 -mno-constpool
20889 Create constant pools in the compiler instead of deferring it to
20890 the assembler. This option is the default and required for correct
20891 code generation on CK801 and CK802, and is optional on other
20892 processors.
20893
20894 -mstack-size
20895 -mno-stack-size
20896 Emit ".stack_size" directives for each function in the assembly
20897 output. This option defaults to off.
20898
20899 -mccrt
20900 -mno-ccrt
20901 Generate code for the C-SKY compiler runtime instead of libgcc.
20902 This option defaults to off.
20903
20904 -mbranch-cost=n
20905 Set the branch costs to roughly "n" instructions. The default is
20906 1.
20907
20908 -msched-prolog
20909 -mno-sched-prolog
20910 Permit scheduling of function prologue and epilogue sequences.
20911 Using this option can result in code that is not compliant with the
20912 C-SKY V2 ABI prologue requirements and that cannot be debugged or
20913 backtraced. It is disabled by default.
20914
20915 -msim
20916 Links the library libsemi.a which is in compatible with simulator.
20917 Applicable to ELF compiler only.
20918
20919 Darwin Options
20920
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 -mmacosx-version-min=version
20987 The earliest version of MacOS X that this executable will run on is
20988 version. Typical values of version include 10.1, 10.2, and 10.3.9.
20989
20990 If the compiler was built to use the system's headers by default,
20991 then the default for this option is the system version on which the
20992 compiler is running, otherwise the default is to make choices that
20993 are compatible with as many systems and code bases as possible.
20994
20995 -mkernel
20996 Enable kernel development mode. The -mkernel option sets -static,
20997 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
20998 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
20999 where applicable. This mode also sets -mno-altivec, -msoft-float,
21000 -fno-builtin and -mlong-branch for PowerPC targets.
21001
21002 -mone-byte-bool
21003 Override the defaults for "bool" so that "sizeof(bool)==1". By
21004 default sizeof(bool) is 4 when compiling for Darwin/PowerPC and 1
21005 when compiling for Darwin/x86, so this option has no effect on x86.
21006
21007 Warning: The -mone-byte-bool switch causes GCC to generate code
21008 that is not binary compatible with code generated without that
21009 switch. Using this switch may require recompiling all other
21010 modules in a program, including system libraries. Use this switch
21011 to conform to a non-default data model.
21012
21013 -mfix-and-continue
21014 -ffix-and-continue
21015 -findirect-data
21016 Generate code suitable for fast turnaround development, such as to
21017 allow GDB to dynamically load .o files into already-running
21018 programs. -findirect-data and -ffix-and-continue are provided for
21019 backwards compatibility.
21020
21021 -all_load
21022 Loads all members of static archive libraries. See man ld(1) for
21023 more information.
21024
21025 -arch_errors_fatal
21026 Cause the errors having to do with files that have the wrong
21027 architecture to be fatal.
21028
21029 -bind_at_load
21030 Causes the output file to be marked such that the dynamic linker
21031 will bind all undefined references when the file is loaded or
21032 launched.
21033
21034 -bundle
21035 Produce a Mach-o bundle format file. See man ld(1) for more
21036 information.
21037
21038 -bundle_loader executable
21039 This option specifies the executable that will load the build
21040 output file being linked. See man ld(1) for more information.
21041
21042 -dynamiclib
21043 When passed this option, GCC produces a dynamic library instead of
21044 an executable when linking, using the Darwin libtool command.
21045
21046 -force_cpusubtype_ALL
21047 This causes GCC's output file to have the ALL subtype, instead of
21048 one controlled by the -mcpu or -march option.
21049
21050 -allowable_client client_name
21051 -client_name
21052 -compatibility_version
21053 -current_version
21054 -dead_strip
21055 -dependency-file
21056 -dylib_file
21057 -dylinker_install_name
21058 -dynamic
21059 -exported_symbols_list
21060 -filelist
21061 -flat_namespace
21062 -force_flat_namespace
21063 -headerpad_max_install_names
21064 -image_base
21065 -init
21066 -install_name
21067 -keep_private_externs
21068 -multi_module
21069 -multiply_defined
21070 -multiply_defined_unused
21071 -noall_load
21072 -no_dead_strip_inits_and_terms
21073 -nofixprebinding
21074 -nomultidefs
21075 -noprebind
21076 -noseglinkedit
21077 -pagezero_size
21078 -prebind
21079 -prebind_all_twolevel_modules
21080 -private_bundle
21081 -read_only_relocs
21082 -sectalign
21083 -sectobjectsymbols
21084 -whyload
21085 -seg1addr
21086 -sectcreate
21087 -sectobjectsymbols
21088 -sectorder
21089 -segaddr
21090 -segs_read_only_addr
21091 -segs_read_write_addr
21092 -seg_addr_table
21093 -seg_addr_table_filename
21094 -seglinkedit
21095 -segprot
21096 -segs_read_only_addr
21097 -segs_read_write_addr
21098 -single_module
21099 -static
21100 -sub_library
21101 -sub_umbrella
21102 -twolevel_namespace
21103 -umbrella
21104 -undefined
21105 -unexported_symbols_list
21106 -weak_reference_mismatches
21107 -whatsloaded
21108 These options are passed to the Darwin linker. The Darwin linker
21109 man page describes them in detail.
21110
21111 DEC Alpha Options
21112
21113 These -m options are defined for the DEC Alpha implementations:
21114
21115 -mno-soft-float
21116 -msoft-float
21117 Use (do not use) the hardware floating-point instructions for
21118 floating-point operations. When -msoft-float is specified,
21119 functions in libgcc.a are used to perform floating-point
21120 operations. Unless they are replaced by routines that emulate the
21121 floating-point operations, or compiled in such a way as to call
21122 such emulations routines, these routines issue floating-point
21123 operations. If you are compiling for an Alpha without floating-
21124 point operations, you must ensure that the library is built so as
21125 not to call them.
21126
21127 Note that Alpha implementations without floating-point operations
21128 are required to have floating-point registers.
21129
21130 -mfp-reg
21131 -mno-fp-regs
21132 Generate code that uses (does not use) the floating-point register
21133 set. -mno-fp-regs implies -msoft-float. If the floating-point
21134 register set is not used, floating-point operands are passed in
21135 integer registers as if they were integers and floating-point
21136 results are passed in $0 instead of $f0. This is a non-standard
21137 calling sequence, so any function with a floating-point argument or
21138 return value called by code compiled with -mno-fp-regs must also be
21139 compiled with that option.
21140
21141 A typical use of this option is building a kernel that does not
21142 use, and hence need not save and restore, any floating-point
21143 registers.
21144
21145 -mieee
21146 The Alpha architecture implements floating-point hardware optimized
21147 for maximum performance. It is mostly compliant with the IEEE
21148 floating-point standard. However, for full compliance, software
21149 assistance is required. This option generates code fully IEEE-
21150 compliant code except that the inexact-flag is not maintained (see
21151 below). If this option is turned on, the preprocessor macro
21152 "_IEEE_FP" is defined during compilation. The resulting code is
21153 less efficient but is able to correctly support denormalized
21154 numbers and exceptional IEEE values such as not-a-number and
21155 plus/minus infinity. Other Alpha compilers call this option
21156 -ieee_with_no_inexact.
21157
21158 -mieee-with-inexact
21159 This is like -mieee except the generated code also maintains the
21160 IEEE inexact-flag. Turning on this option causes the generated
21161 code to implement fully-compliant IEEE math. In addition to
21162 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
21163 On some Alpha implementations the resulting code may execute
21164 significantly slower than the code generated by default. Since
21165 there is very little code that depends on the inexact-flag, you
21166 should normally not specify this option. Other Alpha compilers
21167 call this option -ieee_with_inexact.
21168
21169 -mfp-trap-mode=trap-mode
21170 This option controls what floating-point related traps are enabled.
21171 Other Alpha compilers call this option -fptm trap-mode. The trap
21172 mode can be set to one of four values:
21173
21174 n This is the default (normal) setting. The only traps that are
21175 enabled are the ones that cannot be disabled in software (e.g.,
21176 division by zero trap).
21177
21178 u In addition to the traps enabled by n, underflow traps are
21179 enabled as well.
21180
21181 su Like u, but the instructions are marked to be safe for software
21182 completion (see Alpha architecture manual for details).
21183
21184 sui Like su, but inexact traps are enabled as well.
21185
21186 -mfp-rounding-mode=rounding-mode
21187 Selects the IEEE rounding mode. Other Alpha compilers call this
21188 option -fprm rounding-mode. The rounding-mode can be one of:
21189
21190 n Normal IEEE rounding mode. Floating-point numbers are rounded
21191 towards the nearest machine number or towards the even machine
21192 number in case of a tie.
21193
21194 m Round towards minus infinity.
21195
21196 c Chopped rounding mode. Floating-point numbers are rounded
21197 towards zero.
21198
21199 d Dynamic rounding mode. A field in the floating-point control
21200 register (fpcr, see Alpha architecture reference manual)
21201 controls the rounding mode in effect. The C library
21202 initializes this register for rounding towards plus infinity.
21203 Thus, unless your program modifies the fpcr, d corresponds to
21204 round towards plus infinity.
21205
21206 -mtrap-precision=trap-precision
21207 In the Alpha architecture, floating-point traps are imprecise.
21208 This means without software assistance it is impossible to recover
21209 from a floating trap and program execution normally needs to be
21210 terminated. GCC can generate code that can assist operating system
21211 trap handlers in determining the exact location that caused a
21212 floating-point trap. Depending on the requirements of an
21213 application, different levels of precisions can be selected:
21214
21215 p Program precision. This option is the default and means a trap
21216 handler can only identify which program caused a floating-point
21217 exception.
21218
21219 f Function precision. The trap handler can determine the
21220 function that caused a floating-point exception.
21221
21222 i Instruction precision. The trap handler can determine the
21223 exact instruction that caused a floating-point exception.
21224
21225 Other Alpha compilers provide the equivalent options called
21226 -scope_safe and -resumption_safe.
21227
21228 -mieee-conformant
21229 This option marks the generated code as IEEE conformant. You must
21230 not use this option unless you also specify -mtrap-precision=i and
21231 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
21232 to emit the line .eflag 48 in the function prologue of the
21233 generated assembly file.
21234
21235 -mbuild-constants
21236 Normally GCC examines a 32- or 64-bit integer constant to see if it
21237 can construct it from smaller constants in two or three
21238 instructions. If it cannot, it outputs the constant as a literal
21239 and generates code to load it from the data segment at run time.
21240
21241 Use this option to require GCC to construct all integer constants
21242 using code, even if it takes more instructions (the maximum is
21243 six).
21244
21245 You typically use this option to build a shared library dynamic
21246 loader. Itself a shared library, it must relocate itself in memory
21247 before it can find the variables and constants in its own data
21248 segment.
21249
21250 -mbwx
21251 -mno-bwx
21252 -mcix
21253 -mno-cix
21254 -mfix
21255 -mno-fix
21256 -mmax
21257 -mno-max
21258 Indicate whether GCC should generate code to use the optional BWX,
21259 CIX, FIX and MAX instruction sets. The default is to use the
21260 instruction sets supported by the CPU type specified via -mcpu=
21261 option or that of the CPU on which GCC was built if none is
21262 specified.
21263
21264 -mfloat-vax
21265 -mfloat-ieee
21266 Generate code that uses (does not use) VAX F and G floating-point
21267 arithmetic instead of IEEE single and double precision.
21268
21269 -mexplicit-relocs
21270 -mno-explicit-relocs
21271 Older Alpha assemblers provided no way to generate symbol
21272 relocations except via assembler macros. Use of these macros does
21273 not allow optimal instruction scheduling. GNU binutils as of
21274 version 2.12 supports a new syntax that allows the compiler to
21275 explicitly mark which relocations should apply to which
21276 instructions. This option is mostly useful for debugging, as GCC
21277 detects the capabilities of the assembler when it is built and sets
21278 the default accordingly.
21279
21280 -msmall-data
21281 -mlarge-data
21282 When -mexplicit-relocs is in effect, static data is accessed via
21283 gp-relative relocations. When -msmall-data is used, objects 8
21284 bytes long or smaller are placed in a small data area (the ".sdata"
21285 and ".sbss" sections) and are accessed via 16-bit relocations off
21286 of the $gp register. This limits the size of the small data area
21287 to 64KB, but allows the variables to be directly accessed via a
21288 single instruction.
21289
21290 The default is -mlarge-data. With this option the data area is
21291 limited to just below 2GB. Programs that require more than 2GB of
21292 data must use "malloc" or "mmap" to allocate the data in the heap
21293 instead of in the program's data segment.
21294
21295 When generating code for shared libraries, -fpic implies
21296 -msmall-data and -fPIC implies -mlarge-data.
21297
21298 -msmall-text
21299 -mlarge-text
21300 When -msmall-text is used, the compiler assumes that the code of
21301 the entire program (or shared library) fits in 4MB, and is thus
21302 reachable with a branch instruction. When -msmall-data is used,
21303 the compiler can assume that all local symbols share the same $gp
21304 value, and thus reduce the number of instructions required for a
21305 function call from 4 to 1.
21306
21307 The default is -mlarge-text.
21308
21309 -mcpu=cpu_type
21310 Set the instruction set and instruction scheduling parameters for
21311 machine type cpu_type. You can specify either the EV style name or
21312 the corresponding chip number. GCC supports scheduling parameters
21313 for the EV4, EV5 and EV6 family of processors and chooses the
21314 default values for the instruction set from the processor you
21315 specify. If you do not specify a processor type, GCC defaults to
21316 the processor on which the compiler was built.
21317
21318 Supported values for cpu_type are
21319
21320 ev4
21321 ev45
21322 21064
21323 Schedules as an EV4 and has no instruction set extensions.
21324
21325 ev5
21326 21164
21327 Schedules as an EV5 and has no instruction set extensions.
21328
21329 ev56
21330 21164a
21331 Schedules as an EV5 and supports the BWX extension.
21332
21333 pca56
21334 21164pc
21335 21164PC
21336 Schedules as an EV5 and supports the BWX and MAX extensions.
21337
21338 ev6
21339 21264
21340 Schedules as an EV6 and supports the BWX, FIX, and MAX
21341 extensions.
21342
21343 ev67
21344 21264a
21345 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
21346 extensions.
21347
21348 Native toolchains also support the value native, which selects the
21349 best architecture option for the host processor. -mcpu=native has
21350 no effect if GCC does not recognize the processor.
21351
21352 -mtune=cpu_type
21353 Set only the instruction scheduling parameters for machine type
21354 cpu_type. The instruction set is not changed.
21355
21356 Native toolchains also support the value native, which selects the
21357 best architecture option for the host processor. -mtune=native has
21358 no effect if GCC does not recognize the processor.
21359
21360 -mmemory-latency=time
21361 Sets the latency the scheduler should assume for typical memory
21362 references as seen by the application. This number is highly
21363 dependent on the memory access patterns used by the application and
21364 the size of the external cache on the machine.
21365
21366 Valid options for time are
21367
21368 number
21369 A decimal number representing clock cycles.
21370
21371 L1
21372 L2
21373 L3
21374 main
21375 The compiler contains estimates of the number of clock cycles
21376 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
21377 (also called Dcache, Scache, and Bcache), as well as to main
21378 memory. Note that L3 is only valid for EV5.
21379
21380 eBPF Options
21381
21382 -mframe-limit=bytes
21383 This specifies the hard limit for frame sizes, in bytes.
21384 Currently, the value that can be specified should be less than or
21385 equal to 32767. Defaults to whatever limit is imposed by the
21386 version of the Linux kernel targeted.
21387
21388 -mkernel=version
21389 This specifies the minimum version of the kernel that will run the
21390 compiled program. GCC uses this version to determine which
21391 instructions to use, what kernel helpers to allow, etc. Currently,
21392 version can be one of 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8,
21393 4.9, 4.10, 4.11, 4.12, 4.13, 4.14, 4.15, 4.16, 4.17, 4.18, 4.19,
21394 4.20, 5.0, 5.1, 5.2, latest and native.
21395
21396 -mbig-endian
21397 Generate code for a big-endian target.
21398
21399 -mlittle-endian
21400 Generate code for a little-endian target. This is the default.
21401
21402 -mjmpext
21403 Enable generation of extra conditional-branch instructions.
21404 Enabled for CPU v2 and above.
21405
21406 -mjmp32
21407 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
21408
21409 -malu32
21410 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
21411
21412 -mcpu=version
21413 This specifies which version of the eBPF ISA to target. Newer
21414 versions may not be supported by all kernels. The default is v3.
21415
21416 Supported values for version are:
21417
21418 v1 The first stable eBPF ISA with no special features or
21419 extensions.
21420
21421 v2 Supports the jump extensions, as in -mjmpext.
21422
21423 v3 All features of v2, plus:
21424
21425 -<32-bit jump operations, as in -mjmp32>
21426 -<32-bit ALU operations, as in -malu32>
21427 -mco-re
21428 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires
21429 and is implied by -gbtf.
21430
21431 -mno-co-re
21432 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-
21433 RE support is enabled by default when generating BTF debug
21434 information for the BPF target.
21435
21436 -mxbpf
21437 Generate code for an expanded version of BPF, which relaxes some of
21438 the restrictions imposed by the BPF architecture:
21439
21440 -<Save and restore callee-saved registers at function entry and>
21441 exit, respectively.
21442
21443 FR30 Options
21444
21445 These options are defined specifically for the FR30 port.
21446
21447 -msmall-model
21448 Use the small address space model. This can produce smaller code,
21449 but it does assume that all symbolic values and addresses fit into
21450 a 20-bit range.
21451
21452 -mno-lsim
21453 Assume that runtime support has been provided and so there is no
21454 need to include the simulator library (libsim.a) on the linker
21455 command line.
21456
21457 FT32 Options
21458
21459 These options are defined specifically for the FT32 port.
21460
21461 -msim
21462 Specifies that the program will be run on the simulator. This
21463 causes an alternate runtime startup and library to be linked. You
21464 must not use this option when generating programs that will run on
21465 real hardware; you must provide your own runtime library for
21466 whatever I/O functions are needed.
21467
21468 -mlra
21469 Enable Local Register Allocation. This is still experimental for
21470 FT32, so by default the compiler uses standard reload.
21471
21472 -mnodiv
21473 Do not use div and mod instructions.
21474
21475 -mft32b
21476 Enable use of the extended instructions of the FT32B processor.
21477
21478 -mcompress
21479 Compress all code using the Ft32B code compression scheme.
21480
21481 -mnopm
21482 Do not generate code that reads program memory.
21483
21484 FRV Options
21485
21486 -mgpr-32
21487 Only use the first 32 general-purpose registers.
21488
21489 -mgpr-64
21490 Use all 64 general-purpose registers.
21491
21492 -mfpr-32
21493 Use only the first 32 floating-point registers.
21494
21495 -mfpr-64
21496 Use all 64 floating-point registers.
21497
21498 -mhard-float
21499 Use hardware instructions for floating-point operations.
21500
21501 -msoft-float
21502 Use library routines for floating-point operations.
21503
21504 -malloc-cc
21505 Dynamically allocate condition code registers.
21506
21507 -mfixed-cc
21508 Do not try to dynamically allocate condition code registers, only
21509 use "icc0" and "fcc0".
21510
21511 -mdword
21512 Change ABI to use double word insns.
21513
21514 -mno-dword
21515 Do not use double word instructions.
21516
21517 -mdouble
21518 Use floating-point double instructions.
21519
21520 -mno-double
21521 Do not use floating-point double instructions.
21522
21523 -mmedia
21524 Use media instructions.
21525
21526 -mno-media
21527 Do not use media instructions.
21528
21529 -mmuladd
21530 Use multiply and add/subtract instructions.
21531
21532 -mno-muladd
21533 Do not use multiply and add/subtract instructions.
21534
21535 -mfdpic
21536 Select the FDPIC ABI, which uses function descriptors to represent
21537 pointers to functions. Without any PIC/PIE-related options, it
21538 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
21539 small data are within a 12-bit range from the GOT base address;
21540 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
21541 bfin-elf target, this option implies -msim.
21542
21543 -minline-plt
21544 Enable inlining of PLT entries in function calls to functions that
21545 are not known to bind locally. It has no effect without -mfdpic.
21546 It's enabled by default if optimizing for speed and compiling for
21547 shared libraries (i.e., -fPIC or -fpic), or when an optimization
21548 option such as -O3 or above is present in the command line.
21549
21550 -mTLS
21551 Assume a large TLS segment when generating thread-local code.
21552
21553 -mtls
21554 Do not assume a large TLS segment when generating thread-local
21555 code.
21556
21557 -mgprel-ro
21558 Enable the use of "GPREL" relocations in the FDPIC ABI for data
21559 that is known to be in read-only sections. It's enabled by
21560 default, except for -fpic or -fpie: even though it may help make
21561 the global offset table smaller, it trades 1 instruction for 4.
21562 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
21563 may be shared by multiple symbols, and it avoids the need for a GOT
21564 entry for the referenced symbol, so it's more likely to be a win.
21565 If it is not, -mno-gprel-ro can be used to disable it.
21566
21567 -multilib-library-pic
21568 Link with the (library, not FD) pic libraries. It's implied by
21569 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
21570 should never have to use it explicitly.
21571
21572 -mlinked-fp
21573 Follow the EABI requirement of always creating a frame pointer
21574 whenever a stack frame is allocated. This option is enabled by
21575 default and can be disabled with -mno-linked-fp.
21576
21577 -mlong-calls
21578 Use indirect addressing to call functions outside the current
21579 compilation unit. This allows the functions to be placed anywhere
21580 within the 32-bit address space.
21581
21582 -malign-labels
21583 Try to align labels to an 8-byte boundary by inserting NOPs into
21584 the previous packet. This option only has an effect when VLIW
21585 packing is enabled. It doesn't create new packets; it merely adds
21586 NOPs to existing ones.
21587
21588 -mlibrary-pic
21589 Generate position-independent EABI code.
21590
21591 -macc-4
21592 Use only the first four media accumulator registers.
21593
21594 -macc-8
21595 Use all eight media accumulator registers.
21596
21597 -mpack
21598 Pack VLIW instructions.
21599
21600 -mno-pack
21601 Do not pack VLIW instructions.
21602
21603 -mno-eflags
21604 Do not mark ABI switches in e_flags.
21605
21606 -mcond-move
21607 Enable the use of conditional-move instructions (default).
21608
21609 This switch is mainly for debugging the compiler and will likely be
21610 removed in a future version.
21611
21612 -mno-cond-move
21613 Disable the use of conditional-move instructions.
21614
21615 This switch is mainly for debugging the compiler and will likely be
21616 removed in a future version.
21617
21618 -mscc
21619 Enable the use of conditional set instructions (default).
21620
21621 This switch is mainly for debugging the compiler and will likely be
21622 removed in a future version.
21623
21624 -mno-scc
21625 Disable the use of conditional set instructions.
21626
21627 This switch is mainly for debugging the compiler and will likely be
21628 removed in a future version.
21629
21630 -mcond-exec
21631 Enable the use of conditional execution (default).
21632
21633 This switch is mainly for debugging the compiler and will likely be
21634 removed in a future version.
21635
21636 -mno-cond-exec
21637 Disable the use of conditional execution.
21638
21639 This switch is mainly for debugging the compiler and will likely be
21640 removed in a future version.
21641
21642 -mvliw-branch
21643 Run a pass to pack branches into VLIW instructions (default).
21644
21645 This switch is mainly for debugging the compiler and will likely be
21646 removed in a future version.
21647
21648 -mno-vliw-branch
21649 Do not run a pass to pack branches into VLIW instructions.
21650
21651 This switch is mainly for debugging the compiler and will likely be
21652 removed in a future version.
21653
21654 -mmulti-cond-exec
21655 Enable optimization of "&&" and "||" in conditional execution
21656 (default).
21657
21658 This switch is mainly for debugging the compiler and will likely be
21659 removed in a future version.
21660
21661 -mno-multi-cond-exec
21662 Disable optimization of "&&" and "||" in conditional execution.
21663
21664 This switch is mainly for debugging the compiler and will likely be
21665 removed in a future version.
21666
21667 -mnested-cond-exec
21668 Enable nested conditional execution optimizations (default).
21669
21670 This switch is mainly for debugging the compiler and will likely be
21671 removed in a future version.
21672
21673 -mno-nested-cond-exec
21674 Disable nested conditional execution optimizations.
21675
21676 This switch is mainly for debugging the compiler and will likely be
21677 removed in a future version.
21678
21679 -moptimize-membar
21680 This switch removes redundant "membar" instructions from the
21681 compiler-generated code. It is enabled by default.
21682
21683 -mno-optimize-membar
21684 This switch disables the automatic removal of redundant "membar"
21685 instructions from the generated code.
21686
21687 -mtomcat-stats
21688 Cause gas to print out tomcat statistics.
21689
21690 -mcpu=cpu
21691 Select the processor type for which to generate code. Possible
21692 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
21693 and simple.
21694
21695 GNU/Linux Options
21696
21697 These -m options are defined for GNU/Linux targets:
21698
21699 -mglibc
21700 Use the GNU C library. This is the default except on
21701 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
21702 targets.
21703
21704 -muclibc
21705 Use uClibc C library. This is the default on *-*-linux-*uclibc*
21706 targets.
21707
21708 -mmusl
21709 Use the musl C library. This is the default on *-*-linux-*musl*
21710 targets.
21711
21712 -mbionic
21713 Use Bionic C library. This is the default on *-*-linux-*android*
21714 targets.
21715
21716 -mandroid
21717 Compile code compatible with Android platform. This is the default
21718 on *-*-linux-*android* targets.
21719
21720 When compiling, this option enables -mbionic, -fPIC,
21721 -fno-exceptions and -fno-rtti by default. When linking, this
21722 option makes the GCC driver pass Android-specific options to the
21723 linker. Finally, this option causes the preprocessor macro
21724 "__ANDROID__" to be defined.
21725
21726 -tno-android-cc
21727 Disable compilation effects of -mandroid, i.e., do not enable
21728 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
21729
21730 -tno-android-ld
21731 Disable linking effects of -mandroid, i.e., pass standard Linux
21732 linking options to the linker.
21733
21734 H8/300 Options
21735
21736 These -m options are defined for the H8/300 implementations:
21737
21738 -mrelax
21739 Shorten some address references at link time, when possible; uses
21740 the linker option -relax.
21741
21742 -mh Generate code for the H8/300H.
21743
21744 -ms Generate code for the H8S.
21745
21746 -mn Generate code for the H8S and H8/300H in the normal mode. This
21747 switch must be used either with -mh or -ms.
21748
21749 -ms2600
21750 Generate code for the H8S/2600. This switch must be used with -ms.
21751
21752 -mexr
21753 Extended registers are stored on stack before execution of function
21754 with monitor attribute. Default option is -mexr. This option is
21755 valid only for H8S targets.
21756
21757 -mno-exr
21758 Extended registers are not stored on stack before execution of
21759 function with monitor attribute. Default option is -mno-exr. This
21760 option is valid only for H8S targets.
21761
21762 -mint32
21763 Make "int" data 32 bits by default.
21764
21765 -malign-300
21766 On the H8/300H and H8S, use the same alignment rules as for the
21767 H8/300. The default for the H8/300H and H8S is to align longs and
21768 floats on 4-byte boundaries. -malign-300 causes them to be aligned
21769 on 2-byte boundaries. This option has no effect on the H8/300.
21770
21771 HPPA Options
21772
21773 These -m options are defined for the HPPA family of computers:
21774
21775 -march=architecture-type
21776 Generate code for the specified architecture. The choices for
21777 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
21778 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
21779 system to determine the proper architecture option for your
21780 machine. Code compiled for lower numbered architectures runs on
21781 higher numbered architectures, but not the other way around.
21782
21783 -mpa-risc-1-0
21784 -mpa-risc-1-1
21785 -mpa-risc-2-0
21786 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
21787
21788 -matomic-libcalls
21789 Generate libcalls for atomic loads and stores when sync libcalls
21790 are disabled. This option is enabled by default. It only affects
21791 the generation of atomic libcalls by the HPPA backend.
21792
21793 Both the sync and libatomic libcall implementations use locking.
21794 As a result, processor stores are not atomic with respect to other
21795 atomic operations. Processor loads up to DImode are atomic with
21796 respect to other atomic operations provided they are implemented as
21797 a single access.
21798
21799 The PA-RISC architecture does not support any atomic operations in
21800 hardware except for the "ldcw" instruction. Thus, all atomic
21801 support is implemented using sync and atomic libcalls. Sync
21802 libcall support is in libgcc.a. Atomic libcall support is in
21803 libatomic.
21804
21805 This option generates "__atomic_exchange" calls for atomic stores.
21806 It also provides special handling for atomic DImode accesses on
21807 32-bit targets.
21808
21809 -mbig-switch
21810 Does nothing. Preserved for backward compatibility.
21811
21812 -mcaller-copies
21813 The caller copies function arguments passed by hidden reference.
21814 This option should be used with care as it is not compatible with
21815 the default 32-bit runtime. However, only aggregates larger than
21816 eight bytes are passed by hidden reference and the option provides
21817 better compatibility with OpenMP.
21818
21819 -mcoherent-ldcw
21820 Use ldcw/ldcd coherent cache-control hint.
21821
21822 -mdisable-fpregs
21823 Disable floating-point registers. Equivalent to "-msoft-float".
21824
21825 -mdisable-indexing
21826 Prevent the compiler from using indexing address modes. This
21827 avoids some rather obscure problems when compiling MIG generated
21828 code under MACH.
21829
21830 -mfast-indirect-calls
21831 Generate code that assumes calls never cross space boundaries.
21832 This allows GCC to emit code that performs faster indirect calls.
21833
21834 This option does not work in the presence of shared libraries or
21835 nested functions.
21836
21837 -mfixed-range=register-range
21838 Generate code treating the given register range as fixed registers.
21839 A fixed register is one that the register allocator cannot use.
21840 This is useful when compiling kernel code. A register range is
21841 specified as two registers separated by a dash. Multiple register
21842 ranges can be specified separated by a comma.
21843
21844 -mgas
21845 Enable the use of assembler directives only GAS understands.
21846
21847 -mgnu-ld
21848 Use options specific to GNU ld. This passes -shared to ld when
21849 building a shared library. It is the default when GCC is
21850 configured, explicitly or implicitly, with the GNU linker. This
21851 option does not affect which ld is called; it only changes what
21852 parameters are passed to that ld. The ld that is called is
21853 determined by the --with-ld configure option, GCC's program search
21854 path, and finally by the user's PATH. The linker used by GCC can
21855 be printed using which `gcc -print-prog-name=ld`. This option is
21856 only available on the 64-bit HP-UX GCC, i.e. configured with
21857 hppa*64*-*-hpux*.
21858
21859 -mhp-ld
21860 Use options specific to HP ld. This passes -b to ld when building
21861 a shared library and passes +Accept TypeMismatch to ld on all
21862 links. It is the default when GCC is configured, explicitly or
21863 implicitly, with the HP linker. This option does not affect which
21864 ld is called; it only changes what parameters are passed to that
21865 ld. The ld that is called is determined by the --with-ld configure
21866 option, GCC's program search path, and finally by the user's PATH.
21867 The linker used by GCC can be printed using which `gcc
21868 -print-prog-name=ld`. This option is only available on the 64-bit
21869 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
21870
21871 -mlinker-opt
21872 Enable the optimization pass in the HP-UX linker. Note this makes
21873 symbolic debugging impossible. It also triggers a bug in the HP-UX
21874 8 and HP-UX 9 linkers in which they give bogus error messages when
21875 linking some programs.
21876
21877 -mlong-calls
21878 Generate code that uses long call sequences. This ensures that a
21879 call is always able to reach linker generated stubs. The default
21880 is to generate long calls only when the distance from the call site
21881 to the beginning of the function or translation unit, as the case
21882 may be, exceeds a predefined limit set by the branch type being
21883 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
21884 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
21885 always limited at 240,000 bytes.
21886
21887 Distances are measured from the beginning of functions when using
21888 the -ffunction-sections option, or when using the -mgas and
21889 -mno-portable-runtime options together under HP-UX with the SOM
21890 linker.
21891
21892 It is normally not desirable to use this option as it degrades
21893 performance. However, it may be useful in large applications,
21894 particularly when partial linking is used to build the application.
21895
21896 The types of long calls used depends on the capabilities of the
21897 assembler and linker, and the type of code being generated. The
21898 impact on systems that support long absolute calls, and long pic
21899 symbol-difference or pc-relative calls should be relatively small.
21900 However, an indirect call is used on 32-bit ELF systems in pic code
21901 and it is quite long.
21902
21903 -mlong-load-store
21904 Generate 3-instruction load and store sequences as sometimes
21905 required by the HP-UX 10 linker. This is equivalent to the +k
21906 option to the HP compilers.
21907
21908 -mjump-in-delay
21909 This option is ignored and provided for compatibility purposes
21910 only.
21911
21912 -mno-space-regs
21913 Generate code that assumes the target has no space registers. This
21914 allows GCC to generate faster indirect calls and use unscaled index
21915 address modes.
21916
21917 Such code is suitable for level 0 PA systems and kernels.
21918
21919 -mordered
21920 Assume memory references are ordered and barriers are not needed.
21921
21922 -mportable-runtime
21923 Use the portable calling conventions proposed by HP for ELF
21924 systems.
21925
21926 -mschedule=cpu-type
21927 Schedule code according to the constraints for the machine type
21928 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
21929 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
21930 to determine the proper scheduling option for your machine. The
21931 default scheduling is 8000.
21932
21933 -msio
21934 Generate the predefine, "_SIO", for server IO. The default is
21935 -mwsio. This generates the predefines, "__hp9000s700",
21936 "__hp9000s700__" and "_WSIO", for workstation IO. These options
21937 are available under HP-UX and HI-UX.
21938
21939 -msoft-float
21940 Generate output containing library calls for floating point.
21941 Warning: the requisite libraries are not available for all HPPA
21942 targets. Normally the facilities of the machine's usual C compiler
21943 are used, but this cannot be done directly in cross-compilation.
21944 You must make your own arrangements to provide suitable library
21945 functions for cross-compilation.
21946
21947 -msoft-float changes the calling convention in the output file;
21948 therefore, it is only useful if you compile all of a program with
21949 this option. In particular, you need to compile libgcc.a, the
21950 library that comes with GCC, with -msoft-float in order for this to
21951 work.
21952
21953 -msoft-mult
21954 Use software integer multiplication.
21955
21956 This disables the use of the "xmpyu" instruction.
21957
21958 -munix=unix-std
21959 Generate compiler predefines and select a startfile for the
21960 specified UNIX standard. The choices for unix-std are 93, 95 and
21961 98. 93 is supported on all HP-UX versions. 95 is available on HP-
21962 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
21963 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
21964 11.00, and 98 for HP-UX 11.11 and later.
21965
21966 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
21967 -munix=95 provides additional predefines for "XOPEN_UNIX" and
21968 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
21969 provides additional predefines for "_XOPEN_UNIX",
21970 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
21971 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
21972
21973 It is important to note that this option changes the interfaces for
21974 various library routines. It also affects the operational behavior
21975 of the C library. Thus, extreme care is needed in using this
21976 option.
21977
21978 Library code that is intended to operate with more than one UNIX
21979 standard must test, set and restore the variable
21980 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
21981 provide this capability.
21982
21983 -nolibdld
21984 Suppress the generation of link options to search libdld.sl when
21985 the -static option is specified on HP-UX 10 and later.
21986
21987 -static
21988 The HP-UX implementation of setlocale in libc has a dependency on
21989 libdld.sl. There isn't an archive version of libdld.sl. Thus,
21990 when the -static option is specified, special link options are
21991 needed to resolve this dependency.
21992
21993 On HP-UX 10 and later, the GCC driver adds the necessary options to
21994 link with libdld.sl when the -static option is specified. This
21995 causes the resulting binary to be dynamic. On the 64-bit port, the
21996 linkers generate dynamic binaries by default in any case. The
21997 -nolibdld option can be used to prevent the GCC driver from adding
21998 these link options.
21999
22000 -threads
22001 Add support for multithreading with the dce thread library under
22002 HP-UX. This option sets flags for both the preprocessor and
22003 linker.
22004
22005 IA-64 Options
22006
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
22225 These -m options are defined for the LatticeMico32 architecture:
22226
22227 -mbarrel-shift-enabled
22228 Enable barrel-shift instructions.
22229
22230 -mdivide-enabled
22231 Enable divide and modulus instructions.
22232
22233 -mmultiply-enabled
22234 Enable multiply instructions.
22235
22236 -msign-extend-enabled
22237 Enable sign extend instructions.
22238
22239 -muser-enabled
22240 Enable user-defined instructions.
22241
22242 LoongArch Options
22243
22244 These command-line options are defined for LoongArch targets:
22245
22246 -march=cpu-type
22247 Generate instructions for the machine type cpu-type. In contrast
22248 to -mtune=cpu-type, which merely tunes the generated code for the
22249 specified cpu-type, -march=cpu-type allows GCC to generate code
22250 that may not run at all on processors other than the one indicated.
22251 Specifying -march=cpu-type implies -mtune=cpu-type, except where
22252 noted otherwise.
22253
22254 The choices for cpu-type are:
22255
22256 native
22257 This selects the CPU to generate code for at compilation time
22258 by determining the processor type of the compiling machine.
22259 Using -march=native enables all instruction subsets supported
22260 by the local machine (hence the result might not run on
22261 different machines). Using -mtune=native produces code
22262 optimized for the local machine under the constraints of the
22263 selected instruction set.
22264
22265 loongarch64
22266 A generic CPU with 64-bit extensions.
22267
22268 la464
22269 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
22270
22271 -mtune=cpu-type
22272 Optimize the output for the given processor, specified by
22273 microarchitecture name.
22274
22275 -mabi=base-abi-type
22276 Generate code for the specified calling convention. base-abi-type
22277 can be one of:
22278
22279 lp64d
22280 Uses 64-bit general purpose registers and 32/64-bit floating-
22281 point registers for parameter passing. Data model is LP64,
22282 where int is 32 bits, while long int and pointers are 64 bits.
22283
22284 lp64f
22285 Uses 64-bit general purpose registers and 32-bit floating-point
22286 registers for parameter passing. Data model is LP64, where int
22287 is 32 bits, while long int and pointers are 64 bits.
22288
22289 lp64s
22290 Uses 64-bit general purpose registers and no floating-point
22291 registers for parameter passing. Data model is LP64, where int
22292 is 32 bits, while long int and pointers are 64 bits.
22293
22294 -mfpu=fpu-type
22295 Generate code for the specified FPU type, which can be one of:
22296
22297 64 Allow the use of hardware floating-point instructions for
22298 32-bit and 64-bit operations.
22299
22300 32 Allow the use of hardware floating-point instructions for
22301 32-bit operations.
22302
22303 none
22304 0 Prevent the use of hardware floating-point instructions.
22305
22306 -msoft-float
22307 Force -mfpu=none and prevents the use of floating-point registers
22308 for parameter passing. This option may change the target ABI.
22309
22310 -msingle-float
22311 Force -mfpu=32 and allow the use of 32-bit floating-point registers
22312 for parameter passing. This option may change the target ABI.
22313
22314 -mdouble-float
22315 Force -mfpu=64 and allow the use of 32/64-bit floating-point
22316 registers for parameter passing. This option may change the target
22317 ABI.
22318
22319 -mbranch-cost=n
22320 Set the cost of branches to roughly n instructions.
22321
22322 -mcheck-zero-division
22323 -mno-check-zero-divison
22324 Trap (do not trap) on integer division by zero. The default is
22325 -mcheck-zero-division for -O0 or -Og, and -mno-check-zero-division
22326 for other optimization levels.
22327
22328 -mcond-move-int
22329 -mno-cond-move-int
22330 Conditional moves for integral data in general-purpose registers
22331 are enabled (disabled). The default is -mcond-move-int.
22332
22333 -mcond-move-float
22334 -mno-cond-move-float
22335 Conditional moves for floating-point registers are enabled
22336 (disabled). The default is -mcond-move-float.
22337
22338 -mmemcpy
22339 -mno-memcpy
22340 Force (do not force) the use of "memcpy" for non-trivial block
22341 moves. The default is -mno-memcpy, which allows GCC to inline most
22342 constant-sized copies. Setting optimization level to -Os also
22343 forces the use of "memcpy", but -mno-memcpy may override this
22344 behavior if explicitly specified, regardless of the order these
22345 options on the command line.
22346
22347 -mstrict-align
22348 -mno-strict-align
22349 Avoid or allow generating memory accesses that may not be aligned
22350 on a natural object boundary as described in the architecture
22351 specification. The default is -mno-strict-align.
22352
22353 -msmall-data-limit=number
22354 Put global and static data smaller than number bytes into a special
22355 section (on some targets). The default value is 0.
22356
22357 -mmax-inline-memcpy-size=n
22358 Inline all block moves (such as calls to "memcpy" or structure
22359 copies) less than or equal to n bytes. The default value of n is
22360 1024.
22361
22362 -mcmodel=code-model
22363 Set the code model to one of:
22364
22365 tiny-static (Not implemented yet)
22366 tiny (Not implemented yet)
22367 normal
22368 The text segment must be within 128MB addressing space. The
22369 data segment must be within 2GB addressing space.
22370
22371 medium
22372 The text segment and data segment must be within 2GB addressing
22373 space.
22374
22375 large (Not implemented yet)
22376 extreme
22377 This mode does not limit the size of the code segment and data
22378 segment. The -mcmodel=extreme option is incompatible with
22379 -fplt and -mno-explicit-relocs.
22380
22381 The default code model is "normal".
22382
22383 -mexplicit-relocs
22384 -mno-explicit-relocs
22385 Use or do not use assembler relocation operators when dealing with
22386 symbolic addresses. The alternative is to use assembler macros
22387 instead, which may limit optimization. The default value for the
22388 option is determined during GCC build-time by detecting
22389 corresponding assembler support: "-mexplicit-relocs" if said
22390 support is present, "-mno-explicit-relocs" otherwise. This option
22391 is mostly useful for debugging, or interoperation with assemblers
22392 different from the build-time one.
22393
22394 -mdirect-extern-access
22395 -mno-direct-extern-access
22396 Do not use or use GOT to access external symbols. The default is
22397 -mno-direct-extern-access: GOT is used for external symbols with
22398 default visibility, but not used for other external symbols.
22399
22400 With -mdirect-extern-access, GOT is not used and all external
22401 symbols are PC-relatively addressed. It is only suitable for
22402 environments where no dynamic link is performed, like firmwares, OS
22403 kernels, executables linked with -static or -static-pie.
22404 -mdirect-extern-access is not compatible with -fPIC or -fpic.
22405
22406 M32C Options
22407
22408 -mcpu=name
22409 Select the CPU for which code is generated. name may be one of r8c
22410 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
22411 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
22412
22413 -msim
22414 Specifies that the program will be run on the simulator. This
22415 causes an alternate runtime library to be linked in which supports,
22416 for example, file I/O. You must not use this option when
22417 generating programs that will run on real hardware; you must
22418 provide your own runtime library for whatever I/O functions are
22419 needed.
22420
22421 -memregs=number
22422 Specifies the number of memory-based pseudo-registers GCC uses
22423 during code generation. These pseudo-registers are used like real
22424 registers, so there is a tradeoff between GCC's ability to fit the
22425 code into available registers, and the performance penalty of using
22426 memory instead of registers. Note that all modules in a program
22427 must be compiled with the same value for this option. Because of
22428 that, you must not use this option with GCC's default runtime
22429 libraries.
22430
22431 M32R/D Options
22432
22433 These -m options are defined for Renesas M32R/D architectures:
22434
22435 -m32r2
22436 Generate code for the M32R/2.
22437
22438 -m32rx
22439 Generate code for the M32R/X.
22440
22441 -m32r
22442 Generate code for the M32R. This is the default.
22443
22444 -mmodel=small
22445 Assume all objects live in the lower 16MB of memory (so that their
22446 addresses can be loaded with the "ld24" instruction), and assume
22447 all subroutines are reachable with the "bl" instruction. This is
22448 the default.
22449
22450 The addressability of a particular object can be set with the
22451 "model" attribute.
22452
22453 -mmodel=medium
22454 Assume objects may be anywhere in the 32-bit address space (the
22455 compiler generates "seth/add3" instructions to load their
22456 addresses), and assume all subroutines are reachable with the "bl"
22457 instruction.
22458
22459 -mmodel=large
22460 Assume objects may be anywhere in the 32-bit address space (the
22461 compiler generates "seth/add3" instructions to load their
22462 addresses), and assume subroutines may not be reachable with the
22463 "bl" instruction (the compiler generates the much slower
22464 "seth/add3/jl" instruction sequence).
22465
22466 -msdata=none
22467 Disable use of the small data area. Variables are put into one of
22468 ".data", ".bss", or ".rodata" (unless the "section" attribute has
22469 been specified). This is the default.
22470
22471 The small data area consists of sections ".sdata" and ".sbss".
22472 Objects may be explicitly put in the small data area with the
22473 "section" attribute using one of these sections.
22474
22475 -msdata=sdata
22476 Put small global and static data in the small data area, but do not
22477 generate special code to reference them.
22478
22479 -msdata=use
22480 Put small global and static data in the small data area, and
22481 generate special instructions to reference them.
22482
22483 -G num
22484 Put global and static objects less than or equal to num bytes into
22485 the small data or BSS sections instead of the normal data or BSS
22486 sections. The default value of num is 8. The -msdata option must
22487 be set to one of sdata or use for this option to have any effect.
22488
22489 All modules should be compiled with the same -G num value.
22490 Compiling with different values of num may or may not work; if it
22491 doesn't the linker gives an error message---incorrect code is not
22492 generated.
22493
22494 -mdebug
22495 Makes the M32R-specific code in the compiler display some
22496 statistics that might help in debugging programs.
22497
22498 -malign-loops
22499 Align all loops to a 32-byte boundary.
22500
22501 -mno-align-loops
22502 Do not enforce a 32-byte alignment for loops. This is the default.
22503
22504 -missue-rate=number
22505 Issue number instructions per cycle. number can only be 1 or 2.
22506
22507 -mbranch-cost=number
22508 number can only be 1 or 2. If it is 1 then branches are preferred
22509 over conditional code, if it is 2, then the opposite applies.
22510
22511 -mflush-trap=number
22512 Specifies the trap number to use to flush the cache. The default
22513 is 12. Valid numbers are between 0 and 15 inclusive.
22514
22515 -mno-flush-trap
22516 Specifies that the cache cannot be flushed by using a trap.
22517
22518 -mflush-func=name
22519 Specifies the name of the operating system function to call to
22520 flush the cache. The default is _flush_cache, but a function call
22521 is only used if a trap is not available.
22522
22523 -mno-flush-func
22524 Indicates that there is no OS function for flushing the cache.
22525
22526 M680x0 Options
22527
22528 These are the -m options defined for M680x0 and ColdFire processors.
22529 The default settings depend on which architecture was selected when the
22530 compiler was configured; the defaults for the most common choices are
22531 given below.
22532
22533 -march=arch
22534 Generate code for a specific M680x0 or ColdFire instruction set
22535 architecture. Permissible values of arch for M680x0 architectures
22536 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
22537 architectures are selected according to Freescale's ISA
22538 classification and the permissible values are: isaa, isaaplus, isab
22539 and isac.
22540
22541 GCC defines a macro "__mcfarch__" whenever it is generating code
22542 for a ColdFire target. The arch in this macro is one of the -march
22543 arguments given above.
22544
22545 When used together, -march and -mtune select code that runs on a
22546 family of similar processors but that is optimized for a particular
22547 microarchitecture.
22548
22549 -mcpu=cpu
22550 Generate code for a specific M680x0 or ColdFire processor. The
22551 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
22552 68332 and cpu32. The ColdFire cpus are given by the table below,
22553 which also classifies the CPUs into families:
22554
22555 Family : -mcpu arguments
22556 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
22557 5206 : 5202 5204 5206
22558 5206e : 5206e
22559 5208 : 5207 5208
22560 5211a : 5210a 5211a
22561 5213 : 5211 5212 5213
22562 5216 : 5214 5216
22563 52235 : 52230 52231 52232 52233 52234 52235
22564 5225 : 5224 5225
22565 52259 : 52252 52254 52255 52256 52258 52259
22566 5235 : 5232 5233 5234 5235 523x
22567 5249 : 5249
22568 5250 : 5250
22569 5271 : 5270 5271
22570 5272 : 5272
22571 5275 : 5274 5275
22572 5282 : 5280 5281 5282 528x
22573 53017 : 53011 53012 53013 53014 53015 53016 53017
22574 5307 : 5307
22575 5329 : 5327 5328 5329 532x
22576 5373 : 5372 5373 537x
22577 5407 : 5407
22578 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
22579 5485
22580
22581 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
22582 Other combinations of -mcpu and -march are rejected.
22583
22584 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
22585 selected. It also defines "__mcf_family_family", where the value
22586 of family is given by the table above.
22587
22588 -mtune=tune
22589 Tune the code for a particular microarchitecture within the
22590 constraints set by -march and -mcpu. The M680x0 microarchitectures
22591 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
22592 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
22593
22594 You can also use -mtune=68020-40 for code that needs to run
22595 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
22596 is similar but includes 68060 targets as well. These two options
22597 select the same tuning decisions as -m68020-40 and -m68020-60
22598 respectively.
22599
22600 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
22601 680x0 architecture arch. It also defines "mcarch" unless either
22602 -ansi or a non-GNU -std option is used. If GCC is tuning for a
22603 range of architectures, as selected by -mtune=68020-40 or
22604 -mtune=68020-60, it defines the macros for every architecture in
22605 the range.
22606
22607 GCC also defines the macro "__muarch__" when tuning for ColdFire
22608 microarchitecture uarch, where uarch is one of the arguments given
22609 above.
22610
22611 -m68000
22612 -mc68000
22613 Generate output for a 68000. This is the default when the compiler
22614 is configured for 68000-based systems. It is equivalent to
22615 -march=68000.
22616
22617 Use this option for microcontrollers with a 68000 or EC000 core,
22618 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
22619
22620 -m68010
22621 Generate output for a 68010. This is the default when the compiler
22622 is configured for 68010-based systems. It is equivalent to
22623 -march=68010.
22624
22625 -m68020
22626 -mc68020
22627 Generate output for a 68020. This is the default when the compiler
22628 is configured for 68020-based systems. It is equivalent to
22629 -march=68020.
22630
22631 -m68030
22632 Generate output for a 68030. This is the default when the compiler
22633 is configured for 68030-based systems. It is equivalent to
22634 -march=68030.
22635
22636 -m68040
22637 Generate output for a 68040. This is the default when the compiler
22638 is configured for 68040-based systems. It is equivalent to
22639 -march=68040.
22640
22641 This option inhibits the use of 68881/68882 instructions that have
22642 to be emulated by software on the 68040. Use this option if your
22643 68040 does not have code to emulate those instructions.
22644
22645 -m68060
22646 Generate output for a 68060. This is the default when the compiler
22647 is configured for 68060-based systems. It is equivalent to
22648 -march=68060.
22649
22650 This option inhibits the use of 68020 and 68881/68882 instructions
22651 that have to be emulated by software on the 68060. Use this option
22652 if your 68060 does not have code to emulate those instructions.
22653
22654 -mcpu32
22655 Generate output for a CPU32. This is the default when the compiler
22656 is configured for CPU32-based systems. It is equivalent to
22657 -march=cpu32.
22658
22659 Use this option for microcontrollers with a CPU32 or CPU32+ core,
22660 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
22661 68341, 68349 and 68360.
22662
22663 -m5200
22664 Generate output for a 520X ColdFire CPU. This is the default when
22665 the compiler is configured for 520X-based systems. It is
22666 equivalent to -mcpu=5206, and is now deprecated in favor of that
22667 option.
22668
22669 Use this option for microcontroller with a 5200 core, including the
22670 MCF5202, MCF5203, MCF5204 and MCF5206.
22671
22672 -m5206e
22673 Generate output for a 5206e ColdFire CPU. The option is now
22674 deprecated in favor of the equivalent -mcpu=5206e.
22675
22676 -m528x
22677 Generate output for a member of the ColdFire 528X family. The
22678 option is now deprecated in favor of the equivalent -mcpu=528x.
22679
22680 -m5307
22681 Generate output for a ColdFire 5307 CPU. The option is now
22682 deprecated in favor of the equivalent -mcpu=5307.
22683
22684 -m5407
22685 Generate output for a ColdFire 5407 CPU. The option is now
22686 deprecated in favor of the equivalent -mcpu=5407.
22687
22688 -mcfv4e
22689 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
22690 This includes use of hardware floating-point instructions. The
22691 option is equivalent to -mcpu=547x, and is now deprecated in favor
22692 of that option.
22693
22694 -m68020-40
22695 Generate output for a 68040, without using any of the new
22696 instructions. This results in code that can run relatively
22697 efficiently on either a 68020/68881 or a 68030 or a 68040. The
22698 generated code does use the 68881 instructions that are emulated on
22699 the 68040.
22700
22701 The option is equivalent to -march=68020 -mtune=68020-40.
22702
22703 -m68020-60
22704 Generate output for a 68060, without using any of the new
22705 instructions. This results in code that can run relatively
22706 efficiently on either a 68020/68881 or a 68030 or a 68040. The
22707 generated code does use the 68881 instructions that are emulated on
22708 the 68060.
22709
22710 The option is equivalent to -march=68020 -mtune=68020-60.
22711
22712 -mhard-float
22713 -m68881
22714 Generate floating-point instructions. This is the default for
22715 68020 and above, and for ColdFire devices that have an FPU. It
22716 defines the macro "__HAVE_68881__" on M680x0 targets and
22717 "__mcffpu__" on ColdFire targets.
22718
22719 -msoft-float
22720 Do not generate floating-point instructions; use library calls
22721 instead. This is the default for 68000, 68010, and 68832 targets.
22722 It is also the default for ColdFire devices that have no FPU.
22723
22724 -mdiv
22725 -mno-div
22726 Generate (do not generate) ColdFire hardware divide and remainder
22727 instructions. If -march is used without -mcpu, the default is "on"
22728 for ColdFire architectures and "off" for M680x0 architectures.
22729 Otherwise, the default is taken from the target CPU (either the
22730 default CPU, or the one specified by -mcpu). For example, the
22731 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
22732
22733 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
22734
22735 -mshort
22736 Consider type "int" to be 16 bits wide, like "short int".
22737 Additionally, parameters passed on the stack are also aligned to a
22738 16-bit boundary even on targets whose API mandates promotion to
22739 32-bit.
22740
22741 -mno-short
22742 Do not consider type "int" to be 16 bits wide. This is the
22743 default.
22744
22745 -mnobitfield
22746 -mno-bitfield
22747 Do not use the bit-field instructions. The -m68000, -mcpu32 and
22748 -m5200 options imply -mnobitfield.
22749
22750 -mbitfield
22751 Do use the bit-field instructions. The -m68020 option implies
22752 -mbitfield. This is the default if you use a configuration
22753 designed for a 68020.
22754
22755 -mrtd
22756 Use a different function-calling convention, in which functions
22757 that take a fixed number of arguments return with the "rtd"
22758 instruction, which pops their arguments while returning. This
22759 saves one instruction in the caller since there is no need to pop
22760 the arguments there.
22761
22762 This calling convention is incompatible with the one normally used
22763 on Unix, so you cannot use it if you need to call libraries
22764 compiled with the Unix compiler.
22765
22766 Also, you must provide function prototypes for all functions that
22767 take variable numbers of arguments (including "printf"); otherwise
22768 incorrect code is generated for calls to those functions.
22769
22770 In addition, seriously incorrect code results if you call a
22771 function with too many arguments. (Normally, extra arguments are
22772 harmlessly ignored.)
22773
22774 The "rtd" instruction is supported by the 68010, 68020, 68030,
22775 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
22776
22777 The default is -mno-rtd.
22778
22779 -malign-int
22780 -mno-align-int
22781 Control whether GCC aligns "int", "long", "long long", "float",
22782 "double", and "long double" variables on a 32-bit boundary
22783 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
22784 variables on 32-bit boundaries produces code that runs somewhat
22785 faster on processors with 32-bit busses at the expense of more
22786 memory.
22787
22788 Warning: if you use the -malign-int switch, GCC aligns structures
22789 containing the above types differently than most published
22790 application binary interface specifications for the m68k.
22791
22792 Use the pc-relative addressing mode of the 68000 directly, instead
22793 of using a global offset table. At present, this option implies
22794 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
22795 -fPIC is not presently supported with -mpcrel, though this could be
22796 supported for 68020 and higher processors.
22797
22798 -mno-strict-align
22799 -mstrict-align
22800 Do not (do) assume that unaligned memory references are handled by
22801 the system.
22802
22803 -msep-data
22804 Generate code that allows the data segment to be located in a
22805 different area of memory from the text segment. This allows for
22806 execute-in-place in an environment without virtual memory
22807 management. This option implies -fPIC.
22808
22809 -mno-sep-data
22810 Generate code that assumes that the data segment follows the text
22811 segment. This is the default.
22812
22813 -mid-shared-library
22814 Generate code that supports shared libraries via the library ID
22815 method. This allows for execute-in-place and shared libraries in
22816 an environment without virtual memory management. This option
22817 implies -fPIC.
22818
22819 -mno-id-shared-library
22820 Generate code that doesn't assume ID-based shared libraries are
22821 being used. This is the default.
22822
22823 -mshared-library-id=n
22824 Specifies the identification number of the ID-based shared library
22825 being compiled. Specifying a value of 0 generates more compact
22826 code; specifying other values forces the allocation of that number
22827 to the current library, but is no more space- or time-efficient
22828 than omitting this option.
22829
22830 -mxgot
22831 -mno-xgot
22832 When generating position-independent code for ColdFire, generate
22833 code that works if the GOT has more than 8192 entries. This code
22834 is larger and slower than code generated without this option. On
22835 M680x0 processors, this option is not needed; -fPIC suffices.
22836
22837 GCC normally uses a single instruction to load values from the GOT.
22838 While this is relatively efficient, it only works if the GOT is
22839 smaller than about 64k. Anything larger causes the linker to
22840 report an error such as:
22841
22842 relocation truncated to fit: R_68K_GOT16O foobar
22843
22844 If this happens, you should recompile your code with -mxgot. It
22845 should then work with very large GOTs. However, code generated
22846 with -mxgot is less efficient, since it takes 4 instructions to
22847 fetch the value of a global symbol.
22848
22849 Note that some linkers, including newer versions of the GNU linker,
22850 can create multiple GOTs and sort GOT entries. If you have such a
22851 linker, you should only need to use -mxgot when compiling a single
22852 object file that accesses more than 8192 GOT entries. Very few do.
22853
22854 These options have no effect unless GCC is generating position-
22855 independent code.
22856
22857 -mlong-jump-table-offsets
22858 Use 32-bit offsets in "switch" tables. The default is to use
22859 16-bit offsets.
22860
22861 MCore Options
22862
22863 These are the -m options defined for the Motorola M*Core processors.
22864
22865 -mhardlit
22866 -mno-hardlit
22867 Inline constants into the code stream if it can be done in two
22868 instructions or less.
22869
22870 -mdiv
22871 -mno-div
22872 Use the divide instruction. (Enabled by default).
22873
22874 -mrelax-immediate
22875 -mno-relax-immediate
22876 Allow arbitrary-sized immediates in bit operations.
22877
22878 -mwide-bitfields
22879 -mno-wide-bitfields
22880 Always treat bit-fields as "int"-sized.
22881
22882 -m4byte-functions
22883 -mno-4byte-functions
22884 Force all functions to be aligned to a 4-byte boundary.
22885
22886 -mcallgraph-data
22887 -mno-callgraph-data
22888 Emit callgraph information.
22889
22890 -mslow-bytes
22891 -mno-slow-bytes
22892 Prefer word access when reading byte quantities.
22893
22894 -mlittle-endian
22895 -mbig-endian
22896 Generate code for a little-endian target.
22897
22898 -m210
22899 -m340
22900 Generate code for the 210 processor.
22901
22902 -mno-lsim
22903 Assume that runtime support has been provided and so omit the
22904 simulator library (libsim.a) from the linker command line.
22905
22906 -mstack-increment=size
22907 Set the maximum amount for a single stack increment operation.
22908 Large values can increase the speed of programs that contain
22909 functions that need a large amount of stack space, but they can
22910 also trigger a segmentation fault if the stack is extended too
22911 much. The default value is 0x1000.
22912
22913 MicroBlaze Options
22914
22915 -msoft-float
22916 Use software emulation for floating point (default).
22917
22918 -mhard-float
22919 Use hardware floating-point instructions.
22920
22921 -mmemcpy
22922 Do not optimize block moves, use "memcpy".
22923
22924 -mno-clearbss
22925 This option is deprecated. Use -fno-zero-initialized-in-bss
22926 instead.
22927
22928 -mcpu=cpu-type
22929 Use features of, and schedule code for, the given CPU. Supported
22930 values are in the format vX.YY.Z, where X is a major version, YY is
22931 the minor version, and Z is compatibility code. Example values are
22932 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
22933
22934 -mxl-soft-mul
22935 Use software multiply emulation (default).
22936
22937 -mxl-soft-div
22938 Use software emulation for divides (default).
22939
22940 -mxl-barrel-shift
22941 Use the hardware barrel shifter.
22942
22943 -mxl-pattern-compare
22944 Use pattern compare instructions.
22945
22946 -msmall-divides
22947 Use table lookup optimization for small signed integer divisions.
22948
22949 -mxl-stack-check
22950 This option is deprecated. Use -fstack-check instead.
22951
22952 -mxl-gp-opt
22953 Use GP-relative ".sdata"/".sbss" sections.
22954
22955 -mxl-multiply-high
22956 Use multiply high instructions for high part of 32x32 multiply.
22957
22958 -mxl-float-convert
22959 Use hardware floating-point conversion instructions.
22960
22961 -mxl-float-sqrt
22962 Use hardware floating-point square root instruction.
22963
22964 -mbig-endian
22965 Generate code for a big-endian target.
22966
22967 -mlittle-endian
22968 Generate code for a little-endian target.
22969
22970 -mxl-reorder
22971 Use reorder instructions (swap and byte reversed load/store).
22972
22973 -mxl-mode-app-model
22974 Select application model app-model. Valid models are
22975
22976 executable
22977 normal executable (default), uses startup code crt0.o.
22978
22979 xmdstub
22980 for use with Xilinx Microprocessor Debugger (XMD) based
22981 software intrusive debug agent called xmdstub. This uses
22982 startup file crt1.o and sets the start address of the program
22983 to 0x800.
22984
22985 bootstrap
22986 for applications that are loaded using a bootloader. This
22987 model uses startup file crt2.o which does not contain a
22988 processor reset vector handler. This is suitable for
22989 transferring control on a processor reset to the bootloader
22990 rather than the application.
22991
22992 novectors
22993 for applications that do not require any of the MicroBlaze
22994 vectors. This option may be useful for applications running
22995 within a monitoring application. This model uses crt3.o as a
22996 startup file.
22997
22998 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
22999 model.
23000
23001 -mpic-data-is-text-relative
23002 Assume that the displacement between the text and data segments is
23003 fixed at static link time. This allows data to be referenced by
23004 offset from start of text address instead of GOT since PC-relative
23005 addressing is not supported.
23006
23007 MIPS Options
23008
23009 -EB Generate big-endian code.
23010
23011 -EL Generate little-endian code. This is the default for mips*el-*-*
23012 configurations.
23013
23014 -march=arch
23015 Generate code that runs on arch, which can be the name of a generic
23016 MIPS ISA, or the name of a particular processor. The ISA names
23017 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
23018 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
23019 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
23020 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
23021 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
23022 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
23023 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
23024 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
23025 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
23026 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
23027 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
23028 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
23029 and xlp. The special value from-abi selects the most compatible
23030 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
23031 and mips3 for 64-bit ABIs).
23032
23033 The native Linux/GNU toolchain also supports the value native,
23034 which selects the best architecture option for the host processor.
23035 -march=native has no effect if GCC does not recognize the
23036 processor.
23037
23038 In processor names, a final 000 can be abbreviated as k (for
23039 example, -march=r2k). Prefixes are optional, and vr may be written
23040 r.
23041
23042 Names of the form nf2_1 refer to processors with FPUs clocked at
23043 half the rate of the core, names of the form nf1_1 refer to
23044 processors with FPUs clocked at the same rate as the core, and
23045 names of the form nf3_2 refer to processors with FPUs clocked a
23046 ratio of 3:2 with respect to the core. For compatibility reasons,
23047 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
23048 as synonyms for nf1_1.
23049
23050 GCC defines two macros based on the value of this option. The
23051 first is "_MIPS_ARCH", which gives the name of target architecture,
23052 as a string. The second has the form "_MIPS_ARCH_foo", where foo
23053 is the capitalized value of "_MIPS_ARCH". For example,
23054 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
23055 "_MIPS_ARCH_R2000".
23056
23057 Note that the "_MIPS_ARCH" macro uses the processor names given
23058 above. In other words, it has the full prefix and does not
23059 abbreviate 000 as k. In the case of from-abi, the macro names the
23060 resolved architecture (either "mips1" or "mips3"). It names the
23061 default architecture when no -march option is given.
23062
23063 -mtune=arch
23064 Optimize for arch. Among other things, this option controls the
23065 way instructions are scheduled, and the perceived cost of
23066 arithmetic operations. The list of arch values is the same as for
23067 -march.
23068
23069 When this option is not used, GCC optimizes for the processor
23070 specified by -march. By using -march and -mtune together, it is
23071 possible to generate code that runs on a family of processors, but
23072 optimize the code for one particular member of that family.
23073
23074 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
23075 work in the same way as the -march ones described above.
23076
23077 -mips1
23078 Equivalent to -march=mips1.
23079
23080 -mips2
23081 Equivalent to -march=mips2.
23082
23083 -mips3
23084 Equivalent to -march=mips3.
23085
23086 -mips4
23087 Equivalent to -march=mips4.
23088
23089 -mips32
23090 Equivalent to -march=mips32.
23091
23092 -mips32r3
23093 Equivalent to -march=mips32r3.
23094
23095 -mips32r5
23096 Equivalent to -march=mips32r5.
23097
23098 -mips32r6
23099 Equivalent to -march=mips32r6.
23100
23101 -mips64
23102 Equivalent to -march=mips64.
23103
23104 -mips64r2
23105 Equivalent to -march=mips64r2.
23106
23107 -mips64r3
23108 Equivalent to -march=mips64r3.
23109
23110 -mips64r5
23111 Equivalent to -march=mips64r5.
23112
23113 -mips64r6
23114 Equivalent to -march=mips64r6.
23115
23116 -mips16
23117 -mno-mips16
23118 Generate (do not generate) MIPS16 code. If GCC is targeting a
23119 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
23120
23121 MIPS16 code generation can also be controlled on a per-function
23122 basis by means of "mips16" and "nomips16" attributes.
23123
23124 -mflip-mips16
23125 Generate MIPS16 code on alternating functions. This option is
23126 provided for regression testing of mixed MIPS16/non-MIPS16 code
23127 generation, and is not intended for ordinary use in compiling user
23128 code.
23129
23130 -minterlink-compressed
23131 -mno-interlink-compressed
23132 Require (do not require) that code using the standard
23133 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
23134 microMIPS code, and vice versa.
23135
23136 For example, code using the standard ISA encoding cannot jump
23137 directly to MIPS16 or microMIPS code; it must either use a call or
23138 an indirect jump. -minterlink-compressed therefore disables direct
23139 jumps unless GCC knows that the target of the jump is not
23140 compressed.
23141
23142 -minterlink-mips16
23143 -mno-interlink-mips16
23144 Aliases of -minterlink-compressed and -mno-interlink-compressed.
23145 These options predate the microMIPS ASE and are retained for
23146 backwards compatibility.
23147
23148 -mabi=32
23149 -mabi=o64
23150 -mabi=n32
23151 -mabi=64
23152 -mabi=eabi
23153 Generate code for the given ABI.
23154
23155 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
23156 generates 64-bit code when you select a 64-bit architecture, but
23157 you can use -mgp32 to get 32-bit code instead.
23158
23159 For information about the O64 ABI, see
23160 <https://gcc.gnu.org/projects/mipso64-abi.html>.
23161
23162 GCC supports a variant of the o32 ABI in which floating-point
23163 registers are 64 rather than 32 bits wide. You can select this
23164 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
23165 and "mfhc1" instructions and is therefore only supported for
23166 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
23167
23168 The register assignments for arguments and return values remain the
23169 same, but each scalar value is passed in a single 64-bit register
23170 rather than a pair of 32-bit registers. For example, scalar
23171 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
23172 The set of call-saved registers also remains the same in that the
23173 even-numbered double-precision registers are saved.
23174
23175 Two additional variants of the o32 ABI are supported to enable a
23176 transition from 32-bit to 64-bit registers. These are FPXX
23177 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
23178 mandates that all code must execute correctly when run using 32-bit
23179 or 64-bit registers. The code can be interlinked with either FP32
23180 or FP64, but not both. The FP64A extension is similar to the FP64
23181 extension but forbids the use of odd-numbered single-precision
23182 registers. This can be used in conjunction with the "FRE" mode of
23183 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
23184 interlink and run in the same process without changing FPU modes.
23185
23186 -mabicalls
23187 -mno-abicalls
23188 Generate (do not generate) code that is suitable for SVR4-style
23189 dynamic objects. -mabicalls is the default for SVR4-based systems.
23190
23191 -mshared
23192 -mno-shared
23193 Generate (do not generate) code that is fully position-independent,
23194 and that can therefore be linked into shared libraries. This
23195 option only affects -mabicalls.
23196
23197 All -mabicalls code has traditionally been position-independent,
23198 regardless of options like -fPIC and -fpic. However, as an
23199 extension, the GNU toolchain allows executables to use absolute
23200 accesses for locally-binding symbols. It can also use shorter GP
23201 initialization sequences and generate direct calls to locally-
23202 defined functions. This mode is selected by -mno-shared.
23203
23204 -mno-shared depends on binutils 2.16 or higher and generates
23205 objects that can only be linked by the GNU linker. However, the
23206 option does not affect the ABI of the final executable; it only
23207 affects the ABI of relocatable objects. Using -mno-shared
23208 generally makes executables both smaller and quicker.
23209
23210 -mshared is the default.
23211
23212 -mplt
23213 -mno-plt
23214 Assume (do not assume) that the static and dynamic linkers support
23215 PLTs and copy relocations. This option only affects -mno-shared
23216 -mabicalls. For the n64 ABI, this option has no effect without
23217 -msym32.
23218
23219 You can make -mplt the default by configuring GCC with
23220 --with-mips-plt. The default is -mno-plt otherwise.
23221
23222 -mxgot
23223 -mno-xgot
23224 Lift (do not lift) the usual restrictions on the size of the global
23225 offset table.
23226
23227 GCC normally uses a single instruction to load values from the GOT.
23228 While this is relatively efficient, it only works if the GOT is
23229 smaller than about 64k. Anything larger causes the linker to
23230 report an error such as:
23231
23232 relocation truncated to fit: R_MIPS_GOT16 foobar
23233
23234 If this happens, you should recompile your code with -mxgot. This
23235 works with very large GOTs, although the code is also less
23236 efficient, since it takes three instructions to fetch the value of
23237 a global symbol.
23238
23239 Note that some linkers can create multiple GOTs. If you have such
23240 a linker, you should only need to use -mxgot when a single object
23241 file accesses more than 64k's worth of GOT entries. Very few do.
23242
23243 These options have no effect unless GCC is generating position
23244 independent code.
23245
23246 -mgp32
23247 Assume that general-purpose registers are 32 bits wide.
23248
23249 -mgp64
23250 Assume that general-purpose registers are 64 bits wide.
23251
23252 -mfp32
23253 Assume that floating-point registers are 32 bits wide.
23254
23255 -mfp64
23256 Assume that floating-point registers are 64 bits wide.
23257
23258 -mfpxx
23259 Do not assume the width of floating-point registers.
23260
23261 -mhard-float
23262 Use floating-point coprocessor instructions.
23263
23264 -msoft-float
23265 Do not use floating-point coprocessor instructions. Implement
23266 floating-point calculations using library calls instead.
23267
23268 -mno-float
23269 Equivalent to -msoft-float, but additionally asserts that the
23270 program being compiled does not perform any floating-point
23271 operations. This option is presently supported only by some bare-
23272 metal MIPS configurations, where it may select a special set of
23273 libraries that lack all floating-point support (including, for
23274 example, the floating-point "printf" formats). If code compiled
23275 with -mno-float accidentally contains floating-point operations, it
23276 is likely to suffer a link-time or run-time failure.
23277
23278 -msingle-float
23279 Assume that the floating-point coprocessor only supports single-
23280 precision operations.
23281
23282 -mdouble-float
23283 Assume that the floating-point coprocessor supports double-
23284 precision operations. This is the default.
23285
23286 -modd-spreg
23287 -mno-odd-spreg
23288 Enable the use of odd-numbered single-precision floating-point
23289 registers for the o32 ABI. This is the default for processors that
23290 are known to support these registers. When using the o32 FPXX ABI,
23291 -mno-odd-spreg is set by default.
23292
23293 -mabs=2008
23294 -mabs=legacy
23295 These options control the treatment of the special not-a-number
23296 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
23297 machine instructions.
23298
23299 By default or when -mabs=legacy is used the legacy treatment is
23300 selected. In this case these instructions are considered
23301 arithmetic and avoided where correct operation is required and the
23302 input operand might be a NaN. A longer sequence of instructions
23303 that manipulate the sign bit of floating-point datum manually is
23304 used instead unless the -ffinite-math-only option has also been
23305 specified.
23306
23307 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
23308 case these instructions are considered non-arithmetic and therefore
23309 operating correctly in all cases, including in particular where the
23310 input operand is a NaN. These instructions are therefore always
23311 used for the respective operations.
23312
23313 -mnan=2008
23314 -mnan=legacy
23315 These options control the encoding of the special not-a-number
23316 (NaN) IEEE 754 floating-point data.
23317
23318 The -mnan=legacy option selects the legacy encoding. In this case
23319 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
23320 significand field being 0, whereas signaling NaNs (sNaNs) are
23321 denoted by the first bit of their trailing significand field being
23322 1.
23323
23324 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
23325 case qNaNs are denoted by the first bit of their trailing
23326 significand field being 1, whereas sNaNs are denoted by the first
23327 bit of their trailing significand field being 0.
23328
23329 The default is -mnan=legacy unless GCC has been configured with
23330 --with-nan=2008.
23331
23332 -mllsc
23333 -mno-llsc
23334 Use (do not use) ll, sc, and sync instructions to implement atomic
23335 memory built-in functions. When neither option is specified, GCC
23336 uses the instructions if the target architecture supports them.
23337
23338 -mllsc is useful if the runtime environment can emulate the
23339 instructions and -mno-llsc can be useful when compiling for
23340 nonstandard ISAs. You can make either option the default by
23341 configuring GCC with --with-llsc and --without-llsc respectively.
23342 --with-llsc is the default for some configurations; see the
23343 installation documentation for details.
23344
23345 -mdsp
23346 -mno-dsp
23347 Use (do not use) revision 1 of the MIPS DSP ASE.
23348 This option defines the preprocessor macro "__mips_dsp". It also
23349 defines "__mips_dsp_rev" to 1.
23350
23351 -mdspr2
23352 -mno-dspr2
23353 Use (do not use) revision 2 of the MIPS DSP ASE.
23354 This option defines the preprocessor macros "__mips_dsp" and
23355 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
23356
23357 -msmartmips
23358 -mno-smartmips
23359 Use (do not use) the MIPS SmartMIPS ASE.
23360
23361 -mpaired-single
23362 -mno-paired-single
23363 Use (do not use) paired-single floating-point instructions.
23364 This option requires hardware floating-point support to be
23365 enabled.
23366
23367 -mdmx
23368 -mno-mdmx
23369 Use (do not use) MIPS Digital Media Extension instructions. This
23370 option can only be used when generating 64-bit code and requires
23371 hardware floating-point support to be enabled.
23372
23373 -mips3d
23374 -mno-mips3d
23375 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
23376 -mpaired-single.
23377
23378 -mmicromips
23379 -mno-micromips
23380 Generate (do not generate) microMIPS code.
23381
23382 MicroMIPS code generation can also be controlled on a per-function
23383 basis by means of "micromips" and "nomicromips" attributes.
23384
23385 -mmt
23386 -mno-mt
23387 Use (do not use) MT Multithreading instructions.
23388
23389 -mmcu
23390 -mno-mcu
23391 Use (do not use) the MIPS MCU ASE instructions.
23392
23393 -meva
23394 -mno-eva
23395 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
23396
23397 -mvirt
23398 -mno-virt
23399 Use (do not use) the MIPS Virtualization (VZ) instructions.
23400
23401 -mxpa
23402 -mno-xpa
23403 Use (do not use) the MIPS eXtended Physical Address (XPA)
23404 instructions.
23405
23406 -mcrc
23407 -mno-crc
23408 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
23409 instructions.
23410
23411 -mginv
23412 -mno-ginv
23413 Use (do not use) the MIPS Global INValidate (GINV) instructions.
23414
23415 -mloongson-mmi
23416 -mno-loongson-mmi
23417 Use (do not use) the MIPS Loongson MultiMedia extensions
23418 Instructions (MMI).
23419
23420 -mloongson-ext
23421 -mno-loongson-ext
23422 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
23423
23424 -mloongson-ext2
23425 -mno-loongson-ext2
23426 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
23427 instructions.
23428
23429 -mlong64
23430 Force "long" types to be 64 bits wide. See -mlong32 for an
23431 explanation of the default and the way that the pointer size is
23432 determined.
23433
23434 -mlong32
23435 Force "long", "int", and pointer types to be 32 bits wide.
23436
23437 The default size of "int"s, "long"s and pointers depends on the
23438 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
23439 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
23440 "long"s. Pointers are the same size as "long"s, or the same size
23441 as integer registers, whichever is smaller.
23442
23443 -msym32
23444 -mno-sym32
23445 Assume (do not assume) that all symbols have 32-bit values,
23446 regardless of the selected ABI. This option is useful in
23447 combination with -mabi=64 and -mno-abicalls because it allows GCC
23448 to generate shorter and faster references to symbolic addresses.
23449
23450 -G num
23451 Put definitions of externally-visible data in a small data section
23452 if that data is no bigger than num bytes. GCC can then generate
23453 more efficient accesses to the data; see -mgpopt for details.
23454
23455 The default -G option depends on the configuration.
23456
23457 -mlocal-sdata
23458 -mno-local-sdata
23459 Extend (do not extend) the -G behavior to local data too, such as
23460 to static variables in C. -mlocal-sdata is the default for all
23461 configurations.
23462
23463 If the linker complains that an application is using too much small
23464 data, you might want to try rebuilding the less performance-
23465 critical parts with -mno-local-sdata. You might also want to build
23466 large libraries with -mno-local-sdata, so that the libraries leave
23467 more room for the main program.
23468
23469 -mextern-sdata
23470 -mno-extern-sdata
23471 Assume (do not assume) that externally-defined data is in a small
23472 data section if the size of that data is within the -G limit.
23473 -mextern-sdata is the default for all configurations.
23474
23475 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
23476 Mod references a variable Var that is no bigger than num bytes, you
23477 must make sure that Var is placed in a small data section. If Var
23478 is defined by another module, you must either compile that module
23479 with a high-enough -G setting or attach a "section" attribute to
23480 Var's definition. If Var is common, you must link the application
23481 with a high-enough -G setting.
23482
23483 The easiest way of satisfying these restrictions is to compile and
23484 link every module with the same -G option. However, you may wish
23485 to build a library that supports several different small data
23486 limits. You can do this by compiling the library with the highest
23487 supported -G setting and additionally using -mno-extern-sdata to
23488 stop the library from making assumptions about externally-defined
23489 data.
23490
23491 -mgpopt
23492 -mno-gpopt
23493 Use (do not use) GP-relative accesses for symbols that are known to
23494 be in a small data section; see -G, -mlocal-sdata and
23495 -mextern-sdata. -mgpopt is the default for all configurations.
23496
23497 -mno-gpopt is useful for cases where the $gp register might not
23498 hold the value of "_gp". For example, if the code is part of a
23499 library that might be used in a boot monitor, programs that call
23500 boot monitor routines pass an unknown value in $gp. (In such
23501 situations, the boot monitor itself is usually compiled with -G0.)
23502
23503 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
23504
23505 -membedded-data
23506 -mno-embedded-data
23507 Allocate variables to the read-only data section first if possible,
23508 then next in the small data section if possible, otherwise in data.
23509 This gives slightly slower code than the default, but reduces the
23510 amount of RAM required when executing, and thus may be preferred
23511 for some embedded systems.
23512
23513 -muninit-const-in-rodata
23514 -mno-uninit-const-in-rodata
23515 Put uninitialized "const" variables in the read-only data section.
23516 This option is only meaningful in conjunction with -membedded-data.
23517
23518 -mcode-readable=setting
23519 Specify whether GCC may generate code that reads from executable
23520 sections. There are three possible settings:
23521
23522 -mcode-readable=yes
23523 Instructions may freely access executable sections. This is
23524 the default setting.
23525
23526 -mcode-readable=pcrel
23527 MIPS16 PC-relative load instructions can access executable
23528 sections, but other instructions must not do so. This option
23529 is useful on 4KSc and 4KSd processors when the code TLBs have
23530 the Read Inhibit bit set. It is also useful on processors that
23531 can be configured to have a dual instruction/data SRAM
23532 interface and that, like the M4K, automatically redirect PC-
23533 relative loads to the instruction RAM.
23534
23535 -mcode-readable=no
23536 Instructions must not access executable sections. This option
23537 can be useful on targets that are configured to have a dual
23538 instruction/data SRAM interface but that (unlike the M4K) do
23539 not automatically redirect PC-relative loads to the instruction
23540 RAM.
23541
23542 -msplit-addresses
23543 -mno-split-addresses
23544 Enable (disable) use of the %hi() and %lo() assembler relocation
23545 operators. This option has been superseded by -mexplicit-relocs
23546 but is retained for backwards compatibility.
23547
23548 -mexplicit-relocs
23549 -mno-explicit-relocs
23550 Use (do not use) assembler relocation operators when dealing with
23551 symbolic addresses. The alternative, selected by
23552 -mno-explicit-relocs, is to use assembler macros instead.
23553
23554 -mexplicit-relocs is the default if GCC was configured to use an
23555 assembler that supports relocation operators.
23556
23557 -mcheck-zero-division
23558 -mno-check-zero-division
23559 Trap (do not trap) on integer division by zero.
23560
23561 The default is -mcheck-zero-division.
23562
23563 -mdivide-traps
23564 -mdivide-breaks
23565 MIPS systems check for division by zero by generating either a
23566 conditional trap or a break instruction. Using traps results in
23567 smaller code, but is only supported on MIPS II and later. Also,
23568 some versions of the Linux kernel have a bug that prevents trap
23569 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
23570 to allow conditional traps on architectures that support them and
23571 -mdivide-breaks to force the use of breaks.
23572
23573 The default is usually -mdivide-traps, but this can be overridden
23574 at configure time using --with-divide=breaks. Divide-by-zero
23575 checks can be completely disabled using -mno-check-zero-division.
23576
23577 -mload-store-pairs
23578 -mno-load-store-pairs
23579 Enable (disable) an optimization that pairs consecutive load or
23580 store instructions to enable load/store bonding. This option is
23581 enabled by default but only takes effect when the selected
23582 architecture is known to support bonding.
23583
23584 -munaligned-access
23585 -mno-unaligned-access
23586 Enable (disable) direct unaligned access for MIPS Release 6.
23587 MIPSr6 requires load/store unaligned-access support, by hardware or
23588 trap&emulate. So -mno-unaligned-access may be needed by kernel.
23589
23590 -mmemcpy
23591 -mno-memcpy
23592 Force (do not force) the use of "memcpy" for non-trivial block
23593 moves. The default is -mno-memcpy, which allows GCC to inline most
23594 constant-sized copies.
23595
23596 -mlong-calls
23597 -mno-long-calls
23598 Disable (do not disable) use of the "jal" instruction. Calling
23599 functions using "jal" is more efficient but requires the caller and
23600 callee to be in the same 256 megabyte segment.
23601
23602 This option has no effect on abicalls code. The default is
23603 -mno-long-calls.
23604
23605 -mmad
23606 -mno-mad
23607 Enable (disable) use of the "mad", "madu" and "mul" instructions,
23608 as provided by the R4650 ISA.
23609
23610 -mimadd
23611 -mno-imadd
23612 Enable (disable) use of the "madd" and "msub" integer instructions.
23613 The default is -mimadd on architectures that support "madd" and
23614 "msub" except for the 74k architecture where it was found to
23615 generate slower code.
23616
23617 -mfused-madd
23618 -mno-fused-madd
23619 Enable (disable) use of the floating-point multiply-accumulate
23620 instructions, when they are available. The default is
23621 -mfused-madd.
23622
23623 On the R8000 CPU when multiply-accumulate instructions are used,
23624 the intermediate product is calculated to infinite precision and is
23625 not subject to the FCSR Flush to Zero bit. This may be undesirable
23626 in some circumstances. On other processors the result is
23627 numerically identical to the equivalent computation using separate
23628 multiply, add, subtract and negate instructions.
23629
23630 -nocpp
23631 Tell the MIPS assembler to not run its preprocessor over user
23632 assembler files (with a .s suffix) when assembling them.
23633
23634 -mfix-24k
23635 -mno-fix-24k
23636 Work around the 24K E48 (lost data on stores during refill) errata.
23637 The workarounds are implemented by the assembler rather than by
23638 GCC.
23639
23640 -mfix-r4000
23641 -mno-fix-r4000
23642 Work around certain R4000 CPU errata:
23643
23644 - A double-word or a variable shift may give an incorrect result
23645 if executed immediately after starting an integer division.
23646
23647 - A double-word or a variable shift may give an incorrect result
23648 if executed while an integer multiplication is in progress.
23649
23650 - An integer division may give an incorrect result if started in
23651 a delay slot of a taken branch or a jump.
23652
23653 -mfix-r4400
23654 -mno-fix-r4400
23655 Work around certain R4400 CPU errata:
23656
23657 - A double-word or a variable shift may give an incorrect result
23658 if executed immediately after starting an integer division.
23659
23660 -mfix-r10000
23661 -mno-fix-r10000
23662 Work around certain R10000 errata:
23663
23664 - "ll"/"sc" sequences may not behave atomically on revisions
23665 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
23666
23667 This option can only be used if the target architecture supports
23668 branch-likely instructions. -mfix-r10000 is the default when
23669 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
23670
23671 -mfix-r5900
23672 -mno-fix-r5900
23673 Do not attempt to schedule the preceding instruction into the delay
23674 slot of a branch instruction placed at the end of a short loop of
23675 six instructions or fewer and always schedule a "nop" instruction
23676 there instead. The short loop bug under certain conditions causes
23677 loops to execute only once or twice, due to a hardware bug in the
23678 R5900 chip. The workaround is implemented by the assembler rather
23679 than by GCC.
23680
23681 -mfix-rm7000
23682 -mno-fix-rm7000
23683 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
23684 are implemented by the assembler rather than by GCC.
23685
23686 -mfix-vr4120
23687 -mno-fix-vr4120
23688 Work around certain VR4120 errata:
23689
23690 - "dmultu" does not always produce the correct result.
23691
23692 - "div" and "ddiv" do not always produce the correct result if
23693 one of the operands is negative.
23694
23695 The workarounds for the division errata rely on special functions
23696 in libgcc.a. At present, these functions are only provided by the
23697 "mips64vr*-elf" configurations.
23698
23699 Other VR4120 errata require a NOP to be inserted between certain
23700 pairs of instructions. These errata are handled by the assembler,
23701 not by GCC itself.
23702
23703 -mfix-vr4130
23704 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
23705 implemented by the assembler rather than by GCC, although GCC
23706 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
23707 "dmacc" and "dmacchi" instructions are available instead.
23708
23709 -mfix-sb1
23710 -mno-fix-sb1
23711 Work around certain SB-1 CPU core errata. (This flag currently
23712 works around the SB-1 revision 2 "F1" and "F2" floating-point
23713 errata.)
23714
23715 -mr10k-cache-barrier=setting
23716 Specify whether GCC should insert cache barriers to avoid the side
23717 effects of speculation on R10K processors.
23718
23719 In common with many processors, the R10K tries to predict the
23720 outcome of a conditional branch and speculatively executes
23721 instructions from the "taken" branch. It later aborts these
23722 instructions if the predicted outcome is wrong. However, on the
23723 R10K, even aborted instructions can have side effects.
23724
23725 This problem only affects kernel stores and, depending on the
23726 system, kernel loads. As an example, a speculatively-executed
23727 store may load the target memory into cache and mark the cache line
23728 as dirty, even if the store itself is later aborted. If a DMA
23729 operation writes to the same area of memory before the "dirty" line
23730 is flushed, the cached data overwrites the DMA-ed data. See the
23731 R10K processor manual for a full description, including other
23732 potential problems.
23733
23734 One workaround is to insert cache barrier instructions before every
23735 memory access that might be speculatively executed and that might
23736 have side effects even if aborted. -mr10k-cache-barrier=setting
23737 controls GCC's implementation of this workaround. It assumes that
23738 aborted accesses to any byte in the following regions does not have
23739 side effects:
23740
23741 1. the memory occupied by the current function's stack frame;
23742
23743 2. the memory occupied by an incoming stack argument;
23744
23745 3. the memory occupied by an object with a link-time-constant
23746 address.
23747
23748 It is the kernel's responsibility to ensure that speculative
23749 accesses to these regions are indeed safe.
23750
23751 If the input program contains a function declaration such as:
23752
23753 void foo (void);
23754
23755 then the implementation of "foo" must allow "j foo" and "jal foo"
23756 to be executed speculatively. GCC honors this restriction for
23757 functions it compiles itself. It expects non-GCC functions (such
23758 as hand-written assembly code) to do the same.
23759
23760 The option has three forms:
23761
23762 -mr10k-cache-barrier=load-store
23763 Insert a cache barrier before a load or store that might be
23764 speculatively executed and that might have side effects even if
23765 aborted.
23766
23767 -mr10k-cache-barrier=store
23768 Insert a cache barrier before a store that might be
23769 speculatively executed and that might have side effects even if
23770 aborted.
23771
23772 -mr10k-cache-barrier=none
23773 Disable the insertion of cache barriers. This is the default
23774 setting.
23775
23776 -mflush-func=func
23777 -mno-flush-func
23778 Specifies the function to call to flush the I and D caches, or to
23779 not call any such function. If called, the function must take the
23780 same arguments as the common "_flush_func", that is, the address of
23781 the memory range for which the cache is being flushed, the size of
23782 the memory range, and the number 3 (to flush both caches). The
23783 default depends on the target GCC was configured for, but commonly
23784 is either "_flush_func" or "__cpu_flush".
23785
23786 mbranch-cost=num
23787 Set the cost of branches to roughly num "simple" instructions.
23788 This cost is only a heuristic and is not guaranteed to produce
23789 consistent results across releases. A zero cost redundantly
23790 selects the default, which is based on the -mtune setting.
23791
23792 -mbranch-likely
23793 -mno-branch-likely
23794 Enable or disable use of Branch Likely instructions, regardless of
23795 the default for the selected architecture. By default, Branch
23796 Likely instructions may be generated if they are supported by the
23797 selected architecture. An exception is for the MIPS32 and MIPS64
23798 architectures and processors that implement those architectures;
23799 for those, Branch Likely instructions are not be generated by
23800 default because the MIPS32 and MIPS64 architectures specifically
23801 deprecate their use.
23802
23803 -mcompact-branches=never
23804 -mcompact-branches=optimal
23805 -mcompact-branches=always
23806 These options control which form of branches will be generated.
23807 The default is -mcompact-branches=optimal.
23808
23809 The -mcompact-branches=never option ensures that compact branch
23810 instructions will never be generated.
23811
23812 The -mcompact-branches=always option ensures that a compact branch
23813 instruction will be generated if available for MIPS Release 6
23814 onwards. If a compact branch instruction is not available (or
23815 pre-R6), a delay slot form of the branch will be used instead.
23816
23817 If it is used for MIPS16/microMIPS targets, it will be just ignored
23818 now. The behaviour for MIPS16/microMIPS may change in future,
23819 since they do have some compact branch instructions.
23820
23821 The -mcompact-branches=optimal option will cause a delay slot
23822 branch to be used if one is available in the current ISA and the
23823 delay slot is successfully filled. If the delay slot is not
23824 filled, a compact branch will be chosen if one is available.
23825
23826 -mfp-exceptions
23827 -mno-fp-exceptions
23828 Specifies whether FP exceptions are enabled. This affects how FP
23829 instructions are scheduled for some processors. The default is
23830 that FP exceptions are enabled.
23831
23832 For instance, on the SB-1, if FP exceptions are disabled, and we
23833 are emitting 64-bit code, then we can use both FP pipes.
23834 Otherwise, we can only use one FP pipe.
23835
23836 -mvr4130-align
23837 -mno-vr4130-align
23838 The VR4130 pipeline is two-way superscalar, but can only issue two
23839 instructions together if the first one is 8-byte aligned. When
23840 this option is enabled, GCC aligns pairs of instructions that it
23841 thinks should execute in parallel.
23842
23843 This option only has an effect when optimizing for the VR4130. It
23844 normally makes code faster, but at the expense of making it bigger.
23845 It is enabled by default at optimization level -O3.
23846
23847 -msynci
23848 -mno-synci
23849 Enable (disable) generation of "synci" instructions on
23850 architectures that support it. The "synci" instructions (if
23851 enabled) are generated when "__builtin___clear_cache" is compiled.
23852
23853 This option defaults to -mno-synci, but the default can be
23854 overridden by configuring GCC with --with-synci.
23855
23856 When compiling code for single processor systems, it is generally
23857 safe to use "synci". However, on many multi-core (SMP) systems, it
23858 does not invalidate the instruction caches on all cores and may
23859 lead to undefined behavior.
23860
23861 -mrelax-pic-calls
23862 -mno-relax-pic-calls
23863 Try to turn PIC calls that are normally dispatched via register $25
23864 into direct calls. This is only possible if the linker can resolve
23865 the destination at link time and if the destination is within range
23866 for a direct call.
23867
23868 -mrelax-pic-calls is the default if GCC was configured to use an
23869 assembler and a linker that support the ".reloc" assembly directive
23870 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
23871 this optimization can be performed by the assembler and the linker
23872 alone without help from the compiler.
23873
23874 -mmcount-ra-address
23875 -mno-mcount-ra-address
23876 Emit (do not emit) code that allows "_mcount" to modify the calling
23877 function's return address. When enabled, this option extends the
23878 usual "_mcount" interface with a new ra-address parameter, which
23879 has type "intptr_t *" and is passed in register $12. "_mcount" can
23880 then modify the return address by doing both of the following:
23881
23882 * Returning the new address in register $31.
23883
23884 * Storing the new address in "*ra-address", if ra-address is
23885 nonnull.
23886
23887 The default is -mno-mcount-ra-address.
23888
23889 -mframe-header-opt
23890 -mno-frame-header-opt
23891 Enable (disable) frame header optimization in the o32 ABI. When
23892 using the o32 ABI, calling functions will allocate 16 bytes on the
23893 stack for the called function to write out register arguments.
23894 When enabled, this optimization will suppress the allocation of the
23895 frame header if it can be determined that it is unused.
23896
23897 This optimization is off by default at all optimization levels.
23898
23899 -mlxc1-sxc1
23900 -mno-lxc1-sxc1
23901 When applicable, enable (disable) the generation of "lwxc1",
23902 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
23903
23904 -mmadd4
23905 -mno-madd4
23906 When applicable, enable (disable) the generation of 4-operand
23907 "madd.s", "madd.d" and related instructions. Enabled by default.
23908
23909 MMIX Options
23910
23911 These options are defined for the MMIX:
23912
23913 -mlibfuncs
23914 -mno-libfuncs
23915 Specify that intrinsic library functions are being compiled,
23916 passing all values in registers, no matter the size.
23917
23918 -mepsilon
23919 -mno-epsilon
23920 Generate floating-point comparison instructions that compare with
23921 respect to the "rE" epsilon register.
23922
23923 -mabi=mmixware
23924 -mabi=gnu
23925 Generate code that passes function parameters and return values
23926 that (in the called function) are seen as registers $0 and up, as
23927 opposed to the GNU ABI which uses global registers $231 and up.
23928
23929 -mzero-extend
23930 -mno-zero-extend
23931 When reading data from memory in sizes shorter than 64 bits, use
23932 (do not use) zero-extending load instructions by default, rather
23933 than sign-extending ones.
23934
23935 -mknuthdiv
23936 -mno-knuthdiv
23937 Make the result of a division yielding a remainder have the same
23938 sign as the divisor. With the default, -mno-knuthdiv, the sign of
23939 the remainder follows the sign of the dividend. Both methods are
23940 arithmetically valid, the latter being almost exclusively used.
23941
23942 -mtoplevel-symbols
23943 -mno-toplevel-symbols
23944 Prepend (do not prepend) a : to all global symbols, so the assembly
23945 code can be used with the "PREFIX" assembly directive.
23946
23947 -melf
23948 Generate an executable in the ELF format, rather than the default
23949 mmo format used by the mmix simulator.
23950
23951 -mbranch-predict
23952 -mno-branch-predict
23953 Use (do not use) the probable-branch instructions, when static
23954 branch prediction indicates a probable branch.
23955
23956 -mbase-addresses
23957 -mno-base-addresses
23958 Generate (do not generate) code that uses base addresses. Using a
23959 base address automatically generates a request (handled by the
23960 assembler and the linker) for a constant to be set up in a global
23961 register. The register is used for one or more base address
23962 requests within the range 0 to 255 from the value held in the
23963 register. The generally leads to short and fast code, but the
23964 number of different data items that can be addressed is limited.
23965 This means that a program that uses lots of static data may require
23966 -mno-base-addresses.
23967
23968 -msingle-exit
23969 -mno-single-exit
23970 Force (do not force) generated code to have a single exit point in
23971 each function.
23972
23973 MN10300 Options
23974
23975 These -m options are defined for Matsushita MN10300 architectures:
23976
23977 -mmult-bug
23978 Generate code to avoid bugs in the multiply instructions for the
23979 MN10300 processors. This is the default.
23980
23981 -mno-mult-bug
23982 Do not generate code to avoid bugs in the multiply instructions for
23983 the MN10300 processors.
23984
23985 -mam33
23986 Generate code using features specific to the AM33 processor.
23987
23988 -mno-am33
23989 Do not generate code using features specific to the AM33 processor.
23990 This is the default.
23991
23992 -mam33-2
23993 Generate code using features specific to the AM33/2.0 processor.
23994
23995 -mam34
23996 Generate code using features specific to the AM34 processor.
23997
23998 -mtune=cpu-type
23999 Use the timing characteristics of the indicated CPU type when
24000 scheduling instructions. This does not change the targeted
24001 processor type. The CPU type must be one of mn10300, am33, am33-2
24002 or am34.
24003
24004 -mreturn-pointer-on-d0
24005 When generating a function that returns a pointer, return the
24006 pointer in both "a0" and "d0". Otherwise, the pointer is returned
24007 only in "a0", and attempts to call such functions without a
24008 prototype result in errors. Note that this option is on by
24009 default; use -mno-return-pointer-on-d0 to disable it.
24010
24011 -mno-crt0
24012 Do not link in the C run-time initialization object file.
24013
24014 -mrelax
24015 Indicate to the linker that it should perform a relaxation
24016 optimization pass to shorten branches, calls and absolute memory
24017 addresses. This option only has an effect when used on the command
24018 line for the final link step.
24019
24020 This option makes symbolic debugging impossible.
24021
24022 -mliw
24023 Allow the compiler to generate Long Instruction Word instructions
24024 if the target is the AM33 or later. This is the default. This
24025 option defines the preprocessor macro "__LIW__".
24026
24027 -mno-liw
24028 Do not allow the compiler to generate Long Instruction Word
24029 instructions. This option defines the preprocessor macro
24030 "__NO_LIW__".
24031
24032 -msetlb
24033 Allow the compiler to generate the SETLB and Lcc instructions if
24034 the target is the AM33 or later. This is the default. This option
24035 defines the preprocessor macro "__SETLB__".
24036
24037 -mno-setlb
24038 Do not allow the compiler to generate SETLB or Lcc instructions.
24039 This option defines the preprocessor macro "__NO_SETLB__".
24040
24041 Moxie Options
24042
24043 -meb
24044 Generate big-endian code. This is the default for moxie-*-*
24045 configurations.
24046
24047 -mel
24048 Generate little-endian code.
24049
24050 -mmul.x
24051 Generate mul.x and umul.x instructions. This is the default for
24052 moxiebox-*-* configurations.
24053
24054 -mno-crt0
24055 Do not link in the C run-time initialization object file.
24056
24057 MSP430 Options
24058
24059 These options are defined for the MSP430:
24060
24061 -masm-hex
24062 Force assembly output to always use hex constants. Normally such
24063 constants are signed decimals, but this option is available for
24064 testsuite and/or aesthetic purposes.
24065
24066 -mmcu=
24067 Select the MCU to target. This is used to create a C preprocessor
24068 symbol based upon the MCU name, converted to upper case and pre-
24069 and post-fixed with __. This in turn is used by the msp430.h
24070 header file to select an MCU-specific supplementary header file.
24071
24072 The option also sets the ISA to use. If the MCU name is one that
24073 is known to only support the 430 ISA then that is selected,
24074 otherwise the 430X ISA is selected. A generic MCU name of msp430
24075 can also be used to select the 430 ISA. Similarly the generic
24076 msp430x MCU name selects the 430X ISA.
24077
24078 In addition an MCU-specific linker script is added to the linker
24079 command line. The script's name is the name of the MCU with .ld
24080 appended. Thus specifying -mmcu=xxx on the gcc command line
24081 defines the C preprocessor symbol "__XXX__" and cause the linker to
24082 search for a script called xxx.ld.
24083
24084 The ISA and hardware multiply supported for the different MCUs is
24085 hard-coded into GCC. However, an external devices.csv file can be
24086 used to extend device support beyond those that have been hard-
24087 coded.
24088
24089 GCC searches for the devices.csv file using the following methods
24090 in the given precedence order, where the first method takes
24091 precendence over the second which takes precedence over the third.
24092
24093 Include path specified with "-I" and "-L"
24094 devices.csv will be searched for in each of the directories
24095 specified by include paths and linker library search paths.
24096
24097 Path specified by the environment variable MSP430_GCC_INCLUDE_DIR
24098 Define the value of the global environment variable
24099 MSP430_GCC_INCLUDE_DIR to the full path to the directory
24100 containing devices.csv, and GCC will search this directory for
24101 devices.csv. If devices.csv is found, this directory will also
24102 be registered as an include path, and linker library path.
24103 Header files and linker scripts in this directory can therefore
24104 be used without manually specifying "-I" and "-L" on the
24105 command line.
24106
24107 The msp430-elf{,bare}/include/devices directory
24108 Finally, GCC will examine msp430-elf{,bare}/include/devices
24109 from the toolchain root directory. This directory does not
24110 exist in a default installation, but if the user has created it
24111 and copied devices.csv there, then the MCU data will be read.
24112 As above, this directory will also be registered as an include
24113 path, and linker library path.
24114
24115 If none of the above search methods find devices.csv, then the
24116 hard-coded MCU data is used.
24117
24118 -mwarn-mcu
24119 -mno-warn-mcu
24120 This option enables or disables warnings about conflicts between
24121 the MCU name specified by the -mmcu option and the ISA set by the
24122 -mcpu option and/or the hardware multiply support set by the
24123 -mhwmult option. It also toggles warnings about unrecognized MCU
24124 names. This option is on by default.
24125
24126 -mcpu=
24127 Specifies the ISA to use. Accepted values are msp430, msp430x and
24128 msp430xv2. This option is deprecated. The -mmcu= option should be
24129 used to select the ISA.
24130
24131 -msim
24132 Link to the simulator runtime libraries and linker script.
24133 Overrides any scripts that would be selected by the -mmcu= option.
24134
24135 -mlarge
24136 Use large-model addressing (20-bit pointers, 20-bit "size_t").
24137
24138 -msmall
24139 Use small-model addressing (16-bit pointers, 16-bit "size_t").
24140
24141 -mrelax
24142 This option is passed to the assembler and linker, and allows the
24143 linker to perform certain optimizations that cannot be done until
24144 the final link.
24145
24146 mhwmult=
24147 Describes the type of hardware multiply supported by the target.
24148 Accepted values are none for no hardware multiply, 16bit for the
24149 original 16-bit-only multiply supported by early MCUs. 32bit for
24150 the 16/32-bit multiply supported by later MCUs and f5series for the
24151 16/32-bit multiply supported by F5-series MCUs. A value of auto
24152 can also be given. This tells GCC to deduce the hardware multiply
24153 support based upon the MCU name provided by the -mmcu option. If
24154 no -mmcu option is specified or if the MCU name is not recognized
24155 then no hardware multiply support is assumed. "auto" is the
24156 default setting.
24157
24158 Hardware multiplies are normally performed by calling a library
24159 routine. This saves space in the generated code. When compiling
24160 at -O3 or higher however the hardware multiplier is invoked inline.
24161 This makes for bigger, but faster code.
24162
24163 The hardware multiply routines disable interrupts whilst running
24164 and restore the previous interrupt state when they finish. This
24165 makes them safe to use inside interrupt handlers as well as in
24166 normal code.
24167
24168 -minrt
24169 Enable the use of a minimum runtime environment - no static
24170 initializers or constructors. This is intended for memory-
24171 constrained devices. The compiler includes special symbols in some
24172 objects that tell the linker and runtime which code fragments are
24173 required.
24174
24175 -mtiny-printf
24176 Enable reduced code size "printf" and "puts" library functions.
24177 The tiny implementations of these functions are not reentrant, so
24178 must be used with caution in multi-threaded applications.
24179
24180 Support for streams has been removed and the string to be printed
24181 will always be sent to stdout via the "write" syscall. The string
24182 is not buffered before it is sent to write.
24183
24184 This option requires Newlib Nano IO, so GCC must be configured with
24185 --enable-newlib-nano-formatted-io.
24186
24187 -mmax-inline-shift=
24188 This option takes an integer between 0 and 64 inclusive, and sets
24189 the maximum number of inline shift instructions which should be
24190 emitted to perform a shift operation by a constant amount. When
24191 this value needs to be exceeded, an mspabi helper function is used
24192 instead. The default value is 4.
24193
24194 This only affects cases where a shift by multiple positions cannot
24195 be completed with a single instruction (e.g. all shifts >1 on the
24196 430 ISA).
24197
24198 Shifts of a 32-bit value are at least twice as costly, so the value
24199 passed for this option is divided by 2 and the resulting value used
24200 instead.
24201
24202 -mcode-region=
24203 -mdata-region=
24204 These options tell the compiler where to place functions and data
24205 that do not have one of the "lower", "upper", "either" or "section"
24206 attributes. Possible values are "lower", "upper", "either" or
24207 "any". The first three behave like the corresponding attribute.
24208 The fourth possible value - "any" - is the default. It leaves
24209 placement entirely up to the linker script and how it assigns the
24210 standard sections (".text", ".data", etc) to the memory regions.
24211
24212 -msilicon-errata=
24213 This option passes on a request to assembler to enable the fixes
24214 for the named silicon errata.
24215
24216 -msilicon-errata-warn=
24217 This option passes on a request to the assembler to enable warning
24218 messages when a silicon errata might need to be applied.
24219
24220 -mwarn-devices-csv
24221 -mno-warn-devices-csv
24222 Warn if devices.csv is not found or there are problem parsing it
24223 (default: on).
24224
24225 NDS32 Options
24226
24227 These options are defined for NDS32 implementations:
24228
24229 -mbig-endian
24230 Generate code in big-endian mode.
24231
24232 -mlittle-endian
24233 Generate code in little-endian mode.
24234
24235 -mreduced-regs
24236 Use reduced-set registers for register allocation.
24237
24238 -mfull-regs
24239 Use full-set registers for register allocation.
24240
24241 -mcmov
24242 Generate conditional move instructions.
24243
24244 -mno-cmov
24245 Do not generate conditional move instructions.
24246
24247 -mext-perf
24248 Generate performance extension instructions.
24249
24250 -mno-ext-perf
24251 Do not generate performance extension instructions.
24252
24253 -mext-perf2
24254 Generate performance extension 2 instructions.
24255
24256 -mno-ext-perf2
24257 Do not generate performance extension 2 instructions.
24258
24259 -mext-string
24260 Generate string extension instructions.
24261
24262 -mno-ext-string
24263 Do not generate string extension instructions.
24264
24265 -mv3push
24266 Generate v3 push25/pop25 instructions.
24267
24268 -mno-v3push
24269 Do not generate v3 push25/pop25 instructions.
24270
24271 -m16-bit
24272 Generate 16-bit instructions.
24273
24274 -mno-16-bit
24275 Do not generate 16-bit instructions.
24276
24277 -misr-vector-size=num
24278 Specify the size of each interrupt vector, which must be 4 or 16.
24279
24280 -mcache-block-size=num
24281 Specify the size of each cache block, which must be a power of 2
24282 between 4 and 512.
24283
24284 -march=arch
24285 Specify the name of the target architecture.
24286
24287 -mcmodel=code-model
24288 Set the code model to one of
24289
24290 small
24291 All the data and read-only data segments must be within 512KB
24292 addressing space. The text segment must be within 16MB
24293 addressing space.
24294
24295 medium
24296 The data segment must be within 512KB while the read-only data
24297 segment can be within 4GB addressing space. The text segment
24298 should be still within 16MB addressing space.
24299
24300 large
24301 All the text and data segments can be within 4GB addressing
24302 space.
24303
24304 -mctor-dtor
24305 Enable constructor/destructor feature.
24306
24307 -mrelax
24308 Guide linker to relax instructions.
24309
24310 Nios II Options
24311
24312 These are the options defined for the Altera Nios II processor.
24313
24314 -G num
24315 Put global and static objects less than or equal to num bytes into
24316 the small data or BSS sections instead of the normal data or BSS
24317 sections. The default value of num is 8.
24318
24319 -mgpopt=option
24320 -mgpopt
24321 -mno-gpopt
24322 Generate (do not generate) GP-relative accesses. The following
24323 option names are recognized:
24324
24325 none
24326 Do not generate GP-relative accesses.
24327
24328 local
24329 Generate GP-relative accesses for small data objects that are
24330 not external, weak, or uninitialized common symbols. Also use
24331 GP-relative addressing for objects that have been explicitly
24332 placed in a small data section via a "section" attribute.
24333
24334 global
24335 As for local, but also generate GP-relative accesses for small
24336 data objects that are external, weak, or common. If you use
24337 this option, you must ensure that all parts of your program
24338 (including libraries) are compiled with the same -G setting.
24339
24340 data
24341 Generate GP-relative accesses for all data objects in the
24342 program. If you use this option, the entire data and BSS
24343 segments of your program must fit in 64K of memory and you must
24344 use an appropriate linker script to allocate them within the
24345 addressable range of the global pointer.
24346
24347 all Generate GP-relative addresses for function pointers as well as
24348 data pointers. If you use this option, the entire text, data,
24349 and BSS segments of your program must fit in 64K of memory and
24350 you must use an appropriate linker script to allocate them
24351 within the addressable range of the global pointer.
24352
24353 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
24354 equivalent to -mgpopt=none.
24355
24356 The default is -mgpopt except when -fpic or -fPIC is specified to
24357 generate position-independent code. Note that the Nios II ABI does
24358 not permit GP-relative accesses from shared libraries.
24359
24360 You may need to specify -mno-gpopt explicitly when building
24361 programs that include large amounts of small data, including large
24362 GOT data sections. In this case, the 16-bit offset for GP-relative
24363 addressing may not be large enough to allow access to the entire
24364 small data section.
24365
24366 -mgprel-sec=regexp
24367 This option specifies additional section names that can be accessed
24368 via GP-relative addressing. It is most useful in conjunction with
24369 "section" attributes on variable declarations and a custom linker
24370 script. The regexp is a POSIX Extended Regular Expression.
24371
24372 This option does not affect the behavior of the -G option, and the
24373 specified sections are in addition to the standard ".sdata" and
24374 ".sbss" small-data sections that are recognized by -mgpopt.
24375
24376 -mr0rel-sec=regexp
24377 This option specifies names of sections that can be accessed via a
24378 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
24379 32-bit address space. It is most useful in conjunction with
24380 "section" attributes on variable declarations and a custom linker
24381 script. The regexp is a POSIX Extended Regular Expression.
24382
24383 In contrast to the use of GP-relative addressing for small data,
24384 zero-based addressing is never generated by default and there are
24385 no conventional section names used in standard linker scripts for
24386 sections in the low or high areas of memory.
24387
24388 -mel
24389 -meb
24390 Generate little-endian (default) or big-endian (experimental) code,
24391 respectively.
24392
24393 -march=arch
24394 This specifies the name of the target Nios II architecture. GCC
24395 uses this name to determine what kind of instructions it can emit
24396 when generating assembly code. Permissible names are: r1, r2.
24397
24398 The preprocessor macro "__nios2_arch__" is available to programs,
24399 with value 1 or 2, indicating the targeted ISA level.
24400
24401 -mbypass-cache
24402 -mno-bypass-cache
24403 Force all load and store instructions to always bypass cache by
24404 using I/O variants of the instructions. The default is not to
24405 bypass the cache.
24406
24407 -mno-cache-volatile
24408 -mcache-volatile
24409 Volatile memory access bypass the cache using the I/O variants of
24410 the load and store instructions. The default is not to bypass the
24411 cache.
24412
24413 -mno-fast-sw-div
24414 -mfast-sw-div
24415 Do not use table-based fast divide for small numbers. The default
24416 is to use the fast divide at -O3 and above.
24417
24418 -mno-hw-mul
24419 -mhw-mul
24420 -mno-hw-mulx
24421 -mhw-mulx
24422 -mno-hw-div
24423 -mhw-div
24424 Enable or disable emitting "mul", "mulx" and "div" family of
24425 instructions by the compiler. The default is to emit "mul" and not
24426 emit "div" and "mulx".
24427
24428 -mbmx
24429 -mno-bmx
24430 -mcdx
24431 -mno-cdx
24432 Enable or disable generation of Nios II R2 BMX (bit manipulation)
24433 and CDX (code density) instructions. Enabling these instructions
24434 also requires -march=r2. Since these instructions are optional
24435 extensions to the R2 architecture, the default is not to emit them.
24436
24437 -mcustom-insn=N
24438 -mno-custom-insn
24439 Each -mcustom-insn=N option enables use of a custom instruction
24440 with encoding N when generating code that uses insn. For example,
24441 -mcustom-fadds=253 generates custom instruction 253 for single-
24442 precision floating-point add operations instead of the default
24443 behavior of using a library call.
24444
24445 The following values of insn are supported. Except as otherwise
24446 noted, floating-point operations are expected to be implemented
24447 with normal IEEE 754 semantics and correspond directly to the C
24448 operators or the equivalent GCC built-in functions.
24449
24450 Single-precision floating point:
24451
24452 fadds, fsubs, fdivs, fmuls
24453 Binary arithmetic operations.
24454
24455 fnegs
24456 Unary negation.
24457
24458 fabss
24459 Unary absolute value.
24460
24461 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
24462 Comparison operations.
24463
24464 fmins, fmaxs
24465 Floating-point minimum and maximum. These instructions are
24466 only generated if -ffinite-math-only is specified.
24467
24468 fsqrts
24469 Unary square root operation.
24470
24471 fcoss, fsins, ftans, fatans, fexps, flogs
24472 Floating-point trigonometric and exponential functions. These
24473 instructions are only generated if -funsafe-math-optimizations
24474 is also specified.
24475
24476 Double-precision floating point:
24477
24478 faddd, fsubd, fdivd, fmuld
24479 Binary arithmetic operations.
24480
24481 fnegd
24482 Unary negation.
24483
24484 fabsd
24485 Unary absolute value.
24486
24487 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
24488 Comparison operations.
24489
24490 fmind, fmaxd
24491 Double-precision minimum and maximum. These instructions are
24492 only generated if -ffinite-math-only is specified.
24493
24494 fsqrtd
24495 Unary square root operation.
24496
24497 fcosd, fsind, ftand, fatand, fexpd, flogd
24498 Double-precision trigonometric and exponential functions.
24499 These instructions are only generated if
24500 -funsafe-math-optimizations is also specified.
24501
24502 Conversions:
24503
24504 fextsd
24505 Conversion from single precision to double precision.
24506
24507 ftruncds
24508 Conversion from double precision to single precision.
24509
24510 fixsi, fixsu, fixdi, fixdu
24511 Conversion from floating point to signed or unsigned integer
24512 types, with truncation towards zero.
24513
24514 round
24515 Conversion from single-precision floating point to signed
24516 integer, rounding to the nearest integer and ties away from
24517 zero. This corresponds to the "__builtin_lroundf" function
24518 when -fno-math-errno is used.
24519
24520 floatis, floatus, floatid, floatud
24521 Conversion from signed or unsigned integer types to floating-
24522 point types.
24523
24524 In addition, all of the following transfer instructions for
24525 internal registers X and Y must be provided to use any of the
24526 double-precision floating-point instructions. Custom instructions
24527 taking two double-precision source operands expect the first
24528 operand in the 64-bit register X. The other operand (or only
24529 operand of a unary operation) is given to the custom arithmetic
24530 instruction with the least significant half in source register src1
24531 and the most significant half in src2. A custom instruction that
24532 returns a double-precision result returns the most significant 32
24533 bits in the destination register and the other half in 32-bit
24534 register Y. GCC automatically generates the necessary code
24535 sequences to write register X and/or read register Y when double-
24536 precision floating-point instructions are used.
24537
24538 fwrx
24539 Write src1 into the least significant half of X and src2 into
24540 the most significant half of X.
24541
24542 fwry
24543 Write src1 into Y.
24544
24545 frdxhi, frdxlo
24546 Read the most or least (respectively) significant half of X and
24547 store it in dest.
24548
24549 frdy
24550 Read the value of Y and store it into dest.
24551
24552 Note that you can gain more local control over generation of Nios
24553 II custom instructions by using the target("custom-insn=N") and
24554 target("no-custom-insn") function attributes or pragmas.
24555
24556 -mcustom-fpu-cfg=name
24557 This option enables a predefined, named set of custom instruction
24558 encodings (see -mcustom-insn above). Currently, the following sets
24559 are defined:
24560
24561 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
24562 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
24563
24564 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
24565 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
24566 -fsingle-precision-constant
24567
24568 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
24569 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
24570 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
24571 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
24572 -mcustom-fdivs=255 -fsingle-precision-constant
24573
24574 -mcustom-fpu-cfg=fph2 is equivalent to: -mcustom-fabss=224
24575 -mcustom-fnegs=225 -mcustom-fcmpnes=226 -mcustom-fcmpeqs=227
24576 -mcustom-fcmpges=228 -mcustom-fcmpgts=229 -mcustom-fcmples=230
24577 -mcustom-fcmplts=231 -mcustom-fmaxs=232 -mcustom-fmins=233
24578 -mcustom-round=248 -mcustom-fixsi=249 -mcustom-floatis=250
24579 -mcustom-fsqrts=251 -mcustom-fmuls=252 -mcustom-fadds=253
24580 -mcustom-fsubs=254 -mcustom-fdivs=255
24581
24582 Custom instruction assignments given by individual -mcustom-insn=
24583 options override those given by -mcustom-fpu-cfg=, regardless of
24584 the order of the options on the command line.
24585
24586 Note that you can gain more local control over selection of a FPU
24587 configuration by using the target("custom-fpu-cfg=name") function
24588 attribute or pragma.
24589
24590 The name fph2 is an abbreviation for Nios II Floating Point
24591 Hardware 2 Component. Please note that the custom instructions
24592 enabled by -mcustom-fmins=233 and -mcustom-fmaxs=234 are only
24593 generated if -ffinite-math-only is specified. The custom
24594 instruction enabled by -mcustom-round=248 is only generated if
24595 -fno-math-errno is specified. In contrast to the other
24596 configurations, -fsingle-precision-constant is not set.
24597
24598 These additional -m options are available for the Altera Nios II ELF
24599 (bare-metal) target:
24600
24601 -mhal
24602 Link with HAL BSP. This suppresses linking with the GCC-provided C
24603 runtime startup and termination code, and is typically used in
24604 conjunction with -msys-crt0= to specify the location of the
24605 alternate startup code provided by the HAL BSP.
24606
24607 -msmallc
24608 Link with a limited version of the C library, -lsmallc, rather than
24609 Newlib.
24610
24611 -msys-crt0=startfile
24612 startfile is the file name of the startfile (crt0) to use when
24613 linking. This option is only useful in conjunction with -mhal.
24614
24615 -msys-lib=systemlib
24616 systemlib is the library name of the library that provides low-
24617 level system calls required by the C library, e.g. "read" and
24618 "write". This option is typically used to link with a library
24619 provided by a HAL BSP.
24620
24621 Nvidia PTX Options
24622
24623 These options are defined for Nvidia PTX:
24624
24625 -m64
24626 Ignored, but preserved for backward compatibility. Only 64-bit ABI
24627 is supported.
24628
24629 -march=architecture-string
24630 Generate code for the specified PTX ISA target architecture (e.g.
24631 sm_35). Valid architecture strings are sm_30, sm_35, sm_53, sm_70,
24632 sm_75 and sm_80. The default depends on how the compiler has been
24633 configured, see --with-arch.
24634
24635 This option sets the value of the preprocessor macro "__PTX_SM__";
24636 for instance, for sm_35, it has the value 350.
24637
24638 -misa=architecture-string
24639 Alias of -march=.
24640
24641 -march-map=architecture-string
24642 Select the closest available -march= value that is not more
24643 capable. For instance, for -march-map=sm_50 select -march=sm_35,
24644 and for -march-map=sm_53 select -march=sm_53.
24645
24646 -mptx=version-string
24647 Generate code for the specified PTX ISA version (e.g. 7.0). Valid
24648 version strings include 3.1, 6.0, 6.3, and 7.0. The default PTX
24649 ISA version is 6.0, unless a higher version is required for
24650 specified PTX ISA target architecture via option -march=.
24651
24652 This option sets the values of the preprocessor macros
24653 "__PTX_ISA_VERSION_MAJOR__" and "__PTX_ISA_VERSION_MINOR__"; for
24654 instance, for 3.1 the macros have the values 3 and 1, respectively.
24655
24656 -mmainkernel
24657 Link in code for a __main kernel. This is for stand-alone instead
24658 of offloading execution.
24659
24660 -moptimize
24661 Apply partitioned execution optimizations. This is the default
24662 when any level of optimization is selected.
24663
24664 -msoft-stack
24665 Generate code that does not use ".local" memory directly for stack
24666 storage. Instead, a per-warp stack pointer is maintained
24667 explicitly. This enables variable-length stack allocation (with
24668 variable-length arrays or "alloca"), and when global memory is used
24669 for underlying storage, makes it possible to access automatic
24670 variables from other threads, or with atomic instructions. This
24671 code generation variant is used for OpenMP offloading, but the
24672 option is exposed on its own for the purpose of testing the
24673 compiler; to generate code suitable for linking into programs using
24674 OpenMP offloading, use option -mgomp.
24675
24676 -muniform-simt
24677 Switch to code generation variant that allows to execute all
24678 threads in each warp, while maintaining memory state and side
24679 effects as if only one thread in each warp was active outside of
24680 OpenMP SIMD regions. All atomic operations and calls to runtime
24681 (malloc, free, vprintf) are conditionally executed (iff current
24682 lane index equals the master lane index), and the register being
24683 assigned is copied via a shuffle instruction from the master lane.
24684 Outside of SIMD regions lane 0 is the master; inside, each thread
24685 sees itself as the master. Shared memory array "int __nvptx_uni[]"
24686 stores all-zeros or all-ones bitmasks for each warp, indicating
24687 current mode (0 outside of SIMD regions). Each thread can bitwise-
24688 and the bitmask at position "tid.y" with current lane index to
24689 compute the master lane index.
24690
24691 -mgomp
24692 Generate code for use in OpenMP offloading: enables -msoft-stack
24693 and -muniform-simt options, and selects corresponding multilib
24694 variant.
24695
24696 OpenRISC Options
24697
24698 These options are defined for OpenRISC:
24699
24700 -mboard=name
24701 Configure a board specific runtime. This will be passed to the
24702 linker for newlib board library linking. The default is "or1ksim".
24703
24704 -mnewlib
24705 This option is ignored; it is for compatibility purposes only.
24706 This used to select linker and preprocessor options for use with
24707 newlib.
24708
24709 -msoft-div
24710 -mhard-div
24711 Select software or hardware divide ("l.div", "l.divu")
24712 instructions. This default is hardware divide.
24713
24714 -msoft-mul
24715 -mhard-mul
24716 Select software or hardware multiply ("l.mul", "l.muli")
24717 instructions. This default is hardware multiply.
24718
24719 -msoft-float
24720 -mhard-float
24721 Select software or hardware for floating point operations. The
24722 default is software.
24723
24724 -mdouble-float
24725 When -mhard-float is selected, enables generation of double-
24726 precision floating point instructions. By default functions from
24727 libgcc are used to perform double-precision floating point
24728 operations.
24729
24730 -munordered-float
24731 When -mhard-float is selected, enables generation of unordered
24732 floating point compare and set flag ("lf.sfun*") instructions. By
24733 default functions from libgcc are used to perform unordered
24734 floating point compare and set flag operations.
24735
24736 -mcmov
24737 Enable generation of conditional move ("l.cmov") instructions. By
24738 default the equivalent will be generated using set and branch.
24739
24740 -mror
24741 Enable generation of rotate right ("l.ror") instructions. By
24742 default functions from libgcc are used to perform rotate right
24743 operations.
24744
24745 -mrori
24746 Enable generation of rotate right with immediate ("l.rori")
24747 instructions. By default functions from libgcc are used to perform
24748 rotate right with immediate operations.
24749
24750 -msext
24751 Enable generation of sign extension ("l.ext*") instructions. By
24752 default memory loads are used to perform sign extension.
24753
24754 -msfimm
24755 Enable generation of compare and set flag with immediate ("l.sf*i")
24756 instructions. By default extra instructions will be generated to
24757 store the immediate to a register first.
24758
24759 -mshftimm
24760 Enable generation of shift with immediate ("l.srai", "l.srli",
24761 "l.slli") instructions. By default extra instructions will be
24762 generated to store the immediate to a register first.
24763
24764 -mcmodel=small
24765 Generate OpenRISC code for the small model: The GOT is limited to
24766 64k. This is the default model.
24767
24768 -mcmodel=large
24769 Generate OpenRISC code for the large model: The GOT may grow up to
24770 4G in size.
24771
24772 PDP-11 Options
24773
24774 These options are defined for the PDP-11:
24775
24776 -mfpu
24777 Use hardware FPP floating point. This is the default. (FIS
24778 floating point on the PDP-11/40 is not supported.) Implies -m45.
24779
24780 -msoft-float
24781 Do not use hardware floating point.
24782
24783 -mac0
24784 Return floating-point results in ac0 (fr0 in Unix assembler
24785 syntax).
24786
24787 -mno-ac0
24788 Return floating-point results in memory. This is the default.
24789
24790 -m40
24791 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
24792
24793 -m45
24794 Generate code for a PDP-11/45. This is the default.
24795
24796 -m10
24797 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
24798
24799 -mint16
24800 -mno-int32
24801 Use 16-bit "int". This is the default.
24802
24803 -mint32
24804 -mno-int16
24805 Use 32-bit "int".
24806
24807 -msplit
24808 Target has split instruction and data space. Implies -m45.
24809
24810 -munix-asm
24811 Use Unix assembler syntax.
24812
24813 -mdec-asm
24814 Use DEC assembler syntax.
24815
24816 -mgnu-asm
24817 Use GNU assembler syntax. This is the default.
24818
24819 -mlra
24820 Use the new LRA register allocator. By default, the old "reload"
24821 allocator is used.
24822
24823 PowerPC Options
24824
24825 These are listed under
24826
24827 PRU Options
24828
24829 These command-line options are defined for PRU target:
24830
24831 -minrt
24832 Link with a minimum runtime environment, with no support for static
24833 initializers and constructors. Using this option can significantly
24834 reduce the size of the final ELF binary. Beware that the compiler
24835 could still generate code with static initializers and
24836 constructors. It is up to the programmer to ensure that the source
24837 program will not use those features.
24838
24839 -mmcu=mcu
24840 Specify the PRU MCU variant to use. Check Newlib for the exact
24841 list of supported MCUs.
24842
24843 -mno-relax
24844 Make GCC pass the --no-relax command-line option to the linker
24845 instead of the --relax option.
24846
24847 -mloop
24848 Allow (or do not allow) GCC to use the LOOP instruction.
24849
24850 -mabi=variant
24851 Specify the ABI variant to output code for. -mabi=ti selects the
24852 unmodified TI ABI while -mabi=gnu selects a GNU variant that copes
24853 more naturally with certain GCC assumptions. These are the
24854 differences:
24855
24856 Function Pointer Size
24857 TI ABI specifies that function (code) pointers are 16-bit,
24858 whereas GNU supports only 32-bit data and code pointers.
24859
24860 Optional Return Value Pointer
24861 Function return values larger than 64 bits are passed by using
24862 a hidden pointer as the first argument of the function. TI
24863 ABI, though, mandates that the pointer can be NULL in case the
24864 caller is not using the returned value. GNU always passes and
24865 expects a valid return value pointer.
24866
24867 The current -mabi=ti implementation simply raises a compile error
24868 when any of the above code constructs is detected. As a
24869 consequence the standard C library cannot be built and it is
24870 omitted when linking with -mabi=ti.
24871
24872 Relaxation is a GNU feature and for safety reasons is disabled when
24873 using -mabi=ti. The TI toolchain does not emit relocations for
24874 QBBx instructions, so the GNU linker cannot adjust them when
24875 shortening adjacent LDI32 pseudo instructions.
24876
24877 RISC-V Options
24878
24879 These command-line options are defined for RISC-V targets:
24880
24881 -mbranch-cost=n
24882 Set the cost of branches to roughly n instructions.
24883
24884 -mplt
24885 -mno-plt
24886 When generating PIC code, do or don't allow the use of PLTs.
24887 Ignored for non-PIC. The default is -mplt.
24888
24889 -mabi=ABI-string
24890 Specify integer and floating-point calling convention. ABI-string
24891 contains two parts: the size of integer types and the registers
24892 used for floating-point types. For example -march=rv64ifd
24893 -mabi=lp64d means that long and pointers are 64-bit (implicitly
24894 defining int to be 32-bit), and that floating-point values up to 64
24895 bits wide are passed in F registers. Contrast this with
24896 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
24897 generate code that uses the F and D extensions but only allows
24898 floating-point values up to 32 bits long to be passed in registers;
24899 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
24900 will be passed in registers.
24901
24902 The default for this argument is system dependent, users who want a
24903 specific calling convention should specify one explicitly. The
24904 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
24905 and lp64d. Some calling conventions are impossible to implement on
24906 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
24907 because the ABI requires 64-bit values be passed in F registers,
24908 but F registers are only 32 bits wide. There is also the ilp32e
24909 ABI that can only be used with the rv32e architecture. This ABI is
24910 not well specified at present, and is subject to change.
24911
24912 -mfdiv
24913 -mno-fdiv
24914 Do or don't use hardware floating-point divide and square root
24915 instructions. This requires the F or D extensions for floating-
24916 point registers. The default is to use them if the specified
24917 architecture has these instructions.
24918
24919 -mdiv
24920 -mno-div
24921 Do or don't use hardware instructions for integer division. This
24922 requires the M extension. The default is to use them if the
24923 specified architecture has these instructions.
24924
24925 -misa-spec=ISA-spec-string
24926 Specify the version of the RISC-V Unprivileged (formerly User-
24927 Level) ISA specification to produce code conforming to. The
24928 possibilities for ISA-spec-string are:
24929
24930 2.2 Produce code conforming to version 2.2.
24931
24932 20190608
24933 Produce code conforming to version 20190608.
24934
24935 20191213
24936 Produce code conforming to version 20191213.
24937
24938 The default is -misa-spec=20191213 unless GCC has been configured
24939 with --with-isa-spec= specifying a different default version.
24940
24941 -march=ISA-string
24942 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
24943 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
24944
24945 When -march= is not specified, use the setting from -mcpu.
24946
24947 If both -march and -mcpu= are not specified, the default for this
24948 argument is system dependent, users who want a specific
24949 architecture extensions should specify one explicitly.
24950
24951 -mcpu=processor-string
24952 Use architecture of and optimize the output for the given
24953 processor, specified by particular CPU name. Permissible values
24954 for this option are: sifive-e20, sifive-e21, sifive-e24,
24955 sifive-e31, sifive-e34, sifive-e76, sifive-s21, sifive-s51,
24956 sifive-s54, sifive-s76, sifive-u54, and sifive-u74.
24957
24958 -mtune=processor-string
24959 Optimize the output for the given processor, specified by
24960 microarchitecture or particular CPU name. Permissible values for
24961 this option are: rocket, sifive-3-series, sifive-5-series,
24962 sifive-7-series, thead-c906, size, and all valid options for
24963 -mcpu=.
24964
24965 When -mtune= is not specified, use the setting from -mcpu, the
24966 default is rocket if both are not specified.
24967
24968 The size choice is not intended for use by end-users. This is used
24969 when -Os is specified. It overrides the instruction cost info
24970 provided by -mtune=, but does not override the pipeline info. This
24971 helps reduce code size while still giving good performance.
24972
24973 -mpreferred-stack-boundary=num
24974 Attempt to keep the stack boundary aligned to a 2 raised to num
24975 byte boundary. If -mpreferred-stack-boundary is not specified, the
24976 default is 4 (16 bytes or 128-bits).
24977
24978 Warning: If you use this switch, then you must build all modules
24979 with the same value, including any libraries. This includes the
24980 system libraries and startup modules.
24981
24982 -msmall-data-limit=n
24983 Put global and static data smaller than n bytes into a special
24984 section (on some targets).
24985
24986 -msave-restore
24987 -mno-save-restore
24988 Do or don't use smaller but slower prologue and epilogue code that
24989 uses library function calls. The default is to use fast inline
24990 prologues and epilogues.
24991
24992 -mshorten-memrefs
24993 -mno-shorten-memrefs
24994 Do or do not attempt to make more use of compressed load/store
24995 instructions by replacing a load/store of 'base register + large
24996 offset' with a new load/store of 'new base + small offset'. If the
24997 new base gets stored in a compressed register, then the new
24998 load/store can be compressed. Currently targets 32-bit integer
24999 load/stores only.
25000
25001 -mstrict-align
25002 -mno-strict-align
25003 Do not or do generate unaligned memory accesses. The default is
25004 set depending on whether the processor we are optimizing for
25005 supports fast unaligned access or not.
25006
25007 -mcmodel=medlow
25008 Generate code for the medium-low code model. The program and its
25009 statically defined symbols must lie within a single 2 GiB address
25010 range and must lie between absolute addresses -2 GiB and +2 GiB.
25011 Programs can be statically or dynamically linked. This is the
25012 default code model.
25013
25014 -mcmodel=medany
25015 Generate code for the medium-any code model. The program and its
25016 statically defined symbols must be within any single 2 GiB address
25017 range. Programs can be statically or dynamically linked.
25018
25019 The code generated by the medium-any code model is position-
25020 independent, but is not guaranteed to function correctly when
25021 linked into position-independent executables or libraries.
25022
25023 -mexplicit-relocs
25024 -mno-exlicit-relocs
25025 Use or do not use assembler relocation operators when dealing with
25026 symbolic addresses. The alternative is to use assembler macros
25027 instead, which may limit optimization.
25028
25029 -mrelax
25030 -mno-relax
25031 Take advantage of linker relaxations to reduce the number of
25032 instructions required to materialize symbol addresses. The default
25033 is to take advantage of linker relaxations.
25034
25035 -mriscv-attribute
25036 -mno-riscv-attribute
25037 Emit (do not emit) RISC-V attribute to record extra information
25038 into ELF objects. This feature requires at least binutils 2.32.
25039
25040 -mcsr-check
25041 -mno-csr-check
25042 Enables or disables the CSR checking.
25043
25044 -malign-data=type
25045 Control how GCC aligns variables and constants of array, structure,
25046 or union types. Supported values for type are xlen which uses x
25047 register width as the alignment value, and natural which uses
25048 natural alignment. xlen is the default.
25049
25050 -mbig-endian
25051 Generate big-endian code. This is the default when GCC is
25052 configured for a riscv64be-*-* or riscv32be-*-* target.
25053
25054 -mlittle-endian
25055 Generate little-endian code. This is the default when GCC is
25056 configured for a riscv64-*-* or riscv32-*-* but not a riscv64be-*-*
25057 or riscv32be-*-* target.
25058
25059 -mstack-protector-guard=guard
25060 -mstack-protector-guard-reg=reg
25061 -mstack-protector-guard-offset=offset
25062 Generate stack protection code using canary at guard. Supported
25063 locations are global for a global canary or tls for per-thread
25064 canary in the TLS block.
25065
25066 With the latter choice the options -mstack-protector-guard-reg=reg
25067 and -mstack-protector-guard-offset=offset furthermore specify which
25068 register to use as base register for reading the canary, and from
25069 what offset from that base register. There is no default register
25070 or offset as this is entirely for use within the Linux kernel.
25071
25072 RL78 Options
25073
25074 -msim
25075 Links in additional target libraries to support operation within a
25076 simulator.
25077
25078 -mmul=none
25079 -mmul=g10
25080 -mmul=g13
25081 -mmul=g14
25082 -mmul=rl78
25083 Specifies the type of hardware multiplication and division support
25084 to be used. The simplest is "none", which uses software for both
25085 multiplication and division. This is the default. The "g13" value
25086 is for the hardware multiply/divide peripheral found on the
25087 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
25088 multiplication and division instructions supported by the RL78/G14
25089 (S3 core) parts. The value "rl78" is an alias for "g14" and the
25090 value "mg10" is an alias for "none".
25091
25092 In addition a C preprocessor macro is defined, based upon the
25093 setting of this option. Possible values are: "__RL78_MUL_NONE__",
25094 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
25095
25096 -mcpu=g10
25097 -mcpu=g13
25098 -mcpu=g14
25099 -mcpu=rl78
25100 Specifies the RL78 core to target. The default is the G14 core,
25101 also known as an S3 core or just RL78. The G13 or S2 core does not
25102 have multiply or divide instructions, instead it uses a hardware
25103 peripheral for these operations. The G10 or S1 core does not have
25104 register banks, so it uses a different calling convention.
25105
25106 If this option is set it also selects the type of hardware multiply
25107 support to use, unless this is overridden by an explicit -mmul=none
25108 option on the command line. Thus specifying -mcpu=g13 enables the
25109 use of the G13 hardware multiply peripheral and specifying
25110 -mcpu=g10 disables the use of hardware multiplications altogether.
25111
25112 Note, although the RL78/G14 core is the default target, specifying
25113 -mcpu=g14 or -mcpu=rl78 on the command line does change the
25114 behavior of the toolchain since it also enables G14 hardware
25115 multiply support. If these options are not specified on the
25116 command line then software multiplication routines will be used
25117 even though the code targets the RL78 core. This is for backwards
25118 compatibility with older toolchains which did not have hardware
25119 multiply and divide support.
25120
25121 In addition a C preprocessor macro is defined, based upon the
25122 setting of this option. Possible values are: "__RL78_G10__",
25123 "__RL78_G13__" or "__RL78_G14__".
25124
25125 -mg10
25126 -mg13
25127 -mg14
25128 -mrl78
25129 These are aliases for the corresponding -mcpu= option. They are
25130 provided for backwards compatibility.
25131
25132 -mallregs
25133 Allow the compiler to use all of the available registers. By
25134 default registers "r24..r31" are reserved for use in interrupt
25135 handlers. With this option enabled these registers can be used in
25136 ordinary functions as well.
25137
25138 -m64bit-doubles
25139 -m32bit-doubles
25140 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
25141 (-m32bit-doubles) in size. The default is -m32bit-doubles.
25142
25143 -msave-mduc-in-interrupts
25144 -mno-save-mduc-in-interrupts
25145 Specifies that interrupt handler functions should preserve the MDUC
25146 registers. This is only necessary if normal code might use the
25147 MDUC registers, for example because it performs multiplication and
25148 division operations. The default is to ignore the MDUC registers
25149 as this makes the interrupt handlers faster. The target option
25150 -mg13 needs to be passed for this to work as this feature is only
25151 available on the G13 target (S2 core). The MDUC registers will
25152 only be saved if the interrupt handler performs a multiplication or
25153 division operation or it calls another function.
25154
25155 IBM RS/6000 and PowerPC Options
25156
25157 These -m options are defined for the IBM RS/6000 and PowerPC:
25158
25159 -mpowerpc-gpopt
25160 -mno-powerpc-gpopt
25161 -mpowerpc-gfxopt
25162 -mno-powerpc-gfxopt
25163 -mpowerpc64
25164 -mno-powerpc64
25165 -mmfcrf
25166 -mno-mfcrf
25167 -mpopcntb
25168 -mno-popcntb
25169 -mpopcntd
25170 -mno-popcntd
25171 -mfprnd
25172 -mno-fprnd
25173 -mcmpb
25174 -mno-cmpb
25175 -mhard-dfp
25176 -mno-hard-dfp
25177 You use these options to specify which instructions are available
25178 on the processor you are using. The default value of these options
25179 is determined when configuring GCC. Specifying the -mcpu=cpu_type
25180 overrides the specification of these options. We recommend you use
25181 the -mcpu=cpu_type option rather than the options listed above.
25182
25183 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
25184 architecture instructions in the General Purpose group, including
25185 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
25186 to use the optional PowerPC architecture instructions in the
25187 Graphics group, including floating-point select.
25188
25189 The -mmfcrf option allows GCC to generate the move from condition
25190 register field instruction implemented on the POWER4 processor and
25191 other processors that support the PowerPC V2.01 architecture. The
25192 -mpopcntb option allows GCC to generate the popcount and double-
25193 precision FP reciprocal estimate instruction implemented on the
25194 POWER5 processor and other processors that support the PowerPC
25195 V2.02 architecture. The -mpopcntd option allows GCC to generate
25196 the popcount instruction implemented on the POWER7 processor and
25197 other processors that support the PowerPC V2.06 architecture. The
25198 -mfprnd option allows GCC to generate the FP round to integer
25199 instructions implemented on the POWER5+ processor and other
25200 processors that support the PowerPC V2.03 architecture. The -mcmpb
25201 option allows GCC to generate the compare bytes instruction
25202 implemented on the POWER6 processor and other processors that
25203 support the PowerPC V2.05 architecture. The -mhard-dfp option
25204 allows GCC to generate the decimal floating-point instructions
25205 implemented on some POWER processors.
25206
25207 The -mpowerpc64 option allows GCC to generate the additional 64-bit
25208 instructions that are found in the full PowerPC64 architecture and
25209 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
25210 -mno-powerpc64.
25211
25212 -mcpu=cpu_type
25213 Set architecture type, register usage, and instruction scheduling
25214 parameters for machine type cpu_type. Supported values for
25215 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
25216 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
25217 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
25218 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
25219 power4, power5, power5+, power6, power6x, power7, power8, power9,
25220 power10, powerpc, powerpc64, powerpc64le, rs64, and native.
25221
25222 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
25223 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
25224 64-bit little endian PowerPC architecture machine types, with an
25225 appropriate, generic processor model assumed for scheduling
25226 purposes.
25227
25228 Specifying native as cpu type detects and selects the architecture
25229 option that corresponds to the host processor of the system
25230 performing the compilation. -mcpu=native has no effect if GCC does
25231 not recognize the processor.
25232
25233 The other options specify a specific processor. Code generated
25234 under those options runs best on that processor, and may not run at
25235 all on others.
25236
25237 The -mcpu options automatically enable or disable the following
25238 options:
25239
25240 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
25241 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
25242 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
25243 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
25244 -mfloat128-hardware -mprefixed -mpcrel -mmma -mrop-protect
25245
25246 The particular options set for any particular CPU varies between
25247 compiler versions, depending on what setting seems to produce
25248 optimal code for that CPU; it doesn't necessarily reflect the
25249 actual hardware's capabilities. If you wish to set an individual
25250 option to a particular value, you may specify it after the -mcpu
25251 option, like -mcpu=970 -mno-altivec.
25252
25253 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
25254 disabled by the -mcpu option at present because AIX does not have
25255 full support for these options. You may still enable or disable
25256 them individually if you're sure it'll work in your environment.
25257
25258 -mtune=cpu_type
25259 Set the instruction scheduling parameters for machine type
25260 cpu_type, but do not set the architecture type or register usage,
25261 as -mcpu=cpu_type does. The same values for cpu_type are used for
25262 -mtune as for -mcpu. If both are specified, the code generated
25263 uses the architecture and registers set by -mcpu, but the
25264 scheduling parameters set by -mtune.
25265
25266 -mcmodel=small
25267 Generate PowerPC64 code for the small model: The TOC is limited to
25268 64k.
25269
25270 -mcmodel=medium
25271 Generate PowerPC64 code for the medium model: The TOC and other
25272 static data may be up to a total of 4G in size. This is the
25273 default for 64-bit Linux.
25274
25275 -mcmodel=large
25276 Generate PowerPC64 code for the large model: The TOC may be up to
25277 4G in size. Other data and code is only limited by the 64-bit
25278 address space.
25279
25280 -maltivec
25281 -mno-altivec
25282 Generate code that uses (does not use) AltiVec instructions, and
25283 also enable the use of built-in functions that allow more direct
25284 access to the AltiVec instruction set. You may also need to set
25285 -mabi=altivec to adjust the current ABI with AltiVec ABI
25286 enhancements.
25287
25288 When -maltivec is used, the element order for AltiVec intrinsics
25289 such as "vec_splat", "vec_extract", and "vec_insert" match array
25290 element order corresponding to the endianness of the target. That
25291 is, element zero identifies the leftmost element in a vector
25292 register when targeting a big-endian platform, and identifies the
25293 rightmost element in a vector register when targeting a little-
25294 endian platform.
25295
25296 -mvrsave
25297 -mno-vrsave
25298 Generate VRSAVE instructions when generating AltiVec code.
25299
25300 -msecure-plt
25301 Generate code that allows ld and ld.so to build executables and
25302 shared libraries with non-executable ".plt" and ".got" sections.
25303 This is a PowerPC 32-bit SYSV ABI option.
25304
25305 -mbss-plt
25306 Generate code that uses a BSS ".plt" section that ld.so fills in,
25307 and requires ".plt" and ".got" sections that are both writable and
25308 executable. This is a PowerPC 32-bit SYSV ABI option.
25309
25310 -misel
25311 -mno-isel
25312 This switch enables or disables the generation of ISEL
25313 instructions.
25314
25315 -mvsx
25316 -mno-vsx
25317 Generate code that uses (does not use) vector/scalar (VSX)
25318 instructions, and also enable the use of built-in functions that
25319 allow more direct access to the VSX instruction set.
25320
25321 -mcrypto
25322 -mno-crypto
25323 Enable the use (disable) of the built-in functions that allow
25324 direct access to the cryptographic instructions that were added in
25325 version 2.07 of the PowerPC ISA.
25326
25327 -mhtm
25328 -mno-htm
25329 Enable (disable) the use of the built-in functions that allow
25330 direct access to the Hardware Transactional Memory (HTM)
25331 instructions that were added in version 2.07 of the PowerPC ISA.
25332
25333 -mpower8-fusion
25334 -mno-power8-fusion
25335 Generate code that keeps (does not keeps) some integer operations
25336 adjacent so that the instructions can be fused together on power8
25337 and later processors.
25338
25339 -mpower8-vector
25340 -mno-power8-vector
25341 Generate code that uses (does not use) the vector and scalar
25342 instructions that were added in version 2.07 of the PowerPC ISA.
25343 Also enable the use of built-in functions that allow more direct
25344 access to the vector instructions.
25345
25346 -mquad-memory
25347 -mno-quad-memory
25348 Generate code that uses (does not use) the non-atomic quad word
25349 memory instructions. The -mquad-memory option requires use of
25350 64-bit mode.
25351
25352 -mquad-memory-atomic
25353 -mno-quad-memory-atomic
25354 Generate code that uses (does not use) the atomic quad word memory
25355 instructions. The -mquad-memory-atomic option requires use of
25356 64-bit mode.
25357
25358 -mfloat128
25359 -mno-float128
25360 Enable/disable the __float128 keyword for IEEE 128-bit floating
25361 point and use either software emulation for IEEE 128-bit floating
25362 point or hardware instructions.
25363
25364 The VSX instruction set (-mvsx) must be enabled to use the IEEE
25365 128-bit floating point support. The IEEE 128-bit floating point is
25366 only supported on Linux.
25367
25368 The default for -mfloat128 is enabled on PowerPC Linux systems
25369 using the VSX instruction set, and disabled on other systems.
25370
25371 If you use the ISA 3.0 instruction set (-mpower9-vector or
25372 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
25373 support will also enable the generation of ISA 3.0 IEEE 128-bit
25374 floating point instructions. Otherwise, if you do not specify to
25375 generate ISA 3.0 instructions or you are targeting a 32-bit big
25376 endian system, IEEE 128-bit floating point will be done with
25377 software emulation.
25378
25379 -mfloat128-hardware
25380 -mno-float128-hardware
25381 Enable/disable using ISA 3.0 hardware instructions to support the
25382 __float128 data type.
25383
25384 The default for -mfloat128-hardware is enabled on PowerPC Linux
25385 systems using the ISA 3.0 instruction set, and disabled on other
25386 systems.
25387
25388 -m32
25389 -m64
25390 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
25391 targets (including GNU/Linux). The 32-bit environment sets int,
25392 long and pointer to 32 bits and generates code that runs on any
25393 PowerPC variant. The 64-bit environment sets int to 32 bits and
25394 long and pointer to 64 bits, and generates code for PowerPC64, as
25395 for -mpowerpc64.
25396
25397 -mfull-toc
25398 -mno-fp-in-toc
25399 -mno-sum-in-toc
25400 -mminimal-toc
25401 Modify generation of the TOC (Table Of Contents), which is created
25402 for every executable file. The -mfull-toc option is selected by
25403 default. In that case, GCC allocates at least one TOC entry for
25404 each unique non-automatic variable reference in your program. GCC
25405 also places floating-point constants in the TOC. However, only
25406 16,384 entries are available in the TOC.
25407
25408 If you receive a linker error message that saying you have
25409 overflowed the available TOC space, you can reduce the amount of
25410 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
25411 -mno-fp-in-toc prevents GCC from putting floating-point constants
25412 in the TOC and -mno-sum-in-toc forces GCC to generate code to
25413 calculate the sum of an address and a constant at run time instead
25414 of putting that sum into the TOC. You may specify one or both of
25415 these options. Each causes GCC to produce very slightly slower and
25416 larger code at the expense of conserving TOC space.
25417
25418 If you still run out of space in the TOC even when you specify both
25419 of these options, specify -mminimal-toc instead. This option
25420 causes GCC to make only one TOC entry for every file. When you
25421 specify this option, GCC produces code that is slower and larger
25422 but which uses extremely little TOC space. You may wish to use
25423 this option only on files that contain less frequently-executed
25424 code.
25425
25426 -maix64
25427 -maix32
25428 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
25429 64-bit "long" type, and the infrastructure needed to support them.
25430 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
25431 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
25432
25433 -mxl-compat
25434 -mno-xl-compat
25435 Produce code that conforms more closely to IBM XL compiler
25436 semantics when using AIX-compatible ABI. Pass floating-point
25437 arguments to prototyped functions beyond the register save area
25438 (RSA) on the stack in addition to argument FPRs. Do not assume
25439 that most significant double in 128-bit long double value is
25440 properly rounded when comparing values and converting to double.
25441 Use XL symbol names for long double support routines.
25442
25443 The AIX calling convention was extended but not initially
25444 documented to handle an obscure K&R C case of calling a function
25445 that takes the address of its arguments with fewer arguments than
25446 declared. IBM XL compilers access floating-point arguments that do
25447 not fit in the RSA from the stack when a subroutine is compiled
25448 without optimization. Because always storing floating-point
25449 arguments on the stack is inefficient and rarely needed, this
25450 option is not enabled by default and only is necessary when calling
25451 subroutines compiled by IBM XL compilers without optimization.
25452
25453 -mpe
25454 Support IBM RS/6000 SP Parallel Environment (PE). Link an
25455 application written to use message passing with special startup
25456 code to enable the application to run. The system must have PE
25457 installed in the standard location (/usr/lpp/ppe.poe/), or the
25458 specs file must be overridden with the -specs= option to specify
25459 the appropriate directory location. The Parallel Environment does
25460 not support threads, so the -mpe option and the -pthread option are
25461 incompatible.
25462
25463 -malign-natural
25464 -malign-power
25465 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
25466 -malign-natural overrides the ABI-defined alignment of larger
25467 types, such as floating-point doubles, on their natural size-based
25468 boundary. The option -malign-power instructs GCC to follow the
25469 ABI-specified alignment rules. GCC defaults to the standard
25470 alignment defined in the ABI.
25471
25472 On 64-bit Darwin, natural alignment is the default, and
25473 -malign-power is not supported.
25474
25475 -msoft-float
25476 -mhard-float
25477 Generate code that does not use (uses) the floating-point register
25478 set. Software floating-point emulation is provided if you use the
25479 -msoft-float option, and pass the option to GCC when linking.
25480
25481 -mmultiple
25482 -mno-multiple
25483 Generate code that uses (does not use) the load multiple word
25484 instructions and the store multiple word instructions. These
25485 instructions are generated by default on POWER systems, and not
25486 generated on PowerPC systems. Do not use -mmultiple on little-
25487 endian PowerPC systems, since those instructions do not work when
25488 the processor is in little-endian mode. The exceptions are PPC740
25489 and PPC750 which permit these instructions in little-endian mode.
25490
25491 -mupdate
25492 -mno-update
25493 Generate code that uses (does not use) the load or store
25494 instructions that update the base register to the address of the
25495 calculated memory location. These instructions are generated by
25496 default. If you use -mno-update, there is a small window between
25497 the time that the stack pointer is updated and the address of the
25498 previous frame is stored, which means code that walks the stack
25499 frame across interrupts or signals may get corrupted data.
25500
25501 -mavoid-indexed-addresses
25502 -mno-avoid-indexed-addresses
25503 Generate code that tries to avoid (not avoid) the use of indexed
25504 load or store instructions. These instructions can incur a
25505 performance penalty on Power6 processors in certain situations,
25506 such as when stepping through large arrays that cross a 16M
25507 boundary. This option is enabled by default when targeting Power6
25508 and disabled otherwise.
25509
25510 -mfused-madd
25511 -mno-fused-madd
25512 Generate code that uses (does not use) the floating-point multiply
25513 and accumulate instructions. These instructions are generated by
25514 default if hardware floating point is used. The machine-dependent
25515 -mfused-madd option is now mapped to the machine-independent
25516 -ffp-contract=fast option, and -mno-fused-madd is mapped to
25517 -ffp-contract=off.
25518
25519 -mmulhw
25520 -mno-mulhw
25521 Generate code that uses (does not use) the half-word multiply and
25522 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
25523 processors. These instructions are generated by default when
25524 targeting those processors.
25525
25526 -mdlmzb
25527 -mno-dlmzb
25528 Generate code that uses (does not use) the string-search dlmzb
25529 instruction on the IBM 405, 440, 464 and 476 processors. This
25530 instruction is generated by default when targeting those
25531 processors.
25532
25533 -mno-bit-align
25534 -mbit-align
25535 On System V.4 and embedded PowerPC systems do not (do) force
25536 structures and unions that contain bit-fields to be aligned to the
25537 base type of the bit-field.
25538
25539 For example, by default a structure containing nothing but 8
25540 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
25541 and has a size of 4 bytes. By using -mno-bit-align, the structure
25542 is aligned to a 1-byte boundary and is 1 byte in size.
25543
25544 -mno-strict-align
25545 -mstrict-align
25546 On System V.4 and embedded PowerPC systems do not (do) assume that
25547 unaligned memory references are handled by the system.
25548
25549 -mrelocatable
25550 -mno-relocatable
25551 Generate code that allows (does not allow) a static executable to
25552 be relocated to a different address at run time. A simple embedded
25553 PowerPC system loader should relocate the entire contents of
25554 ".got2" and 4-byte locations listed in the ".fixup" section, a
25555 table of 32-bit addresses generated by this option. For this to
25556 work, all objects linked together must be compiled with
25557 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
25558 stack to an 8-byte boundary.
25559
25560 -mrelocatable-lib
25561 -mno-relocatable-lib
25562 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
25563 to allow static executables to be relocated at run time, but
25564 -mrelocatable-lib does not use the smaller stack alignment of
25565 -mrelocatable. Objects compiled with -mrelocatable-lib may be
25566 linked with objects compiled with any combination of the
25567 -mrelocatable options.
25568
25569 -mno-toc
25570 -mtoc
25571 On System V.4 and embedded PowerPC systems do not (do) assume that
25572 register 2 contains a pointer to a global area pointing to the
25573 addresses used in the program.
25574
25575 -mlittle
25576 -mlittle-endian
25577 On System V.4 and embedded PowerPC systems compile code for the
25578 processor in little-endian mode. The -mlittle-endian option is the
25579 same as -mlittle.
25580
25581 -mbig
25582 -mbig-endian
25583 On System V.4 and embedded PowerPC systems compile code for the
25584 processor in big-endian mode. The -mbig-endian option is the same
25585 as -mbig.
25586
25587 -mdynamic-no-pic
25588 On Darwin and Mac OS X systems, compile code so that it is not
25589 relocatable, but that its external references are relocatable. The
25590 resulting code is suitable for applications, but not shared
25591 libraries.
25592
25593 -msingle-pic-base
25594 Treat the register used for PIC addressing as read-only, rather
25595 than loading it in the prologue for each function. The runtime
25596 system is responsible for initializing this register with an
25597 appropriate value before execution begins.
25598
25599 -mprioritize-restricted-insns=priority
25600 This option controls the priority that is assigned to dispatch-slot
25601 restricted instructions during the second scheduling pass. The
25602 argument priority takes the value 0, 1, or 2 to assign no, highest,
25603 or second-highest (respectively) priority to dispatch-slot
25604 restricted instructions.
25605
25606 -msched-costly-dep=dependence_type
25607 This option controls which dependences are considered costly by the
25608 target during instruction scheduling. The argument dependence_type
25609 takes one of the following values:
25610
25611 no No dependence is costly.
25612
25613 all All dependences are costly.
25614
25615 true_store_to_load
25616 A true dependence from store to load is costly.
25617
25618 store_to_load
25619 Any dependence from store to load is costly.
25620
25621 number
25622 Any dependence for which the latency is greater than or equal
25623 to number is costly.
25624
25625 -minsert-sched-nops=scheme
25626 This option controls which NOP insertion scheme is used during the
25627 second scheduling pass. The argument scheme takes one of the
25628 following values:
25629
25630 no Don't insert NOPs.
25631
25632 pad Pad with NOPs any dispatch group that has vacant issue slots,
25633 according to the scheduler's grouping.
25634
25635 regroup_exact
25636 Insert NOPs to force costly dependent insns into separate
25637 groups. Insert exactly as many NOPs as needed to force an insn
25638 to a new group, according to the estimated processor grouping.
25639
25640 number
25641 Insert NOPs to force costly dependent insns into separate
25642 groups. Insert number NOPs to force an insn to a new group.
25643
25644 -mcall-sysv
25645 On System V.4 and embedded PowerPC systems compile code using
25646 calling conventions that adhere to the March 1995 draft of the
25647 System V Application Binary Interface, PowerPC processor
25648 supplement. This is the default unless you configured GCC using
25649 powerpc-*-eabiaix.
25650
25651 -mcall-sysv-eabi
25652 -mcall-eabi
25653 Specify both -mcall-sysv and -meabi options.
25654
25655 -mcall-sysv-noeabi
25656 Specify both -mcall-sysv and -mno-eabi options.
25657
25658 -mcall-aixdesc
25659 On System V.4 and embedded PowerPC systems compile code for the AIX
25660 operating system.
25661
25662 -mcall-linux
25663 On System V.4 and embedded PowerPC systems compile code for the
25664 Linux-based GNU system.
25665
25666 -mcall-freebsd
25667 On System V.4 and embedded PowerPC systems compile code for the
25668 FreeBSD operating system.
25669
25670 -mcall-netbsd
25671 On System V.4 and embedded PowerPC systems compile code for the
25672 NetBSD operating system.
25673
25674 -mcall-openbsd
25675 On System V.4 and embedded PowerPC systems compile code for the
25676 OpenBSD operating system.
25677
25678 -mtraceback=traceback_type
25679 Select the type of traceback table. Valid values for traceback_type
25680 are full, part, and no.
25681
25682 -maix-struct-return
25683 Return all structures in memory (as specified by the AIX ABI).
25684
25685 -msvr4-struct-return
25686 Return structures smaller than 8 bytes in registers (as specified
25687 by the SVR4 ABI).
25688
25689 -mabi=abi-type
25690 Extend the current ABI with a particular extension, or remove such
25691 extension. Valid values are: altivec, no-altivec, ibmlongdouble,
25692 ieeelongdouble, elfv1, elfv2, and for AIX: vec-extabi, vec-default.
25693
25694 -mabi=ibmlongdouble
25695 Change the current ABI to use IBM extended-precision long double.
25696 This is not likely to work if your system defaults to using IEEE
25697 extended-precision long double. If you change the long double type
25698 from IEEE extended-precision, the compiler will issue a warning
25699 unless you use the -Wno-psabi option. Requires -mlong-double-128
25700 to be enabled.
25701
25702 -mabi=ieeelongdouble
25703 Change the current ABI to use IEEE extended-precision long double.
25704 This is not likely to work if your system defaults to using IBM
25705 extended-precision long double. If you change the long double type
25706 from IBM extended-precision, the compiler will issue a warning
25707 unless you use the -Wno-psabi option. Requires -mlong-double-128
25708 to be enabled.
25709
25710 -mabi=elfv1
25711 Change the current ABI to use the ELFv1 ABI. This is the default
25712 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
25713 ABI requires special system support and is likely to fail in
25714 spectacular ways.
25715
25716 -mabi=elfv2
25717 Change the current ABI to use the ELFv2 ABI. This is the default
25718 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
25719 ABI requires special system support and is likely to fail in
25720 spectacular ways.
25721
25722 -mgnu-attribute
25723 -mno-gnu-attribute
25724 Emit .gnu_attribute assembly directives to set tag/value pairs in a
25725 .gnu.attributes section that specify ABI variations in function
25726 parameters or return values.
25727
25728 -mprototype
25729 -mno-prototype
25730 On System V.4 and embedded PowerPC systems assume that all calls to
25731 variable argument functions are properly prototyped. Otherwise,
25732 the compiler must insert an instruction before every non-prototyped
25733 call to set or clear bit 6 of the condition code register ("CR") to
25734 indicate whether floating-point values are passed in the floating-
25735 point registers in case the function takes variable arguments.
25736 With -mprototype, only calls to prototyped variable argument
25737 functions set or clear the bit.
25738
25739 -msim
25740 On embedded PowerPC systems, assume that the startup module is
25741 called sim-crt0.o and that the standard C libraries are libsim.a
25742 and libc.a. This is the default for powerpc-*-eabisim
25743 configurations.
25744
25745 -mmvme
25746 On embedded PowerPC systems, assume that the startup module is
25747 called crt0.o and the standard C libraries are libmvme.a and
25748 libc.a.
25749
25750 -mads
25751 On embedded PowerPC systems, assume that the startup module is
25752 called crt0.o and the standard C libraries are libads.a and libc.a.
25753
25754 -myellowknife
25755 On embedded PowerPC systems, assume that the startup module is
25756 called crt0.o and the standard C libraries are libyk.a and libc.a.
25757
25758 -mvxworks
25759 On System V.4 and embedded PowerPC systems, specify that you are
25760 compiling for a VxWorks system.
25761
25762 -memb
25763 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
25764 header to indicate that eabi extended relocations are used.
25765
25766 -meabi
25767 -mno-eabi
25768 On System V.4 and embedded PowerPC systems do (do not) adhere to
25769 the Embedded Applications Binary Interface (EABI), which is a set
25770 of modifications to the System V.4 specifications. Selecting
25771 -meabi means that the stack is aligned to an 8-byte boundary, a
25772 function "__eabi" is called from "main" to set up the EABI
25773 environment, and the -msdata option can use both "r2" and "r13" to
25774 point to two separate small data areas. Selecting -mno-eabi means
25775 that the stack is aligned to a 16-byte boundary, no EABI
25776 initialization function is called from "main", and the -msdata
25777 option only uses "r13" to point to a single small data area. The
25778 -meabi option is on by default if you configured GCC using one of
25779 the powerpc*-*-eabi* options.
25780
25781 -msdata=eabi
25782 On System V.4 and embedded PowerPC systems, put small initialized
25783 "const" global and static data in the ".sdata2" section, which is
25784 pointed to by register "r2". Put small initialized non-"const"
25785 global and static data in the ".sdata" section, which is pointed to
25786 by register "r13". Put small uninitialized global and static data
25787 in the ".sbss" section, which is adjacent to the ".sdata" section.
25788 The -msdata=eabi option is incompatible with the -mrelocatable
25789 option. The -msdata=eabi option also sets the -memb option.
25790
25791 -msdata=sysv
25792 On System V.4 and embedded PowerPC systems, put small global and
25793 static data in the ".sdata" section, which is pointed to by
25794 register "r13". Put small uninitialized global and static data in
25795 the ".sbss" section, which is adjacent to the ".sdata" section.
25796 The -msdata=sysv option is incompatible with the -mrelocatable
25797 option.
25798
25799 -msdata=default
25800 -msdata
25801 On System V.4 and embedded PowerPC systems, if -meabi is used,
25802 compile code the same as -msdata=eabi, otherwise compile code the
25803 same as -msdata=sysv.
25804
25805 -msdata=data
25806 On System V.4 and embedded PowerPC systems, put small global data
25807 in the ".sdata" section. Put small uninitialized global data in
25808 the ".sbss" section. Do not use register "r13" to address small
25809 data however. This is the default behavior unless other -msdata
25810 options are used.
25811
25812 -msdata=none
25813 -mno-sdata
25814 On embedded PowerPC systems, put all initialized global and static
25815 data in the ".data" section, and all uninitialized data in the
25816 ".bss" section.
25817
25818 -mreadonly-in-sdata
25819 Put read-only objects in the ".sdata" section as well. This is the
25820 default.
25821
25822 -mblock-move-inline-limit=num
25823 Inline all block moves (such as calls to "memcpy" or structure
25824 copies) less than or equal to num bytes. The minimum value for num
25825 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
25826 default value is target-specific.
25827
25828 -mblock-compare-inline-limit=num
25829 Generate non-looping inline code for all block compares (such as
25830 calls to "memcmp" or structure compares) less than or equal to num
25831 bytes. If num is 0, all inline expansion (non-loop and loop) of
25832 block compare is disabled. The default value is target-specific.
25833
25834 -mblock-compare-inline-loop-limit=num
25835 Generate an inline expansion using loop code for all block compares
25836 that are less than or equal to num bytes, but greater than the
25837 limit for non-loop inline block compare expansion. If the block
25838 length is not constant, at most num bytes will be compared before
25839 "memcmp" is called to compare the remainder of the block. The
25840 default value is target-specific.
25841
25842 -mstring-compare-inline-limit=num
25843 Compare at most num string bytes with inline code. If the
25844 difference or end of string is not found at the end of the inline
25845 compare a call to "strcmp" or "strncmp" will take care of the rest
25846 of the comparison. The default is 64 bytes.
25847
25848 -G num
25849 On embedded PowerPC systems, put global and static items less than
25850 or equal to num bytes into the small data or BSS sections instead
25851 of the normal data or BSS section. By default, num is 8. The -G
25852 num switch is also passed to the linker. All modules should be
25853 compiled with the same -G num value.
25854
25855 -mregnames
25856 -mno-regnames
25857 On System V.4 and embedded PowerPC systems do (do not) emit
25858 register names in the assembly language output using symbolic
25859 forms.
25860
25861 -mlongcall
25862 -mno-longcall
25863 By default assume that all calls are far away so that a longer and
25864 more expensive calling sequence is required. This is required for
25865 calls farther than 32 megabytes (33,554,432 bytes) from the current
25866 location. A short call is generated if the compiler knows the call
25867 cannot be that far away. This setting can be overridden by the
25868 "shortcall" function attribute, or by #pragma longcall(0).
25869
25870 Some linkers are capable of detecting out-of-range calls and
25871 generating glue code on the fly. On these systems, long calls are
25872 unnecessary and generate slower code. As of this writing, the AIX
25873 linker can do this, as can the GNU linker for PowerPC/64. It is
25874 planned to add this feature to the GNU linker for 32-bit PowerPC
25875 systems as well.
25876
25877 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25878 linkers, GCC can generate long calls using an inline PLT call
25879 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
25880 ELFv1 (big-endian) do not support inline PLT calls.
25881
25882 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
25883 L42", plus a branch island (glue code). The two target addresses
25884 represent the callee and the branch island. The Darwin/PPC linker
25885 prefers the first address and generates a "bl callee" if the PPC
25886 "bl" instruction reaches the callee directly; otherwise, the linker
25887 generates "bl L42" to call the branch island. The branch island is
25888 appended to the body of the calling function; it computes the full
25889 32-bit address of the callee and jumps to it.
25890
25891 On Mach-O (Darwin) systems, this option directs the compiler emit
25892 to the glue for every direct call, and the Darwin linker decides
25893 whether to use or discard it.
25894
25895 In the future, GCC may ignore all longcall specifications when the
25896 linker is known to generate glue.
25897
25898 -mpltseq
25899 -mno-pltseq
25900 Implement (do not implement) -fno-plt and long calls using an
25901 inline PLT call sequence that supports lazy linking and long calls
25902 to functions in dlopen'd shared libraries. Inline PLT calls are
25903 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
25904 newer GNU linkers, and are enabled by default if the support is
25905 detected when configuring GCC, and, in the case of 32-bit PowerPC,
25906 if GCC is configured with --enable-secureplt. -mpltseq code and
25907 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
25908 together.
25909
25910 -mtls-markers
25911 -mno-tls-markers
25912 Mark (do not mark) calls to "__tls_get_addr" with a relocation
25913 specifying the function argument. The relocation allows the linker
25914 to reliably associate function call with argument setup
25915 instructions for TLS optimization, which in turn allows GCC to
25916 better schedule the sequence.
25917
25918 -mrecip
25919 -mno-recip
25920 This option enables use of the reciprocal estimate and reciprocal
25921 square root estimate instructions with additional Newton-Raphson
25922 steps to increase precision instead of doing a divide or square
25923 root and divide for floating-point arguments. You should use the
25924 -ffast-math option when using -mrecip (or at least
25925 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
25926 and -fno-trapping-math). Note that while the throughput of the
25927 sequence is generally higher than the throughput of the non-
25928 reciprocal instruction, the precision of the sequence can be
25929 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
25930 0.99999994) for reciprocal square roots.
25931
25932 -mrecip=opt
25933 This option controls which reciprocal estimate instructions may be
25934 used. opt is a comma-separated list of options, which may be
25935 preceded by a "!" to invert the option:
25936
25937 all Enable all estimate instructions.
25938
25939 default
25940 Enable the default instructions, equivalent to -mrecip.
25941
25942 none
25943 Disable all estimate instructions, equivalent to -mno-recip.
25944
25945 div Enable the reciprocal approximation instructions for both
25946 single and double precision.
25947
25948 divf
25949 Enable the single-precision reciprocal approximation
25950 instructions.
25951
25952 divd
25953 Enable the double-precision reciprocal approximation
25954 instructions.
25955
25956 rsqrt
25957 Enable the reciprocal square root approximation instructions
25958 for both single and double precision.
25959
25960 rsqrtf
25961 Enable the single-precision reciprocal square root
25962 approximation instructions.
25963
25964 rsqrtd
25965 Enable the double-precision reciprocal square root
25966 approximation instructions.
25967
25968 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
25969 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
25970 "XVRSQRTEDP" instructions which handle the double-precision
25971 reciprocal square root calculations.
25972
25973 -mrecip-precision
25974 -mno-recip-precision
25975 Assume (do not assume) that the reciprocal estimate instructions
25976 provide higher-precision estimates than is mandated by the PowerPC
25977 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
25978 automatically selects -mrecip-precision. The double-precision
25979 square root estimate instructions are not generated by default on
25980 low-precision machines, since they do not provide an estimate that
25981 converges after three steps.
25982
25983 -mveclibabi=type
25984 Specifies the ABI type to use for vectorizing intrinsics using an
25985 external library. The only type supported at present is mass,
25986 which specifies to use IBM's Mathematical Acceleration Subsystem
25987 (MASS) libraries for vectorizing intrinsics using external
25988 libraries. GCC currently emits calls to "acosd2", "acosf4",
25989 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
25990 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
25991 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
25992 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
25993 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
25994 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
25995 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
25996 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
25997 "tanhf4" when generating code for power7. Both -ftree-vectorize
25998 and -funsafe-math-optimizations must also be enabled. The MASS
25999 libraries must be specified at link time.
26000
26001 -mfriz
26002 -mno-friz
26003 Generate (do not generate) the "friz" instruction when the
26004 -funsafe-math-optimizations option is used to optimize rounding of
26005 floating-point values to 64-bit integer and back to floating point.
26006 The "friz" instruction does not return the same value if the
26007 floating-point number is too large to fit in an integer.
26008
26009 -mpointers-to-nested-functions
26010 -mno-pointers-to-nested-functions
26011 Generate (do not generate) code to load up the static chain
26012 register ("r11") when calling through a pointer on AIX and 64-bit
26013 Linux systems where a function pointer points to a 3-word
26014 descriptor giving the function address, TOC value to be loaded in
26015 register "r2", and static chain value to be loaded in register
26016 "r11". The -mpointers-to-nested-functions is on by default. You
26017 cannot call through pointers to nested functions or pointers to
26018 functions compiled in other languages that use the static chain if
26019 you use -mno-pointers-to-nested-functions.
26020
26021 -msave-toc-indirect
26022 -mno-save-toc-indirect
26023 Generate (do not generate) code to save the TOC value in the
26024 reserved stack location in the function prologue if the function
26025 calls through a pointer on AIX and 64-bit Linux systems. If the
26026 TOC value is not saved in the prologue, it is saved just before the
26027 call through the pointer. The -mno-save-toc-indirect option is the
26028 default.
26029
26030 -mcompat-align-parm
26031 -mno-compat-align-parm
26032 Generate (do not generate) code to pass structure parameters with a
26033 maximum alignment of 64 bits, for compatibility with older versions
26034 of GCC.
26035
26036 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
26037 structure parameter on a 128-bit boundary when that structure
26038 contained a member requiring 128-bit alignment. This is corrected
26039 in more recent versions of GCC. This option may be used to
26040 generate code that is compatible with functions compiled with older
26041 versions of GCC.
26042
26043 The -mno-compat-align-parm option is the default.
26044
26045 -mstack-protector-guard=guard
26046 -mstack-protector-guard-reg=reg
26047 -mstack-protector-guard-offset=offset
26048 -mstack-protector-guard-symbol=symbol
26049 Generate stack protection code using canary at guard. Supported
26050 locations are global for global canary or tls for per-thread canary
26051 in the TLS block (the default with GNU libc version 2.4 or later).
26052
26053 With the latter choice the options -mstack-protector-guard-reg=reg
26054 and -mstack-protector-guard-offset=offset furthermore specify which
26055 register to use as base register for reading the canary, and from
26056 what offset from that base register. The default for those is as
26057 specified in the relevant ABI.
26058 -mstack-protector-guard-symbol=symbol overrides the offset with a
26059 symbol reference to a canary in the TLS block.
26060
26061 -mpcrel
26062 -mno-pcrel
26063 Generate (do not generate) pc-relative addressing. The -mpcrel
26064 option requires that the medium code model (-mcmodel=medium) and
26065 prefixed addressing (-mprefixed) options are enabled.
26066
26067 -mprefixed
26068 -mno-prefixed
26069 Generate (do not generate) addressing modes using prefixed load and
26070 store instructions. The -mprefixed option requires that the option
26071 -mcpu=power10 (or later) is enabled.
26072
26073 -mmma
26074 -mno-mma
26075 Generate (do not generate) the MMA instructions. The -mma option
26076 requires that the option -mcpu=power10 (or later) is enabled.
26077
26078 -mrop-protect
26079 -mno-rop-protect
26080 Generate (do not generate) ROP protection instructions when the
26081 target processor supports them. Currently this option disables the
26082 shrink-wrap optimization (-fshrink-wrap).
26083
26084 -mprivileged
26085 -mno-privileged
26086 Generate (do not generate) code that will run in privileged state.
26087
26088 -mblock-ops-unaligned-vsx
26089 -mno-block-ops-unaligned-vsx
26090 Generate (do not generate) unaligned vsx loads and stores for
26091 inline expansion of "memcpy" and "memmove".
26092
26093 --param rs6000-vect-unroll-limit=
26094 The vectorizer will check with target information to determine
26095 whether it would be beneficial to unroll the main vectorized loop
26096 and by how much. This parameter sets the upper bound of how much
26097 the vectorizer will unroll the main loop. The default value is
26098 four.
26099
26100 RX Options
26101
26102 These command-line options are defined for RX targets:
26103
26104 -m64bit-doubles
26105 -m32bit-doubles
26106 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
26107 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
26108 RX floating-point hardware only works on 32-bit values, which is
26109 why the default is -m32bit-doubles.
26110
26111 -fpu
26112 -nofpu
26113 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
26114 hardware. The default is enabled for the RX600 series and disabled
26115 for the RX200 series.
26116
26117 Floating-point instructions are only generated for 32-bit floating-
26118 point values, however, so the FPU hardware is not used for doubles
26119 if the -m64bit-doubles option is used.
26120
26121 Note If the -fpu option is enabled then -funsafe-math-optimizations
26122 is also enabled automatically. This is because the RX FPU
26123 instructions are themselves unsafe.
26124
26125 -mcpu=name
26126 Selects the type of RX CPU to be targeted. Currently three types
26127 are supported, the generic RX600 and RX200 series hardware and the
26128 specific RX610 CPU. The default is RX600.
26129
26130 The only difference between RX600 and RX610 is that the RX610 does
26131 not support the "MVTIPL" instruction.
26132
26133 The RX200 series does not have a hardware floating-point unit and
26134 so -nofpu is enabled by default when this type is selected.
26135
26136 -mbig-endian-data
26137 -mlittle-endian-data
26138 Store data (but not code) in the big-endian format. The default is
26139 -mlittle-endian-data, i.e. to store data in the little-endian
26140 format.
26141
26142 -msmall-data-limit=N
26143 Specifies the maximum size in bytes of global and static variables
26144 which can be placed into the small data area. Using the small data
26145 area can lead to smaller and faster code, but the size of area is
26146 limited and it is up to the programmer to ensure that the area does
26147 not overflow. Also when the small data area is used one of the
26148 RX's registers (usually "r13") is reserved for use pointing to this
26149 area, so it is no longer available for use by the compiler. This
26150 could result in slower and/or larger code if variables are pushed
26151 onto the stack instead of being held in this register.
26152
26153 Note, common variables (variables that have not been initialized)
26154 and constants are not placed into the small data area as they are
26155 assigned to other sections in the output executable.
26156
26157 The default value is zero, which disables this feature. Note, this
26158 feature is not enabled by default with higher optimization levels
26159 (-O2 etc) because of the potentially detrimental effects of
26160 reserving a register. It is up to the programmer to experiment and
26161 discover whether this feature is of benefit to their program. See
26162 the description of the -mpid option for a description of how the
26163 actual register to hold the small data area pointer is chosen.
26164
26165 -msim
26166 -mno-sim
26167 Use the simulator runtime. The default is to use the libgloss
26168 board-specific runtime.
26169
26170 -mas100-syntax
26171 -mno-as100-syntax
26172 When generating assembler output use a syntax that is compatible
26173 with Renesas's AS100 assembler. This syntax can also be handled by
26174 the GAS assembler, but it has some restrictions so it is not
26175 generated by default.
26176
26177 -mmax-constant-size=N
26178 Specifies the maximum size, in bytes, of a constant that can be
26179 used as an operand in a RX instruction. Although the RX
26180 instruction set does allow constants of up to 4 bytes in length to
26181 be used in instructions, a longer value equates to a longer
26182 instruction. Thus in some circumstances it can be beneficial to
26183 restrict the size of constants that are used in instructions.
26184 Constants that are too big are instead placed into a constant pool
26185 and referenced via register indirection.
26186
26187 The value N can be between 0 and 4. A value of 0 (the default) or
26188 4 means that constants of any size are allowed.
26189
26190 -mrelax
26191 Enable linker relaxation. Linker relaxation is a process whereby
26192 the linker attempts to reduce the size of a program by finding
26193 shorter versions of various instructions. Disabled by default.
26194
26195 -mint-register=N
26196 Specify the number of registers to reserve for fast interrupt
26197 handler functions. The value N can be between 0 and 4. A value of
26198 1 means that register "r13" is reserved for the exclusive use of
26199 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
26200 value of 3 reserves "r13", "r12" and "r11", and a value of 4
26201 reserves "r13" through "r10". A value of 0, the default, does not
26202 reserve any registers.
26203
26204 -msave-acc-in-interrupts
26205 Specifies that interrupt handler functions should preserve the
26206 accumulator register. This is only necessary if normal code might
26207 use the accumulator register, for example because it performs
26208 64-bit multiplications. The default is to ignore the accumulator
26209 as this makes the interrupt handlers faster.
26210
26211 -mpid
26212 -mno-pid
26213 Enables the generation of position independent data. When enabled
26214 any access to constant data is done via an offset from a base
26215 address held in a register. This allows the location of constant
26216 data to be determined at run time without requiring the executable
26217 to be relocated, which is a benefit to embedded applications with
26218 tight memory constraints. Data that can be modified is not
26219 affected by this option.
26220
26221 Note, using this feature reserves a register, usually "r13", for
26222 the constant data base address. This can result in slower and/or
26223 larger code, especially in complicated functions.
26224
26225 The actual register chosen to hold the constant data base address
26226 depends upon whether the -msmall-data-limit and/or the
26227 -mint-register command-line options are enabled. Starting with
26228 register "r13" and proceeding downwards, registers are allocated
26229 first to satisfy the requirements of -mint-register, then -mpid and
26230 finally -msmall-data-limit. Thus it is possible for the small data
26231 area register to be "r8" if both -mint-register=4 and -mpid are
26232 specified on the command line.
26233
26234 By default this feature is not enabled. The default can be
26235 restored via the -mno-pid command-line option.
26236
26237 -mno-warn-multiple-fast-interrupts
26238 -mwarn-multiple-fast-interrupts
26239 Prevents GCC from issuing a warning message if it finds more than
26240 one fast interrupt handler when it is compiling a file. The
26241 default is to issue a warning for each extra fast interrupt handler
26242 found, as the RX only supports one such interrupt.
26243
26244 -mallow-string-insns
26245 -mno-allow-string-insns
26246 Enables or disables the use of the string manipulation instructions
26247 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
26248 "RMPA" instruction. These instructions may prefetch data, which is
26249 not safe to do if accessing an I/O register. (See section 12.2.7
26250 of the RX62N Group User's Manual for more information).
26251
26252 The default is to allow these instructions, but it is not possible
26253 for GCC to reliably detect all circumstances where a string
26254 instruction might be used to access an I/O register, so their use
26255 cannot be disabled automatically. Instead it is reliant upon the
26256 programmer to use the -mno-allow-string-insns option if their
26257 program accesses I/O space.
26258
26259 When the instructions are enabled GCC defines the C preprocessor
26260 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
26261 "__RX_DISALLOW_STRING_INSNS__".
26262
26263 -mjsr
26264 -mno-jsr
26265 Use only (or not only) "JSR" instructions to access functions.
26266 This option can be used when code size exceeds the range of "BSR"
26267 instructions. Note that -mno-jsr does not mean to not use "JSR"
26268 but instead means that any type of branch may be used.
26269
26270 Note: The generic GCC command-line option -ffixed-reg has special
26271 significance to the RX port when used with the "interrupt" function
26272 attribute. This attribute indicates a function intended to process
26273 fast interrupts. GCC ensures that it only uses the registers "r10",
26274 "r11", "r12" and/or "r13" and only provided that the normal use of the
26275 corresponding registers have been restricted via the -ffixed-reg or
26276 -mint-register command-line options.
26277
26278 S/390 and zSeries Options
26279
26280 These are the -m options defined for the S/390 and zSeries
26281 architecture.
26282
26283 -mhard-float
26284 -msoft-float
26285 Use (do not use) the hardware floating-point instructions and
26286 registers for floating-point operations. When -msoft-float is
26287 specified, functions in libgcc.a are used to perform floating-point
26288 operations. When -mhard-float is specified, the compiler generates
26289 IEEE floating-point instructions. This is the default.
26290
26291 -mhard-dfp
26292 -mno-hard-dfp
26293 Use (do not use) the hardware decimal-floating-point instructions
26294 for decimal-floating-point operations. When -mno-hard-dfp is
26295 specified, functions in libgcc.a are used to perform decimal-
26296 floating-point operations. When -mhard-dfp is specified, the
26297 compiler generates decimal-floating-point hardware instructions.
26298 This is the default for -march=z9-ec or higher.
26299
26300 -mlong-double-64
26301 -mlong-double-128
26302 These switches control the size of "long double" type. A size of 64
26303 bits makes the "long double" type equivalent to the "double" type.
26304 This is the default.
26305
26306 -mbackchain
26307 -mno-backchain
26308 Store (do not store) the address of the caller's frame as backchain
26309 pointer into the callee's stack frame. A backchain may be needed
26310 to allow debugging using tools that do not understand DWARF call
26311 frame information. When -mno-packed-stack is in effect, the
26312 backchain pointer is stored at the bottom of the stack frame; when
26313 -mpacked-stack is in effect, the backchain is placed into the
26314 topmost word of the 96/160 byte register save area.
26315
26316 In general, code compiled with -mbackchain is call-compatible with
26317 code compiled with -mno-backchain; however, use of the backchain
26318 for debugging purposes usually requires that the whole binary is
26319 built with -mbackchain. Note that the combination of -mbackchain,
26320 -mpacked-stack and -mhard-float is not supported. In order to
26321 build a linux kernel use -msoft-float.
26322
26323 The default is to not maintain the backchain.
26324
26325 -mpacked-stack
26326 -mno-packed-stack
26327 Use (do not use) the packed stack layout. When -mno-packed-stack
26328 is specified, the compiler uses the all fields of the 96/160 byte
26329 register save area only for their default purpose; unused fields
26330 still take up stack space. When -mpacked-stack is specified,
26331 register save slots are densely packed at the top of the register
26332 save area; unused space is reused for other purposes, allowing for
26333 more efficient use of the available stack space. However, when
26334 -mbackchain is also in effect, the topmost word of the save area is
26335 always used to store the backchain, and the return address register
26336 is always saved two words below the backchain.
26337
26338 As long as the stack frame backchain is not used, code generated
26339 with -mpacked-stack is call-compatible with code generated with
26340 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
26341 S/390 or zSeries generated code that uses the stack frame backchain
26342 at run time, not just for debugging purposes. Such code is not
26343 call-compatible with code compiled with -mpacked-stack. Also, note
26344 that the combination of -mbackchain, -mpacked-stack and
26345 -mhard-float is not supported. In order to build a linux kernel
26346 use -msoft-float.
26347
26348 The default is to not use the packed stack layout.
26349
26350 -msmall-exec
26351 -mno-small-exec
26352 Generate (or do not generate) code using the "bras" instruction to
26353 do subroutine calls. This only works reliably if the total
26354 executable size does not exceed 64k. The default is to use the
26355 "basr" instruction instead, which does not have this limitation.
26356
26357 -m64
26358 -m31
26359 When -m31 is specified, generate code compliant to the GNU/Linux
26360 for S/390 ABI. When -m64 is specified, generate code compliant to
26361 the GNU/Linux for zSeries ABI. This allows GCC in particular to
26362 generate 64-bit instructions. For the s390 targets, the default is
26363 -m31, while the s390x targets default to -m64.
26364
26365 -mzarch
26366 -mesa
26367 When -mzarch is specified, generate code using the instructions
26368 available on z/Architecture. When -mesa is specified, generate
26369 code using the instructions available on ESA/390. Note that -mesa
26370 is not possible with -m64. When generating code compliant to the
26371 GNU/Linux for S/390 ABI, the default is -mesa. When generating
26372 code compliant to the GNU/Linux for zSeries ABI, the default is
26373 -mzarch.
26374
26375 -mhtm
26376 -mno-htm
26377 The -mhtm option enables a set of builtins making use of
26378 instructions available with the transactional execution facility
26379 introduced with the IBM zEnterprise EC12 machine generation S/390
26380 System z Built-in Functions. -mhtm is enabled by default when
26381 using -march=zEC12.
26382
26383 -mvx
26384 -mno-vx
26385 When -mvx is specified, generate code using the instructions
26386 available with the vector extension facility introduced with the
26387 IBM z13 machine generation. This option changes the ABI for some
26388 vector type values with regard to alignment and calling
26389 conventions. In case vector type values are being used in an ABI-
26390 relevant context a GAS .gnu_attribute command will be added to mark
26391 the resulting binary with the ABI used. -mvx is enabled by default
26392 when using -march=z13.
26393
26394 -mzvector
26395 -mno-zvector
26396 The -mzvector option enables vector language extensions and
26397 builtins using instructions available with the vector extension
26398 facility introduced with the IBM z13 machine generation. This
26399 option adds support for vector to be used as a keyword to define
26400 vector type variables and arguments. vector is only available when
26401 GNU extensions are enabled. It will not be expanded when
26402 requesting strict standard compliance e.g. with -std=c99. In
26403 addition to the GCC low-level builtins -mzvector enables a set of
26404 builtins added for compatibility with AltiVec-style implementations
26405 like Power and Cell. In order to make use of these builtins the
26406 header file vecintrin.h needs to be included. -mzvector is
26407 disabled by default.
26408
26409 -mmvcle
26410 -mno-mvcle
26411 Generate (or do not generate) code using the "mvcle" instruction to
26412 perform block moves. When -mno-mvcle is specified, use a "mvc"
26413 loop instead. This is the default unless optimizing for size.
26414
26415 -mdebug
26416 -mno-debug
26417 Print (or do not print) additional debug information when
26418 compiling. The default is to not print debug information.
26419
26420 -march=cpu-type
26421 Generate code that runs on cpu-type, which is the name of a system
26422 representing a certain processor type. Possible values for cpu-
26423 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
26424 z196/arch9, zEC12, z13/arch11, z14/arch12, z15/arch13, z16/arch14,
26425 and native.
26426
26427 The default is -march=z900.
26428
26429 Specifying native as cpu type can be used to select the best
26430 architecture option for the host processor. -march=native has no
26431 effect if GCC does not recognize the processor.
26432
26433 -mtune=cpu-type
26434 Tune to cpu-type everything applicable about the generated code,
26435 except for the ABI and the set of available instructions. The list
26436 of cpu-type values is the same as for -march. The default is the
26437 value used for -march.
26438
26439 -mtpf-trace
26440 -mno-tpf-trace
26441 Generate code that adds (does not add) in TPF OS specific branches
26442 to trace routines in the operating system. This option is off by
26443 default, even when compiling for the TPF OS.
26444
26445 -mtpf-trace-skip
26446 -mno-tpf-trace-skip
26447 Generate code that changes (does not change) the default branch
26448 targets enabled by -mtpf-trace to point to specialized trace
26449 routines providing the ability of selectively skipping function
26450 trace entries for the TPF OS. This option is off by default, even
26451 when compiling for the TPF OS and specifying -mtpf-trace.
26452
26453 -mfused-madd
26454 -mno-fused-madd
26455 Generate code that uses (does not use) the floating-point multiply
26456 and accumulate instructions. These instructions are generated by
26457 default if hardware floating point is used.
26458
26459 -mwarn-framesize=framesize
26460 Emit a warning if the current function exceeds the given frame
26461 size. Because this is a compile-time check it doesn't need to be a
26462 real problem when the program runs. It is intended to identify
26463 functions that most probably cause a stack overflow. It is useful
26464 to be used in an environment with limited stack size e.g. the linux
26465 kernel.
26466
26467 -mwarn-dynamicstack
26468 Emit a warning if the function calls "alloca" or uses dynamically-
26469 sized arrays. This is generally a bad idea with a limited stack
26470 size.
26471
26472 -mstack-guard=stack-guard
26473 -mstack-size=stack-size
26474 If these options are provided the S/390 back end emits additional
26475 instructions in the function prologue that trigger a trap if the
26476 stack size is stack-guard bytes above the stack-size (remember that
26477 the stack on S/390 grows downward). If the stack-guard option is
26478 omitted the smallest power of 2 larger than the frame size of the
26479 compiled function is chosen. These options are intended to be used
26480 to help debugging stack overflow problems. The additionally
26481 emitted code causes only little overhead and hence can also be used
26482 in production-like systems without greater performance degradation.
26483 The given values have to be exact powers of 2 and stack-size has to
26484 be greater than stack-guard without exceeding 64k. In order to be
26485 efficient the extra code makes the assumption that the stack starts
26486 at an address aligned to the value given by stack-size. The stack-
26487 guard option can only be used in conjunction with stack-size.
26488
26489 -mhotpatch=pre-halfwords,post-halfwords
26490 If the hotpatch option is enabled, a "hot-patching" function
26491 prologue is generated for all functions in the compilation unit.
26492 The funtion label is prepended with the given number of two-byte
26493 NOP instructions (pre-halfwords, maximum 1000000). After the
26494 label, 2 * post-halfwords bytes are appended, using the largest NOP
26495 like instructions the architecture allows (maximum 1000000).
26496
26497 If both arguments are zero, hotpatching is disabled.
26498
26499 This option can be overridden for individual functions with the
26500 "hotpatch" attribute.
26501
26502 SH Options
26503
26504 These -m options are defined for the SH implementations:
26505
26506 -m1 Generate code for the SH1.
26507
26508 -m2 Generate code for the SH2.
26509
26510 -m2e
26511 Generate code for the SH2e.
26512
26513 -m2a-nofpu
26514 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
26515 way that the floating-point unit is not used.
26516
26517 -m2a-single-only
26518 Generate code for the SH2a-FPU, in such a way that no double-
26519 precision floating-point operations are used.
26520
26521 -m2a-single
26522 Generate code for the SH2a-FPU assuming the floating-point unit is
26523 in single-precision mode by default.
26524
26525 -m2a
26526 Generate code for the SH2a-FPU assuming the floating-point unit is
26527 in double-precision mode by default.
26528
26529 -m3 Generate code for the SH3.
26530
26531 -m3e
26532 Generate code for the SH3e.
26533
26534 -m4-nofpu
26535 Generate code for the SH4 without a floating-point unit.
26536
26537 -m4-single-only
26538 Generate code for the SH4 with a floating-point unit that only
26539 supports single-precision arithmetic.
26540
26541 -m4-single
26542 Generate code for the SH4 assuming the floating-point unit is in
26543 single-precision mode by default.
26544
26545 -m4 Generate code for the SH4.
26546
26547 -m4-100
26548 Generate code for SH4-100.
26549
26550 -m4-100-nofpu
26551 Generate code for SH4-100 in such a way that the floating-point
26552 unit is not used.
26553
26554 -m4-100-single
26555 Generate code for SH4-100 assuming the floating-point unit is in
26556 single-precision mode by default.
26557
26558 -m4-100-single-only
26559 Generate code for SH4-100 in such a way that no double-precision
26560 floating-point operations are used.
26561
26562 -m4-200
26563 Generate code for SH4-200.
26564
26565 -m4-200-nofpu
26566 Generate code for SH4-200 without in such a way that the floating-
26567 point unit is not used.
26568
26569 -m4-200-single
26570 Generate code for SH4-200 assuming the floating-point unit is in
26571 single-precision mode by default.
26572
26573 -m4-200-single-only
26574 Generate code for SH4-200 in such a way that no double-precision
26575 floating-point operations are used.
26576
26577 -m4-300
26578 Generate code for SH4-300.
26579
26580 -m4-300-nofpu
26581 Generate code for SH4-300 without in such a way that the floating-
26582 point unit is not used.
26583
26584 -m4-300-single
26585 Generate code for SH4-300 in such a way that no double-precision
26586 floating-point operations are used.
26587
26588 -m4-300-single-only
26589 Generate code for SH4-300 in such a way that no double-precision
26590 floating-point operations are used.
26591
26592 -m4-340
26593 Generate code for SH4-340 (no MMU, no FPU).
26594
26595 -m4-500
26596 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
26597 assembler.
26598
26599 -m4a-nofpu
26600 Generate code for the SH4al-dsp, or for a SH4a in such a way that
26601 the floating-point unit is not used.
26602
26603 -m4a-single-only
26604 Generate code for the SH4a, in such a way that no double-precision
26605 floating-point operations are used.
26606
26607 -m4a-single
26608 Generate code for the SH4a assuming the floating-point unit is in
26609 single-precision mode by default.
26610
26611 -m4a
26612 Generate code for the SH4a.
26613
26614 -m4al
26615 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
26616 assembler. GCC doesn't generate any DSP instructions at the
26617 moment.
26618
26619 -mb Compile code for the processor in big-endian mode.
26620
26621 -ml Compile code for the processor in little-endian mode.
26622
26623 -mdalign
26624 Align doubles at 64-bit boundaries. Note that this changes the
26625 calling conventions, and thus some functions from the standard C
26626 library do not work unless you recompile it first with -mdalign.
26627
26628 -mrelax
26629 Shorten some address references at link time, when possible; uses
26630 the linker option -relax.
26631
26632 -mbigtable
26633 Use 32-bit offsets in "switch" tables. The default is to use
26634 16-bit offsets.
26635
26636 -mbitops
26637 Enable the use of bit manipulation instructions on SH2A.
26638
26639 -mfmovd
26640 Enable the use of the instruction "fmovd". Check -mdalign for
26641 alignment constraints.
26642
26643 -mrenesas
26644 Comply with the calling conventions defined by Renesas.
26645
26646 -mno-renesas
26647 Comply with the calling conventions defined for GCC before the
26648 Renesas conventions were available. This option is the default for
26649 all targets of the SH toolchain.
26650
26651 -mnomacsave
26652 Mark the "MAC" register as call-clobbered, even if -mrenesas is
26653 given.
26654
26655 -mieee
26656 -mno-ieee
26657 Control the IEEE compliance of floating-point comparisons, which
26658 affects the handling of cases where the result of a comparison is
26659 unordered. By default -mieee is implicitly enabled. If
26660 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
26661 results in faster floating-point greater-equal and less-equal
26662 comparisons. The implicit settings can be overridden by specifying
26663 either -mieee or -mno-ieee.
26664
26665 -minline-ic_invalidate
26666 Inline code to invalidate instruction cache entries after setting
26667 up nested function trampolines. This option has no effect if
26668 -musermode is in effect and the selected code generation option
26669 (e.g. -m4) does not allow the use of the "icbi" instruction. If
26670 the selected code generation option does not allow the use of the
26671 "icbi" instruction, and -musermode is not in effect, the inlined
26672 code manipulates the instruction cache address array directly with
26673 an associative write. This not only requires privileged mode at
26674 run time, but it also fails if the cache line had been mapped via
26675 the TLB and has become unmapped.
26676
26677 -misize
26678 Dump instruction size and location in the assembly code.
26679
26680 -mpadstruct
26681 This option is deprecated. It pads structures to multiple of 4
26682 bytes, which is incompatible with the SH ABI.
26683
26684 -matomic-model=model
26685 Sets the model of atomic operations and additional parameters as a
26686 comma separated list. For details on the atomic built-in functions
26687 see __atomic Builtins. The following models and parameters are
26688 supported:
26689
26690 none
26691 Disable compiler generated atomic sequences and emit library
26692 calls for atomic operations. This is the default if the target
26693 is not "sh*-*-linux*".
26694
26695 soft-gusa
26696 Generate GNU/Linux compatible gUSA software atomic sequences
26697 for the atomic built-in functions. The generated atomic
26698 sequences require additional support from the
26699 interrupt/exception handling code of the system and are only
26700 suitable for SH3* and SH4* single-core systems. This option is
26701 enabled by default when the target is "sh*-*-linux*" and SH3*
26702 or SH4*. When the target is SH4A, this option also partially
26703 utilizes the hardware atomic instructions "movli.l" and
26704 "movco.l" to create more efficient code, unless strict is
26705 specified.
26706
26707 soft-tcb
26708 Generate software atomic sequences that use a variable in the
26709 thread control block. This is a variation of the gUSA
26710 sequences which can also be used on SH1* and SH2* targets. The
26711 generated atomic sequences require additional support from the
26712 interrupt/exception handling code of the system and are only
26713 suitable for single-core systems. When using this model, the
26714 gbr-offset= parameter has to be specified as well.
26715
26716 soft-imask
26717 Generate software atomic sequences that temporarily disable
26718 interrupts by setting "SR.IMASK = 1111". This model works only
26719 when the program runs in privileged mode and is only suitable
26720 for single-core systems. Additional support from the
26721 interrupt/exception handling code of the system is not
26722 required. This model is enabled by default when the target is
26723 "sh*-*-linux*" and SH1* or SH2*.
26724
26725 hard-llcs
26726 Generate hardware atomic sequences using the "movli.l" and
26727 "movco.l" instructions only. This is only available on SH4A
26728 and is suitable for multi-core systems. Since the hardware
26729 instructions support only 32 bit atomic variables access to 8
26730 or 16 bit variables is emulated with 32 bit accesses. Code
26731 compiled with this option is also compatible with other
26732 software atomic model interrupt/exception handling systems if
26733 executed on an SH4A system. Additional support from the
26734 interrupt/exception handling code of the system is not required
26735 for this model.
26736
26737 gbr-offset=
26738 This parameter specifies the offset in bytes of the variable in
26739 the thread control block structure that should be used by the
26740 generated atomic sequences when the soft-tcb model has been
26741 selected. For other models this parameter is ignored. The
26742 specified value must be an integer multiple of four and in the
26743 range 0-1020.
26744
26745 strict
26746 This parameter prevents mixed usage of multiple atomic models,
26747 even if they are compatible, and makes the compiler generate
26748 atomic sequences of the specified model only.
26749
26750 -mtas
26751 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
26752 that depending on the particular hardware and software
26753 configuration this can degrade overall performance due to the
26754 operand cache line flushes that are implied by the "tas.b"
26755 instruction. On multi-core SH4A processors the "tas.b" instruction
26756 must be used with caution since it can result in data corruption
26757 for certain cache configurations.
26758
26759 -mprefergot
26760 When generating position-independent code, emit function calls
26761 using the Global Offset Table instead of the Procedure Linkage
26762 Table.
26763
26764 -musermode
26765 -mno-usermode
26766 Don't allow (allow) the compiler generating privileged mode code.
26767 Specifying -musermode also implies -mno-inline-ic_invalidate if the
26768 inlined code would not work in user mode. -musermode is the
26769 default when the target is "sh*-*-linux*". If the target is SH1*
26770 or SH2* -musermode has no effect, since there is no user mode.
26771
26772 -multcost=number
26773 Set the cost to assume for a multiply insn.
26774
26775 -mdiv=strategy
26776 Set the division strategy to be used for integer division
26777 operations. strategy can be one of:
26778
26779 call-div1
26780 Calls a library function that uses the single-step division
26781 instruction "div1" to perform the operation. Division by zero
26782 calculates an unspecified result and does not trap. This is
26783 the default except for SH4, SH2A and SHcompact.
26784
26785 call-fp
26786 Calls a library function that performs the operation in double
26787 precision floating point. Division by zero causes a floating-
26788 point exception. This is the default for SHcompact with FPU.
26789 Specifying this for targets that do not have a double precision
26790 FPU defaults to "call-div1".
26791
26792 call-table
26793 Calls a library function that uses a lookup table for small
26794 divisors and the "div1" instruction with case distinction for
26795 larger divisors. Division by zero calculates an unspecified
26796 result and does not trap. This is the default for SH4.
26797 Specifying this for targets that do not have dynamic shift
26798 instructions defaults to "call-div1".
26799
26800 When a division strategy has not been specified the default
26801 strategy is selected based on the current target. For SH2A the
26802 default strategy is to use the "divs" and "divu" instructions
26803 instead of library function calls.
26804
26805 -maccumulate-outgoing-args
26806 Reserve space once for outgoing arguments in the function prologue
26807 rather than around each call. Generally beneficial for performance
26808 and size. Also needed for unwinding to avoid changing the stack
26809 frame around conditional code.
26810
26811 -mdivsi3_libfunc=name
26812 Set the name of the library function used for 32-bit signed
26813 division to name. This only affects the name used in the call
26814 division strategies, and the compiler still expects the same sets
26815 of input/output/clobbered registers as if this option were not
26816 present.
26817
26818 -mfixed-range=register-range
26819 Generate code treating the given register range as fixed registers.
26820 A fixed register is one that the register allocator cannot use.
26821 This is useful when compiling kernel code. A register range is
26822 specified as two registers separated by a dash. Multiple register
26823 ranges can be specified separated by a comma.
26824
26825 -mbranch-cost=num
26826 Assume num to be the cost for a branch instruction. Higher numbers
26827 make the compiler try to generate more branch-free code if
26828 possible. If not specified the value is selected depending on the
26829 processor type that is being compiled for.
26830
26831 -mzdcbranch
26832 -mno-zdcbranch
26833 Assume (do not assume) that zero displacement conditional branch
26834 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
26835 the compiler prefers zero displacement branch code sequences. This
26836 is enabled by default when generating code for SH4 and SH4A. It
26837 can be explicitly disabled by specifying -mno-zdcbranch.
26838
26839 -mcbranch-force-delay-slot
26840 Force the usage of delay slots for conditional branches, which
26841 stuffs the delay slot with a "nop" if a suitable instruction cannot
26842 be found. By default this option is disabled. It can be enabled
26843 to work around hardware bugs as found in the original SH7055.
26844
26845 -mfused-madd
26846 -mno-fused-madd
26847 Generate code that uses (does not use) the floating-point multiply
26848 and accumulate instructions. These instructions are generated by
26849 default if hardware floating point is used. The machine-dependent
26850 -mfused-madd option is now mapped to the machine-independent
26851 -ffp-contract=fast option, and -mno-fused-madd is mapped to
26852 -ffp-contract=off.
26853
26854 -mfsca
26855 -mno-fsca
26856 Allow or disallow the compiler to emit the "fsca" instruction for
26857 sine and cosine approximations. The option -mfsca must be used in
26858 combination with -funsafe-math-optimizations. It is enabled by
26859 default when generating code for SH4A. Using -mno-fsca disables
26860 sine and cosine approximations even if -funsafe-math-optimizations
26861 is in effect.
26862
26863 -mfsrra
26864 -mno-fsrra
26865 Allow or disallow the compiler to emit the "fsrra" instruction for
26866 reciprocal square root approximations. The option -mfsrra must be
26867 used in combination with -funsafe-math-optimizations and
26868 -ffinite-math-only. It is enabled by default when generating code
26869 for SH4A. Using -mno-fsrra disables reciprocal square root
26870 approximations even if -funsafe-math-optimizations and
26871 -ffinite-math-only are in effect.
26872
26873 -mpretend-cmove
26874 Prefer zero-displacement conditional branches for conditional move
26875 instruction patterns. This can result in faster code on the SH4
26876 processor.
26877
26878 -mfdpic
26879 Generate code using the FDPIC ABI.
26880
26881 Solaris 2 Options
26882
26883 These -m options are supported on Solaris 2:
26884
26885 -mclear-hwcap
26886 -mclear-hwcap tells the compiler to remove the hardware
26887 capabilities generated by the Solaris assembler. This is only
26888 necessary when object files use ISA extensions not supported by the
26889 current machine, but check at runtime whether or not to use them.
26890
26891 -mimpure-text
26892 -mimpure-text, used in addition to -shared, tells the compiler to
26893 not pass -z text to the linker when linking a shared object. Using
26894 this option, you can link position-dependent code into a shared
26895 object.
26896
26897 -mimpure-text suppresses the "relocations remain against
26898 allocatable but non-writable sections" linker error message.
26899 However, the necessary relocations trigger copy-on-write, and the
26900 shared object is not actually shared across processes. Instead of
26901 using -mimpure-text, you should compile all source code with -fpic
26902 or -fPIC.
26903
26904 These switches are supported in addition to the above on Solaris 2:
26905
26906 -pthreads
26907 This is a synonym for -pthread.
26908
26909 SPARC Options
26910
26911 These -m options are supported on the SPARC:
26912
26913 -mno-app-regs
26914 -mapp-regs
26915 Specify -mapp-regs to generate output using the global registers 2
26916 through 4, which the SPARC SVR4 ABI reserves for applications.
26917 Like the global register 1, each global register 2 through 4 is
26918 then treated as an allocable register that is clobbered by function
26919 calls. This is the default.
26920
26921 To be fully SVR4 ABI-compliant at the cost of some performance
26922 loss, specify -mno-app-regs. You should compile libraries and
26923 system software with this option.
26924
26925 -mflat
26926 -mno-flat
26927 With -mflat, the compiler does not generate save/restore
26928 instructions and uses a "flat" or single register window model.
26929 This model is compatible with the regular register window model.
26930 The local registers and the input registers (0--5) are still
26931 treated as "call-saved" registers and are saved on the stack as
26932 needed.
26933
26934 With -mno-flat (the default), the compiler generates save/restore
26935 instructions (except for leaf functions). This is the normal
26936 operating mode.
26937
26938 -mfpu
26939 -mhard-float
26940 Generate output containing floating-point instructions. This is
26941 the default.
26942
26943 -mno-fpu
26944 -msoft-float
26945 Generate output containing library calls for floating point.
26946 Warning: the requisite libraries are not available for all SPARC
26947 targets. Normally the facilities of the machine's usual C compiler
26948 are used, but this cannot be done directly in cross-compilation.
26949 You must make your own arrangements to provide suitable library
26950 functions for cross-compilation. The embedded targets sparc-*-aout
26951 and sparclite-*-* do provide software floating-point support.
26952
26953 -msoft-float changes the calling convention in the output file;
26954 therefore, it is only useful if you compile all of a program with
26955 this option. In particular, you need to compile libgcc.a, the
26956 library that comes with GCC, with -msoft-float in order for this to
26957 work.
26958
26959 -mhard-quad-float
26960 Generate output containing quad-word (long double) floating-point
26961 instructions.
26962
26963 -msoft-quad-float
26964 Generate output containing library calls for quad-word (long
26965 double) floating-point instructions. The functions called are
26966 those specified in the SPARC ABI. This is the default.
26967
26968 As of this writing, there are no SPARC implementations that have
26969 hardware support for the quad-word floating-point instructions.
26970 They all invoke a trap handler for one of these instructions, and
26971 then the trap handler emulates the effect of the instruction.
26972 Because of the trap handler overhead, this is much slower than
26973 calling the ABI library routines. Thus the -msoft-quad-float
26974 option is the default.
26975
26976 -mno-unaligned-doubles
26977 -munaligned-doubles
26978 Assume that doubles have 8-byte alignment. This is the default.
26979
26980 With -munaligned-doubles, GCC assumes that doubles have 8-byte
26981 alignment only if they are contained in another type, or if they
26982 have an absolute address. Otherwise, it assumes they have 4-byte
26983 alignment. Specifying this option avoids some rare compatibility
26984 problems with code generated by other compilers. It is not the
26985 default because it results in a performance loss, especially for
26986 floating-point code.
26987
26988 -muser-mode
26989 -mno-user-mode
26990 Do not generate code that can only run in supervisor mode. This is
26991 relevant only for the "casa" instruction emitted for the LEON3
26992 processor. This is the default.
26993
26994 -mfaster-structs
26995 -mno-faster-structs
26996 With -mfaster-structs, the compiler assumes that structures should
26997 have 8-byte alignment. This enables the use of pairs of "ldd" and
26998 "std" instructions for copies in structure assignment, in place of
26999 twice as many "ld" and "st" pairs. However, the use of this
27000 changed alignment directly violates the SPARC ABI. Thus, it's
27001 intended only for use on targets where the developer acknowledges
27002 that their resulting code is not directly in line with the rules of
27003 the ABI.
27004
27005 -mstd-struct-return
27006 -mno-std-struct-return
27007 With -mstd-struct-return, the compiler generates checking code in
27008 functions returning structures or unions to detect size mismatches
27009 between the two sides of function calls, as per the 32-bit ABI.
27010
27011 The default is -mno-std-struct-return. This option has no effect
27012 in 64-bit mode.
27013
27014 -mlra
27015 -mno-lra
27016 Enable Local Register Allocation. This is the default for SPARC
27017 since GCC 7 so -mno-lra needs to be passed to get old Reload.
27018
27019 -mcpu=cpu_type
27020 Set the instruction set, register set, and instruction scheduling
27021 parameters for machine type cpu_type. Supported values for
27022 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
27023 leon3v7, leon5, sparclite, f930, f934, sparclite86x, sparclet,
27024 tsc701, v9, ultrasparc, ultrasparc3, niagara, niagara2, niagara3,
27025 niagara4, niagara7 and m8.
27026
27027 Native Solaris and GNU/Linux toolchains also support the value
27028 native, which selects the best architecture option for the host
27029 processor. -mcpu=native has no effect if GCC does not recognize
27030 the processor.
27031
27032 Default instruction scheduling parameters are used for values that
27033 select an architecture and not an implementation. These are v7,
27034 v8, sparclite, sparclet, v9.
27035
27036 Here is a list of each supported architecture and their supported
27037 implementations.
27038
27039 v7 cypress, leon3v7
27040
27041 v8 supersparc, hypersparc, leon, leon3, leon5
27042
27043 sparclite
27044 f930, f934, sparclite86x
27045
27046 sparclet
27047 tsc701
27048
27049 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
27050 niagara7, m8
27051
27052 By default (unless configured otherwise), GCC generates code for
27053 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
27054 compiler additionally optimizes it for the Cypress CY7C602 chip, as
27055 used in the SPARCStation/SPARCServer 3xx series. This is also
27056 appropriate for the older SPARCStation 1, 2, IPX etc.
27057
27058 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
27059 architecture. The only difference from V7 code is that the
27060 compiler emits the integer multiply and integer divide instructions
27061 which exist in SPARC-V8 but not in SPARC-V7. With
27062 -mcpu=supersparc, the compiler additionally optimizes it for the
27063 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
27064 series.
27065
27066 With -mcpu=sparclite, GCC generates code for the SPARClite variant
27067 of the SPARC architecture. This adds the integer multiply, integer
27068 divide step and scan ("ffs") instructions which exist in SPARClite
27069 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
27070 optimizes it for the Fujitsu MB86930 chip, which is the original
27071 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
27072 optimizes it for the Fujitsu MB86934 chip, which is the more recent
27073 SPARClite with FPU.
27074
27075 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
27076 the SPARC architecture. This adds the integer multiply,
27077 multiply/accumulate, integer divide step and scan ("ffs")
27078 instructions which exist in SPARClet but not in SPARC-V7. With
27079 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
27080 SPARClet chip.
27081
27082 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
27083 architecture. This adds 64-bit integer and floating-point move
27084 instructions, 3 additional floating-point condition code registers
27085 and conditional move instructions. With -mcpu=ultrasparc, the
27086 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
27087 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
27088 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
27089 -mcpu=niagara, the compiler additionally optimizes it for Sun
27090 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
27091 additionally optimizes it for Sun UltraSPARC T2 chips. With
27092 -mcpu=niagara3, the compiler additionally optimizes it for Sun
27093 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
27094 additionally optimizes it for Sun UltraSPARC T4 chips. With
27095 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
27096 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
27097 it for Oracle M8 chips.
27098
27099 -mtune=cpu_type
27100 Set the instruction scheduling parameters for machine type
27101 cpu_type, but do not set the instruction set or register set that
27102 the option -mcpu=cpu_type does.
27103
27104 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
27105 but the only useful values are those that select a particular CPU
27106 implementation. Those are cypress, supersparc, hypersparc, leon,
27107 leon3, leon3v7, leon5, f930, f934, sparclite86x, tsc701,
27108 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
27109 niagara7 and m8. With native Solaris and GNU/Linux toolchains,
27110 native can also be used.
27111
27112 -mv8plus
27113 -mno-v8plus
27114 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
27115 difference from the V8 ABI is that the global and out registers are
27116 considered 64 bits wide. This is enabled by default on Solaris in
27117 32-bit mode for all SPARC-V9 processors.
27118
27119 -mvis
27120 -mno-vis
27121 With -mvis, GCC generates code that takes advantage of the
27122 UltraSPARC Visual Instruction Set extensions. The default is
27123 -mno-vis.
27124
27125 -mvis2
27126 -mno-vis2
27127 With -mvis2, GCC generates code that takes advantage of version 2.0
27128 of the UltraSPARC Visual Instruction Set extensions. The default
27129 is -mvis2 when targeting a cpu that supports such instructions,
27130 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
27131
27132 -mvis3
27133 -mno-vis3
27134 With -mvis3, GCC generates code that takes advantage of version 3.0
27135 of the UltraSPARC Visual Instruction Set extensions. The default
27136 is -mvis3 when targeting a cpu that supports such instructions,
27137 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
27138 -mvis.
27139
27140 -mvis4
27141 -mno-vis4
27142 With -mvis4, GCC generates code that takes advantage of version 4.0
27143 of the UltraSPARC Visual Instruction Set extensions. The default
27144 is -mvis4 when targeting a cpu that supports such instructions,
27145 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
27146 -mvis2 and -mvis.
27147
27148 -mvis4b
27149 -mno-vis4b
27150 With -mvis4b, GCC generates code that takes advantage of version
27151 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
27152 additional VIS instructions introduced in the Oracle SPARC
27153 Architecture 2017. The default is -mvis4b when targeting a cpu
27154 that supports such instructions, such as m8 and later. Setting
27155 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
27156
27157 -mcbcond
27158 -mno-cbcond
27159 With -mcbcond, GCC generates code that takes advantage of the
27160 UltraSPARC Compare-and-Branch-on-Condition instructions. The
27161 default is -mcbcond when targeting a CPU that supports such
27162 instructions, such as Niagara-4 and later.
27163
27164 -mfmaf
27165 -mno-fmaf
27166 With -mfmaf, GCC generates code that takes advantage of the
27167 UltraSPARC Fused Multiply-Add Floating-point instructions. The
27168 default is -mfmaf when targeting a CPU that supports such
27169 instructions, such as Niagara-3 and later.
27170
27171 -mfsmuld
27172 -mno-fsmuld
27173 With -mfsmuld, GCC generates code that takes advantage of the
27174 Floating-point Multiply Single to Double (FsMULd) instruction. The
27175 default is -mfsmuld when targeting a CPU supporting the
27176 architecture versions V8 or V9 with FPU except -mcpu=leon.
27177
27178 -mpopc
27179 -mno-popc
27180 With -mpopc, GCC generates code that takes advantage of the
27181 UltraSPARC Population Count instruction. The default is -mpopc
27182 when targeting a CPU that supports such an instruction, such as
27183 Niagara-2 and later.
27184
27185 -msubxc
27186 -mno-subxc
27187 With -msubxc, GCC generates code that takes advantage of the
27188 UltraSPARC Subtract-Extended-with-Carry instruction. The default
27189 is -msubxc when targeting a CPU that supports such an instruction,
27190 such as Niagara-7 and later.
27191
27192 -mfix-at697f
27193 Enable the documented workaround for the single erratum of the
27194 Atmel AT697F processor (which corresponds to erratum #13 of the
27195 AT697E processor).
27196
27197 -mfix-ut699
27198 Enable the documented workarounds for the floating-point errata and
27199 the data cache nullify errata of the UT699 processor.
27200
27201 -mfix-ut700
27202 Enable the documented workaround for the back-to-back store errata
27203 of the UT699E/UT700 processor.
27204
27205 -mfix-gr712rc
27206 Enable the documented workaround for the back-to-back store errata
27207 of the GR712RC processor.
27208
27209 These -m options are supported in addition to the above on SPARC-V9
27210 processors in 64-bit environments:
27211
27212 -m32
27213 -m64
27214 Generate code for a 32-bit or 64-bit environment. The 32-bit
27215 environment sets int, long and pointer to 32 bits. The 64-bit
27216 environment sets int to 32 bits and long and pointer to 64 bits.
27217
27218 -mcmodel=which
27219 Set the code model to one of
27220
27221 medlow
27222 The Medium/Low code model: 64-bit addresses, programs must be
27223 linked in the low 32 bits of memory. Programs can be
27224 statically or dynamically linked.
27225
27226 medmid
27227 The Medium/Middle code model: 64-bit addresses, programs must
27228 be linked in the low 44 bits of memory, the text and data
27229 segments must be less than 2GB in size and the data segment
27230 must be located within 2GB of the text segment.
27231
27232 medany
27233 The Medium/Anywhere code model: 64-bit addresses, programs may
27234 be linked anywhere in memory, the text and data segments must
27235 be less than 2GB in size and the data segment must be located
27236 within 2GB of the text segment.
27237
27238 embmedany
27239 The Medium/Anywhere code model for embedded systems: 64-bit
27240 addresses, the text and data segments must be less than 2GB in
27241 size, both starting anywhere in memory (determined at link
27242 time). The global register %g4 points to the base of the data
27243 segment. Programs are statically linked and PIC is not
27244 supported.
27245
27246 -mmemory-model=mem-model
27247 Set the memory model in force on the processor to one of
27248
27249 default
27250 The default memory model for the processor and operating
27251 system.
27252
27253 rmo Relaxed Memory Order
27254
27255 pso Partial Store Order
27256
27257 tso Total Store Order
27258
27259 sc Sequential Consistency
27260
27261 These memory models are formally defined in Appendix D of the
27262 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
27263 field.
27264
27265 -mstack-bias
27266 -mno-stack-bias
27267 With -mstack-bias, GCC assumes that the stack pointer, and frame
27268 pointer if present, are offset by -2047 which must be added back
27269 when making stack frame references. This is the default in 64-bit
27270 mode. Otherwise, assume no such offset is present.
27271
27272 Options for System V
27273
27274 These additional options are available on System V Release 4 for
27275 compatibility with other compilers on those systems:
27276
27277 -G Create a shared object. It is recommended that -symbolic or
27278 -shared be used instead.
27279
27280 -Qy Identify the versions of each tool used by the compiler, in a
27281 ".ident" assembler directive in the output.
27282
27283 -Qn Refrain from adding ".ident" directives to the output file (this is
27284 the default).
27285
27286 -YP,dirs
27287 Search the directories dirs, and no others, for libraries specified
27288 with -l.
27289
27290 -Ym,dir
27291 Look in the directory dir to find the M4 preprocessor. The
27292 assembler uses this option.
27293
27294 V850 Options
27295
27296 These -m options are defined for V850 implementations:
27297
27298 -mlong-calls
27299 -mno-long-calls
27300 Treat all calls as being far away (near). If calls are assumed to
27301 be far away, the compiler always loads the function's address into
27302 a register, and calls indirect through the pointer.
27303
27304 -mno-ep
27305 -mep
27306 Do not optimize (do optimize) basic blocks that use the same index
27307 pointer 4 or more times to copy pointer into the "ep" register, and
27308 use the shorter "sld" and "sst" instructions. The -mep option is
27309 on by default if you optimize.
27310
27311 -mno-prolog-function
27312 -mprolog-function
27313 Do not use (do use) external functions to save and restore
27314 registers at the prologue and epilogue of a function. The external
27315 functions are slower, but use less code space if more than one
27316 function saves the same number of registers. The -mprolog-function
27317 option is on by default if you optimize.
27318
27319 -mspace
27320 Try to make the code as small as possible. At present, this just
27321 turns on the -mep and -mprolog-function options.
27322
27323 -mtda=n
27324 Put static or global variables whose size is n bytes or less into
27325 the tiny data area that register "ep" points to. The tiny data
27326 area can hold up to 256 bytes in total (128 bytes for byte
27327 references).
27328
27329 -msda=n
27330 Put static or global variables whose size is n bytes or less into
27331 the small data area that register "gp" points to. The small data
27332 area can hold up to 64 kilobytes.
27333
27334 -mzda=n
27335 Put static or global variables whose size is n bytes or less into
27336 the first 32 kilobytes of memory.
27337
27338 -mv850
27339 Specify that the target processor is the V850.
27340
27341 -mv850e3v5
27342 Specify that the target processor is the V850E3V5. The
27343 preprocessor constant "__v850e3v5__" is defined if this option is
27344 used.
27345
27346 -mv850e2v4
27347 Specify that the target processor is the V850E3V5. This is an
27348 alias for the -mv850e3v5 option.
27349
27350 -mv850e2v3
27351 Specify that the target processor is the V850E2V3. The
27352 preprocessor constant "__v850e2v3__" is defined if this option is
27353 used.
27354
27355 -mv850e2
27356 Specify that the target processor is the V850E2. The preprocessor
27357 constant "__v850e2__" is defined if this option is used.
27358
27359 -mv850e1
27360 Specify that the target processor is the V850E1. The preprocessor
27361 constants "__v850e1__" and "__v850e__" are defined if this option
27362 is used.
27363
27364 -mv850es
27365 Specify that the target processor is the V850ES. This is an alias
27366 for the -mv850e1 option.
27367
27368 -mv850e
27369 Specify that the target processor is the V850E. The preprocessor
27370 constant "__v850e__" is defined if this option is used.
27371
27372 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
27373 -mv850e2v3 nor -mv850e3v5 are defined then a default target
27374 processor is chosen and the relevant __v850*__ preprocessor
27375 constant is defined.
27376
27377 The preprocessor constants "__v850" and "__v851__" are always
27378 defined, regardless of which processor variant is the target.
27379
27380 -mdisable-callt
27381 -mno-disable-callt
27382 This option suppresses generation of the "CALLT" instruction for
27383 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
27384 v850 architecture.
27385
27386 This option is enabled by default when the RH850 ABI is in use (see
27387 -mrh850-abi), and disabled by default when the GCC ABI is in use.
27388 If "CALLT" instructions are being generated then the C preprocessor
27389 symbol "__V850_CALLT__" is defined.
27390
27391 -mrelax
27392 -mno-relax
27393 Pass on (or do not pass on) the -mrelax command-line option to the
27394 assembler.
27395
27396 -mlong-jumps
27397 -mno-long-jumps
27398 Disable (or re-enable) the generation of PC-relative jump
27399 instructions.
27400
27401 -msoft-float
27402 -mhard-float
27403 Disable (or re-enable) the generation of hardware floating point
27404 instructions. This option is only significant when the target
27405 architecture is V850E2V3 or higher. If hardware floating point
27406 instructions are being generated then the C preprocessor symbol
27407 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
27408 defined.
27409
27410 -mloop
27411 Enables the use of the e3v5 LOOP instruction. The use of this
27412 instruction is not enabled by default when the e3v5 architecture is
27413 selected because its use is still experimental.
27414
27415 -mrh850-abi
27416 -mghs
27417 Enables support for the RH850 version of the V850 ABI. This is the
27418 default. With this version of the ABI the following rules apply:
27419
27420 * Integer sized structures and unions are returned via a memory
27421 pointer rather than a register.
27422
27423 * Large structures and unions (more than 8 bytes in size) are
27424 passed by value.
27425
27426 * Functions are aligned to 16-bit boundaries.
27427
27428 * The -m8byte-align command-line option is supported.
27429
27430 * The -mdisable-callt command-line option is enabled by default.
27431 The -mno-disable-callt command-line option is not supported.
27432
27433 When this version of the ABI is enabled the C preprocessor symbol
27434 "__V850_RH850_ABI__" is defined.
27435
27436 -mgcc-abi
27437 Enables support for the old GCC version of the V850 ABI. With this
27438 version of the ABI the following rules apply:
27439
27440 * Integer sized structures and unions are returned in register
27441 "r10".
27442
27443 * Large structures and unions (more than 8 bytes in size) are
27444 passed by reference.
27445
27446 * Functions are aligned to 32-bit boundaries, unless optimizing
27447 for size.
27448
27449 * The -m8byte-align command-line option is not supported.
27450
27451 * The -mdisable-callt command-line option is supported but not
27452 enabled by default.
27453
27454 When this version of the ABI is enabled the C preprocessor symbol
27455 "__V850_GCC_ABI__" is defined.
27456
27457 -m8byte-align
27458 -mno-8byte-align
27459 Enables support for "double" and "long long" types to be aligned on
27460 8-byte boundaries. The default is to restrict the alignment of all
27461 objects to at most 4-bytes. When -m8byte-align is in effect the C
27462 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
27463
27464 -mbig-switch
27465 Generate code suitable for big switch tables. Use this option only
27466 if the assembler/linker complain about out of range branches within
27467 a switch table.
27468
27469 -mapp-regs
27470 This option causes r2 and r5 to be used in the code generated by
27471 the compiler. This setting is the default.
27472
27473 -mno-app-regs
27474 This option causes r2 and r5 to be treated as fixed registers.
27475
27476 VAX Options
27477
27478 These -m options are defined for the VAX:
27479
27480 -munix
27481 Do not output certain jump instructions ("aobleq" and so on) that
27482 the Unix assembler for the VAX cannot handle across long ranges.
27483
27484 -mgnu
27485 Do output those jump instructions, on the assumption that the GNU
27486 assembler is being used.
27487
27488 -mg Output code for G-format floating-point numbers instead of
27489 D-format.
27490
27491 -mlra
27492 -mno-lra
27493 Enable Local Register Allocation. This is still experimental for
27494 the VAX, so by default the compiler uses standard reload.
27495
27496 Visium Options
27497
27498 -mdebug
27499 A program which performs file I/O and is destined to run on an MCM
27500 target should be linked with this option. It causes the libraries
27501 libc.a and libdebug.a to be linked. The program should be run on
27502 the target under the control of the GDB remote debugging stub.
27503
27504 -msim
27505 A program which performs file I/O and is destined to run on the
27506 simulator should be linked with option. This causes libraries
27507 libc.a and libsim.a to be linked.
27508
27509 -mfpu
27510 -mhard-float
27511 Generate code containing floating-point instructions. This is the
27512 default.
27513
27514 -mno-fpu
27515 -msoft-float
27516 Generate code containing library calls for floating-point.
27517
27518 -msoft-float changes the calling convention in the output file;
27519 therefore, it is only useful if you compile all of a program with
27520 this option. In particular, you need to compile libgcc.a, the
27521 library that comes with GCC, with -msoft-float in order for this to
27522 work.
27523
27524 -mcpu=cpu_type
27525 Set the instruction set, register set, and instruction scheduling
27526 parameters for machine type cpu_type. Supported values for
27527 cpu_type are mcm, gr5 and gr6.
27528
27529 mcm is a synonym of gr5 present for backward compatibility.
27530
27531 By default (unless configured otherwise), GCC generates code for
27532 the GR5 variant of the Visium architecture.
27533
27534 With -mcpu=gr6, GCC generates code for the GR6 variant of the
27535 Visium architecture. The only difference from GR5 code is that the
27536 compiler will generate block move instructions.
27537
27538 -mtune=cpu_type
27539 Set the instruction scheduling parameters for machine type
27540 cpu_type, but do not set the instruction set or register set that
27541 the option -mcpu=cpu_type would.
27542
27543 -msv-mode
27544 Generate code for the supervisor mode, where there are no
27545 restrictions on the access to general registers. This is the
27546 default.
27547
27548 -muser-mode
27549 Generate code for the user mode, where the access to some general
27550 registers is forbidden: on the GR5, registers r24 to r31 cannot be
27551 accessed in this mode; on the GR6, only registers r29 to r31 are
27552 affected.
27553
27554 VMS Options
27555
27556 These -m options are defined for the VMS implementations:
27557
27558 -mvms-return-codes
27559 Return VMS condition codes from "main". The default is to return
27560 POSIX-style condition (e.g. error) codes.
27561
27562 -mdebug-main=prefix
27563 Flag the first routine whose name starts with prefix as the main
27564 routine for the debugger.
27565
27566 -mmalloc64
27567 Default to 64-bit memory allocation routines.
27568
27569 -mpointer-size=size
27570 Set the default size of pointers. Possible options for size are 32
27571 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
27572 no for supporting only 32 bit pointers. The later option disables
27573 "pragma pointer_size".
27574
27575 VxWorks Options
27576
27577 The options in this section are defined for all VxWorks targets.
27578 Options specific to the target hardware are listed with the other
27579 options for that target.
27580
27581 -mrtp
27582 GCC can generate code for both VxWorks kernels and real time
27583 processes (RTPs). This option switches from the former to the
27584 latter. It also defines the preprocessor macro "__RTP__".
27585
27586 -non-static
27587 Link an RTP executable against shared libraries rather than static
27588 libraries. The options -static and -shared can also be used for
27589 RTPs; -static is the default.
27590
27591 -Bstatic
27592 -Bdynamic
27593 These options are passed down to the linker. They are defined for
27594 compatibility with Diab.
27595
27596 -Xbind-lazy
27597 Enable lazy binding of function calls. This option is equivalent
27598 to -Wl,-z,now and is defined for compatibility with Diab.
27599
27600 -Xbind-now
27601 Disable lazy binding of function calls. This option is the default
27602 and is defined for compatibility with Diab.
27603
27604 x86 Options
27605
27606 These -m options are defined for the x86 family of computers.
27607
27608 -march=cpu-type
27609 Generate instructions for the machine type cpu-type. In contrast
27610 to -mtune=cpu-type, which merely tunes the generated code for the
27611 specified cpu-type, -march=cpu-type allows GCC to generate code
27612 that may not run at all on processors other than the one indicated.
27613 Specifying -march=cpu-type implies -mtune=cpu-type, except where
27614 noted otherwise.
27615
27616 The choices for cpu-type are:
27617
27618 native
27619 This selects the CPU to generate code for at compilation time
27620 by determining the processor type of the compiling machine.
27621 Using -march=native enables all instruction subsets supported
27622 by the local machine (hence the result might not run on
27623 different machines). Using -mtune=native produces code
27624 optimized for the local machine under the constraints of the
27625 selected instruction set.
27626
27627 x86-64
27628 A generic CPU with 64-bit extensions.
27629
27630 x86-64-v2
27631 x86-64-v3
27632 x86-64-v4
27633 These choices for cpu-type select the corresponding micro-
27634 architecture level from the x86-64 psABI. On ABIs other than
27635 the x86-64 psABI they select the same CPU features as the
27636 x86-64 psABI documents for the particular micro-architecture
27637 level.
27638
27639 Since these cpu-type values do not have a corresponding -mtune
27640 setting, using -march with these values enables generic tuning.
27641 Specific tuning can be enabled using the -mtune=other-cpu-type
27642 option with an appropriate other-cpu-type value.
27643
27644 i386
27645 Original Intel i386 CPU.
27646
27647 i486
27648 Intel i486 CPU. (No scheduling is implemented for this chip.)
27649
27650 i586
27651 pentium
27652 Intel Pentium CPU with no MMX support.
27653
27654 lakemont
27655 Intel Lakemont MCU, based on Intel Pentium CPU.
27656
27657 pentium-mmx
27658 Intel Pentium MMX CPU, based on Pentium core with MMX
27659 instruction set support.
27660
27661 pentiumpro
27662 Intel Pentium Pro CPU.
27663
27664 i686
27665 When used with -march, the Pentium Pro instruction set is used,
27666 so the code runs on all i686 family chips. When used with
27667 -mtune, it has the same meaning as generic.
27668
27669 pentium2
27670 Intel Pentium II CPU, based on Pentium Pro core with MMX and
27671 FXSR instruction set support.
27672
27673 pentium3
27674 pentium3m
27675 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR
27676 and SSE instruction set support.
27677
27678 pentium-m
27679 Intel Pentium M; low-power version of Intel Pentium III CPU
27680 with MMX, SSE, SSE2 and FXSR instruction set support. Used by
27681 Centrino notebooks.
27682
27683 pentium4
27684 pentium4m
27685 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction
27686 set support.
27687
27688 prescott
27689 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2,
27690 SSE3 and FXSR instruction set support.
27691
27692 nocona
27693 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
27694 MMX, SSE, SSE2, SSE3 and FXSR instruction set support.
27695
27696 core2
27697 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
27698 SSSE3, CX16, SAHF and FXSR instruction set support.
27699
27700 nehalem
27701 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
27702 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction
27703 set support.
27704
27705 westmere
27706 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
27707 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and
27708 PCLMUL instruction set support.
27709
27710 sandybridge
27711 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
27712 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
27713 XSAVE and PCLMUL instruction set support.
27714
27715 ivybridge
27716 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
27717 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
27718 XSAVE, PCLMUL, FSGSBASE, RDRND and F16C instruction set
27719 support.
27720
27721 haswell
27722 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
27723 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27724 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27725 LZCNT, FMA, MOVBE and HLE instruction set support.
27726
27727 broadwell
27728 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
27729 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27730 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27731 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW instruction
27732 set support.
27733
27734 skylake
27735 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27736 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27737 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27738 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27739 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
27740
27741 bonnell
27742 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
27743 SSE2, SSE3 and SSSE3 instruction set support.
27744
27745 silvermont
27746 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
27747 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27748 PCLMUL, PREFETCHW and RDRND instruction set support.
27749
27750 goldmont
27751 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
27752 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27753 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
27754 XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction set
27755 support.
27756
27757 goldmont-plus
27758 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
27759 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27760 FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE,
27761 XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID
27762 and SGX instruction set support.
27763
27764 tremont
27765 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
27766 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27767 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
27768 XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID, SGX,
27769 CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG
27770 instruction set support.
27771
27772 sierraforest
27773 Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX,
27774 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
27775 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
27776 PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
27777 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
27778 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
27779 WIDEKL, AVX-VNNI, AVXIFMA, AVXVNNIINT8, AVXNECONVERT and
27780 CMPCCXADD instruction set support.
27781
27782 grandridge
27783 Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE,
27784 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
27785 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
27786 PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
27787 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
27788 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
27789 WIDEKL, AVX-VNNI, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD
27790 and RAOINT instruction set support.
27791
27792 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
27793 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27794 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27795 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
27796 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1
27797 instruction set support.
27798
27799 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
27800 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27801 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27802 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AVX512PF,
27803 AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
27804 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27805
27806 skylake-avx512
27807 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
27808 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27809 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27810 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27811 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
27812 AVX512BW, AVX512DQ and AVX512CD instruction set support.
27813
27814 cannonlake
27815 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX,
27816 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27817 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27818 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27819 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27820 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA
27821 instruction set support.
27822
27823 icelake-client
27824 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX,
27825 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27826 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27827 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27828 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27829 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27830 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
27831 RDPID and AVX512VPOPCNTDQ instruction set support.
27832
27833 icelake-server
27834 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
27835 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27836 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27837 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27838 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27839 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27840 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
27841 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB instruction
27842 set support.
27843
27844 cascadelake
27845 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27846 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27847 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27848 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27849 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
27850 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
27851 support.
27852
27853 cooperlake
27854 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27855 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27856 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27857 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27858 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
27859 AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16
27860 instruction set support.
27861
27862 tigerlake
27863 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27864 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27865 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27866 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27867 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27868 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
27869 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27870 RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
27871 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
27872
27873 sapphirerapids
27874 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX,
27875 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27876 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27877 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27878 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27879 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27880 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27881 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI,
27882 MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE,
27883 TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI,
27884 AVX512-FP16 and AVX512BF16 instruction set support.
27885
27886 alderlake
27887 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27888 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
27889 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
27890 PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
27891 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
27892 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
27893 WIDEKL and AVX-VNNI instruction set support.
27894
27895 rocketlake
27896 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27897 SSE2, SSE3, SSSE3 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27898 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27899 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27900 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW,
27901 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
27902 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27903 RDPID and AVX512VPOPCNTDQ instruction set support.
27904
27905 graniterapids
27906 Intel graniterapids CPU with 64-bit extensions, MOVBE, MMX,
27907 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27908 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27909 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27910 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27911 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27912 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27913 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI,
27914 MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE,
27915 WAITPKG, SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE,
27916 AMX-INT8, AVX-VNNI, AVX512-FP16, AVX512BF16, AMX-FP16 and
27917 PREFETCHI instruction set support.
27918
27919 k6 AMD K6 CPU with MMX instruction set support.
27920
27921 k6-2
27922 k6-3
27923 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
27924 set support.
27925
27926 athlon
27927 athlon-tbird
27928 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
27929 prefetch instructions support.
27930
27931 athlon-4
27932 athlon-xp
27933 athlon-mp
27934 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
27935 full SSE instruction set support.
27936
27937 k8
27938 opteron
27939 athlon64
27940 athlon-fx
27941 Processors based on the AMD K8 core with x86-64 instruction set
27942 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
27943 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
27944 3DNow! and 64-bit instruction set extensions.)
27945
27946 k8-sse3
27947 opteron-sse3
27948 athlon64-sse3
27949 Improved versions of AMD K8 cores with SSE3 instruction set
27950 support.
27951
27952 amdfam10
27953 barcelona
27954 CPUs based on AMD Family 10h cores with x86-64 instruction set
27955 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
27956 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
27957
27958 bdver1
27959 CPUs based on AMD Family 15h cores with x86-64 instruction set
27960 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL,
27961 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
27962 and 64-bit instruction set extensions.)
27963
27964 bdver2
27965 AMD Family 15h core based CPUs with x86-64 instruction set
27966 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
27967 LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27968 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27969
27970 bdver3
27971 AMD Family 15h core based CPUs with x86-64 instruction set
27972 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
27973 AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27974 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27975 extensions.)
27976
27977 bdver4
27978 AMD Family 15h core based CPUs with x86-64 instruction set
27979 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
27980 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX,
27981 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
27982 instruction set extensions.)
27983
27984 znver1
27985 AMD Family 17h core based CPUs with x86-64 instruction set
27986 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
27987 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16,
27988 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
27989 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
27990 extensions.)
27991
27992 znver2
27993 AMD Family 17h core based CPUs with x86-64 instruction set
27994 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
27995 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
27996 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27997 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
27998 WBNOINVD, and 64-bit instruction set extensions.)
27999
28000 znver3
28001 AMD Family 19h core based CPUs with x86-64 instruction set
28002 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
28003 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
28004 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
28005 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
28006 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set
28007 extensions.)
28008
28009 znver4
28010 AMD Family 19h core based CPUs with x86-64 instruction set
28011 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
28012 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
28013 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
28014 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
28015 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA,
28016 AVX512CD, AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI,
28017 AVX512VBMI2, AVX512VNNI, AVX512BITALG, AVX512VPOPCNTDQ, GFNI
28018 and 64-bit instruction set extensions.)
28019
28020 btver1
28021 CPUs based on AMD Family 14h cores with x86-64 instruction set
28022 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
28023 CX16, ABM and 64-bit instruction set extensions.)
28024
28025 btver2
28026 CPUs based on AMD Family 16h cores with x86-64 instruction set
28027 support. This includes MOVBE, F16C, BMI, AVX, PCLMUL, AES,
28028 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
28029 and 64-bit instruction set extensions.
28030
28031 winchip-c6
28032 IDT WinChip C6 CPU, dealt in same way as i486 with additional
28033 MMX instruction set support.
28034
28035 winchip2
28036 IDT WinChip 2 CPU, dealt in same way as i486 with additional
28037 MMX and 3DNow! instruction set support.
28038
28039 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
28040 scheduling is implemented for this chip.)
28041
28042 c3-2
28043 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
28044 support. (No scheduling is implemented for this chip.)
28045
28046 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
28047 set support. (No scheduling is implemented for this chip.)
28048
28049 samuel-2
28050 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
28051 support. (No scheduling is implemented for this chip.)
28052
28053 nehemiah
28054 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
28055 (No scheduling is implemented for this chip.)
28056
28057 esther
28058 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
28059 set support. (No scheduling is implemented for this chip.)
28060
28061 eden-x2
28062 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
28063 instruction set support. (No scheduling is implemented for
28064 this chip.)
28065
28066 eden-x4
28067 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
28068 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
28069 scheduling is implemented for this chip.)
28070
28071 nano
28072 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
28073 SSSE3 instruction set support. (No scheduling is implemented
28074 for this chip.)
28075
28076 nano-1000
28077 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28078 instruction set support. (No scheduling is implemented for
28079 this chip.)
28080
28081 nano-2000
28082 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28083 instruction set support. (No scheduling is implemented for
28084 this chip.)
28085
28086 nano-3000
28087 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
28088 SSE4.1 instruction set support. (No scheduling is implemented
28089 for this chip.)
28090
28091 nano-x2
28092 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
28093 and SSE4.1 instruction set support. (No scheduling is
28094 implemented for this chip.)
28095
28096 nano-x4
28097 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
28098 and SSE4.1 instruction set support. (No scheduling is
28099 implemented for this chip.)
28100
28101 lujiazui
28102 ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3,
28103 SSSE3, SSE4.1, SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE,
28104 XSAVEOPT, FSGSBASE, CX16, ABM, BMI, BMI2, F16C, FXSR, RDSEED
28105 instruction set support.
28106
28107 geode
28108 AMD Geode embedded processor with MMX and 3DNow! instruction
28109 set support.
28110
28111 -mtune=cpu-type
28112 Tune to cpu-type everything applicable about the generated code,
28113 except for the ABI and the set of available instructions. While
28114 picking a specific cpu-type schedules things appropriately for that
28115 particular chip, the compiler does not generate any code that
28116 cannot run on the default machine type unless you use a -march=cpu-
28117 type option. For example, if GCC is configured for
28118 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
28119 for Pentium 4 but still runs on i686 machines.
28120
28121 The choices for cpu-type are the same as for -march. In addition,
28122 -mtune supports 2 extra choices for cpu-type:
28123
28124 generic
28125 Produce code optimized for the most common IA32/AMD64/EM64T
28126 processors. If you know the CPU on which your code will run,
28127 then you should use the corresponding -mtune or -march option
28128 instead of -mtune=generic. But, if you do not know exactly
28129 what CPU users of your application will have, then you should
28130 use this option.
28131
28132 As new processors are deployed in the marketplace, the behavior
28133 of this option will change. Therefore, if you upgrade to a
28134 newer version of GCC, code generation controlled by this option
28135 will change to reflect the processors that are most common at
28136 the time that version of GCC is released.
28137
28138 There is no -march=generic option because -march indicates the
28139 instruction set the compiler can use, and there is no generic
28140 instruction set applicable to all processors. In contrast,
28141 -mtune indicates the processor (or, in this case, collection of
28142 processors) for which the code is optimized.
28143
28144 intel
28145 Produce code optimized for the most current Intel processors,
28146 which are Haswell and Silvermont for this version of GCC. If
28147 you know the CPU on which your code will run, then you should
28148 use the corresponding -mtune or -march option instead of
28149 -mtune=intel. But, if you want your application performs
28150 better on both Haswell and Silvermont, then you should use this
28151 option.
28152
28153 As new Intel processors are deployed in the marketplace, the
28154 behavior of this option will change. Therefore, if you upgrade
28155 to a newer version of GCC, code generation controlled by this
28156 option will change to reflect the most current Intel processors
28157 at the time that version of GCC is released.
28158
28159 There is no -march=intel option because -march indicates the
28160 instruction set the compiler can use, and there is no common
28161 instruction set applicable to all processors. In contrast,
28162 -mtune indicates the processor (or, in this case, collection of
28163 processors) for which the code is optimized.
28164
28165 -mcpu=cpu-type
28166 A deprecated synonym for -mtune.
28167
28168 -mfpmath=unit
28169 Generate floating-point arithmetic for selected unit unit. The
28170 choices for unit are:
28171
28172 387 Use the standard 387 floating-point coprocessor present on the
28173 majority of chips and emulated otherwise. Code compiled with
28174 this option runs almost everywhere. The temporary results are
28175 computed in 80-bit precision instead of the precision specified
28176 by the type, resulting in slightly different results compared
28177 to most of other chips. See -ffloat-store for more detailed
28178 description.
28179
28180 This is the default choice for non-Darwin x86-32 targets.
28181
28182 sse Use scalar floating-point instructions present in the SSE
28183 instruction set. This instruction set is supported by Pentium
28184 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
28185 and Athlon MP chips. The earlier version of the SSE
28186 instruction set supports only single-precision arithmetic, thus
28187 the double and extended-precision arithmetic are still done
28188 using 387. A later version, present only in Pentium 4 and AMD
28189 x86-64 chips, supports double-precision arithmetic too.
28190
28191 For the x86-32 compiler, you must use -march=cpu-type, -msse or
28192 -msse2 switches to enable SSE extensions and make this option
28193 effective. For the x86-64 compiler, these extensions are
28194 enabled by default.
28195
28196 The resulting code should be considerably faster in the
28197 majority of cases and avoid the numerical instability problems
28198 of 387 code, but may break some existing code that expects
28199 temporaries to be 80 bits.
28200
28201 This is the default choice for the x86-64 compiler, Darwin
28202 x86-32 targets, and the default choice for x86-32 targets with
28203 the SSE2 instruction set when -ffast-math is enabled.
28204
28205 sse,387
28206 sse+387
28207 both
28208 Attempt to utilize both instruction sets at once. This
28209 effectively doubles the amount of available registers, and on
28210 chips with separate execution units for 387 and SSE the
28211 execution resources too. Use this option with care, as it is
28212 still experimental, because the GCC register allocator does not
28213 model separate functional units well, resulting in unstable
28214 performance.
28215
28216 -masm=dialect
28217 Output assembly instructions using selected dialect. Also affects
28218 which dialect is used for basic "asm" and extended "asm". Supported
28219 choices (in dialect order) are att or intel. The default is att.
28220 Darwin does not support intel.
28221
28222 -mieee-fp
28223 -mno-ieee-fp
28224 Control whether or not the compiler uses IEEE floating-point
28225 comparisons. These correctly handle the case where the result of a
28226 comparison is unordered.
28227
28228 -m80387
28229 -mhard-float
28230 Generate output containing 80387 instructions for floating point.
28231
28232 -mno-80387
28233 -msoft-float
28234 Generate output containing library calls for floating point.
28235
28236 Warning: the requisite libraries are not part of GCC. Normally the
28237 facilities of the machine's usual C compiler are used, but this
28238 cannot be done directly in cross-compilation. You must make your
28239 own arrangements to provide suitable library functions for cross-
28240 compilation.
28241
28242 On machines where a function returns floating-point results in the
28243 80387 register stack, some floating-point opcodes may be emitted
28244 even if -msoft-float is used.
28245
28246 -mno-fp-ret-in-387
28247 Do not use the FPU registers for return values of functions.
28248
28249 The usual calling convention has functions return values of types
28250 "float" and "double" in an FPU register, even if there is no FPU.
28251 The idea is that the operating system should emulate an FPU.
28252
28253 The option -mno-fp-ret-in-387 causes such values to be returned in
28254 ordinary CPU registers instead.
28255
28256 -mno-fancy-math-387
28257 Some 387 emulators do not support the "sin", "cos" and "sqrt"
28258 instructions for the 387. Specify this option to avoid generating
28259 those instructions. This option is overridden when -march
28260 indicates that the target CPU always has an FPU and so the
28261 instruction does not need emulation. These instructions are not
28262 generated unless you also use the -funsafe-math-optimizations
28263 switch.
28264
28265 -malign-double
28266 -mno-align-double
28267 Control whether GCC aligns "double", "long double", and "long long"
28268 variables on a two-word boundary or a one-word boundary. Aligning
28269 "double" variables on a two-word boundary produces code that runs
28270 somewhat faster on a Pentium at the expense of more memory.
28271
28272 On x86-64, -malign-double is enabled by default.
28273
28274 Warning: if you use the -malign-double switch, structures
28275 containing the above types are aligned differently than the
28276 published application binary interface specifications for the
28277 x86-32 and are not binary compatible with structures in code
28278 compiled without that switch.
28279
28280 -m96bit-long-double
28281 -m128bit-long-double
28282 These switches control the size of "long double" type. The x86-32
28283 application binary interface specifies the size to be 96 bits, so
28284 -m96bit-long-double is the default in 32-bit mode.
28285
28286 Modern architectures (Pentium and newer) prefer "long double" to be
28287 aligned to an 8- or 16-byte boundary. In arrays or structures
28288 conforming to the ABI, this is not possible. So specifying
28289 -m128bit-long-double aligns "long double" to a 16-byte boundary by
28290 padding the "long double" with an additional 32-bit zero.
28291
28292 In the x86-64 compiler, -m128bit-long-double is the default choice
28293 as its ABI specifies that "long double" is aligned on 16-byte
28294 boundary.
28295
28296 Notice that neither of these options enable any extra precision
28297 over the x87 standard of 80 bits for a "long double".
28298
28299 Warning: if you override the default value for your target ABI,
28300 this changes the size of structures and arrays containing "long
28301 double" variables, as well as modifying the function calling
28302 convention for functions taking "long double". Hence they are not
28303 binary-compatible with code compiled without that switch.
28304
28305 -mlong-double-64
28306 -mlong-double-80
28307 -mlong-double-128
28308 These switches control the size of "long double" type. A size of 64
28309 bits makes the "long double" type equivalent to the "double" type.
28310 This is the default for 32-bit Bionic C library. A size of 128
28311 bits makes the "long double" type equivalent to the "__float128"
28312 type. This is the default for 64-bit Bionic C library.
28313
28314 Warning: if you override the default value for your target ABI,
28315 this changes the size of structures and arrays containing "long
28316 double" variables, as well as modifying the function calling
28317 convention for functions taking "long double". Hence they are not
28318 binary-compatible with code compiled without that switch.
28319
28320 -malign-data=type
28321 Control how GCC aligns variables. Supported values for type are
28322 compat uses increased alignment value compatible uses GCC 4.8 and
28323 earlier, abi uses alignment value as specified by the psABI, and
28324 cacheline uses increased alignment value to match the cache line
28325 size. compat is the default.
28326
28327 -mlarge-data-threshold=threshold
28328 When -mcmodel=medium is specified, data objects larger than
28329 threshold are placed in the large data section. This value must be
28330 the same across all objects linked into the binary, and defaults to
28331 65535.
28332
28333 -mrtd
28334 Use a different function-calling convention, in which functions
28335 that take a fixed number of arguments return with the "ret num"
28336 instruction, which pops their arguments while returning. This
28337 saves one instruction in the caller since there is no need to pop
28338 the arguments there.
28339
28340 You can specify that an individual function is called with this
28341 calling sequence with the function attribute "stdcall". You can
28342 also override the -mrtd option by using the function attribute
28343 "cdecl".
28344
28345 Warning: this calling convention is incompatible with the one
28346 normally used on Unix, so you cannot use it if you need to call
28347 libraries compiled with the Unix compiler.
28348
28349 Also, you must provide function prototypes for all functions that
28350 take variable numbers of arguments (including "printf"); otherwise
28351 incorrect code is generated for calls to those functions.
28352
28353 In addition, seriously incorrect code results if you call a
28354 function with too many arguments. (Normally, extra arguments are
28355 harmlessly ignored.)
28356
28357 -mregparm=num
28358 Control how many registers are used to pass integer arguments. By
28359 default, no registers are used to pass arguments, and at most 3
28360 registers can be used. You can control this behavior for a
28361 specific function by using the function attribute "regparm".
28362
28363 Warning: if you use this switch, and num is nonzero, then you must
28364 build all modules with the same value, including any libraries.
28365 This includes the system libraries and startup modules.
28366
28367 -msseregparm
28368 Use SSE register passing conventions for float and double arguments
28369 and return values. You can control this behavior for a specific
28370 function by using the function attribute "sseregparm".
28371
28372 Warning: if you use this switch then you must build all modules
28373 with the same value, including any libraries. This includes the
28374 system libraries and startup modules.
28375
28376 -mvect8-ret-in-mem
28377 Return 8-byte vectors in memory instead of MMX registers. This is
28378 the default on VxWorks to match the ABI of the Sun Studio compilers
28379 until version 12. Only use this option if you need to remain
28380 compatible with existing code produced by those previous compiler
28381 versions or older versions of GCC.
28382
28383 -mpc32
28384 -mpc64
28385 -mpc80
28386 Set 80387 floating-point precision to 32, 64 or 80 bits. When
28387 -mpc32 is specified, the significands of results of floating-point
28388 operations are rounded to 24 bits (single precision); -mpc64 rounds
28389 the significands of results of floating-point operations to 53 bits
28390 (double precision) and -mpc80 rounds the significands of results of
28391 floating-point operations to 64 bits (extended double precision),
28392 which is the default. When this option is used, floating-point
28393 operations in higher precisions are not available to the programmer
28394 without setting the FPU control word explicitly.
28395
28396 Setting the rounding of floating-point operations to less than the
28397 default 80 bits can speed some programs by 2% or more. Note that
28398 some mathematical libraries assume that extended-precision (80-bit)
28399 floating-point operations are enabled by default; routines in such
28400 libraries could suffer significant loss of accuracy, typically
28401 through so-called "catastrophic cancellation", when this option is
28402 used to set the precision to less than extended precision.
28403
28404 -mdaz-ftz
28405 The flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the
28406 MXCSR register are used to control floating-point calculations.SSE
28407 and AVX instructions including scalar and vector instructions could
28408 benefit from enabling the FTZ and DAZ flags when -mdaz-ftz is
28409 specified. Don't set FTZ/DAZ flags when -mno-daz-ftz or -shared is
28410 specified, -mdaz-ftz will set FTZ/DAZ flags even with -shared.
28411
28412 -mstackrealign
28413 Realign the stack at entry. On the x86, the -mstackrealign option
28414 generates an alternate prologue and epilogue that realigns the run-
28415 time stack if necessary. This supports mixing legacy codes that
28416 keep 4-byte stack alignment with modern codes that keep 16-byte
28417 stack alignment for SSE compatibility. See also the attribute
28418 "force_align_arg_pointer", applicable to individual functions.
28419
28420 -mpreferred-stack-boundary=num
28421 Attempt to keep the stack boundary aligned to a 2 raised to num
28422 byte boundary. If -mpreferred-stack-boundary is not specified, the
28423 default is 4 (16 bytes or 128 bits).
28424
28425 Warning: When generating code for the x86-64 architecture with SSE
28426 extensions disabled, -mpreferred-stack-boundary=3 can be used to
28427 keep the stack boundary aligned to 8 byte boundary. Since x86-64
28428 ABI require 16 byte stack alignment, this is ABI incompatible and
28429 intended to be used in controlled environment where stack space is
28430 important limitation. This option leads to wrong code when
28431 functions compiled with 16 byte stack alignment (such as functions
28432 from a standard library) are called with misaligned stack. In this
28433 case, SSE instructions may lead to misaligned memory access traps.
28434 In addition, variable arguments are handled incorrectly for 16 byte
28435 aligned objects (including x87 long double and __int128), leading
28436 to wrong results. You must build all modules with
28437 -mpreferred-stack-boundary=3, including any libraries. This
28438 includes the system libraries and startup modules.
28439
28440 -mincoming-stack-boundary=num
28441 Assume the incoming stack is aligned to a 2 raised to num byte
28442 boundary. If -mincoming-stack-boundary is not specified, the one
28443 specified by -mpreferred-stack-boundary is used.
28444
28445 On Pentium and Pentium Pro, "double" and "long double" values
28446 should be aligned to an 8-byte boundary (see -malign-double) or
28447 suffer significant run time performance penalties. On Pentium III,
28448 the Streaming SIMD Extension (SSE) data type "__m128" may not work
28449 properly if it is not 16-byte aligned.
28450
28451 To ensure proper alignment of this values on the stack, the stack
28452 boundary must be as aligned as that required by any value stored on
28453 the stack. Further, every function must be generated such that it
28454 keeps the stack aligned. Thus calling a function compiled with a
28455 higher preferred stack boundary from a function compiled with a
28456 lower preferred stack boundary most likely misaligns the stack. It
28457 is recommended that libraries that use callbacks always use the
28458 default setting.
28459
28460 This extra alignment does consume extra stack space, and generally
28461 increases code size. Code that is sensitive to stack space usage,
28462 such as embedded systems and operating system kernels, may want to
28463 reduce the preferred alignment to -mpreferred-stack-boundary=2.
28464
28465 -mmmx
28466 -msse
28467 -msse2
28468 -msse3
28469 -mssse3
28470 -msse4
28471 -msse4a
28472 -msse4.1
28473 -msse4.2
28474 -mavx
28475 -mavx2
28476 -mavx512f
28477 -mavx512pf
28478 -mavx512er
28479 -mavx512cd
28480 -mavx512vl
28481 -mavx512bw
28482 -mavx512dq
28483 -mavx512ifma
28484 -mavx512vbmi
28485 -msha
28486 -maes
28487 -mpclmul
28488 -mclflushopt
28489 -mclwb
28490 -mfsgsbase
28491 -mptwrite
28492 -mrdrnd
28493 -mf16c
28494 -mfma
28495 -mpconfig
28496 -mwbnoinvd
28497 -mfma4
28498 -mprfchw
28499 -mrdpid
28500 -mprefetchwt1
28501 -mrdseed
28502 -msgx
28503 -mxop
28504 -mlwp
28505 -m3dnow
28506 -m3dnowa
28507 -mpopcnt
28508 -mabm
28509 -madx
28510 -mbmi
28511 -mbmi2
28512 -mlzcnt
28513 -mfxsr
28514 -mxsave
28515 -mxsaveopt
28516 -mxsavec
28517 -mxsaves
28518 -mrtm
28519 -mhle
28520 -mtbm
28521 -mmwaitx
28522 -mclzero
28523 -mpku
28524 -mavx512vbmi2
28525 -mavx512bf16
28526 -mavx512fp16
28527 -mgfni
28528 -mvaes
28529 -mwaitpkg
28530 -mvpclmulqdq
28531 -mavx512bitalg
28532 -mmovdiri
28533 -mmovdir64b
28534 -menqcmd
28535 -muintr
28536 -mtsxldtrk
28537 -mavx512vpopcntdq
28538 -mavx512vp2intersect
28539 -mavx5124fmaps
28540 -mavx512vnni
28541 -mavxvnni
28542 -mavx5124vnniw
28543 -mcldemote
28544 -mserialize
28545 -mamx-tile
28546 -mamx-int8
28547 -mamx-bf16
28548 -mhreset
28549 -mkl
28550 -mwidekl
28551 -mavxifma
28552 -mavxvnniint8
28553 -mavxneconvert
28554 -mcmpccxadd
28555 -mamx-fp16
28556 -mprefetchi
28557 -mraoint
28558 -mamx-complex
28559 These switches enable the use of instructions in the MMX, SSE,
28560 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
28561 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
28562 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
28563 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
28564 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
28565 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28566 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
28567 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
28568 MOVDIRI, MOVDIR64B, AVX512BF16, ENQCMD, AVX512VPOPCNTDQ,
28569 AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE, UINTR, HRESET,
28570 AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512-FP16,
28571 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AMX-FP16, PREFETCHI,
28572 RAOINT, AMX-COMPLEX or CLDEMOTE extended instruction sets. Each has
28573 a corresponding -mno- option to disable use of these instructions.
28574
28575 These extensions are also available as built-in functions: see x86
28576 Built-in Functions, for details of the functions enabled and
28577 disabled by these switches.
28578
28579 To generate SSE/SSE2 instructions automatically from floating-point
28580 code (as opposed to 387 instructions), see -mfpmath=sse.
28581
28582 GCC depresses SSEx instructions when -mavx is used. Instead, it
28583 generates new AVX instructions or AVX equivalence for all SSEx
28584 instructions when needed.
28585
28586 These options enable GCC to use these extended instructions in
28587 generated code, even without -mfpmath=sse. Applications that
28588 perform run-time CPU detection must compile separate files for each
28589 supported architecture, using the appropriate flags. In
28590 particular, the file containing the CPU detection code should be
28591 compiled without these options.
28592
28593 -mdump-tune-features
28594 This option instructs GCC to dump the names of the x86 performance
28595 tuning features and default settings. The names can be used in
28596 -mtune-ctrl=feature-list.
28597
28598 -mtune-ctrl=feature-list
28599 This option is used to do fine grain control of x86 code generation
28600 features. feature-list is a comma separated list of feature names.
28601 See also -mdump-tune-features. When specified, the feature is
28602 turned on if it is not preceded with ^, otherwise, it is turned
28603 off. -mtune-ctrl=feature-list is intended to be used by GCC
28604 developers. Using it may lead to code paths not covered by testing
28605 and can potentially result in compiler ICEs or runtime errors.
28606
28607 -mno-default
28608 This option instructs GCC to turn off all tunable features. See
28609 also -mtune-ctrl=feature-list and -mdump-tune-features.
28610
28611 -mcld
28612 This option instructs GCC to emit a "cld" instruction in the
28613 prologue of functions that use string instructions. String
28614 instructions depend on the DF flag to select between autoincrement
28615 or autodecrement mode. While the ABI specifies the DF flag to be
28616 cleared on function entry, some operating systems violate this
28617 specification by not clearing the DF flag in their exception
28618 dispatchers. The exception handler can be invoked with the DF flag
28619 set, which leads to wrong direction mode when string instructions
28620 are used. This option can be enabled by default on 32-bit x86
28621 targets by configuring GCC with the --enable-cld configure option.
28622 Generation of "cld" instructions can be suppressed with the
28623 -mno-cld compiler option in this case.
28624
28625 -mvzeroupper
28626 This option instructs GCC to emit a "vzeroupper" instruction before
28627 a transfer of control flow out of the function to minimize the AVX
28628 to SSE transition penalty as well as remove unnecessary "zeroupper"
28629 intrinsics.
28630
28631 -mprefer-avx128
28632 This option instructs GCC to use 128-bit AVX instructions instead
28633 of 256-bit AVX instructions in the auto-vectorizer.
28634
28635 -mprefer-vector-width=opt
28636 This option instructs GCC to use opt-bit vector width in
28637 instructions instead of default on the selected platform.
28638
28639 -mmove-max=bits
28640 This option instructs GCC to set the maximum number of bits can be
28641 moved from memory to memory efficiently to bits. The valid bits
28642 are 128, 256 and 512.
28643
28644 -mstore-max=bits
28645 This option instructs GCC to set the maximum number of bits can be
28646 stored to memory efficiently to bits. The valid bits are 128, 256
28647 and 512.
28648
28649 none
28650 No extra limitations applied to GCC other than defined by the
28651 selected platform.
28652
28653 128 Prefer 128-bit vector width for instructions.
28654
28655 256 Prefer 256-bit vector width for instructions.
28656
28657 512 Prefer 512-bit vector width for instructions.
28658
28659 -mcx16
28660 This option enables GCC to generate "CMPXCHG16B" instructions in
28661 64-bit code to implement compare-and-exchange operations on 16-byte
28662 aligned 128-bit objects. This is useful for atomic updates of data
28663 structures exceeding one machine word in size. The compiler uses
28664 this instruction to implement __sync Builtins. However, for
28665 __atomic Builtins operating on 128-bit integers, a library call is
28666 always used.
28667
28668 -msahf
28669 This option enables generation of "SAHF" instructions in 64-bit
28670 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
28671 the introduction of Pentium 4 G1 step in December 2005, lacked the
28672 "LAHF" and "SAHF" instructions which are supported by AMD64. These
28673 are load and store instructions, respectively, for certain status
28674 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
28675 "fmod", "drem", and "remainder" built-in functions; see Other
28676 Builtins for details.
28677
28678 -mmovbe
28679 This option enables use of the "movbe" instruction to implement
28680 "__builtin_bswap32" and "__builtin_bswap64".
28681
28682 -mshstk
28683 The -mshstk option enables shadow stack built-in functions from x86
28684 Control-flow Enforcement Technology (CET).
28685
28686 -mcrc32
28687 This option enables built-in functions "__builtin_ia32_crc32qi",
28688 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
28689 "__builtin_ia32_crc32di" to generate the "crc32" machine
28690 instruction.
28691
28692 -mmwait
28693 This option enables built-in functions "__builtin_ia32_monitor",
28694 and "__builtin_ia32_mwait" to generate the "monitor" and "mwait"
28695 machine instructions.
28696
28697 -mrecip
28698 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
28699 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
28700 Newton-Raphson step to increase precision instead of "DIVSS" and
28701 "SQRTSS" (and their vectorized variants) for single-precision
28702 floating-point arguments. These instructions are generated only
28703 when -funsafe-math-optimizations is enabled together with
28704 -ffinite-math-only and -fno-trapping-math. Note that while the
28705 throughput of the sequence is higher than the throughput of the
28706 non-reciprocal instruction, the precision of the sequence can be
28707 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
28708 0.99999994).
28709
28710 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
28711 "RSQRTPS") already with -ffast-math (or the above option
28712 combination), and doesn't need -mrecip.
28713
28714 Also note that GCC emits the above sequence with additional Newton-
28715 Raphson step for vectorized single-float division and vectorized
28716 sqrtf(x) already with -ffast-math (or the above option
28717 combination), and doesn't need -mrecip.
28718
28719 -mrecip=opt
28720 This option controls which reciprocal estimate instructions may be
28721 used. opt is a comma-separated list of options, which may be
28722 preceded by a ! to invert the option:
28723
28724 all Enable all estimate instructions.
28725
28726 default
28727 Enable the default instructions, equivalent to -mrecip.
28728
28729 none
28730 Disable all estimate instructions, equivalent to -mno-recip.
28731
28732 div Enable the approximation for scalar division.
28733
28734 vec-div
28735 Enable the approximation for vectorized division.
28736
28737 sqrt
28738 Enable the approximation for scalar square root.
28739
28740 vec-sqrt
28741 Enable the approximation for vectorized square root.
28742
28743 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
28744 approximations, except for square root.
28745
28746 -mveclibabi=type
28747 Specifies the ABI type to use for vectorizing intrinsics using an
28748 external library. Supported values for type are svml for the Intel
28749 short vector math library and acml for the AMD math core library.
28750 To use this option, both -ftree-vectorize and
28751 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
28752 ABI-compatible library must be specified at link time.
28753
28754 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
28755 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
28756 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
28757 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
28758 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
28759 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
28760 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
28761 and "vmlsAcos4" for corresponding function type when
28762 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
28763 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
28764 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
28765 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
28766 corresponding function type when -mveclibabi=acml is used.
28767
28768 -mabi=name
28769 Generate code for the specified calling convention. Permissible
28770 values are sysv for the ABI used on GNU/Linux and other systems,
28771 and ms for the Microsoft ABI. The default is to use the Microsoft
28772 ABI when targeting Microsoft Windows and the SysV ABI on all other
28773 systems. You can control this behavior for specific functions by
28774 using the function attributes "ms_abi" and "sysv_abi".
28775
28776 -mforce-indirect-call
28777 Force all calls to functions to be indirect. This is useful when
28778 using Intel Processor Trace where it generates more precise timing
28779 information for function calls.
28780
28781 -mmanual-endbr
28782 Insert ENDBR instruction at function entry only via the "cf_check"
28783 function attribute. This is useful when used with the option
28784 -fcf-protection=branch to control ENDBR insertion at the function
28785 entry.
28786
28787 -mcet-switch
28788 By default, CET instrumentation is turned off on switch statements
28789 that use a jump table and indirect branch track is disabled. Since
28790 jump tables are stored in read-only memory, this does not result in
28791 a direct loss of hardening. But if the jump table index is
28792 attacker-controlled, the indirect jump may not be constrained by
28793 CET. This option turns on CET instrumentation to enable indirect
28794 branch track for switch statements with jump tables which leads to
28795 the jump targets reachable via any indirect jumps.
28796
28797 -mcall-ms2sysv-xlogues
28798 Due to differences in 64-bit ABIs, any Microsoft ABI function that
28799 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
28800 clobbered. By default, the code for saving and restoring these
28801 registers is emitted inline, resulting in fairly lengthy prologues
28802 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
28803 epilogues that use stubs in the static portion of libgcc to perform
28804 these saves and restores, thus reducing function size at the cost
28805 of a few extra instructions.
28806
28807 -mtls-dialect=type
28808 Generate code to access thread-local storage using the gnu or gnu2
28809 conventions. gnu is the conservative default; gnu2 is more
28810 efficient, but it may add compile- and run-time requirements that
28811 cannot be satisfied on all systems.
28812
28813 -mpush-args
28814 -mno-push-args
28815 Use PUSH operations to store outgoing parameters. This method is
28816 shorter and usually equally fast as method using SUB/MOV operations
28817 and is enabled by default. In some cases disabling it may improve
28818 performance because of improved scheduling and reduced
28819 dependencies.
28820
28821 -maccumulate-outgoing-args
28822 If enabled, the maximum amount of space required for outgoing
28823 arguments is computed in the function prologue. This is faster on
28824 most modern CPUs because of reduced dependencies, improved
28825 scheduling and reduced stack usage when the preferred stack
28826 boundary is not equal to 2. The drawback is a notable increase in
28827 code size. This switch implies -mno-push-args.
28828
28829 -mthreads
28830 Support thread-safe exception handling on MinGW. Programs that
28831 rely on thread-safe exception handling must compile and link all
28832 code with the -mthreads option. When compiling, -mthreads defines
28833 -D_MT; when linking, it links in a special thread helper library
28834 -lmingwthrd which cleans up per-thread exception-handling data.
28835
28836 -mms-bitfields
28837 -mno-ms-bitfields
28838 Enable/disable bit-field layout compatible with the native
28839 Microsoft Windows compiler.
28840
28841 If "packed" is used on a structure, or if bit-fields are used, it
28842 may be that the Microsoft ABI lays out the structure differently
28843 than the way GCC normally does. Particularly when moving packed
28844 data between functions compiled with GCC and the native Microsoft
28845 compiler (either via function call or as data in a file), it may be
28846 necessary to access either format.
28847
28848 This option is enabled by default for Microsoft Windows targets.
28849 This behavior can also be controlled locally by use of variable or
28850 type attributes. For more information, see x86 Variable Attributes
28851 and x86 Type Attributes.
28852
28853 The Microsoft structure layout algorithm is fairly simple with the
28854 exception of the bit-field packing. The padding and alignment of
28855 members of structures and whether a bit-field can straddle a
28856 storage-unit boundary are determine by these rules:
28857
28858 1. Structure members are stored sequentially in the order in which
28859 they are
28860 declared: the first member has the lowest memory address and
28861 the last member the highest.
28862
28863 2. Every data object has an alignment requirement. The alignment
28864 requirement
28865 for all data except structures, unions, and arrays is either
28866 the size of the object or the current packing size (specified
28867 with either the "aligned" attribute or the "pack" pragma),
28868 whichever is less. For structures, unions, and arrays, the
28869 alignment requirement is the largest alignment requirement of
28870 its members. Every object is allocated an offset so that:
28871
28872 offset % alignment_requirement == 0
28873
28874 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
28875 allocation
28876 unit if the integral types are the same size and if the next
28877 bit-field fits into the current allocation unit without
28878 crossing the boundary imposed by the common alignment
28879 requirements of the bit-fields.
28880
28881 MSVC interprets zero-length bit-fields in the following ways:
28882
28883 1. If a zero-length bit-field is inserted between two bit-fields
28884 that
28885 are normally coalesced, the bit-fields are not coalesced.
28886
28887 For example:
28888
28889 struct
28890 {
28891 unsigned long bf_1 : 12;
28892 unsigned long : 0;
28893 unsigned long bf_2 : 12;
28894 } t1;
28895
28896 The size of "t1" is 8 bytes with the zero-length bit-field. If
28897 the zero-length bit-field were removed, "t1"'s size would be 4
28898 bytes.
28899
28900 2. If a zero-length bit-field is inserted after a bit-field, "foo",
28901 and the
28902 alignment of the zero-length bit-field is greater than the
28903 member that follows it, "bar", "bar" is aligned as the type of
28904 the zero-length bit-field.
28905
28906 For example:
28907
28908 struct
28909 {
28910 char foo : 4;
28911 short : 0;
28912 char bar;
28913 } t2;
28914
28915 struct
28916 {
28917 char foo : 4;
28918 short : 0;
28919 double bar;
28920 } t3;
28921
28922 For "t2", "bar" is placed at offset 2, rather than offset 1.
28923 Accordingly, the size of "t2" is 4. For "t3", the zero-length
28924 bit-field does not affect the alignment of "bar" or, as a
28925 result, the size of the structure.
28926
28927 Taking this into account, it is important to note the
28928 following:
28929
28930 1. If a zero-length bit-field follows a normal bit-field, the
28931 type of the
28932 zero-length bit-field may affect the alignment of the
28933 structure as whole. For example, "t2" has a size of 4
28934 bytes, since the zero-length bit-field follows a normal
28935 bit-field, and is of type short.
28936
28937 2. Even if a zero-length bit-field is not followed by a normal
28938 bit-field, it may
28939 still affect the alignment of the structure:
28940
28941 struct
28942 {
28943 char foo : 6;
28944 long : 0;
28945 } t4;
28946
28947 Here, "t4" takes up 4 bytes.
28948
28949 3. Zero-length bit-fields following non-bit-field members are
28950 ignored:
28951 struct
28952 {
28953 char foo;
28954 long : 0;
28955 char bar;
28956 } t5;
28957
28958 Here, "t5" takes up 2 bytes.
28959
28960 -mno-align-stringops
28961 Do not align the destination of inlined string operations. This
28962 switch reduces code size and improves performance in case the
28963 destination is already aligned, but GCC doesn't know about it.
28964
28965 -minline-all-stringops
28966 By default GCC inlines string operations only when the destination
28967 is known to be aligned to least a 4-byte boundary. This enables
28968 more inlining and increases code size, but may improve performance
28969 of code that depends on fast "memcpy" and "memset" for short
28970 lengths. The option enables inline expansion of "strlen" for all
28971 pointer alignments.
28972
28973 -minline-stringops-dynamically
28974 For string operations of unknown size, use run-time checks with
28975 inline code for small blocks and a library call for large blocks.
28976
28977 -mstringop-strategy=alg
28978 Override the internal decision heuristic for the particular
28979 algorithm to use for inlining string operations. The allowed
28980 values for alg are:
28981
28982 rep_byte
28983 rep_4byte
28984 rep_8byte
28985 Expand using i386 "rep" prefix of the specified size.
28986
28987 byte_loop
28988 loop
28989 unrolled_loop
28990 Expand into an inline loop.
28991
28992 libcall
28993 Always use a library call.
28994
28995 -mmemcpy-strategy=strategy
28996 Override the internal decision heuristic to decide if
28997 "__builtin_memcpy" should be inlined and what inline algorithm to
28998 use when the expected size of the copy operation is known. strategy
28999 is a comma-separated list of alg:max_size:dest_align triplets. alg
29000 is specified in -mstringop-strategy, max_size specifies the max
29001 byte size with which inline algorithm alg is allowed. For the last
29002 triplet, the max_size must be -1. The max_size of the triplets in
29003 the list must be specified in increasing order. The minimal byte
29004 size for alg is 0 for the first triplet and "max_size + 1" of the
29005 preceding range.
29006
29007 -mmemset-strategy=strategy
29008 The option is similar to -mmemcpy-strategy= except that it is to
29009 control "__builtin_memset" expansion.
29010
29011 -momit-leaf-frame-pointer
29012 Don't keep the frame pointer in a register for leaf functions.
29013 This avoids the instructions to save, set up, and restore frame
29014 pointers and makes an extra register available in leaf functions.
29015 The option -fomit-leaf-frame-pointer removes the frame pointer for
29016 leaf functions, which might make debugging harder.
29017
29018 -mtls-direct-seg-refs
29019 -mno-tls-direct-seg-refs
29020 Controls whether TLS variables may be accessed with offsets from
29021 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
29022 whether the thread base pointer must be added. Whether or not this
29023 is valid depends on the operating system, and whether it maps the
29024 segment to cover the entire TLS area.
29025
29026 For systems that use the GNU C Library, the default is on.
29027
29028 -msse2avx
29029 -mno-sse2avx
29030 Specify that the assembler should encode SSE instructions with VEX
29031 prefix. The option -mavx turns this on by default.
29032
29033 -mfentry
29034 -mno-fentry
29035 If profiling is active (-pg), put the profiling counter call before
29036 the prologue. Note: On x86 architectures the attribute
29037 "ms_hook_prologue" isn't possible at the moment for -mfentry and
29038 -pg.
29039
29040 -mrecord-mcount
29041 -mno-record-mcount
29042 If profiling is active (-pg), generate a __mcount_loc section that
29043 contains pointers to each profiling call. This is useful for
29044 automatically patching and out calls.
29045
29046 -mnop-mcount
29047 -mno-nop-mcount
29048 If profiling is active (-pg), generate the calls to the profiling
29049 functions as NOPs. This is useful when they should be patched in
29050 later dynamically. This is likely only useful together with
29051 -mrecord-mcount.
29052
29053 -minstrument-return=type
29054 Instrument function exit in -pg -mfentry instrumented functions
29055 with call to specified function. This only instruments true returns
29056 ending with ret, but not sibling calls ending with jump. Valid
29057 types are none to not instrument, call to generate a call to
29058 __return__, or nop5 to generate a 5 byte nop.
29059
29060 -mrecord-return
29061 -mno-record-return
29062 Generate a __return_loc section pointing to all return
29063 instrumentation code.
29064
29065 -mfentry-name=name
29066 Set name of __fentry__ symbol called at function entry for -pg
29067 -mfentry functions.
29068
29069 -mfentry-section=name
29070 Set name of section to record -mrecord-mcount calls (default
29071 __mcount_loc).
29072
29073 -mskip-rax-setup
29074 -mno-skip-rax-setup
29075 When generating code for the x86-64 architecture with SSE
29076 extensions disabled, -mskip-rax-setup can be used to skip setting
29077 up RAX register when there are no variable arguments passed in
29078 vector registers.
29079
29080 Warning: Since RAX register is used to avoid unnecessarily saving
29081 vector registers on stack when passing variable arguments, the
29082 impacts of this option are callees may waste some stack space,
29083 misbehave or jump to a random location. GCC 4.4 or newer don't
29084 have those issues, regardless the RAX register value.
29085
29086 -m8bit-idiv
29087 -mno-8bit-idiv
29088 On some processors, like Intel Atom, 8-bit unsigned integer divide
29089 is much faster than 32-bit/64-bit integer divide. This option
29090 generates a run-time check. If both dividend and divisor are
29091 within range of 0 to 255, 8-bit unsigned integer divide is used
29092 instead of 32-bit/64-bit integer divide.
29093
29094 -mavx256-split-unaligned-load
29095 -mavx256-split-unaligned-store
29096 Split 32-byte AVX unaligned load and store.
29097
29098 -mstack-protector-guard=guard
29099 -mstack-protector-guard-reg=reg
29100 -mstack-protector-guard-offset=offset
29101 Generate stack protection code using canary at guard. Supported
29102 locations are global for global canary or tls for per-thread canary
29103 in the TLS block (the default). This option has effect only when
29104 -fstack-protector or -fstack-protector-all is specified.
29105
29106 With the latter choice the options -mstack-protector-guard-reg=reg
29107 and -mstack-protector-guard-offset=offset furthermore specify which
29108 segment register (%fs or %gs) to use as base register for reading
29109 the canary, and from what offset from that base register. The
29110 default for those is as specified in the relevant ABI.
29111
29112 -mgeneral-regs-only
29113 Generate code that uses only the general-purpose registers. This
29114 prevents the compiler from using floating-point, vector, mask and
29115 bound registers.
29116
29117 -mrelax-cmpxchg-loop
29118 When emitting a compare-and-swap loop for __sync Builtins and
29119 __atomic Builtins lacking a native instruction, optimize for the
29120 highly contended case by issuing an atomic load before the
29121 "CMPXCHG" instruction, and using the "PAUSE" instruction to save
29122 CPU power when restarting the loop.
29123
29124 -mindirect-branch=choice
29125 Convert indirect call and jump with choice. The default is keep,
29126 which keeps indirect call and jump unmodified. thunk converts
29127 indirect call and jump to call and return thunk. thunk-inline
29128 converts indirect call and jump to inlined call and return thunk.
29129 thunk-extern converts indirect call and jump to external call and
29130 return thunk provided in a separate object file. You can control
29131 this behavior for a specific function by using the function
29132 attribute "indirect_branch".
29133
29134 Note that -mcmodel=large is incompatible with
29135 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
29136 the thunk function may not be reachable in the large code model.
29137
29138 Note that -mindirect-branch=thunk-extern is compatible with
29139 -fcf-protection=branch since the external thunk can be made to
29140 enable control-flow check.
29141
29142 -mfunction-return=choice
29143 Convert function return with choice. The default is keep, which
29144 keeps function return unmodified. thunk converts function return
29145 to call and return thunk. thunk-inline converts function return to
29146 inlined call and return thunk. thunk-extern converts function
29147 return to external call and return thunk provided in a separate
29148 object file. You can control this behavior for a specific function
29149 by using the function attribute "function_return".
29150
29151 Note that -mindirect-return=thunk-extern is compatible with
29152 -fcf-protection=branch since the external thunk can be made to
29153 enable control-flow check.
29154
29155 Note that -mcmodel=large is incompatible with
29156 -mfunction-return=thunk and -mfunction-return=thunk-extern since
29157 the thunk function may not be reachable in the large code model.
29158
29159 -mindirect-branch-register
29160 Force indirect call and jump via register.
29161
29162 -mharden-sls=choice
29163 Generate code to mitigate against straight line speculation (SLS)
29164 with choice. The default is none which disables all SLS hardening.
29165 return enables SLS hardening for function returns. indirect-jmp
29166 enables SLS hardening for indirect jumps. all enables all SLS
29167 hardening.
29168
29169 -mindirect-branch-cs-prefix
29170 Add CS prefix to call and jmp to indirect thunk with branch target
29171 in r8-r15 registers so that the call and jmp instruction length is
29172 6 bytes to allow them to be replaced with lfence; call *%r8-r15 or
29173 lfence; jmp *%r8-r15 at run-time.
29174
29175 These -m switches are supported in addition to the above on x86-64
29176 processors in 64-bit environments.
29177
29178 -m32
29179 -m64
29180 -mx32
29181 -m16
29182 -miamcu
29183 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
29184 option sets "int", "long", and pointer types to 32 bits, and
29185 generates code that runs on any i386 system.
29186
29187 The -m64 option sets "int" to 32 bits and "long" and pointer types
29188 to 64 bits, and generates code for the x86-64 architecture. For
29189 Darwin only the -m64 option also turns off the -fno-pic and
29190 -mdynamic-no-pic options.
29191
29192 The -mx32 option sets "int", "long", and pointer types to 32 bits,
29193 and generates code for the x86-64 architecture.
29194
29195 The -m16 option is the same as -m32, except for that it outputs the
29196 ".code16gcc" assembly directive at the beginning of the assembly
29197 output so that the binary can run in 16-bit mode.
29198
29199 The -miamcu option generates code which conforms to Intel MCU
29200 psABI. It requires the -m32 option to be turned on.
29201
29202 -mno-red-zone
29203 Do not use a so-called "red zone" for x86-64 code. The red zone is
29204 mandated by the x86-64 ABI; it is a 128-byte area beyond the
29205 location of the stack pointer that is not modified by signal or
29206 interrupt handlers and therefore can be used for temporary data
29207 without adjusting the stack pointer. The flag -mno-red-zone
29208 disables this red zone.
29209
29210 -mcmodel=small
29211 Generate code for the small code model: the program and its symbols
29212 must be linked in the lower 2 GB of the address space. Pointers
29213 are 64 bits. Programs can be statically or dynamically linked.
29214 This is the default code model.
29215
29216 -mcmodel=kernel
29217 Generate code for the kernel code model. The kernel runs in the
29218 negative 2 GB of the address space. This model has to be used for
29219 Linux kernel code.
29220
29221 -mcmodel=medium
29222 Generate code for the medium model: the program is linked in the
29223 lower 2 GB of the address space. Small symbols are also placed
29224 there. Symbols with sizes larger than -mlarge-data-threshold are
29225 put into large data or BSS sections and can be located above 2GB.
29226 Programs can be statically or dynamically linked.
29227
29228 -mcmodel=large
29229 Generate code for the large model. This model makes no assumptions
29230 about addresses and sizes of sections.
29231
29232 -maddress-mode=long
29233 Generate code for long address mode. This is only supported for
29234 64-bit and x32 environments. It is the default address mode for
29235 64-bit environments.
29236
29237 -maddress-mode=short
29238 Generate code for short address mode. This is only supported for
29239 32-bit and x32 environments. It is the default address mode for
29240 32-bit and x32 environments.
29241
29242 -mneeded
29243 -mno-needed
29244 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
29245 indicate the micro-architecture ISA level required to execute the
29246 binary.
29247
29248 -mno-direct-extern-access
29249 Without -fpic nor -fPIC, always use the GOT pointer to access
29250 external symbols. With -fpic or -fPIC, treat access to protected
29251 symbols as local symbols. The default is -mdirect-extern-access.
29252
29253 Warning: shared libraries compiled with -mno-direct-extern-access
29254 and executable compiled with -mdirect-extern-access may not be
29255 binary compatible if protected symbols are used in shared libraries
29256 and executable.
29257
29258 -munroll-only-small-loops
29259 Controls conservative small loop unrolling. It is default enabled
29260 by O2, and unrolls loop with less than 4 insns by 1 time. Explicit
29261 -f[no-]unroll-[all-]loops would disable this flag to avoid any
29262 unintended unrolling behavior that user does not want.
29263
29264 -mlam=choice
29265 LAM(linear-address masking) allows special bits in the pointer to
29266 be used for metadata. The default is none. With u48, pointer bits
29267 in positions 62:48 can be used for metadata; With u57, pointer bits
29268 in positions 62:57 can be used for metadata.
29269
29270 x86 Windows Options
29271
29272 These additional options are available for Microsoft Windows targets:
29273
29274 -mconsole
29275 This option specifies that a console application is to be
29276 generated, by instructing the linker to set the PE header subsystem
29277 type required for console applications. This option is available
29278 for Cygwin and MinGW targets and is enabled by default on those
29279 targets.
29280
29281 -mdll
29282 This option is available for Cygwin and MinGW targets. It
29283 specifies that a DLL---a dynamic link library---is to be generated,
29284 enabling the selection of the required runtime startup object and
29285 entry point.
29286
29287 -mnop-fun-dllimport
29288 This option is available for Cygwin and MinGW targets. It
29289 specifies that the "dllimport" attribute should be ignored.
29290
29291 -mthreads
29292 This option is available for MinGW targets. It specifies that
29293 MinGW-specific thread support is to be used.
29294
29295 -municode
29296 This option is available for MinGW-w64 targets. It causes the
29297 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
29298 capable runtime startup code.
29299
29300 -mwin32
29301 This option is available for Cygwin and MinGW targets. It
29302 specifies that the typical Microsoft Windows predefined macros are
29303 to be set in the pre-processor, but does not influence the choice
29304 of runtime library/startup code.
29305
29306 -mwindows
29307 This option is available for Cygwin and MinGW targets. It
29308 specifies that a GUI application is to be generated by instructing
29309 the linker to set the PE header subsystem type appropriately.
29310
29311 -fno-set-stack-executable
29312 This option is available for MinGW targets. It specifies that the
29313 executable flag for the stack used by nested functions isn't set.
29314 This is necessary for binaries running in kernel mode of Microsoft
29315 Windows, as there the User32 API, which is used to set executable
29316 privileges, isn't available.
29317
29318 -fwritable-relocated-rdata
29319 This option is available for MinGW and Cygwin targets. It
29320 specifies that relocated-data in read-only section is put into the
29321 ".data" section. This is a necessary for older runtimes not
29322 supporting modification of ".rdata" sections for pseudo-relocation.
29323
29324 -mpe-aligned-commons
29325 This option is available for Cygwin and MinGW targets. It
29326 specifies that the GNU extension to the PE file format that permits
29327 the correct alignment of COMMON variables should be used when
29328 generating code. It is enabled by default if GCC detects that the
29329 target assembler found during configuration supports the feature.
29330
29331 See also under x86 Options for standard options.
29332
29333 Xstormy16 Options
29334
29335 These options are defined for Xstormy16:
29336
29337 -msim
29338 Choose startup files and linker script suitable for the simulator.
29339
29340 Xtensa Options
29341
29342 These options are supported for Xtensa targets:
29343
29344 -mconst16
29345 -mno-const16
29346 Enable or disable use of "CONST16" instructions for loading
29347 constant values. The "CONST16" instruction is currently not a
29348 standard option from Tensilica. When enabled, "CONST16"
29349 instructions are always used in place of the standard "L32R"
29350 instructions. The use of "CONST16" is enabled by default only if
29351 the "L32R" instruction is not available.
29352
29353 -mfused-madd
29354 -mno-fused-madd
29355 Enable or disable use of fused multiply/add and multiply/subtract
29356 instructions in the floating-point option. This has no effect if
29357 the floating-point option is not also enabled. Disabling fused
29358 multiply/add and multiply/subtract instructions forces the compiler
29359 to use separate instructions for the multiply and add/subtract
29360 operations. This may be desirable in some cases where strict IEEE
29361 754-compliant results are required: the fused multiply add/subtract
29362 instructions do not round the intermediate result, thereby
29363 producing results with more bits of precision than specified by the
29364 IEEE standard. Disabling fused multiply add/subtract instructions
29365 also ensures that the program output is not sensitive to the
29366 compiler's ability to combine multiply and add/subtract operations.
29367
29368 -mserialize-volatile
29369 -mno-serialize-volatile
29370 When this option is enabled, GCC inserts "MEMW" instructions before
29371 "volatile" memory references to guarantee sequential consistency.
29372 The default is -mserialize-volatile. Use -mno-serialize-volatile
29373 to omit the "MEMW" instructions.
29374
29375 -mforce-no-pic
29376 For targets, like GNU/Linux, where all user-mode Xtensa code must
29377 be position-independent code (PIC), this option disables PIC for
29378 compiling kernel code.
29379
29380 -mtext-section-literals
29381 -mno-text-section-literals
29382 These options control the treatment of literal pools. The default
29383 is -mno-text-section-literals, which places literals in a separate
29384 section in the output file. This allows the literal pool to be
29385 placed in a data RAM/ROM, and it also allows the linker to combine
29386 literal pools from separate object files to remove redundant
29387 literals and improve code size. With -mtext-section-literals, the
29388 literals are interspersed in the text section in order to keep them
29389 as close as possible to their references. This may be necessary
29390 for large assembly files. Literals for each function are placed
29391 right before that function.
29392
29393 -mauto-litpools
29394 -mno-auto-litpools
29395 These options control the treatment of literal pools. The default
29396 is -mno-auto-litpools, which places literals in a separate section
29397 in the output file unless -mtext-section-literals is used. With
29398 -mauto-litpools the literals are interspersed in the text section
29399 by the assembler. Compiler does not produce explicit ".literal"
29400 directives and loads literals into registers with "MOVI"
29401 instructions instead of "L32R" to let the assembler do relaxation
29402 and place literals as necessary. This option allows assembler to
29403 create several literal pools per function and assemble very big
29404 functions, which may not be possible with -mtext-section-literals.
29405
29406 -mtarget-align
29407 -mno-target-align
29408 When this option is enabled, GCC instructs the assembler to
29409 automatically align instructions to reduce branch penalties at the
29410 expense of some code density. The assembler attempts to widen
29411 density instructions to align branch targets and the instructions
29412 following call instructions. If there are not enough preceding
29413 safe density instructions to align a target, no widening is
29414 performed. The default is -mtarget-align. These options do not
29415 affect the treatment of auto-aligned instructions like "LOOP",
29416 which the assembler always aligns, either by widening density
29417 instructions or by inserting NOP instructions.
29418
29419 -mlongcalls
29420 -mno-longcalls
29421 When this option is enabled, GCC instructs the assembler to
29422 translate direct calls to indirect calls unless it can determine
29423 that the target of a direct call is in the range allowed by the
29424 call instruction. This translation typically occurs for calls to
29425 functions in other source files. Specifically, the assembler
29426 translates a direct "CALL" instruction into an "L32R" followed by a
29427 "CALLX" instruction. The default is -mno-longcalls. This option
29428 should be used in programs where the call target can potentially be
29429 out of range. This option is implemented in the assembler, not the
29430 compiler, so the assembly code generated by GCC still shows direct
29431 call instructions---look at the disassembled object code to see the
29432 actual instructions. Note that the assembler uses an indirect call
29433 for every cross-file call, not just those that really are out of
29434 range.
29435
29436 -mabi=name
29437 Generate code for the specified ABI. Permissible values are:
29438 call0, windowed. Default ABI is chosen by the Xtensa core
29439 configuration.
29440
29441 -mabi=call0
29442 When this option is enabled function parameters are passed in
29443 registers "a2" through "a7", registers "a12" through "a15" are
29444 caller-saved, and register "a15" may be used as a frame pointer.
29445 When this version of the ABI is enabled the C preprocessor symbol
29446 "__XTENSA_CALL0_ABI__" is defined.
29447
29448 -mabi=windowed
29449 When this option is enabled function parameters are passed in
29450 registers "a10" through "a15", and called function rotates register
29451 window by 8 registers on entry so that its arguments are found in
29452 registers "a2" through "a7". Register "a7" may be used as a frame
29453 pointer. Register window is rotated 8 registers back upon return.
29454 When this version of the ABI is enabled the C preprocessor symbol
29455 "__XTENSA_WINDOWED_ABI__" is defined.
29456
29457 -mextra-l32r-costs=n
29458 Specify an extra cost of instruction RAM/ROM access for "L32R"
29459 instructions, in clock cycles. This affects, when optimizing for
29460 speed, whether loading a constant from literal pool using "L32R" or
29461 synthesizing the constant from a small one with a couple of
29462 arithmetic instructions. The default value is 0.
29463
29464 zSeries Options
29465
29466 These are listed under
29467
29469 This section describes several environment variables that affect how
29470 GCC operates. Some of them work by specifying directories or prefixes
29471 to use when searching for various kinds of files. Some are used to
29472 specify other aspects of the compilation environment.
29473
29474 Note that you can also specify places to search using options such as
29475 -B, -I and -L. These take precedence over places specified using
29476 environment variables, which in turn take precedence over those
29477 specified by the configuration of GCC.
29478
29479 LANG
29480 LC_CTYPE
29481 LC_MESSAGES
29482 LC_ALL
29483 These environment variables control the way that GCC uses
29484 localization information which allows GCC to work with different
29485 national conventions. GCC inspects the locale categories LC_CTYPE
29486 and LC_MESSAGES if it has been configured to do so. These locale
29487 categories can be set to any value supported by your installation.
29488 A typical value is en_GB.UTF-8 for English in the United Kingdom
29489 encoded in UTF-8.
29490
29491 The LC_CTYPE environment variable specifies character
29492 classification. GCC uses it to determine the character boundaries
29493 in a string; this is needed for some multibyte encodings that
29494 contain quote and escape characters that are otherwise interpreted
29495 as a string end or escape.
29496
29497 The LC_MESSAGES environment variable specifies the language to use
29498 in diagnostic messages.
29499
29500 If the LC_ALL environment variable is set, it overrides the value
29501 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
29502 default to the value of the LANG environment variable. If none of
29503 these variables are set, GCC defaults to traditional C English
29504 behavior.
29505
29506 TMPDIR
29507 If TMPDIR is set, it specifies the directory to use for temporary
29508 files. GCC uses temporary files to hold the output of one stage of
29509 compilation which is to be used as input to the next stage: for
29510 example, the output of the preprocessor, which is the input to the
29511 compiler proper.
29512
29513 GCC_COMPARE_DEBUG
29514 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
29515 -fcompare-debug to the compiler driver. See the documentation of
29516 this option for more details.
29517
29518 GCC_EXEC_PREFIX
29519 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
29520 names of the subprograms executed by the compiler. No slash is
29521 added when this prefix is combined with the name of a subprogram,
29522 but you can specify a prefix that ends with a slash if you wish.
29523
29524 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
29525 appropriate prefix to use based on the pathname it is invoked with.
29526
29527 If GCC cannot find the subprogram using the specified prefix, it
29528 tries looking in the usual places for the subprogram.
29529
29530 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
29531 prefix is the prefix to the installed compiler. In many cases
29532 prefix is the value of "prefix" when you ran the configure script.
29533
29534 Other prefixes specified with -B take precedence over this prefix.
29535
29536 This prefix is also used for finding files such as crt0.o that are
29537 used for linking.
29538
29539 In addition, the prefix is used in an unusual way in finding the
29540 directories to search for header files. For each of the standard
29541 directories whose name normally begins with /usr/local/lib/gcc
29542 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
29543 replacing that beginning with the specified prefix to produce an
29544 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
29545 just before it searches the standard directory /usr/local/lib/bar.
29546 If a standard directory begins with the configured prefix then the
29547 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
29548 header files.
29549
29550 COMPILER_PATH
29551 The value of COMPILER_PATH is a colon-separated list of
29552 directories, much like PATH. GCC tries the directories thus
29553 specified when searching for subprograms, if it cannot find the
29554 subprograms using GCC_EXEC_PREFIX.
29555
29556 LIBRARY_PATH
29557 The value of LIBRARY_PATH is a colon-separated list of directories,
29558 much like PATH. When configured as a native compiler, GCC tries
29559 the directories thus specified when searching for special linker
29560 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
29561 GCC also uses these directories when searching for ordinary
29562 libraries for the -l option (but directories specified with -L come
29563 first).
29564
29565 LANG
29566 This variable is used to pass locale information to the compiler.
29567 One way in which this information is used is to determine the
29568 character set to be used when character literals, string literals
29569 and comments are parsed in C and C++. When the compiler is
29570 configured to allow multibyte characters, the following values for
29571 LANG are recognized:
29572
29573 C-JIS
29574 Recognize JIS characters.
29575
29576 C-SJIS
29577 Recognize SJIS characters.
29578
29579 C-EUCJP
29580 Recognize EUCJP characters.
29581
29582 If LANG is not defined, or if it has some other value, then the
29583 compiler uses "mblen" and "mbtowc" as defined by the default locale
29584 to recognize and translate multibyte characters.
29585
29586 GCC_EXTRA_DIAGNOSTIC_OUTPUT
29587 If GCC_EXTRA_DIAGNOSTIC_OUTPUT is set to one of the following
29588 values, then additional text will be emitted to stderr when fix-it
29589 hints are emitted. -fdiagnostics-parseable-fixits and
29590 -fno-diagnostics-parseable-fixits take precedence over this
29591 environment variable.
29592
29593 fixits-v1
29594 Emit parseable fix-it hints, equivalent to
29595 -fdiagnostics-parseable-fixits. In particular, columns are
29596 expressed as a count of bytes, starting at byte 1 for the
29597 initial column.
29598
29599 fixits-v2
29600 As "fixits-v1", but columns are expressed as display columns,
29601 as per -fdiagnostics-column-unit=display.
29602
29603 Some additional environment variables affect the behavior of the
29604 preprocessor.
29605
29606 CPATH
29607 C_INCLUDE_PATH
29608 CPLUS_INCLUDE_PATH
29609 OBJC_INCLUDE_PATH
29610 Each variable's value is a list of directories separated by a
29611 special character, much like PATH, in which to look for header
29612 files. The special character, "PATH_SEPARATOR", is target-
29613 dependent and determined at GCC build time. For Microsoft Windows-
29614 based targets it is a semicolon, and for almost all other targets
29615 it is a colon.
29616
29617 CPATH specifies a list of directories to be searched as if
29618 specified with -I, but after any paths given with -I options on the
29619 command line. This environment variable is used regardless of
29620 which language is being preprocessed.
29621
29622 The remaining environment variables apply only when preprocessing
29623 the particular language indicated. Each specifies a list of
29624 directories to be searched as if specified with -isystem, but after
29625 any paths given with -isystem options on the command line.
29626
29627 In all these variables, an empty element instructs the compiler to
29628 search its current working directory. Empty elements can appear at
29629 the beginning or end of a path. For instance, if the value of
29630 CPATH is ":/special/include", that has the same effect as
29631 -I. -I/special/include.
29632
29633 DEPENDENCIES_OUTPUT
29634 If this variable is set, its value specifies how to output
29635 dependencies for Make based on the non-system header files
29636 processed by the compiler. System header files are ignored in the
29637 dependency output.
29638
29639 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
29640 case the Make rules are written to that file, guessing the target
29641 name from the source file name. Or the value can have the form
29642 file target, in which case the rules are written to file file using
29643 target as the target name.
29644
29645 In other words, this environment variable is equivalent to
29646 combining the options -MM and -MF, with an optional -MT switch too.
29647
29648 SUNPRO_DEPENDENCIES
29649 This variable is the same as DEPENDENCIES_OUTPUT (see above),
29650 except that system header files are not ignored, so it implies -M
29651 rather than -MM. However, the dependence on the main input file is
29652 omitted.
29653
29654 SOURCE_DATE_EPOCH
29655 If this variable is set, its value specifies a UNIX timestamp to be
29656 used in replacement of the current date and time in the "__DATE__"
29657 and "__TIME__" macros, so that the embedded timestamps become
29658 reproducible.
29659
29660 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
29661 the number of seconds (excluding leap seconds) since 01 Jan 1970
29662 00:00:00 represented in ASCII; identical to the output of "date
29663 +%s" on GNU/Linux and other systems that support the %s extension
29664 in the "date" command.
29665
29666 The value should be a known timestamp such as the last modification
29667 time of the source or package and it should be set by the build
29668 process.
29669
29671 For instructions on reporting bugs, see <https://bugzilla.redhat.com/>.
29672
29674 1. On some systems, gcc -shared needs to build supplementary stub code
29675 for constructors to work. On multi-libbed systems, gcc -shared
29676 must select the correct support libraries to link against. Failing
29677 to supply the correct flags may lead to subtle defects. Supplying
29678 them in cases where they are not necessary is innocuous. -shared
29679 suppresses the addition of startup code to alter the floating-point
29680 environment as done with -ffast-math, -Ofast or
29681 -funsafe-math-optimizations on some targets.
29682
29684 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1)
29685 and the Info entries for gcc, cpp, as, ld, binutils and gdb.
29686
29688 See the Info entry for gcc, or
29689 <https://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for
29690 contributors to GCC.
29691
29693 Copyright (c) 1988-2023 Free Software Foundation, Inc.
29694
29695 Permission is granted to copy, distribute and/or modify this document
29696 under the terms of the GNU Free Documentation License, Version 1.3 or
29697 any later version published by the Free Software Foundation; with the
29698 Invariant Sections being "GNU General Public License" and "Funding Free
29699 Software", the Front-Cover texts being (a) (see below), and with the
29700 Back-Cover Texts being (b) (see below). A copy of the license is
29701 included in the gfdl(7) man page.
29702
29703 (a) The FSF's Front-Cover Text is:
29704
29705 A GNU Manual
29706
29707 (b) The FSF's Back-Cover Text is:
29708
29709 You have freedom to copy and modify this GNU Manual, like GNU
29710 software. Copies published by the Free Software Foundation raise
29711 funds for GNU development.
29712
29713
29714
29715gcc-13.1.0 2023-04-26 GCC(1)