1GCC(1) GNU GCC(1)
2
3
4
6 gcc - GNU project C and C++ compiler
7
9 gcc [-c|-S|-E] [-std=standard]
10 [-g] [-pg] [-Olevel]
11 [-Wwarn...] [-Wpedantic]
12 [-Idir...] [-Ldir...]
13 [-Dmacro[=defn]...] [-Umacro]
14 [-foption...] [-mmachine-option...]
15 [-o outfile] [@file] infile...
16
17 Only the most useful options are listed here; see below for the
18 remainder. g++ accepts mostly the same options as gcc.
19
21 When you invoke GCC, it normally does preprocessing, compilation,
22 assembly and linking. The "overall options" allow you to stop this
23 process at an intermediate stage. For example, the -c option says not
24 to run the linker. Then the output consists of object files output by
25 the assembler.
26
27 Other options are passed on to one or more stages of processing. Some
28 options control the preprocessor and others the compiler itself. Yet
29 other options control the assembler and linker; most of these are not
30 documented here, since you rarely need to use any of them.
31
32 Most of the command-line options that you can use with GCC are useful
33 for C programs; when an option is only useful with another language
34 (usually C++), the explanation says so explicitly. If the description
35 for a particular option does not mention a source language, you can use
36 that option with all supported languages.
37
38 The usual way to run GCC is to run the executable called gcc, or
39 machine-gcc when cross-compiling, or machine-gcc-version to run a
40 specific version of GCC. When you compile C++ programs, you should
41 invoke GCC as g++ instead.
42
43 The gcc program accepts options and file names as operands. Many
44 options have multi-letter names; therefore multiple single-letter
45 options may not be grouped: -dv is very different from -d -v.
46
47 You can mix options and other arguments. For the most part, the order
48 you use doesn't matter. Order does matter when you use several options
49 of the same kind; for example, if you specify -L more than once, the
50 directories are searched in the order specified. Also, the placement
51 of the -l option is significant.
52
53 Many options have long names starting with -f or with -W---for example,
54 -fmove-loop-invariants, -Wformat and so on. Most of these have both
55 positive and negative forms; the negative form of -ffoo is -fno-foo.
56 This manual documents only one of these two forms, whichever one is not
57 the default.
58
59 Some options take one or more arguments typically separated either by a
60 space or by the equals sign (=) from the option name. Unless
61 documented otherwise, an argument can be either numeric or a string.
62 Numeric arguments must typically be small unsigned decimal or
63 hexadecimal integers. Hexadecimal arguments must begin with the 0x
64 prefix. Arguments to options that specify a size threshold of some
65 sort may be arbitrarily large decimal or hexadecimal integers followed
66 by a byte size suffix designating a multiple of bytes such as "kB" and
67 "KiB" for kilobyte and kibibyte, respectively, "MB" and "MiB" for
68 megabyte and mebibyte, "GB" and "GiB" for gigabyte and gigibyte, and so
69 on. Such arguments are designated by byte-size in the following text.
70 Refer to the NIST, IEC, and other relevant national and international
71 standards for the full listing and explanation of the binary and
72 decimal byte size prefixes.
73
75 Option Summary
76 Here is a summary of all the options, grouped by type. Explanations
77 are in the following sections.
78
79 Overall Options
80 -c -S -E -o file -dumpbase dumpbase -dumpbase-ext auxdropsuf
81 -dumpdir dumppfx -x language -v -### --help[=class[,...]]
82 --target-help --version -pass-exit-codes -pipe -specs=file
83 -wrapper @file -ffile-prefix-map=old=new -fcanon-prefix-map
84 -fplugin=file -fplugin-arg-name=arg -fdump-ada-spec[-slim]
85 -fada-spec-parent=unit -fdump-go-spec=file
86
87 C Language Options
88 -ansi -std=standard -aux-info filename -fno-asm -fno-builtin
89 -fno-builtin-function -fcond-mismatch -ffreestanding -fgimple
90 -fgnu-tm -fgnu89-inline -fhosted -flax-vector-conversions
91 -fms-extensions -foffload=arg -foffload-options=arg -fopenacc
92 -fopenacc-dim=geom -fopenmp -fopenmp-simd
93 -fopenmp-target-simd-clone[=device-type]
94 -fpermitted-flt-eval-methods=standard -fplan9-extensions
95 -fsigned-bitfields -funsigned-bitfields -fsigned-char
96 -funsigned-char -fstrict-flex-arrays[=n] -fsso-struct=endianness
97
98 C++ Language Options
99 -fabi-version=n -fno-access-control -faligned-new=n
100 -fargs-in-order=n -fchar8_t -fcheck-new -fconstexpr-depth=n
101 -fconstexpr-cache-depth=n -fconstexpr-loop-limit=n
102 -fconstexpr-ops-limit=n -fno-elide-constructors
103 -fno-enforce-eh-specs -fno-gnu-keywords -fno-implicit-templates
104 -fno-implicit-inline-templates -fno-implement-inlines
105 -fmodule-header[=kind] -fmodule-only -fmodules-ts
106 -fmodule-implicit-inline -fno-module-lazy
107 -fmodule-mapper=specification -fmodule-version-ignore
108 -fms-extensions -fnew-inheriting-ctors -fnew-ttp-matching
109 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names
110 -fno-optional-diags -fpermissive -fno-pretty-templates -fno-rtti
111 -fsized-deallocation -ftemplate-backtrace-limit=n
112 -ftemplate-depth=n -fno-threadsafe-statics -fuse-cxa-atexit
113 -fno-weak -nostdinc++ -fvisibility-inlines-hidden
114 -fvisibility-ms-compat -fext-numeric-literals
115 -flang-info-include-translate[=header]
116 -flang-info-include-translate-not -flang-info-module-cmi[=module]
117 -stdlib=libstdc++,libc++ -Wabi-tag -Wcatch-value -Wcatch-value=n
118 -Wno-class-conversion -Wclass-memaccess -Wcomma-subscript
119 -Wconditionally-supported -Wno-conversion-null
120 -Wctad-maybe-unsupported -Wctor-dtor-privacy -Wdangling-reference
121 -Wno-delete-incomplete -Wdelete-non-virtual-dtor
122 -Wno-deprecated-array-compare -Wdeprecated-copy
123 -Wdeprecated-copy-dtor -Wno-deprecated-enum-enum-conversion
124 -Wno-deprecated-enum-float-conversion -Weffc++ -Wno-exceptions
125 -Wextra-semi -Wno-inaccessible-base -Wno-inherited-variadic-ctor
126 -Wno-init-list-lifetime -Winvalid-constexpr
127 -Winvalid-imported-macros -Wno-invalid-offsetof
128 -Wno-literal-suffix -Wmismatched-new-delete -Wmismatched-tags
129 -Wmultiple-inheritance -Wnamespaces -Wnarrowing -Wnoexcept
130 -Wnoexcept-type -Wnon-virtual-dtor -Wpessimizing-move
131 -Wno-placement-new -Wplacement-new=n -Wrange-loop-construct
132 -Wredundant-move -Wredundant-tags -Wreorder -Wregister
133 -Wstrict-null-sentinel -Wno-subobject-linkage -Wtemplates
134 -Wno-non-template-friend -Wold-style-cast -Woverloaded-virtual
135 -Wno-pmf-conversions -Wself-move -Wsign-promo -Wsized-deallocation
136 -Wsuggest-final-methods -Wsuggest-final-types -Wsuggest-override
137 -Wno-terminate -Wuseless-cast -Wno-vexing-parse
138 -Wvirtual-inheritance -Wno-virtual-move-assign -Wvolatile
139 -Wzero-as-null-pointer-constant
140
141 Objective-C and Objective-C++ Language Options
142 -fconstant-string-class=class-name -fgnu-runtime -fnext-runtime
143 -fno-nil-receivers -fobjc-abi-version=n -fobjc-call-cxx-cdtors
144 -fobjc-direct-dispatch -fobjc-exceptions -fobjc-gc -fobjc-nilcheck
145 -fobjc-std=objc1 -fno-local-ivars
146 -fivar-visibility=[public|protected|private|package]
147 -freplace-objc-classes -fzero-link -gen-decls -Wassign-intercept
148 -Wno-property-assign-default -Wno-protocol -Wobjc-root-class
149 -Wselector -Wstrict-selector-match -Wundeclared-selector
150
151 Diagnostic Message Formatting Options
152 -fmessage-length=n -fdiagnostics-plain-output
153 -fdiagnostics-show-location=[once|every-line]
154 -fdiagnostics-color=[auto|never|always]
155 -fdiagnostics-urls=[auto|never|always]
156 -fdiagnostics-format=[text|sarif-stderr|sarif-file|json|json-
157 stderr|json-file] -fno-diagnostics-show-option
158 -fno-diagnostics-show-caret -fno-diagnostics-show-labels
159 -fno-diagnostics-show-line-numbers -fno-diagnostics-show-cwe
160 -fno-diagnostics-show-rule -fdiagnostics-minimum-margin-width=width
161 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch
162 -fdiagnostics-show-template-tree -fno-elide-type
163 -fdiagnostics-path-format=[none|separate-events|inline-events]
164 -fdiagnostics-show-path-depths -fno-show-column
165 -fdiagnostics-column-unit=[display|byte]
166 -fdiagnostics-column-origin=origin
167 -fdiagnostics-escape-format=[unicode|bytes]
168
169 Warning Options
170 -fsyntax-only -fmax-errors=n -Wpedantic -pedantic-errors -w
171 -Wextra -Wall -Wabi=n -Waddress -Wno-address-of-packed-member
172 -Waggregate-return -Walloc-size-larger-than=byte-size -Walloc-zero
173 -Walloca -Walloca-larger-than=byte-size
174 -Wno-aggressive-loop-optimizations -Warith-conversion
175 -Warray-bounds -Warray-bounds=n -Warray-compare -Wno-attributes
176 -Wattribute-alias=n -Wno-attribute-alias -Wno-attribute-warning
177 -Wbidi-chars=[none|unpaired|any|ucn] -Wbool-compare
178 -Wbool-operation -Wno-builtin-declaration-mismatch
179 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat
180 -Wc11-c2x-compat -Wc++-compat -Wc++11-compat -Wc++14-compat
181 -Wc++17-compat -Wc++20-compat -Wno-c++11-extensions
182 -Wno-c++14-extensions -Wno-c++17-extensions -Wno-c++20-extensions
183 -Wno-c++23-extensions -Wcast-align -Wcast-align=strict
184 -Wcast-function-type -Wcast-qual -Wchar-subscripts -Wclobbered
185 -Wcomment -Wno-complain-wrong-lang -Wconversion
186 -Wno-coverage-mismatch -Wno-cpp -Wdangling-else
187 -Wdangling-pointer -Wdangling-pointer=n -Wdate-time
188 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init
189 -Wdisabled-optimization -Wno-discarded-array-qualifiers
190 -Wno-discarded-qualifiers -Wno-div-by-zero -Wdouble-promotion
191 -Wduplicated-branches -Wduplicated-cond -Wempty-body
192 -Wno-endif-labels -Wenum-compare -Wenum-conversion
193 -Wenum-int-mismatch -Werror -Werror=* -Wexpansion-to-defined
194 -Wfatal-errors -Wfloat-conversion -Wfloat-equal -Wformat
195 -Wformat=2 -Wno-format-contains-nul -Wno-format-extra-args
196 -Wformat-nonliteral -Wformat-overflow=n -Wformat-security
197 -Wformat-signedness -Wformat-truncation=n -Wformat-y2k
198 -Wframe-address -Wframe-larger-than=byte-size
199 -Wno-free-nonheap-object -Wno-if-not-aligned
200 -Wno-ignored-attributes -Wignored-qualifiers
201 -Wno-incompatible-pointer-types -Wimplicit -Wimplicit-fallthrough
202 -Wimplicit-fallthrough=n -Wno-implicit-function-declaration
203 -Wno-implicit-int -Winfinite-recursion -Winit-self -Winline
204 -Wno-int-conversion -Wint-in-bool-context -Wno-int-to-pointer-cast
205 -Wno-invalid-memory-model -Winvalid-pch -Winvalid-utf8
206 -Wno-unicode -Wjump-misses-init -Wlarger-than=byte-size
207 -Wlogical-not-parentheses -Wlogical-op -Wlong-long
208 -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized
209 -Wmemset-elt-size -Wmemset-transposed-args
210 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces
211 -Wmissing-field-initializers -Wmissing-format-attribute
212 -Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile
213 -Wno-multichar -Wmultistatement-macros -Wnonnull
214 -Wnonnull-compare -Wnormalized=[none|id|nfc|nfkc]
215 -Wnull-dereference -Wno-odr -Wopenacc-parallelism -Wopenmp-simd
216 -Wno-overflow -Woverlength-strings
217 -Wno-override-init-side-effects -Wpacked
218 -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
219 -Wparentheses -Wno-pedantic-ms-format -Wpointer-arith
220 -Wno-pointer-compare -Wno-pointer-to-int-cast -Wno-pragmas
221 -Wno-prio-ctor-dtor -Wredundant-decls -Wrestrict
222 -Wno-return-local-addr -Wreturn-type -Wno-scalar-storage-order
223 -Wsequence-point -Wshadow -Wshadow=global -Wshadow=local
224 -Wshadow=compatible-local -Wno-shadow-ivar
225 -Wno-shift-count-negative -Wno-shift-count-overflow
226 -Wshift-negative-value -Wno-shift-overflow -Wshift-overflow=n
227 -Wsign-compare -Wsign-conversion -Wno-sizeof-array-argument
228 -Wsizeof-array-div -Wsizeof-pointer-div -Wsizeof-pointer-memaccess
229 -Wstack-protector -Wstack-usage=byte-size -Wstrict-aliasing
230 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=n
231 -Wstring-compare -Wno-stringop-overflow -Wno-stringop-overread
232 -Wno-stringop-truncation -Wstrict-flex-arrays
233 -Wsuggest-attribute=[pure|const|noreturn|format|malloc] -Wswitch
234 -Wno-switch-bool -Wswitch-default -Wswitch-enum
235 -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand
236 -Wsystem-headers -Wtautological-compare -Wtrampolines
237 -Wtrigraphs -Wtrivial-auto-var-init -Wtsan -Wtype-limits -Wundef
238 -Wuninitialized -Wunknown-pragmas -Wunsuffixed-float-constants
239 -Wunused -Wunused-but-set-parameter -Wunused-but-set-variable
240 -Wunused-const-variable -Wunused-const-variable=n
241 -Wunused-function -Wunused-label -Wunused-local-typedefs
242 -Wunused-macros -Wunused-parameter -Wno-unused-result
243 -Wunused-value -Wunused-variable -Wno-varargs -Wvariadic-macros
244 -Wvector-operation-performance -Wvla -Wvla-larger-than=byte-size
245 -Wno-vla-larger-than -Wvolatile-register-var -Wwrite-strings
246 -Wxor-used-as-pow -Wzero-length-bounds
247
248 Static Analyzer Options
249 -fanalyzer -fanalyzer-call-summaries -fanalyzer-checker=name
250 -fno-analyzer-feasibility -fanalyzer-fine-grained
251 -fno-analyzer-state-merge -fno-analyzer-state-purge
252 -fno-analyzer-suppress-followups -fanalyzer-transitivity
253 -fno-analyzer-undo-inlining -fanalyzer-verbose-edges
254 -fanalyzer-verbose-state-changes -fanalyzer-verbosity=level
255 -fdump-analyzer -fdump-analyzer-callgraph
256 -fdump-analyzer-exploded-graph -fdump-analyzer-exploded-nodes
257 -fdump-analyzer-exploded-nodes-2 -fdump-analyzer-exploded-nodes-3
258 -fdump-analyzer-exploded-paths -fdump-analyzer-feasibility
259 -fdump-analyzer-json -fdump-analyzer-state-purge
260 -fdump-analyzer-stderr -fdump-analyzer-supergraph
261 -fdump-analyzer-untracked -Wno-analyzer-double-fclose
262 -Wno-analyzer-double-free
263 -Wno-analyzer-exposure-through-output-file
264 -Wno-analyzer-exposure-through-uninit-copy
265 -Wno-analyzer-fd-access-mode-mismatch -Wno-analyzer-fd-double-close
266 -Wno-analyzer-fd-leak -Wno-analyzer-fd-phase-mismatch
267 -Wno-analyzer-fd-type-mismatch -Wno-analyzer-fd-use-after-close
268 -Wno-analyzer-fd-use-without-check -Wno-analyzer-file-leak
269 -Wno-analyzer-free-of-non-heap
270 -Wno-analyzer-imprecise-fp-arithmetic
271 -Wno-analyzer-infinite-recursion -Wno-analyzer-jump-through-null
272 -Wno-analyzer-malloc-leak -Wno-analyzer-mismatching-deallocation
273 -Wno-analyzer-null-argument -Wno-analyzer-null-dereference
274 -Wno-analyzer-out-of-bounds -Wno-analyzer-possible-null-argument
275 -Wno-analyzer-possible-null-dereference
276 -Wno-analyzer-putenv-of-auto-var -Wno-analyzer-shift-count-negative
277 -Wno-analyzer-shift-count-overflow
278 -Wno-analyzer-stale-setjmp-buffer
279 -Wno-analyzer-tainted-allocation-size
280 -Wno-analyzer-tainted-assertion -Wno-analyzer-tainted-array-index
281 -Wno-analyzer-tainted-divisor -Wno-analyzer-tainted-offset
282 -Wno-analyzer-tainted-size -Wanalyzer-too-complex
283 -Wno-analyzer-unsafe-call-within-signal-handler
284 -Wno-analyzer-use-after-free
285 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
286 -Wno-analyzer-use-of-uninitialized-value
287 -Wno-analyzer-va-arg-type-mismatch -Wno-analyzer-va-list-exhausted
288 -Wno-analyzer-va-list-leak -Wno-analyzer-va-list-use-after-va-end
289 -Wno-analyzer-write-to-const -Wno-analyzer-write-to-string-literal
290
291 C and Objective-C-only Warning Options
292 -Wbad-function-cast -Wmissing-declarations
293 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs
294 -Wold-style-declaration -Wold-style-definition -Wstrict-prototypes
295 -Wtraditional -Wtraditional-conversion
296 -Wdeclaration-after-statement -Wpointer-sign
297
298 Debugging Options
299 -g -glevel -gdwarf -gdwarf-version -gbtf -gctf -gctflevel -ggdb
300 -grecord-gcc-switches -gno-record-gcc-switches -gstrict-dwarf
301 -gno-strict-dwarf -gas-loc-support -gno-as-loc-support
302 -gas-locview-support -gno-as-locview-support -gcolumn-info
303 -gno-column-info -gdwarf32 -gdwarf64 -gstatement-frontiers
304 -gno-statement-frontiers -gvariable-location-views
305 -gno-variable-location-views -ginternal-reset-location-views
306 -gno-internal-reset-location-views -ginline-points
307 -gno-inline-points -gvms -gz[=type] -gsplit-dwarf -gdescribe-dies
308 -gno-describe-dies -fdebug-prefix-map=old=new
309 -fdebug-types-section -fno-eliminate-unused-debug-types
310 -femit-struct-debug-baseonly -femit-struct-debug-reduced
311 -femit-struct-debug-detailed[=spec-list]
312 -fno-eliminate-unused-debug-symbols -femit-class-debug-always
313 -fno-merge-debug-strings -fno-dwarf2-cfi-asm -fvar-tracking
314 -fvar-tracking-assignments
315
316 Optimization Options
317 -faggressive-loop-optimizations -falign-functions[=n[:m:[n2[:m2]]]]
318 -falign-jumps[=n[:m:[n2[:m2]]]] -falign-labels[=n[:m:[n2[:m2]]]]
319 -falign-loops[=n[:m:[n2[:m2]]]] -fno-allocation-dce
320 -fallow-store-data-races -fassociative-math -fauto-profile
321 -fauto-profile[=path] -fauto-inc-dec -fbranch-probabilities
322 -fcaller-saves -fcombine-stack-adjustments -fconserve-stack
323 -fcompare-elim -fcprop-registers -fcrossjumping
324 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules
325 -fcx-limited-range -fdata-sections -fdce -fdelayed-branch
326 -fdelete-null-pointer-checks -fdevirtualize
327 -fdevirtualize-speculatively -fdevirtualize-at-ltrans -fdse
328 -fearly-inlining -fipa-sra -fexpensive-optimizations
329 -ffat-lto-objects -ffast-math -ffinite-math-only -ffloat-store
330 -fexcess-precision=style -ffinite-loops -fforward-propagate
331 -ffp-contract=style -ffunction-sections -fgcse
332 -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity
333 -fgcse-sm -fhoist-adjacent-loads -fif-conversion -fif-conversion2
334 -findirect-inlining -finline-functions
335 -finline-functions-called-once -finline-limit=n
336 -finline-small-functions -fipa-modref -fipa-cp -fipa-cp-clone
337 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const
338 -fipa-reference -fipa-reference-addressable -fipa-stack-alignment
339 -fipa-icf -fira-algorithm=algorithm -flive-patching=level
340 -fira-region=region -fira-hoist-pressure -fira-loop-pressure
341 -fno-ira-share-save-slots -fno-ira-share-spill-slots
342 -fisolate-erroneous-paths-dereference
343 -fisolate-erroneous-paths-attribute -fivopts
344 -fkeep-inline-functions -fkeep-static-functions
345 -fkeep-static-consts -flimit-function-alignment
346 -flive-range-shrinkage -floop-block -floop-interchange
347 -floop-strip-mine -floop-unroll-and-jam -floop-nest-optimize
348 -floop-parallelize-all -flra-remat -flto -flto-compression-level
349 -flto-partition=alg -fmerge-all-constants -fmerge-constants
350 -fmodulo-sched -fmodulo-sched-allow-regmoves
351 -fmove-loop-invariants -fmove-loop-stores -fno-branch-count-reg
352 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse
353 -fno-guess-branch-probability -fno-inline -fno-math-errno
354 -fno-peephole -fno-peephole2 -fno-printf-return-value
355 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros
356 -fno-toplevel-reorder -fno-trapping-math
357 -fno-zero-initialized-in-bss -fomit-frame-pointer
358 -foptimize-sibling-calls -fpartial-inlining -fpeel-loops
359 -fpredictive-commoning -fprefetch-loop-arrays -fprofile-correction
360 -fprofile-use -fprofile-use=path -fprofile-partial-training
361 -fprofile-values -fprofile-reorder-functions -freciprocal-math
362 -free -frename-registers -freorder-blocks
363 -freorder-blocks-algorithm=algorithm -freorder-blocks-and-partition
364 -freorder-functions -frerun-cse-after-loop
365 -freschedule-modulo-scheduled-loops -frounding-math
366 -fsave-optimization-record -fsched2-use-superblocks
367 -fsched-pressure -fsched-spec-load -fsched-spec-load-dangerous
368 -fsched-stalled-insns-dep[=n] -fsched-stalled-insns[=n]
369 -fsched-group-heuristic -fsched-critical-path-heuristic
370 -fsched-spec-insn-heuristic -fsched-rank-heuristic
371 -fsched-last-insn-heuristic -fsched-dep-count-heuristic
372 -fschedule-fusion -fschedule-insns -fschedule-insns2
373 -fsection-anchors -fselective-scheduling -fselective-scheduling2
374 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops
375 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate
376 -fsignaling-nans -fsingle-precision-constant
377 -fsplit-ivs-in-unroller -fsplit-loops -fsplit-paths
378 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop
379 -fssa-phiopt -fstdarg-opt -fstore-merging -fstrict-aliasing
380 -fipa-strict-aliasing -fthread-jumps -ftracer -ftree-bit-ccp
381 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-coalesce-vars
382 -ftree-copy-prop -ftree-dce -ftree-dominator-opts -ftree-dse
383 -ftree-forwprop -ftree-fre -fcode-hoisting -ftree-loop-if-convert
384 -ftree-loop-im -ftree-phiprop -ftree-loop-distribution
385 -ftree-loop-distribute-patterns -ftree-loop-ivcanon
386 -ftree-loop-linear -ftree-loop-optimize -ftree-loop-vectorize
387 -ftree-parallelize-loops=n -ftree-pre -ftree-partial-pre
388 -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-sink
389 -ftree-slsr -ftree-sra -ftree-switch-conversion -ftree-tail-merge
390 -ftree-ter -ftree-vectorize -ftree-vrp -ftrivial-auto-var-init
391 -funconstrained-commons -funit-at-a-time -funroll-all-loops
392 -funroll-loops -funsafe-math-optimizations -funswitch-loops
393 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model
394 -fvpt -fweb -fwhole-program -fwpa -fuse-linker-plugin
395 -fzero-call-used-regs --param name=value -O -O0 -O1 -O2 -O3
396 -Os -Ofast -Og -Oz
397
398 Program Instrumentation Options
399 -p -pg -fprofile-arcs --coverage -ftest-coverage
400 -fprofile-abs-path -fprofile-dir=path -fprofile-generate
401 -fprofile-generate=path -fprofile-info-section
402 -fprofile-info-section=name -fprofile-note=path
403 -fprofile-prefix-path=path -fprofile-update=method
404 -fprofile-filter-files=regex -fprofile-exclude-files=regex
405 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
406 -fsanitize=style -fsanitize-recover -fsanitize-recover=style
407 -fsanitize-trap -fsanitize-trap=style -fasan-shadow-offset=number
408 -fsanitize-sections=s1,s2,... -fsanitize-undefined-trap-on-error
409 -fbounds-check -fcf-protection=[full|branch|return|none|check]
410 -fharden-compares -fharden-conditional-branches -fstack-protector
411 -fstack-protector-all -fstack-protector-strong
412 -fstack-protector-explicit -fstack-check
413 -fstack-limit-register=reg -fstack-limit-symbol=sym
414 -fno-stack-limit -fsplit-stack -fvtable-verify=[std|preinit|none]
415 -fvtv-counts -fvtv-debug -finstrument-functions
416 -finstrument-functions-once
417 -finstrument-functions-exclude-function-list=sym,sym,...
418 -finstrument-functions-exclude-file-list=file,file,...
419 -fprofile-prefix-map=old=new
420
421 Preprocessor Options
422 -Aquestion=answer -A-question[=answer] -C -CC -Dmacro[=defn] -dD
423 -dI -dM -dN -dU -fdebug-cpp -fdirectives-only
424 -fdollars-in-identifiers -fexec-charset=charset
425 -fextended-identifiers -finput-charset=charset
426 -flarge-source-files -fmacro-prefix-map=old=new
427 -fmax-include-depth=depth -fno-canonical-system-headers -fpch-deps
428 -fpch-preprocess -fpreprocessed -ftabstop=width
429 -ftrack-macro-expansion -fwide-exec-charset=charset
430 -fworking-directory -H -imacros file -include file -M -MD -MF
431 -MG -MM -MMD -MP -MQ -MT -Mno-modules -no-integrated-cpp -P
432 -pthread -remap -traditional -traditional-cpp -trigraphs -Umacro
433 -undef -Wp,option -Xpreprocessor option
434
435 Assembler Options
436 -Wa,option -Xassembler option
437
438 Linker Options
439 object-file-name -fuse-ld=linker -llibrary -nostartfiles
440 -nodefaultlibs -nolibc -nostdlib -nostdlib++ -e entry
441 --entry=entry -pie -pthread -r -rdynamic -s -static
442 -static-pie -static-libgcc -static-libstdc++ -static-libasan
443 -static-libtsan -static-liblsan -static-libubsan -shared
444 -shared-libgcc -symbolic -T script -Wl,option -Xlinker option -u
445 symbol -z keyword
446
447 Directory Options
448 -Bprefix -Idir -I- -idirafter dir -imacros file -imultilib dir
449 -iplugindir=dir -iprefix file -iquote dir -isysroot dir -isystem
450 dir -iwithprefix dir -iwithprefixbefore dir -Ldir
451 -no-canonical-prefixes --no-sysroot-suffix -nostdinc -nostdinc++
452 --sysroot=dir
453
454 Code Generation Options
455 -fcall-saved-reg -fcall-used-reg -ffixed-reg -fexceptions
456 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables
457 -fasynchronous-unwind-tables -fno-gnu-unique
458 -finhibit-size-directive -fcommon -fno-ident -fpcc-struct-return
459 -fpic -fPIC -fpie -fPIE -fno-plt -fno-jump-tables
460 -fno-bit-tests -frecord-gcc-switches -freg-struct-return
461 -fshort-enums -fshort-wchar -fverbose-asm -fpack-struct[=n]
462 -fleading-underscore -ftls-model=model -fstack-reuse=reuse_level
463 -ftrampolines -ftrapv -fwrapv
464 -fvisibility=[default|internal|hidden|protected]
465 -fstrict-volatile-bitfields -fsync-libcalls
466
467 Developer Options
468 -dletters -dumpspecs -dumpmachine -dumpversion -dumpfullversion
469 -fcallgraph-info[=su,da] -fchecking -fchecking=n -fdbg-cnt-list
470 -fdbg-cnt=counter-value-list -fdisable-ipa-pass_name
471 -fdisable-rtl-pass_name -fdisable-rtl-pass-name=range-list
472 -fdisable-tree-pass_name -fdisable-tree-pass-name=range-list
473 -fdump-debug -fdump-earlydebug -fdump-noaddr -fdump-unnumbered
474 -fdump-unnumbered-links -fdump-final-insns[=file] -fdump-ipa-all
475 -fdump-ipa-cgraph -fdump-ipa-inline -fdump-lang-all
476 -fdump-lang-switch -fdump-lang-switch-options
477 -fdump-lang-switch-options=filename -fdump-passes -fdump-rtl-pass
478 -fdump-rtl-pass=filename -fdump-statistics -fdump-tree-all
479 -fdump-tree-switch -fdump-tree-switch-options
480 -fdump-tree-switch-options=filename -fcompare-debug[=opts]
481 -fcompare-debug-second -fenable-kind-pass -fenable-kind-pass=range-
482 list -fira-verbose=n -flto-report -flto-report-wpa
483 -fmem-report-wpa -fmem-report -fpre-ipa-mem-report
484 -fpost-ipa-mem-report -fopt-info -fopt-info-options[=file]
485 -fmultiflags -fprofile-report -frandom-seed=string
486 -fsched-verbose=n -fsel-sched-verbose -fsel-sched-dump-cfg
487 -fsel-sched-pipelining-verbose -fstats -fstack-usage
488 -ftime-report -ftime-report-details
489 -fvar-tracking-assignments-toggle -gtoggle
490 -print-file-name=library -print-libgcc-file-name
491 -print-multi-directory -print-multi-lib -print-multi-os-directory
492 -print-prog-name=program -print-search-dirs -Q -print-sysroot
493 -print-sysroot-headers-suffix -save-temps -save-temps=cwd
494 -save-temps=obj -time[=file]
495
496 Machine-Dependent Options
497 AArch64 Options -mabi=name -mbig-endian -mlittle-endian
498 -mgeneral-regs-only -mcmodel=tiny -mcmodel=small -mcmodel=large
499 -mstrict-align -mno-strict-align -momit-leaf-frame-pointer
500 -mtls-dialect=desc -mtls-dialect=traditional -mtls-size=size
501 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419
502 -mlow-precision-recip-sqrt -mlow-precision-sqrt
503 -mlow-precision-div -mpc-relative-literal-loads
504 -msign-return-address=scope -mbranch-protection=none|standard|pac-
505 ret[+leaf +b-key]|bti -mharden-sls=opts -march=name -mcpu=name
506 -mtune=name -moverride=string -mverbose-cost-dump
507 -mstack-protector-guard=guard -mstack-protector-guard-reg=sysreg
508 -mstack-protector-guard-offset=offset -mtrack-speculation
509 -moutline-atomics
510
511 Adapteva Epiphany Options -mhalf-reg-file -mprefer-short-insn-regs
512 -mbranch-cost=num -mcmove -mnops=num -msoft-cmpsf -msplit-lohi
513 -mpost-inc -mpost-modify -mstack-offset=num -mround-nearest
514 -mlong-calls -mshort-calls -msmall16 -mfp-mode=mode
515 -mvect-double -max-vect-align=num -msplit-vecmove-early
516 -m1reg-reg
517
518 AMD GCN Options -march=gpu -mtune=gpu -mstack-size=bytes
519
520 ARC Options -mbarrel-shifter -mjli-always -mcpu=cpu -mA6
521 -mARC600 -mA7 -mARC700 -mdpfp -mdpfp-compact -mdpfp-fast
522 -mno-dpfp-lrsr -mea -mno-mpy -mmul32x16 -mmul64 -matomic -mnorm
523 -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap
524 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc
525 -mswape -mtelephony -mxy -misize -mannotate-align -marclinux
526 -marclinux_prof -mlong-calls -mmedium-calls -msdata
527 -mirq-ctrl-saved -mrgf-banked-regs -mlpc-width=width -G num
528 -mvolatile-cache -mtp-regno=regno -malign-call -mauto-modify-reg
529 -mbbit-peephole -mno-brcc -mcase-vector-pcrel -mcompact-casesi
530 -mno-cond-exec -mearly-cbranchsi -mexpand-adddi -mindexed-loads
531 -mlra -mlra-priority-none -mlra-priority-compact
532 -mlra-priority-noncompact -mmillicode -mmixed-code -mq-class
533 -mRcq -mRcw -msize-level=level -mtune=cpu -mmultcost=num
534 -mcode-density-frame -munalign-prob-threshold=probability
535 -mmpy-option=multo -mdiv-rem -mcode-density -mll64 -mfpu=fpu
536 -mrf16 -mbranch-index
537
538 ARM Options -mapcs-frame -mno-apcs-frame -mabi=name
539 -mapcs-stack-check -mno-apcs-stack-check -mapcs-reentrant
540 -mno-apcs-reentrant -mgeneral-regs-only -msched-prolog
541 -mno-sched-prolog -mlittle-endian -mbig-endian -mbe8 -mbe32
542 -mfloat-abi=name -mfp16-format=name -mthumb-interwork
543 -mno-thumb-interwork -mcpu=name -march=name -mfpu=name
544 -mtune=name -mprint-tune-info -mstructure-size-boundary=n
545 -mabort-on-noreturn -mlong-calls -mno-long-calls -msingle-pic-base
546 -mno-single-pic-base -mpic-register=reg -mnop-fun-dllimport
547 -mpoke-function-name -mthumb -marm -mflip-thumb -mtpcs-frame
548 -mtpcs-leaf-frame -mcaller-super-interworking
549 -mcallee-super-interworking -mtp=name -mtls-dialect=dialect
550 -mword-relocations -mfix-cortex-m3-ldrd
551 -mfix-cortex-a57-aes-1742098 -mfix-cortex-a72-aes-1655431
552 -munaligned-access -mneon-for-64bits -mslow-flash-data
553 -masm-syntax-unified -mrestrict-it -mverbose-cost-dump -mpure-code
554 -mcmse -mfix-cmse-cve-2021-35465 -mstack-protector-guard=guard
555 -mstack-protector-guard-offset=offset -mfdpic
556 -mbranch-protection=none|standard|pac-ret[+leaf] [+bti]|bti[+pac-
557 ret[+leaf]]
558
559 AVR Options -mmcu=mcu -mabsdata -maccumulate-args
560 -mbranch-cost=cost -mcall-prologues -mgas-isr-prologues -mint8
561 -mdouble=bits -mlong-double=bits -mn_flash=size -mno-interrupts
562 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack
563 -mfract-convert-truncate -mshort-calls -nodevicelib
564 -nodevicespecs -Waddr-space-convert -Wmisspelled-isr
565
566 Blackfin Options -mcpu=cpu[-sirevision] -msim
567 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer
568 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly
569 -mno-csync-anomaly -mlow-64k -mno-low64k -mstack-check-l1
570 -mid-shared-library -mno-id-shared-library -mshared-library-id=n
571 -mleaf-id-shared-library -mno-leaf-id-shared-library -msep-data
572 -mno-sep-data -mlong-calls -mno-long-calls -mfast-fp
573 -minline-plt -mmulticore -mcorea -mcoreb -msdram -micplb
574
575 C6X Options -mbig-endian -mlittle-endian -march=cpu -msim
576 -msdata=sdata-type
577
578 CRIS Options -mcpu=cpu -march=cpu -mtune=cpu -mmax-stack-frame=n
579 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects
580 -mstack-align -mdata-align -mconst-align -m32-bit -m16-bit
581 -m8-bit -mno-prologue-epilogue -melf -maout -sim -sim2
582 -mmul-bug-workaround -mno-mul-bug-workaround
583
584 C-SKY Options -march=arch -mcpu=cpu -mbig-endian -EB
585 -mlittle-endian -EL -mhard-float -msoft-float -mfpu=fpu
586 -mdouble-float -mfdivdu -mfloat-abi=name -melrw -mistack -mmp
587 -mcp -mcache -msecurity -mtrust -mdsp -medsp -mvdsp -mdiv
588 -msmart -mhigh-registers -manchor -mpushpop -mmultiple-stld
589 -mconstpool -mstack-size -mccrt -mbranch-cost=n -mcse-cc
590 -msched-prolog -msim
591
592 Darwin Options -all_load -allowable_client -arch
593 -arch_errors_fatal -arch_only -bind_at_load -bundle
594 -bundle_loader -client_name -compatibility_version
595 -current_version -dead_strip -dependency-file -dylib_file
596 -dylinker_install_name -dynamic -dynamiclib
597 -exported_symbols_list -filelist -flat_namespace
598 -force_cpusubtype_ALL -force_flat_namespace
599 -headerpad_max_install_names -iframework -image_base -init
600 -install_name -keep_private_externs -multi_module
601 -multiply_defined -multiply_defined_unused -noall_load
602 -no_dead_strip_inits_and_terms -nofixprebinding -nomultidefs
603 -noprebind -noseglinkedit -pagezero_size -prebind
604 -prebind_all_twolevel_modules -private_bundle -read_only_relocs
605 -sectalign -sectobjectsymbols -whyload -seg1addr -sectcreate
606 -sectobjectsymbols -sectorder -segaddr -segs_read_only_addr
607 -segs_read_write_addr -seg_addr_table -seg_addr_table_filename
608 -seglinkedit -segprot -segs_read_only_addr -segs_read_write_addr
609 -single_module -static -sub_library -sub_umbrella
610 -twolevel_namespace -umbrella -undefined -unexported_symbols_list
611 -weak_reference_mismatches -whatsloaded -F -gused -gfull
612 -mmacosx-version-min=version -mkernel -mone-byte-bool
613
614 DEC Alpha Options -mno-fp-regs -msoft-float -mieee
615 -mieee-with-inexact -mieee-conformant -mfp-trap-mode=mode
616 -mfp-rounding-mode=mode -mtrap-precision=mode -mbuild-constants
617 -mcpu=cpu-type -mtune=cpu-type -mbwx -mmax -mfix -mcix
618 -mfloat-vax -mfloat-ieee -mexplicit-relocs -msmall-data
619 -mlarge-data -msmall-text -mlarge-text -mmemory-latency=time
620
621 eBPF Options -mbig-endian -mlittle-endian -mkernel=version
622 -mframe-limit=bytes -mxbpf -mco-re -mno-co-re -mjmpext -mjmp32
623 -malu32 -mcpu=version
624
625 FR30 Options -msmall-model -mno-lsim
626
627 FT32 Options -msim -mlra -mnodiv -mft32b -mcompress -mnopm
628
629 FRV Options -mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 -mhard-float
630 -msoft-float -malloc-cc -mfixed-cc -mdword -mno-dword -mdouble
631 -mno-double -mmedia -mno-media -mmuladd -mno-muladd -mfdpic
632 -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp
633 -mlong-calls -malign-labels -mlibrary-pic -macc-4 -macc-8 -mpack
634 -mno-pack -mno-eflags -mcond-move -mno-cond-move
635 -moptimize-membar -mno-optimize-membar -mscc -mno-scc
636 -mcond-exec -mno-cond-exec -mvliw-branch -mno-vliw-branch
637 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec
638 -mno-nested-cond-exec -mtomcat-stats -mTLS -mtls -mcpu=cpu
639
640 GNU/Linux Options -mglibc -muclibc -mmusl -mbionic -mandroid
641 -tno-android-cc -tno-android-ld
642
643 H8/300 Options -mrelax -mh -ms -mn -mexr -mno-exr -mint32
644 -malign-300
645
646 HPPA Options -march=architecture-type -matomic-libcalls
647 -mbig-switch -mcaller-copies -mdisable-fpregs -mdisable-indexing
648 -mordered -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld
649 -mfixed-range=register-range -mcoherent-ldcw -mjump-in-delay
650 -mlinker-opt -mlong-calls -mlong-load-store -mno-atomic-libcalls
651 -mno-disable-fpregs -mno-disable-indexing -mno-fast-indirect-calls
652 -mno-gas -mno-jump-in-delay -mno-long-load-store
653 -mno-portable-runtime -mno-soft-float -mno-space-regs
654 -msoft-float -mpa-risc-1-0 -mpa-risc-1-1 -mpa-risc-2-0
655 -mportable-runtime -mschedule=cpu-type -mspace-regs -msoft-mult
656 -msio -mwsio -munix=unix-std -nolibdld -static -threads
657
658 IA-64 Options -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld
659 -mno-pic -mvolatile-asm-stop -mregister-names -msdata -mno-sdata
660 -mconstant-gp -mauto-pic -mfused-madd
661 -minline-float-divide-min-latency
662 -minline-float-divide-max-throughput -mno-inline-float-divide
663 -minline-int-divide-min-latency -minline-int-divide-max-throughput
664 -mno-inline-int-divide -minline-sqrt-min-latency
665 -minline-sqrt-max-throughput -mno-inline-sqrt -mdwarf2-asm
666 -mearly-stop-bits -mfixed-range=register-range -mtls-size=tls-size
667 -mtune=cpu-type -milp32 -mlp64 -msched-br-data-spec
668 -msched-ar-data-spec -msched-control-spec -msched-br-in-data-spec
669 -msched-ar-in-data-spec -msched-in-control-spec -msched-spec-ldc
670 -msched-spec-control-ldc -msched-prefer-non-data-spec-insns
671 -msched-prefer-non-control-spec-insns
672 -msched-stop-bits-after-every-cycle
673 -msched-count-spec-in-critical-path
674 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost
675 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=max-
676 insns
677
678 LM32 Options -mbarrel-shift-enabled -mdivide-enabled
679 -mmultiply-enabled -msign-extend-enabled -muser-enabled
680
681 LoongArch Options -march=cpu-type -mtune=cpu-type -mabi=base-abi-
682 type -mfpu=fpu-type -msoft-float -msingle-float -mdouble-float
683 -mbranch-cost=n -mcheck-zero-division -mno-check-zero-division
684 -mcond-move-int -mno-cond-move-int -mcond-move-float
685 -mno-cond-move-float -memcpy -mno-memcpy -mstrict-align
686 -mno-strict-align -mmax-inline-memcpy-size=n -mexplicit-relocs
687 -mno-explicit-relocs -mdirect-extern-access
688 -mno-direct-extern-access -mcmodel=code-model
689
690 M32R/D Options -m32r2 -m32rx -m32r -mdebug -malign-loops
691 -mno-align-loops -missue-rate=number -mbranch-cost=number
692 -mmodel=code-size-model-type -msdata=sdata-type -mno-flush-func
693 -mflush-func=name -mno-flush-trap -mflush-trap=number -G num
694
695 M32C Options -mcpu=cpu -msim -memregs=number
696
697 M680x0 Options -march=arch -mcpu=cpu -mtune=tune -m68000 -m68020
698 -m68020-40 -m68020-60 -m68030 -m68040 -m68060 -mcpu32 -m5200
699 -m5206e -m528x -m5307 -m5407 -mcfv4e -mbitfield -mno-bitfield
700 -mc68000 -mc68020 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div
701 -mshort -mno-short -mhard-float -m68881 -msoft-float -mpcrel
702 -malign-int -mstrict-align -msep-data -mno-sep-data
703 -mshared-library-id=n -mid-shared-library -mno-id-shared-library
704 -mxgot -mno-xgot -mlong-jump-table-offsets
705
706 MCore Options -mhardlit -mno-hardlit -mdiv -mno-div
707 -mrelax-immediates -mno-relax-immediates -mwide-bitfields
708 -mno-wide-bitfields -m4byte-functions -mno-4byte-functions
709 -mcallgraph-data -mno-callgraph-data -mslow-bytes -mno-slow-bytes
710 -mno-lsim -mlittle-endian -mbig-endian -m210 -m340
711 -mstack-increment
712
713 MicroBlaze Options -msoft-float -mhard-float -msmall-divides
714 -mcpu=cpu -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift
715 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss
716 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt
717 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-app-model
718 -mpic-data-is-text-relative
719
720 MIPS Options -EL -EB -march=arch -mtune=arch -mips1 -mips2
721 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 -mips32r6
722 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 -mips16
723 -mno-mips16 -mflip-mips16 -minterlink-compressed
724 -mno-interlink-compressed -minterlink-mips16 -mno-interlink-mips16
725 -mabi=abi -mabicalls -mno-abicalls -mshared -mno-shared -mplt
726 -mno-plt -mxgot -mno-xgot -mgp32 -mgp64 -mfp32 -mfpxx -mfp64
727 -mhard-float -msoft-float -mno-float -msingle-float
728 -mdouble-float -modd-spreg -mno-odd-spreg -mabs=mode
729 -mnan=encoding -mdsp -mno-dsp -mdspr2 -mno-dspr2 -mmcu
730 -mmno-mcu -meva -mno-eva -mvirt -mno-virt -mxpa -mno-xpa -mcrc
731 -mno-crc -mginv -mno-ginv -mmicromips -mno-micromips -mmsa
732 -mno-msa -mloongson-mmi -mno-loongson-mmi -mloongson-ext
733 -mno-loongson-ext -mloongson-ext2 -mno-loongson-ext2 -mfpu=fpu-
734 type -msmartmips -mno-smartmips -mpaired-single
735 -mno-paired-single -mdmx -mno-mdmx -mips3d -mno-mips3d -mmt
736 -mno-mt -mllsc -mno-llsc -mlong64 -mlong32 -msym32 -mno-sym32
737 -Gnum -mlocal-sdata -mno-local-sdata -mextern-sdata
738 -mno-extern-sdata -mgpopt -mno-gopt -membedded-data
739 -mno-embedded-data -muninit-const-in-rodata
740 -mno-uninit-const-in-rodata -mcode-readable=setting
741 -msplit-addresses -mno-split-addresses -mexplicit-relocs
742 -mno-explicit-relocs -mcheck-zero-division
743 -mno-check-zero-division -mdivide-traps -mdivide-breaks
744 -mload-store-pairs -mno-load-store-pairs -munaligned-access
745 -mno-unaligned-access -mmemcpy -mno-memcpy -mlong-calls
746 -mno-long-calls -mmad -mno-mad -mimadd -mno-imadd -mfused-madd
747 -mno-fused-madd -nocpp -mfix-24k -mno-fix-24k -mfix-r4000
748 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 -mfix-r5900
749 -mno-fix-r5900 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000
750 -mno-fix-rm7000 -mfix-vr4120 -mno-fix-vr4120 -mfix-vr4130
751 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 -mflush-func=func
752 -mno-flush-func -mbranch-cost=num -mbranch-likely
753 -mno-branch-likely -mcompact-branches=policy -mfp-exceptions
754 -mno-fp-exceptions -mvr4130-align -mno-vr4130-align -msynci
755 -mno-synci -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4
756 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address
757 -mframe-header-opt -mno-frame-header-opt
758
759 MMIX Options -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon
760 -mabi=gnu -mabi=mmixware -mzero-extend -mknuthdiv
761 -mtoplevel-symbols -melf -mbranch-predict -mno-branch-predict
762 -mbase-addresses -mno-base-addresses -msingle-exit
763 -mno-single-exit
764
765 MN10300 Options -mmult-bug -mno-mult-bug -mno-am33 -mam33
766 -mam33-2 -mam34 -mtune=cpu-type -mreturn-pointer-on-d0 -mno-crt0
767 -mrelax -mliw -msetlb
768
769 Moxie Options -meb -mel -mmul.x -mno-crt0
770
771 MSP430 Options -msim -masm-hex -mmcu= -mcpu= -mlarge -msmall
772 -mrelax -mwarn-mcu -mcode-region= -mdata-region= -msilicon-errata=
773 -msilicon-errata-warn= -mhwmult= -minrt -mtiny-printf
774 -mmax-inline-shift=
775
776 NDS32 Options -mbig-endian -mlittle-endian -mreduced-regs
777 -mfull-regs -mcmov -mno-cmov -mext-perf -mno-ext-perf -mext-perf2
778 -mno-ext-perf2 -mext-string -mno-ext-string -mv3push -mno-v3push
779 -m16bit -mno-16bit -misr-vector-size=num -mcache-block-size=num
780 -march=arch -mcmodel=code-model -mctor-dtor -mrelax
781
782 Nios II Options -G num -mgpopt=option -mgpopt -mno-gpopt
783 -mgprel-sec=regexp -mr0rel-sec=regexp -mel -meb -mno-bypass-cache
784 -mbypass-cache -mno-cache-volatile -mcache-volatile
785 -mno-fast-sw-div -mfast-sw-div -mhw-mul -mno-hw-mul -mhw-mulx
786 -mno-hw-mulx -mno-hw-div -mhw-div -mcustom-insn=N
787 -mno-custom-insn -mcustom-fpu-cfg=name -mhal -msmallc
788 -msys-crt0=name -msys-lib=name -march=arch -mbmx -mno-bmx -mcdx
789 -mno-cdx
790
791 Nvidia PTX Options -m64 -mmainkernel -moptimize
792
793 OpenRISC Options -mboard=name -mnewlib -mhard-mul -mhard-div
794 -msoft-mul -msoft-div -msoft-float -mhard-float -mdouble-float
795 -munordered-float -mcmov -mror -mrori -msext -msfimm -mshftimm
796 -mcmodel=code-model
797
798 PDP-11 Options -mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45
799 -m10 -mint32 -mno-int16 -mint16 -mno-int32 -msplit -munix-asm
800 -mdec-asm -mgnu-asm -mlra
801
802 PowerPC Options See RS/6000 and PowerPC Options.
803
804 PRU Options -mmcu=mcu -minrt -mno-relax -mloop -mabi=variant
805
806 RISC-V Options -mbranch-cost=N-instruction -mplt -mno-plt
807 -mabi=ABI-string -mfdiv -mno-fdiv -mdiv -mno-div -misa-spec=ISA-
808 spec-string -march=ISA-string -mtune=processor-string
809 -mpreferred-stack-boundary=num -msmall-data-limit=N-bytes
810 -msave-restore -mno-save-restore -mshorten-memrefs
811 -mno-shorten-memrefs -mstrict-align -mno-strict-align
812 -mcmodel=medlow -mcmodel=medany -mexplicit-relocs
813 -mno-explicit-relocs -mrelax -mno-relax -mriscv-attribute
814 -mno-riscv-attribute -malign-data=type -mbig-endian
815 -mlittle-endian -mstack-protector-guard=guard
816 -mstack-protector-guard-reg=reg
817 -mstack-protector-guard-offset=offset -mcsr-check -mno-csr-check
818 -minline-atomics -mno-inline-atomics
819
820 RL78 Options -msim -mmul=none -mmul=g13 -mmul=g14 -mallregs
821 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14
822 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts
823
824 RS/6000 and PowerPC Options -mcpu=cpu-type -mtune=cpu-type
825 -mcmodel=code-model -mpowerpc64 -maltivec -mno-altivec
826 -mpowerpc-gpopt -mno-powerpc-gpopt -mpowerpc-gfxopt
827 -mno-powerpc-gfxopt -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb
828 -mpopcntd -mno-popcntd -mfprnd -mno-fprnd -mcmpb -mno-cmpb
829 -mhard-dfp -mno-hard-dfp -mfull-toc -mminimal-toc
830 -mno-fp-in-toc -mno-sum-in-toc -m64 -m32 -mxl-compat
831 -mno-xl-compat -mpe -malign-power -malign-natural -msoft-float
832 -mhard-float -mmultiple -mno-multiple -mupdate -mno-update
833 -mavoid-indexed-addresses -mno-avoid-indexed-addresses
834 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align
835 -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
836 -mrelocatable-lib -mno-relocatable-lib -mtoc -mno-toc -mlittle
837 -mlittle-endian -mbig -mbig-endian -mdynamic-no-pic -mswdiv
838 -msingle-pic-base -mprioritize-restricted-insns=priority
839 -msched-costly-dep=dependence_type -minsert-sched-nops=scheme
840 -mcall-aixdesc -mcall-eabi -mcall-freebsd -mcall-linux
841 -mcall-netbsd -mcall-openbsd -mcall-sysv -mcall-sysv-eabi
842 -mcall-sysv-noeabi -mtraceback=traceback_type -maix-struct-return
843 -msvr4-struct-return -mabi=abi-type -msecure-plt -mbss-plt
844 -mlongcall -mno-longcall -mpltseq -mno-pltseq
845 -mblock-move-inline-limit=num -mblock-compare-inline-limit=num
846 -mblock-compare-inline-loop-limit=num -mno-block-ops-unaligned-vsx
847 -mstring-compare-inline-limit=num -misel -mno-isel -mvrsave
848 -mno-vrsave -mmulhw -mno-mulhw -mdlmzb -mno-dlmzb -mprototype
849 -mno-prototype -msim -mmvme -mads -myellowknife -memb -msdata
850 -msdata=opt -mreadonly-in-sdata -mvxworks -G num -mrecip
851 -mrecip=opt -mno-recip -mrecip-precision -mno-recip-precision
852 -mveclibabi=type -mfriz -mno-friz -mpointers-to-nested-functions
853 -mno-pointers-to-nested-functions -msave-toc-indirect
854 -mno-save-toc-indirect -mpower8-fusion -mno-mpower8-fusion
855 -mpower8-vector -mno-power8-vector -mcrypto -mno-crypto -mhtm
856 -mno-htm -mquad-memory -mno-quad-memory -mquad-memory-atomic
857 -mno-quad-memory-atomic -mcompat-align-parm -mno-compat-align-parm
858 -mfloat128 -mno-float128 -mfloat128-hardware
859 -mno-float128-hardware -mgnu-attribute -mno-gnu-attribute
860 -mstack-protector-guard=guard -mstack-protector-guard-reg=reg
861 -mstack-protector-guard-offset=offset -mprefixed -mno-prefixed
862 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
863 -mprivileged -mno-privileged
864
865 RX Options -m64bit-doubles -m32bit-doubles -fpu -nofpu -mcpu=
866 -mbig-endian-data -mlittle-endian-data -msmall-data -msim
867 -mno-sim -mas100-syntax -mno-as100-syntax -mrelax
868 -mmax-constant-size= -mint-register= -mpid -mallow-string-insns
869 -mno-allow-string-insns -mjsr -mno-warn-multiple-fast-interrupts
870 -msave-acc-in-interrupts
871
872 S/390 and zSeries Options -mtune=cpu-type -march=cpu-type
873 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp
874 -mlong-double-64 -mlong-double-128 -mbackchain -mno-backchain
875 -mpacked-stack -mno-packed-stack -msmall-exec -mno-small-exec
876 -mmvcle -mno-mvcle -m64 -m31 -mdebug -mno-debug -mesa -mzarch
877 -mhtm -mvx -mzvector -mtpf-trace -mno-tpf-trace
878 -mtpf-trace-skip -mno-tpf-trace-skip -mfused-madd -mno-fused-madd
879 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard
880 -mhotpatch=halfwords,halfwords
881
882 SH Options -m1 -m2 -m2e -m2a-nofpu -m2a-single-only -m2a-single
883 -m2a -m3 -m3e -m4-nofpu -m4-single-only -m4-single -m4
884 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al -mb -ml
885 -mdalign -mrelax -mbigtable -mfmovd -mrenesas -mno-renesas
886 -mnomacsave -mieee -mno-ieee -mbitops -misize
887 -minline-ic_invalidate -mpadstruct -mprefergot -musermode
888 -multcost=number -mdiv=strategy -mdivsi3_libfunc=name
889 -mfixed-range=register-range -maccumulate-outgoing-args
890 -matomic-model=atomic-model -mbranch-cost=num -mzdcbranch
891 -mno-zdcbranch -mcbranch-force-delay-slot -mfused-madd
892 -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra
893 -mpretend-cmove -mtas
894
895 Solaris 2 Options -mclear-hwcap -mno-clear-hwcap -mimpure-text
896 -mno-impure-text -pthreads
897
898 SPARC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model
899 -mmemory-model=mem-model -m32 -m64 -mapp-regs -mno-app-regs
900 -mfaster-structs -mno-faster-structs -mflat -mno-flat -mfpu
901 -mno-fpu -mhard-float -msoft-float -mhard-quad-float
902 -msoft-quad-float -mstack-bias -mno-stack-bias -mstd-struct-return
903 -mno-std-struct-return -munaligned-doubles -mno-unaligned-doubles
904 -muser-mode -mno-user-mode -mv8plus -mno-v8plus -mvis -mno-vis
905 -mvis2 -mno-vis2 -mvis3 -mno-vis3 -mvis4 -mno-vis4 -mvis4b
906 -mno-vis4b -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld
907 -mno-fsmuld -mpopc -mno-popc -msubxc -mno-subxc -mfix-at697f
908 -mfix-ut699 -mfix-ut700 -mfix-gr712rc -mlra -mno-lra
909
910 System V Options -Qy -Qn -YP,paths -Ym,dir
911
912 V850 Options -mlong-calls -mno-long-calls -mep -mno-ep
913 -mprolog-function -mno-prolog-function -mspace -mtda=n -msda=n
914 -mzda=n -mapp-regs -mno-app-regs -mdisable-callt
915 -mno-disable-callt -mv850e2v3 -mv850e2 -mv850e1 -mv850es -mv850e
916 -mv850 -mv850e3v5 -mloop -mrelax -mlong-jumps -msoft-float
917 -mhard-float -mgcc-abi -mrh850-abi -mbig-switch
918
919 VAX Options -mg -mgnu -munix -mlra
920
921 Visium Options -mdebug -msim -mfpu -mno-fpu -mhard-float
922 -msoft-float -mcpu=cpu-type -mtune=cpu-type -msv-mode
923 -muser-mode
924
925 VMS Options -mvms-return-codes -mdebug-main=prefix -mmalloc64
926 -mpointer-size=size
927
928 VxWorks Options -mrtp -non-static -Bstatic -Bdynamic -Xbind-lazy
929 -Xbind-now
930
931 x86 Options -mtune=cpu-type -march=cpu-type -mtune-ctrl=feature-
932 list -mdump-tune-features -mno-default -mfpmath=unit
933 -masm=dialect -mno-fancy-math-387 -mno-fp-ret-in-387 -m80387
934 -mhard-float -msoft-float -mno-wide-multiply -mrtd
935 -malign-double -mpreferred-stack-boundary=num
936 -mincoming-stack-boundary=num -mcld -mcx16 -msahf -mmovbe
937 -mcrc32 -mmwait -mrecip -mrecip=opt -mvzeroupper -mprefer-avx128
938 -mprefer-vector-width=opt -mmove-max=bits -mstore-max=bits -mmmx
939 -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx
940 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl
941 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes
942 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd
943 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves
944 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4
945 -mxop -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm
946 -mhle -mlwp -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes
947 -mwaitpkg -mshstk -mmanual-endbr -mcet-switch -mforce-indirect-call
948 -mavx512vbmi2 -mavx512bf16 -menqcmd -mvpclmulqdq -mavx512bitalg
949 -mmovdiri -mmovdir64b -mavx512vpopcntdq -mavx5124fmaps
950 -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid -mrdseed -msgx
951 -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8
952 -mamx-bf16 -muintr -mhreset -mavxvnni -mavx512fp16 -mavxifma
953 -mavxvnniint8 -mavxneconvert -mcmpccxadd -mamx-fp16 -mprefetchi
954 -mraoint -mamx-complex -mcldemote -mms-bitfields
955 -mno-align-stringops -minline-all-stringops
956 -minline-stringops-dynamically -mstringop-strategy=alg -mkl
957 -mwidekl -mmemcpy-strategy=strategy -mmemset-strategy=strategy
958 -mpush-args -maccumulate-outgoing-args -m128bit-long-double
959 -m96bit-long-double -mlong-double-64 -mlong-double-80
960 -mlong-double-128 -mregparm=num -msseregparm -mveclibabi=type
961 -mvect8-ret-in-mem -mpc32 -mpc64 -mpc80 -mdaz-ftz -mstackrealign
962 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs
963 -mcmodel=code-model -mabi=name -maddress-mode=mode -m32 -m64
964 -mx32 -m16 -miamcu -mlarge-data-threshold=num -msse2avx
965 -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv
966 -minstrument-return=type -mfentry-name=name -mfentry-section=name
967 -mavx256-split-unaligned-load -mavx256-split-unaligned-store
968 -malign-data=type -mstack-protector-guard=guard
969 -mstack-protector-guard-reg=reg
970 -mstack-protector-guard-offset=offset
971 -mstack-protector-guard-symbol=symbol -mgeneral-regs-only
972 -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop
973 -mindirect-branch=choice -mfunction-return=choice
974 -mindirect-branch-register -mharden-sls=choice
975 -mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access
976 -munroll-only-small-loops -mlam=choice
977
978 x86 Windows Options -mconsole -mcygwin -mno-cygwin -mdll
979 -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows
980 -fno-set-stack-executable
981
982 Xstormy16 Options -msim
983
984 Xtensa Options -mconst16 -mno-const16 -mfused-madd
985 -mno-fused-madd -mforce-no-pic -mserialize-volatile
986 -mno-serialize-volatile -mtext-section-literals
987 -mno-text-section-literals -mauto-litpools -mno-auto-litpools
988 -mtarget-align -mno-target-align -mlongcalls -mno-longcalls
989 -mabi=abi-type -mextra-l32r-costs=cycles
990
991 zSeries Options See S/390 and zSeries Options.
992
993 Options Controlling the Kind of Output
994 Compilation can involve up to four stages: preprocessing, compilation
995 proper, assembly and linking, always in that order. GCC is capable of
996 preprocessing and compiling several files either into several assembler
997 input files, or into one assembler input file; then each assembler
998 input file produces an object file, and linking combines all the object
999 files (those newly compiled, and those specified as input) into an
1000 executable file.
1001
1002 For any given input file, the file name suffix determines what kind of
1003 compilation is done:
1004
1005 file.c
1006 C source code that must be preprocessed.
1007
1008 file.i
1009 C source code that should not be preprocessed.
1010
1011 file.ii
1012 C++ source code that should not be preprocessed.
1013
1014 file.m
1015 Objective-C source code. Note that you must link with the libobjc
1016 library to make an Objective-C program work.
1017
1018 file.mi
1019 Objective-C source code that should not be preprocessed.
1020
1021 file.mm
1022 file.M
1023 Objective-C++ source code. Note that you must link with the
1024 libobjc library to make an Objective-C++ program work. Note that
1025 .M refers to a literal capital M.
1026
1027 file.mii
1028 Objective-C++ source code that should not be preprocessed.
1029
1030 file.h
1031 C, C++, Objective-C or Objective-C++ header file to be turned into
1032 a precompiled header (default), or C, C++ header file to be turned
1033 into an Ada spec (via the -fdump-ada-spec switch).
1034
1035 file.cc
1036 file.cp
1037 file.cxx
1038 file.cpp
1039 file.CPP
1040 file.c++
1041 file.C
1042 C++ source code that must be preprocessed. Note that in .cxx, the
1043 last two letters must both be literally x. Likewise, .C refers to
1044 a literal capital C.
1045
1046 file.mm
1047 file.M
1048 Objective-C++ source code that must be preprocessed.
1049
1050 file.mii
1051 Objective-C++ source code that should not be preprocessed.
1052
1053 file.hh
1054 file.H
1055 file.hp
1056 file.hxx
1057 file.hpp
1058 file.HPP
1059 file.h++
1060 file.tcc
1061 C++ header file to be turned into a precompiled header or Ada spec.
1062
1063 file.f
1064 file.for
1065 file.ftn
1066 Fixed form Fortran source code that should not be preprocessed.
1067
1068 file.F
1069 file.FOR
1070 file.fpp
1071 file.FPP
1072 file.FTN
1073 Fixed form Fortran source code that must be preprocessed (with the
1074 traditional preprocessor).
1075
1076 file.f90
1077 file.f95
1078 file.f03
1079 file.f08
1080 Free form Fortran source code that should not be preprocessed.
1081
1082 file.F90
1083 file.F95
1084 file.F03
1085 file.F08
1086 Free form Fortran source code that must be preprocessed (with the
1087 traditional preprocessor).
1088
1089 file.go
1090 Go source code.
1091
1092 file.d
1093 D source code.
1094
1095 file.di
1096 D interface file.
1097
1098 file.dd
1099 D documentation code (Ddoc).
1100
1101 file.ads
1102 Ada source code file that contains a library unit declaration (a
1103 declaration of a package, subprogram, or generic, or a generic
1104 instantiation), or a library unit renaming declaration (a package,
1105 generic, or subprogram renaming declaration). Such files are also
1106 called specs.
1107
1108 file.adb
1109 Ada source code file containing a library unit body (a subprogram
1110 or package body). Such files are also called bodies.
1111
1112 file.s
1113 Assembler code.
1114
1115 file.S
1116 file.sx
1117 Assembler code that must be preprocessed.
1118
1119 other
1120 An object file to be fed straight into linking. Any file name with
1121 no recognized suffix is treated this way.
1122
1123 You can specify the input language explicitly with the -x option:
1124
1125 -x language
1126 Specify explicitly the language for the following input files
1127 (rather than letting the compiler choose a default based on the
1128 file name suffix). This option applies to all following input
1129 files until the next -x option. Possible values for language are:
1130
1131 c c-header cpp-output
1132 c++ c++-header c++-system-header c++-user-header c++-cpp-output
1133 objective-c objective-c-header objective-c-cpp-output
1134 objective-c++ objective-c++-header objective-c++-cpp-output
1135 assembler assembler-with-cpp
1136 ada
1137 d
1138 f77 f77-cpp-input f95 f95-cpp-input
1139 go
1140
1141 -x none
1142 Turn off any specification of a language, so that subsequent files
1143 are handled according to their file name suffixes (as they are if
1144 -x has not been used at all).
1145
1146 If you only want some of the stages of compilation, you can use -x (or
1147 filename suffixes) to tell gcc where to start, and one of the options
1148 -c, -S, or -E to say where gcc is to stop. Note that some combinations
1149 (for example, -x cpp-output -E) instruct gcc to do nothing at all.
1150
1151 -c Compile or assemble the source files, but do not link. The linking
1152 stage simply is not done. The ultimate output is in the form of an
1153 object file for each source file.
1154
1155 By default, the object file name for a source file is made by
1156 replacing the suffix .c, .i, .s, etc., with .o.
1157
1158 Unrecognized input files, not requiring compilation or assembly,
1159 are ignored.
1160
1161 -S Stop after the stage of compilation proper; do not assemble. The
1162 output is in the form of an assembler code file for each non-
1163 assembler input file specified.
1164
1165 By default, the assembler file name for a source file is made by
1166 replacing the suffix .c, .i, etc., with .s.
1167
1168 Input files that don't require compilation are ignored.
1169
1170 -E Stop after the preprocessing stage; do not run the compiler proper.
1171 The output is in the form of preprocessed source code, which is
1172 sent to the standard output.
1173
1174 Input files that don't require preprocessing are ignored.
1175
1176 -o file
1177 Place the primary output in file file. This applies to whatever
1178 sort of output is being produced, whether it be an executable file,
1179 an object file, an assembler file or preprocessed C code.
1180
1181 If -o is not specified, the default is to put an executable file in
1182 a.out, the object file for source.suffix in source.o, its assembler
1183 file in source.s, a precompiled header file in source.suffix.gch,
1184 and all preprocessed C source on standard output.
1185
1186 Though -o names only the primary output, it also affects the naming
1187 of auxiliary and dump outputs. See the examples below. Unless
1188 overridden, both auxiliary outputs and dump outputs are placed in
1189 the same directory as the primary output. In auxiliary outputs,
1190 the suffix of the input file is replaced with that of the auxiliary
1191 output file type; in dump outputs, the suffix of the dump file is
1192 appended to the input file suffix. In compilation commands, the
1193 base name of both auxiliary and dump outputs is that of the primary
1194 output; in compile and link commands, the primary output name,
1195 minus the executable suffix, is combined with the input file name.
1196 If both share the same base name, disregarding the suffix, the
1197 result of the combination is that base name, otherwise, they are
1198 concatenated, separated by a dash.
1199
1200 gcc -c foo.c ...
1201
1202 will use foo.o as the primary output, and place aux outputs and
1203 dumps next to it, e.g., aux file foo.dwo for -gsplit-dwarf, and
1204 dump file foo.c.???r.final for -fdump-rtl-final.
1205
1206 If a non-linker output file is explicitly specified, aux and dump
1207 files by default take the same base name:
1208
1209 gcc -c foo.c -o dir/foobar.o ...
1210
1211 will name aux outputs dir/foobar.* and dump outputs dir/foobar.c.*.
1212
1213 A linker output will instead prefix aux and dump outputs:
1214
1215 gcc foo.c bar.c -o dir/foobar ...
1216
1217 will generally name aux outputs dir/foobar-foo.* and
1218 dir/foobar-bar.*, and dump outputs dir/foobar-foo.c.* and
1219 dir/foobar-bar.c.*.
1220
1221 The one exception to the above is when the executable shares the
1222 base name with the single input:
1223
1224 gcc foo.c -o dir/foo ...
1225
1226 in which case aux outputs are named dir/foo.* and dump outputs
1227 named dir/foo.c.*.
1228
1229 The location and the names of auxiliary and dump outputs can be
1230 adjusted by the options -dumpbase, -dumpbase-ext, -dumpdir,
1231 -save-temps=cwd, and -save-temps=obj.
1232
1233 -dumpbase dumpbase
1234 This option sets the base name for auxiliary and dump output files.
1235 It does not affect the name of the primary output file.
1236 Intermediate outputs, when preserved, are not regarded as primary
1237 outputs, but as auxiliary outputs:
1238
1239 gcc -save-temps -S foo.c
1240
1241 saves the (no longer) temporary preprocessed file in foo.i, and
1242 then compiles to the (implied) output file foo.s, whereas:
1243
1244 gcc -save-temps -dumpbase save-foo -c foo.c
1245
1246 preprocesses to in save-foo.i, compiles to save-foo.s (now an
1247 intermediate, thus auxiliary output), and then assembles to the
1248 (implied) output file foo.o.
1249
1250 Absent this option, dump and aux files take their names from the
1251 input file, or from the (non-linker) output file, if one is
1252 explicitly specified: dump output files (e.g. those requested by
1253 -fdump-* options) with the input name suffix, and aux output files
1254 (those requested by other non-dump options, e.g. "-save-temps",
1255 "-gsplit-dwarf", "-fcallgraph-info") without it.
1256
1257 Similar suffix differentiation of dump and aux outputs can be
1258 attained for explicitly-given -dumpbase basename.suf by also
1259 specifying -dumpbase-ext .suf.
1260
1261 If dumpbase is explicitly specified with any directory component,
1262 any dumppfx specification (e.g. -dumpdir or -save-temps=*) is
1263 ignored, and instead of appending to it, dumpbase fully overrides
1264 it:
1265
1266 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1267 -dumpdir pfx- -save-temps=cwd ...
1268
1269 creates auxiliary and dump outputs named alt/foo.*, disregarding
1270 dir/ in -o, the ./ prefix implied by -save-temps=cwd, and pfx- in
1271 -dumpdir.
1272
1273 When -dumpbase is specified in a command that compiles multiple
1274 inputs, or that compiles and then links, it may be combined with
1275 dumppfx, as specified under -dumpdir. Then, each input file is
1276 compiled using the combined dumppfx, and default values for
1277 dumpbase and auxdropsuf are computed for each input file:
1278
1279 gcc foo.c bar.c -c -dumpbase main ...
1280
1281 creates foo.o and bar.o as primary outputs, and avoids overwriting
1282 the auxiliary and dump outputs by using the dumpbase as a prefix,
1283 creating auxiliary and dump outputs named main-foo.* and
1284 main-bar.*.
1285
1286 An empty string specified as dumpbase avoids the influence of the
1287 output basename in the naming of auxiliary and dump outputs during
1288 compilation, computing default values :
1289
1290 gcc -c foo.c -o dir/foobar.o -dumpbase " ...
1291
1292 will name aux outputs dir/foo.* and dump outputs dir/foo.c.*. Note
1293 how their basenames are taken from the input name, but the
1294 directory still defaults to that of the output.
1295
1296 The empty-string dumpbase does not prevent the use of the output
1297 basename for outputs during linking:
1298
1299 gcc foo.c bar.c -o dir/foobar -dumpbase " -flto ...
1300
1301 The compilation of the source files will name auxiliary outputs
1302 dir/foo.* and dir/bar.*, and dump outputs dir/foo.c.* and
1303 dir/bar.c.*. LTO recompilation during linking will use dir/foobar.
1304 as the prefix for dumps and auxiliary files.
1305
1306 -dumpbase-ext auxdropsuf
1307 When forming the name of an auxiliary (but not a dump) output file,
1308 drop trailing auxdropsuf from dumpbase before appending any
1309 suffixes. If not specified, this option defaults to the suffix of
1310 a default dumpbase, i.e., the suffix of the input file when
1311 -dumpbase is not present in the command line, or dumpbase is
1312 combined with dumppfx.
1313
1314 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1315
1316 creates dir/foo.o as the main output, and generates auxiliary
1317 outputs in dir/x-foo.*, taking the location of the primary output,
1318 and dropping the .c suffix from the dumpbase. Dump outputs retain
1319 the suffix: dir/x-foo.c.*.
1320
1321 This option is disregarded if it does not match the suffix of a
1322 specified dumpbase, except as an alternative to the executable
1323 suffix when appending the linker output base name to dumppfx, as
1324 specified below:
1325
1326 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1327
1328 creates main.out as the primary output, and avoids overwriting the
1329 auxiliary and dump outputs by using the executable name minus
1330 auxdropsuf as a prefix, creating auxiliary outputs named main-foo.*
1331 and main-bar.* and dump outputs named main-foo.c.* and
1332 main-bar.c.*.
1333
1334 -dumpdir dumppfx
1335 When forming the name of an auxiliary or dump output file, use
1336 dumppfx as a prefix:
1337
1338 gcc -dumpdir pfx- -c foo.c ...
1339
1340 creates foo.o as the primary output, and auxiliary outputs named
1341 pfx-foo.*, combining the given dumppfx with the default dumpbase
1342 derived from the default primary output, derived in turn from the
1343 input name. Dump outputs also take the input name suffix:
1344 pfx-foo.c.*.
1345
1346 If dumppfx is to be used as a directory name, it must end with a
1347 directory separator:
1348
1349 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1350
1351 creates obj/bar.o as the primary output, and auxiliary outputs
1352 named dir/bar.*, combining the given dumppfx with the default
1353 dumpbase derived from the primary output name. Dump outputs also
1354 take the input name suffix: dir/bar.c.*.
1355
1356 It defaults to the location of the output file, unless the output
1357 file is a special file like "/dev/null". Options -save-temps=cwd
1358 and -save-temps=obj override this default, just like an explicit
1359 -dumpdir option. In case multiple such options are given, the last
1360 one prevails:
1361
1362 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1363
1364 outputs foo.o, with auxiliary outputs named foo.* because
1365 -save-temps=* overrides the dumppfx given by the earlier -dumpdir
1366 option. It does not matter that =obj is the default for
1367 -save-temps, nor that the output directory is implicitly the
1368 current directory. Dump outputs are named foo.c.*.
1369
1370 When compiling from multiple input files, if -dumpbase is
1371 specified, dumpbase, minus a auxdropsuf suffix, and a dash are
1372 appended to (or override, if containing any directory components)
1373 an explicit or defaulted dumppfx, so that each of the multiple
1374 compilations gets differently-named aux and dump outputs.
1375
1376 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1377
1378 outputs auxiliary dumps to dir/pfx-main-foo.* and
1379 dir/pfx-main-bar.*, appending dumpbase- to dumppfx. Dump outputs
1380 retain the input file suffix: dir/pfx-main-foo.c.* and
1381 dir/pfx-main-bar.c.*, respectively. Contrast with the single-input
1382 compilation:
1383
1384 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1385
1386 that, applying -dumpbase to a single source, does not compute and
1387 append a separate dumpbase per input file. Its auxiliary and dump
1388 outputs go in dir/pfx-main.*.
1389
1390 When compiling and then linking from multiple input files, a
1391 defaulted or explicitly specified dumppfx also undergoes the
1392 dumpbase- transformation above (e.g. the compilation of foo.c and
1393 bar.c above, but without -c). If neither -dumpdir nor -dumpbase
1394 are given, the linker output base name, minus auxdropsuf, if
1395 specified, or the executable suffix otherwise, plus a dash is
1396 appended to the default dumppfx instead. Note, however, that
1397 unlike earlier cases of linking:
1398
1399 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1400
1401 does not append the output name main to dumppfx, because -dumpdir
1402 is explicitly specified. The goal is that the explicitly-specified
1403 dumppfx may contain the specified output name as part of the
1404 prefix, if desired; only an explicitly-specified -dumpbase would be
1405 combined with it, in order to avoid simply discarding a meaningful
1406 option.
1407
1408 When compiling and then linking from a single input file, the
1409 linker output base name will only be appended to the default
1410 dumppfx as above if it does not share the base name with the single
1411 input file name. This has been covered in single-input linking
1412 cases above, but not with an explicit -dumpdir that inhibits the
1413 combination, even if overridden by -save-temps=*:
1414
1415 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1416
1417 Auxiliary outputs are named foo.*, and dump outputs foo.c.*, in the
1418 current working directory as ultimately requested by
1419 -save-temps=cwd.
1420
1421 Summing it all up for an intuitive though slightly imprecise data
1422 flow: the primary output name is broken into a directory part and a
1423 basename part; dumppfx is set to the former, unless overridden by
1424 -dumpdir or -save-temps=*, and dumpbase is set to the latter,
1425 unless overriden by -dumpbase. If there are multiple inputs or
1426 linking, this dumpbase may be combined with dumppfx and taken from
1427 each input file. Auxiliary output names for each input are formed
1428 by combining dumppfx, dumpbase minus suffix, and the auxiliary
1429 output suffix; dump output names are only different in that the
1430 suffix from dumpbase is retained.
1431
1432 When it comes to auxiliary and dump outputs created during LTO
1433 recompilation, a combination of dumppfx and dumpbase, as given or
1434 as derived from the linker output name but not from inputs, even in
1435 cases in which this combination would not otherwise be used as
1436 such, is passed down with a trailing period replacing the compiler-
1437 added dash, if any, as a -dumpdir option to lto-wrapper; being
1438 involved in linking, this program does not normally get any
1439 -dumpbase and -dumpbase-ext, and it ignores them.
1440
1441 When running sub-compilers, lto-wrapper appends LTO stage names to
1442 the received dumppfx, ensures it contains a directory component so
1443 that it overrides any -dumpdir, and passes that as -dumpbase to
1444 sub-compilers.
1445
1446 -v Print (on standard error output) the commands executed to run the
1447 stages of compilation. Also print the version number of the
1448 compiler driver program and of the preprocessor and the compiler
1449 proper.
1450
1451 -###
1452 Like -v except the commands are not executed and arguments are
1453 quoted unless they contain only alphanumeric characters or "./-_".
1454 This is useful for shell scripts to capture the driver-generated
1455 command lines.
1456
1457 --help
1458 Print (on the standard output) a description of the command-line
1459 options understood by gcc. If the -v option is also specified then
1460 --help is also passed on to the various processes invoked by gcc,
1461 so that they can display the command-line options they accept. If
1462 the -Wextra option has also been specified (prior to the --help
1463 option), then command-line options that have no documentation
1464 associated with them are also displayed.
1465
1466 --target-help
1467 Print (on the standard output) a description of target-specific
1468 command-line options for each tool. For some targets extra target-
1469 specific information may also be printed.
1470
1471 --help={class|[^]qualifier}[,...]
1472 Print (on the standard output) a description of the command-line
1473 options understood by the compiler that fit into all specified
1474 classes and qualifiers. These are the supported classes:
1475
1476 optimizers
1477 Display all of the optimization options supported by the
1478 compiler.
1479
1480 warnings
1481 Display all of the options controlling warning messages
1482 produced by the compiler.
1483
1484 target
1485 Display target-specific options. Unlike the --target-help
1486 option however, target-specific options of the linker and
1487 assembler are not displayed. This is because those tools do
1488 not currently support the extended --help= syntax.
1489
1490 params
1491 Display the values recognized by the --param option.
1492
1493 language
1494 Display the options supported for language, where language is
1495 the name of one of the languages supported in this version of
1496 GCC. If an option is supported by all languages, one needs to
1497 select common class.
1498
1499 common
1500 Display the options that are common to all languages.
1501
1502 These are the supported qualifiers:
1503
1504 undocumented
1505 Display only those options that are undocumented.
1506
1507 joined
1508 Display options taking an argument that appears after an equal
1509 sign in the same continuous piece of text, such as:
1510 --help=target.
1511
1512 separate
1513 Display options taking an argument that appears as a separate
1514 word following the original option, such as: -o output-file.
1515
1516 Thus for example to display all the undocumented target-specific
1517 switches supported by the compiler, use:
1518
1519 --help=target,undocumented
1520
1521 The sense of a qualifier can be inverted by prefixing it with the ^
1522 character, so for example to display all binary warning options
1523 (i.e., ones that are either on or off and that do not take an
1524 argument) that have a description, use:
1525
1526 --help=warnings,^joined,^undocumented
1527
1528 The argument to --help= should not consist solely of inverted
1529 qualifiers.
1530
1531 Combining several classes is possible, although this usually
1532 restricts the output so much that there is nothing to display. One
1533 case where it does work, however, is when one of the classes is
1534 target. For example, to display all the target-specific
1535 optimization options, use:
1536
1537 --help=target,optimizers
1538
1539 The --help= option can be repeated on the command line. Each
1540 successive use displays its requested class of options, skipping
1541 those that have already been displayed. If --help is also
1542 specified anywhere on the command line then this takes precedence
1543 over any --help= option.
1544
1545 If the -Q option appears on the command line before the --help=
1546 option, then the descriptive text displayed by --help= is changed.
1547 Instead of describing the displayed options, an indication is given
1548 as to whether the option is enabled, disabled or set to a specific
1549 value (assuming that the compiler knows this at the point where the
1550 --help= option is used).
1551
1552 Here is a truncated example from the ARM port of gcc:
1553
1554 % gcc -Q -mabi=2 --help=target -c
1555 The following options are target specific:
1556 -mabi= 2
1557 -mabort-on-noreturn [disabled]
1558 -mapcs [disabled]
1559
1560 The output is sensitive to the effects of previous command-line
1561 options, so for example it is possible to find out which
1562 optimizations are enabled at -O2 by using:
1563
1564 -Q -O2 --help=optimizers
1565
1566 Alternatively you can discover which binary optimizations are
1567 enabled by -O3 by using:
1568
1569 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1570 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1571 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1572
1573 --version
1574 Display the version number and copyrights of the invoked GCC.
1575
1576 -pass-exit-codes
1577 Normally the gcc program exits with the code of 1 if any phase of
1578 the compiler returns a non-success return code. If you specify
1579 -pass-exit-codes, the gcc program instead returns with the
1580 numerically highest error produced by any phase returning an error
1581 indication. The C, C++, and Fortran front ends return 4 if an
1582 internal compiler error is encountered.
1583
1584 -pipe
1585 Use pipes rather than temporary files for communication between the
1586 various stages of compilation. This fails to work on some systems
1587 where the assembler is unable to read from a pipe; but the GNU
1588 assembler has no trouble.
1589
1590 -specs=file
1591 Process file after the compiler reads in the standard specs file,
1592 in order to override the defaults which the gcc driver program uses
1593 when determining what switches to pass to cc1, cc1plus, as, ld,
1594 etc. More than one -specs=file can be specified on the command
1595 line, and they are processed in order, from left to right.
1596
1597 -wrapper
1598 Invoke all subcommands under a wrapper program. The name of the
1599 wrapper program and its parameters are passed as a comma separated
1600 list.
1601
1602 gcc -c t.c -wrapper gdb,--args
1603
1604 This invokes all subprograms of gcc under gdb --args, thus the
1605 invocation of cc1 is gdb --args cc1 ....
1606
1607 -ffile-prefix-map=old=new
1608 When compiling files residing in directory old, record any
1609 references to them in the result of the compilation as if the files
1610 resided in directory new instead. Specifying this option is
1611 equivalent to specifying all the individual -f*-prefix-map options.
1612 This can be used to make reproducible builds that are location
1613 independent. Directories referenced by directives are not affected
1614 by these options. See also -fmacro-prefix-map, -fdebug-prefix-map,
1615 -fprofile-prefix-map and -fcanon-prefix-map.
1616
1617 -fcanon-prefix-map
1618 For the -f*-prefix-map options normally comparison of old prefix
1619 against the filename that would be normally referenced in the
1620 result of the compilation is done using textual comparison of the
1621 prefixes, or ignoring character case for case insensitive
1622 filesystems and considering slashes and backslashes as equal on DOS
1623 based filesystems. The -fcanon-prefix-map causes such comparisons
1624 to be done on canonicalized paths of old and the referenced
1625 filename.
1626
1627 -fplugin=name.so
1628 Load the plugin code in file name.so, assumed to be a shared object
1629 to be dlopen'd by the compiler. The base name of the shared object
1630 file is used to identify the plugin for the purposes of argument
1631 parsing (See -fplugin-arg-name-key=value below). Each plugin
1632 should define the callback functions specified in the Plugins API.
1633
1634 -fplugin-arg-name-key=value
1635 Define an argument called key with a value of value for the plugin
1636 called name.
1637
1638 -fdump-ada-spec[-slim]
1639 For C and C++ source and include files, generate corresponding Ada
1640 specs.
1641
1642 -fada-spec-parent=unit
1643 In conjunction with -fdump-ada-spec[-slim] above, generate Ada
1644 specs as child units of parent unit.
1645
1646 -fdump-go-spec=file
1647 For input files in any language, generate corresponding Go
1648 declarations in file. This generates Go "const", "type", "var",
1649 and "func" declarations which may be a useful way to start writing
1650 a Go interface to code written in some other language.
1651
1652 @file
1653 Read command-line options from file. The options read are inserted
1654 in place of the original @file option. If file does not exist, or
1655 cannot be read, then the option will be treated literally, and not
1656 removed.
1657
1658 Options in file are separated by whitespace. A whitespace
1659 character may be included in an option by surrounding the entire
1660 option in either single or double quotes. Any character (including
1661 a backslash) may be included by prefixing the character to be
1662 included with a backslash. The file may itself contain additional
1663 @file options; any such options will be processed recursively.
1664
1665 Compiling C++ Programs
1666 C++ source files conventionally use one of the suffixes .C, .cc, .cpp,
1667 .CPP, .c++, .cp, or .cxx; C++ header files often use .hh, .hpp, .H, or
1668 (for shared template code) .tcc; and preprocessed C++ files use the
1669 suffix .ii. GCC recognizes files with these names and compiles them as
1670 C++ programs even if you call the compiler the same way as for
1671 compiling C programs (usually with the name gcc).
1672
1673 However, the use of gcc does not add the C++ library. g++ is a program
1674 that calls GCC and automatically specifies linking against the C++
1675 library. It treats .c, .h and .i files as C++ source files instead of
1676 C source files unless -x is used. This program is also useful when
1677 precompiling a C header file with a .h extension for use in C++
1678 compilations. On many systems, g++ is also installed with the name
1679 c++.
1680
1681 When you compile C++ programs, you may specify many of the same
1682 command-line options that you use for compiling programs in any
1683 language; or command-line options meaningful for C and related
1684 languages; or options that are meaningful only for C++ programs.
1685
1686 Options Controlling C Dialect
1687 The following options control the dialect of C (or languages derived
1688 from C, such as C++, Objective-C and Objective-C++) that the compiler
1689 accepts:
1690
1691 -ansi
1692 In C mode, this is equivalent to -std=c90. In C++ mode, it is
1693 equivalent to -std=c++98.
1694
1695 This turns off certain features of GCC that are incompatible with
1696 ISO C90 (when compiling C code), or of standard C++ (when compiling
1697 C++ code), such as the "asm" and "typeof" keywords, and predefined
1698 macros such as "unix" and "vax" that identify the type of system
1699 you are using. It also enables the undesirable and rarely used ISO
1700 trigraph feature. For the C compiler, it disables recognition of
1701 C++ style // comments as well as the "inline" keyword.
1702
1703 The alternate keywords "__asm__", "__extension__", "__inline__" and
1704 "__typeof__" continue to work despite -ansi. You would not want to
1705 use them in an ISO C program, of course, but it is useful to put
1706 them in header files that might be included in compilations done
1707 with -ansi. Alternate predefined macros such as "__unix__" and
1708 "__vax__" are also available, with or without -ansi.
1709
1710 The -ansi option does not cause non-ISO programs to be rejected
1711 gratuitously. For that, -Wpedantic is required in addition to
1712 -ansi.
1713
1714 The macro "__STRICT_ANSI__" is predefined when the -ansi option is
1715 used. Some header files may notice this macro and refrain from
1716 declaring certain functions or defining certain macros that the ISO
1717 standard doesn't call for; this is to avoid interfering with any
1718 programs that might use these names for other things.
1719
1720 Functions that are normally built in but do not have semantics
1721 defined by ISO C (such as "alloca" and "ffs") are not built-in
1722 functions when -ansi is used.
1723
1724 -std=
1725 Determine the language standard. This option is currently only
1726 supported when compiling C or C++.
1727
1728 The compiler can accept several base standards, such as c90 or
1729 c++98, and GNU dialects of those standards, such as gnu90 or
1730 gnu++98. When a base standard is specified, the compiler accepts
1731 all programs following that standard plus those using GNU
1732 extensions that do not contradict it. For example, -std=c90 turns
1733 off certain features of GCC that are incompatible with ISO C90,
1734 such as the "asm" and "typeof" keywords, but not other GNU
1735 extensions that do not have a meaning in ISO C90, such as omitting
1736 the middle term of a "?:" expression. On the other hand, when a GNU
1737 dialect of a standard is specified, all features supported by the
1738 compiler are enabled, even when those features change the meaning
1739 of the base standard. As a result, some strict-conforming programs
1740 may be rejected. The particular standard is used by -Wpedantic to
1741 identify which features are GNU extensions given that version of
1742 the standard. For example -std=gnu90 -Wpedantic warns about C++
1743 style // comments, while -std=gnu99 -Wpedantic does not.
1744
1745 A value for this option must be provided; possible values are
1746
1747 c90
1748 c89
1749 iso9899:1990
1750 Support all ISO C90 programs (certain GNU extensions that
1751 conflict with ISO C90 are disabled). Same as -ansi for C code.
1752
1753 iso9899:199409
1754 ISO C90 as modified in amendment 1.
1755
1756 c99
1757 c9x
1758 iso9899:1999
1759 iso9899:199x
1760 ISO C99. This standard is substantially completely supported,
1761 modulo bugs and floating-point issues (mainly but not entirely
1762 relating to optional C99 features from Annexes F and G). See
1763 <https://gcc.gnu.org/c99status.html> for more information. The
1764 names c9x and iso9899:199x are deprecated.
1765
1766 c11
1767 c1x
1768 iso9899:2011
1769 ISO C11, the 2011 revision of the ISO C standard. This
1770 standard is substantially completely supported, modulo bugs,
1771 floating-point issues (mainly but not entirely relating to
1772 optional C11 features from Annexes F and G) and the optional
1773 Annexes K (Bounds-checking interfaces) and L (Analyzability).
1774 The name c1x is deprecated.
1775
1776 c17
1777 c18
1778 iso9899:2017
1779 iso9899:2018
1780 ISO C17, the 2017 revision of the ISO C standard (published in
1781 2018). This standard is same as C11 except for corrections of
1782 defects (all of which are also applied with -std=c11) and a new
1783 value of "__STDC_VERSION__", and so is supported to the same
1784 extent as C11.
1785
1786 c2x The next version of the ISO C standard, still under
1787 development. The support for this version is experimental and
1788 incomplete.
1789
1790 gnu90
1791 gnu89
1792 GNU dialect of ISO C90 (including some C99 features).
1793
1794 gnu99
1795 gnu9x
1796 GNU dialect of ISO C99. The name gnu9x is deprecated.
1797
1798 gnu11
1799 gnu1x
1800 GNU dialect of ISO C11. The name gnu1x is deprecated.
1801
1802 gnu17
1803 gnu18
1804 GNU dialect of ISO C17. This is the default for C code.
1805
1806 gnu2x
1807 The next version of the ISO C standard, still under
1808 development, plus GNU extensions. The support for this version
1809 is experimental and incomplete.
1810
1811 c++98
1812 c++03
1813 The 1998 ISO C++ standard plus the 2003 technical corrigendum
1814 and some additional defect reports. Same as -ansi for C++ code.
1815
1816 gnu++98
1817 gnu++03
1818 GNU dialect of -std=c++98.
1819
1820 c++11
1821 c++0x
1822 The 2011 ISO C++ standard plus amendments. The name c++0x is
1823 deprecated.
1824
1825 gnu++11
1826 gnu++0x
1827 GNU dialect of -std=c++11. The name gnu++0x is deprecated.
1828
1829 c++14
1830 c++1y
1831 The 2014 ISO C++ standard plus amendments. The name c++1y is
1832 deprecated.
1833
1834 gnu++14
1835 gnu++1y
1836 GNU dialect of -std=c++14. The name gnu++1y is deprecated.
1837
1838 c++17
1839 c++1z
1840 The 2017 ISO C++ standard plus amendments. The name c++1z is
1841 deprecated.
1842
1843 gnu++17
1844 gnu++1z
1845 GNU dialect of -std=c++17. This is the default for C++ code.
1846 The name gnu++1z is deprecated.
1847
1848 c++20
1849 c++2a
1850 The 2020 ISO C++ standard plus amendments. Support is
1851 experimental, and could change in incompatible ways in future
1852 releases. The name c++2a is deprecated.
1853
1854 gnu++20
1855 gnu++2a
1856 GNU dialect of -std=c++20. Support is experimental, and could
1857 change in incompatible ways in future releases. The name
1858 gnu++2a is deprecated.
1859
1860 c++2b
1861 c++23
1862 The next revision of the ISO C++ standard, planned for 2023.
1863 Support is highly experimental, and will almost certainly
1864 change in incompatible ways in future releases.
1865
1866 gnu++2b
1867 gnu++23
1868 GNU dialect of -std=c++2b. Support is highly experimental, and
1869 will almost certainly change in incompatible ways in future
1870 releases.
1871
1872 -aux-info filename
1873 Output to the given filename prototyped declarations for all
1874 functions declared and/or defined in a translation unit, including
1875 those in header files. This option is silently ignored in any
1876 language other than C.
1877
1878 Besides declarations, the file indicates, in comments, the origin
1879 of each declaration (source file and line), whether the declaration
1880 was implicit, prototyped or unprototyped (I, N for new or O for
1881 old, respectively, in the first character after the line number and
1882 the colon), and whether it came from a declaration or a definition
1883 (C or F, respectively, in the following character). In the case of
1884 function definitions, a K&R-style list of arguments followed by
1885 their declarations is also provided, inside comments, after the
1886 declaration.
1887
1888 -fno-asm
1889 Do not recognize "asm", "inline" or "typeof" as a keyword, so that
1890 code can use these words as identifiers. You can use the keywords
1891 "__asm__", "__inline__" and "__typeof__" instead. In C, -ansi
1892 implies -fno-asm.
1893
1894 In C++, "inline" is a standard keyword and is not affected by this
1895 switch. You may want to use the -fno-gnu-keywords flag instead,
1896 which disables "typeof" but not "asm" and "inline". In C99 mode
1897 (-std=c99 or -std=gnu99), this switch only affects the "asm" and
1898 "typeof" keywords, since "inline" is a standard keyword in ISO C99.
1899 In C2X mode (-std=c2x or -std=gnu2x), this switch only affects the
1900 "asm" keyword, since "typeof" is a standard keyword in ISO C2X.
1901
1902 -fno-builtin
1903 -fno-builtin-function
1904 Don't recognize built-in functions that do not begin with
1905 __builtin_ as prefix.
1906
1907 GCC normally generates special code to handle certain built-in
1908 functions more efficiently; for instance, calls to "alloca" may
1909 become single instructions which adjust the stack directly, and
1910 calls to "memcpy" may become inline copy loops. The resulting code
1911 is often both smaller and faster, but since the function calls no
1912 longer appear as such, you cannot set a breakpoint on those calls,
1913 nor can you change the behavior of the functions by linking with a
1914 different library. In addition, when a function is recognized as a
1915 built-in function, GCC may use information about that function to
1916 warn about problems with calls to that function, or to generate
1917 more efficient code, even if the resulting code still contains
1918 calls to that function. For example, warnings are given with
1919 -Wformat for bad calls to "printf" when "printf" is built in and
1920 "strlen" is known not to modify global memory.
1921
1922 With the -fno-builtin-function option only the built-in function
1923 function is disabled. function must not begin with __builtin_. If
1924 a function is named that is not built-in in this version of GCC,
1925 this option is ignored. There is no corresponding
1926 -fbuiltin-function option; if you wish to enable built-in functions
1927 selectively when using -fno-builtin or -ffreestanding, you may
1928 define macros such as:
1929
1930 #define abs(n) __builtin_abs ((n))
1931 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1932
1933 -fcond-mismatch
1934 Allow conditional expressions with mismatched types in the second
1935 and third arguments. The value of such an expression is void.
1936 This option is not supported for C++.
1937
1938 -ffreestanding
1939 Assert that compilation targets a freestanding environment. This
1940 implies -fno-builtin. A freestanding environment is one in which
1941 the standard library may not exist, and program startup may not
1942 necessarily be at "main". The most obvious example is an OS
1943 kernel. This is equivalent to -fno-hosted.
1944
1945 -fgimple
1946 Enable parsing of function definitions marked with "__GIMPLE".
1947 This is an experimental feature that allows unit testing of GIMPLE
1948 passes.
1949
1950 -fgnu-tm
1951 When the option -fgnu-tm is specified, the compiler generates code
1952 for the Linux variant of Intel's current Transactional Memory ABI
1953 specification document (Revision 1.1, May 6 2009). This is an
1954 experimental feature whose interface may change in future versions
1955 of GCC, as the official specification changes. Please note that
1956 not all architectures are supported for this feature.
1957
1958 For more information on GCC's support for transactional memory,
1959
1960 Note that the transactional memory feature is not supported with
1961 non-call exceptions (-fnon-call-exceptions).
1962
1963 -fgnu89-inline
1964 The option -fgnu89-inline tells GCC to use the traditional GNU
1965 semantics for "inline" functions when in C99 mode.
1966
1967 Using this option is roughly equivalent to adding the "gnu_inline"
1968 function attribute to all inline functions.
1969
1970 The option -fno-gnu89-inline explicitly tells GCC to use the C99
1971 semantics for "inline" when in C99 or gnu99 mode (i.e., it
1972 specifies the default behavior). This option is not supported in
1973 -std=c90 or -std=gnu90 mode.
1974
1975 The preprocessor macros "__GNUC_GNU_INLINE__" and
1976 "__GNUC_STDC_INLINE__" may be used to check which semantics are in
1977 effect for "inline" functions.
1978
1979 -fhosted
1980 Assert that compilation targets a hosted environment. This implies
1981 -fbuiltin. A hosted environment is one in which the entire
1982 standard library is available, and in which "main" has a return
1983 type of "int". Examples are nearly everything except a kernel.
1984 This is equivalent to -fno-freestanding.
1985
1986 -flax-vector-conversions
1987 Allow implicit conversions between vectors with differing numbers
1988 of elements and/or incompatible element types. This option should
1989 not be used for new code.
1990
1991 -fms-extensions
1992 Accept some non-standard constructs used in Microsoft header files.
1993
1994 In C++ code, this allows member names in structures to be similar
1995 to previous types declarations.
1996
1997 typedef int UOW;
1998 struct ABC {
1999 UOW UOW;
2000 };
2001
2002 Some cases of unnamed fields in structures and unions are only
2003 accepted with this option.
2004
2005 Note that this option is off for all targets except for x86 targets
2006 using ms-abi.
2007
2008 -foffload=disable
2009 -foffload=default
2010 -foffload=target-list
2011 Specify for which OpenMP and OpenACC offload targets code should be
2012 generated. The default behavior, equivalent to -foffload=default,
2013 is to generate code for all supported offload targets. The
2014 -foffload=disable form generates code only for the host fallback,
2015 while -foffload=target-list generates code only for the specified
2016 comma-separated list of offload targets.
2017
2018 Offload targets are specified in GCC's internal target-triplet
2019 format. You can run the compiler with -v to show the list of
2020 configured offload targets under "OFFLOAD_TARGET_NAMES".
2021
2022 -foffload-options=options
2023 -foffload-options=target-triplet-list=options
2024 With -foffload-options=options, GCC passes the specified options to
2025 the compilers for all enabled offloading targets. You can specify
2026 options that apply only to a specific target or targets by using
2027 the -foffload-options=target-list=options form. The target-list is
2028 a comma-separated list in the same format as for the -foffload=
2029 option.
2030
2031 Typical command lines are
2032
2033 -foffload-options=-lgfortran -foffload-options=-lm
2034 -foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic
2035 -foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm
2036
2037 -fopenacc
2038 Enable handling of OpenACC directives "#pragma acc" in C/C++ and
2039 "!$acc" in Fortran. When -fopenacc is specified, the compiler
2040 generates accelerated code according to the OpenACC Application
2041 Programming Interface v2.6 <https://www.openacc.org>. This option
2042 implies -pthread, and thus is only supported on targets that have
2043 support for -pthread.
2044
2045 -fopenacc-dim=geom
2046 Specify default compute dimensions for parallel offload regions
2047 that do not explicitly specify. The geom value is a triple of
2048 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A
2049 size can be omitted, to use a target-specific default value.
2050
2051 -fopenmp
2052 Enable handling of OpenMP directives "#pragma omp" in C/C++,
2053 "[[omp::directive(...)]]" and "[[omp::sequence(...)]]" in C++ and
2054 "!$omp" in Fortran. When -fopenmp is specified, the compiler
2055 generates parallel code according to the OpenMP Application Program
2056 Interface v4.5 <https://www.openmp.org>. This option implies
2057 -pthread, and thus is only supported on targets that have support
2058 for -pthread. -fopenmp implies -fopenmp-simd.
2059
2060 -fopenmp-simd
2061 Enable handling of OpenMP's "simd", "declare simd", "declare
2062 reduction", "assume", "ordered", "scan", "loop" directives and
2063 combined or composite directives with "simd" as constituent with
2064 "#pragma omp" in C/C++, "[[omp::directive(...)]]" and
2065 "[[omp::sequence(...)]]" in C++ and "!$omp" in Fortran. Other
2066 OpenMP directives are ignored.
2067
2068 -fopenmp-target-simd-clone
2069 -fopenmp-target-simd-clone=device-type
2070 In addition to generating SIMD clones for functions marked with the
2071 "declare simd" directive, GCC also generates clones for functions
2072 marked with the OpenMP "declare target" directive that are suitable
2073 for vectorization when this option is in effect. The device-type
2074 may be one of "none", "host", "nohost", and "any", which correspond
2075 to keywords for the "device_type" clause of the "declare target"
2076 directive; clones are generated for the intersection of devices
2077 specified. -fopenmp-target-simd-clone is equivalent to
2078 -fopenmp-target-simd-clone=any and -fno-openmp-target-simd-clone is
2079 equivalent to -fopenmp-target-simd-clone=none.
2080
2081 At -O2 and higher (but not -Os or -Og) this optimization defaults
2082 to -fopenmp-target-simd-clone=nohost; otherwise it is disabled by
2083 default.
2084
2085 -fpermitted-flt-eval-methods=style
2086 ISO/IEC TS 18661-3 defines new permissible values for
2087 "FLT_EVAL_METHOD" that indicate that operations and constants with
2088 a semantic type that is an interchange or extended format should be
2089 evaluated to the precision and range of that type. These new
2090 values are a superset of those permitted under C99/C11, which does
2091 not specify the meaning of other positive values of
2092 "FLT_EVAL_METHOD". As such, code conforming to C11 may not have
2093 been written expecting the possibility of the new values.
2094
2095 -fpermitted-flt-eval-methods specifies whether the compiler should
2096 allow only the values of "FLT_EVAL_METHOD" specified in C99/C11, or
2097 the extended set of values specified in ISO/IEC TS 18661-3.
2098
2099 style is either "c11" or "ts-18661-3" as appropriate.
2100
2101 The default when in a standards compliant mode (-std=c11 or
2102 similar) is -fpermitted-flt-eval-methods=c11. The default when in
2103 a GNU dialect (-std=gnu11 or similar) is
2104 -fpermitted-flt-eval-methods=ts-18661-3.
2105
2106 -fplan9-extensions
2107 Accept some non-standard constructs used in Plan 9 code.
2108
2109 This enables -fms-extensions, permits passing pointers to
2110 structures with anonymous fields to functions that expect pointers
2111 to elements of the type of the field, and permits referring to
2112 anonymous fields declared using a typedef. This is only
2113 supported for C, not C++.
2114
2115 -fsigned-bitfields
2116 -funsigned-bitfields
2117 -fno-signed-bitfields
2118 -fno-unsigned-bitfields
2119 These options control whether a bit-field is signed or unsigned,
2120 when the declaration does not use either "signed" or "unsigned".
2121 By default, such a bit-field is signed, because this is consistent:
2122 the basic integer types such as "int" are signed types.
2123
2124 -fsigned-char
2125 Let the type "char" be signed, like "signed char".
2126
2127 Note that this is equivalent to -fno-unsigned-char, which is the
2128 negative form of -funsigned-char. Likewise, the option
2129 -fno-signed-char is equivalent to -funsigned-char.
2130
2131 -funsigned-char
2132 Let the type "char" be unsigned, like "unsigned char".
2133
2134 Each kind of machine has a default for what "char" should be. It
2135 is either like "unsigned char" by default or like "signed char" by
2136 default.
2137
2138 Ideally, a portable program should always use "signed char" or
2139 "unsigned char" when it depends on the signedness of an object.
2140 But many programs have been written to use plain "char" and expect
2141 it to be signed, or expect it to be unsigned, depending on the
2142 machines they were written for. This option, and its inverse, let
2143 you make such a program work with the opposite default.
2144
2145 The type "char" is always a distinct type from each of "signed
2146 char" or "unsigned char", even though its behavior is always just
2147 like one of those two.
2148
2149 -fstrict-flex-arrays
2150 Control when to treat the trailing array of a structure as a
2151 flexible array member for the purpose of accessing the elements of
2152 such an array. The positive form is equivalent to
2153 -fstrict-flex-arrays=3, which is the strictest. A trailing array
2154 is treated as a flexible array member only when it is declared as a
2155 flexible array member per C99 standard onwards. The negative form
2156 is equivalent to -fstrict-flex-arrays=0, which is the least strict.
2157 All trailing arrays of structures are treated as flexible array
2158 members.
2159
2160 -fstrict-flex-arrays=level
2161 Control when to treat the trailing array of a structure as a
2162 flexible array member for the purpose of accessing the elements of
2163 such an array. The value of level controls the level of
2164 strictness.
2165
2166 The possible values of level are the same as for the
2167 "strict_flex_array" attribute.
2168
2169 You can control this behavior for a specific trailing array field
2170 of a structure by using the variable attribute "strict_flex_array"
2171 attribute.
2172
2173 -fsso-struct=endianness
2174 Set the default scalar storage order of structures and unions to
2175 the specified endianness. The accepted values are big-endian,
2176 little-endian and native for the native endianness of the target
2177 (the default). This option is not supported for C++.
2178
2179 Warning: the -fsso-struct switch causes GCC to generate code that
2180 is not binary compatible with code generated without it if the
2181 specified endianness is not the native endianness of the target.
2182
2183 Options Controlling C++ Dialect
2184 This section describes the command-line options that are only
2185 meaningful for C++ programs. You can also use most of the GNU compiler
2186 options regardless of what language your program is in. For example,
2187 you might compile a file firstClass.C like this:
2188
2189 g++ -g -fstrict-enums -O -c firstClass.C
2190
2191 In this example, only -fstrict-enums is an option meant only for C++
2192 programs; you can use the other options with any language supported by
2193 GCC.
2194
2195 Some options for compiling C programs, such as -std, are also relevant
2196 for C++ programs.
2197
2198 Here is a list of options that are only for compiling C++ programs:
2199
2200 -fabi-version=n
2201 Use version n of the C++ ABI. The default is version 0.
2202
2203 Version 0 refers to the version conforming most closely to the C++
2204 ABI specification. Therefore, the ABI obtained using version 0
2205 will change in different versions of G++ as ABI bugs are fixed.
2206
2207 Version 1 is the version of the C++ ABI that first appeared in G++
2208 3.2.
2209
2210 Version 2 is the version of the C++ ABI that first appeared in G++
2211 3.4, and was the default through G++ 4.9.
2212
2213 Version 3 corrects an error in mangling a constant address as a
2214 template argument.
2215
2216 Version 4, which first appeared in G++ 4.5, implements a standard
2217 mangling for vector types.
2218
2219 Version 5, which first appeared in G++ 4.6, corrects the mangling
2220 of attribute const/volatile on function pointer types, decltype of
2221 a plain decl, and use of a function parameter in the declaration of
2222 another parameter.
2223
2224 Version 6, which first appeared in G++ 4.7, corrects the promotion
2225 behavior of C++11 scoped enums and the mangling of template
2226 argument packs, const/static_cast, prefix ++ and --, and a class
2227 scope function used as a template argument.
2228
2229 Version 7, which first appeared in G++ 4.8, that treats nullptr_t
2230 as a builtin type and corrects the mangling of lambdas in default
2231 argument scope.
2232
2233 Version 8, which first appeared in G++ 4.9, corrects the
2234 substitution behavior of function types with function-cv-
2235 qualifiers.
2236
2237 Version 9, which first appeared in G++ 5.2, corrects the alignment
2238 of "nullptr_t".
2239
2240 Version 10, which first appeared in G++ 6.1, adds mangling of
2241 attributes that affect type identity, such as ia32 calling
2242 convention attributes (e.g. stdcall).
2243
2244 Version 11, which first appeared in G++ 7, corrects the mangling of
2245 sizeof... expressions and operator names. For multiple entities
2246 with the same name within a function, that are declared in
2247 different scopes, the mangling now changes starting with the
2248 twelfth occurrence. It also implies -fnew-inheriting-ctors.
2249
2250 Version 12, which first appeared in G++ 8, corrects the calling
2251 conventions for empty classes on the x86_64 target and for classes
2252 with only deleted copy/move constructors. It accidentally changes
2253 the calling convention for classes with a deleted copy constructor
2254 and a trivial move constructor.
2255
2256 Version 13, which first appeared in G++ 8.2, fixes the accidental
2257 change in version 12.
2258
2259 Version 14, which first appeared in G++ 10, corrects the mangling
2260 of the nullptr expression.
2261
2262 Version 15, which first appeared in G++ 10.3, corrects G++ 10 ABI
2263 tag regression.
2264
2265 Version 16, which first appeared in G++ 11, changes the mangling of
2266 "__alignof__" to be distinct from that of "alignof", and dependent
2267 operator names.
2268
2269 Version 17, which first appeared in G++ 12, fixes layout of classes
2270 that inherit from aggregate classes with default member
2271 initializers in C++14 and up.
2272
2273 Version 18, which first appeard in G++ 13, fixes manglings of
2274 lambdas that have additional context.
2275
2276 See also -Wabi.
2277
2278 -fabi-compat-version=n
2279 On targets that support strong aliases, G++ works around mangling
2280 changes by creating an alias with the correct mangled name when
2281 defining a symbol with an incorrect mangled name. This switch
2282 specifies which ABI version to use for the alias.
2283
2284 With -fabi-version=0 (the default), this defaults to 13 (GCC 8.2
2285 compatibility). If another ABI version is explicitly selected,
2286 this defaults to 0. For compatibility with GCC versions 3.2
2287 through 4.9, use -fabi-compat-version=2.
2288
2289 If this option is not provided but -Wabi=n is, that version is used
2290 for compatibility aliases. If this option is provided along with
2291 -Wabi (without the version), the version from this option is used
2292 for the warning.
2293
2294 -fno-access-control
2295 Turn off all access checking. This switch is mainly useful for
2296 working around bugs in the access control code.
2297
2298 -faligned-new
2299 Enable support for C++17 "new" of types that require more alignment
2300 than "void* ::operator new(std::size_t)" provides. A numeric
2301 argument such as "-faligned-new=32" can be used to specify how much
2302 alignment (in bytes) is provided by that function, but few users
2303 will need to override the default of alignof(std::max_align_t).
2304
2305 This flag is enabled by default for -std=c++17.
2306
2307 -fchar8_t
2308 -fno-char8_t
2309 Enable support for "char8_t" as adopted for C++20. This includes
2310 the addition of a new "char8_t" fundamental type, changes to the
2311 types of UTF-8 string and character literals, new signatures for
2312 user-defined literals, associated standard library updates, and new
2313 "__cpp_char8_t" and "__cpp_lib_char8_t" feature test macros.
2314
2315 This option enables functions to be overloaded for ordinary and
2316 UTF-8 strings:
2317
2318 int f(const char *); // #1
2319 int f(const char8_t *); // #2
2320 int v1 = f("text"); // Calls #1
2321 int v2 = f(u8"text"); // Calls #2
2322
2323 and introduces new signatures for user-defined literals:
2324
2325 int operator""_udl1(char8_t);
2326 int v3 = u8'x'_udl1;
2327 int operator""_udl2(const char8_t*, std::size_t);
2328 int v4 = u8"text"_udl2;
2329 template<typename T, T...> int operator""_udl3();
2330 int v5 = u8"text"_udl3;
2331
2332 The change to the types of UTF-8 string and character literals
2333 introduces incompatibilities with ISO C++11 and later standards.
2334 For example, the following code is well-formed under ISO C++11, but
2335 is ill-formed when -fchar8_t is specified.
2336
2337 const char *cp = u8"xx";// error: invalid conversion from
2338 // `const char8_t*' to `const char*'
2339 int f(const char*);
2340 auto v = f(u8"xx"); // error: invalid conversion from
2341 // `const char8_t*' to `const char*'
2342 std::string s{u8"xx"}; // error: no matching function for call to
2343 // `std::basic_string<char>::basic_string()'
2344 using namespace std::literals;
2345 s = u8"xx"s; // error: conversion from
2346 // `basic_string<char8_t>' to non-scalar
2347 // type `basic_string<char>' requested
2348
2349 -fcheck-new
2350 Check that the pointer returned by "operator new" is non-null
2351 before attempting to modify the storage allocated. This check is
2352 normally unnecessary because the C++ standard specifies that
2353 "operator new" only returns 0 if it is declared throw(), in which
2354 case the compiler always checks the return value even without this
2355 option. In all other cases, when "operator new" has a non-empty
2356 exception specification, memory exhaustion is signalled by throwing
2357 "std::bad_alloc". See also new (nothrow).
2358
2359 -fconcepts
2360 -fconcepts-ts
2361 Enable support for the C++ Concepts feature for constraining
2362 template arguments. With -std=c++20 and above, Concepts are part
2363 of the language standard, so -fconcepts defaults to on.
2364
2365 Some constructs that were allowed by the earlier C++ Extensions for
2366 Concepts Technical Specification, ISO 19217 (2015), but didn't make
2367 it into the standard, can additionally be enabled by -fconcepts-ts.
2368
2369 -fconstexpr-depth=n
2370 Set the maximum nested evaluation depth for C++11 constexpr
2371 functions to n. A limit is needed to detect endless recursion
2372 during constant expression evaluation. The minimum specified by
2373 the standard is 512.
2374
2375 -fconstexpr-cache-depth=n
2376 Set the maximum level of nested evaluation depth for C++11
2377 constexpr functions that will be cached to n. This is a heuristic
2378 that trades off compilation speed (when the cache avoids repeated
2379 calculations) against memory consumption (when the cache grows very
2380 large from highly recursive evaluations). The default is 8. Very
2381 few users are likely to want to adjust it, but if your code does
2382 heavy constexpr calculations you might want to experiment to find
2383 which value works best for you.
2384
2385 -fconstexpr-fp-except
2386 Annex F of the C standard specifies that IEC559 floating point
2387 exceptions encountered at compile time should not stop compilation.
2388 C++ compilers have historically not followed this guidance, instead
2389 treating floating point division by zero as non-constant even
2390 though it has a well defined value. This flag tells the compiler
2391 to give Annex F priority over other rules saying that a particular
2392 operation is undefined.
2393
2394 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
2395
2396 -fconstexpr-loop-limit=n
2397 Set the maximum number of iterations for a loop in C++14 constexpr
2398 functions to n. A limit is needed to detect infinite loops during
2399 constant expression evaluation. The default is 262144 (1<<18).
2400
2401 -fconstexpr-ops-limit=n
2402 Set the maximum number of operations during a single constexpr
2403 evaluation. Even when number of iterations of a single loop is
2404 limited with the above limit, if there are several nested loops and
2405 each of them has many iterations but still smaller than the above
2406 limit, or if in a body of some loop or even outside of a loop too
2407 many expressions need to be evaluated, the resulting constexpr
2408 evaluation might take too long. The default is 33554432 (1<<25).
2409
2410 -fcontracts
2411 Enable experimental support for the C++ Contracts feature, as
2412 briefly added to and then removed from the C++20 working paper
2413 (N4820). The implementation also includes proposed enhancements
2414 from papers P1290, P1332, and P1429. This functionality is
2415 intended mostly for those interested in experimentation towards
2416 refining the feature to get it into shape for a future C++
2417 standard.
2418
2419 On violation of a checked contract, the violation handler is
2420 called. Users can replace the violation handler by defining
2421
2422 void
2423 handle_contract_violation (const std::experimental::contract_violation&);
2424
2425 There are different sets of additional flags that can be used
2426 together to specify which contracts will be checked and how, for
2427 N4820 contracts, P1332 contracts, or P1429 contracts; these sets
2428 cannot be used together.
2429
2430 -fcontract-mode=[on|off]
2431 Control whether any contracts have any semantics at all.
2432 Defaults to on.
2433
2434 -fcontract-assumption-mode=[on|off]
2435 [N4820] Control whether contracts with level axiom should have
2436 the assume semantic. Defaults to on.
2437
2438 -fcontract-build-level=[off|default|audit]
2439 [N4820] Specify which level of contracts to generate checks
2440 for. Defaults to default.
2441
2442 -fcontract-continuation-mode=[on|off]
2443 [N4820] Control whether to allow the program to continue
2444 executing after a contract violation. That is, do checked
2445 contracts have the maybe semantic described below rather than
2446 the never semantic. Defaults to off.
2447
2448 -fcontract-role=<name>:<default>,<audit>,<axiom>
2449 [P1332] Specify the concrete semantics for each contract level
2450 of a particular contract role.
2451
2452 -fcontract-semantic=[default|audit|axiom]:<semantic>
2453 [P1429] Specify the concrete semantic for a particular contract
2454 level.
2455
2456 -fcontract-strict-declarations=[on|off]
2457 Control whether to reject adding contracts to a function after
2458 its first declaration. Defaults to off.
2459
2460 The possible concrete semantics for that can be specified with
2461 -fcontract-role or -fcontract-semantic are:
2462
2463 "ignore"
2464 This contract has no effect.
2465
2466 "assume"
2467 This contract is treated like C++23 "[[assume]]".
2468
2469 "check_never_continue"
2470 "never"
2471 "abort"
2472 This contract is checked. If it fails, the violation handler
2473 is called. If the handler returns, "std::terminate" is called.
2474
2475 "check_maybe_continue"
2476 "maybe"
2477 This contract is checked. If it fails, the violation handler
2478 is called. If the handler returns, execution continues
2479 normally.
2480
2481 -fcoroutines
2482 Enable support for the C++ coroutines extension (experimental).
2483
2484 -fno-elide-constructors
2485 The C++ standard allows an implementation to omit creating a
2486 temporary that is only used to initialize another object of the
2487 same type. Specifying this option disables that optimization, and
2488 forces G++ to call the copy constructor in all cases. This option
2489 also causes G++ to call trivial member functions which otherwise
2490 would be expanded inline.
2491
2492 In C++17, the compiler is required to omit these temporaries, but
2493 this option still affects trivial member functions.
2494
2495 -fno-enforce-eh-specs
2496 Don't generate code to check for violation of exception
2497 specifications at run time. This option violates the C++ standard,
2498 but may be useful for reducing code size in production builds, much
2499 like defining "NDEBUG". This does not give user code permission to
2500 throw exceptions in violation of the exception specifications; the
2501 compiler still optimizes based on the specifications, so throwing
2502 an unexpected exception results in undefined behavior at run time.
2503
2504 -fextern-tls-init
2505 -fno-extern-tls-init
2506 The C++11 and OpenMP standards allow "thread_local" and
2507 "threadprivate" variables to have dynamic (runtime) initialization.
2508 To support this, any use of such a variable goes through a wrapper
2509 function that performs any necessary initialization. When the use
2510 and definition of the variable are in the same translation unit,
2511 this overhead can be optimized away, but when the use is in a
2512 different translation unit there is significant overhead even if
2513 the variable doesn't actually need dynamic initialization. If the
2514 programmer can be sure that no use of the variable in a non-
2515 defining TU needs to trigger dynamic initialization (either because
2516 the variable is statically initialized, or a use of the variable in
2517 the defining TU will be executed before any uses in another TU),
2518 they can avoid this overhead with the -fno-extern-tls-init option.
2519
2520 On targets that support symbol aliases, the default is
2521 -fextern-tls-init. On targets that do not support symbol aliases,
2522 the default is -fno-extern-tls-init.
2523
2524 -ffold-simple-inlines
2525 -fno-fold-simple-inlines
2526 Permit the C++ frontend to fold calls to "std::move",
2527 "std::forward", "std::addressof" and "std::as_const". In contrast
2528 to inlining, this means no debug information will be generated for
2529 such calls. Since these functions are rarely interesting to debug,
2530 this flag is enabled by default unless -fno-inline is active.
2531
2532 -fno-gnu-keywords
2533 Do not recognize "typeof" as a keyword, so that code can use this
2534 word as an identifier. You can use the keyword "__typeof__"
2535 instead. This option is implied by the strict ISO C++ dialects:
2536 -ansi, -std=c++98, -std=c++11, etc.
2537
2538 -fimplicit-constexpr
2539 Make inline functions implicitly constexpr, if they satisfy the
2540 requirements for a constexpr function. This option can be used in
2541 C++14 mode or later. This can result in initialization changing
2542 from dynamic to static and other optimizations.
2543
2544 -fno-implicit-templates
2545 Never emit code for non-inline templates that are instantiated
2546 implicitly (i.e. by use); only emit code for explicit
2547 instantiations. If you use this option, you must take care to
2548 structure your code to include all the necessary explicit
2549 instantiations to avoid getting undefined symbols at link time.
2550
2551 -fno-implicit-inline-templates
2552 Don't emit code for implicit instantiations of inline templates,
2553 either. The default is to handle inlines differently so that
2554 compiles with and without optimization need the same set of
2555 explicit instantiations.
2556
2557 -fno-implement-inlines
2558 To save space, do not emit out-of-line copies of inline functions
2559 controlled by "#pragma implementation". This causes linker errors
2560 if these functions are not inlined everywhere they are called.
2561
2562 -fmodules-ts
2563 -fno-modules-ts
2564 Enable support for C++20 modules. The -fno-modules-ts is usually
2565 not needed, as that is the default. Even though this is a C++20
2566 feature, it is not currently implicitly enabled by selecting that
2567 standard version.
2568
2569 -fmodule-header
2570 -fmodule-header=user
2571 -fmodule-header=system
2572 Compile a header file to create an importable header unit.
2573
2574 -fmodule-implicit-inline
2575 Member functions defined in their class definitions are not
2576 implicitly inline for modular code. This is different to
2577 traditional C++ behavior, for good reasons. However, it may result
2578 in a difficulty during code porting. This option makes such
2579 function definitions implicitly inline. It does however generate
2580 an ABI incompatibility, so you must use it everywhere or nowhere.
2581 (Such definitions outside of a named module remain implicitly
2582 inline, regardless.)
2583
2584 -fno-module-lazy
2585 Disable lazy module importing and module mapper creation.
2586
2587 -fmodule-mapper=[hostname]:port[?ident]
2588 -fmodule-mapper=|program[?ident] args...
2589 -fmodule-mapper==socket[?ident]
2590 -fmodule-mapper=<>[inout][?ident]
2591 -fmodule-mapper=<in>out[?ident]
2592 -fmodule-mapper=file[?ident]
2593 An oracle to query for module name to filename mappings. If
2594 unspecified the CXX_MODULE_MAPPER environment variable is used, and
2595 if that is unset, an in-process default is provided.
2596
2597 -fmodule-only
2598 Only emit the Compiled Module Interface, inhibiting any object
2599 file.
2600
2601 -fms-extensions
2602 Disable Wpedantic warnings about constructs used in MFC, such as
2603 implicit int and getting a pointer to member function via non-
2604 standard syntax.
2605
2606 -fnew-inheriting-ctors
2607 Enable the P0136 adjustment to the semantics of C++11 constructor
2608 inheritance. This is part of C++17 but also considered to be a
2609 Defect Report against C++11 and C++14. This flag is enabled by
2610 default unless -fabi-version=10 or lower is specified.
2611
2612 -fnew-ttp-matching
2613 Enable the P0522 resolution to Core issue 150, template template
2614 parameters and default arguments: this allows a template with
2615 default template arguments as an argument for a template template
2616 parameter with fewer template parameters. This flag is enabled by
2617 default for -std=c++17.
2618
2619 -fno-nonansi-builtins
2620 Disable built-in declarations of functions that are not mandated by
2621 ANSI/ISO C. These include "ffs", "alloca", "_exit", "index",
2622 "bzero", "conjf", and other related functions.
2623
2624 -fnothrow-opt
2625 Treat a throw() exception specification as if it were a "noexcept"
2626 specification to reduce or eliminate the text size overhead
2627 relative to a function with no exception specification. If the
2628 function has local variables of types with non-trivial destructors,
2629 the exception specification actually makes the function smaller
2630 because the EH cleanups for those variables can be optimized away.
2631 The semantic effect is that an exception thrown out of a function
2632 with such an exception specification results in a call to
2633 "terminate" rather than "unexpected".
2634
2635 -fno-operator-names
2636 Do not treat the operator name keywords "and", "bitand", "bitor",
2637 "compl", "not", "or" and "xor" as synonyms as keywords.
2638
2639 -fno-optional-diags
2640 Disable diagnostics that the standard says a compiler does not need
2641 to issue. Currently, the only such diagnostic issued by G++ is the
2642 one for a name having multiple meanings within a class.
2643
2644 -fpermissive
2645 Downgrade some diagnostics about nonconformant code from errors to
2646 warnings. Thus, using -fpermissive allows some nonconforming code
2647 to compile.
2648
2649 -fno-pretty-templates
2650 When an error message refers to a specialization of a function
2651 template, the compiler normally prints the signature of the
2652 template followed by the template arguments and any typedefs or
2653 typenames in the signature (e.g. "void f(T) [with T = int]" rather
2654 than "void f(int)") so that it's clear which template is involved.
2655 When an error message refers to a specialization of a class
2656 template, the compiler omits any template arguments that match the
2657 default template arguments for that template. If either of these
2658 behaviors make it harder to understand the error message rather
2659 than easier, you can use -fno-pretty-templates to disable them.
2660
2661 -fno-rtti
2662 Disable generation of information about every class with virtual
2663 functions for use by the C++ run-time type identification features
2664 ("dynamic_cast" and "typeid"). If you don't use those parts of the
2665 language, you can save some space by using this flag. Note that
2666 exception handling uses the same information, but G++ generates it
2667 as needed. The "dynamic_cast" operator can still be used for casts
2668 that do not require run-time type information, i.e. casts to "void
2669 *" or to unambiguous base classes.
2670
2671 Mixing code compiled with -frtti with that compiled with -fno-rtti
2672 may not work. For example, programs may fail to link if a class
2673 compiled with -fno-rtti is used as a base for a class compiled with
2674 -frtti.
2675
2676 -fsized-deallocation
2677 Enable the built-in global declarations
2678
2679 void operator delete (void *, std::size_t) noexcept;
2680 void operator delete[] (void *, std::size_t) noexcept;
2681
2682 as introduced in C++14. This is useful for user-defined
2683 replacement deallocation functions that, for example, use the size
2684 of the object to make deallocation faster. Enabled by default
2685 under -std=c++14 and above. The flag -Wsized-deallocation warns
2686 about places that might want to add a definition.
2687
2688 -fstrict-enums
2689 Allow the compiler to optimize using the assumption that a value of
2690 enumerated type can only be one of the values of the enumeration
2691 (as defined in the C++ standard; basically, a value that can be
2692 represented in the minimum number of bits needed to represent all
2693 the enumerators). This assumption may not be valid if the program
2694 uses a cast to convert an arbitrary integer value to the enumerated
2695 type.
2696
2697 -fstrong-eval-order
2698 Evaluate member access, array subscripting, and shift expressions
2699 in left-to-right order, and evaluate assignment in right-to-left
2700 order, as adopted for C++17. Enabled by default with -std=c++17.
2701 -fstrong-eval-order=some enables just the ordering of member access
2702 and shift expressions, and is the default without -std=c++17.
2703
2704 -ftemplate-backtrace-limit=n
2705 Set the maximum number of template instantiation notes for a single
2706 warning or error to n. The default value is 10.
2707
2708 -ftemplate-depth=n
2709 Set the maximum instantiation depth for template classes to n. A
2710 limit on the template instantiation depth is needed to detect
2711 endless recursions during template class instantiation. ANSI/ISO
2712 C++ conforming programs must not rely on a maximum depth greater
2713 than 17 (changed to 1024 in C++11). The default value is 900, as
2714 the compiler can run out of stack space before hitting 1024 in some
2715 situations.
2716
2717 -fno-threadsafe-statics
2718 Do not emit the extra code to use the routines specified in the C++
2719 ABI for thread-safe initialization of local statics. You can use
2720 this option to reduce code size slightly in code that doesn't need
2721 to be thread-safe.
2722
2723 -fuse-cxa-atexit
2724 Register destructors for objects with static storage duration with
2725 the "__cxa_atexit" function rather than the "atexit" function.
2726 This option is required for fully standards-compliant handling of
2727 static destructors, but only works if your C library supports
2728 "__cxa_atexit".
2729
2730 -fno-use-cxa-get-exception-ptr
2731 Don't use the "__cxa_get_exception_ptr" runtime routine. This
2732 causes "std::uncaught_exception" to be incorrect, but is necessary
2733 if the runtime routine is not available.
2734
2735 -fvisibility-inlines-hidden
2736 This switch declares that the user does not attempt to compare
2737 pointers to inline functions or methods where the addresses of the
2738 two functions are taken in different shared objects.
2739
2740 The effect of this is that GCC may, effectively, mark inline
2741 methods with "__attribute__ ((visibility ("hidden")))" so that they
2742 do not appear in the export table of a DSO and do not require a PLT
2743 indirection when used within the DSO. Enabling this option can
2744 have a dramatic effect on load and link times of a DSO as it
2745 massively reduces the size of the dynamic export table when the
2746 library makes heavy use of templates.
2747
2748 The behavior of this switch is not quite the same as marking the
2749 methods as hidden directly, because it does not affect static
2750 variables local to the function or cause the compiler to deduce
2751 that the function is defined in only one shared object.
2752
2753 You may mark a method as having a visibility explicitly to negate
2754 the effect of the switch for that method. For example, if you do
2755 want to compare pointers to a particular inline method, you might
2756 mark it as having default visibility. Marking the enclosing class
2757 with explicit visibility has no effect.
2758
2759 Explicitly instantiated inline methods are unaffected by this
2760 option as their linkage might otherwise cross a shared library
2761 boundary.
2762
2763 -fvisibility-ms-compat
2764 This flag attempts to use visibility settings to make GCC's C++
2765 linkage model compatible with that of Microsoft Visual Studio.
2766
2767 The flag makes these changes to GCC's linkage model:
2768
2769 1. It sets the default visibility to "hidden", like
2770 -fvisibility=hidden.
2771
2772 2. Types, but not their members, are not hidden by default.
2773
2774 3. The One Definition Rule is relaxed for types without explicit
2775 visibility specifications that are defined in more than one
2776 shared object: those declarations are permitted if they are
2777 permitted when this option is not used.
2778
2779 In new code it is better to use -fvisibility=hidden and export
2780 those classes that are intended to be externally visible.
2781 Unfortunately it is possible for code to rely, perhaps
2782 accidentally, on the Visual Studio behavior.
2783
2784 Among the consequences of these changes are that static data
2785 members of the same type with the same name but defined in
2786 different shared objects are different, so changing one does not
2787 change the other; and that pointers to function members defined in
2788 different shared objects may not compare equal. When this flag is
2789 given, it is a violation of the ODR to define types with the same
2790 name differently.
2791
2792 -fno-weak
2793 Do not use weak symbol support, even if it is provided by the
2794 linker. By default, G++ uses weak symbols if they are available.
2795 This option exists only for testing, and should not be used by end-
2796 users; it results in inferior code and has no benefits. This
2797 option may be removed in a future release of G++.
2798
2799 -fext-numeric-literals (C++ and Objective-C++ only)
2800 Accept imaginary, fixed-point, or machine-defined literal number
2801 suffixes as GNU extensions. When this option is turned off these
2802 suffixes are treated as C++11 user-defined literal numeric
2803 suffixes. This is on by default for all pre-C++11 dialects and all
2804 GNU dialects: -std=c++98, -std=gnu++98, -std=gnu++11, -std=gnu++14.
2805 This option is off by default for ISO C++11 onwards (-std=c++11,
2806 ...).
2807
2808 -nostdinc++
2809 Do not search for header files in the standard directories specific
2810 to C++, but do still search the other standard directories. (This
2811 option is used when building the C++ library.)
2812
2813 -flang-info-include-translate
2814 -flang-info-include-translate-not
2815 -flang-info-include-translate=header
2816 Inform of include translation events. The first will note accepted
2817 include translations, the second will note declined include
2818 translations. The header form will inform of include translations
2819 relating to that specific header. If header is of the form "user"
2820 or "<system>" it will be resolved to a specific user or system
2821 header using the include path.
2822
2823 -flang-info-module-cmi
2824 -flang-info-module-cmi=module
2825 Inform of Compiled Module Interface pathnames. The first will note
2826 all read CMI pathnames. The module form will not reading a
2827 specific module's CMI. module may be a named module or a header-
2828 unit (the latter indicated by either being a pathname containing
2829 directory separators or enclosed in "<>" or "").
2830
2831 -stdlib=libstdc++,libc++
2832 When G++ is configured to support this option, it allows
2833 specification of alternate C++ runtime libraries. Two options are
2834 available: libstdc++ (the default, native C++ runtime for G++) and
2835 libc++ which is the C++ runtime installed on some operating systems
2836 (e.g. Darwin versions from Darwin11 onwards). The option switches
2837 G++ to use the headers from the specified library and to emit
2838 "-lstdc++" or "-lc++" respectively, when a C++ runtime is required
2839 for linking.
2840
2841 In addition, these warning options have meanings only for C++ programs:
2842
2843 -Wabi-tag (C++ and Objective-C++ only)
2844 Warn when a type with an ABI tag is used in a context that does not
2845 have that ABI tag. See C++ Attributes for more information about
2846 ABI tags.
2847
2848 -Wcomma-subscript (C++ and Objective-C++ only)
2849 Warn about uses of a comma expression within a subscripting
2850 expression. This usage was deprecated in C++20 and is going to be
2851 removed in C++23. However, a comma expression wrapped in "( )" is
2852 not deprecated. Example:
2853
2854 void f(int *a, int b, int c) {
2855 a[b,c]; // deprecated in C++20, invalid in C++23
2856 a[(b,c)]; // OK
2857 }
2858
2859 In C++23 it is valid to have comma separated expressions in a
2860 subscript when an overloaded subscript operator is found and
2861 supports the right number and types of arguments. G++ will accept
2862 the formerly valid syntax for code that is not valid in C++23 but
2863 used to be valid but deprecated in C++20 with a pedantic warning
2864 that can be disabled with -Wno-comma-subscript.
2865
2866 Enabled by default with -std=c++20 unless -Wno-deprecated, and with
2867 -std=c++23 regardless of -Wno-deprecated.
2868
2869 -Wctad-maybe-unsupported (C++ and Objective-C++ only)
2870 Warn when performing class template argument deduction (CTAD) on a
2871 type with no explicitly written deduction guides. This warning
2872 will point out cases where CTAD succeeded only because the compiler
2873 synthesized the implicit deduction guides, which might not be what
2874 the programmer intended. Certain style guides allow CTAD only on
2875 types that specifically "opt-in"; i.e., on types that are designed
2876 to support CTAD. This warning can be suppressed with the following
2877 pattern:
2878
2879 struct allow_ctad_t; // any name works
2880 template <typename T> struct S {
2881 S(T) { }
2882 };
2883 // Guide with incomplete parameter type will never be considered.
2884 S(allow_ctad_t) -> S<void>;
2885
2886 -Wctor-dtor-privacy (C++ and Objective-C++ only)
2887 Warn when a class seems unusable because all the constructors or
2888 destructors in that class are private, and it has neither friends
2889 nor public static member functions. Also warn if there are no non-
2890 private methods, and there's at least one private member function
2891 that isn't a constructor or destructor.
2892
2893 -Wdangling-reference (C++ and Objective-C++ only)
2894 Warn when a reference is bound to a temporary whose lifetime has
2895 ended. For example:
2896
2897 int n = 1;
2898 const int& r = std::max(n - 1, n + 1); // r is dangling
2899
2900 In the example above, two temporaries are created, one for each
2901 argument, and a reference to one of the temporaries is returned.
2902 However, both temporaries are destroyed at the end of the full
2903 expression, so the reference "r" is dangling. This warning also
2904 detects dangling references in member initializer lists:
2905
2906 const int& f(const int& i) { return i; }
2907 struct S {
2908 const int &r; // r is dangling
2909 S() : r(f(10)) { }
2910 };
2911
2912 Member functions are checked as well, but only their object
2913 argument:
2914
2915 struct S {
2916 const S& self () { return *this; }
2917 };
2918 const S& s = S().self(); // s is dangling
2919
2920 Certain functions are safe in this respect, for example
2921 "std::use_facet": they take and return a reference, but they don't
2922 return one of its arguments, which can fool the warning. Such
2923 functions can be excluded from the warning by wrapping them in a
2924 "#pragma":
2925
2926 #pragma GCC diagnostic push
2927 #pragma GCC diagnostic ignored "-Wdangling-reference"
2928 const T& foo (const T&) { ... }
2929 #pragma GCC diagnostic pop
2930
2931 -Wdangling-reference also warns about code like
2932
2933 auto p = std::minmax(1, 2);
2934
2935 where "std::minmax" returns "std::pair<const int&, const int&>",
2936 and both references dangle after the end of the full expression
2937 that contains the call to "std::minmax".
2938
2939 This warning is enabled by -Wextra.
2940
2941 -Wdelete-non-virtual-dtor (C++ and Objective-C++ only)
2942 Warn when "delete" is used to destroy an instance of a class that
2943 has virtual functions and non-virtual destructor. It is unsafe to
2944 delete an instance of a derived class through a pointer to a base
2945 class if the base class does not have a virtual destructor. This
2946 warning is enabled by -Wall.
2947
2948 -Wdeprecated-copy (C++ and Objective-C++ only)
2949 Warn that the implicit declaration of a copy constructor or copy
2950 assignment operator is deprecated if the class has a user-provided
2951 copy constructor or copy assignment operator, in C++11 and up.
2952 This warning is enabled by -Wextra. With -Wdeprecated-copy-dtor,
2953 also deprecate if the class has a user-provided destructor.
2954
2955 -Wno-deprecated-enum-enum-conversion (C++ and Objective-C++ only)
2956 Disable the warning about the case when the usual arithmetic
2957 conversions are applied on operands where one is of enumeration
2958 type and the other is of a different enumeration type. This
2959 conversion was deprecated in C++20. For example:
2960
2961 enum E1 { e };
2962 enum E2 { f };
2963 int k = f - e;
2964
2965 -Wdeprecated-enum-enum-conversion is enabled by default with
2966 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2967 -Wenum-conversion.
2968
2969 -Wno-deprecated-enum-float-conversion (C++ and Objective-C++ only)
2970 Disable the warning about the case when the usual arithmetic
2971 conversions are applied on operands where one is of enumeration
2972 type and the other is of a floating-point type. This conversion
2973 was deprecated in C++20. For example:
2974
2975 enum E1 { e };
2976 enum E2 { f };
2977 bool b = e <= 3.7;
2978
2979 -Wdeprecated-enum-float-conversion is enabled by default with
2980 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2981 -Wenum-conversion.
2982
2983 -Wno-init-list-lifetime (C++ and Objective-C++ only)
2984 Do not warn about uses of "std::initializer_list" that are likely
2985 to result in dangling pointers. Since the underlying array for an
2986 "initializer_list" is handled like a normal C++ temporary object,
2987 it is easy to inadvertently keep a pointer to the array past the
2988 end of the array's lifetime. For example:
2989
2990 * If a function returns a temporary "initializer_list", or a
2991 local "initializer_list" variable, the array's lifetime ends at
2992 the end of the return statement, so the value returned has a
2993 dangling pointer.
2994
2995 * If a new-expression creates an "initializer_list", the array
2996 only lives until the end of the enclosing full-expression, so
2997 the "initializer_list" in the heap has a dangling pointer.
2998
2999 * When an "initializer_list" variable is assigned from a brace-
3000 enclosed initializer list, the temporary array created for the
3001 right side of the assignment only lives until the end of the
3002 full-expression, so at the next statement the
3003 "initializer_list" variable has a dangling pointer.
3004
3005 // li's initial underlying array lives as long as li
3006 std::initializer_list<int> li = { 1,2,3 };
3007 // assignment changes li to point to a temporary array
3008 li = { 4, 5 };
3009 // now the temporary is gone and li has a dangling pointer
3010 int i = li.begin()[0] // undefined behavior
3011
3012 * When a list constructor stores the "begin" pointer from the
3013 "initializer_list" argument, this doesn't extend the lifetime
3014 of the array, so if a class variable is constructed from a
3015 temporary "initializer_list", the pointer is left dangling by
3016 the end of the variable declaration statement.
3017
3018 -Winvalid-constexpr
3019 Warn when a function never produces a constant expression. In
3020 C++20 and earlier, for every "constexpr" function and function
3021 template, there must be at least one set of function arguments in
3022 at least one instantiation such that an invocation of the function
3023 or constructor could be an evaluated subexpression of a core
3024 constant expression. C++23 removed this restriction, so it's
3025 possible to have a function or a function template marked
3026 "constexpr" for which no invocation satisfies the requirements of a
3027 core constant expression.
3028
3029 This warning is enabled as a pedantic warning by default in C++20
3030 and earlier. In C++23, -Winvalid-constexpr can be turned on, in
3031 which case it will be an ordinary warning. For example:
3032
3033 void f (int& i);
3034 constexpr void
3035 g (int& i)
3036 {
3037 // Warns by default in C++20, in C++23 only with -Winvalid-constexpr.
3038 f(i);
3039 }
3040
3041 -Winvalid-imported-macros
3042 Verify all imported macro definitions are valid at the end of
3043 compilation. This is not enabled by default, as it requires
3044 additional processing to determine. It may be useful when
3045 preparing sets of header-units to ensure consistent macros.
3046
3047 -Wno-literal-suffix (C++ and Objective-C++ only)
3048 Do not warn when a string or character literal is followed by a ud-
3049 suffix which does not begin with an underscore. As a conforming
3050 extension, GCC treats such suffixes as separate preprocessing
3051 tokens in order to maintain backwards compatibility with code that
3052 uses formatting macros from "<inttypes.h>". For example:
3053
3054 #define __STDC_FORMAT_MACROS
3055 #include <inttypes.h>
3056 #include <stdio.h>
3057
3058 int main() {
3059 int64_t i64 = 123;
3060 printf("My int64: %" PRId64"\n", i64);
3061 }
3062
3063 In this case, "PRId64" is treated as a separate preprocessing
3064 token.
3065
3066 This option also controls warnings when a user-defined literal
3067 operator is declared with a literal suffix identifier that doesn't
3068 begin with an underscore. Literal suffix identifiers that don't
3069 begin with an underscore are reserved for future standardization.
3070
3071 These warnings are enabled by default.
3072
3073 -Wno-narrowing (C++ and Objective-C++ only)
3074 For C++11 and later standards, narrowing conversions are diagnosed
3075 by default, as required by the standard. A narrowing conversion
3076 from a constant produces an error, and a narrowing conversion from
3077 a non-constant produces a warning, but -Wno-narrowing suppresses
3078 the diagnostic. Note that this does not affect the meaning of
3079 well-formed code; narrowing conversions are still considered ill-
3080 formed in SFINAE contexts.
3081
3082 With -Wnarrowing in C++98, warn when a narrowing conversion
3083 prohibited by C++11 occurs within { }, e.g.
3084
3085 int i = { 2.2 }; // error: narrowing from double to int
3086
3087 This flag is included in -Wall and -Wc++11-compat.
3088
3089 -Wnoexcept (C++ and Objective-C++ only)
3090 Warn when a noexcept-expression evaluates to false because of a
3091 call to a function that does not have a non-throwing exception
3092 specification (i.e. throw() or "noexcept") but is known by the
3093 compiler to never throw an exception.
3094
3095 -Wnoexcept-type (C++ and Objective-C++ only)
3096 Warn if the C++17 feature making "noexcept" part of a function type
3097 changes the mangled name of a symbol relative to C++14. Enabled by
3098 -Wabi and -Wc++17-compat.
3099
3100 As an example:
3101
3102 template <class T> void f(T t) { t(); };
3103 void g() noexcept;
3104 void h() { f(g); }
3105
3106 In C++14, "f" calls "f<void(*)()>", but in C++17 it calls
3107 "f<void(*)()noexcept>".
3108
3109 -Wclass-memaccess (C++ and Objective-C++ only)
3110 Warn when the destination of a call to a raw memory function such
3111 as "memset" or "memcpy" is an object of class type, and when
3112 writing into such an object might bypass the class non-trivial or
3113 deleted constructor or copy assignment, violate const-correctness
3114 or encapsulation, or corrupt virtual table pointers. Modifying the
3115 representation of such objects may violate invariants maintained by
3116 member functions of the class. For example, the call to "memset"
3117 below is undefined because it modifies a non-trivial class object
3118 and is, therefore, diagnosed. The safe way to either initialize or
3119 clear the storage of objects of such types is by using the
3120 appropriate constructor or assignment operator, if one is
3121 available.
3122
3123 std::string str = "abc";
3124 memset (&str, 0, sizeof str);
3125
3126 The -Wclass-memaccess option is enabled by -Wall. Explicitly
3127 casting the pointer to the class object to "void *" or to a type
3128 that can be safely accessed by the raw memory function suppresses
3129 the warning.
3130
3131 -Wnon-virtual-dtor (C++ and Objective-C++ only)
3132 Warn when a class has virtual functions and an accessible non-
3133 virtual destructor itself or in an accessible polymorphic base
3134 class, in which case it is possible but unsafe to delete an
3135 instance of a derived class through a pointer to the class itself
3136 or base class. This warning is automatically enabled if -Weffc++
3137 is specified. The -Wdelete-non-virtual-dtor option (enabled by
3138 -Wall) should be preferred because it warns about the unsafe cases
3139 without false positives.
3140
3141 -Wregister (C++ and Objective-C++ only)
3142 Warn on uses of the "register" storage class specifier, except when
3143 it is part of the GNU Explicit Register Variables extension. The
3144 use of the "register" keyword as storage class specifier has been
3145 deprecated in C++11 and removed in C++17. Enabled by default with
3146 -std=c++17.
3147
3148 -Wreorder (C++ and Objective-C++ only)
3149 Warn when the order of member initializers given in the code does
3150 not match the order in which they must be executed. For instance:
3151
3152 struct A {
3153 int i;
3154 int j;
3155 A(): j (0), i (1) { }
3156 };
3157
3158 The compiler rearranges the member initializers for "i" and "j" to
3159 match the declaration order of the members, emitting a warning to
3160 that effect. This warning is enabled by -Wall.
3161
3162 -Wno-pessimizing-move (C++ and Objective-C++ only)
3163 This warning warns when a call to "std::move" prevents copy
3164 elision. A typical scenario when copy elision can occur is when
3165 returning in a function with a class return type, when the
3166 expression being returned is the name of a non-volatile automatic
3167 object, and is not a function parameter, and has the same type as
3168 the function return type.
3169
3170 struct T {
3171 ...
3172 };
3173 T fn()
3174 {
3175 T t;
3176 ...
3177 return std::move (t);
3178 }
3179
3180 But in this example, the "std::move" call prevents copy elision.
3181
3182 This warning is enabled by -Wall.
3183
3184 -Wno-redundant-move (C++ and Objective-C++ only)
3185 This warning warns about redundant calls to "std::move"; that is,
3186 when a move operation would have been performed even without the
3187 "std::move" call. This happens because the compiler is forced to
3188 treat the object as if it were an rvalue in certain situations such
3189 as returning a local variable, where copy elision isn't applicable.
3190 Consider:
3191
3192 struct T {
3193 ...
3194 };
3195 T fn(T t)
3196 {
3197 ...
3198 return std::move (t);
3199 }
3200
3201 Here, the "std::move" call is redundant. Because G++ implements
3202 Core Issue 1579, another example is:
3203
3204 struct T { // convertible to U
3205 ...
3206 };
3207 struct U {
3208 ...
3209 };
3210 U fn()
3211 {
3212 T t;
3213 ...
3214 return std::move (t);
3215 }
3216
3217 In this example, copy elision isn't applicable because the type of
3218 the expression being returned and the function return type differ,
3219 yet G++ treats the return value as if it were designated by an
3220 rvalue.
3221
3222 This warning is enabled by -Wextra.
3223
3224 -Wrange-loop-construct (C++ and Objective-C++ only)
3225 This warning warns when a C++ range-based for-loop is creating an
3226 unnecessary copy. This can happen when the range declaration is
3227 not a reference, but probably should be. For example:
3228
3229 struct S { char arr[128]; };
3230 void fn () {
3231 S arr[5];
3232 for (const auto x : arr) { ... }
3233 }
3234
3235 It does not warn when the type being copied is a trivially-copyable
3236 type whose size is less than 64 bytes.
3237
3238 This warning also warns when a loop variable in a range-based for-
3239 loop is initialized with a value of a different type resulting in a
3240 copy. For example:
3241
3242 void fn() {
3243 int arr[10];
3244 for (const double &x : arr) { ... }
3245 }
3246
3247 In the example above, in every iteration of the loop a temporary
3248 value of type "double" is created and destroyed, to which the
3249 reference "const double &" is bound.
3250
3251 This warning is enabled by -Wall.
3252
3253 -Wredundant-tags (C++ and Objective-C++ only)
3254 Warn about redundant class-key and enum-key in references to class
3255 types and enumerated types in contexts where the key can be
3256 eliminated without causing an ambiguity. For example:
3257
3258 struct foo;
3259 struct foo *p; // warn that keyword struct can be eliminated
3260
3261 On the other hand, in this example there is no warning:
3262
3263 struct foo;
3264 void foo (); // "hides" struct foo
3265 void bar (struct foo&); // no warning, keyword struct is necessary
3266
3267 -Wno-subobject-linkage (C++ and Objective-C++ only)
3268 Do not warn if a class type has a base or a field whose type uses
3269 the anonymous namespace or depends on a type with no linkage. If a
3270 type A depends on a type B with no or internal linkage, defining it
3271 in multiple translation units would be an ODR violation because the
3272 meaning of B is different in each translation unit. If A only
3273 appears in a single translation unit, the best way to silence the
3274 warning is to give it internal linkage by putting it in an
3275 anonymous namespace as well. The compiler doesn't give this
3276 warning for types defined in the main .C file, as those are
3277 unlikely to have multiple definitions. -Wsubobject-linkage is
3278 enabled by default.
3279
3280 -Weffc++ (C++ and Objective-C++ only)
3281 Warn about violations of the following style guidelines from Scott
3282 Meyers' Effective C++ series of books:
3283
3284 * Define a copy constructor and an assignment operator for
3285 classes with dynamically-allocated memory.
3286
3287 * Prefer initialization to assignment in constructors.
3288
3289 * Have "operator=" return a reference to *this.
3290
3291 * Don't try to return a reference when you must return an object.
3292
3293 * Distinguish between prefix and postfix forms of increment and
3294 decrement operators.
3295
3296 * Never overload "&&", "||", or ",".
3297
3298 This option also enables -Wnon-virtual-dtor, which is also one of
3299 the effective C++ recommendations. However, the check is extended
3300 to warn about the lack of virtual destructor in accessible non-
3301 polymorphic bases classes too.
3302
3303 When selecting this option, be aware that the standard library
3304 headers do not obey all of these guidelines; use grep -v to filter
3305 out those warnings.
3306
3307 -Wno-exceptions (C++ and Objective-C++ only)
3308 Disable the warning about the case when an exception handler is
3309 shadowed by another handler, which can point out a wrong ordering
3310 of exception handlers.
3311
3312 -Wstrict-null-sentinel (C++ and Objective-C++ only)
3313 Warn about the use of an uncasted "NULL" as sentinel. When
3314 compiling only with GCC this is a valid sentinel, as "NULL" is
3315 defined to "__null". Although it is a null pointer constant rather
3316 than a null pointer, it is guaranteed to be of the same size as a
3317 pointer. But this use is not portable across different compilers.
3318
3319 -Wno-non-template-friend (C++ and Objective-C++ only)
3320 Disable warnings when non-template friend functions are declared
3321 within a template. In very old versions of GCC that predate
3322 implementation of the ISO standard, declarations such as friend int
3323 foo(int), where the name of the friend is an unqualified-id, could
3324 be interpreted as a particular specialization of a template
3325 function; the warning exists to diagnose compatibility problems,
3326 and is enabled by default.
3327
3328 -Wold-style-cast (C++ and Objective-C++ only)
3329 Warn if an old-style (C-style) cast to a non-void type is used
3330 within a C++ program. The new-style casts ("dynamic_cast",
3331 "static_cast", "reinterpret_cast", and "const_cast") are less
3332 vulnerable to unintended effects and much easier to search for.
3333
3334 -Woverloaded-virtual (C++ and Objective-C++ only)
3335 -Woverloaded-virtual=n
3336 Warn when a function declaration hides virtual functions from a
3337 base class. For example, in:
3338
3339 struct A {
3340 virtual void f();
3341 };
3342
3343 struct B: public A {
3344 void f(int); // does not override
3345 };
3346
3347 the "A" class version of "f" is hidden in "B", and code like:
3348
3349 B* b;
3350 b->f();
3351
3352 fails to compile.
3353
3354 In cases where the different signatures are not an accident, the
3355 simplest solution is to add a using-declaration to the derived
3356 class to un-hide the base function, e.g. add "using A::f;" to "B".
3357
3358 The optional level suffix controls the behavior when all the
3359 declarations in the derived class override virtual functions in the
3360 base class, even if not all of the base functions are overridden:
3361
3362 struct C {
3363 virtual void f();
3364 virtual void f(int);
3365 };
3366
3367 struct D: public C {
3368 void f(int); // does override
3369 }
3370
3371 This pattern is less likely to be a mistake; if D is only used
3372 virtually, the user might have decided that the base class
3373 semantics for some of the overloads are fine.
3374
3375 At level 1, this case does not warn; at level 2, it does.
3376 -Woverloaded-virtual by itself selects level 2. Level 1 is
3377 included in -Wall.
3378
3379 -Wno-pmf-conversions (C++ and Objective-C++ only)
3380 Disable the diagnostic for converting a bound pointer to member
3381 function to a plain pointer.
3382
3383 -Wsign-promo (C++ and Objective-C++ only)
3384 Warn when overload resolution chooses a promotion from unsigned or
3385 enumerated type to a signed type, over a conversion to an unsigned
3386 type of the same size. Previous versions of G++ tried to preserve
3387 unsignedness, but the standard mandates the current behavior.
3388
3389 -Wtemplates (C++ and Objective-C++ only)
3390 Warn when a primary template declaration is encountered. Some
3391 coding rules disallow templates, and this may be used to enforce
3392 that rule. The warning is inactive inside a system header file,
3393 such as the STL, so one can still use the STL. One may also
3394 instantiate or specialize templates.
3395
3396 -Wmismatched-new-delete (C++ and Objective-C++ only)
3397 Warn for mismatches between calls to "operator new" or "operator
3398 delete" and the corresponding call to the allocation or
3399 deallocation function. This includes invocations of C++ "operator
3400 delete" with pointers returned from either mismatched forms of
3401 "operator new", or from other functions that allocate objects for
3402 which the "operator delete" isn't a suitable deallocator, as well
3403 as calls to other deallocation functions with pointers returned
3404 from "operator new" for which the deallocation function isn't
3405 suitable.
3406
3407 For example, the "delete" expression in the function below is
3408 diagnosed because it doesn't match the array form of the "new"
3409 expression the pointer argument was returned from. Similarly, the
3410 call to "free" is also diagnosed.
3411
3412 void f ()
3413 {
3414 int *a = new int[n];
3415 delete a; // warning: mismatch in array forms of expressions
3416
3417 char *p = new char[n];
3418 free (p); // warning: mismatch between new and free
3419 }
3420
3421 The related option -Wmismatched-dealloc diagnoses mismatches
3422 involving allocation and deallocation functions other than
3423 "operator new" and "operator delete".
3424
3425 -Wmismatched-new-delete is included in -Wall.
3426
3427 -Wmismatched-tags (C++ and Objective-C++ only)
3428 Warn for declarations of structs, classes, and class templates and
3429 their specializations with a class-key that does not match either
3430 the definition or the first declaration if no definition is
3431 provided.
3432
3433 For example, the declaration of "struct Object" in the argument
3434 list of "draw" triggers the warning. To avoid it, either remove
3435 the redundant class-key "struct" or replace it with "class" to
3436 match its definition.
3437
3438 class Object {
3439 public:
3440 virtual ~Object () = 0;
3441 };
3442 void draw (struct Object*);
3443
3444 It is not wrong to declare a class with the class-key "struct" as
3445 the example above shows. The -Wmismatched-tags option is intended
3446 to help achieve a consistent style of class declarations. In code
3447 that is intended to be portable to Windows-based compilers the
3448 warning helps prevent unresolved references due to the difference
3449 in the mangling of symbols declared with different class-keys. The
3450 option can be used either on its own or in conjunction with
3451 -Wredundant-tags.
3452
3453 -Wmultiple-inheritance (C++ and Objective-C++ only)
3454 Warn when a class is defined with multiple direct base classes.
3455 Some coding rules disallow multiple inheritance, and this may be
3456 used to enforce that rule. The warning is inactive inside a system
3457 header file, such as the STL, so one can still use the STL. One
3458 may also define classes that indirectly use multiple inheritance.
3459
3460 -Wvirtual-inheritance
3461 Warn when a class is defined with a virtual direct base class.
3462 Some coding rules disallow multiple inheritance, and this may be
3463 used to enforce that rule. The warning is inactive inside a system
3464 header file, such as the STL, so one can still use the STL. One
3465 may also define classes that indirectly use virtual inheritance.
3466
3467 -Wno-virtual-move-assign
3468 Suppress warnings about inheriting from a virtual base with a non-
3469 trivial C++11 move assignment operator. This is dangerous because
3470 if the virtual base is reachable along more than one path, it is
3471 moved multiple times, which can mean both objects end up in the
3472 moved-from state. If the move assignment operator is written to
3473 avoid moving from a moved-from object, this warning can be
3474 disabled.
3475
3476 -Wnamespaces
3477 Warn when a namespace definition is opened. Some coding rules
3478 disallow namespaces, and this may be used to enforce that rule.
3479 The warning is inactive inside a system header file, such as the
3480 STL, so one can still use the STL. One may also use using
3481 directives and qualified names.
3482
3483 -Wno-terminate (C++ and Objective-C++ only)
3484 Disable the warning about a throw-expression that will immediately
3485 result in a call to "terminate".
3486
3487 -Wno-vexing-parse (C++ and Objective-C++ only)
3488 Warn about the most vexing parse syntactic ambiguity. This warns
3489 about the cases when a declaration looks like a variable
3490 definition, but the C++ language requires it to be interpreted as a
3491 function declaration. For instance:
3492
3493 void f(double a) {
3494 int i(); // extern int i (void);
3495 int n(int(a)); // extern int n (int);
3496 }
3497
3498 Another example:
3499
3500 struct S { S(int); };
3501 void f(double a) {
3502 S x(int(a)); // extern struct S x (int);
3503 S y(int()); // extern struct S y (int (*) (void));
3504 S z(); // extern struct S z (void);
3505 }
3506
3507 The warning will suggest options how to deal with such an
3508 ambiguity; e.g., it can suggest removing the parentheses or using
3509 braces instead.
3510
3511 This warning is enabled by default.
3512
3513 -Wno-class-conversion (C++ and Objective-C++ only)
3514 Do not warn when a conversion function converts an object to the
3515 same type, to a base class of that type, or to void; such a
3516 conversion function will never be called.
3517
3518 -Wvolatile (C++ and Objective-C++ only)
3519 Warn about deprecated uses of the "volatile" qualifier. This
3520 includes postfix and prefix "++" and "--" expressions of
3521 "volatile"-qualified types, using simple assignments where the left
3522 operand is a "volatile"-qualified non-class type for their value,
3523 compound assignments where the left operand is a
3524 "volatile"-qualified non-class type, "volatile"-qualified function
3525 return type, "volatile"-qualified parameter type, and structured
3526 bindings of a "volatile"-qualified type. This usage was deprecated
3527 in C++20.
3528
3529 Enabled by default with -std=c++20.
3530
3531 -Wzero-as-null-pointer-constant (C++ and Objective-C++ only)
3532 Warn when a literal 0 is used as null pointer constant. This can
3533 be useful to facilitate the conversion to "nullptr" in C++11.
3534
3535 -Waligned-new
3536 Warn about a new-expression of a type that requires greater
3537 alignment than the alignof(std::max_align_t) but uses an allocation
3538 function without an explicit alignment parameter. This option is
3539 enabled by -Wall.
3540
3541 Normally this only warns about global allocation functions, but
3542 -Waligned-new=all also warns about class member allocation
3543 functions.
3544
3545 -Wno-placement-new
3546 -Wplacement-new=n
3547 Warn about placement new expressions with undefined behavior, such
3548 as constructing an object in a buffer that is smaller than the type
3549 of the object. For example, the placement new expression below is
3550 diagnosed because it attempts to construct an array of 64 integers
3551 in a buffer only 64 bytes large.
3552
3553 char buf [64];
3554 new (buf) int[64];
3555
3556 This warning is enabled by default.
3557
3558 -Wplacement-new=1
3559 This is the default warning level of -Wplacement-new. At this
3560 level the warning is not issued for some strictly undefined
3561 constructs that GCC allows as extensions for compatibility with
3562 legacy code. For example, the following "new" expression is
3563 not diagnosed at this level even though it has undefined
3564 behavior according to the C++ standard because it writes past
3565 the end of the one-element array.
3566
3567 struct S { int n, a[1]; };
3568 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
3569 new (s->a)int [32]();
3570
3571 -Wplacement-new=2
3572 At this level, in addition to diagnosing all the same
3573 constructs as at level 1, a diagnostic is also issued for
3574 placement new expressions that construct an object in the last
3575 member of structure whose type is an array of a single element
3576 and whose size is less than the size of the object being
3577 constructed. While the previous example would be diagnosed,
3578 the following construct makes use of the flexible member array
3579 extension to avoid the warning at level 2.
3580
3581 struct S { int n, a[]; };
3582 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
3583 new (s->a)int [32]();
3584
3585 -Wcatch-value
3586 -Wcatch-value=n (C++ and Objective-C++ only)
3587 Warn about catch handlers that do not catch via reference. With
3588 -Wcatch-value=1 (or -Wcatch-value for short) warn about polymorphic
3589 class types that are caught by value. With -Wcatch-value=2 warn
3590 about all class types that are caught by value. With
3591 -Wcatch-value=3 warn about all types that are not caught by
3592 reference. -Wcatch-value is enabled by -Wall.
3593
3594 -Wconditionally-supported (C++ and Objective-C++ only)
3595 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
3596
3597 -Wno-delete-incomplete (C++ and Objective-C++ only)
3598 Do not warn when deleting a pointer to incomplete type, which may
3599 cause undefined behavior at runtime. This warning is enabled by
3600 default.
3601
3602 -Wextra-semi (C++, Objective-C++ only)
3603 Warn about redundant semicolons after in-class function
3604 definitions.
3605
3606 -Wno-inaccessible-base (C++, Objective-C++ only)
3607 This option controls warnings when a base class is inaccessible in
3608 a class derived from it due to ambiguity. The warning is enabled
3609 by default. Note that the warning for ambiguous virtual bases is
3610 enabled by the -Wextra option.
3611
3612 struct A { int a; };
3613
3614 struct B : A { };
3615
3616 struct C : B, A { };
3617
3618 -Wno-inherited-variadic-ctor
3619 Suppress warnings about use of C++11 inheriting constructors when
3620 the base class inherited from has a C variadic constructor; the
3621 warning is on by default because the ellipsis is not inherited.
3622
3623 -Wno-invalid-offsetof (C++ and Objective-C++ only)
3624 Suppress warnings from applying the "offsetof" macro to a non-POD
3625 type. According to the 2014 ISO C++ standard, applying "offsetof"
3626 to a non-standard-layout type is undefined. In existing C++
3627 implementations, however, "offsetof" typically gives meaningful
3628 results. This flag is for users who are aware that they are
3629 writing nonportable code and who have deliberately chosen to ignore
3630 the warning about it.
3631
3632 The restrictions on "offsetof" may be relaxed in a future version
3633 of the C++ standard.
3634
3635 -Wsized-deallocation (C++ and Objective-C++ only)
3636 Warn about a definition of an unsized deallocation function
3637
3638 void operator delete (void *) noexcept;
3639 void operator delete[] (void *) noexcept;
3640
3641 without a definition of the corresponding sized deallocation
3642 function
3643
3644 void operator delete (void *, std::size_t) noexcept;
3645 void operator delete[] (void *, std::size_t) noexcept;
3646
3647 or vice versa. Enabled by -Wextra along with -fsized-deallocation.
3648
3649 -Wsuggest-final-types
3650 Warn about types with virtual methods where code quality would be
3651 improved if the type were declared with the C++11 "final"
3652 specifier, or, if possible, declared in an anonymous namespace.
3653 This allows GCC to more aggressively devirtualize the polymorphic
3654 calls. This warning is more effective with link-time optimization,
3655 where the information about the class hierarchy graph is more
3656 complete.
3657
3658 -Wsuggest-final-methods
3659 Warn about virtual methods where code quality would be improved if
3660 the method were declared with the C++11 "final" specifier, or, if
3661 possible, its type were declared in an anonymous namespace or with
3662 the "final" specifier. This warning is more effective with link-
3663 time optimization, where the information about the class hierarchy
3664 graph is more complete. It is recommended to first consider
3665 suggestions of -Wsuggest-final-types and then rebuild with new
3666 annotations.
3667
3668 -Wsuggest-override
3669 Warn about overriding virtual functions that are not marked with
3670 the "override" keyword.
3671
3672 -Wuse-after-free
3673 -Wuse-after-free=n
3674 Warn about uses of pointers to dynamically allocated objects that
3675 have been rendered indeterminate by a call to a deallocation
3676 function. The warning is enabled at all optimization levels but
3677 may yield different results with optimization than without.
3678
3679 -Wuse-after-free=1
3680 At level 1 the warning attempts to diagnose only unconditional
3681 uses of pointers made indeterminate by a deallocation call or a
3682 successful call to "realloc", regardless of whether or not the
3683 call resulted in an actual reallocatio of memory. This
3684 includes double-"free" calls as well as uses in arithmetic and
3685 relational expressions. Although undefined, uses of
3686 indeterminate pointers in equality (or inequality) expressions
3687 are not diagnosed at this level.
3688
3689 -Wuse-after-free=2
3690 At level 2, in addition to unconditional uses, the warning also
3691 diagnoses conditional uses of pointers made indeterminate by a
3692 deallocation call. As at level 2, uses in equality (or
3693 inequality) expressions are not diagnosed. For example, the
3694 second call to "free" in the following function is diagnosed at
3695 this level:
3696
3697 struct A { int refcount; void *data; };
3698
3699 void release (struct A *p)
3700 {
3701 int refcount = --p->refcount;
3702 free (p);
3703 if (refcount == 0)
3704 free (p->data); // warning: p may be used after free
3705 }
3706
3707 -Wuse-after-free=3
3708 At level 3, the warning also diagnoses uses of indeterminate
3709 pointers in equality expressions. All uses of indeterminate
3710 pointers are undefined but equality tests sometimes appear
3711 after calls to "realloc" as an attempt to determine whether the
3712 call resulted in relocating the object to a different address.
3713 They are diagnosed at a separate level to aid legacy code
3714 gradually transition to safe alternatives. For example, the
3715 equality test in the function below is diagnosed at this level:
3716
3717 void adjust_pointers (int**, int);
3718
3719 void grow (int **p, int n)
3720 {
3721 int **q = (int**)realloc (p, n *= 2);
3722 if (q == p)
3723 return;
3724 adjust_pointers ((int**)q, n);
3725 }
3726
3727 To avoid the warning at this level, store offsets into
3728 allocated memory instead of pointers. This approach obviates
3729 needing to adjust the stored pointers after reallocation.
3730
3731 -Wuse-after-free=2 is included in -Wall.
3732
3733 -Wuseless-cast (C++ and Objective-C++ only)
3734 Warn when an expression is cast to its own type. This warning does
3735 not occur when a class object is converted to a non-reference type
3736 as that is a way to create a temporary:
3737
3738 struct S { };
3739 void g (S&&);
3740 void f (S&& arg)
3741 {
3742 g (S(arg)); // make arg prvalue so that it can bind to S&&
3743 }
3744
3745 -Wno-conversion-null (C++ and Objective-C++ only)
3746 Do not warn for conversions between "NULL" and non-pointer types.
3747 -Wconversion-null is enabled by default.
3748
3749 Options Controlling Objective-C and Objective-C++ Dialects
3750 (NOTE: This manual does not describe the Objective-C and Objective-C++
3751 languages themselves.
3752
3753 This section describes the command-line options that are only
3754 meaningful for Objective-C and Objective-C++ programs. You can also
3755 use most of the language-independent GNU compiler options. For
3756 example, you might compile a file some_class.m like this:
3757
3758 gcc -g -fgnu-runtime -O -c some_class.m
3759
3760 In this example, -fgnu-runtime is an option meant only for Objective-C
3761 and Objective-C++ programs; you can use the other options with any
3762 language supported by GCC.
3763
3764 Note that since Objective-C is an extension of the C language,
3765 Objective-C compilations may also use options specific to the C front-
3766 end (e.g., -Wtraditional). Similarly, Objective-C++ compilations may
3767 use C++-specific options (e.g., -Wabi).
3768
3769 Here is a list of options that are only for compiling Objective-C and
3770 Objective-C++ programs:
3771
3772 -fconstant-string-class=class-name
3773 Use class-name as the name of the class to instantiate for each
3774 literal string specified with the syntax "@"..."". The default
3775 class name is "NXConstantString" if the GNU runtime is being used,
3776 and "NSConstantString" if the NeXT runtime is being used (see
3777 below). On Darwin (macOS, MacOS X) platforms, the
3778 -fconstant-cfstrings option, if also present, overrides the
3779 -fconstant-string-class setting and cause "@"..."" literals to be
3780 laid out as constant CoreFoundation strings. Note that
3781 -fconstant-cfstrings is an alias for the target-specific
3782 -mconstant-cfstrings equivalent.
3783
3784 -fgnu-runtime
3785 Generate object code compatible with the standard GNU Objective-C
3786 runtime. This is the default for most types of systems.
3787
3788 -fnext-runtime
3789 Generate output compatible with the NeXT runtime. This is the
3790 default for NeXT-based systems, including Darwin and Mac OS X. The
3791 macro "__NEXT_RUNTIME__" is predefined if (and only if) this option
3792 is used.
3793
3794 -fno-nil-receivers
3795 Assume that all Objective-C message dispatches ("[receiver
3796 message:arg]") in this translation unit ensure that the receiver is
3797 not "nil". This allows for more efficient entry points in the
3798 runtime to be used. This option is only available in conjunction
3799 with the NeXT runtime and ABI version 0 or 1.
3800
3801 -fobjc-abi-version=n
3802 Use version n of the Objective-C ABI for the selected runtime.
3803 This option is currently supported only for the NeXT runtime. In
3804 that case, Version 0 is the traditional (32-bit) ABI without
3805 support for properties and other Objective-C 2.0 additions.
3806 Version 1 is the traditional (32-bit) ABI with support for
3807 properties and other Objective-C 2.0 additions. Version 2 is the
3808 modern (64-bit) ABI. If nothing is specified, the default is
3809 Version 0 on 32-bit target machines, and Version 2 on 64-bit target
3810 machines.
3811
3812 -fobjc-call-cxx-cdtors
3813 For each Objective-C class, check if any of its instance variables
3814 is a C++ object with a non-trivial default constructor. If so,
3815 synthesize a special "- (id) .cxx_construct" instance method which
3816 runs non-trivial default constructors on any such instance
3817 variables, in order, and then return "self". Similarly, check if
3818 any instance variable is a C++ object with a non-trivial
3819 destructor, and if so, synthesize a special "- (void)
3820 .cxx_destruct" method which runs all such default destructors, in
3821 reverse order.
3822
3823 The "- (id) .cxx_construct" and "- (void) .cxx_destruct" methods
3824 thusly generated only operate on instance variables declared in the
3825 current Objective-C class, and not those inherited from
3826 superclasses. It is the responsibility of the Objective-C runtime
3827 to invoke all such methods in an object's inheritance hierarchy.
3828 The "- (id) .cxx_construct" methods are invoked by the runtime
3829 immediately after a new object instance is allocated; the "- (void)
3830 .cxx_destruct" methods are invoked immediately before the runtime
3831 deallocates an object instance.
3832
3833 As of this writing, only the NeXT runtime on Mac OS X 10.4 and
3834 later has support for invoking the "- (id) .cxx_construct" and "-
3835 (void) .cxx_destruct" methods.
3836
3837 -fobjc-direct-dispatch
3838 Allow fast jumps to the message dispatcher. On Darwin this is
3839 accomplished via the comm page.
3840
3841 -fobjc-exceptions
3842 Enable syntactic support for structured exception handling in
3843 Objective-C, similar to what is offered by C++. This option is
3844 required to use the Objective-C keywords @try, @throw, @catch,
3845 @finally and @synchronized. This option is available with both the
3846 GNU runtime and the NeXT runtime (but not available in conjunction
3847 with the NeXT runtime on Mac OS X 10.2 and earlier).
3848
3849 -fobjc-gc
3850 Enable garbage collection (GC) in Objective-C and Objective-C++
3851 programs. This option is only available with the NeXT runtime; the
3852 GNU runtime has a different garbage collection implementation that
3853 does not require special compiler flags.
3854
3855 -fobjc-nilcheck
3856 For the NeXT runtime with version 2 of the ABI, check for a nil
3857 receiver in method invocations before doing the actual method call.
3858 This is the default and can be disabled using -fno-objc-nilcheck.
3859 Class methods and super calls are never checked for nil in this way
3860 no matter what this flag is set to. Currently this flag does
3861 nothing when the GNU runtime, or an older version of the NeXT
3862 runtime ABI, is used.
3863
3864 -fobjc-std=objc1
3865 Conform to the language syntax of Objective-C 1.0, the language
3866 recognized by GCC 4.0. This only affects the Objective-C additions
3867 to the C/C++ language; it does not affect conformance to C/C++
3868 standards, which is controlled by the separate C/C++ dialect option
3869 flags. When this option is used with the Objective-C or
3870 Objective-C++ compiler, any Objective-C syntax that is not
3871 recognized by GCC 4.0 is rejected. This is useful if you need to
3872 make sure that your Objective-C code can be compiled with older
3873 versions of GCC.
3874
3875 -freplace-objc-classes
3876 Emit a special marker instructing ld(1) not to statically link in
3877 the resulting object file, and allow dyld(1) to load it in at run
3878 time instead. This is used in conjunction with the Fix-and-
3879 Continue debugging mode, where the object file in question may be
3880 recompiled and dynamically reloaded in the course of program
3881 execution, without the need to restart the program itself.
3882 Currently, Fix-and-Continue functionality is only available in
3883 conjunction with the NeXT runtime on Mac OS X 10.3 and later.
3884
3885 -fzero-link
3886 When compiling for the NeXT runtime, the compiler ordinarily
3887 replaces calls to objc_getClass("...") (when the name of the class
3888 is known at compile time) with static class references that get
3889 initialized at load time, which improves run-time performance.
3890 Specifying the -fzero-link flag suppresses this behavior and causes
3891 calls to objc_getClass("...") to be retained. This is useful in
3892 Zero-Link debugging mode, since it allows for individual class
3893 implementations to be modified during program execution. The GNU
3894 runtime currently always retains calls to objc_get_class("...")
3895 regardless of command-line options.
3896
3897 -fno-local-ivars
3898 By default instance variables in Objective-C can be accessed as if
3899 they were local variables from within the methods of the class
3900 they're declared in. This can lead to shadowing between instance
3901 variables and other variables declared either locally inside a
3902 class method or globally with the same name. Specifying the
3903 -fno-local-ivars flag disables this behavior thus avoiding variable
3904 shadowing issues.
3905
3906 -fivar-visibility=[public|protected|private|package]
3907 Set the default instance variable visibility to the specified
3908 option so that instance variables declared outside the scope of any
3909 access modifier directives default to the specified visibility.
3910
3911 -gen-decls
3912 Dump interface declarations for all classes seen in the source file
3913 to a file named sourcename.decl.
3914
3915 -Wassign-intercept (Objective-C and Objective-C++ only)
3916 Warn whenever an Objective-C assignment is being intercepted by the
3917 garbage collector.
3918
3919 -Wno-property-assign-default (Objective-C and Objective-C++ only)
3920 Do not warn if a property for an Objective-C object has no assign
3921 semantics specified.
3922
3923 -Wno-protocol (Objective-C and Objective-C++ only)
3924 If a class is declared to implement a protocol, a warning is issued
3925 for every method in the protocol that is not implemented by the
3926 class. The default behavior is to issue a warning for every method
3927 not explicitly implemented in the class, even if a method
3928 implementation is inherited from the superclass. If you use the
3929 -Wno-protocol option, then methods inherited from the superclass
3930 are considered to be implemented, and no warning is issued for
3931 them.
3932
3933 -Wobjc-root-class (Objective-C and Objective-C++ only)
3934 Warn if a class interface lacks a superclass. Most classes will
3935 inherit from "NSObject" (or "Object") for example. When declaring
3936 classes intended to be root classes, the warning can be suppressed
3937 by marking their interfaces with
3938 "__attribute__((objc_root_class))".
3939
3940 -Wselector (Objective-C and Objective-C++ only)
3941 Warn if multiple methods of different types for the same selector
3942 are found during compilation. The check is performed on the list
3943 of methods in the final stage of compilation. Additionally, a
3944 check is performed for each selector appearing in a @selector(...)
3945 expression, and a corresponding method for that selector has been
3946 found during compilation. Because these checks scan the method
3947 table only at the end of compilation, these warnings are not
3948 produced if the final stage of compilation is not reached, for
3949 example because an error is found during compilation, or because
3950 the -fsyntax-only option is being used.
3951
3952 -Wstrict-selector-match (Objective-C and Objective-C++ only)
3953 Warn if multiple methods with differing argument and/or return
3954 types are found for a given selector when attempting to send a
3955 message using this selector to a receiver of type "id" or "Class".
3956 When this flag is off (which is the default behavior), the compiler
3957 omits such warnings if any differences found are confined to types
3958 that share the same size and alignment.
3959
3960 -Wundeclared-selector (Objective-C and Objective-C++ only)
3961 Warn if a @selector(...) expression referring to an undeclared
3962 selector is found. A selector is considered undeclared if no
3963 method with that name has been declared before the @selector(...)
3964 expression, either explicitly in an @interface or @protocol
3965 declaration, or implicitly in an @implementation section. This
3966 option always performs its checks as soon as a @selector(...)
3967 expression is found, while -Wselector only performs its checks in
3968 the final stage of compilation. This also enforces the coding
3969 style convention that methods and selectors must be declared before
3970 being used.
3971
3972 -print-objc-runtime-info
3973 Generate C header describing the largest structure that is passed
3974 by value, if any.
3975
3976 Options to Control Diagnostic Messages Formatting
3977 Traditionally, diagnostic messages have been formatted irrespective of
3978 the output device's aspect (e.g. its width, ...). You can use the
3979 options described below to control the formatting algorithm for
3980 diagnostic messages, e.g. how many characters per line, how often
3981 source location information should be reported. Note that some
3982 language front ends may not honor these options.
3983
3984 -fmessage-length=n
3985 Try to format error messages so that they fit on lines of about n
3986 characters. If n is zero, then no line-wrapping is done; each
3987 error message appears on a single line. This is the default for
3988 all front ends.
3989
3990 Note - this option also affects the display of the #error and
3991 #warning pre-processor directives, and the deprecated
3992 function/type/variable attribute. It does not however affect the
3993 pragma GCC warning and pragma GCC error pragmas.
3994
3995 -fdiagnostics-plain-output
3996 This option requests that diagnostic output look as plain as
3997 possible, which may be useful when running dejagnu or other
3998 utilities that need to parse diagnostics output and prefer that it
3999 remain more stable over time. -fdiagnostics-plain-output is
4000 currently equivalent to the following options:
4001 -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
4002 -fdiagnostics-color=never -fdiagnostics-urls=never
4003 -fdiagnostics-path-format=separate-events In the future, if GCC
4004 changes the default appearance of its diagnostics, the
4005 corresponding option to disable the new behavior will be added to
4006 this list.
4007
4008 -fdiagnostics-show-location=once
4009 Only meaningful in line-wrapping mode. Instructs the diagnostic
4010 messages reporter to emit source location information once; that
4011 is, in case the message is too long to fit on a single physical
4012 line and has to be wrapped, the source location won't be emitted
4013 (as prefix) again, over and over, in subsequent continuation lines.
4014 This is the default behavior.
4015
4016 -fdiagnostics-show-location=every-line
4017 Only meaningful in line-wrapping mode. Instructs the diagnostic
4018 messages reporter to emit the same source location information (as
4019 prefix) for physical lines that result from the process of breaking
4020 a message which is too long to fit on a single line.
4021
4022 -fdiagnostics-color[=WHEN]
4023 -fno-diagnostics-color
4024 Use color in diagnostics. WHEN is never, always, or auto. The
4025 default depends on how the compiler has been configured, it can be
4026 any of the above WHEN options or also never if GCC_COLORS
4027 environment variable isn't present in the environment, and auto
4028 otherwise. auto makes GCC use color only when the standard error
4029 is a terminal, and when not executing in an emacs shell. The forms
4030 -fdiagnostics-color and -fno-diagnostics-color are aliases for
4031 -fdiagnostics-color=always and -fdiagnostics-color=never,
4032 respectively.
4033
4034 The colors are defined by the environment variable GCC_COLORS. Its
4035 value is a colon-separated list of capabilities and Select Graphic
4036 Rendition (SGR) substrings. SGR commands are interpreted by the
4037 terminal or terminal emulator. (See the section in the
4038 documentation of your text terminal for permitted values and their
4039 meanings as character attributes.) These substring values are
4040 integers in decimal representation and can be concatenated with
4041 semicolons. Common values to concatenate include 1 for bold, 4 for
4042 underline, 5 for blink, 7 for inverse, 39 for default foreground
4043 color, 30 to 37 for foreground colors, 90 to 97 for 16-color mode
4044 foreground colors, 38;5;0 to 38;5;255 for 88-color and 256-color
4045 modes foreground colors, 49 for default background color, 40 to 47
4046 for background colors, 100 to 107 for 16-color mode background
4047 colors, and 48;5;0 to 48;5;255 for 88-color and 256-color modes
4048 background colors.
4049
4050 The default GCC_COLORS is
4051
4052 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
4053 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
4054 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
4055 type-diff=01;32:fnname=01;32:targs=35
4056
4057 where 01;31 is bold red, 01;35 is bold magenta, 01;36 is bold cyan,
4058 32 is green, 34 is blue, 01 is bold, and 31 is red. Setting
4059 GCC_COLORS to the empty string disables colors. Supported
4060 capabilities are as follows.
4061
4062 "error="
4063 SGR substring for error: markers.
4064
4065 "warning="
4066 SGR substring for warning: markers.
4067
4068 "note="
4069 SGR substring for note: markers.
4070
4071 "path="
4072 SGR substring for colorizing paths of control-flow events as
4073 printed via -fdiagnostics-path-format=, such as the identifiers
4074 of individual events and lines indicating interprocedural calls
4075 and returns.
4076
4077 "range1="
4078 SGR substring for first additional range.
4079
4080 "range2="
4081 SGR substring for second additional range.
4082
4083 "locus="
4084 SGR substring for location information, file:line or
4085 file:line:column etc.
4086
4087 "quote="
4088 SGR substring for information printed within quotes.
4089
4090 "fnname="
4091 SGR substring for names of C++ functions.
4092
4093 "targs="
4094 SGR substring for C++ function template parameter bindings.
4095
4096 "fixit-insert="
4097 SGR substring for fix-it hints suggesting text to be inserted
4098 or replaced.
4099
4100 "fixit-delete="
4101 SGR substring for fix-it hints suggesting text to be deleted.
4102
4103 "diff-filename="
4104 SGR substring for filename headers within generated patches.
4105
4106 "diff-hunk="
4107 SGR substring for the starts of hunks within generated patches.
4108
4109 "diff-delete="
4110 SGR substring for deleted lines within generated patches.
4111
4112 "diff-insert="
4113 SGR substring for inserted lines within generated patches.
4114
4115 "type-diff="
4116 SGR substring for highlighting mismatching types within
4117 template arguments in the C++ frontend.
4118
4119 -fdiagnostics-urls[=WHEN]
4120 Use escape sequences to embed URLs in diagnostics. For example,
4121 when -fdiagnostics-show-option emits text showing the command-line
4122 option controlling a diagnostic, embed a URL for documentation of
4123 that option.
4124
4125 WHEN is never, always, or auto. auto makes GCC use URL escape
4126 sequences only when the standard error is a terminal, and when not
4127 executing in an emacs shell or any graphical terminal which is
4128 known to be incompatible with this feature, see below.
4129
4130 The default depends on how the compiler has been configured. It
4131 can be any of the above WHEN options.
4132
4133 GCC can also be configured (via the
4134 --with-diagnostics-urls=auto-if-env configure-time option) so that
4135 the default is affected by environment variables. Under such a
4136 configuration, GCC defaults to using auto if either GCC_URLS or
4137 TERM_URLS environment variables are present and non-empty in the
4138 environment of the compiler, or never if neither are.
4139
4140 However, even with -fdiagnostics-urls=always the behavior is
4141 dependent on those environment variables: If GCC_URLS is set to
4142 empty or no, do not embed URLs in diagnostics. If set to st, URLs
4143 use ST escape sequences. If set to bel, the default, URLs use BEL
4144 escape sequences. Any other non-empty value enables the feature.
4145 If GCC_URLS is not set, use TERM_URLS as a fallback. Note: ST is
4146 an ANSI escape sequence, string terminator ESC \, BEL is an ASCII
4147 character, CTRL-G that usually sounds like a beep.
4148
4149 At this time GCC tries to detect also a few terminals that are
4150 known to not implement the URL feature, and have bugs or at least
4151 had bugs in some versions that are still in use, where the URL
4152 escapes are likely to misbehave, i.e. print garbage on the screen.
4153 That list is currently xfce4-terminal, certain known to be buggy
4154 gnome-terminal versions, the linux console, and mingw. This check
4155 can be skipped with the -fdiagnostics-urls=always.
4156
4157 -fno-diagnostics-show-option
4158 By default, each diagnostic emitted includes text indicating the
4159 command-line option that directly controls the diagnostic (if such
4160 an option is known to the diagnostic machinery). Specifying the
4161 -fno-diagnostics-show-option flag suppresses that behavior.
4162
4163 -fno-diagnostics-show-caret
4164 By default, each diagnostic emitted includes the original source
4165 line and a caret ^ indicating the column. This option suppresses
4166 this information. The source line is truncated to n characters, if
4167 the -fmessage-length=n option is given. When the output is done to
4168 the terminal, the width is limited to the width given by the
4169 COLUMNS environment variable or, if not set, to the terminal width.
4170
4171 -fno-diagnostics-show-labels
4172 By default, when printing source code (via
4173 -fdiagnostics-show-caret), diagnostics can label ranges of source
4174 code with pertinent information, such as the types of expressions:
4175
4176 printf ("foo %s bar", long_i + long_j);
4177 ~^ ~~~~~~~~~~~~~~~
4178 | |
4179 char * long int
4180
4181 This option suppresses the printing of these labels (in the example
4182 above, the vertical bars and the "char *" and "long int" text).
4183
4184 -fno-diagnostics-show-cwe
4185 Diagnostic messages can optionally have an associated
4186 CWE ("https://cwe.mitre.org/index.html") identifier. GCC itself
4187 only provides such metadata for some of the -fanalyzer diagnostics.
4188 GCC plugins may also provide diagnostics with such metadata. By
4189 default, if this information is present, it will be printed with
4190 the diagnostic. This option suppresses the printing of this
4191 metadata.
4192
4193 -fno-diagnostics-show-rules
4194 Diagnostic messages can optionally have rules associated with them,
4195 such as from a coding standard, or a specification. GCC itself
4196 does not do this for any of its diagnostics, but plugins may do so.
4197 By default, if this information is present, it will be printed with
4198 the diagnostic. This option suppresses the printing of this
4199 metadata.
4200
4201 -fno-diagnostics-show-line-numbers
4202 By default, when printing source code (via
4203 -fdiagnostics-show-caret), a left margin is printed, showing line
4204 numbers. This option suppresses this left margin.
4205
4206 -fdiagnostics-minimum-margin-width=width
4207 This option controls the minimum width of the left margin printed
4208 by -fdiagnostics-show-line-numbers. It defaults to 6.
4209
4210 -fdiagnostics-parseable-fixits
4211 Emit fix-it hints in a machine-parseable format, suitable for
4212 consumption by IDEs. For each fix-it, a line will be printed after
4213 the relevant diagnostic, starting with the string "fix-it:". For
4214 example:
4215
4216 fix-it:"test.c":{45:3-45:21}:"gtk_widget_show_all"
4217
4218 The location is expressed as a half-open range, expressed as a
4219 count of bytes, starting at byte 1 for the initial column. In the
4220 above example, bytes 3 through 20 of line 45 of "test.c" are to be
4221 replaced with the given string:
4222
4223 00000000011111111112222222222
4224 12345678901234567890123456789
4225 gtk_widget_showall (dlg);
4226 ^^^^^^^^^^^^^^^^^^
4227 gtk_widget_show_all
4228
4229 The filename and replacement string escape backslash as "\\", tab
4230 as "\t", newline as "\n", double quotes as "\"", non-printable
4231 characters as octal (e.g. vertical tab as "\013").
4232
4233 An empty replacement string indicates that the given range is to be
4234 removed. An empty range (e.g. "45:3-45:3") indicates that the
4235 string is to be inserted at the given position.
4236
4237 -fdiagnostics-generate-patch
4238 Print fix-it hints to stderr in unified diff format, after any
4239 diagnostics are printed. For example:
4240
4241 --- test.c
4242 +++ test.c
4243 @ -42,5 +42,5 @
4244
4245 void show_cb(GtkDialog *dlg)
4246 {
4247 - gtk_widget_showall(dlg);
4248 + gtk_widget_show_all(dlg);
4249 }
4250
4251 The diff may or may not be colorized, following the same rules as
4252 for diagnostics (see -fdiagnostics-color).
4253
4254 -fdiagnostics-show-template-tree
4255 In the C++ frontend, when printing diagnostics showing mismatching
4256 template types, such as:
4257
4258 could not convert 'std::map<int, std::vector<double> >()'
4259 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4260
4261 the -fdiagnostics-show-template-tree flag enables printing a tree-
4262 like structure showing the common and differing parts of the types,
4263 such as:
4264
4265 map<
4266 [...],
4267 vector<
4268 [double != float]>>
4269
4270 The parts that differ are highlighted with color ("double" and
4271 "float" in this case).
4272
4273 -fno-elide-type
4274 By default when the C++ frontend prints diagnostics showing
4275 mismatching template types, common parts of the types are printed
4276 as "[...]" to simplify the error message. For example:
4277
4278 could not convert 'std::map<int, std::vector<double> >()'
4279 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4280
4281 Specifying the -fno-elide-type flag suppresses that behavior. This
4282 flag also affects the output of the
4283 -fdiagnostics-show-template-tree flag.
4284
4285 -fdiagnostics-path-format=KIND
4286 Specify how to print paths of control-flow events for diagnostics
4287 that have such a path associated with them.
4288
4289 KIND is none, separate-events, or inline-events, the default.
4290
4291 none means to not print diagnostic paths.
4292
4293 separate-events means to print a separate "note" diagnostic for
4294 each event within the diagnostic. For example:
4295
4296 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
4297 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
4298 test.c:27:3: note: (2) when 'i < count'
4299 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4300
4301 inline-events means to print the events "inline" within the source
4302 code. This view attempts to consolidate the events into runs of
4303 sufficiently-close events, printing them as labelled ranges within
4304 the source.
4305
4306 For example, the same events as above might be printed as:
4307
4308 'test': events 1-3
4309 |
4310 | 25 | list = PyList_New(0);
4311 | | ^~~~~~~~~~~~~
4312 | | |
4313 | | (1) when 'PyList_New' fails, returning NULL
4314 | 26 |
4315 | 27 | for (i = 0; i < count; i++) {
4316 | | ~~~
4317 | | |
4318 | | (2) when 'i < count'
4319 | 28 | item = PyLong_FromLong(random());
4320 | 29 | PyList_Append(list, item);
4321 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
4322 | | |
4323 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4324 |
4325
4326 Interprocedural control flow is shown by grouping the events by
4327 stack frame, and using indentation to show how stack frames are
4328 nested, pushed, and popped.
4329
4330 For example:
4331
4332 'test': events 1-2
4333 |
4334 | 133 | {
4335 | | ^
4336 | | |
4337 | | (1) entering 'test'
4338 | 134 | boxed_int *obj = make_boxed_int (i);
4339 | | ~~~~~~~~~~~~~~~~~~
4340 | | |
4341 | | (2) calling 'make_boxed_int'
4342 |
4343 +--> 'make_boxed_int': events 3-4
4344 |
4345 | 120 | {
4346 | | ^
4347 | | |
4348 | | (3) entering 'make_boxed_int'
4349 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
4350 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4351 | | |
4352 | | (4) calling 'wrapped_malloc'
4353 |
4354 +--> 'wrapped_malloc': events 5-6
4355 |
4356 | 7 | {
4357 | | ^
4358 | | |
4359 | | (5) entering 'wrapped_malloc'
4360 | 8 | return malloc (size);
4361 | | ~~~~~~~~~~~~~
4362 | | |
4363 | | (6) calling 'malloc'
4364 |
4365 <-------------+
4366 |
4367 'test': event 7
4368 |
4369 | 138 | free_boxed_int (obj);
4370 | | ^~~~~~~~~~~~~~~~~~~~
4371 | | |
4372 | | (7) calling 'free_boxed_int'
4373 |
4374 (etc)
4375
4376 -fdiagnostics-show-path-depths
4377 This option provides additional information when printing control-
4378 flow paths associated with a diagnostic.
4379
4380 If this is option is provided then the stack depth will be printed
4381 for each run of events within
4382 -fdiagnostics-path-format=inline-events. If provided with
4383 -fdiagnostics-path-format=separate-events, then the stack depth and
4384 function declaration will be appended when printing each event.
4385
4386 This is intended for use by GCC developers and plugin developers
4387 when debugging diagnostics that report interprocedural control
4388 flow.
4389
4390 -fno-show-column
4391 Do not print column numbers in diagnostics. This may be necessary
4392 if diagnostics are being scanned by a program that does not
4393 understand the column numbers, such as dejagnu.
4394
4395 -fdiagnostics-column-unit=UNIT
4396 Select the units for the column number. This affects traditional
4397 diagnostics (in the absence of -fno-show-column), as well as JSON
4398 format diagnostics if requested.
4399
4400 The default UNIT, display, considers the number of display columns
4401 occupied by each character. This may be larger than the number of
4402 bytes required to encode the character, in the case of tab
4403 characters, or it may be smaller, in the case of multibyte
4404 characters. For example, the character "GREEK SMALL LETTER PI
4405 (U+03C0)" occupies one display column, and its UTF-8 encoding
4406 requires two bytes; the character "SLIGHTLY SMILING FACE (U+1F642)"
4407 occupies two display columns, and its UTF-8 encoding requires four
4408 bytes.
4409
4410 Setting UNIT to byte changes the column number to the raw byte
4411 count in all cases, as was traditionally output by GCC prior to
4412 version 11.1.0.
4413
4414 -fdiagnostics-column-origin=ORIGIN
4415 Select the origin for column numbers, i.e. the column number
4416 assigned to the first column. The default value of 1 corresponds
4417 to traditional GCC behavior and to the GNU style guide. Some
4418 utilities may perform better with an origin of 0; any non-negative
4419 value may be specified.
4420
4421 -fdiagnostics-escape-format=FORMAT
4422 When GCC prints pertinent source lines for a diagnostic it normally
4423 attempts to print the source bytes directly. However, some
4424 diagnostics relate to encoding issues in the source file, such as
4425 malformed UTF-8, or issues with Unicode normalization. These
4426 diagnostics are flagged so that GCC will escape bytes that are not
4427 printable ASCII when printing their pertinent source lines.
4428
4429 This option controls how such bytes should be escaped.
4430
4431 The default FORMAT, unicode displays Unicode characters that are
4432 not printable ASCII in the form <U+XXXX>, and bytes that do not
4433 correspond to a Unicode character validly-encoded in UTF-8-encoded
4434 will be displayed as hexadecimal in the form <XX>.
4435
4436 For example, a source line containing the string before followed by
4437 the Unicode character U+03C0 ("GREEK SMALL LETTER PI", with UTF-8
4438 encoding 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8
4439 trailing byte), followed by the string after will be printed for
4440 such a diagnostic as:
4441
4442 before<U+03C0><BF>after
4443
4444 Setting FORMAT to bytes will display all non-printable-ASCII bytes
4445 in the form <XX>, thus showing the underlying encoding of non-ASCII
4446 Unicode characters. For the example above, the following will be
4447 printed:
4448
4449 before<CF><80><BF>after
4450
4451 -fdiagnostics-format=FORMAT
4452 Select a different format for printing diagnostics. FORMAT is
4453 text, sarif-stderr, sarif-file, json, json-stderr, or json-file.
4454
4455 The default is text.
4456
4457 The sarif-stderr and sarif-file formats both emit diagnostics in
4458 SARIF Version 2.1.0 format, either to stderr, or to a file named
4459 source.sarif, respectively.
4460
4461 The json format is a synonym for json-stderr. The json-stderr and
4462 json-file formats are identical, apart from where the JSON is
4463 emitted to - with the former, the JSON is emitted to stderr,
4464 whereas with json-file it is written to source.gcc.json.
4465
4466 The emitted JSON consists of a top-level JSON array containing JSON
4467 objects representing the diagnostics. The JSON is emitted as one
4468 line, without formatting; the examples below have been formatted
4469 for clarity.
4470
4471 Diagnostics can have child diagnostics. For example, this error
4472 and note:
4473
4474 misleading-indentation.c:15:3: warning: this 'if' clause does not
4475 guard... [-Wmisleading-indentation]
4476 15 | if (flag)
4477 | ^~
4478 misleading-indentation.c:17:5: note: ...this statement, but the latter
4479 is misleadingly indented as if it were guarded by the 'if'
4480 17 | y = 2;
4481 | ^
4482
4483 might be printed in JSON form (after formatting) like this:
4484
4485 [
4486 {
4487 "kind": "warning",
4488 "locations": [
4489 {
4490 "caret": {
4491 "display-column": 3,
4492 "byte-column": 3,
4493 "column": 3,
4494 "file": "misleading-indentation.c",
4495 "line": 15
4496 },
4497 "finish": {
4498 "display-column": 4,
4499 "byte-column": 4,
4500 "column": 4,
4501 "file": "misleading-indentation.c",
4502 "line": 15
4503 }
4504 }
4505 ],
4506 "message": "this \u2018if\u2019 clause does not guard...",
4507 "option": "-Wmisleading-indentation",
4508 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4509 "children": [
4510 {
4511 "kind": "note",
4512 "locations": [
4513 {
4514 "caret": {
4515 "display-column": 5,
4516 "byte-column": 5,
4517 "column": 5,
4518 "file": "misleading-indentation.c",
4519 "line": 17
4520 }
4521 }
4522 ],
4523 "escape-source": false,
4524 "message": "...this statement, but the latter is ..."
4525 }
4526 ]
4527 "escape-source": false,
4528 "column-origin": 1,
4529 }
4530 ]
4531
4532 where the "note" is a child of the "warning".
4533
4534 A diagnostic has a "kind". If this is "warning", then there is an
4535 "option" key describing the command-line option controlling the
4536 warning.
4537
4538 A diagnostic can contain zero or more locations. Each location has
4539 an optional "label" string and up to three positions within it: a
4540 "caret" position and optional "start" and "finish" positions. A
4541 position is described by a "file" name, a "line" number, and three
4542 numbers indicating a column position:
4543
4544 * "display-column" counts display columns, accounting for tabs
4545 and multibyte characters.
4546
4547 * "byte-column" counts raw bytes.
4548
4549 * "column" is equal to one of the previous two, as dictated by
4550 the -fdiagnostics-column-unit option.
4551
4552 All three columns are relative to the origin specified by
4553 -fdiagnostics-column-origin, which is typically equal to 1 but may
4554 be set, for instance, to 0 for compatibility with other utilities
4555 that number columns from 0. The column origin is recorded in the
4556 JSON output in the "column-origin" tag. In the remaining examples
4557 below, the extra column number outputs have been omitted for
4558 brevity.
4559
4560 For example, this error:
4561
4562 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' {aka
4563 'struct s'} and 'T' {aka 'struct t'})
4564 64 | return callee_4a () + callee_4b ();
4565 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4566 | | |
4567 | | T {aka struct t}
4568 | S {aka struct s}
4569
4570 has three locations. Its primary location is at the "+" token at
4571 column 23. It has two secondary locations, describing the left and
4572 right-hand sides of the expression, which have labels. It might be
4573 printed in JSON form as:
4574
4575 {
4576 "children": [],
4577 "kind": "error",
4578 "locations": [
4579 {
4580 "caret": {
4581 "column": 23, "file": "bad-binary-ops.c", "line": 64
4582 }
4583 },
4584 {
4585 "caret": {
4586 "column": 10, "file": "bad-binary-ops.c", "line": 64
4587 },
4588 "finish": {
4589 "column": 21, "file": "bad-binary-ops.c", "line": 64
4590 },
4591 "label": "S {aka struct s}"
4592 },
4593 {
4594 "caret": {
4595 "column": 25, "file": "bad-binary-ops.c", "line": 64
4596 },
4597 "finish": {
4598 "column": 36, "file": "bad-binary-ops.c", "line": 64
4599 },
4600 "label": "T {aka struct t}"
4601 }
4602 ],
4603 "escape-source": false,
4604 "message": "invalid operands to binary + ..."
4605 }
4606
4607 If a diagnostic contains fix-it hints, it has a "fixits" array,
4608 consisting of half-open intervals, similar to the output of
4609 -fdiagnostics-parseable-fixits. For example, this diagnostic with
4610 a replacement fix-it hint:
4611
4612 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4613 mean 'color'?
4614 8 | return ptr->colour;
4615 | ^~~~~~
4616 | color
4617
4618 might be printed in JSON form as:
4619
4620 {
4621 "children": [],
4622 "fixits": [
4623 {
4624 "next": {
4625 "column": 21,
4626 "file": "demo.c",
4627 "line": 8
4628 },
4629 "start": {
4630 "column": 15,
4631 "file": "demo.c",
4632 "line": 8
4633 },
4634 "string": "color"
4635 }
4636 ],
4637 "kind": "error",
4638 "locations": [
4639 {
4640 "caret": {
4641 "column": 15,
4642 "file": "demo.c",
4643 "line": 8
4644 },
4645 "finish": {
4646 "column": 20,
4647 "file": "demo.c",
4648 "line": 8
4649 }
4650 }
4651 ],
4652 "escape-source": false,
4653 "message": "\u2018struct s\u2019 has no member named ..."
4654 }
4655
4656 where the fix-it hint suggests replacing the text from "start" up
4657 to but not including "next" with "string"'s value. Deletions are
4658 expressed via an empty value for "string", insertions by having
4659 "start" equal "next".
4660
4661 If the diagnostic has a path of control-flow events associated with
4662 it, it has a "path" array of objects representing the events. Each
4663 event object has a "description" string, a "location" object, along
4664 with a "function" string and a "depth" number for representing
4665 interprocedural paths. The "function" represents the current
4666 function at that event, and the "depth" represents the stack depth
4667 relative to some baseline: the higher, the more frames are within
4668 the stack.
4669
4670 For example, the intraprocedural example shown for
4671 -fdiagnostics-path-format= might have this JSON for its path:
4672
4673 "path": [
4674 {
4675 "depth": 0,
4676 "description": "when 'PyList_New' fails, returning NULL",
4677 "function": "test",
4678 "location": {
4679 "column": 10,
4680 "file": "test.c",
4681 "line": 25
4682 }
4683 },
4684 {
4685 "depth": 0,
4686 "description": "when 'i < count'",
4687 "function": "test",
4688 "location": {
4689 "column": 3,
4690 "file": "test.c",
4691 "line": 27
4692 }
4693 },
4694 {
4695 "depth": 0,
4696 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
4697 "function": "test",
4698 "location": {
4699 "column": 5,
4700 "file": "test.c",
4701 "line": 29
4702 }
4703 }
4704 ]
4705
4706 Diagnostics have a boolean attribute "escape-source", hinting
4707 whether non-ASCII bytes should be escaped when printing the
4708 pertinent lines of source code ("true" for diagnostics involving
4709 source encoding issues).
4710
4711 Options to Request or Suppress Warnings
4712 Warnings are diagnostic messages that report constructions that are not
4713 inherently erroneous but that are risky or suggest there may have been
4714 an error.
4715
4716 The following language-independent options do not enable specific
4717 warnings but control the kinds of diagnostics produced by GCC.
4718
4719 -fsyntax-only
4720 Check the code for syntax errors, but don't do anything beyond
4721 that.
4722
4723 -fmax-errors=n
4724 Limits the maximum number of error messages to n, at which point
4725 GCC bails out rather than attempting to continue processing the
4726 source code. If n is 0 (the default), there is no limit on the
4727 number of error messages produced. If -Wfatal-errors is also
4728 specified, then -Wfatal-errors takes precedence over this option.
4729
4730 -w Inhibit all warning messages.
4731
4732 -Werror
4733 Make all warnings into errors.
4734
4735 -Werror=
4736 Make the specified warning into an error. The specifier for a
4737 warning is appended; for example -Werror=switch turns the warnings
4738 controlled by -Wswitch into errors. This switch takes a negative
4739 form, to be used to negate -Werror for specific warnings; for
4740 example -Wno-error=switch makes -Wswitch warnings not be errors,
4741 even when -Werror is in effect.
4742
4743 The warning message for each controllable warning includes the
4744 option that controls the warning. That option can then be used
4745 with -Werror= and -Wno-error= as described above. (Printing of the
4746 option in the warning message can be disabled using the
4747 -fno-diagnostics-show-option flag.)
4748
4749 Note that specifying -Werror=foo automatically implies -Wfoo.
4750 However, -Wno-error=foo does not imply anything.
4751
4752 -Wfatal-errors
4753 This option causes the compiler to abort compilation on the first
4754 error occurred rather than trying to keep going and printing
4755 further error messages.
4756
4757 You can request many specific warnings with options beginning with -W,
4758 for example -Wimplicit to request warnings on implicit declarations.
4759 Each of these specific warning options also has a negative form
4760 beginning -Wno- to turn off warnings; for example, -Wno-implicit. This
4761 manual lists only one of the two forms, whichever is not the default.
4762 For further language-specific options also refer to C++ Dialect Options
4763 and Objective-C and Objective-C++ Dialect Options. Additional warnings
4764 can be produced by enabling the static analyzer;
4765
4766 Some options, such as -Wall and -Wextra, turn on other options, such as
4767 -Wunused, which may turn on further options, such as -Wunused-value.
4768 The combined effect of positive and negative forms is that more
4769 specific options have priority over less specific ones, independently
4770 of their position in the command-line. For options of the same
4771 specificity, the last one takes effect. Options enabled or disabled via
4772 pragmas take effect as if they appeared at the end of the command-line.
4773
4774 When an unrecognized warning option is requested (e.g.,
4775 -Wunknown-warning), GCC emits a diagnostic stating that the option is
4776 not recognized. However, if the -Wno- form is used, the behavior is
4777 slightly different: no diagnostic is produced for -Wno-unknown-warning
4778 unless other diagnostics are being produced. This allows the use of
4779 new -Wno- options with old compilers, but if something goes wrong, the
4780 compiler warns that an unrecognized option is present.
4781
4782 The effectiveness of some warnings depends on optimizations also being
4783 enabled. For example -Wsuggest-final-types is more effective with link-
4784 time optimization and some instances of other warnings may not be
4785 issued at all unless optimization is enabled. While optimization in
4786 general improves the efficacy of control and data flow sensitive
4787 warnings, in some cases it may also cause false positives.
4788
4789 -Wpedantic
4790 -pedantic
4791 Issue all the warnings demanded by strict ISO C and ISO C++; reject
4792 all programs that use forbidden extensions, and some other programs
4793 that do not follow ISO C and ISO C++. For ISO C, follows the
4794 version of the ISO C standard specified by any -std option used.
4795
4796 Valid ISO C and ISO C++ programs should compile properly with or
4797 without this option (though a rare few require -ansi or a -std
4798 option specifying the required version of ISO C). However, without
4799 this option, certain GNU extensions and traditional C and C++
4800 features are supported as well. With this option, they are
4801 rejected.
4802
4803 -Wpedantic does not cause warning messages for use of the alternate
4804 keywords whose names begin and end with __. This alternate format
4805 can also be used to disable warnings for non-ISO __intN types, i.e.
4806 __intN__. Pedantic warnings are also disabled in the expression
4807 that follows "__extension__". However, only system header files
4808 should use these escape routes; application programs should avoid
4809 them.
4810
4811 Some users try to use -Wpedantic to check programs for strict ISO C
4812 conformance. They soon find that it does not do quite what they
4813 want: it finds some non-ISO practices, but not all---only those for
4814 which ISO C requires a diagnostic, and some others for which
4815 diagnostics have been added.
4816
4817 A feature to report any failure to conform to ISO C might be useful
4818 in some instances, but would require considerable additional work
4819 and would be quite different from -Wpedantic. We don't have plans
4820 to support such a feature in the near future.
4821
4822 Where the standard specified with -std represents a GNU extended
4823 dialect of C, such as gnu90 or gnu99, there is a corresponding base
4824 standard, the version of ISO C on which the GNU extended dialect is
4825 based. Warnings from -Wpedantic are given where they are required
4826 by the base standard. (It does not make sense for such warnings to
4827 be given only for features not in the specified GNU C dialect,
4828 since by definition the GNU dialects of C include all features the
4829 compiler supports with the given option, and there would be nothing
4830 to warn about.)
4831
4832 -pedantic-errors
4833 Give an error whenever the base standard (see -Wpedantic) requires
4834 a diagnostic, in some cases where there is undefined behavior at
4835 compile-time and in some other cases that do not prevent
4836 compilation of programs that are valid according to the standard.
4837 This is not equivalent to -Werror=pedantic, since there are errors
4838 enabled by this option and not enabled by the latter and vice
4839 versa.
4840
4841 -Wall
4842 This enables all the warnings about constructions that some users
4843 consider questionable, and that are easy to avoid (or modify to
4844 prevent the warning), even in conjunction with macros. This also
4845 enables some language-specific warnings described in C++ Dialect
4846 Options and Objective-C and Objective-C++ Dialect Options.
4847
4848 -Wall turns on the following warning flags:
4849
4850 -Waddress -Warray-bounds=1 (only with -O2) -Warray-compare
4851 -Warray-parameter=2 (C and Objective-C only) -Wbool-compare
4852 -Wbool-operation -Wc++11-compat -Wc++14-compat -Wcatch-value (C++
4853 and Objective-C++ only) -Wchar-subscripts -Wcomment
4854 -Wdangling-pointer=2 -Wduplicate-decl-specifier (C and Objective-C
4855 only) -Wenum-compare (in C/ObjC; this is on by default in C++)
4856 -Wenum-int-mismatch (C and Objective-C only) -Wformat
4857 -Wformat-overflow -Wformat-truncation -Wint-in-bool-context
4858 -Wimplicit (C and Objective-C only) -Wimplicit-int (C and
4859 Objective-C only) -Wimplicit-function-declaration (C and Objective-
4860 C only) -Winit-self (only for C++) -Wlogical-not-parentheses -Wmain
4861 (only for C/ObjC and unless -ffreestanding) -Wmaybe-uninitialized
4862 -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation
4863 (only for C/C++) -Wmismatched-dealloc -Wmismatched-new-delete (only
4864 for C/C++) -Wmissing-attributes -Wmissing-braces (only for C/ObjC)
4865 -Wmultistatement-macros -Wnarrowing (only for C++) -Wnonnull
4866 -Wnonnull-compare -Wopenmp-simd -Wparentheses -Wpessimizing-move
4867 (only for C++) -Wpointer-sign -Wrange-loop-construct (only for C++)
4868 -Wreorder -Wrestrict -Wreturn-type -Wself-move (only for C++)
4869 -Wsequence-point -Wsign-compare (only in C++) -Wsizeof-array-div
4870 -Wsizeof-pointer-div -Wsizeof-pointer-memaccess -Wstrict-aliasing
4871 -Wstrict-overflow=1 -Wswitch -Wtautological-compare -Wtrigraphs
4872 -Wuninitialized -Wunknown-pragmas -Wunused-function -Wunused-label
4873 -Wunused-value -Wunused-variable -Wuse-after-free=2 -Wvla-parameter
4874 (C and Objective-C only) -Wvolatile-register-var
4875 -Wzero-length-bounds
4876
4877 Note that some warning flags are not implied by -Wall. Some of
4878 them warn about constructions that users generally do not consider
4879 questionable, but which occasionally you might wish to check for;
4880 others warn about constructions that are necessary or hard to avoid
4881 in some cases, and there is no simple way to modify the code to
4882 suppress the warning. Some of them are enabled by -Wextra but many
4883 of them must be enabled individually.
4884
4885 -Wextra
4886 This enables some extra warning flags that are not enabled by
4887 -Wall. (This option used to be called -W. The older name is still
4888 supported, but the newer name is more descriptive.)
4889
4890 -Wclobbered -Wcast-function-type -Wdangling-reference (C++ only)
4891 -Wdeprecated-copy (C++ only) -Wempty-body -Wenum-conversion (C
4892 only) -Wignored-qualifiers -Wimplicit-fallthrough=3
4893 -Wmissing-field-initializers -Wmissing-parameter-type (C only)
4894 -Wold-style-declaration (C only) -Woverride-init -Wsign-compare (C
4895 only) -Wstring-compare -Wredundant-move (only for C++)
4896 -Wtype-limits -Wuninitialized -Wshift-negative-value (in C++11 to
4897 C++17 and in C99 and newer) -Wunused-parameter (only with -Wunused
4898 or -Wall) -Wunused-but-set-parameter (only with -Wunused or -Wall)
4899
4900 The option -Wextra also prints warning messages for the following
4901 cases:
4902
4903 * A pointer is compared against integer zero with "<", "<=", ">",
4904 or ">=".
4905
4906 * (C++ only) An enumerator and a non-enumerator both appear in a
4907 conditional expression.
4908
4909 * (C++ only) Ambiguous virtual bases.
4910
4911 * (C++ only) Subscripting an array that has been declared
4912 "register".
4913
4914 * (C++ only) Taking the address of a variable that has been
4915 declared "register".
4916
4917 * (C++ only) A base class is not initialized in the copy
4918 constructor of a derived class.
4919
4920 -Wabi (C, Objective-C, C++ and Objective-C++ only)
4921 Warn about code affected by ABI changes. This includes code that
4922 may not be compatible with the vendor-neutral C++ ABI as well as
4923 the psABI for the particular target.
4924
4925 Since G++ now defaults to updating the ABI with each major release,
4926 normally -Wabi warns only about C++ ABI compatibility problems if
4927 there is a check added later in a release series for an ABI issue
4928 discovered since the initial release. -Wabi warns about more
4929 things if an older ABI version is selected (with -fabi-version=n).
4930
4931 -Wabi can also be used with an explicit version number to warn
4932 about C++ ABI compatibility with a particular -fabi-version level,
4933 e.g. -Wabi=2 to warn about changes relative to -fabi-version=2.
4934
4935 If an explicit version number is provided and -fabi-compat-version
4936 is not specified, the version number from this option is used for
4937 compatibility aliases. If no explicit version number is provided
4938 with this option, but -fabi-compat-version is specified, that
4939 version number is used for C++ ABI warnings.
4940
4941 Although an effort has been made to warn about all such cases,
4942 there are probably some cases that are not warned about, even
4943 though G++ is generating incompatible code. There may also be
4944 cases where warnings are emitted even though the code that is
4945 generated is compatible.
4946
4947 You should rewrite your code to avoid these warnings if you are
4948 concerned about the fact that code generated by G++ may not be
4949 binary compatible with code generated by other compilers.
4950
4951 Known incompatibilities in -fabi-version=2 (which was the default
4952 from GCC 3.4 to 4.9) include:
4953
4954 * A template with a non-type template parameter of reference type
4955 was mangled incorrectly:
4956
4957 extern int N;
4958 template <int &> struct S {};
4959 void n (S<N>) {2}
4960
4961 This was fixed in -fabi-version=3.
4962
4963 * SIMD vector types declared using "__attribute ((vector_size))"
4964 were mangled in a non-standard way that does not allow for
4965 overloading of functions taking vectors of different sizes.
4966
4967 The mangling was changed in -fabi-version=4.
4968
4969 * "__attribute ((const))" and "noreturn" were mangled as type
4970 qualifiers, and "decltype" of a plain declaration was folded
4971 away.
4972
4973 These mangling issues were fixed in -fabi-version=5.
4974
4975 * Scoped enumerators passed as arguments to a variadic function
4976 are promoted like unscoped enumerators, causing "va_arg" to
4977 complain. On most targets this does not actually affect the
4978 parameter passing ABI, as there is no way to pass an argument
4979 smaller than "int".
4980
4981 Also, the ABI changed the mangling of template argument packs,
4982 "const_cast", "static_cast", prefix increment/decrement, and a
4983 class scope function used as a template argument.
4984
4985 These issues were corrected in -fabi-version=6.
4986
4987 * Lambdas in default argument scope were mangled incorrectly, and
4988 the ABI changed the mangling of "nullptr_t".
4989
4990 These issues were corrected in -fabi-version=7.
4991
4992 * When mangling a function type with function-cv-qualifiers, the
4993 un-qualified function type was incorrectly treated as a
4994 substitution candidate.
4995
4996 This was fixed in -fabi-version=8, the default for GCC 5.1.
4997
4998 * decltype(nullptr) incorrectly had an alignment of 1, leading to
4999 unaligned accesses. Note that this did not affect the ABI of a
5000 function with a "nullptr_t" parameter, as parameters have a
5001 minimum alignment.
5002
5003 This was fixed in -fabi-version=9, the default for GCC 5.2.
5004
5005 * Target-specific attributes that affect the identity of a type,
5006 such as ia32 calling conventions on a function type (stdcall,
5007 regparm, etc.), did not affect the mangled name, leading to
5008 name collisions when function pointers were used as template
5009 arguments.
5010
5011 This was fixed in -fabi-version=10, the default for GCC 6.1.
5012
5013 This option also enables warnings about psABI-related changes. The
5014 known psABI changes at this point include:
5015
5016 * For SysV/x86-64, unions with "long double" members are passed
5017 in memory as specified in psABI. Prior to GCC 4.4, this was
5018 not the case. For example:
5019
5020 union U {
5021 long double ld;
5022 int i;
5023 };
5024
5025 "union U" is now always passed in memory.
5026
5027 -Wno-changes-meaning (C++ and Objective-C++ only)
5028 C++ requires that unqualified uses of a name within a class have
5029 the same meaning in the complete scope of the class, so declaring
5030 the name after using it is ill-formed:
5031
5032 struct A;
5033 struct B1 { A a; typedef A A; }; // warning, 'A' changes meaning
5034 struct B2 { A a; struct A { }; }; // error, 'A' changes meaning
5035
5036 By default, the B1 case is only a warning because the two
5037 declarations have the same type, while the B2 case is an error.
5038 Both diagnostics can be disabled with -Wno-changes-meaning.
5039 Alternately, the error case can be reduced to a warning with
5040 -Wno-error=changes-meaning or -fpermissive.
5041
5042 Both diagnostics are also suppressed by -fms-extensions.
5043
5044 -Wchar-subscripts
5045 Warn if an array subscript has type "char". This is a common cause
5046 of error, as programmers often forget that this type is signed on
5047 some machines. This warning is enabled by -Wall.
5048
5049 -Wno-coverage-mismatch
5050 Warn if feedback profiles do not match when using the -fprofile-use
5051 option. If a source file is changed between compiling with
5052 -fprofile-generate and with -fprofile-use, the files with the
5053 profile feedback can fail to match the source file and GCC cannot
5054 use the profile feedback information. By default, this warning is
5055 enabled and is treated as an error. -Wno-coverage-mismatch can be
5056 used to disable the warning or -Wno-error=coverage-mismatch can be
5057 used to disable the error. Disabling the error for this warning
5058 can result in poorly optimized code and is useful only in the case
5059 of very minor changes such as bug fixes to an existing code-base.
5060 Completely disabling the warning is not recommended.
5061
5062 -Wno-coverage-invalid-line-number
5063 Warn in case a function ends earlier than it begins due to an
5064 invalid linenum macros. The warning is emitted only with
5065 --coverage enabled.
5066
5067 By default, this warning is enabled and is treated as an error.
5068 -Wno-coverage-invalid-line-number can be used to disable the
5069 warning or -Wno-error=coverage-invalid-line-number can be used to
5070 disable the error.
5071
5072 -Wno-cpp (C, Objective-C, C++, Objective-C++ and Fortran only)
5073 Suppress warning messages emitted by "#warning" directives.
5074
5075 -Wdouble-promotion (C, C++, Objective-C and Objective-C++ only)
5076 Give a warning when a value of type "float" is implicitly promoted
5077 to "double". CPUs with a 32-bit "single-precision" floating-point
5078 unit implement "float" in hardware, but emulate "double" in
5079 software. On such a machine, doing computations using "double"
5080 values is much more expensive because of the overhead required for
5081 software emulation.
5082
5083 It is easy to accidentally do computations with "double" because
5084 floating-point literals are implicitly of type "double". For
5085 example, in:
5086
5087 float area(float radius)
5088 {
5089 return 3.14159 * radius * radius;
5090 }
5091
5092 the compiler performs the entire computation with "double" because
5093 the floating-point literal is a "double".
5094
5095 -Wduplicate-decl-specifier (C and Objective-C only)
5096 Warn if a declaration has duplicate "const", "volatile", "restrict"
5097 or "_Atomic" specifier. This warning is enabled by -Wall.
5098
5099 -Wformat
5100 -Wformat=n
5101 Check calls to "printf" and "scanf", etc., to make sure that the
5102 arguments supplied have types appropriate to the format string
5103 specified, and that the conversions specified in the format string
5104 make sense. This includes standard functions, and others specified
5105 by format attributes, in the "printf", "scanf", "strftime" and
5106 "strfmon" (an X/Open extension, not in the C standard) families (or
5107 other target-specific families). Which functions are checked
5108 without format attributes having been specified depends on the
5109 standard version selected, and such checks of functions without the
5110 attribute specified are disabled by -ffreestanding or -fno-builtin.
5111
5112 The formats are checked against the format features supported by
5113 GNU libc version 2.2. These include all ISO C90 and C99 features,
5114 as well as features from the Single Unix Specification and some BSD
5115 and GNU extensions. Other library implementations may not support
5116 all these features; GCC does not support warning about features
5117 that go beyond a particular library's limitations. However, if
5118 -Wpedantic is used with -Wformat, warnings are given about format
5119 features not in the selected standard version (but not for
5120 "strfmon" formats, since those are not in any version of the C
5121 standard).
5122
5123 -Wformat=1
5124 -Wformat
5125 Option -Wformat is equivalent to -Wformat=1, and -Wno-format is
5126 equivalent to -Wformat=0. Since -Wformat also checks for null
5127 format arguments for several functions, -Wformat also implies
5128 -Wnonnull. Some aspects of this level of format checking can
5129 be disabled by the options: -Wno-format-contains-nul,
5130 -Wno-format-extra-args, and -Wno-format-zero-length. -Wformat
5131 is enabled by -Wall.
5132
5133 -Wformat=2
5134 Enable -Wformat plus additional format checks. Currently
5135 equivalent to -Wformat -Wformat-nonliteral -Wformat-security
5136 -Wformat-y2k.
5137
5138 -Wno-format-contains-nul
5139 If -Wformat is specified, do not warn about format strings that
5140 contain NUL bytes.
5141
5142 -Wno-format-extra-args
5143 If -Wformat is specified, do not warn about excess arguments to a
5144 "printf" or "scanf" format function. The C standard specifies that
5145 such arguments are ignored.
5146
5147 Where the unused arguments lie between used arguments that are
5148 specified with $ operand number specifications, normally warnings
5149 are still given, since the implementation could not know what type
5150 to pass to "va_arg" to skip the unused arguments. However, in the
5151 case of "scanf" formats, this option suppresses the warning if the
5152 unused arguments are all pointers, since the Single Unix
5153 Specification says that such unused arguments are allowed.
5154
5155 -Wformat-overflow
5156 -Wformat-overflow=level
5157 Warn about calls to formatted input/output functions such as
5158 "sprintf" and "vsprintf" that might overflow the destination
5159 buffer. When the exact number of bytes written by a format
5160 directive cannot be determined at compile-time it is estimated
5161 based on heuristics that depend on the level argument and on
5162 optimization. While enabling optimization will in most cases
5163 improve the accuracy of the warning, it may also result in false
5164 positives.
5165
5166 -Wformat-overflow
5167 -Wformat-overflow=1
5168 Level 1 of -Wformat-overflow enabled by -Wformat employs a
5169 conservative approach that warns only about calls that most
5170 likely overflow the buffer. At this level, numeric arguments
5171 to format directives with unknown values are assumed to have
5172 the value of one, and strings of unknown length to be empty.
5173 Numeric arguments that are known to be bounded to a subrange of
5174 their type, or string arguments whose output is bounded either
5175 by their directive's precision or by a finite set of string
5176 literals, are assumed to take on the value within the range
5177 that results in the most bytes on output. For example, the
5178 call to "sprintf" below is diagnosed because even with both a
5179 and b equal to zero, the terminating NUL character ('\0')
5180 appended by the function to the destination buffer will be
5181 written past its end. Increasing the size of the buffer by a
5182 single byte is sufficient to avoid the warning, though it may
5183 not be sufficient to avoid the overflow.
5184
5185 void f (int a, int b)
5186 {
5187 char buf [13];
5188 sprintf (buf, "a = %i, b = %i\n", a, b);
5189 }
5190
5191 -Wformat-overflow=2
5192 Level 2 warns also about calls that might overflow the
5193 destination buffer given an argument of sufficient length or
5194 magnitude. At level 2, unknown numeric arguments are assumed
5195 to have the minimum representable value for signed types with a
5196 precision greater than 1, and the maximum representable value
5197 otherwise. Unknown string arguments whose length cannot be
5198 assumed to be bounded either by the directive's precision, or
5199 by a finite set of string literals they may evaluate to, or the
5200 character array they may point to, are assumed to be 1
5201 character long.
5202
5203 At level 2, the call in the example above is again diagnosed,
5204 but this time because with a equal to a 32-bit "INT_MIN" the
5205 first %i directive will write some of its digits beyond the end
5206 of the destination buffer. To make the call safe regardless of
5207 the values of the two variables, the size of the destination
5208 buffer must be increased to at least 34 bytes. GCC includes
5209 the minimum size of the buffer in an informational note
5210 following the warning.
5211
5212 An alternative to increasing the size of the destination buffer
5213 is to constrain the range of formatted values. The maximum
5214 length of string arguments can be bounded by specifying the
5215 precision in the format directive. When numeric arguments of
5216 format directives can be assumed to be bounded by less than the
5217 precision of their type, choosing an appropriate length
5218 modifier to the format specifier will reduce the required
5219 buffer size. For example, if a and b in the example above can
5220 be assumed to be within the precision of the "short int" type
5221 then using either the %hi format directive or casting the
5222 argument to "short" reduces the maximum required size of the
5223 buffer to 24 bytes.
5224
5225 void f (int a, int b)
5226 {
5227 char buf [23];
5228 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
5229 }
5230
5231 -Wno-format-zero-length
5232 If -Wformat is specified, do not warn about zero-length formats.
5233 The C standard specifies that zero-length formats are allowed.
5234
5235 -Wformat-nonliteral
5236 If -Wformat is specified, also warn if the format string is not a
5237 string literal and so cannot be checked, unless the format function
5238 takes its format arguments as a "va_list".
5239
5240 -Wformat-security
5241 If -Wformat is specified, also warn about uses of format functions
5242 that represent possible security problems. At present, this warns
5243 about calls to "printf" and "scanf" functions where the format
5244 string is not a string literal and there are no format arguments,
5245 as in "printf (foo);". This may be a security hole if the format
5246 string came from untrusted input and contains %n. (This is
5247 currently a subset of what -Wformat-nonliteral warns about, but in
5248 future warnings may be added to -Wformat-security that are not
5249 included in -Wformat-nonliteral.)
5250
5251 -Wformat-signedness
5252 If -Wformat is specified, also warn if the format string requires
5253 an unsigned argument and the argument is signed and vice versa.
5254
5255 -Wformat-truncation
5256 -Wformat-truncation=level
5257 Warn about calls to formatted input/output functions such as
5258 "snprintf" and "vsnprintf" that might result in output truncation.
5259 When the exact number of bytes written by a format directive cannot
5260 be determined at compile-time it is estimated based on heuristics
5261 that depend on the level argument and on optimization. While
5262 enabling optimization will in most cases improve the accuracy of
5263 the warning, it may also result in false positives. Except as
5264 noted otherwise, the option uses the same logic -Wformat-overflow.
5265
5266 -Wformat-truncation
5267 -Wformat-truncation=1
5268 Level 1 of -Wformat-truncation enabled by -Wformat employs a
5269 conservative approach that warns only about calls to bounded
5270 functions whose return value is unused and that will most
5271 likely result in output truncation.
5272
5273 -Wformat-truncation=2
5274 Level 2 warns also about calls to bounded functions whose
5275 return value is used and that might result in truncation given
5276 an argument of sufficient length or magnitude.
5277
5278 -Wformat-y2k
5279 If -Wformat is specified, also warn about "strftime" formats that
5280 may yield only a two-digit year.
5281
5282 -Wnonnull
5283 Warn about passing a null pointer for arguments marked as requiring
5284 a non-null value by the "nonnull" function attribute.
5285
5286 -Wnonnull is included in -Wall and -Wformat. It can be disabled
5287 with the -Wno-nonnull option.
5288
5289 -Wnonnull-compare
5290 Warn when comparing an argument marked with the "nonnull" function
5291 attribute against null inside the function.
5292
5293 -Wnonnull-compare is included in -Wall. It can be disabled with
5294 the -Wno-nonnull-compare option.
5295
5296 -Wnull-dereference
5297 Warn if the compiler detects paths that trigger erroneous or
5298 undefined behavior due to dereferencing a null pointer. This
5299 option is only active when -fdelete-null-pointer-checks is active,
5300 which is enabled by optimizations in most targets. The precision
5301 of the warnings depends on the optimization options used.
5302
5303 -Winfinite-recursion
5304 Warn about infinitely recursive calls. The warning is effective at
5305 all optimization levels but requires optimization in order to
5306 detect infinite recursion in calls between two or more functions.
5307 -Winfinite-recursion is included in -Wall.
5308
5309 Compare with -Wanalyzer-infinite-recursion which provides a similar
5310 diagnostic, but is implemented in a different way (as part of
5311 -fanalyzer).
5312
5313 -Winit-self (C, C++, Objective-C and Objective-C++ only)
5314 Warn about uninitialized variables that are initialized with
5315 themselves. Note this option can only be used with the
5316 -Wuninitialized option.
5317
5318 For example, GCC warns about "i" being uninitialized in the
5319 following snippet only when -Winit-self has been specified:
5320
5321 int f()
5322 {
5323 int i = i;
5324 return i;
5325 }
5326
5327 This warning is enabled by -Wall in C++.
5328
5329 -Wno-implicit-int (C and Objective-C only)
5330 This option controls warnings when a declaration does not specify a
5331 type. This warning is enabled by default in C99 and later dialects
5332 of C, and also by -Wall.
5333
5334 -Wno-implicit-function-declaration (C and Objective-C only)
5335 This option controls warnings when a function is used before being
5336 declared. This warning is enabled by default in C99 and later
5337 dialects of C, and also by -Wall. The warning is made into an
5338 error by -pedantic-errors.
5339
5340 -Wimplicit (C and Objective-C only)
5341 Same as -Wimplicit-int and -Wimplicit-function-declaration. This
5342 warning is enabled by -Wall.
5343
5344 -Wimplicit-fallthrough
5345 -Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3 and
5346 -Wno-implicit-fallthrough is the same as -Wimplicit-fallthrough=0.
5347
5348 -Wimplicit-fallthrough=n
5349 Warn when a switch case falls through. For example:
5350
5351 switch (cond)
5352 {
5353 case 1:
5354 a = 1;
5355 break;
5356 case 2:
5357 a = 2;
5358 case 3:
5359 a = 3;
5360 break;
5361 }
5362
5363 This warning does not warn when the last statement of a case cannot
5364 fall through, e.g. when there is a return statement or a call to
5365 function declared with the noreturn attribute.
5366 -Wimplicit-fallthrough= also takes into account control flow
5367 statements, such as ifs, and only warns when appropriate. E.g.
5368
5369 switch (cond)
5370 {
5371 case 1:
5372 if (i > 3) {
5373 bar (5);
5374 break;
5375 } else if (i < 1) {
5376 bar (0);
5377 } else
5378 return;
5379 default:
5380 ...
5381 }
5382
5383 Since there are occasions where a switch case fall through is
5384 desirable, GCC provides an attribute, "__attribute__
5385 ((fallthrough))", that is to be used along with a null statement to
5386 suppress this warning that would normally occur:
5387
5388 switch (cond)
5389 {
5390 case 1:
5391 bar (0);
5392 __attribute__ ((fallthrough));
5393 default:
5394 ...
5395 }
5396
5397 C++17 provides a standard way to suppress the
5398 -Wimplicit-fallthrough warning using "[[fallthrough]];" instead of
5399 the GNU attribute. In C++11 or C++14 users can use
5400 "[[gnu::fallthrough]];", which is a GNU extension. Instead of
5401 these attributes, it is also possible to add a fallthrough comment
5402 to silence the warning. The whole body of the C or C++ style
5403 comment should match the given regular expressions listed below.
5404 The option argument n specifies what kind of comments are accepted:
5405
5406 *<-Wimplicit-fallthrough=0 disables the warning altogether.>
5407 *<-Wimplicit-fallthrough=1 matches ".*" regular>
5408 expression, any comment is used as fallthrough comment.
5409
5410 *<-Wimplicit-fallthrough=2 case insensitively matches>
5411 ".*falls?[ \t-]*thr(ough|u).*" regular expression.
5412
5413 *<-Wimplicit-fallthrough=3 case sensitively matches one of the>
5414 following regular expressions:
5415
5416 *<"-fallthrough">
5417 *<"@fallthrough@">
5418 *<"lint -fallthrough[ \t]*">
5419 *<"[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?FALL(S |
5420 |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?">
5421 *<"[ \t.!]*(Else,? |Intentional(ly)? )?Fall((s |
5422 |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?">
5423 *<"[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?fall(s |
5424 |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?">
5425 *<-Wimplicit-fallthrough=4 case sensitively matches one of the>
5426 following regular expressions:
5427
5428 *<"-fallthrough">
5429 *<"@fallthrough@">
5430 *<"lint -fallthrough[ \t]*">
5431 *<"[ \t]*FALLTHR(OUGH|U)[ \t]*">
5432 *<-Wimplicit-fallthrough=5 doesn't recognize any comments as>
5433 fallthrough comments, only attributes disable the warning.
5434
5435 The comment needs to be followed after optional whitespace and
5436 other comments by "case" or "default" keywords or by a user label
5437 that precedes some "case" or "default" label.
5438
5439 switch (cond)
5440 {
5441 case 1:
5442 bar (0);
5443 /* FALLTHRU */
5444 default:
5445 ...
5446 }
5447
5448 The -Wimplicit-fallthrough=3 warning is enabled by -Wextra.
5449
5450 -Wno-if-not-aligned (C, C++, Objective-C and Objective-C++ only)
5451 Control if warnings triggered by the "warn_if_not_aligned"
5452 attribute should be issued. These warnings are enabled by default.
5453
5454 -Wignored-qualifiers (C and C++ only)
5455 Warn if the return type of a function has a type qualifier such as
5456 "const". For ISO C such a type qualifier has no effect, since the
5457 value returned by a function is not an lvalue. For C++, the
5458 warning is only emitted for scalar types or "void". ISO C
5459 prohibits qualified "void" return types on function definitions, so
5460 such return types always receive a warning even without this
5461 option.
5462
5463 This warning is also enabled by -Wextra.
5464
5465 -Wno-ignored-attributes (C and C++ only)
5466 This option controls warnings when an attribute is ignored. This
5467 is different from the -Wattributes option in that it warns whenever
5468 the compiler decides to drop an attribute, not that the attribute
5469 is either unknown, used in a wrong place, etc. This warning is
5470 enabled by default.
5471
5472 -Wmain
5473 Warn if the type of "main" is suspicious. "main" should be a
5474 function with external linkage, returning int, taking either zero
5475 arguments, two, or three arguments of appropriate types. This
5476 warning is enabled by default in C++ and is enabled by either -Wall
5477 or -Wpedantic.
5478
5479 -Wmisleading-indentation (C and C++ only)
5480 Warn when the indentation of the code does not reflect the block
5481 structure. Specifically, a warning is issued for "if", "else",
5482 "while", and "for" clauses with a guarded statement that does not
5483 use braces, followed by an unguarded statement with the same
5484 indentation.
5485
5486 In the following example, the call to "bar" is misleadingly
5487 indented as if it were guarded by the "if" conditional.
5488
5489 if (some_condition ())
5490 foo ();
5491 bar (); /* Gotcha: this is not guarded by the "if". */
5492
5493 In the case of mixed tabs and spaces, the warning uses the
5494 -ftabstop= option to determine if the statements line up
5495 (defaulting to 8).
5496
5497 The warning is not issued for code involving multiline preprocessor
5498 logic such as the following example.
5499
5500 if (flagA)
5501 foo (0);
5502 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5503 if (flagB)
5504 #endif
5505 foo (1);
5506
5507 The warning is not issued after a "#line" directive, since this
5508 typically indicates autogenerated code, and no assumptions can be
5509 made about the layout of the file that the directive references.
5510
5511 This warning is enabled by -Wall in C and C++.
5512
5513 -Wmissing-attributes
5514 Warn when a declaration of a function is missing one or more
5515 attributes that a related function is declared with and whose
5516 absence may adversely affect the correctness or efficiency of
5517 generated code. For example, the warning is issued for
5518 declarations of aliases that use attributes to specify less
5519 restrictive requirements than those of their targets. This
5520 typically represents a potential optimization opportunity. By
5521 contrast, the -Wattribute-alias=2 option controls warnings issued
5522 when the alias is more restrictive than the target, which could
5523 lead to incorrect code generation. Attributes considered include
5524 "alloc_align", "alloc_size", "cold", "const", "hot", "leaf",
5525 "malloc", "nonnull", "noreturn", "nothrow", "pure",
5526 "returns_nonnull", and "returns_twice".
5527
5528 In C++, the warning is issued when an explicit specialization of a
5529 primary template declared with attribute "alloc_align",
5530 "alloc_size", "assume_aligned", "format", "format_arg", "malloc",
5531 or "nonnull" is declared without it. Attributes "deprecated",
5532 "error", and "warning" suppress the warning..
5533
5534 You can use the "copy" attribute to apply the same set of
5535 attributes to a declaration as that on another declaration without
5536 explicitly enumerating the attributes. This attribute can be
5537 applied to declarations of functions, variables, or types.
5538
5539 -Wmissing-attributes is enabled by -Wall.
5540
5541 For example, since the declaration of the primary function template
5542 below makes use of both attribute "malloc" and "alloc_size" the
5543 declaration of the explicit specialization of the template is
5544 diagnosed because it is missing one of the attributes.
5545
5546 template <class T>
5547 T* __attribute__ ((malloc, alloc_size (1)))
5548 allocate (size_t);
5549
5550 template <>
5551 void* __attribute__ ((malloc)) // missing alloc_size
5552 allocate<void> (size_t);
5553
5554 -Wmissing-braces
5555 Warn if an aggregate or union initializer is not fully bracketed.
5556 In the following example, the initializer for "a" is not fully
5557 bracketed, but that for "b" is fully bracketed.
5558
5559 int a[2][2] = { 0, 1, 2, 3 };
5560 int b[2][2] = { { 0, 1 }, { 2, 3 } };
5561
5562 This warning is enabled by -Wall.
5563
5564 -Wmissing-include-dirs (C, C++, Objective-C, Objective-C++ and Fortran
5565 only)
5566 Warn if a user-supplied include directory does not exist. This
5567 option is disabled by default for C, C++, Objective-C and
5568 Objective-C++. For Fortran, it is partially enabled by default by
5569 warning for -I and -J, only.
5570
5571 -Wno-missing-profile
5572 This option controls warnings if feedback profiles are missing when
5573 using the -fprofile-use option. This option diagnoses those cases
5574 where a new function or a new file is added between compiling with
5575 -fprofile-generate and with -fprofile-use, without regenerating the
5576 profiles. In these cases, the profile feedback data files do not
5577 contain any profile feedback information for the newly added
5578 function or file respectively. Also, in the case when profile
5579 count data (.gcda) files are removed, GCC cannot use any profile
5580 feedback information. In all these cases, warnings are issued to
5581 inform you that a profile generation step is due. Ignoring the
5582 warning can result in poorly optimized code. -Wno-missing-profile
5583 can be used to disable the warning, but this is not recommended and
5584 should be done only when non-existent profile data is justified.
5585
5586 -Wmismatched-dealloc
5587 Warn for calls to deallocation functions with pointer arguments
5588 returned from from allocations functions for which the former isn't
5589 a suitable deallocator. A pair of functions can be associated as
5590 matching allocators and deallocators by use of attribute "malloc".
5591 Unless disabled by the -fno-builtin option the standard functions
5592 "calloc", "malloc", "realloc", and "free", as well as the
5593 corresponding forms of C++ "operator new" and "operator delete" are
5594 implicitly associated as matching allocators and deallocators. In
5595 the following example "mydealloc" is the deallocator for pointers
5596 returned from "myalloc".
5597
5598 void mydealloc (void*);
5599
5600 __attribute__ ((malloc (mydealloc, 1))) void*
5601 myalloc (size_t);
5602
5603 void f (void)
5604 {
5605 void *p = myalloc (32);
5606 // ...use p...
5607 free (p); // warning: not a matching deallocator for myalloc
5608 mydealloc (p); // ok
5609 }
5610
5611 In C++, the related option -Wmismatched-new-delete diagnoses
5612 mismatches involving either "operator new" or "operator delete".
5613
5614 Option -Wmismatched-dealloc is included in -Wall.
5615
5616 -Wmultistatement-macros
5617 Warn about unsafe multiple statement macros that appear to be
5618 guarded by a clause such as "if", "else", "for", "switch", or
5619 "while", in which only the first statement is actually guarded
5620 after the macro is expanded.
5621
5622 For example:
5623
5624 #define DOIT x++; y++
5625 if (c)
5626 DOIT;
5627
5628 will increment "y" unconditionally, not just when "c" holds. The
5629 can usually be fixed by wrapping the macro in a do-while loop:
5630
5631 #define DOIT do { x++; y++; } while (0)
5632 if (c)
5633 DOIT;
5634
5635 This warning is enabled by -Wall in C and C++.
5636
5637 -Wparentheses
5638 Warn if parentheses are omitted in certain contexts, such as when
5639 there is an assignment in a context where a truth value is
5640 expected, or when operators are nested whose precedence people
5641 often get confused about.
5642
5643 Also warn if a comparison like "x<=y<=z" appears; this is
5644 equivalent to "(x<=y ? 1 : 0) <= z", which is a different
5645 interpretation from that of ordinary mathematical notation.
5646
5647 Also warn for dangerous uses of the GNU extension to "?:" with
5648 omitted middle operand. When the condition in the "?": operator is
5649 a boolean expression, the omitted value is always 1. Often
5650 programmers expect it to be a value computed inside the conditional
5651 expression instead.
5652
5653 For C++ this also warns for some cases of unnecessary parentheses
5654 in declarations, which can indicate an attempt at a function call
5655 instead of a declaration:
5656
5657 {
5658 // Declares a local variable called mymutex.
5659 std::unique_lock<std::mutex> (mymutex);
5660 // User meant std::unique_lock<std::mutex> lock (mymutex);
5661 }
5662
5663 This warning is enabled by -Wall.
5664
5665 -Wno-self-move (C++ and Objective-C++ only)
5666 This warning warns when a value is moved to itself with
5667 "std::move". Such a "std::move" typically has no effect.
5668
5669 struct T {
5670 ...
5671 };
5672 void fn()
5673 {
5674 T t;
5675 ...
5676 t = std::move (t);
5677 }
5678
5679 This warning is enabled by -Wall.
5680
5681 -Wsequence-point
5682 Warn about code that may have undefined semantics because of
5683 violations of sequence point rules in the C and C++ standards.
5684
5685 The C and C++ standards define the order in which expressions in a
5686 C/C++ program are evaluated in terms of sequence points, which
5687 represent a partial ordering between the execution of parts of the
5688 program: those executed before the sequence point, and those
5689 executed after it. These occur after the evaluation of a full
5690 expression (one which is not part of a larger expression), after
5691 the evaluation of the first operand of a "&&", "||", "? :" or ","
5692 (comma) operator, before a function is called (but after the
5693 evaluation of its arguments and the expression denoting the called
5694 function), and in certain other places. Other than as expressed by
5695 the sequence point rules, the order of evaluation of subexpressions
5696 of an expression is not specified. All these rules describe only a
5697 partial order rather than a total order, since, for example, if two
5698 functions are called within one expression with no sequence point
5699 between them, the order in which the functions are called is not
5700 specified. However, the standards committee have ruled that
5701 function calls do not overlap.
5702
5703 It is not specified when between sequence points modifications to
5704 the values of objects take effect. Programs whose behavior depends
5705 on this have undefined behavior; the C and C++ standards specify
5706 that "Between the previous and next sequence point an object shall
5707 have its stored value modified at most once by the evaluation of an
5708 expression. Furthermore, the prior value shall be read only to
5709 determine the value to be stored.". If a program breaks these
5710 rules, the results on any particular implementation are entirely
5711 unpredictable.
5712
5713 Examples of code with undefined behavior are "a = a++;", "a[n] =
5714 b[n++]" and "a[i++] = i;". Some more complicated cases are not
5715 diagnosed by this option, and it may give an occasional false
5716 positive result, but in general it has been found fairly effective
5717 at detecting this sort of problem in programs.
5718
5719 The C++17 standard will define the order of evaluation of operands
5720 in more cases: in particular it requires that the right-hand side
5721 of an assignment be evaluated before the left-hand side, so the
5722 above examples are no longer undefined. But this option will still
5723 warn about them, to help people avoid writing code that is
5724 undefined in C and earlier revisions of C++.
5725
5726 The standard is worded confusingly, therefore there is some debate
5727 over the precise meaning of the sequence point rules in subtle
5728 cases. Links to discussions of the problem, including proposed
5729 formal definitions, may be found on the GCC readings page, at
5730 <https://gcc.gnu.org/readings.html>.
5731
5732 This warning is enabled by -Wall for C and C++.
5733
5734 -Wno-return-local-addr
5735 Do not warn about returning a pointer (or in C++, a reference) to a
5736 variable that goes out of scope after the function returns.
5737
5738 -Wreturn-type
5739 Warn whenever a function is defined with a return type that
5740 defaults to "int". Also warn about any "return" statement with no
5741 return value in a function whose return type is not "void" (falling
5742 off the end of the function body is considered returning without a
5743 value).
5744
5745 For C only, warn about a "return" statement with an expression in a
5746 function whose return type is "void", unless the expression type is
5747 also "void". As a GNU extension, the latter case is accepted
5748 without a warning unless -Wpedantic is used. Attempting to use the
5749 return value of a non-"void" function other than "main" that flows
5750 off the end by reaching the closing curly brace that terminates the
5751 function is undefined.
5752
5753 Unlike in C, in C++, flowing off the end of a non-"void" function
5754 other than "main" results in undefined behavior even when the value
5755 of the function is not used.
5756
5757 This warning is enabled by default in C++ and by -Wall otherwise.
5758
5759 -Wno-shift-count-negative
5760 Controls warnings if a shift count is negative. This warning is
5761 enabled by default.
5762
5763 -Wno-shift-count-overflow
5764 Controls warnings if a shift count is greater than or equal to the
5765 bit width of the type. This warning is enabled by default.
5766
5767 -Wshift-negative-value
5768 Warn if left shifting a negative value. This warning is enabled by
5769 -Wextra in C99 (and newer) and C++11 to C++17 modes.
5770
5771 -Wno-shift-overflow
5772 -Wshift-overflow=n
5773 These options control warnings about left shift overflows.
5774
5775 -Wshift-overflow=1
5776 This is the warning level of -Wshift-overflow and is enabled by
5777 default in C99 and C++11 modes (and newer). This warning level
5778 does not warn about left-shifting 1 into the sign bit.
5779 (However, in C, such an overflow is still rejected in contexts
5780 where an integer constant expression is required.) No warning
5781 is emitted in C++20 mode (and newer), as signed left shifts
5782 always wrap.
5783
5784 -Wshift-overflow=2
5785 This warning level also warns about left-shifting 1 into the
5786 sign bit, unless C++14 mode (or newer) is active.
5787
5788 -Wswitch
5789 Warn whenever a "switch" statement has an index of enumerated type
5790 and lacks a "case" for one or more of the named codes of that
5791 enumeration. (The presence of a "default" label prevents this
5792 warning.) "case" labels outside the enumeration range also provoke
5793 warnings when this option is used (even if there is a "default"
5794 label). This warning is enabled by -Wall.
5795
5796 -Wswitch-default
5797 Warn whenever a "switch" statement does not have a "default" case.
5798
5799 -Wswitch-enum
5800 Warn whenever a "switch" statement has an index of enumerated type
5801 and lacks a "case" for one or more of the named codes of that
5802 enumeration. "case" labels outside the enumeration range also
5803 provoke warnings when this option is used. The only difference
5804 between -Wswitch and this option is that this option gives a
5805 warning about an omitted enumeration code even if there is a
5806 "default" label.
5807
5808 -Wno-switch-bool
5809 Do not warn when a "switch" statement has an index of boolean type
5810 and the case values are outside the range of a boolean type. It is
5811 possible to suppress this warning by casting the controlling
5812 expression to a type other than "bool". For example:
5813
5814 switch ((int) (a == 4))
5815 {
5816 ...
5817 }
5818
5819 This warning is enabled by default for C and C++ programs.
5820
5821 -Wno-switch-outside-range
5822 This option controls warnings when a "switch" case has a value that
5823 is outside of its respective type range. This warning is enabled
5824 by default for C and C++ programs.
5825
5826 -Wno-switch-unreachable
5827 Do not warn when a "switch" statement contains statements between
5828 the controlling expression and the first case label, which will
5829 never be executed. For example:
5830
5831 switch (cond)
5832 {
5833 i = 15;
5834 ...
5835 case 5:
5836 ...
5837 }
5838
5839 -Wswitch-unreachable does not warn if the statement between the
5840 controlling expression and the first case label is just a
5841 declaration:
5842
5843 switch (cond)
5844 {
5845 int i;
5846 ...
5847 case 5:
5848 i = 5;
5849 ...
5850 }
5851
5852 This warning is enabled by default for C and C++ programs.
5853
5854 -Wsync-nand (C and C++ only)
5855 Warn when "__sync_fetch_and_nand" and "__sync_nand_and_fetch"
5856 built-in functions are used. These functions changed semantics in
5857 GCC 4.4.
5858
5859 -Wtrivial-auto-var-init
5860 Warn when "-ftrivial-auto-var-init" cannot initialize the automatic
5861 variable. A common situation is an automatic variable that is
5862 declared between the controlling expression and the first case
5863 label of a "switch" statement.
5864
5865 -Wunused-but-set-parameter
5866 Warn whenever a function parameter is assigned to, but otherwise
5867 unused (aside from its declaration).
5868
5869 To suppress this warning use the "unused" attribute.
5870
5871 This warning is also enabled by -Wunused together with -Wextra.
5872
5873 -Wunused-but-set-variable
5874 Warn whenever a local variable is assigned to, but otherwise unused
5875 (aside from its declaration). This warning is enabled by -Wall.
5876
5877 To suppress this warning use the "unused" attribute.
5878
5879 This warning is also enabled by -Wunused, which is enabled by
5880 -Wall.
5881
5882 -Wunused-function
5883 Warn whenever a static function is declared but not defined or a
5884 non-inline static function is unused. This warning is enabled by
5885 -Wall.
5886
5887 -Wunused-label
5888 Warn whenever a label is declared but not used. This warning is
5889 enabled by -Wall.
5890
5891 To suppress this warning use the "unused" attribute.
5892
5893 -Wunused-local-typedefs (C, Objective-C, C++ and Objective-C++ only)
5894 Warn when a typedef locally defined in a function is not used.
5895 This warning is enabled by -Wall.
5896
5897 -Wunused-parameter
5898 Warn whenever a function parameter is unused aside from its
5899 declaration.
5900
5901 To suppress this warning use the "unused" attribute.
5902
5903 -Wno-unused-result
5904 Do not warn if a caller of a function marked with attribute
5905 "warn_unused_result" does not use its return value. The default is
5906 -Wunused-result.
5907
5908 -Wunused-variable
5909 Warn whenever a local or static variable is unused aside from its
5910 declaration. This option implies -Wunused-const-variable=1 for C,
5911 but not for C++. This warning is enabled by -Wall.
5912
5913 To suppress this warning use the "unused" attribute.
5914
5915 -Wunused-const-variable
5916 -Wunused-const-variable=n
5917 Warn whenever a constant static variable is unused aside from its
5918 declaration. -Wunused-const-variable=1 is enabled by
5919 -Wunused-variable for C, but not for C++. In C this declares
5920 variable storage, but in C++ this is not an error since const
5921 variables take the place of "#define"s.
5922
5923 To suppress this warning use the "unused" attribute.
5924
5925 -Wunused-const-variable=1
5926 This is the warning level that is enabled by -Wunused-variable
5927 for C. It warns only about unused static const variables
5928 defined in the main compilation unit, but not about static
5929 const variables declared in any header included.
5930
5931 -Wunused-const-variable=2
5932 This warning level also warns for unused constant static
5933 variables in headers (excluding system headers). This is the
5934 warning level of -Wunused-const-variable and must be explicitly
5935 requested since in C++ this isn't an error and in C it might be
5936 harder to clean up all headers included.
5937
5938 -Wunused-value
5939 Warn whenever a statement computes a result that is explicitly not
5940 used. To suppress this warning cast the unused expression to
5941 "void". This includes an expression-statement or the left-hand side
5942 of a comma expression that contains no side effects. For example,
5943 an expression such as "x[i,j]" causes a warning, while
5944 "x[(void)i,j]" does not.
5945
5946 This warning is enabled by -Wall.
5947
5948 -Wunused
5949 All the above -Wunused options combined.
5950
5951 In order to get a warning about an unused function parameter, you
5952 must either specify -Wextra -Wunused (note that -Wall implies
5953 -Wunused), or separately specify -Wunused-parameter.
5954
5955 -Wuninitialized
5956 Warn if an object with automatic or allocated storage duration is
5957 used without having been initialized. In C++, also warn if a non-
5958 static reference or non-static "const" member appears in a class
5959 without constructors.
5960
5961 In addition, passing a pointer (or in C++, a reference) to an
5962 uninitialized object to a "const"-qualified argument of a built-in
5963 function known to read the object is also diagnosed by this
5964 warning. (-Wmaybe-uninitialized is issued for ordinary functions.)
5965
5966 If you want to warn about code that uses the uninitialized value of
5967 the variable in its own initializer, use the -Winit-self option.
5968
5969 These warnings occur for individual uninitialized elements of
5970 structure, union or array variables as well as for variables that
5971 are uninitialized as a whole. They do not occur for variables or
5972 elements declared "volatile". Because these warnings depend on
5973 optimization, the exact variables or elements for which there are
5974 warnings depend on the precise optimization options and version of
5975 GCC used.
5976
5977 Note that there may be no warning about a variable that is used
5978 only to compute a value that itself is never used, because such
5979 computations may be deleted by data flow analysis before the
5980 warnings are printed.
5981
5982 In C++, this warning also warns about using uninitialized objects
5983 in member-initializer-lists. For example, GCC warns about "b"
5984 being uninitialized in the following snippet:
5985
5986 struct A {
5987 int a;
5988 int b;
5989 A() : a(b) { }
5990 };
5991
5992 -Wno-invalid-memory-model
5993 This option controls warnings for invocations of __atomic Builtins,
5994 __sync Builtins, and the C11 atomic generic functions with a memory
5995 consistency argument that is either invalid for the operation or
5996 outside the range of values of the "memory_order" enumeration. For
5997 example, since the "__atomic_store" and "__atomic_store_n" built-
5998 ins are only defined for the relaxed, release, and sequentially
5999 consistent memory orders the following code is diagnosed:
6000
6001 void store (int *i)
6002 {
6003 __atomic_store_n (i, 0, memory_order_consume);
6004 }
6005
6006 -Winvalid-memory-model is enabled by default.
6007
6008 -Wmaybe-uninitialized
6009 For an object with automatic or allocated storage duration, if
6010 there exists a path from the function entry to a use of the object
6011 that is initialized, but there exist some other paths for which the
6012 object is not initialized, the compiler emits a warning if it
6013 cannot prove the uninitialized paths are not executed at run time.
6014
6015 In addition, passing a pointer (or in C++, a reference) to an
6016 uninitialized object to a "const"-qualified function argument is
6017 also diagnosed by this warning. (-Wuninitialized is issued for
6018 built-in functions known to read the object.) Annotating the
6019 function with attribute "access (none)" indicates that the argument
6020 isn't used to access the object and avoids the warning.
6021
6022 These warnings are only possible in optimizing compilation, because
6023 otherwise GCC does not keep track of the state of variables.
6024
6025 These warnings are made optional because GCC may not be able to
6026 determine when the code is correct in spite of appearing to have an
6027 error. Here is one example of how this can happen:
6028
6029 {
6030 int x;
6031 switch (y)
6032 {
6033 case 1: x = 1;
6034 break;
6035 case 2: x = 4;
6036 break;
6037 case 3: x = 5;
6038 }
6039 foo (x);
6040 }
6041
6042 If the value of "y" is always 1, 2 or 3, then "x" is always
6043 initialized, but GCC doesn't know this. To suppress the warning,
6044 you need to provide a default case with assert(0) or similar code.
6045
6046 This option also warns when a non-volatile automatic variable might
6047 be changed by a call to "longjmp". The compiler sees only the
6048 calls to "setjmp". It cannot know where "longjmp" will be called;
6049 in fact, a signal handler could call it at any point in the code.
6050 As a result, you may get a warning even when there is in fact no
6051 problem because "longjmp" cannot in fact be called at the place
6052 that would cause a problem.
6053
6054 Some spurious warnings can be avoided if you declare all the
6055 functions you use that never return as "noreturn".
6056
6057 This warning is enabled by -Wall or -Wextra.
6058
6059 -Wunknown-pragmas
6060 Warn when a "#pragma" directive is encountered that is not
6061 understood by GCC. If this command-line option is used, warnings
6062 are even issued for unknown pragmas in system header files. This
6063 is not the case if the warnings are only enabled by the -Wall
6064 command-line option.
6065
6066 -Wno-pragmas
6067 Do not warn about misuses of pragmas, such as incorrect parameters,
6068 invalid syntax, or conflicts between pragmas. See also
6069 -Wunknown-pragmas.
6070
6071 -Wno-prio-ctor-dtor
6072 Do not warn if a priority from 0 to 100 is used for constructor or
6073 destructor. The use of constructor and destructor attributes allow
6074 you to assign a priority to the constructor/destructor to control
6075 its order of execution before "main" is called or after it returns.
6076 The priority values must be greater than 100 as the compiler
6077 reserves priority values between 0--100 for the implementation.
6078
6079 -Wstrict-aliasing
6080 This option is only active when -fstrict-aliasing is active. It
6081 warns about code that might break the strict aliasing rules that
6082 the compiler is using for optimization. The warning does not catch
6083 all cases, but does attempt to catch the more common pitfalls. It
6084 is included in -Wall. It is equivalent to -Wstrict-aliasing=3
6085
6086 -Wstrict-aliasing=n
6087 This option is only active when -fstrict-aliasing is active. It
6088 warns about code that might break the strict aliasing rules that
6089 the compiler is using for optimization. Higher levels correspond
6090 to higher accuracy (fewer false positives). Higher levels also
6091 correspond to more effort, similar to the way -O works.
6092 -Wstrict-aliasing is equivalent to -Wstrict-aliasing=3.
6093
6094 Level 1: Most aggressive, quick, least accurate. Possibly useful
6095 when higher levels do not warn but -fstrict-aliasing still breaks
6096 the code, as it has very few false negatives. However, it has many
6097 false positives. Warns for all pointer conversions between
6098 possibly incompatible types, even if never dereferenced. Runs in
6099 the front end only.
6100
6101 Level 2: Aggressive, quick, not too precise. May still have many
6102 false positives (not as many as level 1 though), and few false
6103 negatives (but possibly more than level 1). Unlike level 1, it
6104 only warns when an address is taken. Warns about incomplete types.
6105 Runs in the front end only.
6106
6107 Level 3 (default for -Wstrict-aliasing): Should have very few false
6108 positives and few false negatives. Slightly slower than levels 1
6109 or 2 when optimization is enabled. Takes care of the common
6110 pun+dereference pattern in the front end: "*(int*)&some_float". If
6111 optimization is enabled, it also runs in the back end, where it
6112 deals with multiple statement cases using flow-sensitive points-to
6113 information. Only warns when the converted pointer is
6114 dereferenced. Does not warn about incomplete types.
6115
6116 -Wstrict-overflow
6117 -Wstrict-overflow=n
6118 This option is only active when signed overflow is undefined. It
6119 warns about cases where the compiler optimizes based on the
6120 assumption that signed overflow does not occur. Note that it does
6121 not warn about all cases where the code might overflow: it only
6122 warns about cases where the compiler implements some optimization.
6123 Thus this warning depends on the optimization level.
6124
6125 An optimization that assumes that signed overflow does not occur is
6126 perfectly safe if the values of the variables involved are such
6127 that overflow never does, in fact, occur. Therefore this warning
6128 can easily give a false positive: a warning about code that is not
6129 actually a problem. To help focus on important issues, several
6130 warning levels are defined. No warnings are issued for the use of
6131 undefined signed overflow when estimating how many iterations a
6132 loop requires, in particular when determining whether a loop will
6133 be executed at all.
6134
6135 -Wstrict-overflow=1
6136 Warn about cases that are both questionable and easy to avoid.
6137 For example the compiler simplifies "x + 1 > x" to 1. This
6138 level of -Wstrict-overflow is enabled by -Wall; higher levels
6139 are not, and must be explicitly requested.
6140
6141 -Wstrict-overflow=2
6142 Also warn about other cases where a comparison is simplified to
6143 a constant. For example: "abs (x) >= 0". This can only be
6144 simplified when signed integer overflow is undefined, because
6145 "abs (INT_MIN)" overflows to "INT_MIN", which is less than
6146 zero. -Wstrict-overflow (with no level) is the same as
6147 -Wstrict-overflow=2.
6148
6149 -Wstrict-overflow=3
6150 Also warn about other cases where a comparison is simplified.
6151 For example: "x + 1 > 1" is simplified to "x > 0".
6152
6153 -Wstrict-overflow=4
6154 Also warn about other simplifications not covered by the above
6155 cases. For example: "(x * 10) / 5" is simplified to "x * 2".
6156
6157 -Wstrict-overflow=5
6158 Also warn about cases where the compiler reduces the magnitude
6159 of a constant involved in a comparison. For example: "x + 2 >
6160 y" is simplified to "x + 1 >= y". This is reported only at the
6161 highest warning level because this simplification applies to
6162 many comparisons, so this warning level gives a very large
6163 number of false positives.
6164
6165 -Wstring-compare
6166 Warn for calls to "strcmp" and "strncmp" whose result is determined
6167 to be either zero or non-zero in tests for such equality owing to
6168 the length of one argument being greater than the size of the array
6169 the other argument is stored in (or the bound in the case of
6170 "strncmp"). Such calls could be mistakes. For example, the call
6171 to "strcmp" below is diagnosed because its result is necessarily
6172 non-zero irrespective of the contents of the array "a".
6173
6174 extern char a[4];
6175 void f (char *d)
6176 {
6177 strcpy (d, "string");
6178 ...
6179 if (0 == strcmp (a, d)) // cannot be true
6180 puts ("a and d are the same");
6181 }
6182
6183 -Wstring-compare is enabled by -Wextra.
6184
6185 -Wno-stringop-overflow
6186 -Wstringop-overflow
6187 -Wstringop-overflow=type
6188 Warn for calls to string manipulation functions such as "memcpy"
6189 and "strcpy" that are determined to overflow the destination
6190 buffer. The optional argument is one greater than the type of
6191 Object Size Checking to perform to determine the size of the
6192 destination. The argument is meaningful only for functions that
6193 operate on character arrays but not for raw memory functions like
6194 "memcpy" which always make use of Object Size type-0. The option
6195 also warns for calls that specify a size in excess of the largest
6196 possible object or at most "SIZE_MAX / 2" bytes. The option
6197 produces the best results with optimization enabled but can detect
6198 a small subset of simple buffer overflows even without optimization
6199 in calls to the GCC built-in functions like "__builtin_memcpy" that
6200 correspond to the standard functions. In any case, the option
6201 warns about just a subset of buffer overflows detected by the
6202 corresponding overflow checking built-ins. For example, the option
6203 issues a warning for the "strcpy" call below because it copies at
6204 least 5 characters (the string "blue" including the terminating
6205 NUL) into the buffer of size 4.
6206
6207 enum Color { blue, purple, yellow };
6208 const char* f (enum Color clr)
6209 {
6210 static char buf [4];
6211 const char *str;
6212 switch (clr)
6213 {
6214 case blue: str = "blue"; break;
6215 case purple: str = "purple"; break;
6216 case yellow: str = "yellow"; break;
6217 }
6218
6219 return strcpy (buf, str); // warning here
6220 }
6221
6222 Option -Wstringop-overflow=2 is enabled by default.
6223
6224 -Wstringop-overflow
6225 -Wstringop-overflow=1
6226 The -Wstringop-overflow=1 option uses type-zero Object Size
6227 Checking to determine the sizes of destination objects. At
6228 this setting the option does not warn for writes past the end
6229 of subobjects of larger objects accessed by pointers unless the
6230 size of the largest surrounding object is known. When the
6231 destination may be one of several objects it is assumed to be
6232 the largest one of them. On Linux systems, when optimization
6233 is enabled at this setting the option warns for the same code
6234 as when the "_FORTIFY_SOURCE" macro is defined to a non-zero
6235 value.
6236
6237 -Wstringop-overflow=2
6238 The -Wstringop-overflow=2 option uses type-one Object Size
6239 Checking to determine the sizes of destination objects. At
6240 this setting the option warns about overflows when writing to
6241 members of the largest complete objects whose exact size is
6242 known. However, it does not warn for excessive writes to the
6243 same members of unknown objects referenced by pointers since
6244 they may point to arrays containing unknown numbers of
6245 elements. This is the default setting of the option.
6246
6247 -Wstringop-overflow=3
6248 The -Wstringop-overflow=3 option uses type-two Object Size
6249 Checking to determine the sizes of destination objects. At
6250 this setting the option warns about overflowing the smallest
6251 object or data member. This is the most restrictive setting of
6252 the option that may result in warnings for safe code.
6253
6254 -Wstringop-overflow=4
6255 The -Wstringop-overflow=4 option uses type-three Object Size
6256 Checking to determine the sizes of destination objects. At
6257 this setting the option warns about overflowing any data
6258 members, and when the destination is one of several objects it
6259 uses the size of the largest of them to decide whether to issue
6260 a warning. Similarly to -Wstringop-overflow=3 this setting of
6261 the option may result in warnings for benign code.
6262
6263 -Wno-stringop-overread
6264 Warn for calls to string manipulation functions such as "memchr",
6265 or "strcpy" that are determined to read past the end of the source
6266 sequence.
6267
6268 Option -Wstringop-overread is enabled by default.
6269
6270 -Wno-stringop-truncation
6271 Do not warn for calls to bounded string manipulation functions such
6272 as "strncat", "strncpy", and "stpncpy" that may either truncate the
6273 copied string or leave the destination unchanged.
6274
6275 In the following example, the call to "strncat" specifies a bound
6276 that is less than the length of the source string. As a result,
6277 the copy of the source will be truncated and so the call is
6278 diagnosed. To avoid the warning use "bufsize - strlen (buf) - 1)"
6279 as the bound.
6280
6281 void append (char *buf, size_t bufsize)
6282 {
6283 strncat (buf, ".txt", 3);
6284 }
6285
6286 As another example, the following call to "strncpy" results in
6287 copying to "d" just the characters preceding the terminating NUL,
6288 without appending the NUL to the end. Assuming the result of
6289 "strncpy" is necessarily a NUL-terminated string is a common
6290 mistake, and so the call is diagnosed. To avoid the warning when
6291 the result is not expected to be NUL-terminated, call "memcpy"
6292 instead.
6293
6294 void copy (char *d, const char *s)
6295 {
6296 strncpy (d, s, strlen (s));
6297 }
6298
6299 In the following example, the call to "strncpy" specifies the size
6300 of the destination buffer as the bound. If the length of the
6301 source string is equal to or greater than this size the result of
6302 the copy will not be NUL-terminated. Therefore, the call is also
6303 diagnosed. To avoid the warning, specify "sizeof buf - 1" as the
6304 bound and set the last element of the buffer to "NUL".
6305
6306 void copy (const char *s)
6307 {
6308 char buf[80];
6309 strncpy (buf, s, sizeof buf);
6310 ...
6311 }
6312
6313 In situations where a character array is intended to store a
6314 sequence of bytes with no terminating "NUL" such an array may be
6315 annotated with attribute "nonstring" to avoid this warning. Such
6316 arrays, however, are not suitable arguments to functions that
6317 expect "NUL"-terminated strings. To help detect accidental misuses
6318 of such arrays GCC issues warnings unless it can prove that the use
6319 is safe.
6320
6321 -Wstrict-flex-arrays
6322 Warn about inproper usages of flexible array members according to
6323 the level of the "strict_flex_array (level)" attribute attached to
6324 the trailing array field of a structure if it's available,
6325 otherwise according to the level of the option
6326 -fstrict-flex-arrays=level.
6327
6328 This option is effective only when level is bigger than 0.
6329 Otherwise, it will be ignored with a warning.
6330
6331 when level=1, warnings will be issued for a trailing array
6332 reference of a structure that have 2 or more elements if the
6333 trailing array is referenced as a flexible array member.
6334
6335 when level=2, in addition to level=1, additional warnings will be
6336 issued for a trailing one-element array reference of a structure if
6337 the array is referenced as a flexible array member.
6338
6339 when level=3, in addition to level=2, additional warnings will be
6340 issued for a trailing zero-length array reference of a structure if
6341 the array is referenced as a flexible array member.
6342
6343 -Wsuggest-attribute=[pure|const|noreturn|format|cold|malloc]
6344 Warn for cases where adding an attribute may be beneficial. The
6345 attributes currently supported are listed below.
6346
6347 -Wsuggest-attribute=pure
6348 -Wsuggest-attribute=const
6349 -Wsuggest-attribute=noreturn
6350 -Wmissing-noreturn
6351 -Wsuggest-attribute=malloc
6352 Warn about functions that might be candidates for attributes
6353 "pure", "const" or "noreturn" or "malloc". The compiler only
6354 warns for functions visible in other compilation units or (in
6355 the case of "pure" and "const") if it cannot prove that the
6356 function returns normally. A function returns normally if it
6357 doesn't contain an infinite loop or return abnormally by
6358 throwing, calling "abort" or trapping. This analysis requires
6359 option -fipa-pure-const, which is enabled by default at -O and
6360 higher. Higher optimization levels improve the accuracy of the
6361 analysis.
6362
6363 -Wsuggest-attribute=format
6364 -Wmissing-format-attribute
6365 Warn about function pointers that might be candidates for
6366 "format" attributes. Note these are only possible candidates,
6367 not absolute ones. GCC guesses that function pointers with
6368 "format" attributes that are used in assignment,
6369 initialization, parameter passing or return statements should
6370 have a corresponding "format" attribute in the resulting type.
6371 I.e. the left-hand side of the assignment or initialization,
6372 the type of the parameter variable, or the return type of the
6373 containing function respectively should also have a "format"
6374 attribute to avoid the warning.
6375
6376 GCC also warns about function definitions that might be
6377 candidates for "format" attributes. Again, these are only
6378 possible candidates. GCC guesses that "format" attributes
6379 might be appropriate for any function that calls a function
6380 like "vprintf" or "vscanf", but this might not always be the
6381 case, and some functions for which "format" attributes are
6382 appropriate may not be detected.
6383
6384 -Wsuggest-attribute=cold
6385 Warn about functions that might be candidates for "cold"
6386 attribute. This is based on static detection and generally
6387 only warns about functions which always leads to a call to
6388 another "cold" function such as wrappers of C++ "throw" or
6389 fatal error reporting functions leading to "abort".
6390
6391 -Walloc-zero
6392 Warn about calls to allocation functions decorated with attribute
6393 "alloc_size" that specify zero bytes, including those to the built-
6394 in forms of the functions "aligned_alloc", "alloca", "calloc",
6395 "malloc", and "realloc". Because the behavior of these functions
6396 when called with a zero size differs among implementations (and in
6397 the case of "realloc" has been deprecated) relying on it may result
6398 in subtle portability bugs and should be avoided.
6399
6400 -Walloc-size-larger-than=byte-size
6401 Warn about calls to functions decorated with attribute "alloc_size"
6402 that attempt to allocate objects larger than the specified number
6403 of bytes, or where the result of the size computation in an integer
6404 type with infinite precision would exceed the value of PTRDIFF_MAX
6405 on the target. -Walloc-size-larger-than=PTRDIFF_MAX is enabled by
6406 default. Warnings controlled by the option can be disabled either
6407 by specifying byte-size of SIZE_MAX or more or by
6408 -Wno-alloc-size-larger-than.
6409
6410 -Wno-alloc-size-larger-than
6411 Disable -Walloc-size-larger-than= warnings. The option is
6412 equivalent to -Walloc-size-larger-than=SIZE_MAX or larger.
6413
6414 -Walloca
6415 This option warns on all uses of "alloca" in the source.
6416
6417 -Walloca-larger-than=byte-size
6418 This option warns on calls to "alloca" with an integer argument
6419 whose value is either zero, or that is not bounded by a controlling
6420 predicate that limits its value to at most byte-size. It also
6421 warns for calls to "alloca" where the bound value is unknown.
6422 Arguments of non-integer types are considered unbounded even if
6423 they appear to be constrained to the expected range.
6424
6425 For example, a bounded case of "alloca" could be:
6426
6427 void func (size_t n)
6428 {
6429 void *p;
6430 if (n <= 1000)
6431 p = alloca (n);
6432 else
6433 p = malloc (n);
6434 f (p);
6435 }
6436
6437 In the above example, passing "-Walloca-larger-than=1000" would not
6438 issue a warning because the call to "alloca" is known to be at most
6439 1000 bytes. However, if "-Walloca-larger-than=500" were passed,
6440 the compiler would emit a warning.
6441
6442 Unbounded uses, on the other hand, are uses of "alloca" with no
6443 controlling predicate constraining its integer argument. For
6444 example:
6445
6446 void func ()
6447 {
6448 void *p = alloca (n);
6449 f (p);
6450 }
6451
6452 If "-Walloca-larger-than=500" were passed, the above would trigger
6453 a warning, but this time because of the lack of bounds checking.
6454
6455 Note, that even seemingly correct code involving signed integers
6456 could cause a warning:
6457
6458 void func (signed int n)
6459 {
6460 if (n < 500)
6461 {
6462 p = alloca (n);
6463 f (p);
6464 }
6465 }
6466
6467 In the above example, n could be negative, causing a larger than
6468 expected argument to be implicitly cast into the "alloca" call.
6469
6470 This option also warns when "alloca" is used in a loop.
6471
6472 -Walloca-larger-than=PTRDIFF_MAX is enabled by default but is
6473 usually only effective when -ftree-vrp is active (default for -O2
6474 and above).
6475
6476 See also -Wvla-larger-than=byte-size.
6477
6478 -Wno-alloca-larger-than
6479 Disable -Walloca-larger-than= warnings. The option is equivalent
6480 to -Walloca-larger-than=SIZE_MAX or larger.
6481
6482 -Warith-conversion
6483 Do warn about implicit conversions from arithmetic operations even
6484 when conversion of the operands to the same type cannot change
6485 their values. This affects warnings from -Wconversion,
6486 -Wfloat-conversion, and -Wsign-conversion.
6487
6488 void f (char c, int i)
6489 {
6490 c = c + i; // warns with B<-Wconversion>
6491 c = c + 1; // only warns with B<-Warith-conversion>
6492 }
6493
6494 -Warray-bounds
6495 -Warray-bounds=n
6496 Warn about out of bounds subscripts or offsets into arrays. This
6497 warning is enabled by -Wall. It is more effective when -ftree-vrp
6498 is active (the default for -O2 and above) but a subset of instances
6499 are issued even without optimization.
6500
6501 By default, the trailing array of a structure will be treated as a
6502 flexible array member by -Warray-bounds or -Warray-bounds=n if it
6503 is declared as either a flexible array member per C99 standard
6504 onwards ([]), a GCC zero-length array extension ([0]), or an one-
6505 element array ([1]). As a result, out of bounds subscripts or
6506 offsets into zero-length arrays or one-element arrays are not
6507 warned by default.
6508
6509 You can add the option -fstrict-flex-arrays or
6510 -fstrict-flex-arrays=level to control how this option treat
6511 trailing array of a structure as a flexible array member:
6512
6513 when level<=1, no change to the default behavior.
6514
6515 when level=2, additional warnings will be issued for out of bounds
6516 subscripts or offsets into one-element arrays;
6517
6518 when level=3, in addition to level=2, additional warnings will be
6519 issued for out of bounds subscripts or offsets into zero-length
6520 arrays.
6521
6522 -Warray-bounds=1
6523 This is the default warning level of -Warray-bounds and is
6524 enabled by -Wall; higher levels are not, and must be explicitly
6525 requested.
6526
6527 -Warray-bounds=2
6528 This warning level also warns about the intermediate results of
6529 pointer arithmetic that may yield out of bounds values. This
6530 warning level may give a larger number of false positives and
6531 is deactivated by default.
6532
6533 -Warray-compare
6534 Warn about equality and relational comparisons between two operands
6535 of array type. This comparison was deprecated in C++20. For
6536 example:
6537
6538 int arr1[5];
6539 int arr2[5];
6540 bool same = arr1 == arr2;
6541
6542 -Warray-compare is enabled by -Wall.
6543
6544 -Warray-parameter
6545 -Warray-parameter=n
6546 Warn about redeclarations of functions involving arguments of array
6547 or pointer types of inconsistent kinds or forms, and enable the
6548 detection of out-of-bounds accesses to such parameters by warnings
6549 such as -Warray-bounds.
6550
6551 If the first function declaration uses the array form the bound
6552 specified in the array is assumed to be the minimum number of
6553 elements expected to be provided in calls to the function and the
6554 maximum number of elements accessed by it. Failing to provide
6555 arguments of sufficient size or accessing more than the maximum
6556 number of elements may be diagnosed by warnings such as
6557 -Warray-bounds. At level 1 the warning diagnoses inconsistencies
6558 involving array parameters declared using the "T[static N]" form.
6559
6560 For example, the warning triggers for the following redeclarations
6561 because the first one allows an array of any size to be passed to
6562 "f" while the second one with the keyword "static" specifies that
6563 the array argument must have at least four elements.
6564
6565 void f (int[static 4]);
6566 void f (int[]); // warning (inconsistent array form)
6567
6568 void g (void)
6569 {
6570 int *p = (int *)malloc (4);
6571 f (p); // warning (array too small)
6572 ...
6573 }
6574
6575 At level 2 the warning also triggers for redeclarations involving
6576 any other inconsistency in array or pointer argument forms denoting
6577 array sizes. Pointers and arrays of unspecified bound are
6578 considered equivalent and do not trigger a warning.
6579
6580 void g (int*);
6581 void g (int[]); // no warning
6582 void g (int[8]); // warning (inconsistent array bound)
6583
6584 -Warray-parameter=2 is included in -Wall. The -Wvla-parameter
6585 option triggers warnings for similar inconsistencies involving
6586 Variable Length Array arguments.
6587
6588 -Wattribute-alias=n
6589 -Wno-attribute-alias
6590 Warn about declarations using the "alias" and similar attributes
6591 whose target is incompatible with the type of the alias.
6592
6593 -Wattribute-alias=1
6594 The default warning level of the -Wattribute-alias option
6595 diagnoses incompatibilities between the type of the alias
6596 declaration and that of its target. Such incompatibilities are
6597 typically indicative of bugs.
6598
6599 -Wattribute-alias=2
6600 At this level -Wattribute-alias also diagnoses cases where the
6601 attributes of the alias declaration are more restrictive than
6602 the attributes applied to its target. These mismatches can
6603 potentially result in incorrect code generation. In other
6604 cases they may be benign and could be resolved simply by adding
6605 the missing attribute to the target. For comparison, see the
6606 -Wmissing-attributes option, which controls diagnostics when
6607 the alias declaration is less restrictive than the target,
6608 rather than more restrictive.
6609
6610 Attributes considered include "alloc_align", "alloc_size",
6611 "cold", "const", "hot", "leaf", "malloc", "nonnull",
6612 "noreturn", "nothrow", "pure", "returns_nonnull", and
6613 "returns_twice".
6614
6615 -Wattribute-alias is equivalent to -Wattribute-alias=1. This is
6616 the default. You can disable these warnings with either
6617 -Wno-attribute-alias or -Wattribute-alias=0.
6618
6619 -Wbidi-chars=[none|unpaired|any|ucn]
6620 Warn about possibly misleading UTF-8 bidirectional control
6621 characters in comments, string literals, character constants, and
6622 identifiers. Such characters can change left-to-right writing
6623 direction into right-to-left (and vice versa), which can cause
6624 confusion between the logical order and visual order. This may be
6625 dangerous; for instance, it may seem that a piece of code is not
6626 commented out, whereas it in fact is.
6627
6628 There are three levels of warning supported by GCC. The default is
6629 -Wbidi-chars=unpaired, which warns about improperly terminated bidi
6630 contexts. -Wbidi-chars=none turns the warning off.
6631 -Wbidi-chars=any warns about any use of bidirectional control
6632 characters.
6633
6634 By default, this warning does not warn about UCNs. It is, however,
6635 possible to turn on such checking by using
6636 -Wbidi-chars=unpaired,ucn or -Wbidi-chars=any,ucn. Using
6637 -Wbidi-chars=ucn is valid, and is equivalent to
6638 -Wbidi-chars=unpaired,ucn, if no previous -Wbidi-chars=any was
6639 specified.
6640
6641 -Wbool-compare
6642 Warn about boolean expression compared with an integer value
6643 different from "true"/"false". For instance, the following
6644 comparison is always false:
6645
6646 int n = 5;
6647 ...
6648 if ((n > 1) == 2) { ... }
6649
6650 This warning is enabled by -Wall.
6651
6652 -Wbool-operation
6653 Warn about suspicious operations on expressions of a boolean type.
6654 For instance, bitwise negation of a boolean is very likely a bug in
6655 the program. For C, this warning also warns about incrementing or
6656 decrementing a boolean, which rarely makes sense. (In C++,
6657 decrementing a boolean is always invalid. Incrementing a boolean
6658 is invalid in C++17, and deprecated otherwise.)
6659
6660 This warning is enabled by -Wall.
6661
6662 -Wduplicated-branches
6663 Warn when an if-else has identical branches. This warning detects
6664 cases like
6665
6666 if (p != NULL)
6667 return 0;
6668 else
6669 return 0;
6670
6671 It doesn't warn when both branches contain just a null statement.
6672 This warning also warn for conditional operators:
6673
6674 int i = x ? *p : *p;
6675
6676 -Wduplicated-cond
6677 Warn about duplicated conditions in an if-else-if chain. For
6678 instance, warn for the following code:
6679
6680 if (p->q != NULL) { ... }
6681 else if (p->q != NULL) { ... }
6682
6683 -Wframe-address
6684 Warn when the __builtin_frame_address or __builtin_return_address
6685 is called with an argument greater than 0. Such calls may return
6686 indeterminate values or crash the program. The warning is included
6687 in -Wall.
6688
6689 -Wno-discarded-qualifiers (C and Objective-C only)
6690 Do not warn if type qualifiers on pointers are being discarded.
6691 Typically, the compiler warns if a "const char *" variable is
6692 passed to a function that takes a "char *" parameter. This option
6693 can be used to suppress such a warning.
6694
6695 -Wno-discarded-array-qualifiers (C and Objective-C only)
6696 Do not warn if type qualifiers on arrays which are pointer targets
6697 are being discarded. Typically, the compiler warns if a "const int
6698 (*)[]" variable is passed to a function that takes a "int (*)[]"
6699 parameter. This option can be used to suppress such a warning.
6700
6701 -Wno-incompatible-pointer-types (C and Objective-C only)
6702 Do not warn when there is a conversion between pointers that have
6703 incompatible types. This warning is for cases not covered by
6704 -Wno-pointer-sign, which warns for pointer argument passing or
6705 assignment with different signedness.
6706
6707 -Wno-int-conversion (C and Objective-C only)
6708 Do not warn about incompatible integer to pointer and pointer to
6709 integer conversions. This warning is about implicit conversions;
6710 for explicit conversions the warnings -Wno-int-to-pointer-cast and
6711 -Wno-pointer-to-int-cast may be used.
6712
6713 -Wzero-length-bounds
6714 Warn about accesses to elements of zero-length array members that
6715 might overlap other members of the same object. Declaring interior
6716 zero-length arrays is discouraged because accesses to them are
6717 undefined.
6718
6719 For example, the first two stores in function "bad" are diagnosed
6720 because the array elements overlap the subsequent members "b" and
6721 "c". The third store is diagnosed by -Warray-bounds because it is
6722 beyond the bounds of the enclosing object.
6723
6724 struct X { int a[0]; int b, c; };
6725 struct X x;
6726
6727 void bad (void)
6728 {
6729 x.a[0] = 0; // -Wzero-length-bounds
6730 x.a[1] = 1; // -Wzero-length-bounds
6731 x.a[2] = 2; // -Warray-bounds
6732 }
6733
6734 Option -Wzero-length-bounds is enabled by -Warray-bounds.
6735
6736 -Wno-div-by-zero
6737 Do not warn about compile-time integer division by zero. Floating-
6738 point division by zero is not warned about, as it can be a
6739 legitimate way of obtaining infinities and NaNs.
6740
6741 -Wsystem-headers
6742 Print warning messages for constructs found in system header files.
6743 Warnings from system headers are normally suppressed, on the
6744 assumption that they usually do not indicate real problems and
6745 would only make the compiler output harder to read. Using this
6746 command-line option tells GCC to emit warnings from system headers
6747 as if they occurred in user code. However, note that using -Wall
6748 in conjunction with this option does not warn about unknown pragmas
6749 in system headers---for that, -Wunknown-pragmas must also be used.
6750
6751 -Wtautological-compare
6752 Warn if a self-comparison always evaluates to true or false. This
6753 warning detects various mistakes such as:
6754
6755 int i = 1;
6756 ...
6757 if (i > i) { ... }
6758
6759 This warning also warns about bitwise comparisons that always
6760 evaluate to true or false, for instance:
6761
6762 if ((a & 16) == 10) { ... }
6763
6764 will always be false.
6765
6766 This warning is enabled by -Wall.
6767
6768 -Wtrampolines
6769 Warn about trampolines generated for pointers to nested functions.
6770 A trampoline is a small piece of data or code that is created at
6771 run time on the stack when the address of a nested function is
6772 taken, and is used to call the nested function indirectly. For
6773 some targets, it is made up of data only and thus requires no
6774 special treatment. But, for most targets, it is made up of code
6775 and thus requires the stack to be made executable in order for the
6776 program to work properly.
6777
6778 -Wfloat-equal
6779 Warn if floating-point values are used in equality comparisons.
6780
6781 The idea behind this is that sometimes it is convenient (for the
6782 programmer) to consider floating-point values as approximations to
6783 infinitely precise real numbers. If you are doing this, then you
6784 need to compute (by analyzing the code, or in some other way) the
6785 maximum or likely maximum error that the computation introduces,
6786 and allow for it when performing comparisons (and when producing
6787 output, but that's a different problem). In particular, instead of
6788 testing for equality, you should check to see whether the two
6789 values have ranges that overlap; and this is done with the
6790 relational operators, so equality comparisons are probably
6791 mistaken.
6792
6793 -Wtraditional (C and Objective-C only)
6794 Warn about certain constructs that behave differently in
6795 traditional and ISO C. Also warn about ISO C constructs that have
6796 no traditional C equivalent, and/or problematic constructs that
6797 should be avoided.
6798
6799 * Macro parameters that appear within string literals in the
6800 macro body. In traditional C macro replacement takes place
6801 within string literals, but in ISO C it does not.
6802
6803 * In traditional C, some preprocessor directives did not exist.
6804 Traditional preprocessors only considered a line to be a
6805 directive if the # appeared in column 1 on the line. Therefore
6806 -Wtraditional warns about directives that traditional C
6807 understands but ignores because the # does not appear as the
6808 first character on the line. It also suggests you hide
6809 directives like "#pragma" not understood by traditional C by
6810 indenting them. Some traditional implementations do not
6811 recognize "#elif", so this option suggests avoiding it
6812 altogether.
6813
6814 * A function-like macro that appears without arguments.
6815
6816 * The unary plus operator.
6817
6818 * The U integer constant suffix, or the F or L floating-point
6819 constant suffixes. (Traditional C does support the L suffix on
6820 integer constants.) Note, these suffixes appear in macros
6821 defined in the system headers of most modern systems, e.g. the
6822 _MIN/_MAX macros in "<limits.h>". Use of these macros in user
6823 code might normally lead to spurious warnings, however GCC's
6824 integrated preprocessor has enough context to avoid warning in
6825 these cases.
6826
6827 * A function declared external in one block and then used after
6828 the end of the block.
6829
6830 * A "switch" statement has an operand of type "long".
6831
6832 * A non-"static" function declaration follows a "static" one.
6833 This construct is not accepted by some traditional C compilers.
6834
6835 * The ISO type of an integer constant has a different width or
6836 signedness from its traditional type. This warning is only
6837 issued if the base of the constant is ten. I.e. hexadecimal or
6838 octal values, which typically represent bit patterns, are not
6839 warned about.
6840
6841 * Usage of ISO string concatenation is detected.
6842
6843 * Initialization of automatic aggregates.
6844
6845 * Identifier conflicts with labels. Traditional C lacks a
6846 separate namespace for labels.
6847
6848 * Initialization of unions. If the initializer is zero, the
6849 warning is omitted. This is done under the assumption that the
6850 zero initializer in user code appears conditioned on e.g.
6851 "__STDC__" to avoid missing initializer warnings and relies on
6852 default initialization to zero in the traditional C case.
6853
6854 * Conversions by prototypes between fixed/floating-point values
6855 and vice versa. The absence of these prototypes when compiling
6856 with traditional C causes serious problems. This is a subset
6857 of the possible conversion warnings; for the full set use
6858 -Wtraditional-conversion.
6859
6860 * Use of ISO C style function definitions. This warning
6861 intentionally is not issued for prototype declarations or
6862 variadic functions because these ISO C features appear in your
6863 code when using libiberty's traditional C compatibility macros,
6864 "PARAMS" and "VPARAMS". This warning is also bypassed for
6865 nested functions because that feature is already a GCC
6866 extension and thus not relevant to traditional C compatibility.
6867
6868 -Wtraditional-conversion (C and Objective-C only)
6869 Warn if a prototype causes a type conversion that is different from
6870 what would happen to the same argument in the absence of a
6871 prototype. This includes conversions of fixed point to floating
6872 and vice versa, and conversions changing the width or signedness of
6873 a fixed-point argument except when the same as the default
6874 promotion.
6875
6876 -Wdeclaration-after-statement (C and Objective-C only)
6877 Warn when a declaration is found after a statement in a block.
6878 This construct, known from C++, was introduced with ISO C99 and is
6879 by default allowed in GCC. It is not supported by ISO C90.
6880
6881 -Wshadow
6882 Warn whenever a local variable or type declaration shadows another
6883 variable, parameter, type, class member (in C++), or instance
6884 variable (in Objective-C) or whenever a built-in function is
6885 shadowed. Note that in C++, the compiler warns if a local variable
6886 shadows an explicit typedef, but not if it shadows a
6887 struct/class/enum. If this warning is enabled, it includes also
6888 all instances of local shadowing. This means that
6889 -Wno-shadow=local and -Wno-shadow=compatible-local are ignored when
6890 -Wshadow is used. Same as -Wshadow=global.
6891
6892 -Wno-shadow-ivar (Objective-C only)
6893 Do not warn whenever a local variable shadows an instance variable
6894 in an Objective-C method.
6895
6896 -Wshadow=global
6897 Warn for any shadowing. Same as -Wshadow.
6898
6899 -Wshadow=local
6900 Warn when a local variable shadows another local variable or
6901 parameter.
6902
6903 -Wshadow=compatible-local
6904 Warn when a local variable shadows another local variable or
6905 parameter whose type is compatible with that of the shadowing
6906 variable. In C++, type compatibility here means the type of the
6907 shadowing variable can be converted to that of the shadowed
6908 variable. The creation of this flag (in addition to
6909 -Wshadow=local) is based on the idea that when a local variable
6910 shadows another one of incompatible type, it is most likely
6911 intentional, not a bug or typo, as shown in the following example:
6912
6913 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6914 {
6915 for (int i = 0; i < N; ++i)
6916 {
6917 ...
6918 }
6919 ...
6920 }
6921
6922 Since the two variable "i" in the example above have incompatible
6923 types, enabling only -Wshadow=compatible-local does not emit a
6924 warning. Because their types are incompatible, if a programmer
6925 accidentally uses one in place of the other, type checking is
6926 expected to catch that and emit an error or warning. Use of this
6927 flag instead of -Wshadow=local can possibly reduce the number of
6928 warnings triggered by intentional shadowing. Note that this also
6929 means that shadowing "const char *i" by "char *i" does not emit a
6930 warning.
6931
6932 This warning is also enabled by -Wshadow=local.
6933
6934 -Wlarger-than=byte-size
6935 Warn whenever an object is defined whose size exceeds byte-size.
6936 -Wlarger-than=PTRDIFF_MAX is enabled by default. Warnings
6937 controlled by the option can be disabled either by specifying byte-
6938 size of SIZE_MAX or more or by -Wno-larger-than.
6939
6940 Also warn for calls to bounded functions such as "memchr" or
6941 "strnlen" that specify a bound greater than the largest possible
6942 object, which is PTRDIFF_MAX bytes by default. These warnings can
6943 only be disabled by -Wno-larger-than.
6944
6945 -Wno-larger-than
6946 Disable -Wlarger-than= warnings. The option is equivalent to
6947 -Wlarger-than=SIZE_MAX or larger.
6948
6949 -Wframe-larger-than=byte-size
6950 Warn if the size of a function frame exceeds byte-size. The
6951 computation done to determine the stack frame size is approximate
6952 and not conservative. The actual requirements may be somewhat
6953 greater than byte-size even if you do not get a warning. In
6954 addition, any space allocated via "alloca", variable-length arrays,
6955 or related constructs is not included by the compiler when
6956 determining whether or not to issue a warning.
6957 -Wframe-larger-than=PTRDIFF_MAX is enabled by default. Warnings
6958 controlled by the option can be disabled either by specifying byte-
6959 size of SIZE_MAX or more or by -Wno-frame-larger-than.
6960
6961 -Wno-frame-larger-than
6962 Disable -Wframe-larger-than= warnings. The option is equivalent to
6963 -Wframe-larger-than=SIZE_MAX or larger.
6964
6965 -Wfree-nonheap-object
6966 Warn when attempting to deallocate an object that was either not
6967 allocated on the heap, or by using a pointer that was not returned
6968 from a prior call to the corresponding allocation function. For
6969 example, because the call to "stpcpy" returns a pointer to the
6970 terminating nul character and not to the beginning of the object,
6971 the call to "free" below is diagnosed.
6972
6973 void f (char *p)
6974 {
6975 p = stpcpy (p, "abc");
6976 // ...
6977 free (p); // warning
6978 }
6979
6980 -Wfree-nonheap-object is included in -Wall.
6981
6982 -Wstack-usage=byte-size
6983 Warn if the stack usage of a function might exceed byte-size. The
6984 computation done to determine the stack usage is conservative. Any
6985 space allocated via "alloca", variable-length arrays, or related
6986 constructs is included by the compiler when determining whether or
6987 not to issue a warning.
6988
6989 The message is in keeping with the output of -fstack-usage.
6990
6991 * If the stack usage is fully static but exceeds the specified
6992 amount, it's:
6993
6994 warning: stack usage is 1120 bytes
6995
6996 * If the stack usage is (partly) dynamic but bounded, it's:
6997
6998 warning: stack usage might be 1648 bytes
6999
7000 * If the stack usage is (partly) dynamic and not bounded, it's:
7001
7002 warning: stack usage might be unbounded
7003
7004 -Wstack-usage=PTRDIFF_MAX is enabled by default. Warnings
7005 controlled by the option can be disabled either by specifying byte-
7006 size of SIZE_MAX or more or by -Wno-stack-usage.
7007
7008 -Wno-stack-usage
7009 Disable -Wstack-usage= warnings. The option is equivalent to
7010 -Wstack-usage=SIZE_MAX or larger.
7011
7012 -Wunsafe-loop-optimizations
7013 Warn if the loop cannot be optimized because the compiler cannot
7014 assume anything on the bounds of the loop indices. With
7015 -funsafe-loop-optimizations warn if the compiler makes such
7016 assumptions.
7017
7018 -Wno-pedantic-ms-format (MinGW targets only)
7019 When used in combination with -Wformat and -pedantic without GNU
7020 extensions, this option disables the warnings about non-ISO
7021 "printf" / "scanf" format width specifiers "I32", "I64", and "I"
7022 used on Windows targets, which depend on the MS runtime.
7023
7024 -Wpointer-arith
7025 Warn about anything that depends on the "size of" a function type
7026 or of "void". GNU C assigns these types a size of 1, for
7027 convenience in calculations with "void *" pointers and pointers to
7028 functions. In C++, warn also when an arithmetic operation involves
7029 "NULL". This warning is also enabled by -Wpedantic.
7030
7031 -Wno-pointer-compare
7032 Do not warn if a pointer is compared with a zero character
7033 constant. This usually means that the pointer was meant to be
7034 dereferenced. For example:
7035
7036 const char *p = foo ();
7037 if (p == '\0')
7038 return 42;
7039
7040 Note that the code above is invalid in C++11.
7041
7042 This warning is enabled by default.
7043
7044 -Wtsan
7045 Warn about unsupported features in ThreadSanitizer.
7046
7047 ThreadSanitizer does not support "std::atomic_thread_fence" and can
7048 report false positives.
7049
7050 This warning is enabled by default.
7051
7052 -Wtype-limits
7053 Warn if a comparison is always true or always false due to the
7054 limited range of the data type, but do not warn for constant
7055 expressions. For example, warn if an unsigned variable is compared
7056 against zero with "<" or ">=". This warning is also enabled by
7057 -Wextra.
7058
7059 -Wabsolute-value (C and Objective-C only)
7060 Warn for calls to standard functions that compute the absolute
7061 value of an argument when a more appropriate standard function is
7062 available. For example, calling abs(3.14) triggers the warning
7063 because the appropriate function to call to compute the absolute
7064 value of a double argument is "fabs". The option also triggers
7065 warnings when the argument in a call to such a function has an
7066 unsigned type. This warning can be suppressed with an explicit
7067 type cast and it is also enabled by -Wextra.
7068
7069 -Wcomment
7070 -Wcomments
7071 Warn whenever a comment-start sequence /* appears in a /* comment,
7072 or whenever a backslash-newline appears in a // comment. This
7073 warning is enabled by -Wall.
7074
7075 -Wtrigraphs
7076 Warn if any trigraphs are encountered that might change the meaning
7077 of the program. Trigraphs within comments are not warned about,
7078 except those that would form escaped newlines.
7079
7080 This option is implied by -Wall. If -Wall is not given, this
7081 option is still enabled unless trigraphs are enabled. To get
7082 trigraph conversion without warnings, but get the other -Wall
7083 warnings, use -trigraphs -Wall -Wno-trigraphs.
7084
7085 -Wundef
7086 Warn if an undefined identifier is evaluated in an "#if" directive.
7087 Such identifiers are replaced with zero.
7088
7089 -Wexpansion-to-defined
7090 Warn whenever defined is encountered in the expansion of a macro
7091 (including the case where the macro is expanded by an #if
7092 directive). Such usage is not portable. This warning is also
7093 enabled by -Wpedantic and -Wextra.
7094
7095 -Wunused-macros
7096 Warn about macros defined in the main file that are unused. A
7097 macro is used if it is expanded or tested for existence at least
7098 once. The preprocessor also warns if the macro has not been used
7099 at the time it is redefined or undefined.
7100
7101 Built-in macros, macros defined on the command line, and macros
7102 defined in include files are not warned about.
7103
7104 Note: If a macro is actually used, but only used in skipped
7105 conditional blocks, then the preprocessor reports it as unused. To
7106 avoid the warning in such a case, you might improve the scope of
7107 the macro's definition by, for example, moving it into the first
7108 skipped block. Alternatively, you could provide a dummy use with
7109 something like:
7110
7111 #if defined the_macro_causing_the_warning
7112 #endif
7113
7114 -Wno-endif-labels
7115 Do not warn whenever an "#else" or an "#endif" are followed by
7116 text. This sometimes happens in older programs with code of the
7117 form
7118
7119 #if FOO
7120 ...
7121 #else FOO
7122 ...
7123 #endif FOO
7124
7125 The second and third "FOO" should be in comments. This warning is
7126 on by default.
7127
7128 -Wbad-function-cast (C and Objective-C only)
7129 Warn when a function call is cast to a non-matching type. For
7130 example, warn if a call to a function returning an integer type is
7131 cast to a pointer type.
7132
7133 -Wc90-c99-compat (C and Objective-C only)
7134 Warn about features not present in ISO C90, but present in ISO C99.
7135 For instance, warn about use of variable length arrays, "long long"
7136 type, "bool" type, compound literals, designated initializers, and
7137 so on. This option is independent of the standards mode. Warnings
7138 are disabled in the expression that follows "__extension__".
7139
7140 -Wc99-c11-compat (C and Objective-C only)
7141 Warn about features not present in ISO C99, but present in ISO C11.
7142 For instance, warn about use of anonymous structures and unions,
7143 "_Atomic" type qualifier, "_Thread_local" storage-class specifier,
7144 "_Alignas" specifier, "Alignof" operator, "_Generic" keyword, and
7145 so on. This option is independent of the standards mode. Warnings
7146 are disabled in the expression that follows "__extension__".
7147
7148 -Wc11-c2x-compat (C and Objective-C only)
7149 Warn about features not present in ISO C11, but present in ISO C2X.
7150 For instance, warn about omitting the string in "_Static_assert",
7151 use of [[]] syntax for attributes, use of decimal floating-point
7152 types, and so on. This option is independent of the standards
7153 mode. Warnings are disabled in the expression that follows
7154 "__extension__".
7155
7156 -Wc++-compat (C and Objective-C only)
7157 Warn about ISO C constructs that are outside of the common subset
7158 of ISO C and ISO C++, e.g. request for implicit conversion from
7159 "void *" to a pointer to non-"void" type.
7160
7161 -Wc++11-compat (C++ and Objective-C++ only)
7162 Warn about C++ constructs whose meaning differs between ISO C++
7163 1998 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are
7164 keywords in ISO C++ 2011. This warning turns on -Wnarrowing and is
7165 enabled by -Wall.
7166
7167 -Wc++14-compat (C++ and Objective-C++ only)
7168 Warn about C++ constructs whose meaning differs between ISO C++
7169 2011 and ISO C++ 2014. This warning is enabled by -Wall.
7170
7171 -Wc++17-compat (C++ and Objective-C++ only)
7172 Warn about C++ constructs whose meaning differs between ISO C++
7173 2014 and ISO C++ 2017. This warning is enabled by -Wall.
7174
7175 -Wc++20-compat (C++ and Objective-C++ only)
7176 Warn about C++ constructs whose meaning differs between ISO C++
7177 2017 and ISO C++ 2020. This warning is enabled by -Wall.
7178
7179 -Wno-c++11-extensions (C++ and Objective-C++ only)
7180 Do not warn about C++11 constructs in code being compiled using an
7181 older C++ standard. Even without this option, some C++11
7182 constructs will only be diagnosed if -Wpedantic is used.
7183
7184 -Wno-c++14-extensions (C++ and Objective-C++ only)
7185 Do not warn about C++14 constructs in code being compiled using an
7186 older C++ standard. Even without this option, some C++14
7187 constructs will only be diagnosed if -Wpedantic is used.
7188
7189 -Wno-c++17-extensions (C++ and Objective-C++ only)
7190 Do not warn about C++17 constructs in code being compiled using an
7191 older C++ standard. Even without this option, some C++17
7192 constructs will only be diagnosed if -Wpedantic is used.
7193
7194 -Wno-c++20-extensions (C++ and Objective-C++ only)
7195 Do not warn about C++20 constructs in code being compiled using an
7196 older C++ standard. Even without this option, some C++20
7197 constructs will only be diagnosed if -Wpedantic is used.
7198
7199 -Wno-c++23-extensions (C++ and Objective-C++ only)
7200 Do not warn about C++23 constructs in code being compiled using an
7201 older C++ standard. Even without this option, some C++23
7202 constructs will only be diagnosed if -Wpedantic is used.
7203
7204 -Wcast-qual
7205 Warn whenever a pointer is cast so as to remove a type qualifier
7206 from the target type. For example, warn if a "const char *" is
7207 cast to an ordinary "char *".
7208
7209 Also warn when making a cast that introduces a type qualifier in an
7210 unsafe way. For example, casting "char **" to "const char **" is
7211 unsafe, as in this example:
7212
7213 /* p is char ** value. */
7214 const char **q = (const char **) p;
7215 /* Assignment of readonly string to const char * is OK. */
7216 *q = "string";
7217 /* Now char** pointer points to read-only memory. */
7218 **p = 'b';
7219
7220 -Wcast-align
7221 Warn whenever a pointer is cast such that the required alignment of
7222 the target is increased. For example, warn if a "char *" is cast
7223 to an "int *" on machines where integers can only be accessed at
7224 two- or four-byte boundaries.
7225
7226 -Wcast-align=strict
7227 Warn whenever a pointer is cast such that the required alignment of
7228 the target is increased. For example, warn if a "char *" is cast
7229 to an "int *" regardless of the target machine.
7230
7231 -Wcast-function-type
7232 Warn when a function pointer is cast to an incompatible function
7233 pointer. In a cast involving function types with a variable
7234 argument list only the types of initial arguments that are provided
7235 are considered. Any parameter of pointer-type matches any other
7236 pointer-type. Any benign differences in integral types are
7237 ignored, like "int" vs. "long" on ILP32 targets. Likewise type
7238 qualifiers are ignored. The function type "void (*) (void)" is
7239 special and matches everything, which can be used to suppress this
7240 warning. In a cast involving pointer to member types this warning
7241 warns whenever the type cast is changing the pointer to member
7242 type. This warning is enabled by -Wextra.
7243
7244 -Wwrite-strings
7245 When compiling C, give string constants the type "const
7246 char[length]" so that copying the address of one into a non-"const"
7247 "char *" pointer produces a warning. These warnings help you find
7248 at compile time code that can try to write into a string constant,
7249 but only if you have been very careful about using "const" in
7250 declarations and prototypes. Otherwise, it is just a nuisance.
7251 This is why we did not make -Wall request these warnings.
7252
7253 When compiling C++, warn about the deprecated conversion from
7254 string literals to "char *". This warning is enabled by default
7255 for C++ programs.
7256
7257 -Wclobbered
7258 Warn for variables that might be changed by "longjmp" or "vfork".
7259 This warning is also enabled by -Wextra.
7260
7261 -Wno-complain-wrong-lang
7262 By default, language front ends complain when a command-line option
7263 is valid, but not applicable to that front end. This may be
7264 disabled with -Wno-complain-wrong-lang, which is mostly useful when
7265 invoking a single compiler driver for multiple source files written
7266 in different languages, for example:
7267
7268 $ g++ -fno-rtti a.cc b.f90
7269
7270 The driver g++ invokes the C++ front end to compile a.cc and the
7271 Fortran front end to compile b.f90. The latter front end diagnoses
7272 f951: Warning: command-line option '-fno-rtti' is valid for
7273 C++/D/ObjC++ but not for Fortran, which may be disabled with
7274 -Wno-complain-wrong-lang.
7275
7276 -Wconversion
7277 Warn for implicit conversions that may alter a value. This includes
7278 conversions between real and integer, like "abs (x)" when "x" is
7279 "double"; conversions between signed and unsigned, like "unsigned
7280 ui = -1"; and conversions to smaller types, like "sqrtf (M_PI)". Do
7281 not warn for explicit casts like "abs ((int) x)" and "ui =
7282 (unsigned) -1", or if the value is not changed by the conversion
7283 like in "abs (2.0)". Warnings about conversions between signed and
7284 unsigned integers can be disabled by using -Wno-sign-conversion.
7285
7286 For C++, also warn for confusing overload resolution for user-
7287 defined conversions; and conversions that never use a type
7288 conversion operator: conversions to "void", the same type, a base
7289 class or a reference to them. Warnings about conversions between
7290 signed and unsigned integers are disabled by default in C++ unless
7291 -Wsign-conversion is explicitly enabled.
7292
7293 Warnings about conversion from arithmetic on a small type back to
7294 that type are only given with -Warith-conversion.
7295
7296 -Wdangling-else
7297 Warn about constructions where there may be confusion to which "if"
7298 statement an "else" branch belongs. Here is an example of such a
7299 case:
7300
7301 {
7302 if (a)
7303 if (b)
7304 foo ();
7305 else
7306 bar ();
7307 }
7308
7309 In C/C++, every "else" branch belongs to the innermost possible
7310 "if" statement, which in this example is "if (b)". This is often
7311 not what the programmer expected, as illustrated in the above
7312 example by indentation the programmer chose. When there is the
7313 potential for this confusion, GCC issues a warning when this flag
7314 is specified. To eliminate the warning, add explicit braces around
7315 the innermost "if" statement so there is no way the "else" can
7316 belong to the enclosing "if". The resulting code looks like this:
7317
7318 {
7319 if (a)
7320 {
7321 if (b)
7322 foo ();
7323 else
7324 bar ();
7325 }
7326 }
7327
7328 This warning is enabled by -Wparentheses.
7329
7330 -Wdangling-pointer
7331 -Wdangling-pointer=n
7332 Warn about uses of pointers (or C++ references) to objects with
7333 automatic storage duration after their lifetime has ended. This
7334 includes local variables declared in nested blocks, compound
7335 literals and other unnamed temporary objects. In addition, warn
7336 about storing the address of such objects in escaped pointers. The
7337 warning is enabled at all optimization levels but may yield
7338 different results with optimization than without.
7339
7340 -Wdangling-pointer=1
7341 At level 1 the warning diagnoses only unconditional uses of
7342 dangling pointers. For example
7343
7344 int f (int c1, int c2, x)
7345 {
7346 char *p = strchr ((char[]){ c1, c2 }, c3);
7347 // warning: dangling pointer to a compound literal
7348 return p ? *p : 'x';
7349 }
7350
7351 In the following function the store of the address of the local
7352 variable "x" in the escaped pointer *p also triggers the
7353 warning.
7354
7355 void g (int **p)
7356 {
7357 int x = 7;
7358 // warning: storing the address of a local variable in *p
7359 *p = &x;
7360 }
7361
7362 -Wdangling-pointer=2
7363 At level 2, in addition to unconditional uses the warning also
7364 diagnoses conditional uses of dangling pointers.
7365
7366 For example, because the array a in the following function is
7367 out of scope when the pointer s that was set to point is used,
7368 the warning triggers at this level.
7369
7370 void f (char *s)
7371 {
7372 if (!s)
7373 {
7374 char a[12] = "tmpname";
7375 s = a;
7376 }
7377 // warning: dangling pointer to a may be used
7378 strcat (s, ".tmp");
7379 ...
7380 }
7381
7382 -Wdangling-pointer=2 is included in -Wall.
7383
7384 -Wdate-time
7385 Warn when macros "__TIME__", "__DATE__" or "__TIMESTAMP__" are
7386 encountered as they might prevent bit-wise-identical reproducible
7387 compilations.
7388
7389 -Wempty-body
7390 Warn if an empty body occurs in an "if", "else" or "do while"
7391 statement. This warning is also enabled by -Wextra.
7392
7393 -Wno-endif-labels
7394 Do not warn about stray tokens after "#else" and "#endif".
7395
7396 -Wenum-compare
7397 Warn about a comparison between values of different enumerated
7398 types. In C++ enumerated type mismatches in conditional
7399 expressions are also diagnosed and the warning is enabled by
7400 default. In C this warning is enabled by -Wall.
7401
7402 -Wenum-conversion
7403 Warn when a value of enumerated type is implicitly converted to a
7404 different enumerated type. This warning is enabled by -Wextra in
7405 C.
7406
7407 -Wenum-int-mismatch (C and Objective-C only)
7408 Warn about mismatches between an enumerated type and an integer
7409 type in declarations. For example:
7410
7411 enum E { l = -1, z = 0, g = 1 };
7412 int foo(void);
7413 enum E foo(void);
7414
7415 In C, an enumerated type is compatible with "char", a signed
7416 integer type, or an unsigned integer type. However, since the
7417 choice of the underlying type of an enumerated type is
7418 implementation-defined, such mismatches may cause portability
7419 issues. In C++, such mismatches are an error. In C, this warning
7420 is enabled by -Wall and -Wc++-compat.
7421
7422 -Wjump-misses-init (C, Objective-C only)
7423 Warn if a "goto" statement or a "switch" statement jumps forward
7424 across the initialization of a variable, or jumps backward to a
7425 label after the variable has been initialized. This only warns
7426 about variables that are initialized when they are declared. This
7427 warning is only supported for C and Objective-C; in C++ this sort
7428 of branch is an error in any case.
7429
7430 -Wjump-misses-init is included in -Wc++-compat. It can be disabled
7431 with the -Wno-jump-misses-init option.
7432
7433 -Wsign-compare
7434 Warn when a comparison between signed and unsigned values could
7435 produce an incorrect result when the signed value is converted to
7436 unsigned. In C++, this warning is also enabled by -Wall. In C, it
7437 is also enabled by -Wextra.
7438
7439 -Wsign-conversion
7440 Warn for implicit conversions that may change the sign of an
7441 integer value, like assigning a signed integer expression to an
7442 unsigned integer variable. An explicit cast silences the warning.
7443 In C, this option is enabled also by -Wconversion.
7444
7445 -Wfloat-conversion
7446 Warn for implicit conversions that reduce the precision of a real
7447 value. This includes conversions from real to integer, and from
7448 higher precision real to lower precision real values. This option
7449 is also enabled by -Wconversion.
7450
7451 -Wno-scalar-storage-order
7452 Do not warn on suspicious constructs involving reverse scalar
7453 storage order.
7454
7455 -Wsizeof-array-div
7456 Warn about divisions of two sizeof operators when the first one is
7457 applied to an array and the divisor does not equal the size of the
7458 array element. In such a case, the computation will not yield the
7459 number of elements in the array, which is likely what the user
7460 intended. This warning warns e.g. about
7461
7462 int fn ()
7463 {
7464 int arr[10];
7465 return sizeof (arr) / sizeof (short);
7466 }
7467
7468 This warning is enabled by -Wall.
7469
7470 -Wsizeof-pointer-div
7471 Warn for suspicious divisions of two sizeof expressions that divide
7472 the pointer size by the element size, which is the usual way to
7473 compute the array size but won't work out correctly with pointers.
7474 This warning warns e.g. about "sizeof (ptr) / sizeof (ptr[0])" if
7475 "ptr" is not an array, but a pointer. This warning is enabled by
7476 -Wall.
7477
7478 -Wsizeof-pointer-memaccess
7479 Warn for suspicious length parameters to certain string and memory
7480 built-in functions if the argument uses "sizeof". This warning
7481 triggers for example for "memset (ptr, 0, sizeof (ptr));" if "ptr"
7482 is not an array, but a pointer, and suggests a possible fix, or
7483 about "memcpy (&foo, ptr, sizeof (&foo));".
7484 -Wsizeof-pointer-memaccess also warns about calls to bounded string
7485 copy functions like "strncat" or "strncpy" that specify as the
7486 bound a "sizeof" expression of the source array. For example, in
7487 the following function the call to "strncat" specifies the size of
7488 the source string as the bound. That is almost certainly a mistake
7489 and so the call is diagnosed.
7490
7491 void make_file (const char *name)
7492 {
7493 char path[PATH_MAX];
7494 strncpy (path, name, sizeof path - 1);
7495 strncat (path, ".text", sizeof ".text");
7496 ...
7497 }
7498
7499 The -Wsizeof-pointer-memaccess option is enabled by -Wall.
7500
7501 -Wno-sizeof-array-argument
7502 Do not warn when the "sizeof" operator is applied to a parameter
7503 that is declared as an array in a function definition. This
7504 warning is enabled by default for C and C++ programs.
7505
7506 -Wmemset-elt-size
7507 Warn for suspicious calls to the "memset" built-in function, if the
7508 first argument references an array, and the third argument is a
7509 number equal to the number of elements, but not equal to the size
7510 of the array in memory. This indicates that the user has omitted a
7511 multiplication by the element size. This warning is enabled by
7512 -Wall.
7513
7514 -Wmemset-transposed-args
7515 Warn for suspicious calls to the "memset" built-in function where
7516 the second argument is not zero and the third argument is zero.
7517 For example, the call "memset (buf, sizeof buf, 0)" is diagnosed
7518 because "memset (buf, 0, sizeof buf)" was meant instead. The
7519 diagnostic is only emitted if the third argument is a literal zero.
7520 Otherwise, if it is an expression that is folded to zero, or a cast
7521 of zero to some type, it is far less likely that the arguments have
7522 been mistakenly transposed and no warning is emitted. This warning
7523 is enabled by -Wall.
7524
7525 -Waddress
7526 Warn about suspicious uses of address expressions. These include
7527 comparing the address of a function or a declared object to the
7528 null pointer constant such as in
7529
7530 void f (void);
7531 void g (void)
7532 {
7533 if (!f) // warning: expression evaluates to false
7534 abort ();
7535 }
7536
7537 comparisons of a pointer to a string literal, such as in
7538
7539 void f (const char *x)
7540 {
7541 if (x == "abc") // warning: expression evaluates to false
7542 puts ("equal");
7543 }
7544
7545 and tests of the results of pointer addition or subtraction for
7546 equality to null, such as in
7547
7548 void f (const int *p, int i)
7549 {
7550 return p + i == NULL;
7551 }
7552
7553 Such uses typically indicate a programmer error: the address of
7554 most functions and objects necessarily evaluates to true (the
7555 exception are weak symbols), so their use in a conditional might
7556 indicate missing parentheses in a function call or a missing
7557 dereference in an array expression. The subset of the warning for
7558 object pointers can be suppressed by casting the pointer operand to
7559 an integer type such as "intptr_t" or "uintptr_t". Comparisons
7560 against string literals result in unspecified behavior and are not
7561 portable, and suggest the intent was to call "strcmp". The warning
7562 is suppressed if the suspicious expression is the result of macro
7563 expansion. -Waddress warning is enabled by -Wall.
7564
7565 -Wno-address-of-packed-member
7566 Do not warn when the address of packed member of struct or union is
7567 taken, which usually results in an unaligned pointer value. This
7568 is enabled by default.
7569
7570 -Wlogical-op
7571 Warn about suspicious uses of logical operators in expressions.
7572 This includes using logical operators in contexts where a bit-wise
7573 operator is likely to be expected. Also warns when the operands of
7574 a logical operator are the same:
7575
7576 extern int a;
7577 if (a < 0 && a < 0) { ... }
7578
7579 -Wlogical-not-parentheses
7580 Warn about logical not used on the left hand side operand of a
7581 comparison. This option does not warn if the right operand is
7582 considered to be a boolean expression. Its purpose is to detect
7583 suspicious code like the following:
7584
7585 int a;
7586 ...
7587 if (!a > 1) { ... }
7588
7589 It is possible to suppress the warning by wrapping the LHS into
7590 parentheses:
7591
7592 if ((!a) > 1) { ... }
7593
7594 This warning is enabled by -Wall.
7595
7596 -Waggregate-return
7597 Warn if any functions that return structures or unions are defined
7598 or called. (In languages where you can return an array, this also
7599 elicits a warning.)
7600
7601 -Wno-aggressive-loop-optimizations
7602 Warn if in a loop with constant number of iterations the compiler
7603 detects undefined behavior in some statement during one or more of
7604 the iterations.
7605
7606 -Wno-attributes
7607 Do not warn if an unexpected "__attribute__" is used, such as
7608 unrecognized attributes, function attributes applied to variables,
7609 etc. This does not stop errors for incorrect use of supported
7610 attributes.
7611
7612 Additionally, using -Wno-attributes=, it is possible to suppress
7613 warnings about unknown scoped attributes (in C++11 and C2X). For
7614 example, -Wno-attributes=vendor::attr disables warning about the
7615 following declaration:
7616
7617 [[vendor::attr]] void f();
7618
7619 It is also possible to disable warning about all attributes in a
7620 namespace using -Wno-attributes=vendor:: which prevents warning
7621 about both of these declarations:
7622
7623 [[vendor::safe]] void f();
7624 [[vendor::unsafe]] void f2();
7625
7626 Note that -Wno-attributes= does not imply -Wno-attributes.
7627
7628 -Wno-builtin-declaration-mismatch
7629 Warn if a built-in function is declared with an incompatible
7630 signature or as a non-function, or when a built-in function
7631 declared with a type that does not include a prototype is called
7632 with arguments whose promoted types do not match those expected by
7633 the function. When -Wextra is specified, also warn when a built-in
7634 function that takes arguments is declared without a prototype. The
7635 -Wbuiltin-declaration-mismatch warning is enabled by default. To
7636 avoid the warning include the appropriate header to bring the
7637 prototypes of built-in functions into scope.
7638
7639 For example, the call to "memset" below is diagnosed by the warning
7640 because the function expects a value of type "size_t" as its
7641 argument but the type of 32 is "int". With -Wextra, the
7642 declaration of the function is diagnosed as well.
7643
7644 extern void* memset ();
7645 void f (void *d)
7646 {
7647 memset (d, '\0', 32);
7648 }
7649
7650 -Wno-builtin-macro-redefined
7651 Do not warn if certain built-in macros are redefined. This
7652 suppresses warnings for redefinition of "__TIMESTAMP__",
7653 "__TIME__", "__DATE__", "__FILE__", and "__BASE_FILE__".
7654
7655 -Wstrict-prototypes (C and Objective-C only)
7656 Warn if a function is declared or defined without specifying the
7657 argument types. (An old-style function definition is permitted
7658 without a warning if preceded by a declaration that specifies the
7659 argument types.)
7660
7661 -Wold-style-declaration (C and Objective-C only)
7662 Warn for obsolescent usages, according to the C Standard, in a
7663 declaration. For example, warn if storage-class specifiers like
7664 "static" are not the first things in a declaration. This warning
7665 is also enabled by -Wextra.
7666
7667 -Wold-style-definition (C and Objective-C only)
7668 Warn if an old-style function definition is used. A warning is
7669 given even if there is a previous prototype. A definition using ()
7670 is not considered an old-style definition in C2X mode, because it
7671 is equivalent to (void) in that case, but is considered an old-
7672 style definition for older standards.
7673
7674 -Wmissing-parameter-type (C and Objective-C only)
7675 A function parameter is declared without a type specifier in
7676 K&R-style functions:
7677
7678 void foo(bar) { }
7679
7680 This warning is also enabled by -Wextra.
7681
7682 -Wmissing-prototypes (C and Objective-C only)
7683 Warn if a global function is defined without a previous prototype
7684 declaration. This warning is issued even if the definition itself
7685 provides a prototype. Use this option to detect global functions
7686 that do not have a matching prototype declaration in a header file.
7687 This option is not valid for C++ because all function declarations
7688 provide prototypes and a non-matching declaration declares an
7689 overload rather than conflict with an earlier declaration. Use
7690 -Wmissing-declarations to detect missing declarations in C++.
7691
7692 -Wmissing-declarations
7693 Warn if a global function is defined without a previous
7694 declaration. Do so even if the definition itself provides a
7695 prototype. Use this option to detect global functions that are not
7696 declared in header files. In C, no warnings are issued for
7697 functions with previous non-prototype declarations; use
7698 -Wmissing-prototypes to detect missing prototypes. In C++, no
7699 warnings are issued for function templates, or for inline
7700 functions, or for functions in anonymous namespaces.
7701
7702 -Wmissing-field-initializers
7703 Warn if a structure's initializer has some fields missing. For
7704 example, the following code causes such a warning, because "x.h" is
7705 implicitly zero:
7706
7707 struct s { int f, g, h; };
7708 struct s x = { 3, 4 };
7709
7710 This option does not warn about designated initializers, so the
7711 following modification does not trigger a warning:
7712
7713 struct s { int f, g, h; };
7714 struct s x = { .f = 3, .g = 4 };
7715
7716 In C this option does not warn about the universal zero initializer
7717 { 0 }:
7718
7719 struct s { int f, g, h; };
7720 struct s x = { 0 };
7721
7722 Likewise, in C++ this option does not warn about the empty { }
7723 initializer, for example:
7724
7725 struct s { int f, g, h; };
7726 s x = { };
7727
7728 This warning is included in -Wextra. To get other -Wextra warnings
7729 without this one, use -Wextra -Wno-missing-field-initializers.
7730
7731 -Wno-missing-requires
7732 By default, the compiler warns about a concept-id appearing as a
7733 C++20 simple-requirement:
7734
7735 bool satisfied = requires { C<T> };
7736
7737 Here satisfied will be true if C<T> is a valid expression, which it
7738 is for all T. Presumably the user meant to write
7739
7740 bool satisfied = requires { requires C<T> };
7741
7742 so satisfied is only true if concept C is satisfied for type T.
7743
7744 This warning can be disabled with -Wno-missing-requires.
7745
7746 -Wno-missing-template-keyword
7747 The member access tokens ., -> and :: must be followed by the
7748 "template" keyword if the parent object is dependent and the member
7749 being named is a template.
7750
7751 template <class X>
7752 void DoStuff (X x)
7753 {
7754 x.template DoSomeOtherStuff<X>(); // Good.
7755 x.DoMoreStuff<X>(); // Warning, x is dependent.
7756 }
7757
7758 In rare cases it is possible to get false positives. To silence
7759 this, wrap the expression in parentheses. For example, the
7760 following is treated as a template, even where m and N are
7761 integers:
7762
7763 void NotATemplate (my_class t)
7764 {
7765 int N = 5;
7766
7767 bool test = t.m < N > (0); // Treated as a template.
7768 test = (t.m < N) > (0); // Same meaning, but not treated as a template.
7769 }
7770
7771 This warning can be disabled with -Wno-missing-template-keyword.
7772
7773 -Wno-multichar
7774 Do not warn if a multicharacter constant ('FOOF') is used. Usually
7775 they indicate a typo in the user's code, as they have
7776 implementation-defined values, and should not be used in portable
7777 code.
7778
7779 -Wnormalized=[none|id|nfc|nfkc]
7780 In ISO C and ISO C++, two identifiers are different if they are
7781 different sequences of characters. However, sometimes when
7782 characters outside the basic ASCII character set are used, you can
7783 have two different character sequences that look the same. To
7784 avoid confusion, the ISO 10646 standard sets out some normalization
7785 rules which when applied ensure that two sequences that look the
7786 same are turned into the same sequence. GCC can warn you if you
7787 are using identifiers that have not been normalized; this option
7788 controls that warning.
7789
7790 There are four levels of warning supported by GCC. The default is
7791 -Wnormalized=nfc, which warns about any identifier that is not in
7792 the ISO 10646 "C" normalized form, NFC. NFC is the recommended
7793 form for most uses. It is equivalent to -Wnormalized.
7794
7795 Unfortunately, there are some characters allowed in identifiers by
7796 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7797 identifiers. That is, there's no way to use these symbols in
7798 portable ISO C or C++ and have all your identifiers in NFC.
7799 -Wnormalized=id suppresses the warning for these characters. It is
7800 hoped that future versions of the standards involved will correct
7801 this, which is why this option is not the default.
7802
7803 You can switch the warning off for all characters by writing
7804 -Wnormalized=none or -Wno-normalized. You should only do this if
7805 you are using some other normalization scheme (like "D"), because
7806 otherwise you can easily create bugs that are literally impossible
7807 to see.
7808
7809 Some characters in ISO 10646 have distinct meanings but look
7810 identical in some fonts or display methodologies, especially once
7811 formatting has been applied. For instance "\u207F", "SUPERSCRIPT
7812 LATIN SMALL LETTER N", displays just like a regular "n" that has
7813 been placed in a superscript. ISO 10646 defines the NFKC
7814 normalization scheme to convert all these into a standard form as
7815 well, and GCC warns if your code is not in NFKC if you use
7816 -Wnormalized=nfkc. This warning is comparable to warning about
7817 every identifier that contains the letter O because it might be
7818 confused with the digit 0, and so is not the default, but may be
7819 useful as a local coding convention if the programming environment
7820 cannot be fixed to display these characters distinctly.
7821
7822 -Wno-attribute-warning
7823 Do not warn about usage of functions declared with "warning"
7824 attribute. By default, this warning is enabled.
7825 -Wno-attribute-warning can be used to disable the warning or
7826 -Wno-error=attribute-warning can be used to disable the error when
7827 compiled with -Werror flag.
7828
7829 -Wno-deprecated
7830 Do not warn about usage of deprecated features.
7831
7832 -Wno-deprecated-declarations
7833 Do not warn about uses of functions, variables, and types marked as
7834 deprecated by using the "deprecated" attribute.
7835
7836 -Wno-overflow
7837 Do not warn about compile-time overflow in constant expressions.
7838
7839 -Wno-odr
7840 Warn about One Definition Rule violations during link-time
7841 optimization. Enabled by default.
7842
7843 -Wopenacc-parallelism
7844 Warn about potentially suboptimal choices related to OpenACC
7845 parallelism.
7846
7847 -Wopenmp-simd
7848 Warn if the vectorizer cost model overrides the OpenMP simd
7849 directive set by user. The -fsimd-cost-model=unlimited option can
7850 be used to relax the cost model.
7851
7852 -Woverride-init (C and Objective-C only)
7853 Warn if an initialized field without side effects is overridden
7854 when using designated initializers.
7855
7856 This warning is included in -Wextra. To get other -Wextra warnings
7857 without this one, use -Wextra -Wno-override-init.
7858
7859 -Wno-override-init-side-effects (C and Objective-C only)
7860 Do not warn if an initialized field with side effects is overridden
7861 when using designated initializers. This warning is enabled by
7862 default.
7863
7864 -Wpacked
7865 Warn if a structure is given the packed attribute, but the packed
7866 attribute has no effect on the layout or size of the structure.
7867 Such structures may be mis-aligned for little benefit. For
7868 instance, in this code, the variable "f.x" in "struct bar" is
7869 misaligned even though "struct bar" does not itself have the packed
7870 attribute:
7871
7872 struct foo {
7873 int x;
7874 char a, b, c, d;
7875 } __attribute__((packed));
7876 struct bar {
7877 char z;
7878 struct foo f;
7879 };
7880
7881 -Wnopacked-bitfield-compat
7882 The 4.1, 4.2 and 4.3 series of GCC ignore the "packed" attribute on
7883 bit-fields of type "char". This was fixed in GCC 4.4 but the
7884 change can lead to differences in the structure layout. GCC
7885 informs you when the offset of such a field has changed in GCC 4.4.
7886 For example there is no longer a 4-bit padding between field "a"
7887 and "b" in this structure:
7888
7889 struct foo
7890 {
7891 char a:4;
7892 char b:8;
7893 } __attribute__ ((packed));
7894
7895 This warning is enabled by default. Use
7896 -Wno-packed-bitfield-compat to disable this warning.
7897
7898 -Wpacked-not-aligned (C, C++, Objective-C and Objective-C++ only)
7899 Warn if a structure field with explicitly specified alignment in a
7900 packed struct or union is misaligned. For example, a warning will
7901 be issued on "struct S", like, "warning: alignment 1 of 'struct S'
7902 is less than 8", in this code:
7903
7904 struct __attribute__ ((aligned (8))) S8 { char a[8]; };
7905 struct __attribute__ ((packed)) S {
7906 struct S8 s8;
7907 };
7908
7909 This warning is enabled by -Wall.
7910
7911 -Wpadded
7912 Warn if padding is included in a structure, either to align an
7913 element of the structure or to align the whole structure.
7914 Sometimes when this happens it is possible to rearrange the fields
7915 of the structure to reduce the padding and so make the structure
7916 smaller.
7917
7918 -Wredundant-decls
7919 Warn if anything is declared more than once in the same scope, even
7920 in cases where multiple declaration is valid and changes nothing.
7921
7922 -Wrestrict
7923 Warn when an object referenced by a "restrict"-qualified parameter
7924 (or, in C++, a "__restrict"-qualified parameter) is aliased by
7925 another argument, or when copies between such objects overlap. For
7926 example, the call to the "strcpy" function below attempts to
7927 truncate the string by replacing its initial characters with the
7928 last four. However, because the call writes the terminating NUL
7929 into "a[4]", the copies overlap and the call is diagnosed.
7930
7931 void foo (void)
7932 {
7933 char a[] = "abcd1234";
7934 strcpy (a, a + 4);
7935 ...
7936 }
7937
7938 The -Wrestrict option detects some instances of simple overlap even
7939 without optimization but works best at -O2 and above. It is
7940 included in -Wall.
7941
7942 -Wnested-externs (C and Objective-C only)
7943 Warn if an "extern" declaration is encountered within a function.
7944
7945 -Winline
7946 Warn if a function that is declared as inline cannot be inlined.
7947 Even with this option, the compiler does not warn about failures to
7948 inline functions declared in system headers.
7949
7950 The compiler uses a variety of heuristics to determine whether or
7951 not to inline a function. For example, the compiler takes into
7952 account the size of the function being inlined and the amount of
7953 inlining that has already been done in the current function.
7954 Therefore, seemingly insignificant changes in the source program
7955 can cause the warnings produced by -Winline to appear or disappear.
7956
7957 -Winterference-size
7958 Warn about use of C++17
7959 "std::hardware_destructive_interference_size" without specifying
7960 its value with --param destructive-interference-size. Also warn
7961 about questionable values for that option.
7962
7963 This variable is intended to be used for controlling class layout,
7964 to avoid false sharing in concurrent code:
7965
7966 struct independent_fields {
7967 alignas(std::hardware_destructive_interference_size)
7968 std::atomic<int> one;
7969 alignas(std::hardware_destructive_interference_size)
7970 std::atomic<int> two;
7971 };
7972
7973 Here one and two are intended to be far enough apart that stores to
7974 one won't require accesses to the other to reload the cache line.
7975
7976 By default, --param destructive-interference-size and --param
7977 constructive-interference-size are set based on the current -mtune
7978 option, typically to the L1 cache line size for the particular
7979 target CPU, sometimes to a range if tuning for a generic target.
7980 So all translation units that depend on ABI compatibility for the
7981 use of these variables must be compiled with the same -mtune (or
7982 -mcpu).
7983
7984 If ABI stability is important, such as if the use is in a header
7985 for a library, you should probably not use the hardware
7986 interference size variables at all. Alternatively, you can force a
7987 particular value with --param.
7988
7989 If you are confident that your use of the variable does not affect
7990 ABI outside a single build of your project, you can turn off the
7991 warning with -Wno-interference-size.
7992
7993 -Wint-in-bool-context
7994 Warn for suspicious use of integer values where boolean values are
7995 expected, such as conditional expressions (?:) using non-boolean
7996 integer constants in boolean context, like "if (a <= b ? 2 : 3)".
7997 Or left shifting of signed integers in boolean context, like "for
7998 (a = 0; 1 << a; a++);". Likewise for all kinds of multiplications
7999 regardless of the data type. This warning is enabled by -Wall.
8000
8001 -Wno-int-to-pointer-cast
8002 Suppress warnings from casts to pointer type of an integer of a
8003 different size. In C++, casting to a pointer type of smaller size
8004 is an error. Wint-to-pointer-cast is enabled by default.
8005
8006 -Wno-pointer-to-int-cast (C and Objective-C only)
8007 Suppress warnings from casts from a pointer to an integer type of a
8008 different size.
8009
8010 -Winvalid-pch
8011 Warn if a precompiled header is found in the search path but cannot
8012 be used.
8013
8014 -Winvalid-utf8
8015 Warn if an invalid UTF-8 character is found. This warning is on by
8016 default for C++23 if -finput-charset=UTF-8 is used and turned into
8017 error with -pedantic-errors.
8018
8019 -Wno-unicode
8020 Don't diagnose invalid forms of delimited or named escape sequences
8021 which are treated as separate tokens. Wunicode is enabled by
8022 default.
8023
8024 -Wlong-long
8025 Warn if "long long" type is used. This is enabled by either
8026 -Wpedantic or -Wtraditional in ISO C90 and C++98 modes. To inhibit
8027 the warning messages, use -Wno-long-long.
8028
8029 -Wvariadic-macros
8030 Warn if variadic macros are used in ISO C90 mode, or if the GNU
8031 alternate syntax is used in ISO C99 mode. This is enabled by
8032 either -Wpedantic or -Wtraditional. To inhibit the warning
8033 messages, use -Wno-variadic-macros.
8034
8035 -Wno-varargs
8036 Do not warn upon questionable usage of the macros used to handle
8037 variable arguments like "va_start". These warnings are enabled by
8038 default.
8039
8040 -Wvector-operation-performance
8041 Warn if vector operation is not implemented via SIMD capabilities
8042 of the architecture. Mainly useful for the performance tuning.
8043 Vector operation can be implemented "piecewise", which means that
8044 the scalar operation is performed on every vector element; "in
8045 parallel", which means that the vector operation is implemented
8046 using scalars of wider type, which normally is more performance
8047 efficient; and "as a single scalar", which means that vector fits
8048 into a scalar type.
8049
8050 -Wvla
8051 Warn if a variable-length array is used in the code. -Wno-vla
8052 prevents the -Wpedantic warning of the variable-length array.
8053
8054 -Wvla-larger-than=byte-size
8055 If this option is used, the compiler warns for declarations of
8056 variable-length arrays whose size is either unbounded, or bounded
8057 by an argument that allows the array size to exceed byte-size
8058 bytes. This is similar to how -Walloca-larger-than=byte-size
8059 works, but with variable-length arrays.
8060
8061 Note that GCC may optimize small variable-length arrays of a known
8062 value into plain arrays, so this warning may not get triggered for
8063 such arrays.
8064
8065 -Wvla-larger-than=PTRDIFF_MAX is enabled by default but is
8066 typically only effective when -ftree-vrp is active (default for -O2
8067 and above).
8068
8069 See also -Walloca-larger-than=byte-size.
8070
8071 -Wno-vla-larger-than
8072 Disable -Wvla-larger-than= warnings. The option is equivalent to
8073 -Wvla-larger-than=SIZE_MAX or larger.
8074
8075 -Wvla-parameter
8076 Warn about redeclarations of functions involving arguments of
8077 Variable Length Array types of inconsistent kinds or forms, and
8078 enable the detection of out-of-bounds accesses to such parameters
8079 by warnings such as -Warray-bounds.
8080
8081 If the first function declaration uses the VLA form the bound
8082 specified in the array is assumed to be the minimum number of
8083 elements expected to be provided in calls to the function and the
8084 maximum number of elements accessed by it. Failing to provide
8085 arguments of sufficient size or accessing more than the maximum
8086 number of elements may be diagnosed.
8087
8088 For example, the warning triggers for the following redeclarations
8089 because the first one allows an array of any size to be passed to
8090 "f" while the second one specifies that the array argument must
8091 have at least "n" elements. In addition, calling "f" with the
8092 associated VLA bound parameter in excess of the actual VLA bound
8093 triggers a warning as well.
8094
8095 void f (int n, int[n]);
8096 // warning: argument 2 previously declared as a VLA
8097 void f (int, int[]);
8098
8099 void g (int n)
8100 {
8101 if (n > 4)
8102 return;
8103 int a[n];
8104 // warning: access to a by f may be out of bounds
8105 f (sizeof a, a);
8106 ...
8107 }
8108
8109 -Wvla-parameter is included in -Wall. The -Warray-parameter option
8110 triggers warnings for similar problems involving ordinary array
8111 arguments.
8112
8113 -Wvolatile-register-var
8114 Warn if a register variable is declared volatile. The volatile
8115 modifier does not inhibit all optimizations that may eliminate
8116 reads and/or writes to register variables. This warning is enabled
8117 by -Wall.
8118
8119 -Wxor-used-as-pow (C, C++, Objective-C and Objective-C++ only)
8120 Warn about uses of "^", the exclusive or operator, where it appears
8121 the user meant exponentiation. Specifically, the warning occurs
8122 when the left-hand side is the decimal constant 2 or 10 and the
8123 right-hand side is also a decimal constant.
8124
8125 In C and C++, "^" means exclusive or, whereas in some other
8126 languages (e.g. TeX and some versions of BASIC) it means
8127 exponentiation.
8128
8129 This warning is enabled by default. It can be silenced by
8130 converting one of the operands to hexadecimal.
8131
8132 -Wdisabled-optimization
8133 Warn if a requested optimization pass is disabled. This warning
8134 does not generally indicate that there is anything wrong with your
8135 code; it merely indicates that GCC's optimizers are unable to
8136 handle the code effectively. Often, the problem is that your code
8137 is too big or too complex; GCC refuses to optimize programs when
8138 the optimization itself is likely to take inordinate amounts of
8139 time.
8140
8141 -Wpointer-sign (C and Objective-C only)
8142 Warn for pointer argument passing or assignment with different
8143 signedness. This option is only supported for C and Objective-C.
8144 It is implied by -Wall and by -Wpedantic, which can be disabled
8145 with -Wno-pointer-sign.
8146
8147 -Wstack-protector
8148 This option is only active when -fstack-protector is active. It
8149 warns about functions that are not protected against stack
8150 smashing.
8151
8152 -Woverlength-strings
8153 Warn about string constants that are longer than the "minimum
8154 maximum" length specified in the C standard. Modern compilers
8155 generally allow string constants that are much longer than the
8156 standard's minimum limit, but very portable programs should avoid
8157 using longer strings.
8158
8159 The limit applies after string constant concatenation, and does not
8160 count the trailing NUL. In C90, the limit was 509 characters; in
8161 C99, it was raised to 4095. C++98 does not specify a normative
8162 minimum maximum, so we do not diagnose overlength strings in C++.
8163
8164 This option is implied by -Wpedantic, and can be disabled with
8165 -Wno-overlength-strings.
8166
8167 -Wunsuffixed-float-constants (C and Objective-C only)
8168 Issue a warning for any floating constant that does not have a
8169 suffix. When used together with -Wsystem-headers it warns about
8170 such constants in system header files. This can be useful when
8171 preparing code to use with the "FLOAT_CONST_DECIMAL64" pragma from
8172 the decimal floating-point extension to C99.
8173
8174 -Wno-lto-type-mismatch
8175 During the link-time optimization, do not warn about type
8176 mismatches in global declarations from different compilation units.
8177 Requires -flto to be enabled. Enabled by default.
8178
8179 -Wno-designated-init (C and Objective-C only)
8180 Suppress warnings when a positional initializer is used to
8181 initialize a structure that has been marked with the
8182 "designated_init" attribute.
8183
8184 Options That Control Static Analysis
8185 -fanalyzer
8186 This option enables an static analysis of program flow which looks
8187 for "interesting" interprocedural paths through the code, and
8188 issues warnings for problems found on them.
8189
8190 This analysis is much more expensive than other GCC warnings.
8191
8192 In technical terms, it performs coverage-guided symbolic execution
8193 of the code being compiled. It is neither sound nor complete: it
8194 can have false positives and false negatives. It is a bug-finding
8195 tool, rather than a tool for proving program correctness.
8196
8197 The analyzer is only suitable for use on C code in this release.
8198
8199 Enabling this option effectively enables the following warnings:
8200
8201 -Wanalyzer-allocation-size -Wanalyzer-deref-before-check
8202 -Wanalyzer-double-fclose -Wanalyzer-double-free
8203 -Wanalyzer-exposure-through-output-file
8204 -Wanalyzer-exposure-through-uninit-copy
8205 -Wanalyzer-fd-access-mode-mismatch -Wanalyzer-fd-double-close
8206 -Wanalyzer-fd-leak -Wanalyzer-fd-phase-mismatch
8207 -Wanalyzer-fd-type-mismatch -Wanalyzer-fd-use-after-close
8208 -Wanalyzer-fd-use-without-check -Wanalyzer-file-leak
8209 -Wanalyzer-free-of-non-heap -Wanalyzer-imprecise-fp-arithmetic
8210 -Wanalyzer-infinite-recursion -Wanalyzer-jump-through-null
8211 -Wanalyzer-malloc-leak -Wanalyzer-mismatching-deallocation
8212 -Wanalyzer-null-argument -Wanalyzer-null-dereference
8213 -Wanalyzer-out-of-bounds -Wanalyzer-possible-null-argument
8214 -Wanalyzer-possible-null-dereference -Wanalyzer-putenv-of-auto-var
8215 -Wanalyzer-shift-count-negative -Wanalyzer-shift-count-overflow
8216 -Wanalyzer-stale-setjmp-buffer
8217 -Wanalyzer-unsafe-call-within-signal-handler
8218 -Wanalyzer-use-after-free
8219 -Wanalyzer-use-of-pointer-in-stale-stack-frame
8220 -Wanalyzer-use-of-uninitialized-value
8221 -Wanalyzer-va-arg-type-mismatch -Wanalyzer-va-list-exhausted
8222 -Wanalyzer-va-list-leak -Wanalyzer-va-list-use-after-va-end
8223 -Wanalyzer-write-to-const -Wanalyzer-write-to-string-literal
8224
8225 This option is only available if GCC was configured with analyzer
8226 support enabled.
8227
8228 -Wanalyzer-too-complex
8229 If -fanalyzer is enabled, the analyzer uses various heuristics to
8230 attempt to explore the control flow and data flow in the program,
8231 but these can be defeated by sufficiently complicated code.
8232
8233 By default, the analysis silently stops if the code is too
8234 complicated for the analyzer to fully explore and it reaches an
8235 internal limit. The -Wanalyzer-too-complex option warns if this
8236 occurs.
8237
8238 -Wno-analyzer-allocation-size
8239 This warning requires -fanalyzer, which enables it; to disable it,
8240 use -Wno-analyzer-allocation-size.
8241
8242 This diagnostic warns for paths through the code in which a pointer
8243 to a buffer is assigned to point at a buffer with a size that is
8244 not a multiple of "sizeof (*pointer)".
8245
8246 See CWE-131: Incorrect Calculation of Buffer Size
8247 ("https://cwe.mitre.org/data/definitions/131.html").
8248
8249 -Wno-analyzer-deref-before-check
8250 This warning requires -fanalyzer, which enables it; use
8251 -Wno-analyzer-deref-before-check to disable it.
8252
8253 This diagnostic warns for paths through the code in which a pointer
8254 is checked for "NULL" *after* it has already been dereferenced,
8255 suggesting that the pointer could have been NULL. Such cases
8256 suggest that the check for NULL is either redundant, or that it
8257 needs to be moved to before the pointer is dereferenced.
8258
8259 This diagnostic also considers values passed to a function argument
8260 marked with "__attribute__((nonnull))" as requiring a non-NULL
8261 value, and thus will complain if such values are checked for "NULL"
8262 after returning from such a function call.
8263
8264 This diagnostic is unlikely to be reported when any level of
8265 optimization is enabled, as GCC's optimization logic will typically
8266 consider such checks for NULL as being redundant, and optimize them
8267 away before the analyzer "sees" them. Hence optimization should be
8268 disabled when attempting to trigger this diagnostic.
8269
8270 -Wno-analyzer-double-fclose
8271 This warning requires -fanalyzer, which enables it; use
8272 -Wno-analyzer-double-fclose to disable it.
8273
8274 This diagnostic warns for paths through the code in which a "FILE
8275 *" can have "fclose" called on it more than once.
8276
8277 See CWE-1341: Multiple Releases of Same Resource or Handle
8278 ("https://cwe.mitre.org/data/definitions/1341.html").
8279
8280 -Wno-analyzer-double-free
8281 This warning requires -fanalyzer, which enables it; use
8282 -Wno-analyzer-double-free to disable it.
8283
8284 This diagnostic warns for paths through the code in which a pointer
8285 can have a deallocator called on it more than once, either "free",
8286 or a deallocator referenced by attribute "malloc".
8287
8288 See CWE-415: Double Free
8289 ("https://cwe.mitre.org/data/definitions/415.html").
8290
8291 -Wno-analyzer-exposure-through-output-file
8292 This warning requires -fanalyzer, which enables it; use
8293 -Wno-analyzer-exposure-through-output-file to disable it.
8294
8295 This diagnostic warns for paths through the code in which a
8296 security-sensitive value is written to an output file (such as
8297 writing a password to a log file).
8298
8299 See CWE-532: Information Exposure Through Log Files
8300 ("https://cwe.mitre.org/data/definitions/532.html").
8301
8302 -Wanalyzer-exposure-through-uninit-copy
8303 This warning requires both -fanalyzer and the use of a plugin to
8304 specify a function that copies across a "trust boundary". Use
8305 -Wno-analyzer-exposure-through-uninit-copy to disable it.
8306
8307 This diagnostic warns for "infoleaks" - paths through the code in
8308 which uninitialized values are copied across a security boundary
8309 (such as code within an OS kernel that copies a partially-
8310 initialized struct on the stack to user space).
8311
8312 See CWE-200: Exposure of Sensitive Information to an Unauthorized
8313 Actor ("https://cwe.mitre.org/data/definitions/200.html").
8314
8315 -Wno-analyzer-fd-access-mode-mismatch
8316 This warning requires -fanalyzer, which enables it; use
8317 -Wno-analyzer-fd-access-mode-mismatch to disable it.
8318
8319 This diagnostic warns for paths through code in which a "read" on a
8320 write-only file descriptor is attempted, or vice versa.
8321
8322 This diagnostic also warns for code paths in a which a function
8323 with attribute "fd_arg_read (N)" is called with a file descriptor
8324 opened with "O_WRONLY" at referenced argument "N" or a function
8325 with attribute "fd_arg_write (N)" is called with a file descriptor
8326 opened with "O_RDONLY" at referenced argument N.
8327
8328 -Wno-analyzer-fd-double-close
8329 This warning requires -fanalyzer, which enables it; use
8330 -Wno-analyzer-fd-double-close to disable it.
8331
8332 This diagnostic warns for paths through code in which a file
8333 descriptor can be closed more than once.
8334
8335 See CWE-1341: Multiple Releases of Same Resource or Handle
8336 ("https://cwe.mitre.org/data/definitions/1341.html").
8337
8338 -Wno-analyzer-fd-leak
8339 This warning requires -fanalyzer, which enables it; use
8340 -Wno-analyzer-fd-leak to disable it.
8341
8342 This diagnostic warns for paths through code in which an open file
8343 descriptor is leaked.
8344
8345 See CWE-775: Missing Release of File Descriptor or Handle after
8346 Effective Lifetime
8347 ("https://cwe.mitre.org/data/definitions/775.html").
8348
8349 -Wno-analyzer-fd-phase-mismatch
8350 This warning requires -fanalyzer, which enables it; use
8351 -Wno-analyzer-fd-phase-mismatch to disable it.
8352
8353 This diagnostic warns for paths through code in which an operation
8354 is attempted in the wrong phase of a file descriptor's lifetime.
8355 For example, it will warn on attempts to call "accept" on a stream
8356 socket that has not yet had "listen" successfully called on it.
8357
8358 See CWE-666: Operation on Resource in Wrong Phase of Lifetime
8359 ("https://cwe.mitre.org/data/definitions/666.html").
8360
8361 -Wno-analyzer-fd-type-mismatch
8362 This warning requires -fanalyzer, which enables it; use
8363 -Wno-analyzer-fd-type-mismatch to disable it.
8364
8365 This diagnostic warns for paths through code in which an operation
8366 is attempted on the wrong type of file descriptor. For example, it
8367 will warn on attempts to use socket operations on a file descriptor
8368 obtained via "open", or when attempting to use a stream socket
8369 operation on a datagram socket.
8370
8371 -Wno-analyzer-fd-use-after-close
8372 This warning requires -fanalyzer, which enables it; use
8373 -Wno-analyzer-fd-use-after-close to disable it.
8374
8375 This diagnostic warns for paths through code in which a read or
8376 write is called on a closed file descriptor.
8377
8378 This diagnostic also warns for paths through code in which a
8379 function with attribute "fd_arg (N)" or "fd_arg_read (N)" or
8380 "fd_arg_write (N)" is called with a closed file descriptor at
8381 referenced argument "N".
8382
8383 -Wno-analyzer-fd-use-without-check
8384 This warning requires -fanalyzer, which enables it; use
8385 -Wno-analyzer-fd-use-without-check to disable it.
8386
8387 This diagnostic warns for paths through code in which a file
8388 descriptor is used without being checked for validity.
8389
8390 This diagnostic also warns for paths through code in which a
8391 function with attribute "fd_arg (N)" or "fd_arg_read (N)" or
8392 "fd_arg_write (N)" is called with a file descriptor, at referenced
8393 argument "N", without being checked for validity.
8394
8395 -Wno-analyzer-file-leak
8396 This warning requires -fanalyzer, which enables it; use
8397 -Wno-analyzer-file-leak to disable it.
8398
8399 This diagnostic warns for paths through the code in which a
8400 "<stdio.h>" "FILE *" stream object is leaked.
8401
8402 See CWE-775: Missing Release of File Descriptor or Handle after
8403 Effective Lifetime
8404 ("https://cwe.mitre.org/data/definitions/775.html").
8405
8406 -Wno-analyzer-free-of-non-heap
8407 This warning requires -fanalyzer, which enables it; use
8408 -Wno-analyzer-free-of-non-heap to disable it.
8409
8410 This diagnostic warns for paths through the code in which "free" is
8411 called on a non-heap pointer (e.g. an on-stack buffer, or a
8412 global).
8413
8414 See CWE-590: Free of Memory not on the Heap
8415 ("https://cwe.mitre.org/data/definitions/590.html").
8416
8417 -Wno-analyzer-imprecise-fp-arithmetic
8418 This warning requires -fanalyzer, which enables it; use
8419 -Wno-analyzer-imprecise-fp-arithmetic to disable it.
8420
8421 This diagnostic warns for paths through the code in which floating-
8422 point arithmetic is used in locations where precise computation is
8423 needed. This diagnostic only warns on use of floating-point
8424 operands inside the calculation of an allocation size at the
8425 moment.
8426
8427 -Wno-analyzer-infinite-recursion
8428 This warning requires -fanalyzer, which enables it; use
8429 -Wno-analyzer-infinite-recursion to disable it.
8430
8431 This diagnostics warns for paths through the code which appear to
8432 lead to infinite recursion.
8433
8434 Specifically, when the analyzer "sees" a recursive call, it will
8435 compare the state of memory at the entry to the new frame with that
8436 at the entry to the previous frame of that function on the stack.
8437 The warning is issued if nothing in memory appears to be changing;
8438 any changes observed to parameters or globals are assumed to lead
8439 to termination of the recursion and thus suppress the warning.
8440
8441 This diagnostic is likely to miss cases of infinite recursion that
8442 are convered to iteration by the optimizer before the analyzer
8443 "sees" them. Hence optimization should be disabled when attempting
8444 to trigger this diagnostic.
8445
8446 Compare with -Winfinite-recursion, which provides a similar
8447 diagnostic, but is implemented in a different way.
8448
8449 -Wno-analyzer-jump-through-null
8450 This warning requires -fanalyzer, which enables it; use
8451 -Wno-analyzer-jump-through-null to disable it.
8452
8453 This diagnostic warns for paths through the code in which a "NULL"
8454 function pointer is called.
8455
8456 -Wno-analyzer-malloc-leak
8457 This warning requires -fanalyzer, which enables it; use
8458 -Wno-analyzer-malloc-leak to disable it.
8459
8460 This diagnostic warns for paths through the code in which a pointer
8461 allocated via an allocator is leaked: either "malloc", or a
8462 function marked with attribute "malloc".
8463
8464 See CWE-401: Missing Release of Memory after Effective Lifetime
8465 ("https://cwe.mitre.org/data/definitions/401.html").
8466
8467 -Wno-analyzer-mismatching-deallocation
8468 This warning requires -fanalyzer, which enables it; use
8469 -Wno-analyzer-mismatching-deallocation to disable it.
8470
8471 This diagnostic warns for paths through the code in which the wrong
8472 deallocation function is called on a pointer value, based on which
8473 function was used to allocate the pointer value. The diagnostic
8474 will warn about mismatches between "free", scalar "delete" and
8475 vector "delete[]", and those marked as allocator/deallocator pairs
8476 using attribute "malloc".
8477
8478 See CWE-762: Mismatched Memory Management Routines
8479 ("https://cwe.mitre.org/data/definitions/762.html").
8480
8481 -Wno-analyzer-out-of-bounds
8482 This warning requires -fanalyzer, which enables it; use
8483 -Wno-analyzer-out-of-bounds to disable it.
8484
8485 This diagnostic warns for paths through the code in which a buffer
8486 is definitely read or written out-of-bounds. The diagnostic
8487 applies for cases where the analyzer is able to determine a
8488 constant offset and for accesses past the end of a buffer, also a
8489 constant capacity. Further, the diagnostic does limited checking
8490 for accesses past the end when the offset as well as the capacity
8491 is symbolic.
8492
8493 See CWE-119: Improper Restriction of Operations within the Bounds
8494 of a Memory Buffer
8495 ("https://cwe.mitre.org/data/definitions/119.html").
8496
8497 -Wno-analyzer-possible-null-argument
8498 This warning requires -fanalyzer, which enables it; use
8499 -Wno-analyzer-possible-null-argument to disable it.
8500
8501 This diagnostic warns for paths through the code in which a
8502 possibly-NULL value is passed to a function argument marked with
8503 "__attribute__((nonnull))" as requiring a non-NULL value.
8504
8505 See CWE-690: Unchecked Return Value to NULL Pointer Dereference
8506 ("https://cwe.mitre.org/data/definitions/690.html").
8507
8508 -Wno-analyzer-possible-null-dereference
8509 This warning requires -fanalyzer, which enables it; use
8510 -Wno-analyzer-possible-null-dereference to disable it.
8511
8512 This diagnostic warns for paths through the code in which a
8513 possibly-NULL value is dereferenced.
8514
8515 See CWE-690: Unchecked Return Value to NULL Pointer Dereference
8516 ("https://cwe.mitre.org/data/definitions/690.html").
8517
8518 -Wno-analyzer-null-argument
8519 This warning requires -fanalyzer, which enables it; use
8520 -Wno-analyzer-null-argument to disable it.
8521
8522 This diagnostic warns for paths through the code in which a value
8523 known to be NULL is passed to a function argument marked with
8524 "__attribute__((nonnull))" as requiring a non-NULL value.
8525
8526 See CWE-476: NULL Pointer Dereference
8527 ("https://cwe.mitre.org/data/definitions/476.html").
8528
8529 -Wno-analyzer-null-dereference
8530 This warning requires -fanalyzer, which enables it; use
8531 -Wno-analyzer-null-dereference to disable it.
8532
8533 This diagnostic warns for paths through the code in which a value
8534 known to be NULL is dereferenced.
8535
8536 See CWE-476: NULL Pointer Dereference
8537 ("https://cwe.mitre.org/data/definitions/476.html").
8538
8539 -Wno-analyzer-putenv-of-auto-var
8540 This warning requires -fanalyzer, which enables it; use
8541 -Wno-analyzer-putenv-of-auto-var to disable it.
8542
8543 This diagnostic warns for paths through the code in which a call to
8544 "putenv" is passed a pointer to an automatic variable or an on-
8545 stack buffer.
8546
8547 See POS34-C. Do not call putenv() with a pointer to an automatic
8548 variable as the argument
8549 ("https://wiki.sei.cmu.edu/confluence/x/6NYxBQ").
8550
8551 -Wno-analyzer-shift-count-negative
8552 This warning requires -fanalyzer, which enables it; use
8553 -Wno-analyzer-shift-count-negative to disable it.
8554
8555 This diagnostic warns for paths through the code in which a shift
8556 is attempted with a negative count. It is analogous to the
8557 -Wshift-count-negative diagnostic implemented in the C/C++ front
8558 ends, but is implemented based on analyzing interprocedural paths,
8559 rather than merely parsing the syntax tree. However, the analyzer
8560 does not prioritize detection of such paths, so false negatives are
8561 more likely relative to other warnings.
8562
8563 -Wno-analyzer-shift-count-overflow
8564 This warning requires -fanalyzer, which enables it; use
8565 -Wno-analyzer-shift-count-overflow to disable it.
8566
8567 This diagnostic warns for paths through the code in which a shift
8568 is attempted with a count greater than or equal to the precision of
8569 the operand's type. It is analogous to the -Wshift-count-overflow
8570 diagnostic implemented in the C/C++ front ends, but is implemented
8571 based on analyzing interprocedural paths, rather than merely
8572 parsing the syntax tree. However, the analyzer does not prioritize
8573 detection of such paths, so false negatives are more likely
8574 relative to other warnings.
8575
8576 -Wno-analyzer-stale-setjmp-buffer
8577 This warning requires -fanalyzer, which enables it; use
8578 -Wno-analyzer-stale-setjmp-buffer to disable it.
8579
8580 This diagnostic warns for paths through the code in which "longjmp"
8581 is called to rewind to a "jmp_buf" relating to a "setjmp" call in a
8582 function that has returned.
8583
8584 When "setjmp" is called on a "jmp_buf" to record a rewind location,
8585 it records the stack frame. The stack frame becomes invalid when
8586 the function containing the "setjmp" call returns. Attempting to
8587 rewind to it via "longjmp" would reference a stack frame that no
8588 longer exists, and likely lead to a crash (or worse).
8589
8590 -Wno-analyzer-tainted-allocation-size
8591 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8592 to enable it; use -Wno-analyzer-tainted-allocation-size to disable
8593 it.
8594
8595 This diagnostic warns for paths through the code in which a value
8596 that could be under an attacker's control is used as the size of an
8597 allocation without being sanitized, so that an attacker could
8598 inject an excessively large allocation and potentially cause a
8599 denial of service attack.
8600
8601 See CWE-789: Memory Allocation with Excessive Size Value
8602 ("https://cwe.mitre.org/data/definitions/789.html").
8603
8604 -Wno-analyzer-tainted-assertion
8605 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8606 to enable it; use -Wno-analyzer-tainted-assertion to disable it.
8607
8608 This diagnostic warns for paths through the code in which a value
8609 that could be under an attacker's control is used as part of a
8610 condition without being first sanitized, and that condition guards
8611 a call to a function marked with attribute "noreturn" (such as the
8612 function "__builtin_unreachable"). Such functions typically
8613 indicate abnormal termination of the program, such as for assertion
8614 failure handlers. For example:
8615
8616 assert (some_tainted_value < SOME_LIMIT);
8617
8618 In such cases:
8619
8620 * when assertion-checking is enabled: an attacker could trigger a
8621 denial of service by injecting an assertion failure
8622
8623 * when assertion-checking is disabled, such as by defining
8624 "NDEBUG", an attacker could inject data that subverts the
8625 process, since it presumably violates a precondition that is
8626 being assumed by the code.
8627
8628 Note that when assertion-checking is disabled, the assertions are
8629 typically removed by the preprocessor before the analyzer has a
8630 chance to "see" them, so this diagnostic can only generate warnings
8631 on builds in which assertion-checking is enabled.
8632
8633 For the purpose of this warning, any function marked with attribute
8634 "noreturn" is considered as a possible assertion failure handler,
8635 including "__builtin_unreachable". Note that these functions are
8636 sometimes removed by the optimizer before the analyzer "sees" them.
8637 Hence optimization should be disabled when attempting to trigger
8638 this diagnostic.
8639
8640 See CWE-617: Reachable Assertion
8641 ("https://cwe.mitre.org/data/definitions/617.html").
8642
8643 The warning can also report problematic constructions such as
8644
8645 switch (some_tainted_value) {
8646 case 0:
8647 /* [...etc; various valid cases omitted...] */
8648 break;
8649
8650 default:
8651 __builtin_unreachable (); /* BUG: attacker can trigger this */
8652 }
8653
8654 despite the above not being an assertion failure, strictly
8655 speaking.
8656
8657 -Wno-analyzer-tainted-array-index
8658 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8659 to enable it; use -Wno-analyzer-tainted-array-index to disable it.
8660
8661 This diagnostic warns for paths through the code in which a value
8662 that could be under an attacker's control is used as the index of
8663 an array access without being sanitized, so that an attacker could
8664 inject an out-of-bounds access.
8665
8666 See CWE-129: Improper Validation of Array Index
8667 ("https://cwe.mitre.org/data/definitions/129.html").
8668
8669 -Wno-analyzer-tainted-divisor
8670 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8671 to enable it; use -Wno-analyzer-tainted-divisor to disable it.
8672
8673 This diagnostic warns for paths through the code in which a value
8674 that could be under an attacker's control is used as the divisor in
8675 a division or modulus operation without being sanitized, so that an
8676 attacker could inject a division-by-zero.
8677
8678 See CWE-369: Divide By Zero
8679 ("https://cwe.mitre.org/data/definitions/369.html").
8680
8681 -Wno-analyzer-tainted-offset
8682 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8683 to enable it; use -Wno-analyzer-tainted-offset to disable it.
8684
8685 This diagnostic warns for paths through the code in which a value
8686 that could be under an attacker's control is used as a pointer
8687 offset without being sanitized, so that an attacker could inject an
8688 out-of-bounds access.
8689
8690 See CWE-823: Use of Out-of-range Pointer Offset
8691 ("https://cwe.mitre.org/data/definitions/823.html").
8692
8693 -Wno-analyzer-tainted-size
8694 This warning requires both -fanalyzer and -fanalyzer-checker=taint
8695 to enable it; use -Wno-analyzer-tainted-size to disable it.
8696
8697 This diagnostic warns for paths through the code in which a value
8698 that could be under an attacker's control is used as the size of an
8699 operation such as "memset" without being sanitized, so that an
8700 attacker could inject an out-of-bounds access.
8701
8702 See CWE-129: Improper Validation of Array Index
8703 ("https://cwe.mitre.org/data/definitions/129.html").
8704
8705 -Wno-analyzer-unsafe-call-within-signal-handler
8706 This warning requires -fanalyzer, which enables it; use
8707 -Wno-analyzer-unsafe-call-within-signal-handler to disable it.
8708
8709 This diagnostic warns for paths through the code in which a
8710 function known to be async-signal-unsafe (such as "fprintf") is
8711 called from a signal handler.
8712
8713 See CWE-479: Signal Handler Use of a Non-reentrant Function
8714 ("https://cwe.mitre.org/data/definitions/479.html").
8715
8716 -Wno-analyzer-use-after-free
8717 This warning requires -fanalyzer, which enables it; use
8718 -Wno-analyzer-use-after-free to disable it.
8719
8720 This diagnostic warns for paths through the code in which a pointer
8721 is used after a deallocator is called on it: either "free", or a
8722 deallocator referenced by attribute "malloc".
8723
8724 See CWE-416: Use After Free
8725 ("https://cwe.mitre.org/data/definitions/416.html").
8726
8727 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
8728 This warning requires -fanalyzer, which enables it; use
8729 -Wno-analyzer-use-of-pointer-in-stale-stack-frame to disable it.
8730
8731 This diagnostic warns for paths through the code in which a pointer
8732 is dereferenced that points to a variable in a stale stack frame.
8733
8734 -Wno-analyzer-va-arg-type-mismatch
8735 This warning requires -fanalyzer, which enables it; use
8736 -Wno-analyzer-va-arg-type-mismatch to disable it.
8737
8738 This diagnostic warns for interprocedural paths through the code
8739 for which the analyzer detects an attempt to use "va_arg" to
8740 extract a value passed to a variadic call, but uses a type that
8741 does not match that of the expression passed to the call.
8742
8743 See CWE-686: Function Call With Incorrect Argument Type
8744 ("https://cwe.mitre.org/data/definitions/686.html").
8745
8746 -Wno-analyzer-va-list-exhausted
8747 This warning requires -fanalyzer, which enables it; use
8748 -Wno-analyzer-va-list-exhausted to disable it.
8749
8750 This diagnostic warns for interprocedural paths through the code
8751 for which the analyzer detects an attempt to use "va_arg" to access
8752 the next value passed to a variadic call, but all of the values in
8753 the "va_list" have already been consumed.
8754
8755 See CWE-685: Function Call With Incorrect Number of Arguments
8756 ("https://cwe.mitre.org/data/definitions/685.html").
8757
8758 -Wno-analyzer-va-list-leak
8759 This warning requires -fanalyzer, which enables it; use
8760 -Wno-analyzer-va-list-leak to disable it.
8761
8762 This diagnostic warns for interprocedural paths through the code
8763 for which the analyzer detects that "va_start" or "va_copy" has
8764 been called on a "va_list" without a corresponding call to
8765 "va_end".
8766
8767 -Wno-analyzer-va-list-use-after-va-end
8768 This warning requires -fanalyzer, which enables it; use
8769 -Wno-analyzer-va-list-use-after-va-end to disable it.
8770
8771 This diagnostic warns for interprocedural paths through the code
8772 for which the analyzer detects an attempt to use a "va_list" after
8773 "va_end" has been called on it. "va_list".
8774
8775 -Wno-analyzer-write-to-const
8776 This warning requires -fanalyzer, which enables it; use
8777 -Wno-analyzer-write-to-const to disable it.
8778
8779 This diagnostic warns for paths through the code in which the
8780 analyzer detects an attempt to write through a pointer to a "const"
8781 object. However, the analyzer does not prioritize detection of
8782 such paths, so false negatives are more likely relative to other
8783 warnings.
8784
8785 -Wno-analyzer-write-to-string-literal
8786 This warning requires -fanalyzer, which enables it; use
8787 -Wno-analyzer-write-to-string-literal to disable it.
8788
8789 This diagnostic warns for paths through the code in which the
8790 analyzer detects an attempt to write through a pointer to a string
8791 literal. However, the analyzer does not prioritize detection of
8792 such paths, so false negatives are more likely relative to other
8793 warnings.
8794
8795 -Wno-analyzer-use-of-uninitialized-value
8796 This warning requires -fanalyzer, which enables it; use
8797 -Wno-analyzer-use-of-uninitialized-value to disable it.
8798
8799 This diagnostic warns for paths through the code in which an
8800 uninitialized value is used.
8801
8802 See CWE-457: Use of Uninitialized Variable
8803 ("https://cwe.mitre.org/data/definitions/457.html").
8804
8805 The analyzer has hardcoded knowledge about the behavior of the
8806 following memory-management functions:
8807
8808 *<"alloca">
8809 *<The built-in functions "__builtin_alloc",>
8810 "__builtin_alloc_with_align", @item "__builtin_calloc",
8811 "__builtin_free", "__builtin_malloc", "__builtin_memcpy",
8812 "__builtin_memcpy_chk", "__builtin_memset", "__builtin_memset_chk",
8813 "__builtin_realloc", "__builtin_stack_restore", and
8814 "__builtin_stack_save"
8815
8816 *<"calloc">
8817 *<"free">
8818 *<"malloc">
8819 *<"memset">
8820 *<"operator delete">
8821 *<"operator delete []">
8822 *<"operator new">
8823 *<"operator new []">
8824 *<"realloc">
8825 *<"strdup">
8826 *<"strndup">
8827
8828 of the following functions for working with file descriptors:
8829
8830 *<"open">
8831 *<"close">
8832 *<"creat">
8833 *<"dup", "dup2" and "dup3">
8834 *<"isatty">
8835 *<"pipe", and "pipe2">
8836 *<"read">
8837 *<"write">
8838 *<"socket", "bind", "listen", "accept", and "connect">
8839
8840 of the following functions for working with "<stdio.h>" streams:
8841
8842 *<The built-in functions "__builtin_fprintf",>
8843 "__builtin_fprintf_unlocked", "__builtin_fputc",
8844 "__builtin_fputc_unlocked", "__builtin_fputs",
8845 "__builtin_fputs_unlocked", "__builtin_fwrite",
8846 "__builtin_fwrite_unlocked", "__builtin_printf",
8847 "__builtin_printf_unlocked", "__builtin_putc", "__builtin_putchar",
8848 "__builtin_putchar_unlocked", "__builtin_putc_unlocked",
8849 "__builtin_puts", "__builtin_puts_unlocked", "__builtin_vfprintf",
8850 and "__builtin_vprintf"
8851
8852 *<"fopen">
8853 *<"fclose">
8854 *<"ferror">
8855 *<"fgets">
8856 *<"fgets_unlocked">
8857 *<"fileno">
8858 *<"fread">
8859 *<"getc">
8860 *<"getchar">
8861 *<"fprintf">
8862 *<"printf">
8863 *<"fwrite">
8864
8865 and of the following functions:
8866
8867 *<The built-in functions "__builtin_expect",>
8868 "__builtin_expect_with_probability", "__builtin_strchr",
8869 "__builtin_strcpy", "__builtin_strcpy_chk", "__builtin_strlen",
8870 "__builtin_va_copy", and "__builtin_va_start"
8871
8872 *<The GNU extensions "error" and "error_at_line">
8873 *<"getpass">
8874 *<"longjmp">
8875 *<"putenv">
8876 *<"setjmp">
8877 *<"siglongjmp">
8878 *<"signal">
8879 *<"sigsetjmp">
8880 *<"strchr">
8881 *<"strlen">
8882
8883 In addition, various functions with an "__analyzer_" prefix have
8884 special meaning to the analyzer, described in the GCC Internals manual.
8885
8886 Pertinent parameters for controlling the exploration are:
8887
8888 *<--param analyzer-bb-explosion-factor=value>
8889 *<--param analyzer-max-enodes-per-program-point=value>
8890 *<--param analyzer-max-recursion-depth=value>
8891 *<--param analyzer-min-snodes-for-call-summary=value>
8892
8893 The following options control the analyzer.
8894
8895 -fanalyzer-call-summaries
8896 Simplify interprocedural analysis by computing the effect of
8897 certain calls, rather than exploring all paths through the function
8898 from callsite to each possible return.
8899
8900 If enabled, call summaries are only used for functions with more
8901 than one call site, and that are sufficiently complicated (as per
8902 --param analyzer-min-snodes-for-call-summary=value).
8903
8904 -fanalyzer-checker=name
8905 Restrict the analyzer to run just the named checker, and enable it.
8906
8907 Some checkers are disabled by default (even with -fanalyzer), such
8908 as the "taint" checker that implements
8909 -Wanalyzer-tainted-array-index, and this option is required to
8910 enable them.
8911
8912 Note: currently, -fanalyzer-checker=taint disables the following
8913 warnings from -fanalyzer:
8914
8915 -Wanalyzer-deref-before-check -Wanalyzer-double-fclose
8916 -Wanalyzer-double-free -Wanalyzer-exposure-through-output-file
8917 -Wanalyzer-fd-access-mode-mismatch -Wanalyzer-fd-double-close
8918 -Wanalyzer-fd-leak -Wanalyzer-fd-use-after-close
8919 -Wanalyzer-fd-use-without-check -Wanalyzer-file-leak
8920 -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak
8921 -Wanalyzer-mismatching-deallocation -Wanalyzer-null-argument
8922 -Wanalyzer-null-dereference -Wanalyzer-possible-null-argument
8923 -Wanalyzer-possible-null-dereference
8924 -Wanalyzer-unsafe-call-within-signal-handler
8925 -Wanalyzer-use-after-free -Wanalyzer-va-list-leak
8926 -Wanalyzer-va-list-use-after-va-end
8927
8928 -fno-analyzer-feasibility
8929 This option is intended for analyzer developers.
8930
8931 By default the analyzer verifies that there is a feasible control
8932 flow path for each diagnostic it emits: that the conditions that
8933 hold are not mutually exclusive. Diagnostics for which no feasible
8934 path can be found are rejected. This filtering can be suppressed
8935 with -fno-analyzer-feasibility, for debugging issues in this code.
8936
8937 -fanalyzer-fine-grained
8938 This option is intended for analyzer developers.
8939
8940 Internally the analyzer builds an "exploded graph" that combines
8941 control flow graphs with data flow information.
8942
8943 By default, an edge in this graph can contain the effects of a run
8944 of multiple statements within a basic block. With
8945 -fanalyzer-fine-grained, each statement gets its own edge.
8946
8947 -fanalyzer-show-duplicate-count
8948 This option is intended for analyzer developers: if multiple
8949 diagnostics have been detected as being duplicates of each other,
8950 it emits a note when reporting the best diagnostic, giving the
8951 number of additional diagnostics that were suppressed by the
8952 deduplication logic.
8953
8954 -fno-analyzer-state-merge
8955 This option is intended for analyzer developers.
8956
8957 By default the analyzer attempts to simplify analysis by merging
8958 sufficiently similar states at each program point as it builds its
8959 "exploded graph". With -fno-analyzer-state-merge this merging can
8960 be suppressed, for debugging state-handling issues.
8961
8962 -fno-analyzer-state-purge
8963 This option is intended for analyzer developers.
8964
8965 By default the analyzer attempts to simplify analysis by purging
8966 aspects of state at a program point that appear to no longer be
8967 relevant e.g. the values of locals that aren't accessed later in
8968 the function and which aren't relevant to leak analysis.
8969
8970 With -fno-analyzer-state-purge this purging of state can be
8971 suppressed, for debugging state-handling issues.
8972
8973 -fno-analyzer-suppress-followups
8974 This option is intended for analyzer developers.
8975
8976 By default the analyzer will stop exploring an execution path after
8977 encountering certain diagnostics, in order to avoid potentially
8978 issuing a cascade of follow-up diagnostics.
8979
8980 The diagnostics that terminate analysis along a path are:
8981
8982 *<-Wanalyzer-null-argument>
8983 *<-Wanalyzer-null-dereference>
8984 *<-Wanalyzer-use-after-free>
8985 *<-Wanalyzer-use-of-pointer-in-stale-stack-frame>
8986 *<-Wanalyzer-use-of-uninitialized-value>
8987
8988 With -fno-analyzer-suppress-followups the analyzer will continue to
8989 explore such paths even after such diagnostics, which may be
8990 helpful for debugging issues in the analyzer, or for
8991 microbenchmarks for detecting undefined behavior.
8992
8993 -fanalyzer-transitivity
8994 This option enables transitivity of constraints within the
8995 analyzer.
8996
8997 -fno-analyzer-undo-inlining
8998 This option is intended for analyzer developers.
8999
9000 -fanalyzer runs relatively late compared to other code analysis
9001 tools, and some optimizations have already been applied to the
9002 code. In particular function inlining may have occurred, leading
9003 to the interprocedural execution paths emitted by the analyzer
9004 containing function frames that don't correspond to those in the
9005 original source code.
9006
9007 By default the analyzer attempts to reconstruct the original
9008 function frames, and to emit events showing the inlined calls.
9009
9010 With -fno-analyzer-undo-inlining this attempt to reconstruct the
9011 original frame information can be be disabled, which may be of help
9012 when debugging issues in the analyzer.
9013
9014 -fanalyzer-verbose-edges
9015 This option is intended for analyzer developers. It enables more
9016 verbose, lower-level detail in the descriptions of control flow
9017 within diagnostic paths.
9018
9019 -fanalyzer-verbose-state-changes
9020 This option is intended for analyzer developers. It enables more
9021 verbose, lower-level detail in the descriptions of events relating
9022 to state machines within diagnostic paths.
9023
9024 -fanalyzer-verbosity=level
9025 This option controls the complexity of the control flow paths that
9026 are emitted for analyzer diagnostics.
9027
9028 The level can be one of:
9029
9030 0 At this level, interprocedural call and return events are
9031 displayed, along with the most pertinent state-change events
9032 relating to a diagnostic. For example, for a double-"free"
9033 diagnostic, both calls to "free" will be shown.
9034
9035 1 As per the previous level, but also show events for the entry
9036 to each function.
9037
9038 2 As per the previous level, but also show events relating to
9039 control flow that are significant to triggering the issue (e.g.
9040 "true path taken" at a conditional).
9041
9042 This level is the default.
9043
9044 3 As per the previous level, but show all control flow events,
9045 not just significant ones.
9046
9047 4 This level is intended for analyzer developers; it adds various
9048 other events intended for debugging the analyzer.
9049
9050 -fdump-analyzer
9051 Dump internal details about what the analyzer is doing to
9052 file.analyzer.txt. -fdump-analyzer-stderr overrides this option.
9053
9054 -fdump-analyzer-stderr
9055 Dump internal details about what the analyzer is doing to stderr.
9056 This option overrides -fdump-analyzer.
9057
9058 -fdump-analyzer-callgraph
9059 Dump a representation of the call graph suitable for viewing with
9060 GraphViz to file.callgraph.dot.
9061
9062 -fdump-analyzer-exploded-graph
9063 Dump a representation of the "exploded graph" suitable for viewing
9064 with GraphViz to file.eg.dot. Nodes are color-coded based on
9065 state-machine states to emphasize state changes.
9066
9067 -fdump-analyzer-exploded-nodes
9068 Emit diagnostics showing where nodes in the "exploded graph" are in
9069 relation to the program source.
9070
9071 -fdump-analyzer-exploded-nodes-2
9072 Dump a textual representation of the "exploded graph" to
9073 file.eg.txt.
9074
9075 -fdump-analyzer-exploded-nodes-3
9076 Dump a textual representation of the "exploded graph" to one dump
9077 file per node, to file.eg-id.txt. This is typically a large number
9078 of dump files.
9079
9080 -fdump-analyzer-exploded-paths
9081 Dump a textual representation of the "exploded path" for each
9082 diagnostic to file.idx.kind.epath.txt.
9083
9084 -fdump-analyzer-feasibility
9085 Dump internal details about the analyzer's search for feasible
9086 paths. The details are written in a form suitable for viewing with
9087 GraphViz to filenames of the form file.*.fg.dot, file.*.tg.dot, and
9088 file.*.fpath.txt.
9089
9090 -fdump-analyzer-json
9091 Dump a compressed JSON representation of analyzer internals to
9092 file.analyzer.json.gz. The precise format is subject to change.
9093
9094 -fdump-analyzer-state-purge
9095 As per -fdump-analyzer-supergraph, dump a representation of the
9096 "supergraph" suitable for viewing with GraphViz, but annotate the
9097 graph with information on what state will be purged at each node.
9098 The graph is written to file.state-purge.dot.
9099
9100 -fdump-analyzer-supergraph
9101 Dump representations of the "supergraph" suitable for viewing with
9102 GraphViz to file.supergraph.dot and to file.supergraph-eg.dot.
9103 These show all of the control flow graphs in the program, with
9104 interprocedural edges for calls and returns. The second dump
9105 contains annotations showing nodes in the "exploded graph" and
9106 diagnostics associated with them.
9107
9108 -fdump-analyzer-untracked
9109 Emit custom warnings with internal details intended for analyzer
9110 developers.
9111
9112 Options for Debugging Your Program
9113 To tell GCC to emit extra information for use by a debugger, in almost
9114 all cases you need only to add -g to your other options. Some debug
9115 formats can co-exist (like DWARF with CTF) when each of them is enabled
9116 explicitly by adding the respective command line option to your other
9117 options.
9118
9119 GCC allows you to use -g with -O. The shortcuts taken by optimized
9120 code may occasionally be surprising: some variables you declared may
9121 not exist at all; flow of control may briefly move where you did not
9122 expect it; some statements may not be executed because they compute
9123 constant results or their values are already at hand; some statements
9124 may execute in different places because they have been moved out of
9125 loops. Nevertheless it is possible to debug optimized output. This
9126 makes it reasonable to use the optimizer for programs that might have
9127 bugs.
9128
9129 If you are not using some other optimization option, consider using -Og
9130 with -g. With no -O option at all, some compiler passes that collect
9131 information useful for debugging do not run at all, so that -Og may
9132 result in a better debugging experience.
9133
9134 -g Produce debugging information in the operating system's native
9135 format (stabs, COFF, XCOFF, or DWARF). GDB can work with this
9136 debugging information.
9137
9138 On most systems that use stabs format, -g enables use of extra
9139 debugging information that only GDB can use; this extra information
9140 makes debugging work better in GDB but probably makes other
9141 debuggers crash or refuse to read the program. If you want to
9142 control for certain whether to generate the extra information, use
9143 -gvms (see below).
9144
9145 -ggdb
9146 Produce debugging information for use by GDB. This means to use
9147 the most expressive format available (DWARF, stabs, or the native
9148 format if neither of those are supported), including GDB extensions
9149 if at all possible.
9150
9151 -gdwarf
9152 -gdwarf-version
9153 Produce debugging information in DWARF format (if that is
9154 supported). The value of version may be either 2, 3, 4 or 5; the
9155 default version for most targets is 5 (with the exception of
9156 VxWorks, TPF and Darwin/Mac OS X, which default to version 2, and
9157 AIX, which defaults to version 4).
9158
9159 Note that with DWARF Version 2, some ports require and always use
9160 some non-conflicting DWARF 3 extensions in the unwind tables.
9161
9162 Version 4 may require GDB 7.0 and -fvar-tracking-assignments for
9163 maximum benefit. Version 5 requires GDB 8.0 or higher.
9164
9165 GCC no longer supports DWARF Version 1, which is substantially
9166 different than Version 2 and later. For historical reasons, some
9167 other DWARF-related options such as -fno-dwarf2-cfi-asm) retain a
9168 reference to DWARF Version 2 in their names, but apply to all
9169 currently-supported versions of DWARF.
9170
9171 -gbtf
9172 Request BTF debug information. BTF is the default debugging format
9173 for the eBPF target. On other targets, like x86, BTF debug
9174 information can be generated along with DWARF debug information
9175 when both of the debug formats are enabled explicitly via their
9176 respective command line options.
9177
9178 -gctf
9179 -gctflevel
9180 Request CTF debug information and use level to specify how much CTF
9181 debug information should be produced. If -gctf is specified
9182 without a value for level, the default level of CTF debug
9183 information is 2.
9184
9185 CTF debug information can be generated along with DWARF debug
9186 information when both of the debug formats are enabled explicitly
9187 via their respective command line options.
9188
9189 Level 0 produces no CTF debug information at all. Thus, -gctf0
9190 negates -gctf.
9191
9192 Level 1 produces CTF information for tracebacks only. This
9193 includes callsite information, but does not include type
9194 information.
9195
9196 Level 2 produces type information for entities (functions, data
9197 objects etc.) at file-scope or global-scope only.
9198
9199 -gvms
9200 Produce debugging information in Alpha/VMS debug format (if that is
9201 supported). This is the format used by DEBUG on Alpha/VMS systems.
9202
9203 -glevel
9204 -ggdblevel
9205 -gvmslevel
9206 Request debugging information and also use level to specify how
9207 much information. The default level is 2.
9208
9209 Level 0 produces no debug information at all. Thus, -g0 negates
9210 -g.
9211
9212 Level 1 produces minimal information, enough for making backtraces
9213 in parts of the program that you don't plan to debug. This
9214 includes descriptions of functions and external variables, and line
9215 number tables, but no information about local variables.
9216
9217 Level 3 includes extra information, such as all the macro
9218 definitions present in the program. Some debuggers support macro
9219 expansion when you use -g3.
9220
9221 If you use multiple -g options, with or without level numbers, the
9222 last such option is the one that is effective.
9223
9224 -gdwarf does not accept a concatenated debug level, to avoid
9225 confusion with -gdwarf-level. Instead use an additional -glevel
9226 option to change the debug level for DWARF.
9227
9228 -fno-eliminate-unused-debug-symbols
9229 By default, no debug information is produced for symbols that are
9230 not actually used. Use this option if you want debug information
9231 for all symbols.
9232
9233 -femit-class-debug-always
9234 Instead of emitting debugging information for a C++ class in only
9235 one object file, emit it in all object files using the class. This
9236 option should be used only with debuggers that are unable to handle
9237 the way GCC normally emits debugging information for classes
9238 because using this option increases the size of debugging
9239 information by as much as a factor of two.
9240
9241 -fno-merge-debug-strings
9242 Direct the linker to not merge together strings in the debugging
9243 information that are identical in different object files. Merging
9244 is not supported by all assemblers or linkers. Merging decreases
9245 the size of the debug information in the output file at the cost of
9246 increasing link processing time. Merging is enabled by default.
9247
9248 -fdebug-prefix-map=old=new
9249 When compiling files residing in directory old, record debugging
9250 information describing them as if the files resided in directory
9251 new instead. This can be used to replace a build-time path with an
9252 install-time path in the debug info. It can also be used to change
9253 an absolute path to a relative path by using . for new. This can
9254 give more reproducible builds, which are location independent, but
9255 may require an extra command to tell GDB where to find the source
9256 files. See also -ffile-prefix-map and -fcanon-prefix-map.
9257
9258 -fvar-tracking
9259 Run variable tracking pass. It computes where variables are stored
9260 at each position in code. Better debugging information is then
9261 generated (if the debugging information format supports this
9262 information).
9263
9264 It is enabled by default when compiling with optimization (-Os, -O,
9265 -O2, ...), debugging information (-g) and the debug info format
9266 supports it.
9267
9268 -fvar-tracking-assignments
9269 Annotate assignments to user variables early in the compilation and
9270 attempt to carry the annotations over throughout the compilation
9271 all the way to the end, in an attempt to improve debug information
9272 while optimizing. Use of -gdwarf-4 is recommended along with it.
9273
9274 It can be enabled even if var-tracking is disabled, in which case
9275 annotations are created and maintained, but discarded at the end.
9276 By default, this flag is enabled together with -fvar-tracking,
9277 except when selective scheduling is enabled.
9278
9279 -gsplit-dwarf
9280 If DWARF debugging information is enabled, separate as much
9281 debugging information as possible into a separate output file with
9282 the extension .dwo. This option allows the build system to avoid
9283 linking files with debug information. To be useful, this option
9284 requires a debugger capable of reading .dwo files.
9285
9286 -gdwarf32
9287 -gdwarf64
9288 If DWARF debugging information is enabled, the -gdwarf32 selects
9289 the 32-bit DWARF format and the -gdwarf64 selects the 64-bit DWARF
9290 format. The default is target specific, on most targets it is
9291 -gdwarf32 though. The 32-bit DWARF format is smaller, but can't
9292 support more than 2GiB of debug information in any of the DWARF
9293 debug information sections. The 64-bit DWARF format allows larger
9294 debug information and might not be well supported by all consumers
9295 yet.
9296
9297 -gdescribe-dies
9298 Add description attributes to some DWARF DIEs that have no name
9299 attribute, such as artificial variables, external references and
9300 call site parameter DIEs.
9301
9302 -gpubnames
9303 Generate DWARF ".debug_pubnames" and ".debug_pubtypes" sections.
9304
9305 -ggnu-pubnames
9306 Generate ".debug_pubnames" and ".debug_pubtypes" sections in a
9307 format suitable for conversion into a GDB index. This option is
9308 only useful with a linker that can produce GDB index version 7.
9309
9310 -fdebug-types-section
9311 When using DWARF Version 4 or higher, type DIEs can be put into
9312 their own ".debug_types" section instead of making them part of the
9313 ".debug_info" section. It is more efficient to put them in a
9314 separate comdat section since the linker can then remove
9315 duplicates. But not all DWARF consumers support ".debug_types"
9316 sections yet and on some objects ".debug_types" produces larger
9317 instead of smaller debugging information.
9318
9319 -grecord-gcc-switches
9320 -gno-record-gcc-switches
9321 This switch causes the command-line options used to invoke the
9322 compiler that may affect code generation to be appended to the
9323 DW_AT_producer attribute in DWARF debugging information. The
9324 options are concatenated with spaces separating them from each
9325 other and from the compiler version. It is enabled by default.
9326 See also -frecord-gcc-switches for another way of storing compiler
9327 options into the object file.
9328
9329 -gstrict-dwarf
9330 Disallow using extensions of later DWARF standard version than
9331 selected with -gdwarf-version. On most targets using non-
9332 conflicting DWARF extensions from later standard versions is
9333 allowed.
9334
9335 -gno-strict-dwarf
9336 Allow using extensions of later DWARF standard version than
9337 selected with -gdwarf-version.
9338
9339 -gas-loc-support
9340 Inform the compiler that the assembler supports ".loc" directives.
9341 It may then use them for the assembler to generate DWARF2+ line
9342 number tables.
9343
9344 This is generally desirable, because assembler-generated line-
9345 number tables are a lot more compact than those the compiler can
9346 generate itself.
9347
9348 This option will be enabled by default if, at GCC configure time,
9349 the assembler was found to support such directives.
9350
9351 -gno-as-loc-support
9352 Force GCC to generate DWARF2+ line number tables internally, if
9353 DWARF2+ line number tables are to be generated.
9354
9355 -gas-locview-support
9356 Inform the compiler that the assembler supports "view" assignment
9357 and reset assertion checking in ".loc" directives.
9358
9359 This option will be enabled by default if, at GCC configure time,
9360 the assembler was found to support them.
9361
9362 -gno-as-locview-support
9363 Force GCC to assign view numbers internally, if
9364 -gvariable-location-views are explicitly requested.
9365
9366 -gcolumn-info
9367 -gno-column-info
9368 Emit location column information into DWARF debugging information,
9369 rather than just file and line. This option is enabled by default.
9370
9371 -gstatement-frontiers
9372 -gno-statement-frontiers
9373 This option causes GCC to create markers in the internal
9374 representation at the beginning of statements, and to keep them
9375 roughly in place throughout compilation, using them to guide the
9376 output of "is_stmt" markers in the line number table. This is
9377 enabled by default when compiling with optimization (-Os, -O1, -O2,
9378 ...), and outputting DWARF 2 debug information at the normal level.
9379
9380 -gvariable-location-views
9381 -gvariable-location-views=incompat5
9382 -gno-variable-location-views
9383 Augment variable location lists with progressive view numbers
9384 implied from the line number table. This enables debug information
9385 consumers to inspect state at certain points of the program, even
9386 if no instructions associated with the corresponding source
9387 locations are present at that point. If the assembler lacks
9388 support for view numbers in line number tables, this will cause the
9389 compiler to emit the line number table, which generally makes them
9390 somewhat less compact. The augmented line number tables and
9391 location lists are fully backward-compatible, so they can be
9392 consumed by debug information consumers that are not aware of these
9393 augmentations, but they won't derive any benefit from them either.
9394
9395 This is enabled by default when outputting DWARF 2 debug
9396 information at the normal level, as long as there is assembler
9397 support, -fvar-tracking-assignments is enabled and -gstrict-dwarf
9398 is not. When assembler support is not available, this may still be
9399 enabled, but it will force GCC to output internal line number
9400 tables, and if -ginternal-reset-location-views is not enabled, that
9401 will most certainly lead to silently mismatching location views.
9402
9403 There is a proposed representation for view numbers that is not
9404 backward compatible with the location list format introduced in
9405 DWARF 5, that can be enabled with
9406 -gvariable-location-views=incompat5. This option may be removed in
9407 the future, is only provided as a reference implementation of the
9408 proposed representation. Debug information consumers are not
9409 expected to support this extended format, and they would be
9410 rendered unable to decode location lists using it.
9411
9412 -ginternal-reset-location-views
9413 -gno-internal-reset-location-views
9414 Attempt to determine location views that can be omitted from
9415 location view lists. This requires the compiler to have very
9416 accurate insn length estimates, which isn't always the case, and it
9417 may cause incorrect view lists to be generated silently when using
9418 an assembler that does not support location view lists. The GNU
9419 assembler will flag any such error as a "view number mismatch".
9420 This is only enabled on ports that define a reliable estimation
9421 function.
9422
9423 -ginline-points
9424 -gno-inline-points
9425 Generate extended debug information for inlined functions.
9426 Location view tracking markers are inserted at inlined entry
9427 points, so that address and view numbers can be computed and output
9428 in debug information. This can be enabled independently of
9429 location views, in which case the view numbers won't be output, but
9430 it can only be enabled along with statement frontiers, and it is
9431 only enabled by default if location views are enabled.
9432
9433 -gz[=type]
9434 Produce compressed debug sections in DWARF format, if that is
9435 supported. If type is not given, the default type depends on the
9436 capabilities of the assembler and linker used. type may be one of
9437 none (don't compress debug sections), or zlib (use zlib compression
9438 in ELF gABI format). If the linker doesn't support writing
9439 compressed debug sections, the option is rejected. Otherwise, if
9440 the assembler does not support them, -gz is silently ignored when
9441 producing object files.
9442
9443 -femit-struct-debug-baseonly
9444 Emit debug information for struct-like types only when the base
9445 name of the compilation source file matches the base name of file
9446 in which the struct is defined.
9447
9448 This option substantially reduces the size of debugging
9449 information, but at significant potential loss in type information
9450 to the debugger. See -femit-struct-debug-reduced for a less
9451 aggressive option. See -femit-struct-debug-detailed for more
9452 detailed control.
9453
9454 This option works only with DWARF debug output.
9455
9456 -femit-struct-debug-reduced
9457 Emit debug information for struct-like types only when the base
9458 name of the compilation source file matches the base name of file
9459 in which the type is defined, unless the struct is a template or
9460 defined in a system header.
9461
9462 This option significantly reduces the size of debugging
9463 information, with some potential loss in type information to the
9464 debugger. See -femit-struct-debug-baseonly for a more aggressive
9465 option. See -femit-struct-debug-detailed for more detailed
9466 control.
9467
9468 This option works only with DWARF debug output.
9469
9470 -femit-struct-debug-detailed[=spec-list]
9471 Specify the struct-like types for which the compiler generates
9472 debug information. The intent is to reduce duplicate struct debug
9473 information between different object files within the same program.
9474
9475 This option is a detailed version of -femit-struct-debug-reduced
9476 and -femit-struct-debug-baseonly, which serves for most needs.
9477
9478 A specification has the
9479 syntax[dir:|ind:][ord:|gen:](any|sys|base|none)
9480
9481 The optional first word limits the specification to structs that
9482 are used directly (dir:) or used indirectly (ind:). A struct type
9483 is used directly when it is the type of a variable, member.
9484 Indirect uses arise through pointers to structs. That is, when use
9485 of an incomplete struct is valid, the use is indirect. An example
9486 is struct one direct; struct two * indirect;.
9487
9488 The optional second word limits the specification to ordinary
9489 structs (ord:) or generic structs (gen:). Generic structs are a
9490 bit complicated to explain. For C++, these are non-explicit
9491 specializations of template classes, or non-template classes within
9492 the above. Other programming languages have generics, but
9493 -femit-struct-debug-detailed does not yet implement them.
9494
9495 The third word specifies the source files for those structs for
9496 which the compiler should emit debug information. The values none
9497 and any have the normal meaning. The value base means that the
9498 base of name of the file in which the type declaration appears must
9499 match the base of the name of the main compilation file. In
9500 practice, this means that when compiling foo.c, debug information
9501 is generated for types declared in that file and foo.h, but not
9502 other header files. The value sys means those types satisfying
9503 base or declared in system or compiler headers.
9504
9505 You may need to experiment to determine the best settings for your
9506 application.
9507
9508 The default is -femit-struct-debug-detailed=all.
9509
9510 This option works only with DWARF debug output.
9511
9512 -fno-dwarf2-cfi-asm
9513 Emit DWARF unwind info as compiler generated ".eh_frame" section
9514 instead of using GAS ".cfi_*" directives.
9515
9516 -fno-eliminate-unused-debug-types
9517 Normally, when producing DWARF output, GCC avoids producing debug
9518 symbol output for types that are nowhere used in the source file
9519 being compiled. Sometimes it is useful to have GCC emit debugging
9520 information for all types declared in a compilation unit,
9521 regardless of whether or not they are actually used in that
9522 compilation unit, for example if, in the debugger, you want to cast
9523 a value to a type that is not actually used in your program (but is
9524 declared). More often, however, this results in a significant
9525 amount of wasted space.
9526
9527 Options That Control Optimization
9528 These options control various sorts of optimizations.
9529
9530 Without any optimization option, the compiler's goal is to reduce the
9531 cost of compilation and to make debugging produce the expected results.
9532 Statements are independent: if you stop the program with a breakpoint
9533 between statements, you can then assign a new value to any variable or
9534 change the program counter to any other statement in the function and
9535 get exactly the results you expect from the source code.
9536
9537 Turning on optimization flags makes the compiler attempt to improve the
9538 performance and/or code size at the expense of compilation time and
9539 possibly the ability to debug the program.
9540
9541 The compiler performs optimization based on the knowledge it has of the
9542 program. Compiling multiple files at once to a single output file mode
9543 allows the compiler to use information gained from all of the files
9544 when compiling each of them.
9545
9546 Not all optimizations are controlled directly by a flag. Only
9547 optimizations that have a flag are listed in this section.
9548
9549 Most optimizations are completely disabled at -O0 or if an -O level is
9550 not set on the command line, even if individual optimization flags are
9551 specified. Similarly, -Og suppresses many optimization passes.
9552
9553 Depending on the target and how GCC was configured, a slightly
9554 different set of optimizations may be enabled at each -O level than
9555 those listed here. You can invoke GCC with -Q --help=optimizers to
9556 find out the exact set of optimizations that are enabled at each level.
9557
9558 -O
9559 -O1 Optimize. Optimizing compilation takes somewhat more time, and a
9560 lot more memory for a large function.
9561
9562 With -O, the compiler tries to reduce code size and execution time,
9563 without performing any optimizations that take a great deal of
9564 compilation time.
9565
9566 -O turns on the following optimization flags:
9567
9568 -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments
9569 -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch
9570 -fdse -fforward-propagate -fguess-branch-probability
9571 -fif-conversion -fif-conversion2 -finline-functions-called-once
9572 -fipa-modref -fipa-profile -fipa-pure-const -fipa-reference
9573 -fipa-reference-addressable -fmerge-constants
9574 -fmove-loop-invariants -fmove-loop-stores -fomit-frame-pointer
9575 -freorder-blocks -fshrink-wrap -fshrink-wrap-separate
9576 -fsplit-wide-types -fssa-backprop -fssa-phiopt -ftree-bit-ccp
9577 -ftree-ccp -ftree-ch -ftree-coalesce-vars -ftree-copy-prop
9578 -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-forwprop
9579 -ftree-fre -ftree-phiprop -ftree-pta -ftree-scev-cprop -ftree-sink
9580 -ftree-slsr -ftree-sra -ftree-ter -funit-at-a-time
9581
9582 -O2 Optimize even more. GCC performs nearly all supported
9583 optimizations that do not involve a space-speed tradeoff. As
9584 compared to -O, this option increases both compilation time and the
9585 performance of the generated code.
9586
9587 -O2 turns on all optimization flags specified by -O1. It also
9588 turns on the following optimization flags:
9589
9590 -falign-functions -falign-jumps -falign-labels -falign-loops
9591 -fcaller-saves -fcode-hoisting -fcrossjumping -fcse-follow-jumps
9592 -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize
9593 -fdevirtualize-speculatively -fexpensive-optimizations
9594 -ffinite-loops -fgcse -fgcse-lm -fhoist-adjacent-loads
9595 -finline-functions -finline-small-functions -findirect-inlining
9596 -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fipa-vrp
9597 -fisolate-erroneous-paths-dereference -flra-remat
9598 -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining
9599 -fpeephole2 -freorder-blocks-algorithm=stc
9600 -freorder-blocks-and-partition -freorder-functions
9601 -frerun-cse-after-loop -fschedule-insns -fschedule-insns2
9602 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing
9603 -fthread-jumps -ftree-builtin-call-dce -ftree-loop-vectorize
9604 -ftree-pre -ftree-slp-vectorize -ftree-switch-conversion
9605 -ftree-tail-merge -ftree-vrp -fvect-cost-model=very-cheap
9606
9607 Please note the warning under -fgcse about invoking -O2 on programs
9608 that use computed gotos.
9609
9610 -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2
9611 and also turns on the following optimization flags:
9612
9613 -fgcse-after-reload -fipa-cp-clone -floop-interchange
9614 -floop-unroll-and-jam -fpeel-loops -fpredictive-commoning
9615 -fsplit-loops -fsplit-paths -ftree-loop-distribution
9616 -ftree-partial-pre -funswitch-loops -fvect-cost-model=dynamic
9617 -fversion-loops-for-strides
9618
9619 -O0 Reduce compilation time and make debugging produce the expected
9620 results. This is the default.
9621
9622 -Os Optimize for size. -Os enables all -O2 optimizations except those
9623 that often increase code size:
9624
9625 -falign-functions -falign-jumps -falign-labels -falign-loops
9626 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc
9627
9628 It also enables -finline-functions, causes the compiler to tune for
9629 code size rather than execution speed, and performs further
9630 optimizations designed to reduce code size.
9631
9632 -Ofast
9633 Disregard strict standards compliance. -Ofast enables all -O3
9634 optimizations. It also enables optimizations that are not valid
9635 for all standard-compliant programs. It turns on -ffast-math,
9636 -fallow-store-data-races and the Fortran-specific -fstack-arrays,
9637 unless -fmax-stack-var-size is specified, and -fno-protect-parens.
9638 It turns off -fsemantic-interposition.
9639
9640 -Og Optimize debugging experience. -Og should be the optimization
9641 level of choice for the standard edit-compile-debug cycle, offering
9642 a reasonable level of optimization while maintaining fast
9643 compilation and a good debugging experience. It is a better choice
9644 than -O0 for producing debuggable code because some compiler passes
9645 that collect debug information are disabled at -O0.
9646
9647 Like -O0, -Og completely disables a number of optimization passes
9648 so that individual options controlling them have no effect.
9649 Otherwise -Og enables all -O1 optimization flags except for those
9650 that may interfere with debugging:
9651
9652 -fbranch-count-reg -fdelayed-branch -fdse -fif-conversion
9653 -fif-conversion2 -finline-functions-called-once
9654 -fmove-loop-invariants -fmove-loop-stores -fssa-phiopt
9655 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra
9656
9657 -Oz Optimize aggressively for size rather than speed. This may
9658 increase the number of instructions executed if those instructions
9659 require fewer bytes to encode. -Oz behaves similarly to -Os
9660 including enabling most -O2 optimizations.
9661
9662 If you use multiple -O options, with or without level numbers, the last
9663 such option is the one that is effective.
9664
9665 Options of the form -fflag specify machine-independent flags. Most
9666 flags have both positive and negative forms; the negative form of -ffoo
9667 is -fno-foo. In the table below, only one of the forms is listed---the
9668 one you typically use. You can figure out the other form by either
9669 removing no- or adding it.
9670
9671 The following options control specific optimizations. They are either
9672 activated by -O options or are related to ones that are. You can use
9673 the following flags in the rare cases when "fine-tuning" of
9674 optimizations to be performed is desired.
9675
9676 -fno-defer-pop
9677 For machines that must pop arguments after a function call, always
9678 pop the arguments as soon as each function returns. At levels -O1
9679 and higher, -fdefer-pop is the default; this allows the compiler to
9680 let arguments accumulate on the stack for several function calls
9681 and pop them all at once.
9682
9683 -fforward-propagate
9684 Perform a forward propagation pass on RTL. The pass tries to
9685 combine two instructions and checks if the result can be
9686 simplified. If loop unrolling is active, two passes are performed
9687 and the second is scheduled after loop unrolling.
9688
9689 This option is enabled by default at optimization levels -O1, -O2,
9690 -O3, -Os.
9691
9692 -ffp-contract=style
9693 -ffp-contract=off disables floating-point expression contraction.
9694 -ffp-contract=fast enables floating-point expression contraction
9695 such as forming of fused multiply-add operations if the target has
9696 native support for them. -ffp-contract=on enables floating-point
9697 expression contraction if allowed by the language standard. This
9698 is currently not implemented and treated equal to
9699 -ffp-contract=off.
9700
9701 The default is -ffp-contract=fast.
9702
9703 -fomit-frame-pointer
9704 Omit the frame pointer in functions that don't need one. This
9705 avoids the instructions to save, set up and restore the frame
9706 pointer; on many targets it also makes an extra register available.
9707
9708 On some targets this flag has no effect because the standard
9709 calling sequence always uses a frame pointer, so it cannot be
9710 omitted.
9711
9712 Note that -fno-omit-frame-pointer doesn't guarantee the frame
9713 pointer is used in all functions. Several targets always omit the
9714 frame pointer in leaf functions.
9715
9716 Enabled by default at -O1 and higher.
9717
9718 -foptimize-sibling-calls
9719 Optimize sibling and tail recursive calls.
9720
9721 Enabled at levels -O2, -O3, -Os.
9722
9723 -foptimize-strlen
9724 Optimize various standard C string functions (e.g. "strlen",
9725 "strchr" or "strcpy") and their "_FORTIFY_SOURCE" counterparts into
9726 faster alternatives.
9727
9728 Enabled at levels -O2, -O3.
9729
9730 -fno-inline
9731 Do not expand any functions inline apart from those marked with the
9732 "always_inline" attribute. This is the default when not
9733 optimizing.
9734
9735 Single functions can be exempted from inlining by marking them with
9736 the "noinline" attribute.
9737
9738 -finline-small-functions
9739 Integrate functions into their callers when their body is smaller
9740 than expected function call code (so overall size of program gets
9741 smaller). The compiler heuristically decides which functions are
9742 simple enough to be worth integrating in this way. This inlining
9743 applies to all functions, even those not declared inline.
9744
9745 Enabled at levels -O2, -O3, -Os.
9746
9747 -findirect-inlining
9748 Inline also indirect calls that are discovered to be known at
9749 compile time thanks to previous inlining. This option has any
9750 effect only when inlining itself is turned on by the
9751 -finline-functions or -finline-small-functions options.
9752
9753 Enabled at levels -O2, -O3, -Os.
9754
9755 -finline-functions
9756 Consider all functions for inlining, even if they are not declared
9757 inline. The compiler heuristically decides which functions are
9758 worth integrating in this way.
9759
9760 If all calls to a given function are integrated, and the function
9761 is declared "static", then the function is normally not output as
9762 assembler code in its own right.
9763
9764 Enabled at levels -O2, -O3, -Os. Also enabled by -fprofile-use and
9765 -fauto-profile.
9766
9767 -finline-functions-called-once
9768 Consider all "static" functions called once for inlining into their
9769 caller even if they are not marked "inline". If a call to a given
9770 function is integrated, then the function is not output as
9771 assembler code in its own right.
9772
9773 Enabled at levels -O1, -O2, -O3 and -Os, but not -Og.
9774
9775 -fearly-inlining
9776 Inline functions marked by "always_inline" and functions whose body
9777 seems smaller than the function call overhead early before doing
9778 -fprofile-generate instrumentation and real inlining pass. Doing
9779 so makes profiling significantly cheaper and usually inlining
9780 faster on programs having large chains of nested wrapper functions.
9781
9782 Enabled by default.
9783
9784 -fipa-sra
9785 Perform interprocedural scalar replacement of aggregates, removal
9786 of unused parameters and replacement of parameters passed by
9787 reference by parameters passed by value.
9788
9789 Enabled at levels -O2, -O3 and -Os.
9790
9791 -finline-limit=n
9792 By default, GCC limits the size of functions that can be inlined.
9793 This flag allows coarse control of this limit. n is the size of
9794 functions that can be inlined in number of pseudo instructions.
9795
9796 Inlining is actually controlled by a number of parameters, which
9797 may be specified individually by using --param name=value. The
9798 -finline-limit=n option sets some of these parameters as follows:
9799
9800 max-inline-insns-single
9801 is set to n/2.
9802
9803 max-inline-insns-auto
9804 is set to n/2.
9805
9806 See below for a documentation of the individual parameters
9807 controlling inlining and for the defaults of these parameters.
9808
9809 Note: there may be no value to -finline-limit that results in
9810 default behavior.
9811
9812 Note: pseudo instruction represents, in this particular context, an
9813 abstract measurement of function's size. In no way does it
9814 represent a count of assembly instructions and as such its exact
9815 meaning might change from one release to an another.
9816
9817 -fno-keep-inline-dllexport
9818 This is a more fine-grained version of -fkeep-inline-functions,
9819 which applies only to functions that are declared using the
9820 "dllexport" attribute or declspec.
9821
9822 -fkeep-inline-functions
9823 In C, emit "static" functions that are declared "inline" into the
9824 object file, even if the function has been inlined into all of its
9825 callers. This switch does not affect functions using the "extern
9826 inline" extension in GNU C90. In C++, emit any and all inline
9827 functions into the object file.
9828
9829 -fkeep-static-functions
9830 Emit "static" functions into the object file, even if the function
9831 is never used.
9832
9833 -fkeep-static-consts
9834 Emit variables declared "static const" when optimization isn't
9835 turned on, even if the variables aren't referenced.
9836
9837 GCC enables this option by default. If you want to force the
9838 compiler to check if a variable is referenced, regardless of
9839 whether or not optimization is turned on, use the
9840 -fno-keep-static-consts option.
9841
9842 -fmerge-constants
9843 Attempt to merge identical constants (string constants and
9844 floating-point constants) across compilation units.
9845
9846 This option is the default for optimized compilation if the
9847 assembler and linker support it. Use -fno-merge-constants to
9848 inhibit this behavior.
9849
9850 Enabled at levels -O1, -O2, -O3, -Os.
9851
9852 -fmerge-all-constants
9853 Attempt to merge identical constants and identical variables.
9854
9855 This option implies -fmerge-constants. In addition to
9856 -fmerge-constants this considers e.g. even constant initialized
9857 arrays or initialized constant variables with integral or floating-
9858 point types. Languages like C or C++ require each variable,
9859 including multiple instances of the same variable in recursive
9860 calls, to have distinct locations, so using this option results in
9861 non-conforming behavior.
9862
9863 -fmodulo-sched
9864 Perform swing modulo scheduling immediately before the first
9865 scheduling pass. This pass looks at innermost loops and reorders
9866 their instructions by overlapping different iterations.
9867
9868 -fmodulo-sched-allow-regmoves
9869 Perform more aggressive SMS-based modulo scheduling with register
9870 moves allowed. By setting this flag certain anti-dependences edges
9871 are deleted, which triggers the generation of reg-moves based on
9872 the life-range analysis. This option is effective only with
9873 -fmodulo-sched enabled.
9874
9875 -fno-branch-count-reg
9876 Disable the optimization pass that scans for opportunities to use
9877 "decrement and branch" instructions on a count register instead of
9878 instruction sequences that decrement a register, compare it against
9879 zero, and then branch based upon the result. This option is only
9880 meaningful on architectures that support such instructions, which
9881 include x86, PowerPC, IA-64 and S/390. Note that the
9882 -fno-branch-count-reg option doesn't remove the decrement and
9883 branch instructions from the generated instruction stream
9884 introduced by other optimization passes.
9885
9886 The default is -fbranch-count-reg at -O1 and higher, except for
9887 -Og.
9888
9889 -fno-function-cse
9890 Do not put function addresses in registers; make each instruction
9891 that calls a constant function contain the function's address
9892 explicitly.
9893
9894 This option results in less efficient code, but some strange hacks
9895 that alter the assembler output may be confused by the
9896 optimizations performed when this option is not used.
9897
9898 The default is -ffunction-cse
9899
9900 -fno-zero-initialized-in-bss
9901 If the target supports a BSS section, GCC by default puts variables
9902 that are initialized to zero into BSS. This can save space in the
9903 resulting code.
9904
9905 This option turns off this behavior because some programs
9906 explicitly rely on variables going to the data section---e.g., so
9907 that the resulting executable can find the beginning of that
9908 section and/or make assumptions based on that.
9909
9910 The default is -fzero-initialized-in-bss.
9911
9912 -fthread-jumps
9913 Perform optimizations that check to see if a jump branches to a
9914 location where another comparison subsumed by the first is found.
9915 If so, the first branch is redirected to either the destination of
9916 the second branch or a point immediately following it, depending on
9917 whether the condition is known to be true or false.
9918
9919 Enabled at levels -O1, -O2, -O3, -Os.
9920
9921 -fsplit-wide-types
9922 When using a type that occupies multiple registers, such as "long
9923 long" on a 32-bit system, split the registers apart and allocate
9924 them independently. This normally generates better code for those
9925 types, but may make debugging more difficult.
9926
9927 Enabled at levels -O1, -O2, -O3, -Os.
9928
9929 -fsplit-wide-types-early
9930 Fully split wide types early, instead of very late. This option
9931 has no effect unless -fsplit-wide-types is turned on.
9932
9933 This is the default on some targets.
9934
9935 -fcse-follow-jumps
9936 In common subexpression elimination (CSE), scan through jump
9937 instructions when the target of the jump is not reached by any
9938 other path. For example, when CSE encounters an "if" statement
9939 with an "else" clause, CSE follows the jump when the condition
9940 tested is false.
9941
9942 Enabled at levels -O2, -O3, -Os.
9943
9944 -fcse-skip-blocks
9945 This is similar to -fcse-follow-jumps, but causes CSE to follow
9946 jumps that conditionally skip over blocks. When CSE encounters a
9947 simple "if" statement with no else clause, -fcse-skip-blocks causes
9948 CSE to follow the jump around the body of the "if".
9949
9950 Enabled at levels -O2, -O3, -Os.
9951
9952 -frerun-cse-after-loop
9953 Re-run common subexpression elimination after loop optimizations
9954 are performed.
9955
9956 Enabled at levels -O2, -O3, -Os.
9957
9958 -fgcse
9959 Perform a global common subexpression elimination pass. This pass
9960 also performs global constant and copy propagation.
9961
9962 Note: When compiling a program using computed gotos, a GCC
9963 extension, you may get better run-time performance if you disable
9964 the global common subexpression elimination pass by adding
9965 -fno-gcse to the command line.
9966
9967 Enabled at levels -O2, -O3, -Os.
9968
9969 -fgcse-lm
9970 When -fgcse-lm is enabled, global common subexpression elimination
9971 attempts to move loads that are only killed by stores into
9972 themselves. This allows a loop containing a load/store sequence to
9973 be changed to a load outside the loop, and a copy/store within the
9974 loop.
9975
9976 Enabled by default when -fgcse is enabled.
9977
9978 -fgcse-sm
9979 When -fgcse-sm is enabled, a store motion pass is run after global
9980 common subexpression elimination. This pass attempts to move
9981 stores out of loops. When used in conjunction with -fgcse-lm,
9982 loops containing a load/store sequence can be changed to a load
9983 before the loop and a store after the loop.
9984
9985 Not enabled at any optimization level.
9986
9987 -fgcse-las
9988 When -fgcse-las is enabled, the global common subexpression
9989 elimination pass eliminates redundant loads that come after stores
9990 to the same memory location (both partial and full redundancies).
9991
9992 Not enabled at any optimization level.
9993
9994 -fgcse-after-reload
9995 When -fgcse-after-reload is enabled, a redundant load elimination
9996 pass is performed after reload. The purpose of this pass is to
9997 clean up redundant spilling.
9998
9999 Enabled by -O3, -fprofile-use and -fauto-profile.
10000
10001 -faggressive-loop-optimizations
10002 This option tells the loop optimizer to use language constraints to
10003 derive bounds for the number of iterations of a loop. This assumes
10004 that loop code does not invoke undefined behavior by for example
10005 causing signed integer overflows or out-of-bound array accesses.
10006 The bounds for the number of iterations of a loop are used to guide
10007 loop unrolling and peeling and loop exit test optimizations. This
10008 option is enabled by default.
10009
10010 -funconstrained-commons
10011 This option tells the compiler that variables declared in common
10012 blocks (e.g. Fortran) may later be overridden with longer trailing
10013 arrays. This prevents certain optimizations that depend on knowing
10014 the array bounds.
10015
10016 -fcrossjumping
10017 Perform cross-jumping transformation. This transformation unifies
10018 equivalent code and saves code size. The resulting code may or may
10019 not perform better than without cross-jumping.
10020
10021 Enabled at levels -O2, -O3, -Os.
10022
10023 -fauto-inc-dec
10024 Combine increments or decrements of addresses with memory accesses.
10025 This pass is always skipped on architectures that do not have
10026 instructions to support this. Enabled by default at -O1 and higher
10027 on architectures that support this.
10028
10029 -fdce
10030 Perform dead code elimination (DCE) on RTL. Enabled by default at
10031 -O1 and higher.
10032
10033 -fdse
10034 Perform dead store elimination (DSE) on RTL. Enabled by default at
10035 -O1 and higher.
10036
10037 -fif-conversion
10038 Attempt to transform conditional jumps into branch-less
10039 equivalents. This includes use of conditional moves, min, max, set
10040 flags and abs instructions, and some tricks doable by standard
10041 arithmetics. The use of conditional execution on chips where it is
10042 available is controlled by -fif-conversion2.
10043
10044 Enabled at levels -O1, -O2, -O3, -Os, but not with -Og.
10045
10046 -fif-conversion2
10047 Use conditional execution (where available) to transform
10048 conditional jumps into branch-less equivalents.
10049
10050 Enabled at levels -O1, -O2, -O3, -Os, but not with -Og.
10051
10052 -fdeclone-ctor-dtor
10053 The C++ ABI requires multiple entry points for constructors and
10054 destructors: one for a base subobject, one for a complete object,
10055 and one for a virtual destructor that calls operator delete
10056 afterwards. For a hierarchy with virtual bases, the base and
10057 complete variants are clones, which means two copies of the
10058 function. With this option, the base and complete variants are
10059 changed to be thunks that call a common implementation.
10060
10061 Enabled by -Os.
10062
10063 -fdelete-null-pointer-checks
10064 Assume that programs cannot safely dereference null pointers, and
10065 that no code or data element resides at address zero. This option
10066 enables simple constant folding optimizations at all optimization
10067 levels. In addition, other optimization passes in GCC use this
10068 flag to control global dataflow analyses that eliminate useless
10069 checks for null pointers; these assume that a memory access to
10070 address zero always results in a trap, so that if a pointer is
10071 checked after it has already been dereferenced, it cannot be null.
10072
10073 Note however that in some environments this assumption is not true.
10074 Use -fno-delete-null-pointer-checks to disable this optimization
10075 for programs that depend on that behavior.
10076
10077 This option is enabled by default on most targets. On Nios II ELF,
10078 it defaults to off. On AVR and MSP430, this option is completely
10079 disabled.
10080
10081 Passes that use the dataflow information are enabled independently
10082 at different optimization levels.
10083
10084 -fdevirtualize
10085 Attempt to convert calls to virtual functions to direct calls.
10086 This is done both within a procedure and interprocedurally as part
10087 of indirect inlining (-findirect-inlining) and interprocedural
10088 constant propagation (-fipa-cp). Enabled at levels -O2, -O3, -Os.
10089
10090 -fdevirtualize-speculatively
10091 Attempt to convert calls to virtual functions to speculative direct
10092 calls. Based on the analysis of the type inheritance graph,
10093 determine for a given call the set of likely targets. If the set is
10094 small, preferably of size 1, change the call into a conditional
10095 deciding between direct and indirect calls. The speculative calls
10096 enable more optimizations, such as inlining. When they seem
10097 useless after further optimization, they are converted back into
10098 original form.
10099
10100 -fdevirtualize-at-ltrans
10101 Stream extra information needed for aggressive devirtualization
10102 when running the link-time optimizer in local transformation mode.
10103 This option enables more devirtualization but significantly
10104 increases the size of streamed data. For this reason it is disabled
10105 by default.
10106
10107 -fexpensive-optimizations
10108 Perform a number of minor optimizations that are relatively
10109 expensive.
10110
10111 Enabled at levels -O2, -O3, -Os.
10112
10113 -free
10114 Attempt to remove redundant extension instructions. This is
10115 especially helpful for the x86-64 architecture, which implicitly
10116 zero-extends in 64-bit registers after writing to their lower
10117 32-bit half.
10118
10119 Enabled for Alpha, AArch64 and x86 at levels -O2, -O3, -Os.
10120
10121 -fno-lifetime-dse
10122 In C++ the value of an object is only affected by changes within
10123 its lifetime: when the constructor begins, the object has an
10124 indeterminate value, and any changes during the lifetime of the
10125 object are dead when the object is destroyed. Normally dead store
10126 elimination will take advantage of this; if your code relies on the
10127 value of the object storage persisting beyond the lifetime of the
10128 object, you can use this flag to disable this optimization. To
10129 preserve stores before the constructor starts (e.g. because your
10130 operator new clears the object storage) but still treat the object
10131 as dead after the destructor, you can use -flifetime-dse=1. The
10132 default behavior can be explicitly selected with -flifetime-dse=2.
10133 -flifetime-dse=0 is equivalent to -fno-lifetime-dse.
10134
10135 -flive-range-shrinkage
10136 Attempt to decrease register pressure through register live range
10137 shrinkage. This is helpful for fast processors with small or
10138 moderate size register sets.
10139
10140 -fira-algorithm=algorithm
10141 Use the specified coloring algorithm for the integrated register
10142 allocator. The algorithm argument can be priority, which specifies
10143 Chow's priority coloring, or CB, which specifies Chaitin-Briggs
10144 coloring. Chaitin-Briggs coloring is not implemented for all
10145 architectures, but for those targets that do support it, it is the
10146 default because it generates better code.
10147
10148 -fira-region=region
10149 Use specified regions for the integrated register allocator. The
10150 region argument should be one of the following:
10151
10152 all Use all loops as register allocation regions. This can give
10153 the best results for machines with a small and/or irregular
10154 register set.
10155
10156 mixed
10157 Use all loops except for loops with small register pressure as
10158 the regions. This value usually gives the best results in most
10159 cases and for most architectures, and is enabled by default
10160 when compiling with optimization for speed (-O, -O2, ...).
10161
10162 one Use all functions as a single region. This typically results
10163 in the smallest code size, and is enabled by default for -Os or
10164 -O0.
10165
10166 -fira-hoist-pressure
10167 Use IRA to evaluate register pressure in the code hoisting pass for
10168 decisions to hoist expressions. This option usually results in
10169 smaller code, but it can slow the compiler down.
10170
10171 This option is enabled at level -Os for all targets.
10172
10173 -fira-loop-pressure
10174 Use IRA to evaluate register pressure in loops for decisions to
10175 move loop invariants. This option usually results in generation of
10176 faster and smaller code on machines with large register files (>=
10177 32 registers), but it can slow the compiler down.
10178
10179 This option is enabled at level -O3 for some targets.
10180
10181 -fno-ira-share-save-slots
10182 Disable sharing of stack slots used for saving call-used hard
10183 registers living through a call. Each hard register gets a
10184 separate stack slot, and as a result function stack frames are
10185 larger.
10186
10187 -fno-ira-share-spill-slots
10188 Disable sharing of stack slots allocated for pseudo-registers.
10189 Each pseudo-register that does not get a hard register gets a
10190 separate stack slot, and as a result function stack frames are
10191 larger.
10192
10193 -flra-remat
10194 Enable CFG-sensitive rematerialization in LRA. Instead of loading
10195 values of spilled pseudos, LRA tries to rematerialize (recalculate)
10196 values if it is profitable.
10197
10198 Enabled at levels -O2, -O3, -Os.
10199
10200 -fdelayed-branch
10201 If supported for the target machine, attempt to reorder
10202 instructions to exploit instruction slots available after delayed
10203 branch instructions.
10204
10205 Enabled at levels -O1, -O2, -O3, -Os, but not at -Og.
10206
10207 -fschedule-insns
10208 If supported for the target machine, attempt to reorder
10209 instructions to eliminate execution stalls due to required data
10210 being unavailable. This helps machines that have slow floating
10211 point or memory load instructions by allowing other instructions to
10212 be issued until the result of the load or floating-point
10213 instruction is required.
10214
10215 Enabled at levels -O2, -O3.
10216
10217 -fschedule-insns2
10218 Similar to -fschedule-insns, but requests an additional pass of
10219 instruction scheduling after register allocation has been done.
10220 This is especially useful on machines with a relatively small
10221 number of registers and where memory load instructions take more
10222 than one cycle.
10223
10224 Enabled at levels -O2, -O3, -Os.
10225
10226 -fno-sched-interblock
10227 Disable instruction scheduling across basic blocks, which is
10228 normally enabled when scheduling before register allocation, i.e.
10229 with -fschedule-insns or at -O2 or higher.
10230
10231 -fno-sched-spec
10232 Disable speculative motion of non-load instructions, which is
10233 normally enabled when scheduling before register allocation, i.e.
10234 with -fschedule-insns or at -O2 or higher.
10235
10236 -fsched-pressure
10237 Enable register pressure sensitive insn scheduling before register
10238 allocation. This only makes sense when scheduling before register
10239 allocation is enabled, i.e. with -fschedule-insns or at -O2 or
10240 higher. Usage of this option can improve the generated code and
10241 decrease its size by preventing register pressure increase above
10242 the number of available hard registers and subsequent spills in
10243 register allocation.
10244
10245 -fsched-spec-load
10246 Allow speculative motion of some load instructions. This only
10247 makes sense when scheduling before register allocation, i.e. with
10248 -fschedule-insns or at -O2 or higher.
10249
10250 -fsched-spec-load-dangerous
10251 Allow speculative motion of more load instructions. This only
10252 makes sense when scheduling before register allocation, i.e. with
10253 -fschedule-insns or at -O2 or higher.
10254
10255 -fsched-stalled-insns
10256 -fsched-stalled-insns=n
10257 Define how many insns (if any) can be moved prematurely from the
10258 queue of stalled insns into the ready list during the second
10259 scheduling pass. -fno-sched-stalled-insns means that no insns are
10260 moved prematurely, -fsched-stalled-insns=0 means there is no limit
10261 on how many queued insns can be moved prematurely.
10262 -fsched-stalled-insns without a value is equivalent to
10263 -fsched-stalled-insns=1.
10264
10265 -fsched-stalled-insns-dep
10266 -fsched-stalled-insns-dep=n
10267 Define how many insn groups (cycles) are examined for a dependency
10268 on a stalled insn that is a candidate for premature removal from
10269 the queue of stalled insns. This has an effect only during the
10270 second scheduling pass, and only if -fsched-stalled-insns is used.
10271 -fno-sched-stalled-insns-dep is equivalent to
10272 -fsched-stalled-insns-dep=0. -fsched-stalled-insns-dep without a
10273 value is equivalent to -fsched-stalled-insns-dep=1.
10274
10275 -fsched2-use-superblocks
10276 When scheduling after register allocation, use superblock
10277 scheduling. This allows motion across basic block boundaries,
10278 resulting in faster schedules. This option is experimental, as not
10279 all machine descriptions used by GCC model the CPU closely enough
10280 to avoid unreliable results from the algorithm.
10281
10282 This only makes sense when scheduling after register allocation,
10283 i.e. with -fschedule-insns2 or at -O2 or higher.
10284
10285 -fsched-group-heuristic
10286 Enable the group heuristic in the scheduler. This heuristic favors
10287 the instruction that belongs to a schedule group. This is enabled
10288 by default when scheduling is enabled, i.e. with -fschedule-insns
10289 or -fschedule-insns2 or at -O2 or higher.
10290
10291 -fsched-critical-path-heuristic
10292 Enable the critical-path heuristic in the scheduler. This
10293 heuristic favors instructions on the critical path. This is
10294 enabled by default when scheduling is enabled, i.e. with
10295 -fschedule-insns or -fschedule-insns2 or at -O2 or higher.
10296
10297 -fsched-spec-insn-heuristic
10298 Enable the speculative instruction heuristic in the scheduler.
10299 This heuristic favors speculative instructions with greater
10300 dependency weakness. This is enabled by default when scheduling is
10301 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
10302 or higher.
10303
10304 -fsched-rank-heuristic
10305 Enable the rank heuristic in the scheduler. This heuristic favors
10306 the instruction belonging to a basic block with greater size or
10307 frequency. This is enabled by default when scheduling is enabled,
10308 i.e. with -fschedule-insns or -fschedule-insns2 or at -O2 or
10309 higher.
10310
10311 -fsched-last-insn-heuristic
10312 Enable the last-instruction heuristic in the scheduler. This
10313 heuristic favors the instruction that is less dependent on the last
10314 instruction scheduled. This is enabled by default when scheduling
10315 is enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at
10316 -O2 or higher.
10317
10318 -fsched-dep-count-heuristic
10319 Enable the dependent-count heuristic in the scheduler. This
10320 heuristic favors the instruction that has more instructions
10321 depending on it. This is enabled by default when scheduling is
10322 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
10323 or higher.
10324
10325 -freschedule-modulo-scheduled-loops
10326 Modulo scheduling is performed before traditional scheduling. If a
10327 loop is modulo scheduled, later scheduling passes may change its
10328 schedule. Use this option to control that behavior.
10329
10330 -fselective-scheduling
10331 Schedule instructions using selective scheduling algorithm.
10332 Selective scheduling runs instead of the first scheduler pass.
10333
10334 -fselective-scheduling2
10335 Schedule instructions using selective scheduling algorithm.
10336 Selective scheduling runs instead of the second scheduler pass.
10337
10338 -fsel-sched-pipelining
10339 Enable software pipelining of innermost loops during selective
10340 scheduling. This option has no effect unless one of
10341 -fselective-scheduling or -fselective-scheduling2 is turned on.
10342
10343 -fsel-sched-pipelining-outer-loops
10344 When pipelining loops during selective scheduling, also pipeline
10345 outer loops. This option has no effect unless
10346 -fsel-sched-pipelining is turned on.
10347
10348 -fsemantic-interposition
10349 Some object formats, like ELF, allow interposing of symbols by the
10350 dynamic linker. This means that for symbols exported from the DSO,
10351 the compiler cannot perform interprocedural propagation, inlining
10352 and other optimizations in anticipation that the function or
10353 variable in question may change. While this feature is useful, for
10354 example, to rewrite memory allocation functions by a debugging
10355 implementation, it is expensive in the terms of code quality. With
10356 -fno-semantic-interposition the compiler assumes that if
10357 interposition happens for functions the overwriting function will
10358 have precisely the same semantics (and side effects). Similarly if
10359 interposition happens for variables, the constructor of the
10360 variable will be the same. The flag has no effect for functions
10361 explicitly declared inline (where it is never allowed for
10362 interposition to change semantics) and for symbols explicitly
10363 declared weak.
10364
10365 -fshrink-wrap
10366 Emit function prologues only before parts of the function that need
10367 it, rather than at the top of the function. This flag is enabled
10368 by default at -O and higher.
10369
10370 -fshrink-wrap-separate
10371 Shrink-wrap separate parts of the prologue and epilogue separately,
10372 so that those parts are only executed when needed. This option is
10373 on by default, but has no effect unless -fshrink-wrap is also
10374 turned on and the target supports this.
10375
10376 -fcaller-saves
10377 Enable allocation of values to registers that are clobbered by
10378 function calls, by emitting extra instructions to save and restore
10379 the registers around such calls. Such allocation is done only when
10380 it seems to result in better code.
10381
10382 This option is always enabled by default on certain machines,
10383 usually those which have no call-preserved registers to use
10384 instead.
10385
10386 Enabled at levels -O2, -O3, -Os.
10387
10388 -fcombine-stack-adjustments
10389 Tracks stack adjustments (pushes and pops) and stack memory
10390 references and then tries to find ways to combine them.
10391
10392 Enabled by default at -O1 and higher.
10393
10394 -fipa-ra
10395 Use caller save registers for allocation if those registers are not
10396 used by any called function. In that case it is not necessary to
10397 save and restore them around calls. This is only possible if
10398 called functions are part of same compilation unit as current
10399 function and they are compiled before it.
10400
10401 Enabled at levels -O2, -O3, -Os, however the option is disabled if
10402 generated code will be instrumented for profiling (-p, or -pg) or
10403 if callee's register usage cannot be known exactly (this happens on
10404 targets that do not expose prologues and epilogues in RTL).
10405
10406 -fconserve-stack
10407 Attempt to minimize stack usage. The compiler attempts to use less
10408 stack space, even if that makes the program slower. This option
10409 implies setting the large-stack-frame parameter to 100 and the
10410 large-stack-frame-growth parameter to 400.
10411
10412 -ftree-reassoc
10413 Perform reassociation on trees. This flag is enabled by default at
10414 -O1 and higher.
10415
10416 -fcode-hoisting
10417 Perform code hoisting. Code hoisting tries to move the evaluation
10418 of expressions executed on all paths to the function exit as early
10419 as possible. This is especially useful as a code size
10420 optimization, but it often helps for code speed as well. This flag
10421 is enabled by default at -O2 and higher.
10422
10423 -ftree-pre
10424 Perform partial redundancy elimination (PRE) on trees. This flag
10425 is enabled by default at -O2 and -O3.
10426
10427 -ftree-partial-pre
10428 Make partial redundancy elimination (PRE) more aggressive. This
10429 flag is enabled by default at -O3.
10430
10431 -ftree-forwprop
10432 Perform forward propagation on trees. This flag is enabled by
10433 default at -O1 and higher.
10434
10435 -ftree-fre
10436 Perform full redundancy elimination (FRE) on trees. The difference
10437 between FRE and PRE is that FRE only considers expressions that are
10438 computed on all paths leading to the redundant computation. This
10439 analysis is faster than PRE, though it exposes fewer redundancies.
10440 This flag is enabled by default at -O1 and higher.
10441
10442 -ftree-phiprop
10443 Perform hoisting of loads from conditional pointers on trees. This
10444 pass is enabled by default at -O1 and higher.
10445
10446 -fhoist-adjacent-loads
10447 Speculatively hoist loads from both branches of an if-then-else if
10448 the loads are from adjacent locations in the same structure and the
10449 target architecture has a conditional move instruction. This flag
10450 is enabled by default at -O2 and higher.
10451
10452 -ftree-copy-prop
10453 Perform copy propagation on trees. This pass eliminates
10454 unnecessary copy operations. This flag is enabled by default at
10455 -O1 and higher.
10456
10457 -fipa-pure-const
10458 Discover which functions are pure or constant. Enabled by default
10459 at -O1 and higher.
10460
10461 -fipa-reference
10462 Discover which static variables do not escape the compilation unit.
10463 Enabled by default at -O1 and higher.
10464
10465 -fipa-reference-addressable
10466 Discover read-only, write-only and non-addressable static
10467 variables. Enabled by default at -O1 and higher.
10468
10469 -fipa-stack-alignment
10470 Reduce stack alignment on call sites if possible. Enabled by
10471 default.
10472
10473 -fipa-pta
10474 Perform interprocedural pointer analysis and interprocedural
10475 modification and reference analysis. This option can cause
10476 excessive memory and compile-time usage on large compilation units.
10477 It is not enabled by default at any optimization level.
10478
10479 -fipa-profile
10480 Perform interprocedural profile propagation. The functions called
10481 only from cold functions are marked as cold. Also functions
10482 executed once (such as "cold", "noreturn", static constructors or
10483 destructors) are identified. Cold functions and loop less parts of
10484 functions executed once are then optimized for size. Enabled by
10485 default at -O1 and higher.
10486
10487 -fipa-modref
10488 Perform interprocedural mod/ref analysis. This optimization
10489 analyzes the side effects of functions (memory locations that are
10490 modified or referenced) and enables better optimization across the
10491 function call boundary. This flag is enabled by default at -O1 and
10492 higher.
10493
10494 -fipa-cp
10495 Perform interprocedural constant propagation. This optimization
10496 analyzes the program to determine when values passed to functions
10497 are constants and then optimizes accordingly. This optimization
10498 can substantially increase performance if the application has
10499 constants passed to functions. This flag is enabled by default at
10500 -O2, -Os and -O3. It is also enabled by -fprofile-use and
10501 -fauto-profile.
10502
10503 -fipa-cp-clone
10504 Perform function cloning to make interprocedural constant
10505 propagation stronger. When enabled, interprocedural constant
10506 propagation performs function cloning when externally visible
10507 function can be called with constant arguments. Because this
10508 optimization can create multiple copies of functions, it may
10509 significantly increase code size (see --param
10510 ipa-cp-unit-growth=value). This flag is enabled by default at -O3.
10511 It is also enabled by -fprofile-use and -fauto-profile.
10512
10513 -fipa-bit-cp
10514 When enabled, perform interprocedural bitwise constant propagation.
10515 This flag is enabled by default at -O2 and by -fprofile-use and
10516 -fauto-profile. It requires that -fipa-cp is enabled.
10517
10518 -fipa-vrp
10519 When enabled, perform interprocedural propagation of value ranges.
10520 This flag is enabled by default at -O2. It requires that -fipa-cp
10521 is enabled.
10522
10523 -fipa-icf
10524 Perform Identical Code Folding for functions and read-only
10525 variables. The optimization reduces code size and may disturb
10526 unwind stacks by replacing a function by equivalent one with a
10527 different name. The optimization works more effectively with link-
10528 time optimization enabled.
10529
10530 Although the behavior is similar to the Gold Linker's ICF
10531 optimization, GCC ICF works on different levels and thus the
10532 optimizations are not same - there are equivalences that are found
10533 only by GCC and equivalences found only by Gold.
10534
10535 This flag is enabled by default at -O2 and -Os.
10536
10537 -flive-patching=level
10538 Control GCC's optimizations to produce output suitable for live-
10539 patching.
10540
10541 If the compiler's optimization uses a function's body or
10542 information extracted from its body to optimize/change another
10543 function, the latter is called an impacted function of the former.
10544 If a function is patched, its impacted functions should be patched
10545 too.
10546
10547 The impacted functions are determined by the compiler's
10548 interprocedural optimizations. For example, a caller is impacted
10549 when inlining a function into its caller, cloning a function and
10550 changing its caller to call this new clone, or extracting a
10551 function's pureness/constness information to optimize its direct or
10552 indirect callers, etc.
10553
10554 Usually, the more IPA optimizations enabled, the larger the number
10555 of impacted functions for each function. In order to control the
10556 number of impacted functions and more easily compute the list of
10557 impacted function, IPA optimizations can be partially enabled at
10558 two different levels.
10559
10560 The level argument should be one of the following:
10561
10562 inline-clone
10563 Only enable inlining and cloning optimizations, which includes
10564 inlining, cloning, interprocedural scalar replacement of
10565 aggregates and partial inlining. As a result, when patching a
10566 function, all its callers and its clones' callers are impacted,
10567 therefore need to be patched as well.
10568
10569 -flive-patching=inline-clone disables the following
10570 optimization flags: -fwhole-program -fipa-pta -fipa-reference
10571 -fipa-ra -fipa-icf -fipa-icf-functions -fipa-icf-variables
10572 -fipa-bit-cp -fipa-vrp -fipa-pure-const
10573 -fipa-reference-addressable -fipa-stack-alignment -fipa-modref
10574
10575 inline-only-static
10576 Only enable inlining of static functions. As a result, when
10577 patching a static function, all its callers are impacted and so
10578 need to be patched as well.
10579
10580 In addition to all the flags that -flive-patching=inline-clone
10581 disables, -flive-patching=inline-only-static disables the
10582 following additional optimization flags: -fipa-cp-clone
10583 -fipa-sra -fpartial-inlining -fipa-cp
10584
10585 When -flive-patching is specified without any value, the default
10586 value is inline-clone.
10587
10588 This flag is disabled by default.
10589
10590 Note that -flive-patching is not supported with link-time
10591 optimization (-flto).
10592
10593 -fisolate-erroneous-paths-dereference
10594 Detect paths that trigger erroneous or undefined behavior due to
10595 dereferencing a null pointer. Isolate those paths from the main
10596 control flow and turn the statement with erroneous or undefined
10597 behavior into a trap. This flag is enabled by default at -O2 and
10598 higher and depends on -fdelete-null-pointer-checks also being
10599 enabled.
10600
10601 -fisolate-erroneous-paths-attribute
10602 Detect paths that trigger erroneous or undefined behavior due to a
10603 null value being used in a way forbidden by a "returns_nonnull" or
10604 "nonnull" attribute. Isolate those paths from the main control
10605 flow and turn the statement with erroneous or undefined behavior
10606 into a trap. This is not currently enabled, but may be enabled by
10607 -O2 in the future.
10608
10609 -ftree-sink
10610 Perform forward store motion on trees. This flag is enabled by
10611 default at -O1 and higher.
10612
10613 -ftree-bit-ccp
10614 Perform sparse conditional bit constant propagation on trees and
10615 propagate pointer alignment information. This pass only operates
10616 on local scalar variables and is enabled by default at -O1 and
10617 higher, except for -Og. It requires that -ftree-ccp is enabled.
10618
10619 -ftree-ccp
10620 Perform sparse conditional constant propagation (CCP) on trees.
10621 This pass only operates on local scalar variables and is enabled by
10622 default at -O1 and higher.
10623
10624 -fssa-backprop
10625 Propagate information about uses of a value up the definition chain
10626 in order to simplify the definitions. For example, this pass
10627 strips sign operations if the sign of a value never matters. The
10628 flag is enabled by default at -O1 and higher.
10629
10630 -fssa-phiopt
10631 Perform pattern matching on SSA PHI nodes to optimize conditional
10632 code. This pass is enabled by default at -O1 and higher, except
10633 for -Og.
10634
10635 -ftree-switch-conversion
10636 Perform conversion of simple initializations in a switch to
10637 initializations from a scalar array. This flag is enabled by
10638 default at -O2 and higher.
10639
10640 -ftree-tail-merge
10641 Look for identical code sequences. When found, replace one with a
10642 jump to the other. This optimization is known as tail merging or
10643 cross jumping. This flag is enabled by default at -O2 and higher.
10644 The compilation time in this pass can be limited using max-tail-
10645 merge-comparisons parameter and max-tail-merge-iterations
10646 parameter.
10647
10648 -ftree-dce
10649 Perform dead code elimination (DCE) on trees. This flag is enabled
10650 by default at -O1 and higher.
10651
10652 -ftree-builtin-call-dce
10653 Perform conditional dead code elimination (DCE) for calls to built-
10654 in functions that may set "errno" but are otherwise free of side
10655 effects. This flag is enabled by default at -O2 and higher if -Os
10656 is not also specified.
10657
10658 -ffinite-loops
10659 Assume that a loop with an exit will eventually take the exit and
10660 not loop indefinitely. This allows the compiler to remove loops
10661 that otherwise have no side-effects, not considering eventual
10662 endless looping as such.
10663
10664 This option is enabled by default at -O2 for C++ with -std=c++11 or
10665 higher.
10666
10667 -ftree-dominator-opts
10668 Perform a variety of simple scalar cleanups (constant/copy
10669 propagation, redundancy elimination, range propagation and
10670 expression simplification) based on a dominator tree traversal.
10671 This also performs jump threading (to reduce jumps to jumps). This
10672 flag is enabled by default at -O1 and higher.
10673
10674 -ftree-dse
10675 Perform dead store elimination (DSE) on trees. A dead store is a
10676 store into a memory location that is later overwritten by another
10677 store without any intervening loads. In this case the earlier
10678 store can be deleted. This flag is enabled by default at -O1 and
10679 higher.
10680
10681 -ftree-ch
10682 Perform loop header copying on trees. This is beneficial since it
10683 increases effectiveness of code motion optimizations. It also
10684 saves one jump. This flag is enabled by default at -O1 and higher.
10685 It is not enabled for -Os, since it usually increases code size.
10686
10687 -ftree-loop-optimize
10688 Perform loop optimizations on trees. This flag is enabled by
10689 default at -O1 and higher.
10690
10691 -ftree-loop-linear
10692 -floop-strip-mine
10693 -floop-block
10694 Perform loop nest optimizations. Same as -floop-nest-optimize. To
10695 use this code transformation, GCC has to be configured with
10696 --with-isl to enable the Graphite loop transformation
10697 infrastructure.
10698
10699 -fgraphite-identity
10700 Enable the identity transformation for graphite. For every SCoP we
10701 generate the polyhedral representation and transform it back to
10702 gimple. Using -fgraphite-identity we can check the costs or
10703 benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation. Some
10704 minimal optimizations are also performed by the code generator isl,
10705 like index splitting and dead code elimination in loops.
10706
10707 -floop-nest-optimize
10708 Enable the isl based loop nest optimizer. This is a generic loop
10709 nest optimizer based on the Pluto optimization algorithms. It
10710 calculates a loop structure optimized for data-locality and
10711 parallelism. This option is experimental.
10712
10713 -floop-parallelize-all
10714 Use the Graphite data dependence analysis to identify loops that
10715 can be parallelized. Parallelize all the loops that can be
10716 analyzed to not contain loop carried dependences without checking
10717 that it is profitable to parallelize the loops.
10718
10719 -ftree-coalesce-vars
10720 While transforming the program out of the SSA representation,
10721 attempt to reduce copying by coalescing versions of different user-
10722 defined variables, instead of just compiler temporaries. This may
10723 severely limit the ability to debug an optimized program compiled
10724 with -fno-var-tracking-assignments. In the negated form, this flag
10725 prevents SSA coalescing of user variables. This option is enabled
10726 by default if optimization is enabled, and it does very little
10727 otherwise.
10728
10729 -ftree-loop-if-convert
10730 Attempt to transform conditional jumps in the innermost loops to
10731 branch-less equivalents. The intent is to remove control-flow from
10732 the innermost loops in order to improve the ability of the
10733 vectorization pass to handle these loops. This is enabled by
10734 default if vectorization is enabled.
10735
10736 -ftree-loop-distribution
10737 Perform loop distribution. This flag can improve cache performance
10738 on big loop bodies and allow further loop optimizations, like
10739 parallelization or vectorization, to take place. For example, the
10740 loop
10741
10742 DO I = 1, N
10743 A(I) = B(I) + C
10744 D(I) = E(I) * F
10745 ENDDO
10746
10747 is transformed to
10748
10749 DO I = 1, N
10750 A(I) = B(I) + C
10751 ENDDO
10752 DO I = 1, N
10753 D(I) = E(I) * F
10754 ENDDO
10755
10756 This flag is enabled by default at -O3. It is also enabled by
10757 -fprofile-use and -fauto-profile.
10758
10759 -ftree-loop-distribute-patterns
10760 Perform loop distribution of patterns that can be code generated
10761 with calls to a library. This flag is enabled by default at -O2
10762 and higher, and by -fprofile-use and -fauto-profile.
10763
10764 This pass distributes the initialization loops and generates a call
10765 to memset zero. For example, the loop
10766
10767 DO I = 1, N
10768 A(I) = 0
10769 B(I) = A(I) + I
10770 ENDDO
10771
10772 is transformed to
10773
10774 DO I = 1, N
10775 A(I) = 0
10776 ENDDO
10777 DO I = 1, N
10778 B(I) = A(I) + I
10779 ENDDO
10780
10781 and the initialization loop is transformed into a call to memset
10782 zero. This flag is enabled by default at -O3. It is also enabled
10783 by -fprofile-use and -fauto-profile.
10784
10785 -floop-interchange
10786 Perform loop interchange outside of graphite. This flag can
10787 improve cache performance on loop nest and allow further loop
10788 optimizations, like vectorization, to take place. For example, the
10789 loop
10790
10791 for (int i = 0; i < N; i++)
10792 for (int j = 0; j < N; j++)
10793 for (int k = 0; k < N; k++)
10794 c[i][j] = c[i][j] + a[i][k]*b[k][j];
10795
10796 is transformed to
10797
10798 for (int i = 0; i < N; i++)
10799 for (int k = 0; k < N; k++)
10800 for (int j = 0; j < N; j++)
10801 c[i][j] = c[i][j] + a[i][k]*b[k][j];
10802
10803 This flag is enabled by default at -O3. It is also enabled by
10804 -fprofile-use and -fauto-profile.
10805
10806 -floop-unroll-and-jam
10807 Apply unroll and jam transformations on feasible loops. In a loop
10808 nest this unrolls the outer loop by some factor and fuses the
10809 resulting multiple inner loops. This flag is enabled by default at
10810 -O3. It is also enabled by -fprofile-use and -fauto-profile.
10811
10812 -ftree-loop-im
10813 Perform loop invariant motion on trees. This pass moves only
10814 invariants that are hard to handle at RTL level (function calls,
10815 operations that expand to nontrivial sequences of insns). With
10816 -funswitch-loops it also moves operands of conditions that are
10817 invariant out of the loop, so that we can use just trivial
10818 invariantness analysis in loop unswitching. The pass also includes
10819 store motion.
10820
10821 -ftree-loop-ivcanon
10822 Create a canonical counter for number of iterations in loops for
10823 which determining number of iterations requires complicated
10824 analysis. Later optimizations then may determine the number
10825 easily. Useful especially in connection with unrolling.
10826
10827 -ftree-scev-cprop
10828 Perform final value replacement. If a variable is modified in a
10829 loop in such a way that its value when exiting the loop can be
10830 determined using only its initial value and the number of loop
10831 iterations, replace uses of the final value by such a computation,
10832 provided it is sufficiently cheap. This reduces data dependencies
10833 and may allow further simplifications. Enabled by default at -O1
10834 and higher.
10835
10836 -fivopts
10837 Perform induction variable optimizations (strength reduction,
10838 induction variable merging and induction variable elimination) on
10839 trees.
10840
10841 -ftree-parallelize-loops=n
10842 Parallelize loops, i.e., split their iteration space to run in n
10843 threads. This is only possible for loops whose iterations are
10844 independent and can be arbitrarily reordered. The optimization is
10845 only profitable on multiprocessor machines, for loops that are CPU-
10846 intensive, rather than constrained e.g. by memory bandwidth. This
10847 option implies -pthread, and thus is only supported on targets that
10848 have support for -pthread.
10849
10850 -ftree-pta
10851 Perform function-local points-to analysis on trees. This flag is
10852 enabled by default at -O1 and higher, except for -Og.
10853
10854 -ftree-sra
10855 Perform scalar replacement of aggregates. This pass replaces
10856 structure references with scalars to prevent committing structures
10857 to memory too early. This flag is enabled by default at -O1 and
10858 higher, except for -Og.
10859
10860 -fstore-merging
10861 Perform merging of narrow stores to consecutive memory addresses.
10862 This pass merges contiguous stores of immediate values narrower
10863 than a word into fewer wider stores to reduce the number of
10864 instructions. This is enabled by default at -O2 and higher as well
10865 as -Os.
10866
10867 -ftree-ter
10868 Perform temporary expression replacement during the SSA->normal
10869 phase. Single use/single def temporaries are replaced at their use
10870 location with their defining expression. This results in non-
10871 GIMPLE code, but gives the expanders much more complex trees to
10872 work on resulting in better RTL generation. This is enabled by
10873 default at -O1 and higher.
10874
10875 -ftree-slsr
10876 Perform straight-line strength reduction on trees. This recognizes
10877 related expressions involving multiplications and replaces them by
10878 less expensive calculations when possible. This is enabled by
10879 default at -O1 and higher.
10880
10881 -ftree-vectorize
10882 Perform vectorization on trees. This flag enables
10883 -ftree-loop-vectorize and -ftree-slp-vectorize if not explicitly
10884 specified.
10885
10886 -ftree-loop-vectorize
10887 Perform loop vectorization on trees. This flag is enabled by
10888 default at -O2 and by -ftree-vectorize, -fprofile-use, and
10889 -fauto-profile.
10890
10891 -ftree-slp-vectorize
10892 Perform basic block vectorization on trees. This flag is enabled by
10893 default at -O2 and by -ftree-vectorize, -fprofile-use, and
10894 -fauto-profile.
10895
10896 -ftrivial-auto-var-init=choice
10897 Initialize automatic variables with either a pattern or with zeroes
10898 to increase the security and predictability of a program by
10899 preventing uninitialized memory disclosure and use. GCC still
10900 considers an automatic variable that doesn't have an explicit
10901 initializer as uninitialized, -Wuninitialized and
10902 -Wanalyzer-use-of-uninitialized-value will still report warning
10903 messages on such automatic variables and the compiler will perform
10904 optimization as if the variable were uninitialized. With this
10905 option, GCC will also initialize any padding of automatic variables
10906 that have structure or union types to zeroes. However, the current
10907 implementation cannot initialize automatic variables that are
10908 declared between the controlling expression and the first case of a
10909 "switch" statement. Using -Wtrivial-auto-var-init to report all
10910 such cases.
10911
10912 The three values of choice are:
10913
10914 * uninitialized doesn't initialize any automatic variables. This
10915 is C and C++'s default.
10916
10917 * pattern Initialize automatic variables with values which will
10918 likely transform logic bugs into crashes down the line, are
10919 easily recognized in a crash dump and without being values that
10920 programmers can rely on for useful program semantics. The
10921 current value is byte-repeatable pattern with byte "0xFE". The
10922 values used for pattern initialization might be changed in the
10923 future.
10924
10925 * zero Initialize automatic variables with zeroes.
10926
10927 The default is uninitialized.
10928
10929 You can control this behavior for a specific variable by using the
10930 variable attribute "uninitialized".
10931
10932 -fvect-cost-model=model
10933 Alter the cost model used for vectorization. The model argument
10934 should be one of unlimited, dynamic, cheap or very-cheap. With the
10935 unlimited model the vectorized code-path is assumed to be
10936 profitable while with the dynamic model a runtime check guards the
10937 vectorized code-path to enable it only for iteration counts that
10938 will likely execute faster than when executing the original scalar
10939 loop. The cheap model disables vectorization of loops where doing
10940 so would be cost prohibitive for example due to required runtime
10941 checks for data dependence or alignment but otherwise is equal to
10942 the dynamic model. The very-cheap model only allows vectorization
10943 if the vector code would entirely replace the scalar code that is
10944 being vectorized. For example, if each iteration of a vectorized
10945 loop would only be able to handle exactly four iterations of the
10946 scalar loop, the very-cheap model would only allow vectorization if
10947 the scalar iteration count is known to be a multiple of four.
10948
10949 The default cost model depends on other optimization flags and is
10950 either dynamic or cheap.
10951
10952 -fsimd-cost-model=model
10953 Alter the cost model used for vectorization of loops marked with
10954 the OpenMP simd directive. The model argument should be one of
10955 unlimited, dynamic, cheap. All values of model have the same
10956 meaning as described in -fvect-cost-model and by default a cost
10957 model defined with -fvect-cost-model is used.
10958
10959 -ftree-vrp
10960 Perform Value Range Propagation on trees. This is similar to the
10961 constant propagation pass, but instead of values, ranges of values
10962 are propagated. This allows the optimizers to remove unnecessary
10963 range checks like array bound checks and null pointer checks. This
10964 is enabled by default at -O2 and higher. Null pointer check
10965 elimination is only done if -fdelete-null-pointer-checks is
10966 enabled.
10967
10968 -fsplit-paths
10969 Split paths leading to loop backedges. This can improve dead code
10970 elimination and common subexpression elimination. This is enabled
10971 by default at -O3 and above.
10972
10973 -fsplit-ivs-in-unroller
10974 Enables expression of values of induction variables in later
10975 iterations of the unrolled loop using the value in the first
10976 iteration. This breaks long dependency chains, thus improving
10977 efficiency of the scheduling passes.
10978
10979 A combination of -fweb and CSE is often sufficient to obtain the
10980 same effect. However, that is not reliable in cases where the loop
10981 body is more complicated than a single basic block. It also does
10982 not work at all on some architectures due to restrictions in the
10983 CSE pass.
10984
10985 This optimization is enabled by default.
10986
10987 -fvariable-expansion-in-unroller
10988 With this option, the compiler creates multiple copies of some
10989 local variables when unrolling a loop, which can result in superior
10990 code.
10991
10992 This optimization is enabled by default for PowerPC targets, but
10993 disabled by default otherwise.
10994
10995 -fpartial-inlining
10996 Inline parts of functions. This option has any effect only when
10997 inlining itself is turned on by the -finline-functions or
10998 -finline-small-functions options.
10999
11000 Enabled at levels -O2, -O3, -Os.
11001
11002 -fpredictive-commoning
11003 Perform predictive commoning optimization, i.e., reusing
11004 computations (especially memory loads and stores) performed in
11005 previous iterations of loops.
11006
11007 This option is enabled at level -O3. It is also enabled by
11008 -fprofile-use and -fauto-profile.
11009
11010 -fprefetch-loop-arrays
11011 If supported by the target machine, generate instructions to
11012 prefetch memory to improve the performance of loops that access
11013 large arrays.
11014
11015 This option may generate better or worse code; results are highly
11016 dependent on the structure of loops within the source code.
11017
11018 Disabled at level -Os.
11019
11020 -fno-printf-return-value
11021 Do not substitute constants for known return value of formatted
11022 output functions such as "sprintf", "snprintf", "vsprintf", and
11023 "vsnprintf" (but not "printf" of "fprintf"). This transformation
11024 allows GCC to optimize or even eliminate branches based on the
11025 known return value of these functions called with arguments that
11026 are either constant, or whose values are known to be in a range
11027 that makes determining the exact return value possible. For
11028 example, when -fprintf-return-value is in effect, both the branch
11029 and the body of the "if" statement (but not the call to "snprint")
11030 can be optimized away when "i" is a 32-bit or smaller integer
11031 because the return value is guaranteed to be at most 8.
11032
11033 char buf[9];
11034 if (snprintf (buf, "%08x", i) >= sizeof buf)
11035 ...
11036
11037 The -fprintf-return-value option relies on other optimizations and
11038 yields best results with -O2 and above. It works in tandem with
11039 the -Wformat-overflow and -Wformat-truncation options. The
11040 -fprintf-return-value option is enabled by default.
11041
11042 -fno-peephole
11043 -fno-peephole2
11044 Disable any machine-specific peephole optimizations. The
11045 difference between -fno-peephole and -fno-peephole2 is in how they
11046 are implemented in the compiler; some targets use one, some use the
11047 other, a few use both.
11048
11049 -fpeephole is enabled by default. -fpeephole2 enabled at levels
11050 -O2, -O3, -Os.
11051
11052 -fno-guess-branch-probability
11053 Do not guess branch probabilities using heuristics.
11054
11055 GCC uses heuristics to guess branch probabilities if they are not
11056 provided by profiling feedback (-fprofile-arcs). These heuristics
11057 are based on the control flow graph. If some branch probabilities
11058 are specified by "__builtin_expect", then the heuristics are used
11059 to guess branch probabilities for the rest of the control flow
11060 graph, taking the "__builtin_expect" info into account. The
11061 interactions between the heuristics and "__builtin_expect" can be
11062 complex, and in some cases, it may be useful to disable the
11063 heuristics so that the effects of "__builtin_expect" are easier to
11064 understand.
11065
11066 It is also possible to specify expected probability of the
11067 expression with "__builtin_expect_with_probability" built-in
11068 function.
11069
11070 The default is -fguess-branch-probability at levels -O, -O2, -O3,
11071 -Os.
11072
11073 -freorder-blocks
11074 Reorder basic blocks in the compiled function in order to reduce
11075 number of taken branches and improve code locality.
11076
11077 Enabled at levels -O1, -O2, -O3, -Os.
11078
11079 -freorder-blocks-algorithm=algorithm
11080 Use the specified algorithm for basic block reordering. The
11081 algorithm argument can be simple, which does not increase code size
11082 (except sometimes due to secondary effects like alignment), or stc,
11083 the "software trace cache" algorithm, which tries to put all often
11084 executed code together, minimizing the number of branches executed
11085 by making extra copies of code.
11086
11087 The default is simple at levels -O1, -Os, and stc at levels -O2,
11088 -O3.
11089
11090 -freorder-blocks-and-partition
11091 In addition to reordering basic blocks in the compiled function, in
11092 order to reduce number of taken branches, partitions hot and cold
11093 basic blocks into separate sections of the assembly and .o files,
11094 to improve paging and cache locality performance.
11095
11096 This optimization is automatically turned off in the presence of
11097 exception handling or unwind tables (on targets using
11098 setjump/longjump or target specific scheme), for linkonce sections,
11099 for functions with a user-defined section attribute and on any
11100 architecture that does not support named sections. When
11101 -fsplit-stack is used this option is not enabled by default (to
11102 avoid linker errors), but may be enabled explicitly (if using a
11103 working linker).
11104
11105 Enabled for x86 at levels -O2, -O3, -Os.
11106
11107 -freorder-functions
11108 Reorder functions in the object file in order to improve code
11109 locality. This is implemented by using special subsections
11110 ".text.hot" for most frequently executed functions and
11111 ".text.unlikely" for unlikely executed functions. Reordering is
11112 done by the linker so object file format must support named
11113 sections and linker must place them in a reasonable way.
11114
11115 This option isn't effective unless you either provide profile
11116 feedback (see -fprofile-arcs for details) or manually annotate
11117 functions with "hot" or "cold" attributes.
11118
11119 Enabled at levels -O2, -O3, -Os.
11120
11121 -fstrict-aliasing
11122 Allow the compiler to assume the strictest aliasing rules
11123 applicable to the language being compiled. For C (and C++), this
11124 activates optimizations based on the type of expressions. In
11125 particular, an object of one type is assumed never to reside at the
11126 same address as an object of a different type, unless the types are
11127 almost the same. For example, an "unsigned int" can alias an
11128 "int", but not a "void*" or a "double". A character type may alias
11129 any other type.
11130
11131 Pay special attention to code like this:
11132
11133 union a_union {
11134 int i;
11135 double d;
11136 };
11137
11138 int f() {
11139 union a_union t;
11140 t.d = 3.0;
11141 return t.i;
11142 }
11143
11144 The practice of reading from a different union member than the one
11145 most recently written to (called "type-punning") is common. Even
11146 with -fstrict-aliasing, type-punning is allowed, provided the
11147 memory is accessed through the union type. So, the code above
11148 works as expected. However, this code might not:
11149
11150 int f() {
11151 union a_union t;
11152 int* ip;
11153 t.d = 3.0;
11154 ip = &t.i;
11155 return *ip;
11156 }
11157
11158 Similarly, access by taking the address, casting the resulting
11159 pointer and dereferencing the result has undefined behavior, even
11160 if the cast uses a union type, e.g.:
11161
11162 int f() {
11163 double d = 3.0;
11164 return ((union a_union *) &d)->i;
11165 }
11166
11167 The -fstrict-aliasing option is enabled at levels -O2, -O3, -Os.
11168
11169 -fipa-strict-aliasing
11170 Controls whether rules of -fstrict-aliasing are applied across
11171 function boundaries. Note that if multiple functions gets inlined
11172 into a single function the memory accesses are no longer considered
11173 to be crossing a function boundary.
11174
11175 The -fipa-strict-aliasing option is enabled by default and is
11176 effective only in combination with -fstrict-aliasing.
11177
11178 -falign-functions
11179 -falign-functions=n
11180 -falign-functions=n:m
11181 -falign-functions=n:m:n2
11182 -falign-functions=n:m:n2:m2
11183 Align the start of functions to the next power-of-two greater than
11184 or equal to n, skipping up to m-1 bytes. This ensures that at
11185 least the first m bytes of the function can be fetched by the CPU
11186 without crossing an n-byte alignment boundary.
11187
11188 If m is not specified, it defaults to n.
11189
11190 Examples: -falign-functions=32 aligns functions to the next 32-byte
11191 boundary, -falign-functions=24 aligns to the next 32-byte boundary
11192 only if this can be done by skipping 23 bytes or less,
11193 -falign-functions=32:7 aligns to the next 32-byte boundary only if
11194 this can be done by skipping 6 bytes or less.
11195
11196 The second pair of n2:m2 values allows you to specify a secondary
11197 alignment: -falign-functions=64:7:32:3 aligns to the next 64-byte
11198 boundary if this can be done by skipping 6 bytes or less, otherwise
11199 aligns to the next 32-byte boundary if this can be done by skipping
11200 2 bytes or less. If m2 is not specified, it defaults to n2.
11201
11202 Some assemblers only support this flag when n is a power of two; in
11203 that case, it is rounded up.
11204
11205 -fno-align-functions and -falign-functions=1 are equivalent and
11206 mean that functions are not aligned.
11207
11208 If n is not specified or is zero, use a machine-dependent default.
11209 The maximum allowed n option value is 65536.
11210
11211 Enabled at levels -O2, -O3.
11212
11213 -flimit-function-alignment
11214 If this option is enabled, the compiler tries to avoid
11215 unnecessarily overaligning functions. It attempts to instruct the
11216 assembler to align by the amount specified by -falign-functions,
11217 but not to skip more bytes than the size of the function.
11218
11219 -falign-labels
11220 -falign-labels=n
11221 -falign-labels=n:m
11222 -falign-labels=n:m:n2
11223 -falign-labels=n:m:n2:m2
11224 Align all branch targets to a power-of-two boundary.
11225
11226 Parameters of this option are analogous to the -falign-functions
11227 option. -fno-align-labels and -falign-labels=1 are equivalent and
11228 mean that labels are not aligned.
11229
11230 If -falign-loops or -falign-jumps are applicable and are greater
11231 than this value, then their values are used instead.
11232
11233 If n is not specified or is zero, use a machine-dependent default
11234 which is very likely to be 1, meaning no alignment. The maximum
11235 allowed n option value is 65536.
11236
11237 Enabled at levels -O2, -O3.
11238
11239 -falign-loops
11240 -falign-loops=n
11241 -falign-loops=n:m
11242 -falign-loops=n:m:n2
11243 -falign-loops=n:m:n2:m2
11244 Align loops to a power-of-two boundary. If the loops are executed
11245 many times, this makes up for any execution of the dummy padding
11246 instructions.
11247
11248 If -falign-labels is greater than this value, then its value is
11249 used instead.
11250
11251 Parameters of this option are analogous to the -falign-functions
11252 option. -fno-align-loops and -falign-loops=1 are equivalent and
11253 mean that loops are not aligned. The maximum allowed n option
11254 value is 65536.
11255
11256 If n is not specified or is zero, use a machine-dependent default.
11257
11258 Enabled at levels -O2, -O3.
11259
11260 -falign-jumps
11261 -falign-jumps=n
11262 -falign-jumps=n:m
11263 -falign-jumps=n:m:n2
11264 -falign-jumps=n:m:n2:m2
11265 Align branch targets to a power-of-two boundary, for branch targets
11266 where the targets can only be reached by jumping. In this case, no
11267 dummy operations need be executed.
11268
11269 If -falign-labels is greater than this value, then its value is
11270 used instead.
11271
11272 Parameters of this option are analogous to the -falign-functions
11273 option. -fno-align-jumps and -falign-jumps=1 are equivalent and
11274 mean that loops are not aligned.
11275
11276 If n is not specified or is zero, use a machine-dependent default.
11277 The maximum allowed n option value is 65536.
11278
11279 Enabled at levels -O2, -O3.
11280
11281 -fno-allocation-dce
11282 Do not remove unused C++ allocations in dead code elimination.
11283
11284 -fallow-store-data-races
11285 Allow the compiler to perform optimizations that may introduce new
11286 data races on stores, without proving that the variable cannot be
11287 concurrently accessed by other threads. Does not affect
11288 optimization of local data. It is safe to use this option if it is
11289 known that global data will not be accessed by multiple threads.
11290
11291 Examples of optimizations enabled by -fallow-store-data-races
11292 include hoisting or if-conversions that may cause a value that was
11293 already in memory to be re-written with that same value. Such re-
11294 writing is safe in a single threaded context but may be unsafe in a
11295 multi-threaded context. Note that on some processors, if-
11296 conversions may be required in order to enable vectorization.
11297
11298 Enabled at level -Ofast.
11299
11300 -funit-at-a-time
11301 This option is left for compatibility reasons. -funit-at-a-time has
11302 no effect, while -fno-unit-at-a-time implies -fno-toplevel-reorder
11303 and -fno-section-anchors.
11304
11305 Enabled by default.
11306
11307 -fno-toplevel-reorder
11308 Do not reorder top-level functions, variables, and "asm"
11309 statements. Output them in the same order that they appear in the
11310 input file. When this option is used, unreferenced static
11311 variables are not removed. This option is intended to support
11312 existing code that relies on a particular ordering. For new code,
11313 it is better to use attributes when possible.
11314
11315 -ftoplevel-reorder is the default at -O1 and higher, and also at
11316 -O0 if -fsection-anchors is explicitly requested. Additionally
11317 -fno-toplevel-reorder implies -fno-section-anchors.
11318
11319 -funreachable-traps
11320 With this option, the compiler turns calls to
11321 "__builtin_unreachable" into traps, instead of using them for
11322 optimization. This also affects any such calls implicitly
11323 generated by the compiler.
11324
11325 This option has the same effect as -fsanitize=unreachable
11326 -fsanitize-trap=unreachable, but does not affect the values of
11327 those options. If -fsanitize=unreachable is enabled, that option
11328 takes priority over this one.
11329
11330 This option is enabled by default at -O0 and -Og.
11331
11332 -fweb
11333 Constructs webs as commonly used for register allocation purposes
11334 and assign each web individual pseudo register. This allows the
11335 register allocation pass to operate on pseudos directly, but also
11336 strengthens several other optimization passes, such as CSE, loop
11337 optimizer and trivial dead code remover. It can, however, make
11338 debugging impossible, since variables no longer stay in a "home
11339 register".
11340
11341 Enabled by default with -funroll-loops.
11342
11343 -fwhole-program
11344 Assume that the current compilation unit represents the whole
11345 program being compiled. All public functions and variables with
11346 the exception of "main" and those merged by attribute
11347 "externally_visible" become static functions and in effect are
11348 optimized more aggressively by interprocedural optimizers.
11349
11350 With -flto this option has a limited use. In most cases the
11351 precise list of symbols used or exported from the binary is known
11352 the resolution info passed to the link-time optimizer by the linker
11353 plugin. It is still useful if no linker plugin is used or during
11354 incremental link step when final code is produced (with -flto
11355 -flinker-output=nolto-rel).
11356
11357 -flto[=n]
11358 This option runs the standard link-time optimizer. When invoked
11359 with source code, it generates GIMPLE (one of GCC's internal
11360 representations) and writes it to special ELF sections in the
11361 object file. When the object files are linked together, all the
11362 function bodies are read from these ELF sections and instantiated
11363 as if they had been part of the same translation unit.
11364
11365 To use the link-time optimizer, -flto and optimization options
11366 should be specified at compile time and during the final link. It
11367 is recommended that you compile all the files participating in the
11368 same link with the same options and also specify those options at
11369 link time. For example:
11370
11371 gcc -c -O2 -flto foo.c
11372 gcc -c -O2 -flto bar.c
11373 gcc -o myprog -flto -O2 foo.o bar.o
11374
11375 The first two invocations to GCC save a bytecode representation of
11376 GIMPLE into special ELF sections inside foo.o and bar.o. The final
11377 invocation reads the GIMPLE bytecode from foo.o and bar.o, merges
11378 the two files into a single internal image, and compiles the result
11379 as usual. Since both foo.o and bar.o are merged into a single
11380 image, this causes all the interprocedural analyses and
11381 optimizations in GCC to work across the two files as if they were a
11382 single one. This means, for example, that the inliner is able to
11383 inline functions in bar.o into functions in foo.o and vice-versa.
11384
11385 Another (simpler) way to enable link-time optimization is:
11386
11387 gcc -o myprog -flto -O2 foo.c bar.c
11388
11389 The above generates bytecode for foo.c and bar.c, merges them
11390 together into a single GIMPLE representation and optimizes them as
11391 usual to produce myprog.
11392
11393 The important thing to keep in mind is that to enable link-time
11394 optimizations you need to use the GCC driver to perform the link
11395 step. GCC automatically performs link-time optimization if any of
11396 the objects involved were compiled with the -flto command-line
11397 option. You can always override the automatic decision to do link-
11398 time optimization by passing -fno-lto to the link command.
11399
11400 To make whole program optimization effective, it is necessary to
11401 make certain whole program assumptions. The compiler needs to know
11402 what functions and variables can be accessed by libraries and
11403 runtime outside of the link-time optimized unit. When supported by
11404 the linker, the linker plugin (see -fuse-linker-plugin) passes
11405 information to the compiler about used and externally visible
11406 symbols. When the linker plugin is not available, -fwhole-program
11407 should be used to allow the compiler to make these assumptions,
11408 which leads to more aggressive optimization decisions.
11409
11410 When a file is compiled with -flto without -fuse-linker-plugin, the
11411 generated object file is larger than a regular object file because
11412 it contains GIMPLE bytecodes and the usual final code (see
11413 -ffat-lto-objects). This means that object files with LTO
11414 information can be linked as normal object files; if -fno-lto is
11415 passed to the linker, no interprocedural optimizations are applied.
11416 Note that when -fno-fat-lto-objects is enabled the compile stage is
11417 faster but you cannot perform a regular, non-LTO link on them.
11418
11419 When producing the final binary, GCC only applies link-time
11420 optimizations to those files that contain bytecode. Therefore, you
11421 can mix and match object files and libraries with GIMPLE bytecodes
11422 and final object code. GCC automatically selects which files to
11423 optimize in LTO mode and which files to link without further
11424 processing.
11425
11426 Generally, options specified at link time override those specified
11427 at compile time, although in some cases GCC attempts to infer link-
11428 time options from the settings used to compile the input files.
11429
11430 If you do not specify an optimization level option -O at link time,
11431 then GCC uses the highest optimization level used when compiling
11432 the object files. Note that it is generally ineffective to specify
11433 an optimization level option only at link time and not at compile
11434 time, for two reasons. First, compiling without optimization
11435 suppresses compiler passes that gather information needed for
11436 effective optimization at link time. Second, some early
11437 optimization passes can be performed only at compile time and not
11438 at link time.
11439
11440 There are some code generation flags preserved by GCC when
11441 generating bytecodes, as they need to be used during the final
11442 link. Currently, the following options and their settings are
11443 taken from the first object file that explicitly specifies them:
11444 -fcommon, -fexceptions, -fnon-call-exceptions, -fgnu-tm and all the
11445 -m target flags.
11446
11447 The following options -fPIC, -fpic, -fpie and -fPIE are combined
11448 based on the following scheme:
11449
11450 B<-fPIC> + B<-fpic> = B<-fpic>
11451 B<-fPIC> + B<-fno-pic> = B<-fno-pic>
11452 B<-fpic/-fPIC> + (no option) = (no option)
11453 B<-fPIC> + B<-fPIE> = B<-fPIE>
11454 B<-fpic> + B<-fPIE> = B<-fpie>
11455 B<-fPIC/-fpic> + B<-fpie> = B<-fpie>
11456
11457 Certain ABI-changing flags are required to match in all compilation
11458 units, and trying to override this at link time with a conflicting
11459 value is ignored. This includes options such as
11460 -freg-struct-return and -fpcc-struct-return.
11461
11462 Other options such as -ffp-contract, -fno-strict-overflow, -fwrapv,
11463 -fno-trapv or -fno-strict-aliasing are passed through to the link
11464 stage and merged conservatively for conflicting translation units.
11465 Specifically -fno-strict-overflow, -fwrapv and -fno-trapv take
11466 precedence; and for example -ffp-contract=off takes precedence over
11467 -ffp-contract=fast. You can override them at link time.
11468
11469 Diagnostic options such as -Wstringop-overflow are passed through
11470 to the link stage and their setting matches that of the compile-
11471 step at function granularity. Note that this matters only for
11472 diagnostics emitted during optimization. Note that code transforms
11473 such as inlining can lead to warnings being enabled or disabled for
11474 regions if code not consistent with the setting at compile time.
11475
11476 When you need to pass options to the assembler via -Wa or
11477 -Xassembler make sure to either compile such translation units with
11478 -fno-lto or consistently use the same assembler options on all
11479 translation units. You can alternatively also specify assembler
11480 options at LTO link time.
11481
11482 To enable debug info generation you need to supply -g at compile
11483 time. If any of the input files at link time were built with debug
11484 info generation enabled the link will enable debug info generation
11485 as well. Any elaborate debug info settings like the dwarf level
11486 -gdwarf-5 need to be explicitly repeated at the linker command line
11487 and mixing different settings in different translation units is
11488 discouraged.
11489
11490 If LTO encounters objects with C linkage declared with incompatible
11491 types in separate translation units to be linked together
11492 (undefined behavior according to ISO C99 6.2.7), a non-fatal
11493 diagnostic may be issued. The behavior is still undefined at run
11494 time. Similar diagnostics may be raised for other languages.
11495
11496 Another feature of LTO is that it is possible to apply
11497 interprocedural optimizations on files written in different
11498 languages:
11499
11500 gcc -c -flto foo.c
11501 g++ -c -flto bar.cc
11502 gfortran -c -flto baz.f90
11503 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
11504
11505 Notice that the final link is done with g++ to get the C++ runtime
11506 libraries and -lgfortran is added to get the Fortran runtime
11507 libraries. In general, when mixing languages in LTO mode, you
11508 should use the same link command options as when mixing languages
11509 in a regular (non-LTO) compilation.
11510
11511 If object files containing GIMPLE bytecode are stored in a library
11512 archive, say libfoo.a, it is possible to extract and use them in an
11513 LTO link if you are using a linker with plugin support. To create
11514 static libraries suitable for LTO, use gcc-ar and gcc-ranlib
11515 instead of ar and ranlib; to show the symbols of object files with
11516 GIMPLE bytecode, use gcc-nm. Those commands require that ar,
11517 ranlib and nm have been compiled with plugin support. At link
11518 time, use the flag -fuse-linker-plugin to ensure that the library
11519 participates in the LTO optimization process:
11520
11521 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
11522
11523 With the linker plugin enabled, the linker extracts the needed
11524 GIMPLE files from libfoo.a and passes them on to the running GCC to
11525 make them part of the aggregated GIMPLE image to be optimized.
11526
11527 If you are not using a linker with plugin support and/or do not
11528 enable the linker plugin, then the objects inside libfoo.a are
11529 extracted and linked as usual, but they do not participate in the
11530 LTO optimization process. In order to make a static library
11531 suitable for both LTO optimization and usual linkage, compile its
11532 object files with -flto -ffat-lto-objects.
11533
11534 Link-time optimizations do not require the presence of the whole
11535 program to operate. If the program does not require any symbols to
11536 be exported, it is possible to combine -flto and -fwhole-program to
11537 allow the interprocedural optimizers to use more aggressive
11538 assumptions which may lead to improved optimization opportunities.
11539 Use of -fwhole-program is not needed when linker plugin is active
11540 (see -fuse-linker-plugin).
11541
11542 The current implementation of LTO makes no attempt to generate
11543 bytecode that is portable between different types of hosts. The
11544 bytecode files are versioned and there is a strict version check,
11545 so bytecode files generated in one version of GCC do not work with
11546 an older or newer version of GCC.
11547
11548 Link-time optimization does not work well with generation of
11549 debugging information on systems other than those using a
11550 combination of ELF and DWARF.
11551
11552 If you specify the optional n, the optimization and code generation
11553 done at link time is executed in parallel using n parallel jobs by
11554 utilizing an installed make program. The environment variable MAKE
11555 may be used to override the program used.
11556
11557 You can also specify -flto=jobserver to use GNU make's job server
11558 mode to determine the number of parallel jobs. This is useful when
11559 the Makefile calling GCC is already executing in parallel. You
11560 must prepend a + to the command recipe in the parent Makefile for
11561 this to work. This option likely only works if MAKE is GNU make.
11562 Even without the option value, GCC tries to automatically detect a
11563 running GNU make's job server.
11564
11565 Use -flto=auto to use GNU make's job server, if available, or
11566 otherwise fall back to autodetection of the number of CPU threads
11567 present in your system.
11568
11569 -flto-partition=alg
11570 Specify the partitioning algorithm used by the link-time optimizer.
11571 The value is either 1to1 to specify a partitioning mirroring the
11572 original source files or balanced to specify partitioning into
11573 equally sized chunks (whenever possible) or max to create new
11574 partition for every symbol where possible. Specifying none as an
11575 algorithm disables partitioning and streaming completely. The
11576 default value is balanced. While 1to1 can be used as an workaround
11577 for various code ordering issues, the max partitioning is intended
11578 for internal testing only. The value one specifies that exactly
11579 one partition should be used while the value none bypasses
11580 partitioning and executes the link-time optimization step directly
11581 from the WPA phase.
11582
11583 -flto-compression-level=n
11584 This option specifies the level of compression used for
11585 intermediate language written to LTO object files, and is only
11586 meaningful in conjunction with LTO mode (-flto). GCC currently
11587 supports two LTO compression algorithms. For zstd, valid values are
11588 0 (no compression) to 19 (maximum compression), while zlib supports
11589 values from 0 to 9. Values outside this range are clamped to
11590 either minimum or maximum of the supported values. If the option
11591 is not given, a default balanced compression setting is used.
11592
11593 -fuse-linker-plugin
11594 Enables the use of a linker plugin during link-time optimization.
11595 This option relies on plugin support in the linker, which is
11596 available in gold or in GNU ld 2.21 or newer.
11597
11598 This option enables the extraction of object files with GIMPLE
11599 bytecode out of library archives. This improves the quality of
11600 optimization by exposing more code to the link-time optimizer.
11601 This information specifies what symbols can be accessed externally
11602 (by non-LTO object or during dynamic linking). Resulting code
11603 quality improvements on binaries (and shared libraries that use
11604 hidden visibility) are similar to -fwhole-program. See -flto for a
11605 description of the effect of this flag and how to use it.
11606
11607 This option is enabled by default when LTO support in GCC is
11608 enabled and GCC was configured for use with a linker supporting
11609 plugins (GNU ld 2.21 or newer or gold).
11610
11611 -ffat-lto-objects
11612 Fat LTO objects are object files that contain both the intermediate
11613 language and the object code. This makes them usable for both LTO
11614 linking and normal linking. This option is effective only when
11615 compiling with -flto and is ignored at link time.
11616
11617 -fno-fat-lto-objects improves compilation time over plain LTO, but
11618 requires the complete toolchain to be aware of LTO. It requires a
11619 linker with linker plugin support for basic functionality.
11620 Additionally, nm, ar and ranlib need to support linker plugins to
11621 allow a full-featured build environment (capable of building static
11622 libraries etc). GCC provides the gcc-ar, gcc-nm, gcc-ranlib
11623 wrappers to pass the right options to these tools. With non fat LTO
11624 makefiles need to be modified to use them.
11625
11626 Note that modern binutils provide plugin auto-load mechanism.
11627 Installing the linker plugin into $libdir/bfd-plugins has the same
11628 effect as usage of the command wrappers (gcc-ar, gcc-nm and gcc-
11629 ranlib).
11630
11631 The default is -fno-fat-lto-objects on targets with linker plugin
11632 support.
11633
11634 -fcompare-elim
11635 After register allocation and post-register allocation instruction
11636 splitting, identify arithmetic instructions that compute processor
11637 flags similar to a comparison operation based on that arithmetic.
11638 If possible, eliminate the explicit comparison operation.
11639
11640 This pass only applies to certain targets that cannot explicitly
11641 represent the comparison operation before register allocation is
11642 complete.
11643
11644 Enabled at levels -O1, -O2, -O3, -Os.
11645
11646 -fcprop-registers
11647 After register allocation and post-register allocation instruction
11648 splitting, perform a copy-propagation pass to try to reduce
11649 scheduling dependencies and occasionally eliminate the copy.
11650
11651 Enabled at levels -O1, -O2, -O3, -Os.
11652
11653 -fprofile-correction
11654 Profiles collected using an instrumented binary for multi-threaded
11655 programs may be inconsistent due to missed counter updates. When
11656 this option is specified, GCC uses heuristics to correct or smooth
11657 out such inconsistencies. By default, GCC emits an error message
11658 when an inconsistent profile is detected.
11659
11660 This option is enabled by -fauto-profile.
11661
11662 -fprofile-partial-training
11663 With "-fprofile-use" all portions of programs not executed during
11664 train run are optimized agressively for size rather than speed. In
11665 some cases it is not practical to train all possible hot paths in
11666 the program. (For example, program may contain functions specific
11667 for a given hardware and trianing may not cover all hardware
11668 configurations program is run on.) With
11669 "-fprofile-partial-training" profile feedback will be ignored for
11670 all functions not executed during the train run leading them to be
11671 optimized as if they were compiled without profile feedback. This
11672 leads to better performance when train run is not representative
11673 but also leads to significantly bigger code.
11674
11675 -fprofile-use
11676 -fprofile-use=path
11677 Enable profile feedback-directed optimizations, and the following
11678 optimizations, many of which are generally profitable only with
11679 profile feedback available:
11680
11681 -fbranch-probabilities -fprofile-values -funroll-loops
11682 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
11683 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
11684 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
11685 -ftree-slp-vectorize -fvect-cost-model=dynamic
11686 -ftree-loop-distribute-patterns -fprofile-reorder-functions
11687
11688 Before you can use this option, you must first generate profiling
11689 information.
11690
11691 By default, GCC emits an error message if the feedback profiles do
11692 not match the source code. This error can be turned into a warning
11693 by using -Wno-error=coverage-mismatch. Note this may result in
11694 poorly optimized code. Additionally, by default, GCC also emits a
11695 warning message if the feedback profiles do not exist (see
11696 -Wmissing-profile).
11697
11698 If path is specified, GCC looks at the path to find the profile
11699 feedback data files. See -fprofile-dir.
11700
11701 -fauto-profile
11702 -fauto-profile=path
11703 Enable sampling-based feedback-directed optimizations, and the
11704 following optimizations, many of which are generally profitable
11705 only with profile feedback available:
11706
11707 -fbranch-probabilities -fprofile-values -funroll-loops
11708 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
11709 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
11710 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
11711 -ftree-slp-vectorize -fvect-cost-model=dynamic
11712 -ftree-loop-distribute-patterns -fprofile-correction
11713
11714 path is the name of a file containing AutoFDO profile information.
11715 If omitted, it defaults to fbdata.afdo in the current directory.
11716
11717 Producing an AutoFDO profile data file requires running your
11718 program with the perf utility on a supported GNU/Linux target
11719 system. For more information, see <https://perf.wiki.kernel.org/>.
11720
11721 E.g.
11722
11723 perf record -e br_inst_retired:near_taken -b -o perf.data \
11724 -- your_program
11725
11726 Then use the create_gcov tool to convert the raw profile data to a
11727 format that can be used by GCC. You must also supply the
11728 unstripped binary for your program to this tool. See
11729 <https://github.com/google/autofdo>.
11730
11731 E.g.
11732
11733 create_gcov --binary=your_program.unstripped --profile=perf.data \
11734 --gcov=profile.afdo
11735
11736 The following options control compiler behavior regarding floating-
11737 point arithmetic. These options trade off between speed and
11738 correctness. All must be specifically enabled.
11739
11740 -ffloat-store
11741 Do not store floating-point variables in registers, and inhibit
11742 other options that might change whether a floating-point value is
11743 taken from a register or memory.
11744
11745 This option prevents undesirable excess precision on machines such
11746 as the 68000 where the floating registers (of the 68881) keep more
11747 precision than a "double" is supposed to have. Similarly for the
11748 x86 architecture. For most programs, the excess precision does
11749 only good, but a few programs rely on the precise definition of
11750 IEEE floating point. Use -ffloat-store for such programs, after
11751 modifying them to store all pertinent intermediate computations
11752 into variables.
11753
11754 -fexcess-precision=style
11755 This option allows further control over excess precision on
11756 machines where floating-point operations occur in a format with
11757 more precision or range than the IEEE standard and interchange
11758 floating-point types. By default, -fexcess-precision=fast is in
11759 effect; this means that operations may be carried out in a wider
11760 precision than the types specified in the source if that would
11761 result in faster code, and it is unpredictable when rounding to the
11762 types specified in the source code takes place. When compiling C
11763 or C++, if -fexcess-precision=standard is specified then excess
11764 precision follows the rules specified in ISO C99 or C++; in
11765 particular, both casts and assignments cause values to be rounded
11766 to their semantic types (whereas -ffloat-store only affects
11767 assignments). This option is enabled by default for C or C++ if a
11768 strict conformance option such as -std=c99 or -std=c++17 is used.
11769 -ffast-math enables -fexcess-precision=fast by default regardless
11770 of whether a strict conformance option is used.
11771
11772 -fexcess-precision=standard is not implemented for languages other
11773 than C or C++. On the x86, it has no effect if -mfpmath=sse or
11774 -mfpmath=sse+387 is specified; in the former case, IEEE semantics
11775 apply without excess precision, and in the latter, rounding is
11776 unpredictable.
11777
11778 -ffast-math
11779 Sets the options -fno-math-errno, -funsafe-math-optimizations,
11780 -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans,
11781 -fcx-limited-range and -fexcess-precision=fast.
11782
11783 This option causes the preprocessor macro "__FAST_MATH__" to be
11784 defined.
11785
11786 This option is not turned on by any -O option besides -Ofast since
11787 it can result in incorrect output for programs that depend on an
11788 exact implementation of IEEE or ISO rules/specifications for math
11789 functions. It may, however, yield faster code for programs that do
11790 not require the guarantees of these specifications.
11791
11792 -fno-math-errno
11793 Do not set "errno" after calling math functions that are executed
11794 with a single instruction, e.g., "sqrt". A program that relies on
11795 IEEE exceptions for math error handling may want to use this flag
11796 for speed while maintaining IEEE arithmetic compatibility.
11797
11798 This option is not turned on by any -O option since it can result
11799 in incorrect output for programs that depend on an exact
11800 implementation of IEEE or ISO rules/specifications for math
11801 functions. It may, however, yield faster code for programs that do
11802 not require the guarantees of these specifications.
11803
11804 The default is -fmath-errno.
11805
11806 On Darwin systems, the math library never sets "errno". There is
11807 therefore no reason for the compiler to consider the possibility
11808 that it might, and -fno-math-errno is the default.
11809
11810 -funsafe-math-optimizations
11811 Allow optimizations for floating-point arithmetic that (a) assume
11812 that arguments and results are valid and (b) may violate IEEE or
11813 ANSI standards. When used at link time, it may include libraries
11814 or startup files that change the default FPU control word or other
11815 similar optimizations.
11816
11817 This option is not turned on by any -O option since it can result
11818 in incorrect output for programs that depend on an exact
11819 implementation of IEEE or ISO rules/specifications for math
11820 functions. It may, however, yield faster code for programs that do
11821 not require the guarantees of these specifications. Enables
11822 -fno-signed-zeros, -fno-trapping-math, -fassociative-math and
11823 -freciprocal-math.
11824
11825 The default is -fno-unsafe-math-optimizations.
11826
11827 -fassociative-math
11828 Allow re-association of operands in series of floating-point
11829 operations. This violates the ISO C and C++ language standard by
11830 possibly changing computation result. NOTE: re-ordering may change
11831 the sign of zero as well as ignore NaNs and inhibit or create
11832 underflow or overflow (and thus cannot be used on code that relies
11833 on rounding behavior like "(x + 2**52) - 2**52". May also reorder
11834 floating-point comparisons and thus may not be used when ordered
11835 comparisons are required. This option requires that both
11836 -fno-signed-zeros and -fno-trapping-math be in effect. Moreover,
11837 it doesn't make much sense with -frounding-math. For Fortran the
11838 option is automatically enabled when both -fno-signed-zeros and
11839 -fno-trapping-math are in effect.
11840
11841 The default is -fno-associative-math.
11842
11843 -freciprocal-math
11844 Allow the reciprocal of a value to be used instead of dividing by
11845 the value if this enables optimizations. For example "x / y" can
11846 be replaced with "x * (1/y)", which is useful if "(1/y)" is subject
11847 to common subexpression elimination. Note that this loses
11848 precision and increases the number of flops operating on the value.
11849
11850 The default is -fno-reciprocal-math.
11851
11852 -ffinite-math-only
11853 Allow optimizations for floating-point arithmetic that assume that
11854 arguments and results are not NaNs or +-Infs.
11855
11856 This option is not turned on by any -O option since it can result
11857 in incorrect output for programs that depend on an exact
11858 implementation of IEEE or ISO rules/specifications for math
11859 functions. It may, however, yield faster code for programs that do
11860 not require the guarantees of these specifications.
11861
11862 The default is -fno-finite-math-only.
11863
11864 -fno-signed-zeros
11865 Allow optimizations for floating-point arithmetic that ignore the
11866 signedness of zero. IEEE arithmetic specifies the behavior of
11867 distinct +0.0 and -0.0 values, which then prohibits simplification
11868 of expressions such as x+0.0 or 0.0*x (even with
11869 -ffinite-math-only). This option implies that the sign of a zero
11870 result isn't significant.
11871
11872 The default is -fsigned-zeros.
11873
11874 -fno-trapping-math
11875 Compile code assuming that floating-point operations cannot
11876 generate user-visible traps. These traps include division by zero,
11877 overflow, underflow, inexact result and invalid operation. This
11878 option requires that -fno-signaling-nans be in effect. Setting
11879 this option may allow faster code if one relies on "non-stop" IEEE
11880 arithmetic, for example.
11881
11882 This option should never be turned on by any -O option since it can
11883 result in incorrect output for programs that depend on an exact
11884 implementation of IEEE or ISO rules/specifications for math
11885 functions.
11886
11887 The default is -ftrapping-math.
11888
11889 Future versions of GCC may provide finer control of this setting
11890 using C99's "FENV_ACCESS" pragma. This command-line option will be
11891 used along with -frounding-math to specify the default state for
11892 "FENV_ACCESS".
11893
11894 -frounding-math
11895 Disable transformations and optimizations that assume default
11896 floating-point rounding behavior. This is round-to-zero for all
11897 floating point to integer conversions, and round-to-nearest for all
11898 other arithmetic truncations. This option should be specified for
11899 programs that change the FP rounding mode dynamically, or that may
11900 be executed with a non-default rounding mode. This option disables
11901 constant folding of floating-point expressions at compile time
11902 (which may be affected by rounding mode) and arithmetic
11903 transformations that are unsafe in the presence of sign-dependent
11904 rounding modes.
11905
11906 The default is -fno-rounding-math.
11907
11908 This option is experimental and does not currently guarantee to
11909 disable all GCC optimizations that are affected by rounding mode.
11910 Future versions of GCC may provide finer control of this setting
11911 using C99's "FENV_ACCESS" pragma. This command-line option will be
11912 used along with -ftrapping-math to specify the default state for
11913 "FENV_ACCESS".
11914
11915 -fsignaling-nans
11916 Compile code assuming that IEEE signaling NaNs may generate user-
11917 visible traps during floating-point operations. Setting this
11918 option disables optimizations that may change the number of
11919 exceptions visible with signaling NaNs. This option implies
11920 -ftrapping-math.
11921
11922 This option causes the preprocessor macro "__SUPPORT_SNAN__" to be
11923 defined.
11924
11925 The default is -fno-signaling-nans.
11926
11927 This option is experimental and does not currently guarantee to
11928 disable all GCC optimizations that affect signaling NaN behavior.
11929
11930 -fno-fp-int-builtin-inexact
11931 Do not allow the built-in functions "ceil", "floor", "round" and
11932 "trunc", and their "float" and "long double" variants, to generate
11933 code that raises the "inexact" floating-point exception for
11934 noninteger arguments. ISO C99 and C11 allow these functions to
11935 raise the "inexact" exception, but ISO/IEC TS 18661-1:2014, the C
11936 bindings to IEEE 754-2008, as integrated into ISO C2X, does not
11937 allow these functions to do so.
11938
11939 The default is -ffp-int-builtin-inexact, allowing the exception to
11940 be raised, unless C2X or a later C standard is selected. This
11941 option does nothing unless -ftrapping-math is in effect.
11942
11943 Even if -fno-fp-int-builtin-inexact is used, if the functions
11944 generate a call to a library function then the "inexact" exception
11945 may be raised if the library implementation does not follow TS
11946 18661.
11947
11948 -fsingle-precision-constant
11949 Treat floating-point constants as single precision instead of
11950 implicitly converting them to double-precision constants.
11951
11952 -fcx-limited-range
11953 When enabled, this option states that a range reduction step is not
11954 needed when performing complex division. Also, there is no
11955 checking whether the result of a complex multiplication or division
11956 is "NaN + I*NaN", with an attempt to rescue the situation in that
11957 case. The default is -fno-cx-limited-range, but is enabled by
11958 -ffast-math.
11959
11960 This option controls the default setting of the ISO C99
11961 "CX_LIMITED_RANGE" pragma. Nevertheless, the option applies to all
11962 languages.
11963
11964 -fcx-fortran-rules
11965 Complex multiplication and division follow Fortran rules. Range
11966 reduction is done as part of complex division, but there is no
11967 checking whether the result of a complex multiplication or division
11968 is "NaN + I*NaN", with an attempt to rescue the situation in that
11969 case.
11970
11971 The default is -fno-cx-fortran-rules.
11972
11973 The following options control optimizations that may improve
11974 performance, but are not enabled by any -O options. This section
11975 includes experimental options that may produce broken code.
11976
11977 -fbranch-probabilities
11978 After running a program compiled with -fprofile-arcs, you can
11979 compile it a second time using -fbranch-probabilities, to improve
11980 optimizations based on the number of times each branch was taken.
11981 When a program compiled with -fprofile-arcs exits, it saves arc
11982 execution counts to a file called sourcename.gcda for each source
11983 file. The information in this data file is very dependent on the
11984 structure of the generated code, so you must use the same source
11985 code and the same optimization options for both compilations. See
11986 details about the file naming in -fprofile-arcs.
11987
11988 With -fbranch-probabilities, GCC puts a REG_BR_PROB note on each
11989 JUMP_INSN and CALL_INSN. These can be used to improve
11990 optimization. Currently, they are only used in one place: in
11991 reorg.cc, instead of guessing which path a branch is most likely to
11992 take, the REG_BR_PROB values are used to exactly determine which
11993 path is taken more often.
11994
11995 Enabled by -fprofile-use and -fauto-profile.
11996
11997 -fprofile-values
11998 If combined with -fprofile-arcs, it adds code so that some data
11999 about values of expressions in the program is gathered.
12000
12001 With -fbranch-probabilities, it reads back the data gathered from
12002 profiling values of expressions for usage in optimizations.
12003
12004 Enabled by -fprofile-generate, -fprofile-use, and -fauto-profile.
12005
12006 -fprofile-reorder-functions
12007 Function reordering based on profile instrumentation collects first
12008 time of execution of a function and orders these functions in
12009 ascending order.
12010
12011 Enabled with -fprofile-use.
12012
12013 -fvpt
12014 If combined with -fprofile-arcs, this option instructs the compiler
12015 to add code to gather information about values of expressions.
12016
12017 With -fbranch-probabilities, it reads back the data gathered and
12018 actually performs the optimizations based on them. Currently the
12019 optimizations include specialization of division operations using
12020 the knowledge about the value of the denominator.
12021
12022 Enabled with -fprofile-use and -fauto-profile.
12023
12024 -frename-registers
12025 Attempt to avoid false dependencies in scheduled code by making use
12026 of registers left over after register allocation. This
12027 optimization most benefits processors with lots of registers.
12028 Depending on the debug information format adopted by the target,
12029 however, it can make debugging impossible, since variables no
12030 longer stay in a "home register".
12031
12032 Enabled by default with -funroll-loops.
12033
12034 -fschedule-fusion
12035 Performs a target dependent pass over the instruction stream to
12036 schedule instructions of same type together because target machine
12037 can execute them more efficiently if they are adjacent to each
12038 other in the instruction flow.
12039
12040 Enabled at levels -O2, -O3, -Os.
12041
12042 -ftracer
12043 Perform tail duplication to enlarge superblock size. This
12044 transformation simplifies the control flow of the function allowing
12045 other optimizations to do a better job.
12046
12047 Enabled by -fprofile-use and -fauto-profile.
12048
12049 -funroll-loops
12050 Unroll loops whose number of iterations can be determined at
12051 compile time or upon entry to the loop. -funroll-loops implies
12052 -frerun-cse-after-loop, -fweb and -frename-registers. It also
12053 turns on complete loop peeling (i.e. complete removal of loops with
12054 a small constant number of iterations). This option makes code
12055 larger, and may or may not make it run faster.
12056
12057 Enabled by -fprofile-use and -fauto-profile.
12058
12059 -funroll-all-loops
12060 Unroll all loops, even if their number of iterations is uncertain
12061 when the loop is entered. This usually makes programs run more
12062 slowly. -funroll-all-loops implies the same options as
12063 -funroll-loops.
12064
12065 -fpeel-loops
12066 Peels loops for which there is enough information that they do not
12067 roll much (from profile feedback or static analysis). It also
12068 turns on complete loop peeling (i.e. complete removal of loops with
12069 small constant number of iterations).
12070
12071 Enabled by -O3, -fprofile-use, and -fauto-profile.
12072
12073 -fmove-loop-invariants
12074 Enables the loop invariant motion pass in the RTL loop optimizer.
12075 Enabled at level -O1 and higher, except for -Og.
12076
12077 -fmove-loop-stores
12078 Enables the loop store motion pass in the GIMPLE loop optimizer.
12079 This moves invariant stores to after the end of the loop in
12080 exchange for carrying the stored value in a register across the
12081 iteration. Note for this option to have an effect -ftree-loop-im
12082 has to be enabled as well. Enabled at level -O1 and higher, except
12083 for -Og.
12084
12085 -fsplit-loops
12086 Split a loop into two if it contains a condition that's always true
12087 for one side of the iteration space and false for the other.
12088
12089 Enabled by -fprofile-use and -fauto-profile.
12090
12091 -funswitch-loops
12092 Move branches with loop invariant conditions out of the loop, with
12093 duplicates of the loop on both branches (modified according to
12094 result of the condition).
12095
12096 Enabled by -fprofile-use and -fauto-profile.
12097
12098 -fversion-loops-for-strides
12099 If a loop iterates over an array with a variable stride, create
12100 another version of the loop that assumes the stride is always one.
12101 For example:
12102
12103 for (int i = 0; i < n; ++i)
12104 x[i * stride] = ...;
12105
12106 becomes:
12107
12108 if (stride == 1)
12109 for (int i = 0; i < n; ++i)
12110 x[i] = ...;
12111 else
12112 for (int i = 0; i < n; ++i)
12113 x[i * stride] = ...;
12114
12115 This is particularly useful for assumed-shape arrays in Fortran
12116 where (for example) it allows better vectorization assuming
12117 contiguous accesses. This flag is enabled by default at -O3. It
12118 is also enabled by -fprofile-use and -fauto-profile.
12119
12120 -ffunction-sections
12121 -fdata-sections
12122 Place each function or data item into its own section in the output
12123 file if the target supports arbitrary sections. The name of the
12124 function or the name of the data item determines the section's name
12125 in the output file.
12126
12127 Use these options on systems where the linker can perform
12128 optimizations to improve locality of reference in the instruction
12129 space. Most systems using the ELF object format have linkers with
12130 such optimizations. On AIX, the linker rearranges sections
12131 (CSECTs) based on the call graph. The performance impact varies.
12132
12133 Together with a linker garbage collection (linker --gc-sections
12134 option) these options may lead to smaller statically-linked
12135 executables (after stripping).
12136
12137 On ELF/DWARF systems these options do not degenerate the quality of
12138 the debug information. There could be issues with other object
12139 files/debug info formats.
12140
12141 Only use these options when there are significant benefits from
12142 doing so. When you specify these options, the assembler and linker
12143 create larger object and executable files and are also slower.
12144 These options affect code generation. They prevent optimizations
12145 by the compiler and assembler using relative locations inside a
12146 translation unit since the locations are unknown until link time.
12147 An example of such an optimization is relaxing calls to short call
12148 instructions.
12149
12150 -fstdarg-opt
12151 Optimize the prologue of variadic argument functions with respect
12152 to usage of those arguments.
12153
12154 -fsection-anchors
12155 Try to reduce the number of symbolic address calculations by using
12156 shared "anchor" symbols to address nearby objects. This
12157 transformation can help to reduce the number of GOT entries and GOT
12158 accesses on some targets.
12159
12160 For example, the implementation of the following function "foo":
12161
12162 static int a, b, c;
12163 int foo (void) { return a + b + c; }
12164
12165 usually calculates the addresses of all three variables, but if you
12166 compile it with -fsection-anchors, it accesses the variables from a
12167 common anchor point instead. The effect is similar to the
12168 following pseudocode (which isn't valid C):
12169
12170 int foo (void)
12171 {
12172 register int *xr = &x;
12173 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
12174 }
12175
12176 Not all targets support this option.
12177
12178 -fzero-call-used-regs=choice
12179 Zero call-used registers at function return to increase program
12180 security by either mitigating Return-Oriented Programming (ROP)
12181 attacks or preventing information leakage through registers.
12182
12183 The possible values of choice are the same as for the
12184 "zero_call_used_regs" attribute. The default is skip.
12185
12186 You can control this behavior for a specific function by using the
12187 function attribute "zero_call_used_regs".
12188
12189 --param name=value
12190 In some places, GCC uses various constants to control the amount of
12191 optimization that is done. For example, GCC does not inline
12192 functions that contain more than a certain number of instructions.
12193 You can control some of these constants on the command line using
12194 the --param option.
12195
12196 The names of specific parameters, and the meaning of the values,
12197 are tied to the internals of the compiler, and are subject to
12198 change without notice in future releases.
12199
12200 In order to get the minimal, maximal and default values of a
12201 parameter, use the --help=param -Q options.
12202
12203 In each case, the value is an integer. The following choices of
12204 name are recognized for all targets:
12205
12206 predictable-branch-outcome
12207 When branch is predicted to be taken with probability lower
12208 than this threshold (in percent), then it is considered well
12209 predictable.
12210
12211 max-rtl-if-conversion-insns
12212 RTL if-conversion tries to remove conditional branches around a
12213 block and replace them with conditionally executed
12214 instructions. This parameter gives the maximum number of
12215 instructions in a block which should be considered for if-
12216 conversion. The compiler will also use other heuristics to
12217 decide whether if-conversion is likely to be profitable.
12218
12219 max-rtl-if-conversion-predictable-cost
12220 RTL if-conversion will try to remove conditional branches
12221 around a block and replace them with conditionally executed
12222 instructions. These parameters give the maximum permissible
12223 cost for the sequence that would be generated by if-conversion
12224 depending on whether the branch is statically determined to be
12225 predictable or not. The units for this parameter are the same
12226 as those for the GCC internal seq_cost metric. The compiler
12227 will try to provide a reasonable default for this parameter
12228 using the BRANCH_COST target macro.
12229
12230 max-crossjump-edges
12231 The maximum number of incoming edges to consider for cross-
12232 jumping. The algorithm used by -fcrossjumping is O(N^2) in the
12233 number of edges incoming to each block. Increasing values mean
12234 more aggressive optimization, making the compilation time
12235 increase with probably small improvement in executable size.
12236
12237 min-crossjump-insns
12238 The minimum number of instructions that must be matched at the
12239 end of two blocks before cross-jumping is performed on them.
12240 This value is ignored in the case where all instructions in the
12241 block being cross-jumped from are matched.
12242
12243 max-grow-copy-bb-insns
12244 The maximum code size expansion factor when copying basic
12245 blocks instead of jumping. The expansion is relative to a jump
12246 instruction.
12247
12248 max-goto-duplication-insns
12249 The maximum number of instructions to duplicate to a block that
12250 jumps to a computed goto. To avoid O(N^2) behavior in a number
12251 of passes, GCC factors computed gotos early in the compilation
12252 process, and unfactors them as late as possible. Only computed
12253 jumps at the end of a basic blocks with no more than max-goto-
12254 duplication-insns are unfactored.
12255
12256 max-delay-slot-insn-search
12257 The maximum number of instructions to consider when looking for
12258 an instruction to fill a delay slot. If more than this
12259 arbitrary number of instructions are searched, the time savings
12260 from filling the delay slot are minimal, so stop searching.
12261 Increasing values mean more aggressive optimization, making the
12262 compilation time increase with probably small improvement in
12263 execution time.
12264
12265 max-delay-slot-live-search
12266 When trying to fill delay slots, the maximum number of
12267 instructions to consider when searching for a block with valid
12268 live register information. Increasing this arbitrarily chosen
12269 value means more aggressive optimization, increasing the
12270 compilation time. This parameter should be removed when the
12271 delay slot code is rewritten to maintain the control-flow
12272 graph.
12273
12274 max-gcse-memory
12275 The approximate maximum amount of memory in "kB" that can be
12276 allocated in order to perform the global common subexpression
12277 elimination optimization. If more memory than specified is
12278 required, the optimization is not done.
12279
12280 max-gcse-insertion-ratio
12281 If the ratio of expression insertions to deletions is larger
12282 than this value for any expression, then RTL PRE inserts or
12283 removes the expression and thus leaves partially redundant
12284 computations in the instruction stream.
12285
12286 max-pending-list-length
12287 The maximum number of pending dependencies scheduling allows
12288 before flushing the current state and starting over. Large
12289 functions with few branches or calls can create excessively
12290 large lists which needlessly consume memory and resources.
12291
12292 max-modulo-backtrack-attempts
12293 The maximum number of backtrack attempts the scheduler should
12294 make when modulo scheduling a loop. Larger values can
12295 exponentially increase compilation time.
12296
12297 max-inline-functions-called-once-loop-depth
12298 Maximal loop depth of a call considered by inline heuristics
12299 that tries to inline all functions called once.
12300
12301 max-inline-functions-called-once-insns
12302 Maximal estimated size of functions produced while inlining
12303 functions called once.
12304
12305 max-inline-insns-single
12306 Several parameters control the tree inliner used in GCC. This
12307 number sets the maximum number of instructions (counted in
12308 GCC's internal representation) in a single function that the
12309 tree inliner considers for inlining. This only affects
12310 functions declared inline and methods implemented in a class
12311 declaration (C++).
12312
12313 max-inline-insns-auto
12314 When you use -finline-functions (included in -O3), a lot of
12315 functions that would otherwise not be considered for inlining
12316 by the compiler are investigated. To those functions, a
12317 different (more restrictive) limit compared to functions
12318 declared inline can be applied (--param max-inline-insns-auto).
12319
12320 max-inline-insns-small
12321 This is bound applied to calls which are considered relevant
12322 with -finline-small-functions.
12323
12324 max-inline-insns-size
12325 This is bound applied to calls which are optimized for size.
12326 Small growth may be desirable to anticipate optimization
12327 oppurtunities exposed by inlining.
12328
12329 uninlined-function-insns
12330 Number of instructions accounted by inliner for function
12331 overhead such as function prologue and epilogue.
12332
12333 uninlined-function-time
12334 Extra time accounted by inliner for function overhead such as
12335 time needed to execute function prologue and epilogue.
12336
12337 inline-heuristics-hint-percent
12338 The scale (in percents) applied to inline-insns-single,
12339 inline-insns-single-O2, inline-insns-auto when inline
12340 heuristics hints that inlining is very profitable (will enable
12341 later optimizations).
12342
12343 uninlined-thunk-insns
12344 uninlined-thunk-time
12345 Same as --param uninlined-function-insns and --param uninlined-
12346 function-time but applied to function thunks.
12347
12348 inline-min-speedup
12349 When estimated performance improvement of caller + callee
12350 runtime exceeds this threshold (in percent), the function can
12351 be inlined regardless of the limit on --param max-inline-insns-
12352 single and --param max-inline-insns-auto.
12353
12354 large-function-insns
12355 The limit specifying really large functions. For functions
12356 larger than this limit after inlining, inlining is constrained
12357 by --param large-function-growth. This parameter is useful
12358 primarily to avoid extreme compilation time caused by non-
12359 linear algorithms used by the back end.
12360
12361 large-function-growth
12362 Specifies maximal growth of large function caused by inlining
12363 in percents. For example, parameter value 100 limits large
12364 function growth to 2.0 times the original size.
12365
12366 large-unit-insns
12367 The limit specifying large translation unit. Growth caused by
12368 inlining of units larger than this limit is limited by --param
12369 inline-unit-growth. For small units this might be too tight.
12370 For example, consider a unit consisting of function A that is
12371 inline and B that just calls A three times. If B is small
12372 relative to A, the growth of unit is 300\% and yet such
12373 inlining is very sane. For very large units consisting of
12374 small inlineable functions, however, the overall unit growth
12375 limit is needed to avoid exponential explosion of code size.
12376 Thus for smaller units, the size is increased to --param large-
12377 unit-insns before applying --param inline-unit-growth.
12378
12379 lazy-modules
12380 Maximum number of concurrently open C++ module files when lazy
12381 loading.
12382
12383 inline-unit-growth
12384 Specifies maximal overall growth of the compilation unit caused
12385 by inlining. For example, parameter value 20 limits unit
12386 growth to 1.2 times the original size. Cold functions (either
12387 marked cold via an attribute or by profile feedback) are not
12388 accounted into the unit size.
12389
12390 ipa-cp-unit-growth
12391 Specifies maximal overall growth of the compilation unit caused
12392 by interprocedural constant propagation. For example,
12393 parameter value 10 limits unit growth to 1.1 times the original
12394 size.
12395
12396 ipa-cp-large-unit-insns
12397 The size of translation unit that IPA-CP pass considers large.
12398
12399 large-stack-frame
12400 The limit specifying large stack frames. While inlining the
12401 algorithm is trying to not grow past this limit too much.
12402
12403 large-stack-frame-growth
12404 Specifies maximal growth of large stack frames caused by
12405 inlining in percents. For example, parameter value 1000 limits
12406 large stack frame growth to 11 times the original size.
12407
12408 max-inline-insns-recursive
12409 max-inline-insns-recursive-auto
12410 Specifies the maximum number of instructions an out-of-line
12411 copy of a self-recursive inline function can grow into by
12412 performing recursive inlining.
12413
12414 --param max-inline-insns-recursive applies to functions
12415 declared inline. For functions not declared inline, recursive
12416 inlining happens only when -finline-functions (included in -O3)
12417 is enabled; --param max-inline-insns-recursive-auto applies
12418 instead.
12419
12420 max-inline-recursive-depth
12421 max-inline-recursive-depth-auto
12422 Specifies the maximum recursion depth used for recursive
12423 inlining.
12424
12425 --param max-inline-recursive-depth applies to functions
12426 declared inline. For functions not declared inline, recursive
12427 inlining happens only when -finline-functions (included in -O3)
12428 is enabled; --param max-inline-recursive-depth-auto applies
12429 instead.
12430
12431 min-inline-recursive-probability
12432 Recursive inlining is profitable only for function having deep
12433 recursion in average and can hurt for function having little
12434 recursion depth by increasing the prologue size or complexity
12435 of function body to other optimizers.
12436
12437 When profile feedback is available (see -fprofile-generate) the
12438 actual recursion depth can be guessed from the probability that
12439 function recurses via a given call expression. This parameter
12440 limits inlining only to call expressions whose probability
12441 exceeds the given threshold (in percents).
12442
12443 early-inlining-insns
12444 Specify growth that the early inliner can make. In effect it
12445 increases the amount of inlining for code having a large
12446 abstraction penalty.
12447
12448 max-early-inliner-iterations
12449 Limit of iterations of the early inliner. This basically
12450 bounds the number of nested indirect calls the early inliner
12451 can resolve. Deeper chains are still handled by late inlining.
12452
12453 comdat-sharing-probability
12454 Probability (in percent) that C++ inline function with comdat
12455 visibility are shared across multiple compilation units.
12456
12457 modref-max-bases
12458 modref-max-refs
12459 modref-max-accesses
12460 Specifies the maximal number of base pointers, references and
12461 accesses stored for a single function by mod/ref analysis.
12462
12463 modref-max-tests
12464 Specifies the maxmal number of tests alias oracle can perform
12465 to disambiguate memory locations using the mod/ref information.
12466 This parameter ought to be bigger than --param modref-max-bases
12467 and --param modref-max-refs.
12468
12469 modref-max-depth
12470 Specifies the maximum depth of DFS walk used by modref escape
12471 analysis. Setting to 0 disables the analysis completely.
12472
12473 modref-max-escape-points
12474 Specifies the maximum number of escape points tracked by modref
12475 per SSA-name.
12476
12477 modref-max-adjustments
12478 Specifies the maximum number the access range is enlarged
12479 during modref dataflow analysis.
12480
12481 profile-func-internal-id
12482 A parameter to control whether to use function internal id in
12483 profile database lookup. If the value is 0, the compiler uses
12484 an id that is based on function assembler name and filename,
12485 which makes old profile data more tolerant to source changes
12486 such as function reordering etc.
12487
12488 min-vect-loop-bound
12489 The minimum number of iterations under which loops are not
12490 vectorized when -ftree-vectorize is used. The number of
12491 iterations after vectorization needs to be greater than the
12492 value specified by this option to allow vectorization.
12493
12494 gcse-cost-distance-ratio
12495 Scaling factor in calculation of maximum distance an expression
12496 can be moved by GCSE optimizations. This is currently
12497 supported only in the code hoisting pass. The bigger the
12498 ratio, the more aggressive code hoisting is with simple
12499 expressions, i.e., the expressions that have cost less than
12500 gcse-unrestricted-cost. Specifying 0 disables hoisting of
12501 simple expressions.
12502
12503 gcse-unrestricted-cost
12504 Cost, roughly measured as the cost of a single typical machine
12505 instruction, at which GCSE optimizations do not constrain the
12506 distance an expression can travel. This is currently supported
12507 only in the code hoisting pass. The lesser the cost, the more
12508 aggressive code hoisting is. Specifying 0 allows all
12509 expressions to travel unrestricted distances.
12510
12511 max-hoist-depth
12512 The depth of search in the dominator tree for expressions to
12513 hoist. This is used to avoid quadratic behavior in hoisting
12514 algorithm. The value of 0 does not limit on the search, but
12515 may slow down compilation of huge functions.
12516
12517 max-tail-merge-comparisons
12518 The maximum amount of similar bbs to compare a bb with. This
12519 is used to avoid quadratic behavior in tree tail merging.
12520
12521 max-tail-merge-iterations
12522 The maximum amount of iterations of the pass over the function.
12523 This is used to limit compilation time in tree tail merging.
12524
12525 store-merging-allow-unaligned
12526 Allow the store merging pass to introduce unaligned stores if
12527 it is legal to do so.
12528
12529 max-stores-to-merge
12530 The maximum number of stores to attempt to merge into wider
12531 stores in the store merging pass.
12532
12533 max-store-chains-to-track
12534 The maximum number of store chains to track at the same time in
12535 the attempt to merge them into wider stores in the store
12536 merging pass.
12537
12538 max-stores-to-track
12539 The maximum number of stores to track at the same time in the
12540 attemt to to merge them into wider stores in the store merging
12541 pass.
12542
12543 max-unrolled-insns
12544 The maximum number of instructions that a loop may have to be
12545 unrolled. If a loop is unrolled, this parameter also
12546 determines how many times the loop code is unrolled.
12547
12548 max-average-unrolled-insns
12549 The maximum number of instructions biased by probabilities of
12550 their execution that a loop may have to be unrolled. If a loop
12551 is unrolled, this parameter also determines how many times the
12552 loop code is unrolled.
12553
12554 max-unroll-times
12555 The maximum number of unrollings of a single loop.
12556
12557 max-peeled-insns
12558 The maximum number of instructions that a loop may have to be
12559 peeled. If a loop is peeled, this parameter also determines
12560 how many times the loop code is peeled.
12561
12562 max-peel-times
12563 The maximum number of peelings of a single loop.
12564
12565 max-peel-branches
12566 The maximum number of branches on the hot path through the
12567 peeled sequence.
12568
12569 max-completely-peeled-insns
12570 The maximum number of insns of a completely peeled loop.
12571
12572 max-completely-peel-times
12573 The maximum number of iterations of a loop to be suitable for
12574 complete peeling.
12575
12576 max-completely-peel-loop-nest-depth
12577 The maximum depth of a loop nest suitable for complete peeling.
12578
12579 max-unswitch-insns
12580 The maximum number of insns of an unswitched loop.
12581
12582 max-unswitch-depth
12583 The maximum depth of a loop nest to be unswitched.
12584
12585 lim-expensive
12586 The minimum cost of an expensive expression in the loop
12587 invariant motion.
12588
12589 min-loop-cond-split-prob
12590 When FDO profile information is available, min-loop-cond-split-
12591 prob specifies minimum threshold for probability of semi-
12592 invariant condition statement to trigger loop split.
12593
12594 iv-consider-all-candidates-bound
12595 Bound on number of candidates for induction variables, below
12596 which all candidates are considered for each use in induction
12597 variable optimizations. If there are more candidates than
12598 this, only the most relevant ones are considered to avoid
12599 quadratic time complexity.
12600
12601 iv-max-considered-uses
12602 The induction variable optimizations give up on loops that
12603 contain more induction variable uses.
12604
12605 iv-always-prune-cand-set-bound
12606 If the number of candidates in the set is smaller than this
12607 value, always try to remove unnecessary ivs from the set when
12608 adding a new one.
12609
12610 avg-loop-niter
12611 Average number of iterations of a loop.
12612
12613 dse-max-object-size
12614 Maximum size (in bytes) of objects tracked bytewise by dead
12615 store elimination. Larger values may result in larger
12616 compilation times.
12617
12618 dse-max-alias-queries-per-store
12619 Maximum number of queries into the alias oracle per store.
12620 Larger values result in larger compilation times and may result
12621 in more removed dead stores.
12622
12623 scev-max-expr-size
12624 Bound on size of expressions used in the scalar evolutions
12625 analyzer. Large expressions slow the analyzer.
12626
12627 scev-max-expr-complexity
12628 Bound on the complexity of the expressions in the scalar
12629 evolutions analyzer. Complex expressions slow the analyzer.
12630
12631 max-tree-if-conversion-phi-args
12632 Maximum number of arguments in a PHI supported by TREE if
12633 conversion unless the loop is marked with simd pragma.
12634
12635 vect-max-layout-candidates
12636 The maximum number of possible vector layouts (such as
12637 permutations) to consider when optimizing to-be-vectorized
12638 code.
12639
12640 vect-max-version-for-alignment-checks
12641 The maximum number of run-time checks that can be performed
12642 when doing loop versioning for alignment in the vectorizer.
12643
12644 vect-max-version-for-alias-checks
12645 The maximum number of run-time checks that can be performed
12646 when doing loop versioning for alias in the vectorizer.
12647
12648 vect-max-peeling-for-alignment
12649 The maximum number of loop peels to enhance access alignment
12650 for vectorizer. Value -1 means no limit.
12651
12652 max-iterations-to-track
12653 The maximum number of iterations of a loop the brute-force
12654 algorithm for analysis of the number of iterations of the loop
12655 tries to evaluate.
12656
12657 hot-bb-count-fraction
12658 The denominator n of fraction 1/n of the maximal execution
12659 count of a basic block in the entire program that a basic block
12660 needs to at least have in order to be considered hot. The
12661 default is 10000, which means that a basic block is considered
12662 hot if its execution count is greater than 1/10000 of the
12663 maximal execution count. 0 means that it is never considered
12664 hot. Used in non-LTO mode.
12665
12666 hot-bb-count-ws-permille
12667 The number of most executed permilles, ranging from 0 to 1000,
12668 of the profiled execution of the entire program to which the
12669 execution count of a basic block must be part of in order to be
12670 considered hot. The default is 990, which means that a basic
12671 block is considered hot if its execution count contributes to
12672 the upper 990 permilles, or 99.0%, of the profiled execution of
12673 the entire program. 0 means that it is never considered hot.
12674 Used in LTO mode.
12675
12676 hot-bb-frequency-fraction
12677 The denominator n of fraction 1/n of the execution frequency of
12678 the entry block of a function that a basic block of this
12679 function needs to at least have in order to be considered hot.
12680 The default is 1000, which means that a basic block is
12681 considered hot in a function if it is executed more frequently
12682 than 1/1000 of the frequency of the entry block of the
12683 function. 0 means that it is never considered hot.
12684
12685 unlikely-bb-count-fraction
12686 The denominator n of fraction 1/n of the number of profiled
12687 runs of the entire program below which the execution count of a
12688 basic block must be in order for the basic block to be
12689 considered unlikely executed. The default is 20, which means
12690 that a basic block is considered unlikely executed if it is
12691 executed in fewer than 1/20, or 5%, of the runs of the program.
12692 0 means that it is always considered unlikely executed.
12693
12694 max-predicted-iterations
12695 The maximum number of loop iterations we predict statically.
12696 This is useful in cases where a function contains a single loop
12697 with known bound and another loop with unknown bound. The
12698 known number of iterations is predicted correctly, while the
12699 unknown number of iterations average to roughly 10. This means
12700 that the loop without bounds appears artificially cold relative
12701 to the other one.
12702
12703 builtin-expect-probability
12704 Control the probability of the expression having the specified
12705 value. This parameter takes a percentage (i.e. 0 ... 100) as
12706 input.
12707
12708 builtin-string-cmp-inline-length
12709 The maximum length of a constant string for a builtin string
12710 cmp call eligible for inlining.
12711
12712 align-threshold
12713 Select fraction of the maximal frequency of executions of a
12714 basic block in a function to align the basic block.
12715
12716 align-loop-iterations
12717 A loop expected to iterate at least the selected number of
12718 iterations is aligned.
12719
12720 tracer-dynamic-coverage
12721 tracer-dynamic-coverage-feedback
12722 This value is used to limit superblock formation once the given
12723 percentage of executed instructions is covered. This limits
12724 unnecessary code size expansion.
12725
12726 The tracer-dynamic-coverage-feedback parameter is used only
12727 when profile feedback is available. The real profiles (as
12728 opposed to statically estimated ones) are much less balanced
12729 allowing the threshold to be larger value.
12730
12731 tracer-max-code-growth
12732 Stop tail duplication once code growth has reached given
12733 percentage. This is a rather artificial limit, as most of the
12734 duplicates are eliminated later in cross jumping, so it may be
12735 set to much higher values than is the desired code growth.
12736
12737 tracer-min-branch-ratio
12738 Stop reverse growth when the reverse probability of best edge
12739 is less than this threshold (in percent).
12740
12741 tracer-min-branch-probability
12742 tracer-min-branch-probability-feedback
12743 Stop forward growth if the best edge has probability lower than
12744 this threshold.
12745
12746 Similarly to tracer-dynamic-coverage two parameters are
12747 provided. tracer-min-branch-probability-feedback is used for
12748 compilation with profile feedback and tracer-min-branch-
12749 probability compilation without. The value for compilation
12750 with profile feedback needs to be more conservative (higher) in
12751 order to make tracer effective.
12752
12753 stack-clash-protection-guard-size
12754 Specify the size of the operating system provided stack guard
12755 as 2 raised to num bytes. Higher values may reduce the number
12756 of explicit probes, but a value larger than the operating
12757 system provided guard will leave code vulnerable to stack clash
12758 style attacks.
12759
12760 stack-clash-protection-probe-interval
12761 Stack clash protection involves probing stack space as it is
12762 allocated. This param controls the maximum distance between
12763 probes into the stack as 2 raised to num bytes. Higher values
12764 may reduce the number of explicit probes, but a value larger
12765 than the operating system provided guard will leave code
12766 vulnerable to stack clash style attacks.
12767
12768 max-cse-path-length
12769 The maximum number of basic blocks on path that CSE considers.
12770
12771 max-cse-insns
12772 The maximum number of instructions CSE processes before
12773 flushing.
12774
12775 ggc-min-expand
12776 GCC uses a garbage collector to manage its own memory
12777 allocation. This parameter specifies the minimum percentage by
12778 which the garbage collector's heap should be allowed to expand
12779 between collections. Tuning this may improve compilation
12780 speed; it has no effect on code generation.
12781
12782 The default is 30% + 70% * (RAM/1GB) with an upper bound of
12783 100% when RAM >= 1GB. If "getrlimit" is available, the notion
12784 of "RAM" is the smallest of actual RAM and "RLIMIT_DATA" or
12785 "RLIMIT_AS". If GCC is not able to calculate RAM on a
12786 particular platform, the lower bound of 30% is used. Setting
12787 this parameter and ggc-min-heapsize to zero causes a full
12788 collection to occur at every opportunity. This is extremely
12789 slow, but can be useful for debugging.
12790
12791 ggc-min-heapsize
12792 Minimum size of the garbage collector's heap before it begins
12793 bothering to collect garbage. The first collection occurs
12794 after the heap expands by ggc-min-expand% beyond ggc-min-
12795 heapsize. Again, tuning this may improve compilation speed,
12796 and has no effect on code generation.
12797
12798 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit
12799 that tries to ensure that RLIMIT_DATA or RLIMIT_AS are not
12800 exceeded, but with a lower bound of 4096 (four megabytes) and
12801 an upper bound of 131072 (128 megabytes). If GCC is not able
12802 to calculate RAM on a particular platform, the lower bound is
12803 used. Setting this parameter very large effectively disables
12804 garbage collection. Setting this parameter and ggc-min-expand
12805 to zero causes a full collection to occur at every opportunity.
12806
12807 max-reload-search-insns
12808 The maximum number of instruction reload should look backward
12809 for equivalent register. Increasing values mean more
12810 aggressive optimization, making the compilation time increase
12811 with probably slightly better performance.
12812
12813 max-cselib-memory-locations
12814 The maximum number of memory locations cselib should take into
12815 account. Increasing values mean more aggressive optimization,
12816 making the compilation time increase with probably slightly
12817 better performance.
12818
12819 max-sched-ready-insns
12820 The maximum number of instructions ready to be issued the
12821 scheduler should consider at any given time during the first
12822 scheduling pass. Increasing values mean more thorough
12823 searches, making the compilation time increase with probably
12824 little benefit.
12825
12826 max-sched-region-blocks
12827 The maximum number of blocks in a region to be considered for
12828 interblock scheduling.
12829
12830 max-pipeline-region-blocks
12831 The maximum number of blocks in a region to be considered for
12832 pipelining in the selective scheduler.
12833
12834 max-sched-region-insns
12835 The maximum number of insns in a region to be considered for
12836 interblock scheduling.
12837
12838 max-pipeline-region-insns
12839 The maximum number of insns in a region to be considered for
12840 pipelining in the selective scheduler.
12841
12842 min-spec-prob
12843 The minimum probability (in percents) of reaching a source
12844 block for interblock speculative scheduling.
12845
12846 max-sched-extend-regions-iters
12847 The maximum number of iterations through CFG to extend regions.
12848 A value of 0 disables region extensions.
12849
12850 max-sched-insn-conflict-delay
12851 The maximum conflict delay for an insn to be considered for
12852 speculative motion.
12853
12854 sched-spec-prob-cutoff
12855 The minimal probability of speculation success (in percents),
12856 so that speculative insns are scheduled.
12857
12858 sched-state-edge-prob-cutoff
12859 The minimum probability an edge must have for the scheduler to
12860 save its state across it.
12861
12862 sched-mem-true-dep-cost
12863 Minimal distance (in CPU cycles) between store and load
12864 targeting same memory locations.
12865
12866 selsched-max-lookahead
12867 The maximum size of the lookahead window of selective
12868 scheduling. It is a depth of search for available
12869 instructions.
12870
12871 selsched-max-sched-times
12872 The maximum number of times that an instruction is scheduled
12873 during selective scheduling. This is the limit on the number
12874 of iterations through which the instruction may be pipelined.
12875
12876 selsched-insns-to-rename
12877 The maximum number of best instructions in the ready list that
12878 are considered for renaming in the selective scheduler.
12879
12880 sms-min-sc
12881 The minimum value of stage count that swing modulo scheduler
12882 generates.
12883
12884 max-last-value-rtl
12885 The maximum size measured as number of RTLs that can be
12886 recorded in an expression in combiner for a pseudo register as
12887 last known value of that register.
12888
12889 max-combine-insns
12890 The maximum number of instructions the RTL combiner tries to
12891 combine.
12892
12893 integer-share-limit
12894 Small integer constants can use a shared data structure,
12895 reducing the compiler's memory usage and increasing its speed.
12896 This sets the maximum value of a shared integer constant.
12897
12898 ssp-buffer-size
12899 The minimum size of buffers (i.e. arrays) that receive stack
12900 smashing protection when -fstack-protector is used.
12901
12902 min-size-for-stack-sharing
12903 The minimum size of variables taking part in stack slot sharing
12904 when not optimizing.
12905
12906 max-jump-thread-duplication-stmts
12907 Maximum number of statements allowed in a block that needs to
12908 be duplicated when threading jumps.
12909
12910 max-jump-thread-paths
12911 The maximum number of paths to consider when searching for jump
12912 threading opportunities. When arriving at a block, incoming
12913 edges are only considered if the number of paths to be searched
12914 so far multiplied by the number of incoming edges does not
12915 exhaust the specified maximum number of paths to consider.
12916
12917 max-fields-for-field-sensitive
12918 Maximum number of fields in a structure treated in a field
12919 sensitive manner during pointer analysis.
12920
12921 prefetch-latency
12922 Estimate on average number of instructions that are executed
12923 before prefetch finishes. The distance prefetched ahead is
12924 proportional to this constant. Increasing this number may also
12925 lead to less streams being prefetched (see simultaneous-
12926 prefetches).
12927
12928 simultaneous-prefetches
12929 Maximum number of prefetches that can run at the same time.
12930
12931 l1-cache-line-size
12932 The size of cache line in L1 data cache, in bytes.
12933
12934 l1-cache-size
12935 The size of L1 data cache, in kilobytes.
12936
12937 l2-cache-size
12938 The size of L2 data cache, in kilobytes.
12939
12940 prefetch-dynamic-strides
12941 Whether the loop array prefetch pass should issue software
12942 prefetch hints for strides that are non-constant. In some
12943 cases this may be beneficial, though the fact the stride is
12944 non-constant may make it hard to predict when there is clear
12945 benefit to issuing these hints.
12946
12947 Set to 1 if the prefetch hints should be issued for non-
12948 constant strides. Set to 0 if prefetch hints should be issued
12949 only for strides that are known to be constant and below
12950 prefetch-minimum-stride.
12951
12952 prefetch-minimum-stride
12953 Minimum constant stride, in bytes, to start using prefetch
12954 hints for. If the stride is less than this threshold, prefetch
12955 hints will not be issued.
12956
12957 This setting is useful for processors that have hardware
12958 prefetchers, in which case there may be conflicts between the
12959 hardware prefetchers and the software prefetchers. If the
12960 hardware prefetchers have a maximum stride they can handle, it
12961 should be used here to improve the use of software prefetchers.
12962
12963 A value of -1 means we don't have a threshold and therefore
12964 prefetch hints can be issued for any constant stride.
12965
12966 This setting is only useful for strides that are known and
12967 constant.
12968
12969 destructive-interference-size
12970 constructive-interference-size
12971 The values for the C++17 variables
12972 "std::hardware_destructive_interference_size" and
12973 "std::hardware_constructive_interference_size". The
12974 destructive interference size is the minimum recommended offset
12975 between two independent concurrently-accessed objects; the
12976 constructive interference size is the maximum recommended size
12977 of contiguous memory accessed together. Typically both will be
12978 the size of an L1 cache line for the target, in bytes. For a
12979 generic target covering a range of L1 cache line sizes,
12980 typically the constructive interference size will be the small
12981 end of the range and the destructive size will be the large
12982 end.
12983
12984 The destructive interference size is intended to be used for
12985 layout, and thus has ABI impact. The default value is not
12986 expected to be stable, and on some targets varies with -mtune,
12987 so use of this variable in a context where ABI stability is
12988 important, such as the public interface of a library, is
12989 strongly discouraged; if it is used in that context, users can
12990 stabilize the value using this option.
12991
12992 The constructive interference size is less sensitive, as it is
12993 typically only used in a static_assert to make sure that a type
12994 fits within a cache line.
12995
12996 See also -Winterference-size.
12997
12998 loop-interchange-max-num-stmts
12999 The maximum number of stmts in a loop to be interchanged.
13000
13001 loop-interchange-stride-ratio
13002 The minimum ratio between stride of two loops for interchange
13003 to be profitable.
13004
13005 min-insn-to-prefetch-ratio
13006 The minimum ratio between the number of instructions and the
13007 number of prefetches to enable prefetching in a loop.
13008
13009 prefetch-min-insn-to-mem-ratio
13010 The minimum ratio between the number of instructions and the
13011 number of memory references to enable prefetching in a loop.
13012
13013 use-canonical-types
13014 Whether the compiler should use the "canonical" type system.
13015 Should always be 1, which uses a more efficient internal
13016 mechanism for comparing types in C++ and Objective-C++.
13017 However, if bugs in the canonical type system are causing
13018 compilation failures, set this value to 0 to disable canonical
13019 types.
13020
13021 switch-conversion-max-branch-ratio
13022 Switch initialization conversion refuses to create arrays that
13023 are bigger than switch-conversion-max-branch-ratio times the
13024 number of branches in the switch.
13025
13026 max-partial-antic-length
13027 Maximum length of the partial antic set computed during the
13028 tree partial redundancy elimination optimization (-ftree-pre)
13029 when optimizing at -O3 and above. For some sorts of source
13030 code the enhanced partial redundancy elimination optimization
13031 can run away, consuming all of the memory available on the host
13032 machine. This parameter sets a limit on the length of the sets
13033 that are computed, which prevents the runaway behavior.
13034 Setting a value of 0 for this parameter allows an unlimited set
13035 length.
13036
13037 rpo-vn-max-loop-depth
13038 Maximum loop depth that is value-numbered optimistically. When
13039 the limit hits the innermost rpo-vn-max-loop-depth loops and
13040 the outermost loop in the loop nest are value-numbered
13041 optimistically and the remaining ones not.
13042
13043 sccvn-max-alias-queries-per-access
13044 Maximum number of alias-oracle queries we perform when looking
13045 for redundancies for loads and stores. If this limit is hit
13046 the search is aborted and the load or store is not considered
13047 redundant. The number of queries is algorithmically limited to
13048 the number of stores on all paths from the load to the function
13049 entry.
13050
13051 ira-max-loops-num
13052 IRA uses regional register allocation by default. If a
13053 function contains more loops than the number given by this
13054 parameter, only at most the given number of the most
13055 frequently-executed loops form regions for regional register
13056 allocation.
13057
13058 ira-max-conflict-table-size
13059 Although IRA uses a sophisticated algorithm to compress the
13060 conflict table, the table can still require excessive amounts
13061 of memory for huge functions. If the conflict table for a
13062 function could be more than the size in MB given by this
13063 parameter, the register allocator instead uses a faster,
13064 simpler, and lower-quality algorithm that does not require
13065 building a pseudo-register conflict table.
13066
13067 ira-loop-reserved-regs
13068 IRA can be used to evaluate more accurate register pressure in
13069 loops for decisions to move loop invariants (see -O3). The
13070 number of available registers reserved for some other purposes
13071 is given by this parameter. Default of the parameter is the
13072 best found from numerous experiments.
13073
13074 ira-consider-dup-in-all-alts
13075 Make IRA to consider matching constraint (duplicated operand
13076 number) heavily in all available alternatives for preferred
13077 register class. If it is set as zero, it means IRA only
13078 respects the matching constraint when it's in the only
13079 available alternative with an appropriate register class.
13080 Otherwise, it means IRA will check all available alternatives
13081 for preferred register class even if it has found some choice
13082 with an appropriate register class and respect the found
13083 qualified matching constraint.
13084
13085 ira-simple-lra-insn-threshold
13086 Approximate function insn number in 1K units triggering simple
13087 local RA.
13088
13089 lra-inheritance-ebb-probability-cutoff
13090 LRA tries to reuse values reloaded in registers in subsequent
13091 insns. This optimization is called inheritance. EBB is used
13092 as a region to do this optimization. The parameter defines a
13093 minimal fall-through edge probability in percentage used to add
13094 BB to inheritance EBB in LRA. The default value was chosen
13095 from numerous runs of SPEC2000 on x86-64.
13096
13097 loop-invariant-max-bbs-in-loop
13098 Loop invariant motion can be very expensive, both in
13099 compilation time and in amount of needed compile-time memory,
13100 with very large loops. Loops with more basic blocks than this
13101 parameter won't have loop invariant motion optimization
13102 performed on them.
13103
13104 loop-max-datarefs-for-datadeps
13105 Building data dependencies is expensive for very large loops.
13106 This parameter limits the number of data references in loops
13107 that are considered for data dependence analysis. These large
13108 loops are no handled by the optimizations using loop data
13109 dependencies.
13110
13111 max-vartrack-size
13112 Sets a maximum number of hash table slots to use during
13113 variable tracking dataflow analysis of any function. If this
13114 limit is exceeded with variable tracking at assignments
13115 enabled, analysis for that function is retried without it,
13116 after removing all debug insns from the function. If the limit
13117 is exceeded even without debug insns, var tracking analysis is
13118 completely disabled for the function. Setting the parameter to
13119 zero makes it unlimited.
13120
13121 max-vartrack-expr-depth
13122 Sets a maximum number of recursion levels when attempting to
13123 map variable names or debug temporaries to value expressions.
13124 This trades compilation time for more complete debug
13125 information. If this is set too low, value expressions that
13126 are available and could be represented in debug information may
13127 end up not being used; setting this higher may enable the
13128 compiler to find more complex debug expressions, but compile
13129 time and memory use may grow.
13130
13131 max-debug-marker-count
13132 Sets a threshold on the number of debug markers (e.g. begin
13133 stmt markers) to avoid complexity explosion at inlining or
13134 expanding to RTL. If a function has more such gimple stmts
13135 than the set limit, such stmts will be dropped from the inlined
13136 copy of a function, and from its RTL expansion.
13137
13138 min-nondebug-insn-uid
13139 Use uids starting at this parameter for nondebug insns. The
13140 range below the parameter is reserved exclusively for debug
13141 insns created by -fvar-tracking-assignments, but debug insns
13142 may get (non-overlapping) uids above it if the reserved range
13143 is exhausted.
13144
13145 ipa-sra-deref-prob-threshold
13146 IPA-SRA replaces a pointer which is known not be NULL with one
13147 or more new parameters only when the probability (in percent,
13148 relative to function entry) of it being dereferenced is higher
13149 than this parameter.
13150
13151 ipa-sra-ptr-growth-factor
13152 IPA-SRA replaces a pointer to an aggregate with one or more new
13153 parameters only when their cumulative size is less or equal to
13154 ipa-sra-ptr-growth-factor times the size of the original
13155 pointer parameter.
13156
13157 ipa-sra-ptrwrap-growth-factor
13158 Additional maximum allowed growth of total size of new
13159 parameters that ipa-sra replaces a pointer to an aggregate
13160 with, if it points to a local variable that the caller only
13161 writes to and passes it as an argument to other functions.
13162
13163 ipa-sra-max-replacements
13164 Maximum pieces of an aggregate that IPA-SRA tracks. As a
13165 consequence, it is also the maximum number of replacements of a
13166 formal parameter.
13167
13168 sra-max-scalarization-size-Ospeed
13169 sra-max-scalarization-size-Osize
13170 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA)
13171 aim to replace scalar parts of aggregates with uses of
13172 independent scalar variables. These parameters control the
13173 maximum size, in storage units, of aggregate which is
13174 considered for replacement when compiling for speed (sra-max-
13175 scalarization-size-Ospeed) or size (sra-max-scalarization-size-
13176 Osize) respectively.
13177
13178 sra-max-propagations
13179 The maximum number of artificial accesses that Scalar
13180 Replacement of Aggregates (SRA) will track, per one local
13181 variable, in order to facilitate copy propagation.
13182
13183 tm-max-aggregate-size
13184 When making copies of thread-local variables in a transaction,
13185 this parameter specifies the size in bytes after which
13186 variables are saved with the logging functions as opposed to
13187 save/restore code sequence pairs. This option only applies
13188 when using -fgnu-tm.
13189
13190 graphite-max-nb-scop-params
13191 To avoid exponential effects in the Graphite loop transforms,
13192 the number of parameters in a Static Control Part (SCoP) is
13193 bounded. A value of zero can be used to lift the bound. A
13194 variable whose value is unknown at compilation time and defined
13195 outside a SCoP is a parameter of the SCoP.
13196
13197 loop-block-tile-size
13198 Loop blocking or strip mining transforms, enabled with
13199 -floop-block or -floop-strip-mine, strip mine each loop in the
13200 loop nest by a given number of iterations. The strip length
13201 can be changed using the loop-block-tile-size parameter.
13202
13203 ipa-jump-function-lookups
13204 Specifies number of statements visited during jump function
13205 offset discovery.
13206
13207 ipa-cp-value-list-size
13208 IPA-CP attempts to track all possible values and types passed
13209 to a function's parameter in order to propagate them and
13210 perform devirtualization. ipa-cp-value-list-size is the
13211 maximum number of values and types it stores per one formal
13212 parameter of a function.
13213
13214 ipa-cp-eval-threshold
13215 IPA-CP calculates its own score of cloning profitability
13216 heuristics and performs those cloning opportunities with scores
13217 that exceed ipa-cp-eval-threshold.
13218
13219 ipa-cp-max-recursive-depth
13220 Maximum depth of recursive cloning for self-recursive function.
13221
13222 ipa-cp-min-recursive-probability
13223 Recursive cloning only when the probability of call being
13224 executed exceeds the parameter.
13225
13226 ipa-cp-profile-count-base
13227 When using -fprofile-use option, IPA-CP will consider the
13228 measured execution count of a call graph edge at this
13229 percentage position in their histogram as the basis for its
13230 heuristics calculation.
13231
13232 ipa-cp-recursive-freq-factor
13233 The number of times interprocedural copy propagation expects
13234 recursive functions to call themselves.
13235
13236 ipa-cp-recursion-penalty
13237 Percentage penalty the recursive functions will receive when
13238 they are evaluated for cloning.
13239
13240 ipa-cp-single-call-penalty
13241 Percentage penalty functions containing a single call to
13242 another function will receive when they are evaluated for
13243 cloning.
13244
13245 ipa-max-agg-items
13246 IPA-CP is also capable to propagate a number of scalar values
13247 passed in an aggregate. ipa-max-agg-items controls the maximum
13248 number of such values per one parameter.
13249
13250 ipa-cp-loop-hint-bonus
13251 When IPA-CP determines that a cloning candidate would make the
13252 number of iterations of a loop known, it adds a bonus of ipa-
13253 cp-loop-hint-bonus to the profitability score of the candidate.
13254
13255 ipa-max-loop-predicates
13256 The maximum number of different predicates IPA will use to
13257 describe when loops in a function have known properties.
13258
13259 ipa-max-aa-steps
13260 During its analysis of function bodies, IPA-CP employs alias
13261 analysis in order to track values pointed to by function
13262 parameters. In order not spend too much time analyzing huge
13263 functions, it gives up and consider all memory clobbered after
13264 examining ipa-max-aa-steps statements modifying memory.
13265
13266 ipa-max-switch-predicate-bounds
13267 Maximal number of boundary endpoints of case ranges of switch
13268 statement. For switch exceeding this limit, IPA-CP will not
13269 construct cloning cost predicate, which is used to estimate
13270 cloning benefit, for default case of the switch statement.
13271
13272 ipa-max-param-expr-ops
13273 IPA-CP will analyze conditional statement that references some
13274 function parameter to estimate benefit for cloning upon certain
13275 constant value. But if number of operations in a parameter
13276 expression exceeds ipa-max-param-expr-ops, the expression is
13277 treated as complicated one, and is not handled by IPA analysis.
13278
13279 lto-partitions
13280 Specify desired number of partitions produced during WHOPR
13281 compilation. The number of partitions should exceed the number
13282 of CPUs used for compilation.
13283
13284 lto-min-partition
13285 Size of minimal partition for WHOPR (in estimated
13286 instructions). This prevents expenses of splitting very small
13287 programs into too many partitions.
13288
13289 lto-max-partition
13290 Size of max partition for WHOPR (in estimated instructions).
13291 to provide an upper bound for individual size of partition.
13292 Meant to be used only with balanced partitioning.
13293
13294 lto-max-streaming-parallelism
13295 Maximal number of parallel processes used for LTO streaming.
13296
13297 cxx-max-namespaces-for-diagnostic-help
13298 The maximum number of namespaces to consult for suggestions
13299 when C++ name lookup fails for an identifier.
13300
13301 sink-frequency-threshold
13302 The maximum relative execution frequency (in percents) of the
13303 target block relative to a statement's original block to allow
13304 statement sinking of a statement. Larger numbers result in
13305 more aggressive statement sinking. A small positive adjustment
13306 is applied for statements with memory operands as those are
13307 even more profitable so sink.
13308
13309 max-stores-to-sink
13310 The maximum number of conditional store pairs that can be sunk.
13311 Set to 0 if either vectorization (-ftree-vectorize) or if-
13312 conversion (-ftree-loop-if-convert) is disabled.
13313
13314 case-values-threshold
13315 The smallest number of different values for which it is best to
13316 use a jump-table instead of a tree of conditional branches. If
13317 the value is 0, use the default for the machine.
13318
13319 jump-table-max-growth-ratio-for-size
13320 The maximum code size growth ratio when expanding into a jump
13321 table (in percent). The parameter is used when optimizing for
13322 size.
13323
13324 jump-table-max-growth-ratio-for-speed
13325 The maximum code size growth ratio when expanding into a jump
13326 table (in percent). The parameter is used when optimizing for
13327 speed.
13328
13329 tree-reassoc-width
13330 Set the maximum number of instructions executed in parallel in
13331 reassociated tree. This parameter overrides target dependent
13332 heuristics used by default if has non zero value.
13333
13334 sched-pressure-algorithm
13335 Choose between the two available implementations of
13336 -fsched-pressure. Algorithm 1 is the original implementation
13337 and is the more likely to prevent instructions from being
13338 reordered. Algorithm 2 was designed to be a compromise between
13339 the relatively conservative approach taken by algorithm 1 and
13340 the rather aggressive approach taken by the default scheduler.
13341 It relies more heavily on having a regular register file and
13342 accurate register pressure classes. See haifa-sched.cc in the
13343 GCC sources for more details.
13344
13345 The default choice depends on the target.
13346
13347 max-slsr-cand-scan
13348 Set the maximum number of existing candidates that are
13349 considered when seeking a basis for a new straight-line
13350 strength reduction candidate.
13351
13352 asan-globals
13353 Enable buffer overflow detection for global objects. This kind
13354 of protection is enabled by default if you are using
13355 -fsanitize=address option. To disable global objects
13356 protection use --param asan-globals=0.
13357
13358 asan-stack
13359 Enable buffer overflow detection for stack objects. This kind
13360 of protection is enabled by default when using
13361 -fsanitize=address. To disable stack protection use --param
13362 asan-stack=0 option.
13363
13364 asan-instrument-reads
13365 Enable buffer overflow detection for memory reads. This kind
13366 of protection is enabled by default when using
13367 -fsanitize=address. To disable memory reads protection use
13368 --param asan-instrument-reads=0.
13369
13370 asan-instrument-writes
13371 Enable buffer overflow detection for memory writes. This kind
13372 of protection is enabled by default when using
13373 -fsanitize=address. To disable memory writes protection use
13374 --param asan-instrument-writes=0 option.
13375
13376 asan-memintrin
13377 Enable detection for built-in functions. This kind of
13378 protection is enabled by default when using -fsanitize=address.
13379 To disable built-in functions protection use --param
13380 asan-memintrin=0.
13381
13382 asan-use-after-return
13383 Enable detection of use-after-return. This kind of protection
13384 is enabled by default when using the -fsanitize=address option.
13385 To disable it use --param asan-use-after-return=0.
13386
13387 Note: By default the check is disabled at run time. To enable
13388 it, add "detect_stack_use_after_return=1" to the environment
13389 variable ASAN_OPTIONS.
13390
13391 asan-instrumentation-with-call-threshold
13392 If number of memory accesses in function being instrumented is
13393 greater or equal to this number, use callbacks instead of
13394 inline checks. E.g. to disable inline code use --param
13395 asan-instrumentation-with-call-threshold=0.
13396
13397 asan-kernel-mem-intrinsic-prefix
13398 If nonzero, prefix calls to "memcpy", "memset" and "memmove"
13399 with __asan_ or __hwasan_ for -fsanitize=kernel-address or
13400 -fsanitize=kernel-hwaddress, respectively.
13401
13402 hwasan-instrument-stack
13403 Enable hwasan instrumentation of statically sized stack-
13404 allocated variables. This kind of instrumentation is enabled
13405 by default when using -fsanitize=hwaddress and disabled by
13406 default when using -fsanitize=kernel-hwaddress. To disable
13407 stack instrumentation use --param hwasan-instrument-stack=0,
13408 and to enable it use --param hwasan-instrument-stack=1.
13409
13410 hwasan-random-frame-tag
13411 When using stack instrumentation, decide tags for stack
13412 variables using a deterministic sequence beginning at a random
13413 tag for each frame. With this parameter unset tags are chosen
13414 using the same sequence but beginning from 1. This is enabled
13415 by default for -fsanitize=hwaddress and unavailable for
13416 -fsanitize=kernel-hwaddress. To disable it use --param
13417 hwasan-random-frame-tag=0.
13418
13419 hwasan-instrument-allocas
13420 Enable hwasan instrumentation of dynamically sized stack-
13421 allocated variables. This kind of instrumentation is enabled
13422 by default when using -fsanitize=hwaddress and disabled by
13423 default when using -fsanitize=kernel-hwaddress. To disable
13424 instrumentation of such variables use --param
13425 hwasan-instrument-allocas=0, and to enable it use --param
13426 hwasan-instrument-allocas=1.
13427
13428 hwasan-instrument-reads
13429 Enable hwasan checks on memory reads. Instrumentation of reads
13430 is enabled by default for both -fsanitize=hwaddress and
13431 -fsanitize=kernel-hwaddress. To disable checking memory reads
13432 use --param hwasan-instrument-reads=0.
13433
13434 hwasan-instrument-writes
13435 Enable hwasan checks on memory writes. Instrumentation of
13436 writes is enabled by default for both -fsanitize=hwaddress and
13437 -fsanitize=kernel-hwaddress. To disable checking memory writes
13438 use --param hwasan-instrument-writes=0.
13439
13440 hwasan-instrument-mem-intrinsics
13441 Enable hwasan instrumentation of builtin functions.
13442 Instrumentation of these builtin functions is enabled by
13443 default for both -fsanitize=hwaddress and
13444 -fsanitize=kernel-hwaddress. To disable instrumentation of
13445 builtin functions use --param
13446 hwasan-instrument-mem-intrinsics=0.
13447
13448 use-after-scope-direct-emission-threshold
13449 If the size of a local variable in bytes is smaller or equal to
13450 this number, directly poison (or unpoison) shadow memory
13451 instead of using run-time callbacks.
13452
13453 tsan-distinguish-volatile
13454 Emit special instrumentation for accesses to volatiles.
13455
13456 tsan-instrument-func-entry-exit
13457 Emit instrumentation calls to __tsan_func_entry() and
13458 __tsan_func_exit().
13459
13460 max-fsm-thread-path-insns
13461 Maximum number of instructions to copy when duplicating blocks
13462 on a finite state automaton jump thread path.
13463
13464 threader-debug
13465 threader-debug=[none|all] Enables verbose dumping of the
13466 threader solver.
13467
13468 parloops-chunk-size
13469 Chunk size of omp schedule for loops parallelized by parloops.
13470
13471 parloops-schedule
13472 Schedule type of omp schedule for loops parallelized by
13473 parloops (static, dynamic, guided, auto, runtime).
13474
13475 parloops-min-per-thread
13476 The minimum number of iterations per thread of an innermost
13477 parallelized loop for which the parallelized variant is
13478 preferred over the single threaded one. Note that for a
13479 parallelized loop nest the minimum number of iterations of the
13480 outermost loop per thread is two.
13481
13482 max-ssa-name-query-depth
13483 Maximum depth of recursion when querying properties of SSA
13484 names in things like fold routines. One level of recursion
13485 corresponds to following a use-def chain.
13486
13487 max-speculative-devirt-maydefs
13488 The maximum number of may-defs we analyze when looking for a
13489 must-def specifying the dynamic type of an object that invokes
13490 a virtual call we may be able to devirtualize speculatively.
13491
13492 evrp-sparse-threshold
13493 Maximum number of basic blocks before EVRP uses a sparse cache.
13494
13495 ranger-debug
13496 Specifies the type of debug output to be issued for ranges.
13497
13498 evrp-switch-limit
13499 Specifies the maximum number of switch cases before EVRP
13500 ignores a switch.
13501
13502 unroll-jam-min-percent
13503 The minimum percentage of memory references that must be
13504 optimized away for the unroll-and-jam transformation to be
13505 considered profitable.
13506
13507 unroll-jam-max-unroll
13508 The maximum number of times the outer loop should be unrolled
13509 by the unroll-and-jam transformation.
13510
13511 max-rtl-if-conversion-unpredictable-cost
13512 Maximum permissible cost for the sequence that would be
13513 generated by the RTL if-conversion pass for a branch that is
13514 considered unpredictable.
13515
13516 max-variable-expansions-in-unroller
13517 If -fvariable-expansion-in-unroller is used, the maximum number
13518 of times that an individual variable will be expanded during
13519 loop unrolling.
13520
13521 partial-inlining-entry-probability
13522 Maximum probability of the entry BB of split region (in percent
13523 relative to entry BB of the function) to make partial inlining
13524 happen.
13525
13526 max-tracked-strlens
13527 Maximum number of strings for which strlen optimization pass
13528 will track string lengths.
13529
13530 gcse-after-reload-partial-fraction
13531 The threshold ratio for performing partial redundancy
13532 elimination after reload.
13533
13534 gcse-after-reload-critical-fraction
13535 The threshold ratio of critical edges execution count that
13536 permit performing redundancy elimination after reload.
13537
13538 max-loop-header-insns
13539 The maximum number of insns in loop header duplicated by the
13540 copy loop headers pass.
13541
13542 vect-epilogues-nomask
13543 Enable loop epilogue vectorization using smaller vector size.
13544
13545 vect-partial-vector-usage
13546 Controls when the loop vectorizer considers using partial
13547 vector loads and stores as an alternative to falling back to
13548 scalar code. 0 stops the vectorizer from ever using partial
13549 vector loads and stores. 1 allows partial vector loads and
13550 stores if vectorization removes the need for the code to
13551 iterate. 2 allows partial vector loads and stores in all
13552 loops. The parameter only has an effect on targets that
13553 support partial vector loads and stores.
13554
13555 vect-inner-loop-cost-factor
13556 The maximum factor which the loop vectorizer applies to the
13557 cost of statements in an inner loop relative to the loop being
13558 vectorized. The factor applied is the maximum of the estimated
13559 number of iterations of the inner loop and this parameter. The
13560 default value of this parameter is 50.
13561
13562 vect-induction-float
13563 Enable loop vectorization of floating point inductions.
13564
13565 avoid-fma-max-bits
13566 Maximum number of bits for which we avoid creating FMAs.
13567
13568 sms-loop-average-count-threshold
13569 A threshold on the average loop count considered by the swing
13570 modulo scheduler.
13571
13572 sms-dfa-history
13573 The number of cycles the swing modulo scheduler considers when
13574 checking conflicts using DFA.
13575
13576 graphite-allow-codegen-errors
13577 Whether codegen errors should be ICEs when -fchecking.
13578
13579 sms-max-ii-factor
13580 A factor for tuning the upper bound that swing modulo scheduler
13581 uses for scheduling a loop.
13582
13583 lra-max-considered-reload-pseudos
13584 The max number of reload pseudos which are considered during
13585 spilling a non-reload pseudo.
13586
13587 max-pow-sqrt-depth
13588 Maximum depth of sqrt chains to use when synthesizing
13589 exponentiation by a real constant.
13590
13591 max-dse-active-local-stores
13592 Maximum number of active local stores in RTL dead store
13593 elimination.
13594
13595 asan-instrument-allocas
13596 Enable asan allocas/VLAs protection.
13597
13598 max-iterations-computation-cost
13599 Bound on the cost of an expression to compute the number of
13600 iterations.
13601
13602 max-isl-operations
13603 Maximum number of isl operations, 0 means unlimited.
13604
13605 graphite-max-arrays-per-scop
13606 Maximum number of arrays per scop.
13607
13608 max-vartrack-reverse-op-size
13609 Max. size of loc list for which reverse ops should be added.
13610
13611 fsm-scale-path-stmts
13612 Scale factor to apply to the number of statements in a
13613 threading path crossing a loop backedge when comparing to
13614 --param=max-jump-thread-duplication-stmts.
13615
13616 uninit-control-dep-attempts
13617 Maximum number of nested calls to search for control
13618 dependencies during uninitialized variable analysis.
13619
13620 sched-autopref-queue-depth
13621 Hardware autoprefetcher scheduler model control flag. Number
13622 of lookahead cycles the model looks into; at ' ' only enable
13623 instruction sorting heuristic.
13624
13625 loop-versioning-max-inner-insns
13626 The maximum number of instructions that an inner loop can have
13627 before the loop versioning pass considers it too big to copy.
13628
13629 loop-versioning-max-outer-insns
13630 The maximum number of instructions that an outer loop can have
13631 before the loop versioning pass considers it too big to copy,
13632 discounting any instructions in inner loops that directly
13633 benefit from versioning.
13634
13635 ssa-name-def-chain-limit
13636 The maximum number of SSA_NAME assignments to follow in
13637 determining a property of a variable such as its value. This
13638 limits the number of iterations or recursive calls GCC performs
13639 when optimizing certain statements or when determining their
13640 validity prior to issuing diagnostics.
13641
13642 store-merging-max-size
13643 Maximum size of a single store merging region in bytes.
13644
13645 hash-table-verification-limit
13646 The number of elements for which hash table verification is
13647 done for each searched element.
13648
13649 max-find-base-term-values
13650 Maximum number of VALUEs handled during a single find_base_term
13651 call.
13652
13653 analyzer-max-enodes-per-program-point
13654 The maximum number of exploded nodes per program point within
13655 the analyzer, before terminating analysis of that point.
13656
13657 analyzer-max-constraints
13658 The maximum number of constraints per state.
13659
13660 analyzer-min-snodes-for-call-summary
13661 The minimum number of supernodes within a function for the
13662 analyzer to consider summarizing its effects at call sites.
13663
13664 analyzer-max-enodes-for-full-dump
13665 The maximum depth of exploded nodes that should appear in a dot
13666 dump before switching to a less verbose format.
13667
13668 analyzer-max-recursion-depth
13669 The maximum number of times a callsite can appear in a call
13670 stack within the analyzer, before terminating analysis of a
13671 call that would recurse deeper.
13672
13673 analyzer-max-svalue-depth
13674 The maximum depth of a symbolic value, before approximating the
13675 value as unknown.
13676
13677 analyzer-max-infeasible-edges
13678 The maximum number of infeasible edges to reject before
13679 declaring a diagnostic as infeasible.
13680
13681 gimple-fe-computed-hot-bb-threshold
13682 The number of executions of a basic block which is considered
13683 hot. The parameter is used only in GIMPLE FE.
13684
13685 analyzer-bb-explosion-factor
13686 The maximum number of 'after supernode' exploded nodes within
13687 the analyzer per supernode, before terminating analysis.
13688
13689 ranger-logical-depth
13690 Maximum depth of logical expression evaluation ranger will look
13691 through when evaluating outgoing edge ranges.
13692
13693 ranger-recompute-depth
13694 Maximum depth of instruction chains to consider for
13695 recomputation in the outgoing range calculator.
13696
13697 relation-block-limit
13698 Maximum number of relations the oracle will register in a basic
13699 block.
13700
13701 min-pagesize
13702 Minimum page size for warning purposes.
13703
13704 openacc-kernels
13705 Specify mode of OpenACC `kernels' constructs handling. With
13706 --param=openacc-kernels=decompose, OpenACC `kernels' constructs
13707 are decomposed into parts, a sequence of compute constructs,
13708 each then handled individually. This is work in progress.
13709 With --param=openacc-kernels=parloops, OpenACC `kernels'
13710 constructs are handled by the parloops pass, en bloc. This is
13711 the current default.
13712
13713 openacc-privatization
13714 Control whether the -fopt-info-omp-note and applicable
13715 -fdump-tree-*-details options emit OpenACC privatization
13716 diagnostics. With --param=openacc-privatization=quiet, don't
13717 diagnose. This is the current default. With
13718 --param=openacc-privatization=noisy, do diagnose.
13719
13720 The following choices of name are available on AArch64 targets:
13721
13722 aarch64-sve-compare-costs
13723 When vectorizing for SVE, consider using "unpacked" vectors for
13724 smaller elements and use the cost model to pick the cheapest
13725 approach. Also use the cost model to choose between SVE and
13726 Advanced SIMD vectorization.
13727
13728 Using unpacked vectors includes storing smaller elements in
13729 larger containers and accessing elements with extending loads
13730 and truncating stores.
13731
13732 aarch64-float-recp-precision
13733 The number of Newton iterations for calculating the reciprocal
13734 for float type. The precision of division is proportional to
13735 this param when division approximation is enabled. The default
13736 value is 1.
13737
13738 aarch64-double-recp-precision
13739 The number of Newton iterations for calculating the reciprocal
13740 for double type. The precision of division is propotional to
13741 this param when division approximation is enabled. The default
13742 value is 2.
13743
13744 aarch64-autovec-preference
13745 Force an ISA selection strategy for auto-vectorization.
13746 Accepts values from 0 to 4, inclusive.
13747
13748 0 Use the default heuristics.
13749
13750 1 Use only Advanced SIMD for auto-vectorization.
13751
13752 2 Use only SVE for auto-vectorization.
13753
13754 3 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when
13755 the costs are deemed equal.
13756
13757 4 Use both Advanced SIMD and SVE. Prefer SVE when the costs
13758 are deemed equal.
13759
13760 The default value is 0.
13761
13762 aarch64-loop-vect-issue-rate-niters
13763 The tuning for some AArch64 CPUs tries to take both latencies
13764 and issue rates into account when deciding whether a loop
13765 should be vectorized using SVE, vectorized using Advanced SIMD,
13766 or not vectorized at all. If this parameter is set to n, GCC
13767 will not use this heuristic for loops that are known to execute
13768 in fewer than n Advanced SIMD iterations.
13769
13770 aarch64-vect-unroll-limit
13771 The vectorizer will use available tuning information to
13772 determine whether it would be beneficial to unroll the main
13773 vectorized loop and by how much. This parameter set's the
13774 upper bound of how much the vectorizer will unroll the main
13775 loop. The default value is four.
13776
13777 The following choices of name are available on i386 and x86_64
13778 targets:
13779
13780 x86-stlf-window-ninsns
13781 Instructions number above which STFL stall penalty can be
13782 compensated.
13783
13784 x86-stv-max-visits
13785 The maximum number of use and def visits when discovering a STV
13786 chain before the discovery is aborted.
13787
13788 Program Instrumentation Options
13789 GCC supports a number of command-line options that control adding run-
13790 time instrumentation to the code it normally generates. For example,
13791 one purpose of instrumentation is collect profiling statistics for use
13792 in finding program hot spots, code coverage analysis, or profile-guided
13793 optimizations. Another class of program instrumentation is adding run-
13794 time checking to detect programming errors like invalid pointer
13795 dereferences or out-of-bounds array accesses, as well as deliberately
13796 hostile attacks such as stack smashing or C++ vtable hijacking. There
13797 is also a general hook which can be used to implement other forms of
13798 tracing or function-level instrumentation for debug or program analysis
13799 purposes.
13800
13801 -p
13802 -pg Generate extra code to write profile information suitable for the
13803 analysis program prof (for -p) or gprof (for -pg). You must use
13804 this option when compiling the source files you want data about,
13805 and you must also use it when linking.
13806
13807 You can use the function attribute "no_instrument_function" to
13808 suppress profiling of individual functions when compiling with
13809 these options.
13810
13811 -fprofile-arcs
13812 Add code so that program flow arcs are instrumented. During
13813 execution the program records how many times each branch and call
13814 is executed and how many times it is taken or returns. On targets
13815 that support constructors with priority support, profiling properly
13816 handles constructors, destructors and C++ constructors (and
13817 destructors) of classes which are used as a type of a global
13818 variable.
13819
13820 When the compiled program exits it saves this data to a file called
13821 auxname.gcda for each source file. The data may be used for
13822 profile-directed optimizations (-fbranch-probabilities), or for
13823 test coverage analysis (-ftest-coverage). Each object file's
13824 auxname is generated from the name of the output file, if
13825 explicitly specified and it is not the final executable, otherwise
13826 it is the basename of the source file. In both cases any suffix is
13827 removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda
13828 for output file specified as -o dir/foo.o).
13829
13830 Note that if a command line directly links source files, the
13831 corresponding .gcda files will be prefixed with the unsuffixed name
13832 of the output file. E.g. "gcc a.c b.c -o binary" would generate
13833 binary-a.gcda and binary-b.gcda files.
13834
13835 --coverage
13836 This option is used to compile and link code instrumented for
13837 coverage analysis. The option is a synonym for -fprofile-arcs
13838 -ftest-coverage (when compiling) and -lgcov (when linking). See
13839 the documentation for those options for more details.
13840
13841 * Compile the source files with -fprofile-arcs plus optimization
13842 and code generation options. For test coverage analysis, use
13843 the additional -ftest-coverage option. You do not need to
13844 profile every source file in a program.
13845
13846 * Compile the source files additionally with -fprofile-abs-path
13847 to create absolute path names in the .gcno files. This allows
13848 gcov to find the correct sources in projects where compilations
13849 occur with different working directories.
13850
13851 * Link your object files with -lgcov or -fprofile-arcs (the
13852 latter implies the former).
13853
13854 * Run the program on a representative workload to generate the
13855 arc profile information. This may be repeated any number of
13856 times. You can run concurrent instances of your program, and
13857 provided that the file system supports locking, the data files
13858 will be correctly updated. Unless a strict ISO C dialect
13859 option is in effect, "fork" calls are detected and correctly
13860 handled without double counting.
13861
13862 Moreover, an object file can be recompiled multiple times and
13863 the corresponding .gcda file merges as long as the source file
13864 and the compiler options are unchanged.
13865
13866 * For profile-directed optimizations, compile the source files
13867 again with the same optimization and code generation options
13868 plus -fbranch-probabilities.
13869
13870 * For test coverage analysis, use gcov to produce human readable
13871 information from the .gcno and .gcda files. Refer to the gcov
13872 documentation for further information.
13873
13874 With -fprofile-arcs, for each function of your program GCC creates
13875 a program flow graph, then finds a spanning tree for the graph.
13876 Only arcs that are not on the spanning tree have to be
13877 instrumented: the compiler adds code to count the number of times
13878 that these arcs are executed. When an arc is the only exit or only
13879 entrance to a block, the instrumentation code can be added to the
13880 block; otherwise, a new basic block must be created to hold the
13881 instrumentation code.
13882
13883 -ftest-coverage
13884 Produce a notes file that the gcov code-coverage utility can use to
13885 show program coverage. Each source file's note file is called
13886 auxname.gcno. Refer to the -fprofile-arcs option above for a
13887 description of auxname and instructions on how to generate test
13888 coverage data. Coverage data matches the source files more closely
13889 if you do not optimize.
13890
13891 -fprofile-abs-path
13892 Automatically convert relative source file names to absolute path
13893 names in the .gcno files. This allows gcov to find the correct
13894 sources in projects where compilations occur with different working
13895 directories.
13896
13897 -fprofile-dir=path
13898 Set the directory to search for the profile data files in to path.
13899 This option affects only the profile data generated by
13900 -fprofile-generate, -ftest-coverage, -fprofile-arcs and used by
13901 -fprofile-use and -fbranch-probabilities and its related options.
13902 Both absolute and relative paths can be used. By default, GCC uses
13903 the current directory as path, thus the profile data file appears
13904 in the same directory as the object file. In order to prevent the
13905 file name clashing, if the object file name is not an absolute
13906 path, we mangle the absolute path of the sourcename.gcda file and
13907 use it as the file name of a .gcda file. See details about the
13908 file naming in -fprofile-arcs. See similar option -fprofile-note.
13909
13910 When an executable is run in a massive parallel environment, it is
13911 recommended to save profile to different folders. That can be done
13912 with variables in path that are exported during run-time:
13913
13914 %p process ID.
13915
13916 %q{VAR}
13917 value of environment variable VAR
13918
13919 -fprofile-generate
13920 -fprofile-generate=path
13921 Enable options usually used for instrumenting application to
13922 produce profile useful for later recompilation with profile
13923 feedback based optimization. You must use -fprofile-generate both
13924 when compiling and when linking your program.
13925
13926 The following options are enabled: -fprofile-arcs,
13927 -fprofile-values, -finline-functions, and -fipa-bit-cp.
13928
13929 If path is specified, GCC looks at the path to find the profile
13930 feedback data files. See -fprofile-dir.
13931
13932 To optimize the program based on the collected profile information,
13933 use -fprofile-use.
13934
13935 -fprofile-info-section
13936 -fprofile-info-section=name
13937 Register the profile information in the specified section instead
13938 of using a constructor/destructor. The section name is name if it
13939 is specified, otherwise the section name defaults to ".gcov_info".
13940 A pointer to the profile information generated by -fprofile-arcs is
13941 placed in the specified section for each translation unit. This
13942 option disables the profile information registration through a
13943 constructor and it disables the profile information processing
13944 through a destructor. This option is not intended to be used in
13945 hosted environments such as GNU/Linux. It targets freestanding
13946 environments (for example embedded systems) with limited resources
13947 which do not support constructors/destructors or the C library file
13948 I/O.
13949
13950 The linker could collect the input sections in a continuous memory
13951 block and define start and end symbols. A GNU linker script
13952 example which defines a linker output section follows:
13953
13954 .gcov_info :
13955 {
13956 PROVIDE (__gcov_info_start = .);
13957 KEEP (*(.gcov_info))
13958 PROVIDE (__gcov_info_end = .);
13959 }
13960
13961 The program could dump the profiling information registered in this
13962 linker set for example like this:
13963
13964 #include <gcov.h>
13965 #include <stdio.h>
13966 #include <stdlib.h>
13967
13968 extern const struct gcov_info *const __gcov_info_start[];
13969 extern const struct gcov_info *const __gcov_info_end[];
13970
13971 static void
13972 dump (const void *d, unsigned n, void *arg)
13973 {
13974 const unsigned char *c = d;
13975
13976 for (unsigned i = 0; i < n; ++i)
13977 printf ("%02x", c[i]);
13978 }
13979
13980 static void
13981 filename (const char *f, void *arg)
13982 {
13983 __gcov_filename_to_gcfn (f, dump, arg );
13984 }
13985
13986 static void *
13987 allocate (unsigned length, void *arg)
13988 {
13989 return malloc (length);
13990 }
13991
13992 static void
13993 dump_gcov_info (void)
13994 {
13995 const struct gcov_info *const *info = __gcov_info_start;
13996 const struct gcov_info *const *end = __gcov_info_end;
13997
13998 /* Obfuscate variable to prevent compiler optimizations. */
13999 __asm__ ("" : "+r" (info));
14000
14001 while (info != end)
14002 {
14003 void *arg = NULL;
14004 __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
14005 putchar ('\n');
14006 ++info;
14007 }
14008 }
14009
14010 int
14011 main (void)
14012 {
14013 dump_gcov_info ();
14014 return 0;
14015 }
14016
14017 The merge-stream subcommand of gcov-tool may be used to deserialize
14018 the data stream generated by the "__gcov_filename_to_gcfn" and
14019 "__gcov_info_to_gcda" functions and merge the profile information
14020 into .gcda files on the host filesystem.
14021
14022 -fprofile-note=path
14023 If path is specified, GCC saves .gcno file into path location. If
14024 you combine the option with multiple source files, the .gcno file
14025 will be overwritten.
14026
14027 -fprofile-prefix-path=path
14028 This option can be used in combination with
14029 profile-generate=profile_dir and profile-use=profile_dir to inform
14030 GCC where is the base directory of built source tree. By default
14031 profile_dir will contain files with mangled absolute paths of all
14032 object files in the built project. This is not desirable when
14033 directory used to build the instrumented binary differs from the
14034 directory used to build the binary optimized with profile feedback
14035 because the profile data will not be found during the optimized
14036 build. In such setups -fprofile-prefix-path=path with path
14037 pointing to the base directory of the build can be used to strip
14038 the irrelevant part of the path and keep all file names relative to
14039 the main build directory.
14040
14041 -fprofile-prefix-map=old=new
14042 When compiling files residing in directory old, record profiling
14043 information (with --coverage) describing them as if the files
14044 resided in directory new instead. See also -ffile-prefix-map and
14045 -fcanon-prefix-map.
14046
14047 -fprofile-update=method
14048 Alter the update method for an application instrumented for profile
14049 feedback based optimization. The method argument should be one of
14050 single, atomic or prefer-atomic. The first one is useful for
14051 single-threaded applications, while the second one prevents profile
14052 corruption by emitting thread-safe code.
14053
14054 Warning: When an application does not properly join all threads (or
14055 creates an detached thread), a profile file can be still corrupted.
14056
14057 Using prefer-atomic would be transformed either to atomic, when
14058 supported by a target, or to single otherwise. The GCC driver
14059 automatically selects prefer-atomic when -pthread is present in the
14060 command line.
14061
14062 -fprofile-filter-files=regex
14063 Instrument only functions from files whose name matches any of the
14064 regular expressions (separated by semi-colons).
14065
14066 For example, -fprofile-filter-files=main\.c;module.*\.c will
14067 instrument only main.c and all C files starting with 'module'.
14068
14069 -fprofile-exclude-files=regex
14070 Instrument only functions from files whose name does not match any
14071 of the regular expressions (separated by semi-colons).
14072
14073 For example, -fprofile-exclude-files=/usr/.* will prevent
14074 instrumentation of all files that are located in the /usr/ folder.
14075
14076 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
14077 Control level of reproducibility of profile gathered by
14078 "-fprofile-generate". This makes it possible to rebuild program
14079 with same outcome which is useful, for example, for distribution
14080 packages.
14081
14082 With -fprofile-reproducible=serial the profile gathered by
14083 -fprofile-generate is reproducible provided the trained program
14084 behaves the same at each invocation of the train run, it is not
14085 multi-threaded and profile data streaming is always done in the
14086 same order. Note that profile streaming happens at the end of
14087 program run but also before "fork" function is invoked.
14088
14089 Note that it is quite common that execution counts of some part of
14090 programs depends, for example, on length of temporary file names or
14091 memory space randomization (that may affect hash-table collision
14092 rate). Such non-reproducible part of programs may be annotated by
14093 "no_instrument_function" function attribute. gcov-dump with -l can
14094 be used to dump gathered data and verify that they are indeed
14095 reproducible.
14096
14097 With -fprofile-reproducible=parallel-runs collected profile stays
14098 reproducible regardless the order of streaming of the data into
14099 gcda files. This setting makes it possible to run multiple
14100 instances of instrumented program in parallel (such as with "make
14101 -j"). This reduces quality of gathered data, in particular of
14102 indirect call profiling.
14103
14104 -fsanitize=address
14105 Enable AddressSanitizer, a fast memory error detector. Memory
14106 access instructions are instrumented to detect out-of-bounds and
14107 use-after-free bugs. The option enables
14108 -fsanitize-address-use-after-scope. See
14109 <https://github.com/google/sanitizers/wiki/AddressSanitizer> for
14110 more details. The run-time behavior can be influenced using the
14111 ASAN_OPTIONS environment variable. When set to "help=1", the
14112 available options are shown at startup of the instrumented program.
14113 See
14114 <https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags>
14115 for a list of supported options. The option cannot be combined
14116 with -fsanitize=thread or -fsanitize=hwaddress. Note that the only
14117 target -fsanitize=hwaddress is currently supported on is AArch64.
14118
14119 To get more accurate stack traces, it is possible to use options
14120 such as -O0, -O1, or -Og (which, for instance, prevent most
14121 function inlining), -fno-optimize-sibling-calls (which prevents
14122 optimizing sibling and tail recursive calls; this option is
14123 implicit for -O0, -O1, or -Og), or -fno-ipa-icf (which disables
14124 Identical Code Folding for functions). Since multiple runs of the
14125 program may yield backtraces with different addresses due to ASLR
14126 (Address Space Layout Randomization), it may be desirable to turn
14127 ASLR off. On Linux, this can be achieved with setarch `uname -m`
14128 -R ./prog.
14129
14130 -fsanitize=kernel-address
14131 Enable AddressSanitizer for Linux kernel. See
14132 <https://github.com/google/kernel-sanitizers> for more details.
14133
14134 -fsanitize=hwaddress
14135 Enable Hardware-assisted AddressSanitizer, which uses a hardware
14136 ability to ignore the top byte of a pointer to allow the detection
14137 of memory errors with a low memory overhead. Memory access
14138 instructions are instrumented to detect out-of-bounds and use-
14139 after-free bugs. The option enables
14140 -fsanitize-address-use-after-scope. See
14141 <https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html>
14142 for more details. The run-time behavior can be influenced using
14143 the HWASAN_OPTIONS environment variable. When set to "help=1", the
14144 available options are shown at startup of the instrumented program.
14145 The option cannot be combined with -fsanitize=thread or
14146 -fsanitize=address, and is currently only available on AArch64.
14147
14148 -fsanitize=kernel-hwaddress
14149 Enable Hardware-assisted AddressSanitizer for compilation of the
14150 Linux kernel. Similar to -fsanitize=kernel-address but using an
14151 alternate instrumentation method, and similar to
14152 -fsanitize=hwaddress but with instrumentation differences necessary
14153 for compiling the Linux kernel. These differences are to avoid
14154 hwasan library initialization calls and to account for the stack
14155 pointer having a different value in its top byte.
14156
14157 Note: This option has different defaults to the
14158 -fsanitize=hwaddress. Instrumenting the stack and alloca calls are
14159 not on by default but are still possible by specifying the command-
14160 line options --param hwasan-instrument-stack=1 and --param
14161 hwasan-instrument-allocas=1 respectively. Using a random frame tag
14162 is not implemented for kernel instrumentation.
14163
14164 -fsanitize=pointer-compare
14165 Instrument comparison operation (<, <=, >, >=) with pointer
14166 operands. The option must be combined with either
14167 -fsanitize=kernel-address or -fsanitize=address The option cannot
14168 be combined with -fsanitize=thread. Note: By default the check is
14169 disabled at run time. To enable it, add
14170 "detect_invalid_pointer_pairs=2" to the environment variable
14171 ASAN_OPTIONS. Using "detect_invalid_pointer_pairs=1" detects
14172 invalid operation only when both pointers are non-null.
14173
14174 -fsanitize=pointer-subtract
14175 Instrument subtraction with pointer operands. The option must be
14176 combined with either -fsanitize=kernel-address or
14177 -fsanitize=address The option cannot be combined with
14178 -fsanitize=thread. Note: By default the check is disabled at run
14179 time. To enable it, add "detect_invalid_pointer_pairs=2" to the
14180 environment variable ASAN_OPTIONS. Using
14181 "detect_invalid_pointer_pairs=1" detects invalid operation only
14182 when both pointers are non-null.
14183
14184 -fsanitize=shadow-call-stack
14185 Enable ShadowCallStack, a security enhancement mechanism used to
14186 protect programs against return address overwrites (e.g. stack
14187 buffer overflows.) It works by saving a function's return address
14188 to a separately allocated shadow call stack in the function
14189 prologue and restoring the return address from the shadow call
14190 stack in the function epilogue. Instrumentation only occurs in
14191 functions that need to save the return address to the stack.
14192
14193 Currently it only supports the aarch64 platform. It is
14194 specifically designed for linux kernels that enable the
14195 CONFIG_SHADOW_CALL_STACK option. For the user space programs,
14196 runtime support is not currently provided in libc and libgcc.
14197 Users who want to use this feature in user space need to provide
14198 their own support for the runtime. It should be noted that this
14199 may cause the ABI rules to be broken.
14200
14201 On aarch64, the instrumentation makes use of the platform register
14202 "x18". This generally means that any code that may run on the same
14203 thread as code compiled with ShadowCallStack must be compiled with
14204 the flag -ffixed-x18, otherwise functions compiled without
14205 -ffixed-x18 might clobber "x18" and so corrupt the shadow stack
14206 pointer.
14207
14208 Also, because there is no userspace runtime support, code compiled
14209 with ShadowCallStack cannot use exception handling. Use
14210 -fno-exceptions to turn off exceptions.
14211
14212 See <https://clang.llvm.org/docs/ShadowCallStack.html> for more
14213 details.
14214
14215 -fsanitize=thread
14216 Enable ThreadSanitizer, a fast data race detector. Memory access
14217 instructions are instrumented to detect data race bugs. See
14218 <https://github.com/google/sanitizers/wiki#threadsanitizer> for
14219 more details. The run-time behavior can be influenced using the
14220 TSAN_OPTIONS environment variable; see
14221 <https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags>
14222 for a list of supported options. The option cannot be combined
14223 with -fsanitize=address, -fsanitize=leak.
14224
14225 Note that sanitized atomic builtins cannot throw exceptions when
14226 operating on invalid memory addresses with non-call exceptions
14227 (-fnon-call-exceptions).
14228
14229 -fsanitize=leak
14230 Enable LeakSanitizer, a memory leak detector. This option only
14231 matters for linking of executables. The executable is linked
14232 against a library that overrides "malloc" and other allocator
14233 functions. See
14234 <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
14235 for more details. The run-time behavior can be influenced using
14236 the LSAN_OPTIONS environment variable. The option cannot be
14237 combined with -fsanitize=thread.
14238
14239 -fsanitize=undefined
14240 Enable UndefinedBehaviorSanitizer, a fast undefined behavior
14241 detector. Various computations are instrumented to detect
14242 undefined behavior at runtime. See
14243 <https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html> for
14244 more details. The run-time behavior can be influenced using the
14245 UBSAN_OPTIONS environment variable. Current suboptions are:
14246
14247 -fsanitize=shift
14248 This option enables checking that the result of a shift
14249 operation is not undefined. Note that what exactly is
14250 considered undefined differs slightly between C and C++, as
14251 well as between ISO C90 and C99, etc. This option has two
14252 suboptions, -fsanitize=shift-base and
14253 -fsanitize=shift-exponent.
14254
14255 -fsanitize=shift-exponent
14256 This option enables checking that the second argument of a
14257 shift operation is not negative and is smaller than the
14258 precision of the promoted first argument.
14259
14260 -fsanitize=shift-base
14261 If the second argument of a shift operation is within range,
14262 check that the result of a shift operation is not undefined.
14263 Note that what exactly is considered undefined differs slightly
14264 between C and C++, as well as between ISO C90 and C99, etc.
14265
14266 -fsanitize=integer-divide-by-zero
14267 Detect integer division by zero.
14268
14269 -fsanitize=unreachable
14270 With this option, the compiler turns the
14271 "__builtin_unreachable" call into a diagnostics message call
14272 instead. When reaching the "__builtin_unreachable" call, the
14273 behavior is undefined.
14274
14275 -fsanitize=vla-bound
14276 This option instructs the compiler to check that the size of a
14277 variable length array is positive.
14278
14279 -fsanitize=null
14280 This option enables pointer checking. Particularly, the
14281 application built with this option turned on will issue an
14282 error message when it tries to dereference a NULL pointer, or
14283 if a reference (possibly an rvalue reference) is bound to a
14284 NULL pointer, or if a method is invoked on an object pointed by
14285 a NULL pointer.
14286
14287 -fsanitize=return
14288 This option enables return statement checking. Programs built
14289 with this option turned on will issue an error message when the
14290 end of a non-void function is reached without actually
14291 returning a value. This option works in C++ only.
14292
14293 -fsanitize=signed-integer-overflow
14294 This option enables signed integer overflow checking. We check
14295 that the result of "+", "*", and both unary and binary "-" does
14296 not overflow in the signed arithmetics. This also detects
14297 "INT_MIN / -1" signed division. Note, integer promotion rules
14298 must be taken into account. That is, the following is not an
14299 overflow:
14300
14301 signed char a = SCHAR_MAX;
14302 a++;
14303
14304 -fsanitize=bounds
14305 This option enables instrumentation of array bounds. Various
14306 out of bounds accesses are detected. Flexible array members,
14307 flexible array member-like arrays, and initializers of
14308 variables with static storage are not instrumented, with the
14309 exception of flexible array member-like arrays for which
14310 "-fstrict-flex-arrays" or "-fstrict-flex-arrays=" options or
14311 "strict_flex_array" attributes say they shouldn't be treated
14312 like flexible array member-like arrays.
14313
14314 -fsanitize=bounds-strict
14315 This option enables strict instrumentation of array bounds.
14316 Most out of bounds accesses are detected, including flexible
14317 array member-like arrays. Initializers of variables with
14318 static storage are not instrumented.
14319
14320 -fsanitize=alignment
14321 This option enables checking of alignment of pointers when they
14322 are dereferenced, or when a reference is bound to
14323 insufficiently aligned target, or when a method or constructor
14324 is invoked on insufficiently aligned object.
14325
14326 -fsanitize=object-size
14327 This option enables instrumentation of memory references using
14328 the "__builtin_dynamic_object_size" function. Various out of
14329 bounds pointer accesses are detected.
14330
14331 -fsanitize=float-divide-by-zero
14332 Detect floating-point division by zero. Unlike other similar
14333 options, -fsanitize=float-divide-by-zero is not enabled by
14334 -fsanitize=undefined, since floating-point division by zero can
14335 be a legitimate way of obtaining infinities and NaNs.
14336
14337 -fsanitize=float-cast-overflow
14338 This option enables floating-point type to integer conversion
14339 checking. We check that the result of the conversion does not
14340 overflow. Unlike other similar options,
14341 -fsanitize=float-cast-overflow is not enabled by
14342 -fsanitize=undefined. This option does not work well with
14343 "FE_INVALID" exceptions enabled.
14344
14345 -fsanitize=nonnull-attribute
14346 This option enables instrumentation of calls, checking whether
14347 null values are not passed to arguments marked as requiring a
14348 non-null value by the "nonnull" function attribute.
14349
14350 -fsanitize=returns-nonnull-attribute
14351 This option enables instrumentation of return statements in
14352 functions marked with "returns_nonnull" function attribute, to
14353 detect returning of null values from such functions.
14354
14355 -fsanitize=bool
14356 This option enables instrumentation of loads from bool. If a
14357 value other than 0/1 is loaded, a run-time error is issued.
14358
14359 -fsanitize=enum
14360 This option enables instrumentation of loads from an enum type.
14361 If a value outside the range of values for the enum type is
14362 loaded, a run-time error is issued.
14363
14364 -fsanitize=vptr
14365 This option enables instrumentation of C++ member function
14366 calls, member accesses and some conversions between pointers to
14367 base and derived classes, to verify the referenced object has
14368 the correct dynamic type.
14369
14370 -fsanitize=pointer-overflow
14371 This option enables instrumentation of pointer arithmetics. If
14372 the pointer arithmetics overflows, a run-time error is issued.
14373
14374 -fsanitize=builtin
14375 This option enables instrumentation of arguments to selected
14376 builtin functions. If an invalid value is passed to such
14377 arguments, a run-time error is issued. E.g. passing 0 as the
14378 argument to "__builtin_ctz" or "__builtin_clz" invokes
14379 undefined behavior and is diagnosed by this option.
14380
14381 Note that sanitizers tend to increase the rate of false positive
14382 warnings, most notably those around -Wmaybe-uninitialized. We
14383 recommend against combining -Werror and [the use of] sanitizers.
14384
14385 While -ftrapv causes traps for signed overflows to be emitted,
14386 -fsanitize=undefined gives a diagnostic message. This currently
14387 works only for the C family of languages.
14388
14389 -fno-sanitize=all
14390 This option disables all previously enabled sanitizers.
14391 -fsanitize=all is not allowed, as some sanitizers cannot be used
14392 together.
14393
14394 -fasan-shadow-offset=number
14395 This option forces GCC to use custom shadow offset in
14396 AddressSanitizer checks. It is useful for experimenting with
14397 different shadow memory layouts in Kernel AddressSanitizer.
14398
14399 -fsanitize-sections=s1,s2,...
14400 Sanitize global variables in selected user-defined sections. si
14401 may contain wildcards.
14402
14403 -fsanitize-recover[=opts]
14404 -fsanitize-recover= controls error recovery mode for sanitizers
14405 mentioned in comma-separated list of opts. Enabling this option
14406 for a sanitizer component causes it to attempt to continue running
14407 the program as if no error happened. This means multiple runtime
14408 errors can be reported in a single program run, and the exit code
14409 of the program may indicate success even when errors have been
14410 reported. The -fno-sanitize-recover= option can be used to alter
14411 this behavior: only the first detected error is reported and
14412 program then exits with a non-zero exit code.
14413
14414 Currently this feature only works for -fsanitize=undefined (and its
14415 suboptions except for -fsanitize=unreachable and
14416 -fsanitize=return), -fsanitize=float-cast-overflow,
14417 -fsanitize=float-divide-by-zero, -fsanitize=bounds-strict,
14418 -fsanitize=kernel-address and -fsanitize=address. For these
14419 sanitizers error recovery is turned on by default, except
14420 -fsanitize=address, for which this feature is experimental.
14421 -fsanitize-recover=all and -fno-sanitize-recover=all is also
14422 accepted, the former enables recovery for all sanitizers that
14423 support it, the latter disables recovery for all sanitizers that
14424 support it.
14425
14426 Even if a recovery mode is turned on the compiler side, it needs to
14427 be also enabled on the runtime library side, otherwise the failures
14428 are still fatal. The runtime library defaults to "halt_on_error=0"
14429 for ThreadSanitizer and UndefinedBehaviorSanitizer, while default
14430 value for AddressSanitizer is "halt_on_error=1". This can be
14431 overridden through setting the "halt_on_error" flag in the
14432 corresponding environment variable.
14433
14434 Syntax without an explicit opts parameter is deprecated. It is
14435 equivalent to specifying an opts list of:
14436
14437 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
14438
14439 -fsanitize-address-use-after-scope
14440 Enable sanitization of local variables to detect use-after-scope
14441 bugs. The option sets -fstack-reuse to none.
14442
14443 -fsanitize-trap[=opts]
14444 The -fsanitize-trap= option instructs the compiler to report for
14445 sanitizers mentioned in comma-separated list of opts undefined
14446 behavior using "__builtin_trap" rather than a "libubsan" library
14447 routine. If this option is enabled for certain sanitizer, it takes
14448 precedence over the -fsanitizer-recover= for that sanitizer,
14449 "__builtin_trap" will be emitted and be fatal regardless of whether
14450 recovery is enabled or disabled using -fsanitize-recover=.
14451
14452 The advantage of this is that the "libubsan" library is not needed
14453 and is not linked in, so this is usable even in freestanding
14454 environments.
14455
14456 Currently this feature works with -fsanitize=undefined (and its
14457 suboptions except for -fsanitize=vptr),
14458 -fsanitize=float-cast-overflow, -fsanitize=float-divide-by-zero and
14459 -fsanitize=bounds-strict. "-fsanitize-trap=all" can be also
14460 specified, which enables it for "undefined" suboptions,
14461 -fsanitize=float-cast-overflow, -fsanitize=float-divide-by-zero and
14462 -fsanitize=bounds-strict. If "-fsanitize-trap=undefined" or
14463 "-fsanitize-trap=all" is used and "-fsanitize=vptr" is enabled on
14464 the command line, the instrumentation is silently ignored as the
14465 instrumentation always needs "libubsan" support,
14466 -fsanitize-trap=vptr is not allowed.
14467
14468 -fsanitize-undefined-trap-on-error
14469 The -fsanitize-undefined-trap-on-error option is deprecated
14470 equivalent of -fsanitize-trap=all.
14471
14472 -fsanitize-coverage=trace-pc
14473 Enable coverage-guided fuzzing code instrumentation. Inserts a
14474 call to "__sanitizer_cov_trace_pc" into every basic block.
14475
14476 -fsanitize-coverage=trace-cmp
14477 Enable dataflow guided fuzzing code instrumentation. Inserts a
14478 call to "__sanitizer_cov_trace_cmp1", "__sanitizer_cov_trace_cmp2",
14479 "__sanitizer_cov_trace_cmp4" or "__sanitizer_cov_trace_cmp8" for
14480 integral comparison with both operands variable or
14481 "__sanitizer_cov_trace_const_cmp1",
14482 "__sanitizer_cov_trace_const_cmp2",
14483 "__sanitizer_cov_trace_const_cmp4" or
14484 "__sanitizer_cov_trace_const_cmp8" for integral comparison with one
14485 operand constant, "__sanitizer_cov_trace_cmpf" or
14486 "__sanitizer_cov_trace_cmpd" for float or double comparisons and
14487 "__sanitizer_cov_trace_switch" for switch statements.
14488
14489 -fcf-protection=[full|branch|return|none|check]
14490 Enable code instrumentation of control-flow transfers to increase
14491 program security by checking that target addresses of control-flow
14492 transfer instructions (such as indirect function call, function
14493 return, indirect jump) are valid. This prevents diverting the flow
14494 of control to an unexpected target. This is intended to protect
14495 against such threats as Return-oriented Programming (ROP), and
14496 similarly call/jmp-oriented programming (COP/JOP).
14497
14498 The value "branch" tells the compiler to implement checking of
14499 validity of control-flow transfer at the point of indirect branch
14500 instructions, i.e. call/jmp instructions. The value "return"
14501 implements checking of validity at the point of returning from a
14502 function. The value "full" is an alias for specifying both
14503 "branch" and "return". The value "none" turns off instrumentation.
14504
14505 The value "check" is used for the final link with link-time
14506 optimization (LTO). An error is issued if LTO object files are
14507 compiled with different -fcf-protection values. The value "check"
14508 is ignored at the compile time.
14509
14510 The macro "__CET__" is defined when -fcf-protection is used. The
14511 first bit of "__CET__" is set to 1 for the value "branch" and the
14512 second bit of "__CET__" is set to 1 for the "return".
14513
14514 You can also use the "nocf_check" attribute to identify which
14515 functions and calls should be skipped from instrumentation.
14516
14517 Currently the x86 GNU/Linux target provides an implementation based
14518 on Intel Control-flow Enforcement Technology (CET) which works for
14519 i686 processor or newer.
14520
14521 -fharden-compares
14522 For every logical test that survives gimple optimizations and is
14523 not the condition in a conditional branch (for example, conditions
14524 tested for conditional moves, or to store in boolean variables),
14525 emit extra code to compute and verify the reversed condition, and
14526 to call "__builtin_trap" if the results do not match. Use with
14527 -fharden-conditional-branches to cover all conditionals.
14528
14529 -fharden-conditional-branches
14530 For every non-vectorized conditional branch that survives gimple
14531 optimizations, emit extra code to compute and verify the reversed
14532 condition, and to call "__builtin_trap" if the result is
14533 unexpected. Use with -fharden-compares to cover all conditionals.
14534
14535 -fstack-protector
14536 Emit extra code to check for buffer overflows, such as stack
14537 smashing attacks. This is done by adding a guard variable to
14538 functions with vulnerable objects. This includes functions that
14539 call "alloca", and functions with buffers larger than or equal to 8
14540 bytes. The guards are initialized when a function is entered and
14541 then checked when the function exits. If a guard check fails, an
14542 error message is printed and the program exits. Only variables
14543 that are actually allocated on the stack are considered, optimized
14544 away variables or variables allocated in registers don't count.
14545
14546 -fstack-protector-all
14547 Like -fstack-protector except that all functions are protected.
14548
14549 -fstack-protector-strong
14550 Like -fstack-protector but includes additional functions to be
14551 protected --- those that have local array definitions, or have
14552 references to local frame addresses. Only variables that are
14553 actually allocated on the stack are considered, optimized away
14554 variables or variables allocated in registers don't count.
14555
14556 -fstack-protector-explicit
14557 Like -fstack-protector but only protects those functions which have
14558 the "stack_protect" attribute.
14559
14560 -fstack-check
14561 Generate code to verify that you do not go beyond the boundary of
14562 the stack. You should specify this flag if you are running in an
14563 environment with multiple threads, but you only rarely need to
14564 specify it in a single-threaded environment since stack overflow is
14565 automatically detected on nearly all systems if there is only one
14566 stack.
14567
14568 Note that this switch does not actually cause checking to be done;
14569 the operating system or the language runtime must do that. The
14570 switch causes generation of code to ensure that they see the stack
14571 being extended.
14572
14573 You can additionally specify a string parameter: no means no
14574 checking, generic means force the use of old-style checking,
14575 specific means use the best checking method and is equivalent to
14576 bare -fstack-check.
14577
14578 Old-style checking is a generic mechanism that requires no specific
14579 target support in the compiler but comes with the following
14580 drawbacks:
14581
14582 1. Modified allocation strategy for large objects: they are always
14583 allocated dynamically if their size exceeds a fixed threshold.
14584 Note this may change the semantics of some code.
14585
14586 2. Fixed limit on the size of the static frame of functions: when
14587 it is topped by a particular function, stack checking is not
14588 reliable and a warning is issued by the compiler.
14589
14590 3. Inefficiency: because of both the modified allocation strategy
14591 and the generic implementation, code performance is hampered.
14592
14593 Note that old-style stack checking is also the fallback method for
14594 specific if no target support has been added in the compiler.
14595
14596 -fstack-check= is designed for Ada's needs to detect infinite
14597 recursion and stack overflows. specific is an excellent choice
14598 when compiling Ada code. It is not generally sufficient to protect
14599 against stack-clash attacks. To protect against those you want
14600 -fstack-clash-protection.
14601
14602 -fstack-clash-protection
14603 Generate code to prevent stack clash style attacks. When this
14604 option is enabled, the compiler will only allocate one page of
14605 stack space at a time and each page is accessed immediately after
14606 allocation. Thus, it prevents allocations from jumping over any
14607 stack guard page provided by the operating system.
14608
14609 Most targets do not fully support stack clash protection. However,
14610 on those targets -fstack-clash-protection will protect dynamic
14611 stack allocations. -fstack-clash-protection may also provide
14612 limited protection for static stack allocations if the target
14613 supports -fstack-check=specific.
14614
14615 -fstack-limit-register=reg
14616 -fstack-limit-symbol=sym
14617 -fno-stack-limit
14618 Generate code to ensure that the stack does not grow beyond a
14619 certain value, either the value of a register or the address of a
14620 symbol. If a larger stack is required, a signal is raised at run
14621 time. For most targets, the signal is raised before the stack
14622 overruns the boundary, so it is possible to catch the signal
14623 without taking special precautions.
14624
14625 For instance, if the stack starts at absolute address 0x80000000
14626 and grows downwards, you can use the flags
14627 -fstack-limit-symbol=__stack_limit and
14628 -Wl,--defsym,__stack_limit=0x7ffe0000 to enforce a stack limit of
14629 128KB. Note that this may only work with the GNU linker.
14630
14631 You can locally override stack limit checking by using the
14632 "no_stack_limit" function attribute.
14633
14634 -fsplit-stack
14635 Generate code to automatically split the stack before it overflows.
14636 The resulting program has a discontiguous stack which can only
14637 overflow if the program is unable to allocate any more memory.
14638 This is most useful when running threaded programs, as it is no
14639 longer necessary to calculate a good stack size to use for each
14640 thread. This is currently only implemented for the x86 targets
14641 running GNU/Linux.
14642
14643 When code compiled with -fsplit-stack calls code compiled without
14644 -fsplit-stack, there may not be much stack space available for the
14645 latter code to run. If compiling all code, including library code,
14646 with -fsplit-stack is not an option, then the linker can fix up
14647 these calls so that the code compiled without -fsplit-stack always
14648 has a large stack. Support for this is implemented in the gold
14649 linker in GNU binutils release 2.21 and later.
14650
14651 -fvtable-verify=[std|preinit|none]
14652 This option is only available when compiling C++ code. It turns on
14653 (or off, if using -fvtable-verify=none) the security feature that
14654 verifies at run time, for every virtual call, that the vtable
14655 pointer through which the call is made is valid for the type of the
14656 object, and has not been corrupted or overwritten. If an invalid
14657 vtable pointer is detected at run time, an error is reported and
14658 execution of the program is immediately halted.
14659
14660 This option causes run-time data structures to be built at program
14661 startup, which are used for verifying the vtable pointers. The
14662 options std and preinit control the timing of when these data
14663 structures are built. In both cases the data structures are built
14664 before execution reaches "main". Using -fvtable-verify=std causes
14665 the data structures to be built after shared libraries have been
14666 loaded and initialized. -fvtable-verify=preinit causes them to be
14667 built before shared libraries have been loaded and initialized.
14668
14669 If this option appears multiple times in the command line with
14670 different values specified, none takes highest priority over both
14671 std and preinit; preinit takes priority over std.
14672
14673 -fvtv-debug
14674 When used in conjunction with -fvtable-verify=std or
14675 -fvtable-verify=preinit, causes debug versions of the runtime
14676 functions for the vtable verification feature to be called. This
14677 flag also causes the compiler to log information about which vtable
14678 pointers it finds for each class. This information is written to a
14679 file named vtv_set_ptr_data.log in the directory named by the
14680 environment variable VTV_LOGS_DIR if that is defined or the current
14681 working directory otherwise.
14682
14683 Note: This feature appends data to the log file. If you want a
14684 fresh log file, be sure to delete any existing one.
14685
14686 -fvtv-counts
14687 This is a debugging flag. When used in conjunction with
14688 -fvtable-verify=std or -fvtable-verify=preinit, this causes the
14689 compiler to keep track of the total number of virtual calls it
14690 encounters and the number of verifications it inserts. It also
14691 counts the number of calls to certain run-time library functions
14692 that it inserts and logs this information for each compilation
14693 unit. The compiler writes this information to a file named
14694 vtv_count_data.log in the directory named by the environment
14695 variable VTV_LOGS_DIR if that is defined or the current working
14696 directory otherwise. It also counts the size of the vtable pointer
14697 sets for each class, and writes this information to
14698 vtv_class_set_sizes.log in the same directory.
14699
14700 Note: This feature appends data to the log files. To get fresh
14701 log files, be sure to delete any existing ones.
14702
14703 -finstrument-functions
14704 Generate instrumentation calls for entry and exit to functions.
14705 Just after function entry and just before function exit, the
14706 following profiling functions are called with the address of the
14707 current function and its call site. (On some platforms,
14708 "__builtin_return_address" does not work beyond the current
14709 function, so the call site information may not be available to the
14710 profiling functions otherwise.)
14711
14712 void __cyg_profile_func_enter (void *this_fn,
14713 void *call_site);
14714 void __cyg_profile_func_exit (void *this_fn,
14715 void *call_site);
14716
14717 The first argument is the address of the start of the current
14718 function, which may be looked up exactly in the symbol table.
14719
14720 This instrumentation is also done for functions expanded inline in
14721 other functions. The profiling calls indicate where, conceptually,
14722 the inline function is entered and exited. This means that
14723 addressable versions of such functions must be available. If all
14724 your uses of a function are expanded inline, this may mean an
14725 additional expansion of code size. If you use "extern inline" in
14726 your C code, an addressable version of such functions must be
14727 provided. (This is normally the case anyway, but if you get lucky
14728 and the optimizer always expands the functions inline, you might
14729 have gotten away without providing static copies.)
14730
14731 A function may be given the attribute "no_instrument_function", in
14732 which case this instrumentation is not done. This can be used, for
14733 example, for the profiling functions listed above, high-priority
14734 interrupt routines, and any functions from which the profiling
14735 functions cannot safely be called (perhaps signal handlers, if the
14736 profiling routines generate output or allocate memory).
14737
14738 -finstrument-functions-once
14739 This is similar to -finstrument-functions, but the profiling
14740 functions are called only once per instrumented function, i.e. the
14741 first profiling function is called after the first entry into the
14742 instrumented function and the second profiling function is called
14743 before the exit corresponding to this first entry.
14744
14745 The definition of "once" for the purpose of this option is a little
14746 vague because the implementation is not protected against data
14747 races. As a result, the implementation only guarantees that the
14748 profiling functions are called at least once per process and at
14749 most once per thread, but the calls are always paired, that is to
14750 say, if a thread calls the first function, then it will call the
14751 second function, unless it never reaches the exit of the
14752 instrumented function.
14753
14754 -finstrument-functions-exclude-file-list=file,file,...
14755 Set the list of functions that are excluded from instrumentation
14756 (see the description of -finstrument-functions). If the file that
14757 contains a function definition matches with one of file, then that
14758 function is not instrumented. The match is done on substrings: if
14759 the file parameter is a substring of the file name, it is
14760 considered to be a match.
14761
14762 For example:
14763
14764 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
14765
14766 excludes any inline function defined in files whose pathnames
14767 contain /bits/stl or include/sys.
14768
14769 If, for some reason, you want to include letter , in one of sym,
14770 write ,. For example,
14771 -finstrument-functions-exclude-file-list=',,tmp' (note the single
14772 quote surrounding the option).
14773
14774 -finstrument-functions-exclude-function-list=sym,sym,...
14775 This is similar to -finstrument-functions-exclude-file-list, but
14776 this option sets the list of function names to be excluded from
14777 instrumentation. The function name to be matched is its user-
14778 visible name, such as "vector<int> blah(const vector<int> &)", not
14779 the internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The
14780 match is done on substrings: if the sym parameter is a substring of
14781 the function name, it is considered to be a match. For C99 and C++
14782 extended identifiers, the function name must be given in UTF-8, not
14783 using universal character names.
14784
14785 -fpatchable-function-entry=N[,M]
14786 Generate N NOPs right at the beginning of each function, with the
14787 function entry point before the Mth NOP. If M is omitted, it
14788 defaults to 0 so the function entry points to the address just at
14789 the first NOP. The NOP instructions reserve extra space which can
14790 be used to patch in any desired instrumentation at run time,
14791 provided that the code segment is writable. The amount of space is
14792 controllable indirectly via the number of NOPs; the NOP instruction
14793 used corresponds to the instruction emitted by the internal GCC
14794 back-end interface "gen_nop". This behavior is target-specific and
14795 may also depend on the architecture variant and/or other
14796 compilation options.
14797
14798 For run-time identification, the starting addresses of these areas,
14799 which correspond to their respective function entries minus M, are
14800 additionally collected in the "__patchable_function_entries"
14801 section of the resulting binary.
14802
14803 Note that the value of "__attribute__ ((patchable_function_entry
14804 (N,M)))" takes precedence over command-line option
14805 -fpatchable-function-entry=N,M. This can be used to increase the
14806 area size or to remove it completely on a single function. If
14807 "N=0", no pad location is recorded.
14808
14809 The NOP instructions are inserted at---and maybe before, depending
14810 on M---the function entry address, even before the prologue. On
14811 PowerPC with the ELFv2 ABI, for a function with dual entry points,
14812 the local entry point is this function entry address.
14813
14814 The maximum value of N and M is 65535. On PowerPC with the ELFv2
14815 ABI, for a function with dual entry points, the supported values
14816 for M are 0, 2, 6 and 14.
14817
14818 Options Controlling the Preprocessor
14819 These options control the C preprocessor, which is run on each C source
14820 file before actual compilation.
14821
14822 If you use the -E option, nothing is done except preprocessing. Some
14823 of these options make sense only together with -E because they cause
14824 the preprocessor output to be unsuitable for actual compilation.
14825
14826 In addition to the options listed here, there are a number of options
14827 to control search paths for include files documented in Directory
14828 Options. Options to control preprocessor diagnostics are listed in
14829 Warning Options.
14830
14831 -D name
14832 Predefine name as a macro, with definition 1.
14833
14834 -D name=definition
14835 The contents of definition are tokenized and processed as if they
14836 appeared during translation phase three in a #define directive. In
14837 particular, the definition is truncated by embedded newline
14838 characters.
14839
14840 If you are invoking the preprocessor from a shell or shell-like
14841 program you may need to use the shell's quoting syntax to protect
14842 characters such as spaces that have a meaning in the shell syntax.
14843
14844 If you wish to define a function-like macro on the command line,
14845 write its argument list with surrounding parentheses before the
14846 equals sign (if any). Parentheses are meaningful to most shells,
14847 so you should quote the option. With sh and csh,
14848 -D'name(args...)=definition' works.
14849
14850 -D and -U options are processed in the order they are given on the
14851 command line. All -imacros file and -include file options are
14852 processed after all -D and -U options.
14853
14854 -U name
14855 Cancel any previous definition of name, either built in or provided
14856 with a -D option.
14857
14858 -include file
14859 Process file as if "#include "file"" appeared as the first line of
14860 the primary source file. However, the first directory searched for
14861 file is the preprocessor's working directory instead of the
14862 directory containing the main source file. If not found there, it
14863 is searched for in the remainder of the "#include "..."" search
14864 chain as normal.
14865
14866 If multiple -include options are given, the files are included in
14867 the order they appear on the command line.
14868
14869 -imacros file
14870 Exactly like -include, except that any output produced by scanning
14871 file is thrown away. Macros it defines remain defined. This
14872 allows you to acquire all the macros from a header without also
14873 processing its declarations.
14874
14875 All files specified by -imacros are processed before all files
14876 specified by -include.
14877
14878 -undef
14879 Do not predefine any system-specific or GCC-specific macros. The
14880 standard predefined macros remain defined.
14881
14882 -pthread
14883 Define additional macros required for using the POSIX threads
14884 library. You should use this option consistently for both
14885 compilation and linking. This option is supported on GNU/Linux
14886 targets, most other Unix derivatives, and also on x86 Cygwin and
14887 MinGW targets.
14888
14889 -M Instead of outputting the result of preprocessing, output a rule
14890 suitable for make describing the dependencies of the main source
14891 file. The preprocessor outputs one make rule containing the object
14892 file name for that source file, a colon, and the names of all the
14893 included files, including those coming from -include or -imacros
14894 command-line options.
14895
14896 Unless specified explicitly (with -MT or -MQ), the object file name
14897 consists of the name of the source file with any suffix replaced
14898 with object file suffix and with any leading directory parts
14899 removed. If there are many included files then the rule is split
14900 into several lines using \-newline. The rule has no commands.
14901
14902 This option does not suppress the preprocessor's debug output, such
14903 as -dM. To avoid mixing such debug output with the dependency
14904 rules you should explicitly specify the dependency output file with
14905 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
14906 Debug output is still sent to the regular output stream as normal.
14907
14908 Passing -M to the driver implies -E, and suppresses warnings with
14909 an implicit -w.
14910
14911 -MM Like -M but do not mention header files that are found in system
14912 header directories, nor header files that are included, directly or
14913 indirectly, from such a header.
14914
14915 This implies that the choice of angle brackets or double quotes in
14916 an #include directive does not in itself determine whether that
14917 header appears in -MM dependency output.
14918
14919 -MF file
14920 When used with -M or -MM, specifies a file to write the
14921 dependencies to. If no -MF switch is given the preprocessor sends
14922 the rules to the same place it would send preprocessed output.
14923
14924 When used with the driver options -MD or -MMD, -MF overrides the
14925 default dependency output file.
14926
14927 If file is -, then the dependencies are written to stdout.
14928
14929 -MG In conjunction with an option such as -M requesting dependency
14930 generation, -MG assumes missing header files are generated files
14931 and adds them to the dependency list without raising an error. The
14932 dependency filename is taken directly from the "#include" directive
14933 without prepending any path. -MG also suppresses preprocessed
14934 output, as a missing header file renders this useless.
14935
14936 This feature is used in automatic updating of makefiles.
14937
14938 -Mno-modules
14939 Disable dependency generation for compiled module interfaces.
14940
14941 -MP This option instructs CPP to add a phony target for each dependency
14942 other than the main file, causing each to depend on nothing. These
14943 dummy rules work around errors make gives if you remove header
14944 files without updating the Makefile to match.
14945
14946 This is typical output:
14947
14948 test.o: test.c test.h
14949
14950 test.h:
14951
14952 -MT target
14953 Change the target of the rule emitted by dependency generation. By
14954 default CPP takes the name of the main input file, deletes any
14955 directory components and any file suffix such as .c, and appends
14956 the platform's usual object suffix. The result is the target.
14957
14958 An -MT option sets the target to be exactly the string you specify.
14959 If you want multiple targets, you can specify them as a single
14960 argument to -MT, or use multiple -MT options.
14961
14962 For example, -MT '$(objpfx)foo.o' might give
14963
14964 $(objpfx)foo.o: foo.c
14965
14966 -MQ target
14967 Same as -MT, but it quotes any characters which are special to
14968 Make. -MQ '$(objpfx)foo.o' gives
14969
14970 $$(objpfx)foo.o: foo.c
14971
14972 The default target is automatically quoted, as if it were given
14973 with -MQ.
14974
14975 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
14976 The driver determines file based on whether an -o option is given.
14977 If it is, the driver uses its argument but with a suffix of .d,
14978 otherwise it takes the name of the input file, removes any
14979 directory components and suffix, and applies a .d suffix.
14980
14981 If -MD is used in conjunction with -E, any -o switch is understood
14982 to specify the dependency output file, but if used without -E, each
14983 -o is understood to specify a target object file.
14984
14985 Since -E is not implied, -MD can be used to generate a dependency
14986 output file as a side effect of the compilation process.
14987
14988 -MMD
14989 Like -MD except mention only user header files, not system header
14990 files.
14991
14992 -fpreprocessed
14993 Indicate to the preprocessor that the input file has already been
14994 preprocessed. This suppresses things like macro expansion,
14995 trigraph conversion, escaped newline splicing, and processing of
14996 most directives. The preprocessor still recognizes and removes
14997 comments, so that you can pass a file preprocessed with -C to the
14998 compiler without problems. In this mode the integrated
14999 preprocessor is little more than a tokenizer for the front ends.
15000
15001 -fpreprocessed is implicit if the input file has one of the
15002 extensions .i, .ii or .mi. These are the extensions that GCC uses
15003 for preprocessed files created by -save-temps.
15004
15005 -fdirectives-only
15006 When preprocessing, handle directives, but do not expand macros.
15007
15008 The option's behavior depends on the -E and -fpreprocessed options.
15009
15010 With -E, preprocessing is limited to the handling of directives
15011 such as "#define", "#ifdef", and "#error". Other preprocessor
15012 operations, such as macro expansion and trigraph conversion are not
15013 performed. In addition, the -dD option is implicitly enabled.
15014
15015 With -fpreprocessed, predefinition of command line and most builtin
15016 macros is disabled. Macros such as "__LINE__", which are
15017 contextually dependent, are handled normally. This enables
15018 compilation of files previously preprocessed with "-E
15019 -fdirectives-only".
15020
15021 With both -E and -fpreprocessed, the rules for -fpreprocessed take
15022 precedence. This enables full preprocessing of files previously
15023 preprocessed with "-E -fdirectives-only".
15024
15025 -fdollars-in-identifiers
15026 Accept $ in identifiers.
15027
15028 -fextended-identifiers
15029 Accept universal character names and extended characters in
15030 identifiers. This option is enabled by default for C99 (and later
15031 C standard versions) and C++.
15032
15033 -fno-canonical-system-headers
15034 When preprocessing, do not shorten system header paths with
15035 canonicalization.
15036
15037 -fmax-include-depth=depth
15038 Set the maximum depth of the nested #include. The default is 200.
15039
15040 -ftabstop=width
15041 Set the distance between tab stops. This helps the preprocessor
15042 report correct column numbers in warnings or errors, even if tabs
15043 appear on the line. If the value is less than 1 or greater than
15044 100, the option is ignored. The default is 8.
15045
15046 -ftrack-macro-expansion[=level]
15047 Track locations of tokens across macro expansions. This allows the
15048 compiler to emit diagnostic about the current macro expansion stack
15049 when a compilation error occurs in a macro expansion. Using this
15050 option makes the preprocessor and the compiler consume more memory.
15051 The level parameter can be used to choose the level of precision of
15052 token location tracking thus decreasing the memory consumption if
15053 necessary. Value 0 of level de-activates this option. Value 1
15054 tracks tokens locations in a degraded mode for the sake of minimal
15055 memory overhead. In this mode all tokens resulting from the
15056 expansion of an argument of a function-like macro have the same
15057 location. Value 2 tracks tokens locations completely. This value is
15058 the most memory hungry. When this option is given no argument, the
15059 default parameter value is 2.
15060
15061 Note that "-ftrack-macro-expansion=2" is activated by default.
15062
15063 -fmacro-prefix-map=old=new
15064 When preprocessing files residing in directory old, expand the
15065 "__FILE__" and "__BASE_FILE__" macros as if the files resided in
15066 directory new instead. This can be used to change an absolute path
15067 to a relative path by using . for new which can result in more
15068 reproducible builds that are location independent. This option
15069 also affects "__builtin_FILE()" during compilation. See also
15070 -ffile-prefix-map and -fcanon-prefix-map.
15071
15072 -fexec-charset=charset
15073 Set the execution character set, used for string and character
15074 constants. The default is UTF-8. charset can be any encoding
15075 supported by the system's "iconv" library routine.
15076
15077 -fwide-exec-charset=charset
15078 Set the wide execution character set, used for wide string and
15079 character constants. The default is one of UTF-32BE, UTF-32LE,
15080 UTF-16BE, or UTF-16LE, whichever corresponds to the width of
15081 "wchar_t" and the big-endian or little-endian byte order being used
15082 for code generation. As with -fexec-charset, charset can be any
15083 encoding supported by the system's "iconv" library routine;
15084 however, you will have problems with encodings that do not fit
15085 exactly in "wchar_t".
15086
15087 -finput-charset=charset
15088 Set the input character set, used for translation from the
15089 character set of the input file to the source character set used by
15090 GCC. If the locale does not specify, or GCC cannot get this
15091 information from the locale, the default is UTF-8. This can be
15092 overridden by either the locale or this command-line option.
15093 Currently the command-line option takes precedence if there's a
15094 conflict. charset can be any encoding supported by the system's
15095 "iconv" library routine.
15096
15097 -fpch-deps
15098 When using precompiled headers, this flag causes the dependency-
15099 output flags to also list the files from the precompiled header's
15100 dependencies. If not specified, only the precompiled header are
15101 listed and not the files that were used to create it, because those
15102 files are not consulted when a precompiled header is used.
15103
15104 -fpch-preprocess
15105 This option allows use of a precompiled header together with -E.
15106 It inserts a special "#pragma", "#pragma GCC pch_preprocess
15107 "filename"" in the output to mark the place where the precompiled
15108 header was found, and its filename. When -fpreprocessed is in use,
15109 GCC recognizes this "#pragma" and loads the PCH.
15110
15111 This option is off by default, because the resulting preprocessed
15112 output is only really suitable as input to GCC. It is switched on
15113 by -save-temps.
15114
15115 You should not write this "#pragma" in your own code, but it is
15116 safe to edit the filename if the PCH file is available in a
15117 different location. The filename may be absolute or it may be
15118 relative to GCC's current directory.
15119
15120 -fworking-directory
15121 Enable generation of linemarkers in the preprocessor output that
15122 let the compiler know the current working directory at the time of
15123 preprocessing. When this option is enabled, the preprocessor
15124 emits, after the initial linemarker, a second linemarker with the
15125 current working directory followed by two slashes. GCC uses this
15126 directory, when it's present in the preprocessed input, as the
15127 directory emitted as the current working directory in some
15128 debugging information formats. This option is implicitly enabled
15129 if debugging information is enabled, but this can be inhibited with
15130 the negated form -fno-working-directory. If the -P flag is present
15131 in the command line, this option has no effect, since no "#line"
15132 directives are emitted whatsoever.
15133
15134 -A predicate=answer
15135 Make an assertion with the predicate predicate and answer answer.
15136 This form is preferred to the older form -A predicate(answer),
15137 which is still supported, because it does not use shell special
15138 characters.
15139
15140 -A -predicate=answer
15141 Cancel an assertion with the predicate predicate and answer answer.
15142
15143 -C Do not discard comments. All comments are passed through to the
15144 output file, except for comments in processed directives, which are
15145 deleted along with the directive.
15146
15147 You should be prepared for side effects when using -C; it causes
15148 the preprocessor to treat comments as tokens in their own right.
15149 For example, comments appearing at the start of what would be a
15150 directive line have the effect of turning that line into an
15151 ordinary source line, since the first token on the line is no
15152 longer a #.
15153
15154 -CC Do not discard comments, including during macro expansion. This is
15155 like -C, except that comments contained within macros are also
15156 passed through to the output file where the macro is expanded.
15157
15158 In addition to the side effects of the -C option, the -CC option
15159 causes all C++-style comments inside a macro to be converted to
15160 C-style comments. This is to prevent later use of that macro from
15161 inadvertently commenting out the remainder of the source line.
15162
15163 The -CC option is generally used to support lint comments.
15164
15165 -P Inhibit generation of linemarkers in the output from the
15166 preprocessor. This might be useful when running the preprocessor
15167 on something that is not C code, and will be sent to a program
15168 which might be confused by the linemarkers.
15169
15170 -traditional
15171 -traditional-cpp
15172 Try to imitate the behavior of pre-standard C preprocessors, as
15173 opposed to ISO C preprocessors. See the GNU CPP manual for
15174 details.
15175
15176 Note that GCC does not otherwise attempt to emulate a pre-standard
15177 C compiler, and these options are only supported with the -E
15178 switch, or when invoking CPP explicitly.
15179
15180 -trigraphs
15181 Support ISO C trigraphs. These are three-character sequences, all
15182 starting with ??, that are defined by ISO C to stand for single
15183 characters. For example, ??/ stands for \, so '??/n' is a
15184 character constant for a newline.
15185
15186 The nine trigraphs and their replacements are
15187
15188 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
15189 Replacement: [ ] { } # \ ^ | ~
15190
15191 By default, GCC ignores trigraphs, but in standard-conforming modes
15192 it converts them. See the -std and -ansi options.
15193
15194 -remap
15195 Enable special code to work around file systems which only permit
15196 very short file names, such as MS-DOS.
15197
15198 -H Print the name of each header file used, in addition to other
15199 normal activities. Each name is indented to show how deep in the
15200 #include stack it is. Precompiled header files are also printed,
15201 even if they are found to be invalid; an invalid precompiled header
15202 file is printed with ...x and a valid one with ...! .
15203
15204 -dletters
15205 Says to make debugging dumps during compilation as specified by
15206 letters. The flags documented here are those relevant to the
15207 preprocessor. Other letters are interpreted by the compiler
15208 proper, or reserved for future versions of GCC, and so are silently
15209 ignored. If you specify letters whose behavior conflicts, the
15210 result is undefined.
15211
15212 -dM Instead of the normal output, generate a list of #define
15213 directives for all the macros defined during the execution of
15214 the preprocessor, including predefined macros. This gives you
15215 a way of finding out what is predefined in your version of the
15216 preprocessor. Assuming you have no file foo.h, the command
15217
15218 touch foo.h; cpp -dM foo.h
15219
15220 shows all the predefined macros.
15221
15222 If you use -dM without the -E option, -dM is interpreted as a
15223 synonym for -fdump-rtl-mach.
15224
15225 -dD Like -dM except in two respects: it does not include the
15226 predefined macros, and it outputs both the #define directives
15227 and the result of preprocessing. Both kinds of output go to
15228 the standard output file.
15229
15230 -dN Like -dD, but emit only the macro names, not their expansions.
15231
15232 -dI Output #include directives in addition to the result of
15233 preprocessing.
15234
15235 -dU Like -dD except that only macros that are expanded, or whose
15236 definedness is tested in preprocessor directives, are output;
15237 the output is delayed until the use or test of the macro; and
15238 #undef directives are also output for macros tested but
15239 undefined at the time.
15240
15241 -fdebug-cpp
15242 This option is only useful for debugging GCC. When used from CPP
15243 or with -E, it dumps debugging information about location maps.
15244 Every token in the output is preceded by the dump of the map its
15245 location belongs to.
15246
15247 When used from GCC without -E, this option has no effect.
15248
15249 -Wp,option
15250 You can use -Wp,option to bypass the compiler driver and pass
15251 option directly through to the preprocessor. If option contains
15252 commas, it is split into multiple options at the commas. However,
15253 many options are modified, translated or interpreted by the
15254 compiler driver before being passed to the preprocessor, and -Wp
15255 forcibly bypasses this phase. The preprocessor's direct interface
15256 is undocumented and subject to change, so whenever possible you
15257 should avoid using -Wp and let the driver handle the options
15258 instead.
15259
15260 -Xpreprocessor option
15261 Pass option as an option to the preprocessor. You can use this to
15262 supply system-specific preprocessor options that GCC does not
15263 recognize.
15264
15265 If you want to pass an option that takes an argument, you must use
15266 -Xpreprocessor twice, once for the option and once for the
15267 argument.
15268
15269 -no-integrated-cpp
15270 Perform preprocessing as a separate pass before compilation. By
15271 default, GCC performs preprocessing as an integrated part of input
15272 tokenization and parsing. If this option is provided, the
15273 appropriate language front end (cc1, cc1plus, or cc1obj for C, C++,
15274 and Objective-C, respectively) is instead invoked twice, once for
15275 preprocessing only and once for actual compilation of the
15276 preprocessed input. This option may be useful in conjunction with
15277 the -B or -wrapper options to specify an alternate preprocessor or
15278 perform additional processing of the program source between normal
15279 preprocessing and compilation.
15280
15281 -flarge-source-files
15282 Adjust GCC to expect large source files, at the expense of slower
15283 compilation and higher memory usage.
15284
15285 Specifically, GCC normally tracks both column numbers and line
15286 numbers within source files and it normally prints both of these
15287 numbers in diagnostics. However, once it has processed a certain
15288 number of source lines, it stops tracking column numbers and only
15289 tracks line numbers. This means that diagnostics for later lines
15290 do not include column numbers. It also means that options like
15291 -Wmisleading-indentation cease to work at that point, although the
15292 compiler prints a note if this happens. Passing
15293 -flarge-source-files significantly increases the number of source
15294 lines that GCC can process before it stops tracking columns.
15295
15296 Passing Options to the Assembler
15297 You can pass options to the assembler.
15298
15299 -Wa,option
15300 Pass option as an option to the assembler. If option contains
15301 commas, it is split into multiple options at the commas.
15302
15303 -Xassembler option
15304 Pass option as an option to the assembler. You can use this to
15305 supply system-specific assembler options that GCC does not
15306 recognize.
15307
15308 If you want to pass an option that takes an argument, you must use
15309 -Xassembler twice, once for the option and once for the argument.
15310
15311 Options for Linking
15312 These options come into play when the compiler links object files into
15313 an executable output file. They are meaningless if the compiler is not
15314 doing a link step.
15315
15316 object-file-name
15317 A file name that does not end in a special recognized suffix is
15318 considered to name an object file or library. (Object files are
15319 distinguished from libraries by the linker according to the file
15320 contents.) If linking is done, these object files are used as
15321 input to the linker.
15322
15323 -c
15324 -S
15325 -E If any of these options is used, then the linker is not run, and
15326 object file names should not be used as arguments.
15327
15328 -flinker-output=type
15329 This option controls code generation of the link-time optimizer.
15330 By default the linker output is automatically determined by the
15331 linker plugin. For debugging the compiler and if incremental
15332 linking with a non-LTO object file is desired, it may be useful to
15333 control the type manually.
15334
15335 If type is exec, code generation produces a static binary. In this
15336 case -fpic and -fpie are both disabled.
15337
15338 If type is dyn, code generation produces a shared library. In this
15339 case -fpic or -fPIC is preserved, but not enabled automatically.
15340 This allows to build shared libraries without position-independent
15341 code on architectures where this is possible, i.e. on x86.
15342
15343 If type is pie, code generation produces an -fpie executable. This
15344 results in similar optimizations as exec except that -fpie is not
15345 disabled if specified at compilation time.
15346
15347 If type is rel, the compiler assumes that incremental linking is
15348 done. The sections containing intermediate code for link-time
15349 optimization are merged, pre-optimized, and output to the resulting
15350 object file. In addition, if -ffat-lto-objects is specified, binary
15351 code is produced for future non-LTO linking. The object file
15352 produced by incremental linking is smaller than a static library
15353 produced from the same object files. At link time the result of
15354 incremental linking also loads faster than a static library
15355 assuming that the majority of objects in the library are used.
15356
15357 Finally nolto-rel configures the compiler for incremental linking
15358 where code generation is forced, a final binary is produced, and
15359 the intermediate code for later link-time optimization is stripped.
15360 When multiple object files are linked together the resulting code
15361 is better optimized than with link-time optimizations disabled (for
15362 example, cross-module inlining happens), but most of benefits of
15363 whole program optimizations are lost.
15364
15365 During the incremental link (by -r) the linker plugin defaults to
15366 rel. With current interfaces to GNU Binutils it is however not
15367 possible to incrementally link LTO objects and non-LTO objects into
15368 a single mixed object file. If any of object files in incremental
15369 link cannot be used for link-time optimization, the linker plugin
15370 issues a warning and uses nolto-rel. To maintain whole program
15371 optimization, it is recommended to link such objects into static
15372 library instead. Alternatively it is possible to use H.J. Lu's
15373 binutils with support for mixed objects.
15374
15375 -fuse-ld=bfd
15376 Use the bfd linker instead of the default linker.
15377
15378 -fuse-ld=gold
15379 Use the gold linker instead of the default linker.
15380
15381 -fuse-ld=lld
15382 Use the LLVM lld linker instead of the default linker.
15383
15384 -fuse-ld=mold
15385 Use the Modern Linker (mold) instead of the default linker.
15386
15387 -llibrary
15388 -l library
15389 Search the library named library when linking. (The second
15390 alternative with the library as a separate argument is only for
15391 POSIX compliance and is not recommended.)
15392
15393 The -l option is passed directly to the linker by GCC. Refer to
15394 your linker documentation for exact details. The general
15395 description below applies to the GNU linker.
15396
15397 The linker searches a standard list of directories for the library.
15398 The directories searched include several standard system
15399 directories plus any that you specify with -L.
15400
15401 Static libraries are archives of object files, and have file names
15402 like liblibrary.a. Some targets also support shared libraries,
15403 which typically have names like liblibrary.so. If both static and
15404 shared libraries are found, the linker gives preference to linking
15405 with the shared library unless the -static option is used.
15406
15407 It makes a difference where in the command you write this option;
15408 the linker searches and processes libraries and object files in the
15409 order they are specified. Thus, foo.o -lz bar.o searches library z
15410 after file foo.o but before bar.o. If bar.o refers to functions in
15411 z, those functions may not be loaded.
15412
15413 -lobjc
15414 You need this special case of the -l option in order to link an
15415 Objective-C or Objective-C++ program.
15416
15417 -nostartfiles
15418 Do not use the standard system startup files when linking. The
15419 standard system libraries are used normally, unless -nostdlib,
15420 -nolibc, or -nodefaultlibs is used.
15421
15422 -nodefaultlibs
15423 Do not use the standard system libraries when linking. Only the
15424 libraries you specify are passed to the linker, and options
15425 specifying linkage of the system libraries, such as -static-libgcc
15426 or -shared-libgcc, are ignored. The standard startup files are
15427 used normally, unless -nostartfiles is used.
15428
15429 The compiler may generate calls to "memcmp", "memset", "memcpy" and
15430 "memmove". These entries are usually resolved by entries in libc.
15431 These entry points should be supplied through some other mechanism
15432 when this option is specified.
15433
15434 -nolibc
15435 Do not use the C library or system libraries tightly coupled with
15436 it when linking. Still link with the startup files, libgcc or
15437 toolchain provided language support libraries such as libgnat,
15438 libgfortran or libstdc++ unless options preventing their inclusion
15439 are used as well. This typically removes -lc from the link command
15440 line, as well as system libraries that normally go with it and
15441 become meaningless when absence of a C library is assumed, for
15442 example -lpthread or -lm in some configurations. This is intended
15443 for bare-board targets when there is indeed no C library available.
15444
15445 -nostdlib
15446 Do not use the standard system startup files or libraries when
15447 linking. No startup files and only the libraries you specify are
15448 passed to the linker, and options specifying linkage of the system
15449 libraries, such as -static-libgcc or -shared-libgcc, are ignored.
15450
15451 The compiler may generate calls to "memcmp", "memset", "memcpy" and
15452 "memmove". These entries are usually resolved by entries in libc.
15453 These entry points should be supplied through some other mechanism
15454 when this option is specified.
15455
15456 One of the standard libraries bypassed by -nostdlib and
15457 -nodefaultlibs is libgcc.a, a library of internal subroutines which
15458 GCC uses to overcome shortcomings of particular machines, or
15459 special needs for some languages.
15460
15461 In most cases, you need libgcc.a even when you want to avoid other
15462 standard libraries. In other words, when you specify -nostdlib or
15463 -nodefaultlibs you should usually specify -lgcc as well. This
15464 ensures that you have no unresolved references to internal GCC
15465 library subroutines. (An example of such an internal subroutine is
15466 "__main", used to ensure C++ constructors are called.)
15467
15468 -nostdlib++
15469 Do not implicitly link with standard C++ libraries.
15470
15471 -e entry
15472 --entry=entry
15473 Specify that the program entry point is entry. The argument is
15474 interpreted by the linker; the GNU linker accepts either a symbol
15475 name or an address.
15476
15477 -pie
15478 Produce a dynamically linked position independent executable on
15479 targets that support it. For predictable results, you must also
15480 specify the same set of options used for compilation (-fpie, -fPIE,
15481 or model suboptions) when you specify this linker option.
15482
15483 -no-pie
15484 Don't produce a dynamically linked position independent executable.
15485
15486 -static-pie
15487 Produce a static position independent executable on targets that
15488 support it. A static position independent executable is similar to
15489 a static executable, but can be loaded at any address without a
15490 dynamic linker. For predictable results, you must also specify the
15491 same set of options used for compilation (-fpie, -fPIE, or model
15492 suboptions) when you specify this linker option.
15493
15494 -pthread
15495 Link with the POSIX threads library. This option is supported on
15496 GNU/Linux targets, most other Unix derivatives, and also on x86
15497 Cygwin and MinGW targets. On some targets this option also sets
15498 flags for the preprocessor, so it should be used consistently for
15499 both compilation and linking.
15500
15501 -r Produce a relocatable object as output. This is also known as
15502 partial linking.
15503
15504 -rdynamic
15505 Pass the flag -export-dynamic to the ELF linker, on targets that
15506 support it. This instructs the linker to add all symbols, not only
15507 used ones, to the dynamic symbol table. This option is needed for
15508 some uses of "dlopen" or to allow obtaining backtraces from within
15509 a program.
15510
15511 -s Remove all symbol table and relocation information from the
15512 executable.
15513
15514 -static
15515 On systems that support dynamic linking, this overrides -pie and
15516 prevents linking with the shared libraries. On other systems, this
15517 option has no effect.
15518
15519 -shared
15520 Produce a shared object which can then be linked with other objects
15521 to form an executable. Not all systems support this option. For
15522 predictable results, you must also specify the same set of options
15523 used for compilation (-fpic, -fPIC, or model suboptions) when you
15524 specify this linker option.[1]
15525
15526 -shared-libgcc
15527 -static-libgcc
15528 On systems that provide libgcc as a shared library, these options
15529 force the use of either the shared or static version, respectively.
15530 If no shared version of libgcc was built when the compiler was
15531 configured, these options have no effect.
15532
15533 There are several situations in which an application should use the
15534 shared libgcc instead of the static version. The most common of
15535 these is when the application wishes to throw and catch exceptions
15536 across different shared libraries. In that case, each of the
15537 libraries as well as the application itself should use the shared
15538 libgcc.
15539
15540 Therefore, the G++ driver automatically adds -shared-libgcc
15541 whenever you build a shared library or a main executable, because
15542 C++ programs typically use exceptions, so this is the right thing
15543 to do.
15544
15545 If, instead, you use the GCC driver to create shared libraries, you
15546 may find that they are not always linked with the shared libgcc.
15547 If GCC finds, at its configuration time, that you have a non-GNU
15548 linker or a GNU linker that does not support option --eh-frame-hdr,
15549 it links the shared version of libgcc into shared libraries by
15550 default. Otherwise, it takes advantage of the linker and optimizes
15551 away the linking with the shared version of libgcc, linking with
15552 the static version of libgcc by default. This allows exceptions to
15553 propagate through such shared libraries, without incurring
15554 relocation costs at library load time.
15555
15556 However, if a library or main executable is supposed to throw or
15557 catch exceptions, you must link it using the G++ driver, or using
15558 the option -shared-libgcc, such that it is linked with the shared
15559 libgcc.
15560
15561 -static-libasan
15562 When the -fsanitize=address option is used to link a program, the
15563 GCC driver automatically links against libasan. If libasan is
15564 available as a shared library, and the -static option is not used,
15565 then this links against the shared version of libasan. The
15566 -static-libasan option directs the GCC driver to link libasan
15567 statically, without necessarily linking other libraries statically.
15568
15569 -static-libtsan
15570 When the -fsanitize=thread option is used to link a program, the
15571 GCC driver automatically links against libtsan. If libtsan is
15572 available as a shared library, and the -static option is not used,
15573 then this links against the shared version of libtsan. The
15574 -static-libtsan option directs the GCC driver to link libtsan
15575 statically, without necessarily linking other libraries statically.
15576
15577 -static-liblsan
15578 When the -fsanitize=leak option is used to link a program, the GCC
15579 driver automatically links against liblsan. If liblsan is
15580 available as a shared library, and the -static option is not used,
15581 then this links against the shared version of liblsan. The
15582 -static-liblsan option directs the GCC driver to link liblsan
15583 statically, without necessarily linking other libraries statically.
15584
15585 -static-libubsan
15586 When the -fsanitize=undefined option is used to link a program, the
15587 GCC driver automatically links against libubsan. If libubsan is
15588 available as a shared library, and the -static option is not used,
15589 then this links against the shared version of libubsan. The
15590 -static-libubsan option directs the GCC driver to link libubsan
15591 statically, without necessarily linking other libraries statically.
15592
15593 -static-libstdc++
15594 When the g++ program is used to link a C++ program, it normally
15595 automatically links against libstdc++. If libstdc++ is available
15596 as a shared library, and the -static option is not used, then this
15597 links against the shared version of libstdc++. That is normally
15598 fine. However, it is sometimes useful to freeze the version of
15599 libstdc++ used by the program without going all the way to a fully
15600 static link. The -static-libstdc++ option directs the g++ driver
15601 to link libstdc++ statically, without necessarily linking other
15602 libraries statically.
15603
15604 -symbolic
15605 Bind references to global symbols when building a shared object.
15606 Warn about any unresolved references (unless overridden by the link
15607 editor option -Xlinker -z -Xlinker defs). Only a few systems
15608 support this option.
15609
15610 -T script
15611 Use script as the linker script. This option is supported by most
15612 systems using the GNU linker. On some targets, such as bare-board
15613 targets without an operating system, the -T option may be required
15614 when linking to avoid references to undefined symbols.
15615
15616 -Xlinker option
15617 Pass option as an option to the linker. You can use this to supply
15618 system-specific linker options that GCC does not recognize.
15619
15620 If you want to pass an option that takes a separate argument, you
15621 must use -Xlinker twice, once for the option and once for the
15622 argument. For example, to pass -assert definitions, you must write
15623 -Xlinker -assert -Xlinker definitions. It does not work to write
15624 -Xlinker "-assert definitions", because this passes the entire
15625 string as a single argument, which is not what the linker expects.
15626
15627 When using the GNU linker, it is usually more convenient to pass
15628 arguments to linker options using the option=value syntax than as
15629 separate arguments. For example, you can specify -Xlinker
15630 -Map=output.map rather than -Xlinker -Map -Xlinker output.map.
15631 Other linkers may not support this syntax for command-line options.
15632
15633 -Wl,option
15634 Pass option as an option to the linker. If option contains commas,
15635 it is split into multiple options at the commas. You can use this
15636 syntax to pass an argument to the option. For example,
15637 -Wl,-Map,output.map passes -Map output.map to the linker. When
15638 using the GNU linker, you can also get the same effect with
15639 -Wl,-Map=output.map.
15640
15641 -u symbol
15642 Pretend the symbol symbol is undefined, to force linking of library
15643 modules to define it. You can use -u multiple times with different
15644 symbols to force loading of additional library modules.
15645
15646 -z keyword
15647 -z is passed directly on to the linker along with the keyword
15648 keyword. See the section in the documentation of your linker for
15649 permitted values and their meanings.
15650
15651 Options for Directory Search
15652 These options specify directories to search for header files, for
15653 libraries and for parts of the compiler:
15654
15655 -I dir
15656 -iquote dir
15657 -isystem dir
15658 -idirafter dir
15659 Add the directory dir to the list of directories to be searched for
15660 header files during preprocessing. If dir begins with = or
15661 $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix;
15662 see --sysroot and -isysroot.
15663
15664 Directories specified with -iquote apply only to the quote form of
15665 the directive, "#include "file"". Directories specified with -I,
15666 -isystem, or -idirafter apply to lookup for both the
15667 "#include "file"" and "#include <file>" directives.
15668
15669 You can specify any number or combination of these options on the
15670 command line to search for header files in several directories.
15671 The lookup order is as follows:
15672
15673 1. For the quote form of the include directive, the directory of
15674 the current file is searched first.
15675
15676 2. For the quote form of the include directive, the directories
15677 specified by -iquote options are searched in left-to-right
15678 order, as they appear on the command line.
15679
15680 3. Directories specified with -I options are scanned in left-to-
15681 right order.
15682
15683 4. Directories specified with -isystem options are scanned in
15684 left-to-right order.
15685
15686 5. Standard system directories are scanned.
15687
15688 6. Directories specified with -idirafter options are scanned in
15689 left-to-right order.
15690
15691 You can use -I to override a system header file, substituting your
15692 own version, since these directories are searched before the
15693 standard system header file directories. However, you should not
15694 use this option to add directories that contain vendor-supplied
15695 system header files; use -isystem for that.
15696
15697 The -isystem and -idirafter options also mark the directory as a
15698 system directory, so that it gets the same special treatment that
15699 is applied to the standard system directories.
15700
15701 If a standard system include directory, or a directory specified
15702 with -isystem, is also specified with -I, the -I option is ignored.
15703 The directory is still searched but as a system directory at its
15704 normal position in the system include chain. This is to ensure
15705 that GCC's procedure to fix buggy system headers and the ordering
15706 for the "#include_next" directive are not inadvertently changed.
15707 If you really need to change the search order for system
15708 directories, use the -nostdinc and/or -isystem options.
15709
15710 -I- Split the include path. This option has been deprecated. Please
15711 use -iquote instead for -I directories before the -I- and remove
15712 the -I- option.
15713
15714 Any directories specified with -I options before -I- are searched
15715 only for headers requested with "#include "file""; they are not
15716 searched for "#include <file>". If additional directories are
15717 specified with -I options after the -I-, those directories are
15718 searched for all #include directives.
15719
15720 In addition, -I- inhibits the use of the directory of the current
15721 file directory as the first search directory for "#include "file"".
15722 There is no way to override this effect of -I-.
15723
15724 -iprefix prefix
15725 Specify prefix as the prefix for subsequent -iwithprefix options.
15726 If the prefix represents a directory, you should include the final
15727 /.
15728
15729 -iwithprefix dir
15730 -iwithprefixbefore dir
15731 Append dir to the prefix specified previously with -iprefix, and
15732 add the resulting directory to the include search path.
15733 -iwithprefixbefore puts it in the same place -I would; -iwithprefix
15734 puts it where -idirafter would.
15735
15736 -isysroot dir
15737 This option is like the --sysroot option, but applies only to
15738 header files (except for Darwin targets, where it applies to both
15739 header files and libraries). See the --sysroot option for more
15740 information.
15741
15742 -imultilib dir
15743 Use dir as a subdirectory of the directory containing target-
15744 specific C++ headers.
15745
15746 -nostdinc
15747 Do not search the standard system directories for header files.
15748 Only the directories explicitly specified with -I, -iquote,
15749 -isystem, and/or -idirafter options (and the directory of the
15750 current file, if appropriate) are searched.
15751
15752 -nostdinc++
15753 Do not search for header files in the C++-specific standard
15754 directories, but do still search the other standard directories.
15755 (This option is used when building the C++ library.)
15756
15757 -iplugindir=dir
15758 Set the directory to search for plugins that are passed by
15759 -fplugin=name instead of -fplugin=path/name.so. This option is not
15760 meant to be used by the user, but only passed by the driver.
15761
15762 -Ldir
15763 Add directory dir to the list of directories to be searched for -l.
15764
15765 -Bprefix
15766 This option specifies where to find the executables, libraries,
15767 include files, and data files of the compiler itself.
15768
15769 The compiler driver program runs one or more of the subprograms
15770 cpp, cc1, as and ld. It tries prefix as a prefix for each program
15771 it tries to run, both with and without machine/version/ for the
15772 corresponding target machine and compiler version.
15773
15774 For each subprogram to be run, the compiler driver first tries the
15775 -B prefix, if any. If that name is not found, or if -B is not
15776 specified, the driver tries two standard prefixes, /usr/lib/gcc/
15777 and /usr/local/lib/gcc/. If neither of those results in a file
15778 name that is found, the unmodified program name is searched for
15779 using the directories specified in your PATH environment variable.
15780
15781 The compiler checks to see if the path provided by -B refers to a
15782 directory, and if necessary it adds a directory separator character
15783 at the end of the path.
15784
15785 -B prefixes that effectively specify directory names also apply to
15786 libraries in the linker, because the compiler translates these
15787 options into -L options for the linker. They also apply to include
15788 files in the preprocessor, because the compiler translates these
15789 options into -isystem options for the preprocessor. In this case,
15790 the compiler appends include to the prefix.
15791
15792 The runtime support file libgcc.a can also be searched for using
15793 the -B prefix, if needed. If it is not found there, the two
15794 standard prefixes above are tried, and that is all. The file is
15795 left out of the link if it is not found by those means.
15796
15797 Another way to specify a prefix much like the -B prefix is to use
15798 the environment variable GCC_EXEC_PREFIX.
15799
15800 As a special kludge, if the path provided by -B is [dir/]stageN/,
15801 where N is a number in the range 0 to 9, then it is replaced by
15802 [dir/]include. This is to help with boot-strapping the compiler.
15803
15804 -no-canonical-prefixes
15805 Do not expand any symbolic links, resolve references to /../ or
15806 /./, or make the path absolute when generating a relative prefix.
15807
15808 --sysroot=dir
15809 Use dir as the logical root directory for headers and libraries.
15810 For example, if the compiler normally searches for headers in
15811 /usr/include and libraries in /usr/lib, it instead searches
15812 dir/usr/include and dir/usr/lib.
15813
15814 If you use both this option and the -isysroot option, then the
15815 --sysroot option applies to libraries, but the -isysroot option
15816 applies to header files.
15817
15818 The GNU linker (beginning with version 2.16) has the necessary
15819 support for this option. If your linker does not support this
15820 option, the header file aspect of --sysroot still works, but the
15821 library aspect does not.
15822
15823 --no-sysroot-suffix
15824 For some targets, a suffix is added to the root directory specified
15825 with --sysroot, depending on the other options used, so that
15826 headers may for example be found in dir/suffix/usr/include instead
15827 of dir/usr/include. This option disables the addition of such a
15828 suffix.
15829
15830 Options for Code Generation Conventions
15831 These machine-independent options control the interface conventions
15832 used in code generation.
15833
15834 Most of them have both positive and negative forms; the negative form
15835 of -ffoo is -fno-foo. In the table below, only one of the forms is
15836 listed---the one that is not the default. You can figure out the other
15837 form by either removing no- or adding it.
15838
15839 -fstack-reuse=reuse-level
15840 This option controls stack space reuse for user declared local/auto
15841 variables and compiler generated temporaries. reuse_level can be
15842 all, named_vars, or none. all enables stack reuse for all local
15843 variables and temporaries, named_vars enables the reuse only for
15844 user defined local variables with names, and none disables stack
15845 reuse completely. The default value is all. The option is needed
15846 when the program extends the lifetime of a scoped local variable or
15847 a compiler generated temporary beyond the end point defined by the
15848 language. When a lifetime of a variable ends, and if the variable
15849 lives in memory, the optimizing compiler has the freedom to reuse
15850 its stack space with other temporaries or scoped local variables
15851 whose live range does not overlap with it. Legacy code extending
15852 local lifetime is likely to break with the stack reuse
15853 optimization.
15854
15855 For example,
15856
15857 int *p;
15858 {
15859 int local1;
15860
15861 p = &local1;
15862 local1 = 10;
15863 ....
15864 }
15865 {
15866 int local2;
15867 local2 = 20;
15868 ...
15869 }
15870
15871 if (*p == 10) // out of scope use of local1
15872 {
15873
15874 }
15875
15876 Another example:
15877
15878 struct A
15879 {
15880 A(int k) : i(k), j(k) { }
15881 int i;
15882 int j;
15883 };
15884
15885 A *ap;
15886
15887 void foo(const A& ar)
15888 {
15889 ap = &ar;
15890 }
15891
15892 void bar()
15893 {
15894 foo(A(10)); // temp object's lifetime ends when foo returns
15895
15896 {
15897 A a(20);
15898 ....
15899 }
15900 ap->i+= 10; // ap references out of scope temp whose space
15901 // is reused with a. What is the value of ap->i?
15902 }
15903
15904 The lifetime of a compiler generated temporary is well defined by
15905 the C++ standard. When a lifetime of a temporary ends, and if the
15906 temporary lives in memory, the optimizing compiler has the freedom
15907 to reuse its stack space with other temporaries or scoped local
15908 variables whose live range does not overlap with it. However some
15909 of the legacy code relies on the behavior of older compilers in
15910 which temporaries' stack space is not reused, the aggressive stack
15911 reuse can lead to runtime errors. This option is used to control
15912 the temporary stack reuse optimization.
15913
15914 -ftrapv
15915 This option generates traps for signed overflow on addition,
15916 subtraction, multiplication operations. The options -ftrapv and
15917 -fwrapv override each other, so using -ftrapv -fwrapv on the
15918 command-line results in -fwrapv being effective. Note that only
15919 active options override, so using -ftrapv -fwrapv -fno-wrapv on the
15920 command-line results in -ftrapv being effective.
15921
15922 -fwrapv
15923 This option instructs the compiler to assume that signed arithmetic
15924 overflow of addition, subtraction and multiplication wraps around
15925 using twos-complement representation. This flag enables some
15926 optimizations and disables others. The options -ftrapv and -fwrapv
15927 override each other, so using -ftrapv -fwrapv on the command-line
15928 results in -fwrapv being effective. Note that only active options
15929 override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
15930 results in -ftrapv being effective.
15931
15932 -fwrapv-pointer
15933 This option instructs the compiler to assume that pointer
15934 arithmetic overflow on addition and subtraction wraps around using
15935 twos-complement representation. This flag disables some
15936 optimizations which assume pointer overflow is invalid.
15937
15938 -fstrict-overflow
15939 This option implies -fno-wrapv -fno-wrapv-pointer and when negated
15940 implies -fwrapv -fwrapv-pointer.
15941
15942 -fexceptions
15943 Enable exception handling. Generates extra code needed to
15944 propagate exceptions. For some targets, this implies GCC generates
15945 frame unwind information for all functions, which can produce
15946 significant data size overhead, although it does not affect
15947 execution. If you do not specify this option, GCC enables it by
15948 default for languages like C++ that normally require exception
15949 handling, and disables it for languages like C that do not normally
15950 require it. However, you may need to enable this option when
15951 compiling C code that needs to interoperate properly with exception
15952 handlers written in C++. You may also wish to disable this option
15953 if you are compiling older C++ programs that don't use exception
15954 handling.
15955
15956 -fnon-call-exceptions
15957 Generate code that allows trapping instructions to throw
15958 exceptions. Note that this requires platform-specific runtime
15959 support that does not exist everywhere. Moreover, it only allows
15960 trapping instructions to throw exceptions, i.e. memory references
15961 or floating-point instructions. It does not allow exceptions to be
15962 thrown from arbitrary signal handlers such as "SIGALRM". This
15963 enables -fexceptions.
15964
15965 -fdelete-dead-exceptions
15966 Consider that instructions that may throw exceptions but don't
15967 otherwise contribute to the execution of the program can be
15968 optimized away. This does not affect calls to functions except
15969 those with the "pure" or "const" attributes. This option is
15970 enabled by default for the Ada and C++ compilers, as permitted by
15971 the language specifications. Optimization passes that cause dead
15972 exceptions to be removed are enabled independently at different
15973 optimization levels.
15974
15975 -funwind-tables
15976 Similar to -fexceptions, except that it just generates any needed
15977 static data, but does not affect the generated code in any other
15978 way. You normally do not need to enable this option; instead, a
15979 language processor that needs this handling enables it on your
15980 behalf.
15981
15982 -fasynchronous-unwind-tables
15983 Generate unwind table in DWARF format, if supported by target
15984 machine. The table is exact at each instruction boundary, so it
15985 can be used for stack unwinding from asynchronous events (such as
15986 debugger or garbage collector).
15987
15988 -fno-gnu-unique
15989 On systems with recent GNU assembler and C library, the C++
15990 compiler uses the "STB_GNU_UNIQUE" binding to make sure that
15991 definitions of template static data members and static local
15992 variables in inline functions are unique even in the presence of
15993 "RTLD_LOCAL"; this is necessary to avoid problems with a library
15994 used by two different "RTLD_LOCAL" plugins depending on a
15995 definition in one of them and therefore disagreeing with the other
15996 one about the binding of the symbol. But this causes "dlclose" to
15997 be ignored for affected DSOs; if your program relies on
15998 reinitialization of a DSO via "dlclose" and "dlopen", you can use
15999 -fno-gnu-unique.
16000
16001 -fpcc-struct-return
16002 Return "short" "struct" and "union" values in memory like longer
16003 ones, rather than in registers. This convention is less efficient,
16004 but it has the advantage of allowing intercallability between GCC-
16005 compiled files and files compiled with other compilers,
16006 particularly the Portable C Compiler (pcc).
16007
16008 The precise convention for returning structures in memory depends
16009 on the target configuration macros.
16010
16011 Short structures and unions are those whose size and alignment
16012 match that of some integer type.
16013
16014 Warning: code compiled with the -fpcc-struct-return switch is not
16015 binary compatible with code compiled with the -freg-struct-return
16016 switch. Use it to conform to a non-default application binary
16017 interface.
16018
16019 -freg-struct-return
16020 Return "struct" and "union" values in registers when possible.
16021 This is more efficient for small structures than
16022 -fpcc-struct-return.
16023
16024 If you specify neither -fpcc-struct-return nor -freg-struct-return,
16025 GCC defaults to whichever convention is standard for the target.
16026 If there is no standard convention, GCC defaults to
16027 -fpcc-struct-return, except on targets where GCC is the principal
16028 compiler. In those cases, we can choose the standard, and we chose
16029 the more efficient register return alternative.
16030
16031 Warning: code compiled with the -freg-struct-return switch is not
16032 binary compatible with code compiled with the -fpcc-struct-return
16033 switch. Use it to conform to a non-default application binary
16034 interface.
16035
16036 -fshort-enums
16037 Allocate to an "enum" type only as many bytes as it needs for the
16038 declared range of possible values. Specifically, the "enum" type
16039 is equivalent to the smallest integer type that has enough room.
16040
16041 Warning: the -fshort-enums switch causes GCC to generate code that
16042 is not binary compatible with code generated without that switch.
16043 Use it to conform to a non-default application binary interface.
16044
16045 -fshort-wchar
16046 Override the underlying type for "wchar_t" to be "short unsigned
16047 int" instead of the default for the target. This option is useful
16048 for building programs to run under WINE.
16049
16050 Warning: the -fshort-wchar switch causes GCC to generate code that
16051 is not binary compatible with code generated without that switch.
16052 Use it to conform to a non-default application binary interface.
16053
16054 -fcommon
16055 In C code, this option controls the placement of global variables
16056 defined without an initializer, known as tentative definitions in
16057 the C standard. Tentative definitions are distinct from
16058 declarations of a variable with the "extern" keyword, which do not
16059 allocate storage.
16060
16061 The default is -fno-common, which specifies that the compiler
16062 places uninitialized global variables in the BSS section of the
16063 object file. This inhibits the merging of tentative definitions by
16064 the linker so you get a multiple-definition error if the same
16065 variable is accidentally defined in more than one compilation unit.
16066
16067 The -fcommon places uninitialized global variables in a common
16068 block. This allows the linker to resolve all tentative definitions
16069 of the same variable in different compilation units to the same
16070 object, or to a non-tentative definition. This behavior is
16071 inconsistent with C++, and on many targets implies a speed and code
16072 size penalty on global variable references. It is mainly useful to
16073 enable legacy code to link without errors.
16074
16075 -fno-ident
16076 Ignore the "#ident" directive.
16077
16078 -finhibit-size-directive
16079 Don't output a ".size" assembler directive, or anything else that
16080 would cause trouble if the function is split in the middle, and the
16081 two halves are placed at locations far apart in memory. This
16082 option is used when compiling crtstuff.c; you should not need to
16083 use it for anything else.
16084
16085 -fverbose-asm
16086 Put extra commentary information in the generated assembly code to
16087 make it more readable. This option is generally only of use to
16088 those who actually need to read the generated assembly code
16089 (perhaps while debugging the compiler itself).
16090
16091 -fno-verbose-asm, the default, causes the extra information to be
16092 omitted and is useful when comparing two assembler files.
16093
16094 The added comments include:
16095
16096 * information on the compiler version and command-line options,
16097
16098 * the source code lines associated with the assembly
16099 instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE,
16100
16101 * hints on which high-level expressions correspond to the various
16102 assembly instruction operands.
16103
16104 For example, given this C source file:
16105
16106 int test (int n)
16107 {
16108 int i;
16109 int total = 0;
16110
16111 for (i = 0; i < n; i++)
16112 total += i * i;
16113
16114 return total;
16115 }
16116
16117 compiling to (x86_64) assembly via -S and emitting the result
16118 direct to stdout via -o -
16119
16120 gcc -S test.c -fverbose-asm -Os -o -
16121
16122 gives output similar to this:
16123
16124 .file "test.c"
16125 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
16126 [...snip...]
16127 # options passed:
16128 [...snip...]
16129
16130 .text
16131 .globl test
16132 .type test, @function
16133 test:
16134 .LFB0:
16135 .cfi_startproc
16136 # test.c:4: int total = 0;
16137 xorl %eax, %eax # <retval>
16138 # test.c:6: for (i = 0; i < n; i++)
16139 xorl %edx, %edx # i
16140 .L2:
16141 # test.c:6: for (i = 0; i < n; i++)
16142 cmpl %edi, %edx # n, i
16143 jge .L5 #,
16144 # test.c:7: total += i * i;
16145 movl %edx, %ecx # i, tmp92
16146 imull %edx, %ecx # i, tmp92
16147 # test.c:6: for (i = 0; i < n; i++)
16148 incl %edx # i
16149 # test.c:7: total += i * i;
16150 addl %ecx, %eax # tmp92, <retval>
16151 jmp .L2 #
16152 .L5:
16153 # test.c:10: }
16154 ret
16155 .cfi_endproc
16156 .LFE0:
16157 .size test, .-test
16158 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
16159 .section .note.GNU-stack,"",@progbits
16160
16161 The comments are intended for humans rather than machines and hence
16162 the precise format of the comments is subject to change.
16163
16164 -frecord-gcc-switches
16165 This switch causes the command line used to invoke the compiler to
16166 be recorded into the object file that is being created. This
16167 switch is only implemented on some targets and the exact format of
16168 the recording is target and binary file format dependent, but it
16169 usually takes the form of a section containing ASCII text. This
16170 switch is related to the -fverbose-asm switch, but that switch only
16171 records information in the assembler output file as comments, so it
16172 never reaches the object file. See also -grecord-gcc-switches for
16173 another way of storing compiler options into the object file.
16174
16175 -fpic
16176 Generate position-independent code (PIC) suitable for use in a
16177 shared library, if supported for the target machine. Such code
16178 accesses all constant addresses through a global offset table
16179 (GOT). The dynamic loader resolves the GOT entries when the
16180 program starts (the dynamic loader is not part of GCC; it is part
16181 of the operating system). If the GOT size for the linked
16182 executable exceeds a machine-specific maximum size, you get an
16183 error message from the linker indicating that -fpic does not work;
16184 in that case, recompile with -fPIC instead. (These maximums are 8k
16185 on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The
16186 x86 has no such limit.)
16187
16188 Position-independent code requires special support, and therefore
16189 works only on certain machines. For the x86, GCC supports PIC for
16190 System V but not for the Sun 386i. Code generated for the IBM
16191 RS/6000 is always position-independent.
16192
16193 When this flag is set, the macros "__pic__" and "__PIC__" are
16194 defined to 1.
16195
16196 -fPIC
16197 If supported for the target machine, emit position-independent
16198 code, suitable for dynamic linking and avoiding any limit on the
16199 size of the global offset table. This option makes a difference on
16200 AArch64, m68k, PowerPC and SPARC.
16201
16202 Position-independent code requires special support, and therefore
16203 works only on certain machines.
16204
16205 When this flag is set, the macros "__pic__" and "__PIC__" are
16206 defined to 2.
16207
16208 -fpie
16209 -fPIE
16210 These options are similar to -fpic and -fPIC, but the generated
16211 position-independent code can be only linked into executables.
16212 Usually these options are used to compile code that will be linked
16213 using the -pie GCC option.
16214
16215 -fpie and -fPIE both define the macros "__pie__" and "__PIE__".
16216 The macros have the value 1 for -fpie and 2 for -fPIE.
16217
16218 -fno-plt
16219 Do not use the PLT for external function calls in position-
16220 independent code. Instead, load the callee address at call sites
16221 from the GOT and branch to it. This leads to more efficient code
16222 by eliminating PLT stubs and exposing GOT loads to optimizations.
16223 On architectures such as 32-bit x86 where PLT stubs expect the GOT
16224 pointer in a specific register, this gives more register allocation
16225 freedom to the compiler. Lazy binding requires use of the PLT;
16226 with -fno-plt all external symbols are resolved at load time.
16227
16228 Alternatively, the function attribute "noplt" can be used to avoid
16229 calls through the PLT for specific external functions.
16230
16231 In position-dependent code, a few targets also convert calls to
16232 functions that are marked to not use the PLT to use the GOT
16233 instead.
16234
16235 -fno-jump-tables
16236 Do not use jump tables for switch statements even where it would be
16237 more efficient than other code generation strategies. This option
16238 is of use in conjunction with -fpic or -fPIC for building code that
16239 forms part of a dynamic linker and cannot reference the address of
16240 a jump table. On some targets, jump tables do not require a GOT
16241 and this option is not needed.
16242
16243 -fno-bit-tests
16244 Do not use bit tests for switch statements even where it would be
16245 more efficient than other code generation strategies.
16246
16247 -ffixed-reg
16248 Treat the register named reg as a fixed register; generated code
16249 should never refer to it (except perhaps as a stack pointer, frame
16250 pointer or in some other fixed role).
16251
16252 reg must be the name of a register. The register names accepted
16253 are machine-specific and are defined in the "REGISTER_NAMES" macro
16254 in the machine description macro file.
16255
16256 This flag does not have a negative form, because it specifies a
16257 three-way choice.
16258
16259 -fcall-used-reg
16260 Treat the register named reg as an allocable register that is
16261 clobbered by function calls. It may be allocated for temporaries
16262 or variables that do not live across a call. Functions compiled
16263 this way do not save and restore the register reg.
16264
16265 It is an error to use this flag with the frame pointer or stack
16266 pointer. Use of this flag for other registers that have fixed
16267 pervasive roles in the machine's execution model produces
16268 disastrous results.
16269
16270 This flag does not have a negative form, because it specifies a
16271 three-way choice.
16272
16273 -fcall-saved-reg
16274 Treat the register named reg as an allocable register saved by
16275 functions. It may be allocated even for temporaries or variables
16276 that live across a call. Functions compiled this way save and
16277 restore the register reg if they use it.
16278
16279 It is an error to use this flag with the frame pointer or stack
16280 pointer. Use of this flag for other registers that have fixed
16281 pervasive roles in the machine's execution model produces
16282 disastrous results.
16283
16284 A different sort of disaster results from the use of this flag for
16285 a register in which function values may be returned.
16286
16287 This flag does not have a negative form, because it specifies a
16288 three-way choice.
16289
16290 -fpack-struct[=n]
16291 Without a value specified, pack all structure members together
16292 without holes. When a value is specified (which must be a small
16293 power of two), pack structure members according to this value,
16294 representing the maximum alignment (that is, objects with default
16295 alignment requirements larger than this are output potentially
16296 unaligned at the next fitting location.
16297
16298 Warning: the -fpack-struct switch causes GCC to generate code that
16299 is not binary compatible with code generated without that switch.
16300 Additionally, it makes the code suboptimal. Use it to conform to a
16301 non-default application binary interface.
16302
16303 -fleading-underscore
16304 This option and its counterpart, -fno-leading-underscore, forcibly
16305 change the way C symbols are represented in the object file. One
16306 use is to help link with legacy assembly code.
16307
16308 Warning: the -fleading-underscore switch causes GCC to generate
16309 code that is not binary compatible with code generated without that
16310 switch. Use it to conform to a non-default application binary
16311 interface. Not all targets provide complete support for this
16312 switch.
16313
16314 -ftls-model=model
16315 Alter the thread-local storage model to be used. The model
16316 argument should be one of global-dynamic, local-dynamic, initial-
16317 exec or local-exec. Note that the choice is subject to
16318 optimization: the compiler may use a more efficient model for
16319 symbols not visible outside of the translation unit, or if -fpic is
16320 not given on the command line.
16321
16322 The default without -fpic is initial-exec; with -fpic the default
16323 is global-dynamic.
16324
16325 -ftrampolines
16326 For targets that normally need trampolines for nested functions,
16327 always generate them instead of using descriptors. Otherwise, for
16328 targets that do not need them, like for example HP-PA or IA-64, do
16329 nothing.
16330
16331 A trampoline is a small piece of code that is created at run time
16332 on the stack when the address of a nested function is taken, and is
16333 used to call the nested function indirectly. Therefore, it
16334 requires the stack to be made executable in order for the program
16335 to work properly.
16336
16337 -fno-trampolines is enabled by default on a language by language
16338 basis to let the compiler avoid generating them, if it computes
16339 that this is safe, and replace them with descriptors. Descriptors
16340 are made up of data only, but the generated code must be prepared
16341 to deal with them. As of this writing, -fno-trampolines is enabled
16342 by default only for Ada.
16343
16344 Moreover, code compiled with -ftrampolines and code compiled with
16345 -fno-trampolines are not binary compatible if nested functions are
16346 present. This option must therefore be used on a program-wide
16347 basis and be manipulated with extreme care.
16348
16349 For languages other than Ada, the "-ftrampolines" and
16350 "-fno-trampolines" options currently have no effect, and
16351 trampolines are always generated on platforms that need them for
16352 nested functions.
16353
16354 -fvisibility=[default|internal|hidden|protected]
16355 Set the default ELF image symbol visibility to the specified
16356 option---all symbols are marked with this unless overridden within
16357 the code. Using this feature can very substantially improve
16358 linking and load times of shared object libraries, produce more
16359 optimized code, provide near-perfect API export and prevent symbol
16360 clashes. It is strongly recommended that you use this in any
16361 shared objects you distribute.
16362
16363 Despite the nomenclature, default always means public; i.e.,
16364 available to be linked against from outside the shared object.
16365 protected and internal are pretty useless in real-world usage so
16366 the only other commonly used option is hidden. The default if
16367 -fvisibility isn't specified is default, i.e., make every symbol
16368 public.
16369
16370 A good explanation of the benefits offered by ensuring ELF symbols
16371 have the correct visibility is given by "How To Write Shared
16372 Libraries" by Ulrich Drepper (which can be found at
16373 <https://www.akkadia.org/drepper/>)---however a superior solution
16374 made possible by this option to marking things hidden when the
16375 default is public is to make the default hidden and mark things
16376 public. This is the norm with DLLs on Windows and with
16377 -fvisibility=hidden and "__attribute__ ((visibility("default")))"
16378 instead of "__declspec(dllexport)" you get almost identical
16379 semantics with identical syntax. This is a great boon to those
16380 working with cross-platform projects.
16381
16382 For those adding visibility support to existing code, you may find
16383 "#pragma GCC visibility" of use. This works by you enclosing the
16384 declarations you wish to set visibility for with (for example)
16385 "#pragma GCC visibility push(hidden)" and "#pragma GCC visibility
16386 pop". Bear in mind that symbol visibility should be viewed as part
16387 of the API interface contract and thus all new code should always
16388 specify visibility when it is not the default; i.e., declarations
16389 only for use within the local DSO should always be marked
16390 explicitly as hidden as so to avoid PLT indirection
16391 overheads---making this abundantly clear also aids readability and
16392 self-documentation of the code. Note that due to ISO C++
16393 specification requirements, "operator new" and "operator delete"
16394 must always be of default visibility.
16395
16396 Be aware that headers from outside your project, in particular
16397 system headers and headers from any other library you use, may not
16398 be expecting to be compiled with visibility other than the default.
16399 You may need to explicitly say "#pragma GCC visibility
16400 push(default)" before including any such headers.
16401
16402 "extern" declarations are not affected by -fvisibility, so a lot of
16403 code can be recompiled with -fvisibility=hidden with no
16404 modifications. However, this means that calls to "extern"
16405 functions with no explicit visibility use the PLT, so it is more
16406 effective to use "__attribute ((visibility))" and/or "#pragma GCC
16407 visibility" to tell the compiler which "extern" declarations should
16408 be treated as hidden.
16409
16410 Note that -fvisibility does affect C++ vague linkage entities. This
16411 means that, for instance, an exception class that is be thrown
16412 between DSOs must be explicitly marked with default visibility so
16413 that the type_info nodes are unified between the DSOs.
16414
16415 An overview of these techniques, their benefits and how to use them
16416 is at <https://gcc.gnu.org/wiki/Visibility>.
16417
16418 -fstrict-volatile-bitfields
16419 This option should be used if accesses to volatile bit-fields (or
16420 other structure fields, although the compiler usually honors those
16421 types anyway) should use a single access of the width of the
16422 field's type, aligned to a natural alignment if possible. For
16423 example, targets with memory-mapped peripheral registers might
16424 require all such accesses to be 16 bits wide; with this flag you
16425 can declare all peripheral bit-fields as "unsigned short" (assuming
16426 short is 16 bits on these targets) to force GCC to use 16-bit
16427 accesses instead of, perhaps, a more efficient 32-bit access.
16428
16429 If this option is disabled, the compiler uses the most efficient
16430 instruction. In the previous example, that might be a 32-bit load
16431 instruction, even though that accesses bytes that do not contain
16432 any portion of the bit-field, or memory-mapped registers unrelated
16433 to the one being updated.
16434
16435 In some cases, such as when the "packed" attribute is applied to a
16436 structure field, it may not be possible to access the field with a
16437 single read or write that is correctly aligned for the target
16438 machine. In this case GCC falls back to generating multiple
16439 accesses rather than code that will fault or truncate the result at
16440 run time.
16441
16442 Note: Due to restrictions of the C/C++11 memory model, write
16443 accesses are not allowed to touch non bit-field members. It is
16444 therefore recommended to define all bits of the field's type as
16445 bit-field members.
16446
16447 The default value of this option is determined by the application
16448 binary interface for the target processor.
16449
16450 -fsync-libcalls
16451 This option controls whether any out-of-line instance of the
16452 "__sync" family of functions may be used to implement the C++11
16453 "__atomic" family of functions.
16454
16455 The default value of this option is enabled, thus the only useful
16456 form of the option is -fno-sync-libcalls. This option is used in
16457 the implementation of the libatomic runtime library.
16458
16459 GCC Developer Options
16460 This section describes command-line options that are primarily of
16461 interest to GCC developers, including options to support compiler
16462 testing and investigation of compiler bugs and compile-time performance
16463 problems. This includes options that produce debug dumps at various
16464 points in the compilation; that print statistics such as memory use and
16465 execution time; and that print information about GCC's configuration,
16466 such as where it searches for libraries. You should rarely need to use
16467 any of these options for ordinary compilation and linking tasks.
16468
16469 Many developer options that cause GCC to dump output to a file take an
16470 optional =filename suffix. You can specify stdout or - to dump to
16471 standard output, and stderr for standard error.
16472
16473 If =filename is omitted, a default dump file name is constructed by
16474 concatenating the base dump file name, a pass number, phase letter, and
16475 pass name. The base dump file name is the name of output file produced
16476 by the compiler if explicitly specified and not an executable;
16477 otherwise it is the source file name. The pass number is determined by
16478 the order passes are registered with the compiler's pass manager. This
16479 is generally the same as the order of execution, but passes registered
16480 by plugins, target-specific passes, or passes that are otherwise
16481 registered late are numbered higher than the pass named final, even if
16482 they are executed earlier. The phase letter is one of i (inter-
16483 procedural analysis), l (language-specific), r (RTL), or t (tree). The
16484 files are created in the directory of the output file.
16485
16486 -fcallgraph-info
16487 -fcallgraph-info=MARKERS
16488 Makes the compiler output callgraph information for the program, on
16489 a per-object-file basis. The information is generated in the
16490 common VCG format. It can be decorated with additional, per-node
16491 and/or per-edge information, if a list of comma-separated markers
16492 is additionally specified. When the "su" marker is specified, the
16493 callgraph is decorated with stack usage information; it is
16494 equivalent to -fstack-usage. When the "da" marker is specified,
16495 the callgraph is decorated with information about dynamically
16496 allocated objects.
16497
16498 When compiling with -flto, no callgraph information is output along
16499 with the object file. At LTO link time, -fcallgraph-info may
16500 generate multiple callgraph information files next to intermediate
16501 LTO output files.
16502
16503 -dletters
16504 -fdump-rtl-pass
16505 -fdump-rtl-pass=filename
16506 Says to make debugging dumps during compilation at times specified
16507 by letters. This is used for debugging the RTL-based passes of the
16508 compiler.
16509
16510 Some -dletters switches have different meaning when -E is used for
16511 preprocessing.
16512
16513 Debug dumps can be enabled with a -fdump-rtl switch or some -d
16514 option letters. Here are the possible letters for use in pass and
16515 letters, and their meanings:
16516
16517 -fdump-rtl-alignments
16518 Dump after branch alignments have been computed.
16519
16520 -fdump-rtl-asmcons
16521 Dump after fixing rtl statements that have unsatisfied in/out
16522 constraints.
16523
16524 -fdump-rtl-auto_inc_dec
16525 Dump after auto-inc-dec discovery. This pass is only run on
16526 architectures that have auto inc or auto dec instructions.
16527
16528 -fdump-rtl-barriers
16529 Dump after cleaning up the barrier instructions.
16530
16531 -fdump-rtl-bbpart
16532 Dump after partitioning hot and cold basic blocks.
16533
16534 -fdump-rtl-bbro
16535 Dump after block reordering.
16536
16537 -fdump-rtl-btl1
16538 -fdump-rtl-btl2
16539 -fdump-rtl-btl1 and -fdump-rtl-btl2 enable dumping after the
16540 two branch target load optimization passes.
16541
16542 -fdump-rtl-bypass
16543 Dump after jump bypassing and control flow optimizations.
16544
16545 -fdump-rtl-combine
16546 Dump after the RTL instruction combination pass.
16547
16548 -fdump-rtl-compgotos
16549 Dump after duplicating the computed gotos.
16550
16551 -fdump-rtl-ce1
16552 -fdump-rtl-ce2
16553 -fdump-rtl-ce3
16554 -fdump-rtl-ce1, -fdump-rtl-ce2, and -fdump-rtl-ce3 enable
16555 dumping after the three if conversion passes.
16556
16557 -fdump-rtl-cprop_hardreg
16558 Dump after hard register copy propagation.
16559
16560 -fdump-rtl-csa
16561 Dump after combining stack adjustments.
16562
16563 -fdump-rtl-cse1
16564 -fdump-rtl-cse2
16565 -fdump-rtl-cse1 and -fdump-rtl-cse2 enable dumping after the
16566 two common subexpression elimination passes.
16567
16568 -fdump-rtl-dce
16569 Dump after the standalone dead code elimination passes.
16570
16571 -fdump-rtl-dbr
16572 Dump after delayed branch scheduling.
16573
16574 -fdump-rtl-dce1
16575 -fdump-rtl-dce2
16576 -fdump-rtl-dce1 and -fdump-rtl-dce2 enable dumping after the
16577 two dead store elimination passes.
16578
16579 -fdump-rtl-eh
16580 Dump after finalization of EH handling code.
16581
16582 -fdump-rtl-eh_ranges
16583 Dump after conversion of EH handling range regions.
16584
16585 -fdump-rtl-expand
16586 Dump after RTL generation.
16587
16588 -fdump-rtl-fwprop1
16589 -fdump-rtl-fwprop2
16590 -fdump-rtl-fwprop1 and -fdump-rtl-fwprop2 enable dumping after
16591 the two forward propagation passes.
16592
16593 -fdump-rtl-gcse1
16594 -fdump-rtl-gcse2
16595 -fdump-rtl-gcse1 and -fdump-rtl-gcse2 enable dumping after
16596 global common subexpression elimination.
16597
16598 -fdump-rtl-init-regs
16599 Dump after the initialization of the registers.
16600
16601 -fdump-rtl-initvals
16602 Dump after the computation of the initial value sets.
16603
16604 -fdump-rtl-into_cfglayout
16605 Dump after converting to cfglayout mode.
16606
16607 -fdump-rtl-ira
16608 Dump after iterated register allocation.
16609
16610 -fdump-rtl-jump
16611 Dump after the second jump optimization.
16612
16613 -fdump-rtl-loop2
16614 -fdump-rtl-loop2 enables dumping after the rtl loop
16615 optimization passes.
16616
16617 -fdump-rtl-mach
16618 Dump after performing the machine dependent reorganization
16619 pass, if that pass exists.
16620
16621 -fdump-rtl-mode_sw
16622 Dump after removing redundant mode switches.
16623
16624 -fdump-rtl-rnreg
16625 Dump after register renumbering.
16626
16627 -fdump-rtl-outof_cfglayout
16628 Dump after converting from cfglayout mode.
16629
16630 -fdump-rtl-peephole2
16631 Dump after the peephole pass.
16632
16633 -fdump-rtl-postreload
16634 Dump after post-reload optimizations.
16635
16636 -fdump-rtl-pro_and_epilogue
16637 Dump after generating the function prologues and epilogues.
16638
16639 -fdump-rtl-sched1
16640 -fdump-rtl-sched2
16641 -fdump-rtl-sched1 and -fdump-rtl-sched2 enable dumping after
16642 the basic block scheduling passes.
16643
16644 -fdump-rtl-ree
16645 Dump after sign/zero extension elimination.
16646
16647 -fdump-rtl-seqabstr
16648 Dump after common sequence discovery.
16649
16650 -fdump-rtl-shorten
16651 Dump after shortening branches.
16652
16653 -fdump-rtl-sibling
16654 Dump after sibling call optimizations.
16655
16656 -fdump-rtl-split1
16657 -fdump-rtl-split2
16658 -fdump-rtl-split3
16659 -fdump-rtl-split4
16660 -fdump-rtl-split5
16661 These options enable dumping after five rounds of instruction
16662 splitting.
16663
16664 -fdump-rtl-sms
16665 Dump after modulo scheduling. This pass is only run on some
16666 architectures.
16667
16668 -fdump-rtl-stack
16669 Dump after conversion from GCC's "flat register file" registers
16670 to the x87's stack-like registers. This pass is only run on
16671 x86 variants.
16672
16673 -fdump-rtl-subreg1
16674 -fdump-rtl-subreg2
16675 -fdump-rtl-subreg1 and -fdump-rtl-subreg2 enable dumping after
16676 the two subreg expansion passes.
16677
16678 -fdump-rtl-unshare
16679 Dump after all rtl has been unshared.
16680
16681 -fdump-rtl-vartrack
16682 Dump after variable tracking.
16683
16684 -fdump-rtl-vregs
16685 Dump after converting virtual registers to hard registers.
16686
16687 -fdump-rtl-web
16688 Dump after live range splitting.
16689
16690 -fdump-rtl-regclass
16691 -fdump-rtl-subregs_of_mode_init
16692 -fdump-rtl-subregs_of_mode_finish
16693 -fdump-rtl-dfinit
16694 -fdump-rtl-dfinish
16695 These dumps are defined but always produce empty files.
16696
16697 -da
16698 -fdump-rtl-all
16699 Produce all the dumps listed above.
16700
16701 -dA Annotate the assembler output with miscellaneous debugging
16702 information.
16703
16704 -dD Dump all macro definitions, at the end of preprocessing, in
16705 addition to normal output.
16706
16707 -dH Produce a core dump whenever an error occurs.
16708
16709 -dp Annotate the assembler output with a comment indicating which
16710 pattern and alternative is used. The length and cost of each
16711 instruction are also printed.
16712
16713 -dP Dump the RTL in the assembler output as a comment before each
16714 instruction. Also turns on -dp annotation.
16715
16716 -dx Just generate RTL for a function instead of compiling it.
16717 Usually used with -fdump-rtl-expand.
16718
16719 -fdump-debug
16720 Dump debugging information generated during the debug generation
16721 phase.
16722
16723 -fdump-earlydebug
16724 Dump debugging information generated during the early debug
16725 generation phase.
16726
16727 -fdump-noaddr
16728 When doing debugging dumps, suppress address output. This makes it
16729 more feasible to use diff on debugging dumps for compiler
16730 invocations with different compiler binaries and/or different text
16731 / bss / data / heap / stack / dso start locations.
16732
16733 -freport-bug
16734 Collect and dump debug information into a temporary file if an
16735 internal compiler error (ICE) occurs.
16736
16737 -fdump-unnumbered
16738 When doing debugging dumps, suppress instruction numbers and
16739 address output. This makes it more feasible to use diff on
16740 debugging dumps for compiler invocations with different options, in
16741 particular with and without -g.
16742
16743 -fdump-unnumbered-links
16744 When doing debugging dumps (see -d option above), suppress
16745 instruction numbers for the links to the previous and next
16746 instructions in a sequence.
16747
16748 -fdump-ipa-switch
16749 -fdump-ipa-switch-options
16750 Control the dumping at various stages of inter-procedural analysis
16751 language tree to a file. The file name is generated by appending a
16752 switch specific suffix to the source file name, and the file is
16753 created in the same directory as the output file. The following
16754 dumps are possible:
16755
16756 all Enables all inter-procedural analysis dumps.
16757
16758 cgraph
16759 Dumps information about call-graph optimization, unused
16760 function removal, and inlining decisions.
16761
16762 inline
16763 Dump after function inlining.
16764
16765 Additionally, the options -optimized, -missed, -note, and -all can
16766 be provided, with the same meaning as for -fopt-info, defaulting to
16767 -optimized.
16768
16769 For example, -fdump-ipa-inline-optimized-missed will emit
16770 information on callsites that were inlined, along with callsites
16771 that were not inlined.
16772
16773 By default, the dump will contain messages about successful
16774 optimizations (equivalent to -optimized) together with low-level
16775 details about the analysis.
16776
16777 -fdump-lang
16778 Dump language-specific information. The file name is made by
16779 appending .lang to the source file name.
16780
16781 -fdump-lang-all
16782 -fdump-lang-switch
16783 -fdump-lang-switch-options
16784 -fdump-lang-switch-options=filename
16785 Control the dumping of language-specific information. The options
16786 and filename portions behave as described in the -fdump-tree
16787 option. The following switch values are accepted:
16788
16789 all Enable all language-specific dumps.
16790
16791 class
16792 Dump class hierarchy information. Virtual table information is
16793 emitted unless 'slim' is specified. This option is applicable
16794 to C++ only.
16795
16796 module
16797 Dump module information. Options lineno (locations), graph
16798 (reachability), blocks (clusters), uid (serialization), alias
16799 (mergeable), asmname (Elrond), eh (mapper) & vops (macros) may
16800 provide additional information. This option is applicable to
16801 C++ only.
16802
16803 raw Dump the raw internal tree data. This option is applicable to
16804 C++ only.
16805
16806 -fdump-passes
16807 Print on stderr the list of optimization passes that are turned on
16808 and off by the current command-line options.
16809
16810 -fdump-statistics-option
16811 Enable and control dumping of pass statistics in a separate file.
16812 The file name is generated by appending a suffix ending in
16813 .statistics to the source file name, and the file is created in the
16814 same directory as the output file. If the -option form is used,
16815 -stats causes counters to be summed over the whole compilation unit
16816 while -details dumps every event as the passes generate them. The
16817 default with no option is to sum counters for each function
16818 compiled.
16819
16820 -fdump-tree-all
16821 -fdump-tree-switch
16822 -fdump-tree-switch-options
16823 -fdump-tree-switch-options=filename
16824 Control the dumping at various stages of processing the
16825 intermediate language tree to a file. If the -options form is
16826 used, options is a list of - separated options which control the
16827 details of the dump. Not all options are applicable to all dumps;
16828 those that are not meaningful are ignored. The following options
16829 are available
16830
16831 address
16832 Print the address of each node. Usually this is not meaningful
16833 as it changes according to the environment and source file.
16834 Its primary use is for tying up a dump file with a debug
16835 environment.
16836
16837 asmname
16838 If "DECL_ASSEMBLER_NAME" has been set for a given decl, use
16839 that in the dump instead of "DECL_NAME". Its primary use is
16840 ease of use working backward from mangled names in the assembly
16841 file.
16842
16843 slim
16844 When dumping front-end intermediate representations, inhibit
16845 dumping of members of a scope or body of a function merely
16846 because that scope has been reached. Only dump such items when
16847 they are directly reachable by some other path.
16848
16849 When dumping pretty-printed trees, this option inhibits dumping
16850 the bodies of control structures.
16851
16852 When dumping RTL, print the RTL in slim (condensed) form
16853 instead of the default LISP-like representation.
16854
16855 raw Print a raw representation of the tree. By default, trees are
16856 pretty-printed into a C-like representation.
16857
16858 details
16859 Enable more detailed dumps (not honored by every dump option).
16860 Also include information from the optimization passes.
16861
16862 stats
16863 Enable dumping various statistics about the pass (not honored
16864 by every dump option).
16865
16866 blocks
16867 Enable showing basic block boundaries (disabled in raw dumps).
16868
16869 graph
16870 For each of the other indicated dump files (-fdump-rtl-pass),
16871 dump a representation of the control flow graph suitable for
16872 viewing with GraphViz to file.passid.pass.dot. Each function
16873 in the file is pretty-printed as a subgraph, so that GraphViz
16874 can render them all in a single plot.
16875
16876 This option currently only works for RTL dumps, and the RTL is
16877 always dumped in slim form.
16878
16879 vops
16880 Enable showing virtual operands for every statement.
16881
16882 lineno
16883 Enable showing line numbers for statements.
16884
16885 uid Enable showing the unique ID ("DECL_UID") for each variable.
16886
16887 verbose
16888 Enable showing the tree dump for each statement.
16889
16890 eh Enable showing the EH region number holding each statement.
16891
16892 scev
16893 Enable showing scalar evolution analysis details.
16894
16895 optimized
16896 Enable showing optimization information (only available in
16897 certain passes).
16898
16899 missed
16900 Enable showing missed optimization information (only available
16901 in certain passes).
16902
16903 note
16904 Enable other detailed optimization information (only available
16905 in certain passes).
16906
16907 all Turn on all options, except raw, slim, verbose and lineno.
16908
16909 optall
16910 Turn on all optimization options, i.e., optimized, missed, and
16911 note.
16912
16913 To determine what tree dumps are available or find the dump for a
16914 pass of interest follow the steps below.
16915
16916 1. Invoke GCC with -fdump-passes and in the stderr output look for
16917 a code that corresponds to the pass you are interested in. For
16918 example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2"
16919 correspond to the three Value Range Propagation passes. The
16920 number at the end distinguishes distinct invocations of the
16921 same pass.
16922
16923 2. To enable the creation of the dump file, append the pass code
16924 to the -fdump- option prefix and invoke GCC with it. For
16925 example, to enable the dump from the Early Value Range
16926 Propagation pass, invoke GCC with the -fdump-tree-evrp option.
16927 Optionally, you may specify the name of the dump file. If you
16928 don't specify one, GCC creates as described below.
16929
16930 3. Find the pass dump in a file whose name is composed of three
16931 components separated by a period: the name of the source file
16932 GCC was invoked to compile, a numeric suffix indicating the
16933 pass number followed by the letter t for tree passes (and the
16934 letter r for RTL passes), and finally the pass code. For
16935 example, the Early VRP pass dump might be in a file named
16936 myfile.c.038t.evrp in the current working directory. Note that
16937 the numeric codes are not stable and may change from one
16938 version of GCC to another.
16939
16940 -fopt-info
16941 -fopt-info-options
16942 -fopt-info-options=filename
16943 Controls optimization dumps from various optimization passes. If
16944 the -options form is used, options is a list of - separated option
16945 keywords to select the dump details and optimizations.
16946
16947 The options can be divided into three groups:
16948
16949 1. options describing what kinds of messages should be emitted,
16950
16951 2. options describing the verbosity of the dump, and
16952
16953 3. options describing which optimizations should be included.
16954
16955 The options from each group can be freely mixed as they are non-
16956 overlapping. However, in case of any conflicts, the later options
16957 override the earlier options on the command line.
16958
16959 The following options control which kinds of messages should be
16960 emitted:
16961
16962 optimized
16963 Print information when an optimization is successfully applied.
16964 It is up to a pass to decide which information is relevant. For
16965 example, the vectorizer passes print the source location of
16966 loops which are successfully vectorized.
16967
16968 missed
16969 Print information about missed optimizations. Individual passes
16970 control which information to include in the output.
16971
16972 note
16973 Print verbose information about optimizations, such as certain
16974 transformations, more detailed messages about decisions etc.
16975
16976 all Print detailed optimization information. This includes
16977 optimized, missed, and note.
16978
16979 The following option controls the dump verbosity:
16980
16981 internals
16982 By default, only "high-level" messages are emitted. This option
16983 enables additional, more detailed, messages, which are likely
16984 to only be of interest to GCC developers.
16985
16986 One or more of the following option keywords can be used to
16987 describe a group of optimizations:
16988
16989 ipa Enable dumps from all interprocedural optimizations.
16990
16991 loop
16992 Enable dumps from all loop optimizations.
16993
16994 inline
16995 Enable dumps from all inlining optimizations.
16996
16997 omp Enable dumps from all OMP (Offloading and Multi Processing)
16998 optimizations.
16999
17000 vec Enable dumps from all vectorization optimizations.
17001
17002 optall
17003 Enable dumps from all optimizations. This is a superset of the
17004 optimization groups listed above.
17005
17006 If options is omitted, it defaults to optimized-optall, which means
17007 to dump messages about successful optimizations from all the
17008 passes, omitting messages that are treated as "internals".
17009
17010 If the filename is provided, then the dumps from all the applicable
17011 optimizations are concatenated into the filename. Otherwise the
17012 dump is output onto stderr. Though multiple -fopt-info options are
17013 accepted, only one of them can include a filename. If other
17014 filenames are provided then all but the first such option are
17015 ignored.
17016
17017 Note that the output filename is overwritten in case of multiple
17018 translation units. If a combined output from multiple translation
17019 units is desired, stderr should be used instead.
17020
17021 In the following example, the optimization info is output to
17022 stderr:
17023
17024 gcc -O3 -fopt-info
17025
17026 This example:
17027
17028 gcc -O3 -fopt-info-missed=missed.all
17029
17030 outputs missed optimization report from all the passes into
17031 missed.all, and this one:
17032
17033 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
17034
17035 prints information about missed optimization opportunities from
17036 vectorization passes on stderr. Note that -fopt-info-vec-missed is
17037 equivalent to -fopt-info-missed-vec. The order of the optimization
17038 group names and message types listed after -fopt-info does not
17039 matter.
17040
17041 As another example,
17042
17043 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
17044
17045 outputs information about missed optimizations as well as optimized
17046 locations from all the inlining passes into inline.txt.
17047
17048 Finally, consider:
17049
17050 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
17051
17052 Here the two output filenames vec.miss and loop.opt are in conflict
17053 since only one output file is allowed. In this case, only the first
17054 option takes effect and the subsequent options are ignored. Thus
17055 only vec.miss is produced which contains dumps from the vectorizer
17056 about missed opportunities.
17057
17058 -fsave-optimization-record
17059 Write a SRCFILE.opt-record.json.gz file detailing what
17060 optimizations were performed, for those optimizations that support
17061 -fopt-info.
17062
17063 This option is experimental and the format of the data within the
17064 compressed JSON file is subject to change.
17065
17066 It is roughly equivalent to a machine-readable version of
17067 -fopt-info-all, as a collection of messages with source file, line
17068 number and column number, with the following additional data for
17069 each message:
17070
17071 * the execution count of the code being optimized, along with
17072 metadata about whether this was from actual profile data, or
17073 just an estimate, allowing consumers to prioritize messages by
17074 code hotness,
17075
17076 * the function name of the code being optimized, where
17077 applicable,
17078
17079 * the "inlining chain" for the code being optimized, so that when
17080 a function is inlined into several different places (which
17081 might themselves be inlined), the reader can distinguish
17082 between the copies,
17083
17084 * objects identifying those parts of the message that refer to
17085 expressions, statements or symbol-table nodes, which of these
17086 categories they are, and, when available, their source code
17087 location,
17088
17089 * the GCC pass that emitted the message, and
17090
17091 * the location in GCC's own code from which the message was
17092 emitted
17093
17094 Additionally, some messages are logically nested within other
17095 messages, reflecting implementation details of the optimization
17096 passes.
17097
17098 -fsched-verbose=n
17099 On targets that use instruction scheduling, this option controls
17100 the amount of debugging output the scheduler prints to the dump
17101 files.
17102
17103 For n greater than zero, -fsched-verbose outputs the same
17104 information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n
17105 greater than one, it also output basic block probabilities,
17106 detailed ready list information and unit/insn info. For n greater
17107 than two, it includes RTL at abort point, control-flow and regions
17108 info. And for n over four, -fsched-verbose also includes
17109 dependence info.
17110
17111 -fenable-kind-pass
17112 -fdisable-kind-pass=range-list
17113 This is a set of options that are used to explicitly disable/enable
17114 optimization passes. These options are intended for use for
17115 debugging GCC. Compiler users should use regular options for
17116 enabling/disabling passes instead.
17117
17118 -fdisable-ipa-pass
17119 Disable IPA pass pass. pass is the pass name. If the same pass
17120 is statically invoked in the compiler multiple times, the pass
17121 name should be appended with a sequential number starting from
17122 1.
17123
17124 -fdisable-rtl-pass
17125 -fdisable-rtl-pass=range-list
17126 Disable RTL pass pass. pass is the pass name. If the same
17127 pass is statically invoked in the compiler multiple times, the
17128 pass name should be appended with a sequential number starting
17129 from 1. range-list is a comma-separated list of function
17130 ranges or assembler names. Each range is a number pair
17131 separated by a colon. The range is inclusive in both ends. If
17132 the range is trivial, the number pair can be simplified as a
17133 single number. If the function's call graph node's uid falls
17134 within one of the specified ranges, the pass is disabled for
17135 that function. The uid is shown in the function header of a
17136 dump file, and the pass names can be dumped by using option
17137 -fdump-passes.
17138
17139 -fdisable-tree-pass
17140 -fdisable-tree-pass=range-list
17141 Disable tree pass pass. See -fdisable-rtl for the description
17142 of option arguments.
17143
17144 -fenable-ipa-pass
17145 Enable IPA pass pass. pass is the pass name. If the same pass
17146 is statically invoked in the compiler multiple times, the pass
17147 name should be appended with a sequential number starting from
17148 1.
17149
17150 -fenable-rtl-pass
17151 -fenable-rtl-pass=range-list
17152 Enable RTL pass pass. See -fdisable-rtl for option argument
17153 description and examples.
17154
17155 -fenable-tree-pass
17156 -fenable-tree-pass=range-list
17157 Enable tree pass pass. See -fdisable-rtl for the description
17158 of option arguments.
17159
17160 Here are some examples showing uses of these options.
17161
17162 # disable ccp1 for all functions
17163 -fdisable-tree-ccp1
17164 # disable complete unroll for function whose cgraph node uid is 1
17165 -fenable-tree-cunroll=1
17166 # disable gcse2 for functions at the following ranges [1,1],
17167 # [300,400], and [400,1000]
17168 # disable gcse2 for functions foo and foo2
17169 -fdisable-rtl-gcse2=foo,foo2
17170 # disable early inlining
17171 -fdisable-tree-einline
17172 # disable ipa inlining
17173 -fdisable-ipa-inline
17174 # enable tree full unroll
17175 -fenable-tree-unroll
17176
17177 -fchecking
17178 -fchecking=n
17179 Enable internal consistency checking. The default depends on the
17180 compiler configuration. -fchecking=2 enables further internal
17181 consistency checking that might affect code generation.
17182
17183 -frandom-seed=string
17184 This option provides a seed that GCC uses in place of random
17185 numbers in generating certain symbol names that have to be
17186 different in every compiled file. It is also used to place unique
17187 stamps in coverage data files and the object files that produce
17188 them. You can use the -frandom-seed option to produce reproducibly
17189 identical object files.
17190
17191 The string can either be a number (decimal, octal or hex) or an
17192 arbitrary string (in which case it's converted to a number by
17193 computing CRC32).
17194
17195 The string should be different for every file you compile.
17196
17197 -save-temps
17198 Store the usual "temporary" intermediate files permanently; name
17199 them as auxiliary output files, as specified described under
17200 -dumpbase and -dumpdir.
17201
17202 When used in combination with the -x command-line option,
17203 -save-temps is sensible enough to avoid overwriting an input source
17204 file with the same extension as an intermediate file. The
17205 corresponding intermediate file may be obtained by renaming the
17206 source file before using -save-temps.
17207
17208 -save-temps=cwd
17209 Equivalent to -save-temps -dumpdir ./.
17210
17211 -save-temps=obj
17212 Equivalent to -save-temps -dumpdir outdir/, where outdir/ is the
17213 directory of the output file specified after the -o option,
17214 including any directory separators. If the -o option is not used,
17215 the -save-temps=obj switch behaves like -save-temps=cwd.
17216
17217 -time[=file]
17218 Report the CPU time taken by each subprocess in the compilation
17219 sequence. For C source files, this is the compiler proper and
17220 assembler (plus the linker if linking is done).
17221
17222 Without the specification of an output file, the output looks like
17223 this:
17224
17225 # cc1 0.12 0.01
17226 # as 0.00 0.01
17227
17228 The first number on each line is the "user time", that is time
17229 spent executing the program itself. The second number is "system
17230 time", time spent executing operating system routines on behalf of
17231 the program. Both numbers are in seconds.
17232
17233 With the specification of an output file, the output is appended to
17234 the named file, and it looks like this:
17235
17236 0.12 0.01 cc1 <options>
17237 0.00 0.01 as <options>
17238
17239 The "user time" and the "system time" are moved before the program
17240 name, and the options passed to the program are displayed, so that
17241 one can later tell what file was being compiled, and with which
17242 options.
17243
17244 -fdump-final-insns[=file]
17245 Dump the final internal representation (RTL) to file. If the
17246 optional argument is omitted (or if file is "."), the name of the
17247 dump file is determined by appending ".gkd" to the dump base name,
17248 see -dumpbase.
17249
17250 -fcompare-debug[=opts]
17251 If no error occurs during compilation, run the compiler a second
17252 time, adding opts and -fcompare-debug-second to the arguments
17253 passed to the second compilation. Dump the final internal
17254 representation in both compilations, and print an error if they
17255 differ.
17256
17257 If the equal sign is omitted, the default -gtoggle is used.
17258
17259 The environment variable GCC_COMPARE_DEBUG, if defined, non-empty
17260 and nonzero, implicitly enables -fcompare-debug. If
17261 GCC_COMPARE_DEBUG is defined to a string starting with a dash, then
17262 it is used for opts, otherwise the default -gtoggle is used.
17263
17264 -fcompare-debug=, with the equal sign but without opts, is
17265 equivalent to -fno-compare-debug, which disables the dumping of the
17266 final representation and the second compilation, preventing even
17267 GCC_COMPARE_DEBUG from taking effect.
17268
17269 To verify full coverage during -fcompare-debug testing, set
17270 GCC_COMPARE_DEBUG to say -fcompare-debug-not-overridden, which GCC
17271 rejects as an invalid option in any actual compilation (rather than
17272 preprocessing, assembly or linking). To get just a warning,
17273 setting GCC_COMPARE_DEBUG to -w%n-fcompare-debug not overridden
17274 will do.
17275
17276 -fcompare-debug-second
17277 This option is implicitly passed to the compiler for the second
17278 compilation requested by -fcompare-debug, along with options to
17279 silence warnings, and omitting other options that would cause the
17280 compiler to produce output to files or to standard output as a side
17281 effect. Dump files and preserved temporary files are renamed so as
17282 to contain the ".gk" additional extension during the second
17283 compilation, to avoid overwriting those generated by the first.
17284
17285 When this option is passed to the compiler driver, it causes the
17286 first compilation to be skipped, which makes it useful for little
17287 other than debugging the compiler proper.
17288
17289 -gtoggle
17290 Turn off generation of debug info, if leaving out this option
17291 generates it, or turn it on at level 2 otherwise. The position of
17292 this argument in the command line does not matter; it takes effect
17293 after all other options are processed, and it does so only once, no
17294 matter how many times it is given. This is mainly intended to be
17295 used with -fcompare-debug.
17296
17297 -fvar-tracking-assignments-toggle
17298 Toggle -fvar-tracking-assignments, in the same way that -gtoggle
17299 toggles -g.
17300
17301 -Q Makes the compiler print out each function name as it is compiled,
17302 and print some statistics about each pass when it finishes.
17303
17304 -ftime-report
17305 Makes the compiler print some statistics about the time consumed by
17306 each pass when it finishes.
17307
17308 -ftime-report-details
17309 Record the time consumed by infrastructure parts separately for
17310 each pass.
17311
17312 -fira-verbose=n
17313 Control the verbosity of the dump file for the integrated register
17314 allocator. The default value is 5. If the value n is greater or
17315 equal to 10, the dump output is sent to stderr using the same
17316 format as n minus 10.
17317
17318 -flto-report
17319 Prints a report with internal details on the workings of the link-
17320 time optimizer. The contents of this report vary from version to
17321 version. It is meant to be useful to GCC developers when
17322 processing object files in LTO mode (via -flto).
17323
17324 Disabled by default.
17325
17326 -flto-report-wpa
17327 Like -flto-report, but only print for the WPA phase of link-time
17328 optimization.
17329
17330 -fmem-report
17331 Makes the compiler print some statistics about permanent memory
17332 allocation when it finishes.
17333
17334 -fmem-report-wpa
17335 Makes the compiler print some statistics about permanent memory
17336 allocation for the WPA phase only.
17337
17338 -fpre-ipa-mem-report
17339 -fpost-ipa-mem-report
17340 Makes the compiler print some statistics about permanent memory
17341 allocation before or after interprocedural optimization.
17342
17343 -fmultiflags
17344 This option enables multilib-aware "TFLAGS" to be used to build
17345 target libraries with options different from those the compiler is
17346 configured to use by default, through the use of specs
17347
17348 Like "TFLAGS", this allows the target libraries to be built for
17349 portable baseline environments, while the compiler defaults to more
17350 demanding ones. That's useful because users can easily override
17351 the defaults the compiler is configured to use to build their own
17352 programs, if the defaults are not ideal for their target
17353 environment, whereas rebuilding the runtime libraries is usually
17354 not as easy or desirable.
17355
17356 Unlike "TFLAGS", the use of specs enables different flags to be
17357 selected for different multilibs. The way to accomplish that is to
17358 build with make TFLAGS=-fmultiflags, after configuring
17359 --with-specs=%{fmultiflags:...}.
17360
17361 This option is discarded by the driver once it's done processing
17362 driver self spec.
17363
17364 It is also useful to check that "TFLAGS" are being used to build
17365 all target libraries, by configuring a non-bootstrap compiler
17366 --with-specs='%{!fmultiflags:%emissing TFLAGS}' and building the
17367 compiler and target libraries.
17368
17369 -fprofile-report
17370 Makes the compiler print some statistics about consistency of the
17371 (estimated) profile and effect of individual passes.
17372
17373 -fstack-usage
17374 Makes the compiler output stack usage information for the program,
17375 on a per-function basis. The filename for the dump is made by
17376 appending .su to the auxname. auxname is generated from the name
17377 of the output file, if explicitly specified and it is not an
17378 executable, otherwise it is the basename of the source file. An
17379 entry is made up of three fields:
17380
17381 * The name of the function.
17382
17383 * A number of bytes.
17384
17385 * One or more qualifiers: "static", "dynamic", "bounded".
17386
17387 The qualifier "static" means that the function manipulates the
17388 stack statically: a fixed number of bytes are allocated for the
17389 frame on function entry and released on function exit; no stack
17390 adjustments are otherwise made in the function. The second field
17391 is this fixed number of bytes.
17392
17393 The qualifier "dynamic" means that the function manipulates the
17394 stack dynamically: in addition to the static allocation described
17395 above, stack adjustments are made in the body of the function, for
17396 example to push/pop arguments around function calls. If the
17397 qualifier "bounded" is also present, the amount of these
17398 adjustments is bounded at compile time and the second field is an
17399 upper bound of the total amount of stack used by the function. If
17400 it is not present, the amount of these adjustments is not bounded
17401 at compile time and the second field only represents the bounded
17402 part.
17403
17404 -fstats
17405 Emit statistics about front-end processing at the end of the
17406 compilation. This option is supported only by the C++ front end,
17407 and the information is generally only useful to the G++ development
17408 team.
17409
17410 -fdbg-cnt-list
17411 Print the name and the counter upper bound for all debug counters.
17412
17413 -fdbg-cnt=counter-value-list
17414 Set the internal debug counter lower and upper bound. counter-
17415 value-list is a comma-separated list of
17416 name:lower_bound1-upper_bound1 [:lower_bound2-upper_bound2...]
17417 tuples which sets the name of the counter and list of closed
17418 intervals. The lower_bound is optional and is zero initialized if
17419 not set. For example, with -fdbg-cnt=dce:2-4:10-11,tail_call:10,
17420 dbg_cnt(dce) returns true only for second, third, fourth, tenth and
17421 eleventh invocation. For dbg_cnt(tail_call) true is returned for
17422 first 10 invocations.
17423
17424 -print-file-name=library
17425 Print the full absolute name of the library file library that would
17426 be used when linking---and don't do anything else. With this
17427 option, GCC does not compile or link anything; it just prints the
17428 file name.
17429
17430 -print-multi-directory
17431 Print the directory name corresponding to the multilib selected by
17432 any other switches present in the command line. This directory is
17433 supposed to exist in GCC_EXEC_PREFIX.
17434
17435 -print-multi-lib
17436 Print the mapping from multilib directory names to compiler
17437 switches that enable them. The directory name is separated from
17438 the switches by ;, and each switch starts with an @ instead of the
17439 -, without spaces between multiple switches. This is supposed to
17440 ease shell processing.
17441
17442 -print-multi-os-directory
17443 Print the path to OS libraries for the selected multilib, relative
17444 to some lib subdirectory. If OS libraries are present in the lib
17445 subdirectory and no multilibs are used, this is usually just ., if
17446 OS libraries are present in libsuffix sibling directories this
17447 prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are
17448 present in lib/subdir subdirectories it prints e.g. amd64, sparcv9
17449 or ev6.
17450
17451 -print-multiarch
17452 Print the path to OS libraries for the selected multiarch, relative
17453 to some lib subdirectory.
17454
17455 -print-prog-name=program
17456 Like -print-file-name, but searches for a program such as cpp.
17457
17458 -print-libgcc-file-name
17459 Same as -print-file-name=libgcc.a.
17460
17461 This is useful when you use -nostdlib or -nodefaultlibs but you do
17462 want to link with libgcc.a. You can do:
17463
17464 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
17465
17466 -print-search-dirs
17467 Print the name of the configured installation directory and a list
17468 of program and library directories gcc searches---and don't do
17469 anything else.
17470
17471 This is useful when gcc prints the error message installation
17472 problem, cannot exec cpp0: No such file or directory. To resolve
17473 this you either need to put cpp0 and the other compiler components
17474 where gcc expects to find them, or you can set the environment
17475 variable GCC_EXEC_PREFIX to the directory where you installed them.
17476 Don't forget the trailing /.
17477
17478 -print-sysroot
17479 Print the target sysroot directory that is used during compilation.
17480 This is the target sysroot specified either at configure time or
17481 using the --sysroot option, possibly with an extra suffix that
17482 depends on compilation options. If no target sysroot is specified,
17483 the option prints nothing.
17484
17485 -print-sysroot-headers-suffix
17486 Print the suffix added to the target sysroot when searching for
17487 headers, or give an error if the compiler is not configured with
17488 such a suffix---and don't do anything else.
17489
17490 -dumpmachine
17491 Print the compiler's target machine (for example,
17492 i686-pc-linux-gnu)---and don't do anything else.
17493
17494 -dumpversion
17495 Print the compiler version (for example, 3.0, 6.3.0 or 7)---and
17496 don't do anything else. This is the compiler version used in
17497 filesystem paths and specs. Depending on how the compiler has been
17498 configured it can be just a single number (major version), two
17499 numbers separated by a dot (major and minor version) or three
17500 numbers separated by dots (major, minor and patchlevel version).
17501
17502 -dumpfullversion
17503 Print the full compiler version---and don't do anything else. The
17504 output is always three numbers separated by dots, major, minor and
17505 patchlevel version.
17506
17507 -dumpspecs
17508 Print the compiler's built-in specs---and don't do anything else.
17509 (This is used when GCC itself is being built.)
17510
17511 Machine-Dependent Options
17512 Each target machine supported by GCC can have its own options---for
17513 example, to allow you to compile for a particular processor variant or
17514 ABI, or to control optimizations specific to that machine. By
17515 convention, the names of machine-specific options start with -m.
17516
17517 Some configurations of the compiler also support additional target-
17518 specific options, usually for compatibility with other compilers on the
17519 same platform.
17520
17521 AArch64 Options
17522
17523 These options are defined for AArch64 implementations:
17524
17525 -mabi=name
17526 Generate code for the specified data model. Permissible values are
17527 ilp32 for SysV-like data model where int, long int and pointers are
17528 32 bits, and lp64 for SysV-like data model where int is 32 bits,
17529 but long int and pointers are 64 bits.
17530
17531 The default depends on the specific target configuration. Note
17532 that the LP64 and ILP32 ABIs are not link-compatible; you must
17533 compile your entire program with the same ABI, and link with a
17534 compatible set of libraries.
17535
17536 -mbig-endian
17537 Generate big-endian code. This is the default when GCC is
17538 configured for an aarch64_be-*-* target.
17539
17540 -mgeneral-regs-only
17541 Generate code which uses only the general-purpose registers. This
17542 will prevent the compiler from using floating-point and Advanced
17543 SIMD registers but will not impose any restrictions on the
17544 assembler.
17545
17546 -mlittle-endian
17547 Generate little-endian code. This is the default when GCC is
17548 configured for an aarch64-*-* but not an aarch64_be-*-* target.
17549
17550 -mcmodel=tiny
17551 Generate code for the tiny code model. The program and its
17552 statically defined symbols must be within 1MB of each other.
17553 Programs can be statically or dynamically linked.
17554
17555 -mcmodel=small
17556 Generate code for the small code model. The program and its
17557 statically defined symbols must be within 4GB of each other.
17558 Programs can be statically or dynamically linked. This is the
17559 default code model.
17560
17561 -mcmodel=large
17562 Generate code for the large code model. This makes no assumptions
17563 about addresses and sizes of sections. Programs can be statically
17564 linked only. The -mcmodel=large option is incompatible with
17565 -mabi=ilp32, -fpic and -fPIC.
17566
17567 -mstrict-align
17568 -mno-strict-align
17569 Avoid or allow generating memory accesses that may not be aligned
17570 on a natural object boundary as described in the architecture
17571 specification.
17572
17573 -momit-leaf-frame-pointer
17574 -mno-omit-leaf-frame-pointer
17575 Omit or keep the frame pointer in leaf functions. The former
17576 behavior is the default.
17577
17578 -mstack-protector-guard=guard
17579 -mstack-protector-guard-reg=reg
17580 -mstack-protector-guard-offset=offset
17581 Generate stack protection code using canary at guard. Supported
17582 locations are global for a global canary or sysreg for a canary in
17583 an appropriate system register.
17584
17585 With the latter choice the options -mstack-protector-guard-reg=reg
17586 and -mstack-protector-guard-offset=offset furthermore specify which
17587 system register to use as base register for reading the canary, and
17588 from what offset from that base register. There is no default
17589 register or offset as this is entirely for use within the Linux
17590 kernel.
17591
17592 -mtls-dialect=desc
17593 Use TLS descriptors as the thread-local storage mechanism for
17594 dynamic accesses of TLS variables. This is the default.
17595
17596 -mtls-dialect=traditional
17597 Use traditional TLS as the thread-local storage mechanism for
17598 dynamic accesses of TLS variables.
17599
17600 -mtls-size=size
17601 Specify bit size of immediate TLS offsets. Valid values are 12,
17602 24, 32, 48. This option requires binutils 2.26 or newer.
17603
17604 -mfix-cortex-a53-835769
17605 -mno-fix-cortex-a53-835769
17606 Enable or disable the workaround for the ARM Cortex-A53 erratum
17607 number 835769. This involves inserting a NOP instruction between
17608 memory instructions and 64-bit integer multiply-accumulate
17609 instructions.
17610
17611 -mfix-cortex-a53-843419
17612 -mno-fix-cortex-a53-843419
17613 Enable or disable the workaround for the ARM Cortex-A53 erratum
17614 number 843419. This erratum workaround is made at link time and
17615 this will only pass the corresponding flag to the linker.
17616
17617 -mlow-precision-recip-sqrt
17618 -mno-low-precision-recip-sqrt
17619 Enable or disable the reciprocal square root approximation. This
17620 option only has an effect if -ffast-math or
17621 -funsafe-math-optimizations is used as well. Enabling this reduces
17622 precision of reciprocal square root results to about 16 bits for
17623 single precision and to 32 bits for double precision.
17624
17625 -mlow-precision-sqrt
17626 -mno-low-precision-sqrt
17627 Enable or disable the square root approximation. This option only
17628 has an effect if -ffast-math or -funsafe-math-optimizations is used
17629 as well. Enabling this reduces precision of square root results to
17630 about 16 bits for single precision and to 32 bits for double
17631 precision. If enabled, it implies -mlow-precision-recip-sqrt.
17632
17633 -mlow-precision-div
17634 -mno-low-precision-div
17635 Enable or disable the division approximation. This option only has
17636 an effect if -ffast-math or -funsafe-math-optimizations is used as
17637 well. Enabling this reduces precision of division results to about
17638 16 bits for single precision and to 32 bits for double precision.
17639
17640 -mtrack-speculation
17641 -mno-track-speculation
17642 Enable or disable generation of additional code to track
17643 speculative execution through conditional branches. The tracking
17644 state can then be used by the compiler when expanding calls to
17645 "__builtin_speculation_safe_copy" to permit a more efficient code
17646 sequence to be generated.
17647
17648 -moutline-atomics
17649 -mno-outline-atomics
17650 Enable or disable calls to out-of-line helpers to implement atomic
17651 operations. These helpers will, at runtime, determine if the LSE
17652 instructions from ARMv8.1-A can be used; if not, they will use the
17653 load/store-exclusive instructions that are present in the base
17654 ARMv8.0 ISA.
17655
17656 This option is only applicable when compiling for the base ARMv8.0
17657 instruction set. If using a later revision, e.g. -march=armv8.1-a
17658 or -march=armv8-a+lse, the ARMv8.1-Atomics instructions will be
17659 used directly. The same applies when using -mcpu= when the
17660 selected cpu supports the lse feature. This option is on by
17661 default.
17662
17663 -march=name
17664 Specify the name of the target architecture and, optionally, one or
17665 more feature modifiers. This option has the form
17666 -march=arch{+[no]feature}*.
17667
17668 The table below summarizes the permissible values for arch and the
17669 features that they enable by default:
17670
17671 arch value : Architecture : Includes by default
17672 armv8-a : Armv8-A : +fp, +simd
17673 armv8.1-a : Armv8.1-A : armv8-a, +crc, +lse, +rdma
17674 armv8.2-a : Armv8.2-A : armv8.1-a
17675 armv8.3-a : Armv8.3-A : armv8.2-a, +pauth
17676 armv8.4-a : Armv8.4-A : armv8.3-a, +flagm, +fp16fml, +dotprod
17677 armv8.5-a : Armv8.5-A : armv8.4-a, +sb, +ssbs, +predres
17678 armv8.6-a : Armv8.6-A : armv8.5-a, +bf16, +i8mm
17679 armv8.7-a : Armv8.7-A : armv8.6-a, +ls64
17680 armv8.8-a : Armv8.8-a : armv8.7-a, +mops
17681 armv9-a : Armv9-A : armv8.5-a, +sve, +sve2
17682 armv9.1-a : Armv9.1-A : armv9-a, +bf16, +i8mm
17683 armv9.2-a : Armv9.2-A : armv9.1-a, +ls64
17684 armv9.3-a : Armv9.3-A : armv9.2-a, +mops
17685 armv8-r : Armv8-R : armv8-r
17686
17687 The value native is available on native AArch64 GNU/Linux and
17688 causes the compiler to pick the architecture of the host system.
17689 This option has no effect if the compiler is unable to recognize
17690 the architecture of the host system,
17691
17692 The permissible values for feature are listed in the sub-section on
17693 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
17694 Where conflicting feature modifiers are specified, the right-most
17695 feature is used.
17696
17697 GCC uses name to determine what kind of instructions it can emit
17698 when generating assembly code. If -march is specified without
17699 either of -mtune or -mcpu also being specified, the code is tuned
17700 to perform well across a range of target processors implementing
17701 the target architecture.
17702
17703 -mtune=name
17704 Specify the name of the target processor for which GCC should tune
17705 the performance of the code. Permissible values for this option
17706 are: generic, cortex-a35, cortex-a53, cortex-a55, cortex-a57,
17707 cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae,
17708 cortex-a77, cortex-a65, cortex-a65ae, cortex-a34, cortex-a78,
17709 cortex-a78ae, cortex-a78c, ares, exynos-m1, emag, falkor,
17710 neoverse-512tvb, neoverse-e1, neoverse-n1, neoverse-n2,
17711 neoverse-v1, neoverse-v2, qdf24xx, saphira, phecda, xgene1, vulcan,
17712 octeontx, octeontx81, octeontx83, octeontx2, octeontx2t98,
17713 octeontx2t96 octeontx2t93, octeontx2f95, octeontx2f95n,
17714 octeontx2f95mm, a64fx, thunderx, thunderxt88, thunderxt88p1,
17715 thunderxt81, tsv110, thunderxt83, thunderx2t99, thunderx3t110,
17716 zeus, cortex-a57.cortex-a53, cortex-a72.cortex-a53,
17717 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
17718 cortex-a75.cortex-a55, cortex-a76.cortex-a55, cortex-r82,
17719 cortex-x1, cortex-x1c, cortex-x2, cortex-x3, cortex-a510,
17720 cortex-a710, cortex-a715, ampere1, ampere1a, and native.
17721
17722 The values cortex-a57.cortex-a53, cortex-a72.cortex-a53,
17723 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
17724 cortex-a75.cortex-a55, cortex-a76.cortex-a55 specify that GCC
17725 should tune for a big.LITTLE system.
17726
17727 The value neoverse-512tvb specifies that GCC should tune for
17728 Neoverse cores that (a) implement SVE and (b) have a total vector
17729 bandwidth of 512 bits per cycle. In other words, the option tells
17730 GCC to tune for Neoverse cores that can execute 4 128-bit Advanced
17731 SIMD arithmetic instructions a cycle and that can execute an
17732 equivalent number of SVE arithmetic instructions per cycle (2 for
17733 256-bit SVE, 4 for 128-bit SVE). This is more general than tuning
17734 for a specific core like Neoverse V1 but is more specific than the
17735 default tuning described below.
17736
17737 Additionally on native AArch64 GNU/Linux systems the value native
17738 tunes performance to the host system. This option has no effect if
17739 the compiler is unable to recognize the processor of the host
17740 system.
17741
17742 Where none of -mtune=, -mcpu= or -march= are specified, the code is
17743 tuned to perform well across a range of target processors.
17744
17745 This option cannot be suffixed by feature modifiers.
17746
17747 -mcpu=name
17748 Specify the name of the target processor, optionally suffixed by
17749 one or more feature modifiers. This option has the form
17750 -mcpu=cpu{+[no]feature}*, where the permissible values for cpu are
17751 the same as those available for -mtune. The permissible values for
17752 feature are documented in the sub-section on
17753 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
17754 Where conflicting feature modifiers are specified, the right-most
17755 feature is used.
17756
17757 GCC uses name to determine what kind of instructions it can emit
17758 when generating assembly code (as if by -march) and to determine
17759 the target processor for which to tune for performance (as if by
17760 -mtune). Where this option is used in conjunction with -march or
17761 -mtune, those options take precedence over the appropriate part of
17762 this option.
17763
17764 -mcpu=neoverse-512tvb is special in that it does not refer to a
17765 specific core, but instead refers to all Neoverse cores that (a)
17766 implement SVE and (b) have a total vector bandwidth of 512 bits a
17767 cycle. Unless overridden by -march, -mcpu=neoverse-512tvb
17768 generates code that can run on a Neoverse V1 core, since Neoverse
17769 V1 is the first Neoverse core with these properties. Unless
17770 overridden by -mtune, -mcpu=neoverse-512tvb tunes code in the same
17771 way as for -mtune=neoverse-512tvb.
17772
17773 -moverride=string
17774 Override tuning decisions made by the back-end in response to a
17775 -mtune= switch. The syntax, semantics, and accepted values for
17776 string in this option are not guaranteed to be consistent across
17777 releases.
17778
17779 This option is only intended to be useful when developing GCC.
17780
17781 -mverbose-cost-dump
17782 Enable verbose cost model dumping in the debug dump files. This
17783 option is provided for use in debugging the compiler.
17784
17785 -mpc-relative-literal-loads
17786 -mno-pc-relative-literal-loads
17787 Enable or disable PC-relative literal loads. With this option
17788 literal pools are accessed using a single instruction and emitted
17789 after each function. This limits the maximum size of functions to
17790 1MB. This is enabled by default for -mcmodel=tiny.
17791
17792 -msign-return-address=scope
17793 Select the function scope on which return address signing will be
17794 applied. Permissible values are none, which disables return
17795 address signing, non-leaf, which enables pointer signing for
17796 functions which are not leaf functions, and all, which enables
17797 pointer signing for all functions. The default value is none. This
17798 option has been deprecated by -mbranch-protection.
17799
17800 -mbranch-protection=none|standard|pac-ret[+leaf+b-key]|bti
17801 Select the branch protection features to use. none is the default
17802 and turns off all types of branch protection. standard turns on
17803 all types of branch protection features. If a feature has
17804 additional tuning options, then standard sets it to its standard
17805 level. pac-ret[+leaf] turns on return address signing to its
17806 standard level: signing functions that save the return address to
17807 memory (non-leaf functions will practically always do this) using
17808 the a-key. The optional argument leaf can be used to extend the
17809 signing to include leaf functions. The optional argument b-key can
17810 be used to sign the functions with the B-key instead of the A-key.
17811 bti turns on branch target identification mechanism.
17812
17813 -mharden-sls=opts
17814 Enable compiler hardening against straight line speculation (SLS).
17815 opts is a comma-separated list of the following options:
17816
17817 retbr
17818 blr
17819
17820 In addition, -mharden-sls=all enables all SLS hardening while
17821 -mharden-sls=none disables all SLS hardening.
17822
17823 -msve-vector-bits=bits
17824 Specify the number of bits in an SVE vector register. This option
17825 only has an effect when SVE is enabled.
17826
17827 GCC supports two forms of SVE code generation: "vector-length
17828 agnostic" output that works with any size of vector register and
17829 "vector-length specific" output that allows GCC to make assumptions
17830 about the vector length when it is useful for optimization reasons.
17831 The possible values of bits are: scalable, 128, 256, 512, 1024 and
17832 2048. Specifying scalable selects vector-length agnostic output.
17833 At present -msve-vector-bits=128 also generates vector-length
17834 agnostic output for big-endian targets. All other values generate
17835 vector-length specific code. The behavior of these values may
17836 change in future releases and no value except scalable should be
17837 relied on for producing code that is portable across different
17838 hardware SVE vector lengths.
17839
17840 The default is -msve-vector-bits=scalable, which produces vector-
17841 length agnostic code.
17842
17843 -march and -mcpu Feature Modifiers
17844
17845 Feature modifiers used with -march and -mcpu can be any of the
17846 following and their inverses nofeature:
17847
17848 crc Enable CRC extension. This is on by default for -march=armv8.1-a.
17849
17850 crypto
17851 Enable Crypto extension. This also enables Advanced SIMD and
17852 floating-point instructions.
17853
17854 fp Enable floating-point instructions. This is on by default for all
17855 possible values for options -march and -mcpu.
17856
17857 simd
17858 Enable Advanced SIMD instructions. This also enables floating-
17859 point instructions. This is on by default for all possible values
17860 for options -march and -mcpu.
17861
17862 sve Enable Scalable Vector Extension instructions. This also enables
17863 Advanced SIMD and floating-point instructions.
17864
17865 lse Enable Large System Extension instructions. This is on by default
17866 for -march=armv8.1-a.
17867
17868 rdma
17869 Enable Round Double Multiply Accumulate instructions. This is on
17870 by default for -march=armv8.1-a.
17871
17872 fp16
17873 Enable FP16 extension. This also enables floating-point
17874 instructions.
17875
17876 fp16fml
17877 Enable FP16 fmla extension. This also enables FP16 extensions and
17878 floating-point instructions. This option is enabled by default for
17879 -march=armv8.4-a. Use of this option with architectures prior to
17880 Armv8.2-A is not supported.
17881
17882 rcpc
17883 Enable the RCpc extension. This enables the use of the LDAPR
17884 instructions for load-acquire atomic semantics, and passes it on to
17885 the assembler, enabling inline asm statements to use instructions
17886 from the RCpc extension.
17887
17888 dotprod
17889 Enable the Dot Product extension. This also enables Advanced SIMD
17890 instructions.
17891
17892 aes Enable the Armv8-a aes and pmull crypto extension. This also
17893 enables Advanced SIMD instructions.
17894
17895 sha2
17896 Enable the Armv8-a sha2 crypto extension. This also enables
17897 Advanced SIMD instructions.
17898
17899 sha3
17900 Enable the sha512 and sha3 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 sm4 Enable the sm3 and sm4 crypto extension. This also enables
17905 Advanced SIMD instructions. Use of this option with architectures
17906 prior to Armv8.2-A is not supported.
17907
17908 profile
17909 Enable the Statistical Profiling extension. This option is only to
17910 enable the extension at the assembler level and does not affect
17911 code generation.
17912
17913 rng Enable the Armv8.5-a Random Number instructions. This option is
17914 only to enable the extension at the assembler level and does not
17915 affect code generation.
17916
17917 memtag
17918 Enable the Armv8.5-a Memory Tagging Extensions. Use of this option
17919 with architectures prior to Armv8.5-A is not supported.
17920
17921 sb Enable the Armv8-a Speculation Barrier instruction. This option is
17922 only to enable the extension at the assembler level and does not
17923 affect code generation. This option is enabled by default for
17924 -march=armv8.5-a.
17925
17926 ssbs
17927 Enable the Armv8-a Speculative Store Bypass Safe instruction. This
17928 option is only to enable the extension at the assembler level and
17929 does not affect code generation. This option is enabled by default
17930 for -march=armv8.5-a.
17931
17932 predres
17933 Enable the Armv8-a Execution and Data Prediction Restriction
17934 instructions. This option is only to enable the extension at the
17935 assembler level and does not affect code generation. This option
17936 is enabled by default for -march=armv8.5-a.
17937
17938 sve2
17939 Enable the Armv8-a Scalable Vector Extension 2. This also enables
17940 SVE instructions.
17941
17942 sve2-bitperm
17943 Enable SVE2 bitperm instructions. This also enables SVE2
17944 instructions.
17945
17946 sve2-sm4
17947 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
17948
17949 sve2-aes
17950 Enable SVE2 aes instructions. This also enables SVE2 instructions.
17951
17952 sve2-sha3
17953 Enable SVE2 sha3 instructions. This also enables SVE2
17954 instructions.
17955
17956 tme Enable the Transactional Memory Extension.
17957
17958 i8mm
17959 Enable 8-bit Integer Matrix Multiply instructions. This also
17960 enables Advanced SIMD and floating-point instructions. This option
17961 is enabled by default for -march=armv8.6-a. Use of this option
17962 with architectures prior to Armv8.2-A is not supported.
17963
17964 f32mm
17965 Enable 32-bit Floating point Matrix Multiply instructions. This
17966 also enables SVE instructions. Use of this option with
17967 architectures prior to Armv8.2-A is not supported.
17968
17969 f64mm
17970 Enable 64-bit Floating point Matrix Multiply instructions. This
17971 also enables SVE instructions. Use of this option with
17972 architectures prior to Armv8.2-A is not supported.
17973
17974 bf16
17975 Enable brain half-precision floating-point instructions. This also
17976 enables Advanced SIMD and floating-point instructions. This option
17977 is enabled by default for -march=armv8.6-a. Use of this option
17978 with architectures prior to Armv8.2-A is not supported.
17979
17980 ls64
17981 Enable the 64-byte atomic load and store instructions for
17982 accelerators. This option is enabled by default for
17983 -march=armv8.7-a.
17984
17985 mops
17986 Enable the instructions to accelerate memory operations like
17987 "memcpy", "memmove", "memset". This option is enabled by default
17988 for -march=armv8.8-a
17989
17990 flagm
17991 Enable the Flag Manipulation instructions Extension.
17992
17993 pauth
17994 Enable the Pointer Authentication Extension.
17995
17996 cssc
17997 Enable the Common Short Sequence Compression instructions.
17998
17999 Feature crypto implies aes, sha2, and simd, which implies fp.
18000 Conversely, nofp implies nosimd, which implies nocrypto, noaes and
18001 nosha2.
18002
18003 Adapteva Epiphany Options
18004
18005 These -m options are defined for Adapteva Epiphany:
18006
18007 -mhalf-reg-file
18008 Don't allocate any register in the range "r32"..."r63". That
18009 allows code to run on hardware variants that lack these registers.
18010
18011 -mprefer-short-insn-regs
18012 Preferentially allocate registers that allow short instruction
18013 generation. This can result in increased instruction count, so
18014 this may either reduce or increase overall code size.
18015
18016 -mbranch-cost=num
18017 Set the cost of branches to roughly num "simple" instructions.
18018 This cost is only a heuristic and is not guaranteed to produce
18019 consistent results across releases.
18020
18021 -mcmove
18022 Enable the generation of conditional moves.
18023
18024 -mnops=num
18025 Emit num NOPs before every other generated instruction.
18026
18027 -mno-soft-cmpsf
18028 For single-precision floating-point comparisons, emit an "fsub"
18029 instruction and test the flags. This is faster than a software
18030 comparison, but can get incorrect results in the presence of NaNs,
18031 or when two different small numbers are compared such that their
18032 difference is calculated as zero. The default is -msoft-cmpsf,
18033 which uses slower, but IEEE-compliant, software comparisons.
18034
18035 -mstack-offset=num
18036 Set the offset between the top of the stack and the stack pointer.
18037 E.g., a value of 8 means that the eight bytes in the range
18038 "sp+0...sp+7" can be used by leaf functions without stack
18039 allocation. Values other than 8 or 16 are untested and unlikely to
18040 work. Note also that this option changes the ABI; compiling a
18041 program with a different stack offset than the libraries have been
18042 compiled with generally does not work. This option can be useful
18043 if you want to evaluate if a different stack offset would give you
18044 better code, but to actually use a different stack offset to build
18045 working programs, it is recommended to configure the toolchain with
18046 the appropriate --with-stack-offset=num option.
18047
18048 -mno-round-nearest
18049 Make the scheduler assume that the rounding mode has been set to
18050 truncating. The default is -mround-nearest.
18051
18052 -mlong-calls
18053 If not otherwise specified by an attribute, assume all calls might
18054 be beyond the offset range of the "b" / "bl" instructions, and
18055 therefore load the function address into a register before
18056 performing a (otherwise direct) call. This is the default.
18057
18058 -mshort-calls
18059 If not otherwise specified by an attribute, assume all direct calls
18060 are in the range of the "b" / "bl" instructions, so use these
18061 instructions for direct calls. The default is -mlong-calls.
18062
18063 -msmall16
18064 Assume addresses can be loaded as 16-bit unsigned values. This
18065 does not apply to function addresses for which -mlong-calls
18066 semantics are in effect.
18067
18068 -mfp-mode=mode
18069 Set the prevailing mode of the floating-point unit. This
18070 determines the floating-point mode that is provided and expected at
18071 function call and return time. Making this mode match the mode you
18072 predominantly need at function start can make your programs smaller
18073 and faster by avoiding unnecessary mode switches.
18074
18075 mode can be set to one the following values:
18076
18077 caller
18078 Any mode at function entry is valid, and retained or restored
18079 when the function returns, and when it calls other functions.
18080 This mode is useful for compiling libraries or other
18081 compilation units you might want to incorporate into different
18082 programs with different prevailing FPU modes, and the
18083 convenience of being able to use a single object file outweighs
18084 the size and speed overhead for any extra mode switching that
18085 might be needed, compared with what would be needed with a more
18086 specific choice of prevailing FPU mode.
18087
18088 truncate
18089 This is the mode used for floating-point calculations with
18090 truncating (i.e. round towards zero) rounding mode. That
18091 includes conversion from floating point to integer.
18092
18093 round-nearest
18094 This is the mode used for floating-point calculations with
18095 round-to-nearest-or-even rounding mode.
18096
18097 int This is the mode used to perform integer calculations in the
18098 FPU, e.g. integer multiply, or integer multiply-and-
18099 accumulate.
18100
18101 The default is -mfp-mode=caller
18102
18103 -mno-split-lohi
18104 -mno-postinc
18105 -mno-postmodify
18106 Code generation tweaks that disable, respectively, splitting of
18107 32-bit loads, generation of post-increment addresses, and
18108 generation of post-modify addresses. The defaults are msplit-lohi,
18109 -mpost-inc, and -mpost-modify.
18110
18111 -mnovect-double
18112 Change the preferred SIMD mode to SImode. The default is
18113 -mvect-double, which uses DImode as preferred SIMD mode.
18114
18115 -max-vect-align=num
18116 The maximum alignment for SIMD vector mode types. num may be 4 or
18117 8. The default is 8. Note that this is an ABI change, even though
18118 many library function interfaces are unaffected if they don't use
18119 SIMD vector modes in places that affect size and/or alignment of
18120 relevant types.
18121
18122 -msplit-vecmove-early
18123 Split vector moves into single word moves before reload. In theory
18124 this can give better register allocation, but so far the reverse
18125 seems to be generally the case.
18126
18127 -m1reg-reg
18128 Specify a register to hold the constant -1, which makes loading
18129 small negative constants and certain bitmasks faster. Allowable
18130 values for reg are r43 and r63, which specify use of that register
18131 as a fixed register, and none, which means that no register is used
18132 for this purpose. The default is -m1reg-none.
18133
18134 AMD GCN Options
18135
18136 These options are defined specifically for the AMD GCN port.
18137
18138 -march=gpu
18139 -mtune=gpu
18140 Set architecture type or tuning for gpu. Supported values for gpu
18141 are
18142
18143 fiji
18144 Compile for GCN3 Fiji devices (gfx803).
18145
18146 gfx900
18147 Compile for GCN5 Vega 10 devices (gfx900).
18148
18149 gfx906
18150 Compile for GCN5 Vega 20 devices (gfx906).
18151
18152 gfx908
18153 Compile for CDNA1 Instinct MI100 series devices (gfx908).
18154
18155 gfx90a
18156 Compile for CDNA2 Instinct MI200 series devices (gfx90a).
18157
18158 -msram-ecc=on
18159 -msram-ecc=off
18160 -msram-ecc=any
18161 Compile binaries suitable for devices with the SRAM-ECC feature
18162 enabled, disabled, or either mode. This feature can be enabled
18163 per-process on some devices. The compiled code must match the
18164 device mode. The default is any, for devices that support it.
18165
18166 -mstack-size=bytes
18167 Specify how many bytes of stack space will be requested for each
18168 GPU thread (wave-front). Beware that there may be many threads and
18169 limited memory available. The size of the stack allocation may
18170 also have an impact on run-time performance. The default is 32KB
18171 when using OpenACC or OpenMP, and 1MB otherwise.
18172
18173 -mxnack
18174 Compile binaries suitable for devices with the XNACK feature
18175 enabled. Some devices always require XNACK and some allow the user
18176 to configure XNACK. The compiled code must match the device mode.
18177 The default is -mno-xnack. At present this option is a placeholder
18178 for support that is not yet implemented.
18179
18180 ARC Options
18181
18182 The following options control the architecture variant for which code
18183 is being compiled:
18184
18185 -mbarrel-shifter
18186 Generate instructions supported by barrel shifter. This is the
18187 default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
18188
18189 -mjli-always
18190 Force to call a function using jli_s instruction. This option is
18191 valid only for ARCv2 architecture.
18192
18193 -mcpu=cpu
18194 Set architecture type, register usage, and instruction scheduling
18195 parameters for cpu. There are also shortcut alias options
18196 available for backward compatibility and convenience. Supported
18197 values for cpu are
18198
18199 arc600
18200 Compile for ARC600. Aliases: -mA6, -mARC600.
18201
18202 arc601
18203 Compile for ARC601. Alias: -mARC601.
18204
18205 arc700
18206 Compile for ARC700. Aliases: -mA7, -mARC700. This is the
18207 default when configured with --with-cpu=arc700.
18208
18209 arcem
18210 Compile for ARC EM.
18211
18212 archs
18213 Compile for ARC HS.
18214
18215 em Compile for ARC EM CPU with no hardware extensions.
18216
18217 em4 Compile for ARC EM4 CPU.
18218
18219 em4_dmips
18220 Compile for ARC EM4 DMIPS CPU.
18221
18222 em4_fpus
18223 Compile for ARC EM4 DMIPS CPU with the single-precision
18224 floating-point extension.
18225
18226 em4_fpuda
18227 Compile for ARC EM4 DMIPS CPU with single-precision floating-
18228 point and double assist instructions.
18229
18230 hs Compile for ARC HS CPU with no hardware extensions except the
18231 atomic instructions.
18232
18233 hs34
18234 Compile for ARC HS34 CPU.
18235
18236 hs38
18237 Compile for ARC HS38 CPU.
18238
18239 hs38_linux
18240 Compile for ARC HS38 CPU with all hardware extensions on.
18241
18242 hs4x
18243 Compile for ARC HS4x CPU.
18244
18245 hs4xd
18246 Compile for ARC HS4xD CPU.
18247
18248 hs4x_rel31
18249 Compile for ARC HS4x CPU release 3.10a.
18250
18251 arc600_norm
18252 Compile for ARC 600 CPU with "norm" instructions enabled.
18253
18254 arc600_mul32x16
18255 Compile for ARC 600 CPU with "norm" and 32x16-bit multiply
18256 instructions enabled.
18257
18258 arc600_mul64
18259 Compile for ARC 600 CPU with "norm" and "mul64"-family
18260 instructions enabled.
18261
18262 arc601_norm
18263 Compile for ARC 601 CPU with "norm" instructions enabled.
18264
18265 arc601_mul32x16
18266 Compile for ARC 601 CPU with "norm" and 32x16-bit multiply
18267 instructions enabled.
18268
18269 arc601_mul64
18270 Compile for ARC 601 CPU with "norm" and "mul64"-family
18271 instructions enabled.
18272
18273 nps400
18274 Compile for ARC 700 on NPS400 chip.
18275
18276 em_mini
18277 Compile for ARC EM minimalist configuration featuring reduced
18278 register set.
18279
18280 -mdpfp
18281 -mdpfp-compact
18282 Generate double-precision FPX instructions, tuned for the compact
18283 implementation.
18284
18285 -mdpfp-fast
18286 Generate double-precision FPX instructions, tuned for the fast
18287 implementation.
18288
18289 -mno-dpfp-lrsr
18290 Disable "lr" and "sr" instructions from using FPX extension aux
18291 registers.
18292
18293 -mea
18294 Generate extended arithmetic instructions. Currently only "divaw",
18295 "adds", "subs", and "sat16" are supported. Only valid for
18296 -mcpu=ARC700.
18297
18298 -mno-mpy
18299 Do not generate "mpy"-family instructions for ARC700. This option
18300 is deprecated.
18301
18302 -mmul32x16
18303 Generate 32x16-bit multiply and multiply-accumulate instructions.
18304
18305 -mmul64
18306 Generate "mul64" and "mulu64" instructions. Only valid for
18307 -mcpu=ARC600.
18308
18309 -mnorm
18310 Generate "norm" instructions. This is the default if -mcpu=ARC700
18311 is in effect.
18312
18313 -mspfp
18314 -mspfp-compact
18315 Generate single-precision FPX instructions, tuned for the compact
18316 implementation.
18317
18318 -mspfp-fast
18319 Generate single-precision FPX instructions, tuned for the fast
18320 implementation.
18321
18322 -msimd
18323 Enable generation of ARC SIMD instructions via target-specific
18324 builtins. Only valid for -mcpu=ARC700.
18325
18326 -msoft-float
18327 This option ignored; it is provided for compatibility purposes
18328 only. Software floating-point code is emitted by default, and this
18329 default can overridden by FPX options; -mspfp, -mspfp-compact, or
18330 -mspfp-fast for single precision, and -mdpfp, -mdpfp-compact, or
18331 -mdpfp-fast for double precision.
18332
18333 -mswap
18334 Generate "swap" instructions.
18335
18336 -matomic
18337 This enables use of the locked load/store conditional extension to
18338 implement atomic memory built-in functions. Not available for ARC
18339 6xx or ARC EM cores.
18340
18341 -mdiv-rem
18342 Enable "div" and "rem" instructions for ARCv2 cores.
18343
18344 -mcode-density
18345 Enable code density instructions for ARC EM. This option is on by
18346 default for ARC HS.
18347
18348 -mll64
18349 Enable double load/store operations for ARC HS cores.
18350
18351 -mtp-regno=regno
18352 Specify thread pointer register number.
18353
18354 -mmpy-option=multo
18355 Compile ARCv2 code with a multiplier design option. You can
18356 specify the option using either a string or numeric value for
18357 multo. wlh1 is the default value. The recognized values are:
18358
18359 0
18360 none
18361 No multiplier available.
18362
18363 1
18364 w 16x16 multiplier, fully pipelined. The following instructions
18365 are enabled: "mpyw" and "mpyuw".
18366
18367 2
18368 wlh1
18369 32x32 multiplier, fully pipelined (1 stage). The following
18370 instructions are additionally enabled: "mpy", "mpyu", "mpym",
18371 "mpymu", and "mpy_s".
18372
18373 3
18374 wlh2
18375 32x32 multiplier, fully pipelined (2 stages). The following
18376 instructions are additionally enabled: "mpy", "mpyu", "mpym",
18377 "mpymu", and "mpy_s".
18378
18379 4
18380 wlh3
18381 Two 16x16 multipliers, blocking, sequential. The following
18382 instructions are additionally enabled: "mpy", "mpyu", "mpym",
18383 "mpymu", and "mpy_s".
18384
18385 5
18386 wlh4
18387 One 16x16 multiplier, blocking, sequential. The following
18388 instructions are additionally enabled: "mpy", "mpyu", "mpym",
18389 "mpymu", and "mpy_s".
18390
18391 6
18392 wlh5
18393 One 32x4 multiplier, blocking, sequential. The following
18394 instructions are additionally enabled: "mpy", "mpyu", "mpym",
18395 "mpymu", and "mpy_s".
18396
18397 7
18398 plus_dmpy
18399 ARC HS SIMD support.
18400
18401 8
18402 plus_macd
18403 ARC HS SIMD support.
18404
18405 9
18406 plus_qmacw
18407 ARC HS SIMD support.
18408
18409 This option is only available for ARCv2 cores.
18410
18411 -mfpu=fpu
18412 Enables support for specific floating-point hardware extensions for
18413 ARCv2 cores. Supported values for fpu are:
18414
18415 fpus
18416 Enables support for single-precision floating-point hardware
18417 extensions.
18418
18419 fpud
18420 Enables support for double-precision floating-point hardware
18421 extensions. The single-precision floating-point extension is
18422 also enabled. Not available for ARC EM.
18423
18424 fpuda
18425 Enables support for double-precision floating-point hardware
18426 extensions using double-precision assist instructions. The
18427 single-precision floating-point extension is also enabled.
18428 This option is only available for ARC EM.
18429
18430 fpuda_div
18431 Enables support for double-precision floating-point hardware
18432 extensions using double-precision assist instructions. The
18433 single-precision floating-point, square-root, and divide
18434 extensions are also enabled. This option is only available for
18435 ARC EM.
18436
18437 fpuda_fma
18438 Enables support for double-precision floating-point hardware
18439 extensions using double-precision assist instructions. The
18440 single-precision floating-point and fused multiply and add
18441 hardware extensions are also enabled. This option is only
18442 available for ARC EM.
18443
18444 fpuda_all
18445 Enables support for double-precision floating-point hardware
18446 extensions using double-precision assist instructions. All
18447 single-precision floating-point hardware extensions are also
18448 enabled. This option is only available for ARC EM.
18449
18450 fpus_div
18451 Enables support for single-precision floating-point, square-
18452 root and divide hardware extensions.
18453
18454 fpud_div
18455 Enables support for double-precision floating-point, square-
18456 root and divide hardware extensions. This option includes
18457 option fpus_div. Not available for ARC EM.
18458
18459 fpus_fma
18460 Enables support for single-precision floating-point and fused
18461 multiply and add hardware extensions.
18462
18463 fpud_fma
18464 Enables support for double-precision floating-point and fused
18465 multiply and add hardware extensions. This option includes
18466 option fpus_fma. Not available for ARC EM.
18467
18468 fpus_all
18469 Enables support for all single-precision floating-point
18470 hardware extensions.
18471
18472 fpud_all
18473 Enables support for all single- and double-precision floating-
18474 point hardware extensions. Not available for ARC EM.
18475
18476 -mirq-ctrl-saved=register-range, blink, lp_count
18477 Specifies general-purposes registers that the processor
18478 automatically saves/restores on interrupt entry and exit.
18479 register-range is specified as two registers separated by a dash.
18480 The register range always starts with "r0", the upper limit is "fp"
18481 register. blink and lp_count are optional. This option is only
18482 valid for ARC EM and ARC HS cores.
18483
18484 -mrgf-banked-regs=number
18485 Specifies the number of registers replicated in second register
18486 bank on entry to fast interrupt. Fast interrupts are interrupts
18487 with the highest priority level P0. These interrupts save only PC
18488 and STATUS32 registers to avoid memory transactions during
18489 interrupt entry and exit sequences. Use this option when you are
18490 using fast interrupts in an ARC V2 family processor. Permitted
18491 values are 4, 8, 16, and 32.
18492
18493 -mlpc-width=width
18494 Specify the width of the "lp_count" register. Valid values for
18495 width are 8, 16, 20, 24, 28 and 32 bits. The default width is
18496 fixed to 32 bits. If the width is less than 32, the compiler does
18497 not attempt to transform loops in your program to use the zero-
18498 delay loop mechanism unless it is known that the "lp_count"
18499 register can hold the required loop-counter value. Depending on
18500 the width specified, the compiler and run-time library might
18501 continue to use the loop mechanism for various needs. This option
18502 defines macro "__ARC_LPC_WIDTH__" with the value of width.
18503
18504 -mrf16
18505 This option instructs the compiler to generate code for a 16-entry
18506 register file. This option defines the "__ARC_RF16__" preprocessor
18507 macro.
18508
18509 -mbranch-index
18510 Enable use of "bi" or "bih" instructions to implement jump tables.
18511
18512 The following options are passed through to the assembler, and also
18513 define preprocessor macro symbols.
18514
18515 -mdsp-packa
18516 Passed down to the assembler to enable the DSP Pack A extensions.
18517 Also sets the preprocessor symbol "__Xdsp_packa". This option is
18518 deprecated.
18519
18520 -mdvbf
18521 Passed down to the assembler to enable the dual Viterbi butterfly
18522 extension. Also sets the preprocessor symbol "__Xdvbf". This
18523 option is deprecated.
18524
18525 -mlock
18526 Passed down to the assembler to enable the locked load/store
18527 conditional extension. Also sets the preprocessor symbol
18528 "__Xlock".
18529
18530 -mmac-d16
18531 Passed down to the assembler. Also sets the preprocessor symbol
18532 "__Xxmac_d16". This option is deprecated.
18533
18534 -mmac-24
18535 Passed down to the assembler. Also sets the preprocessor symbol
18536 "__Xxmac_24". This option is deprecated.
18537
18538 -mrtsc
18539 Passed down to the assembler to enable the 64-bit time-stamp
18540 counter extension instruction. Also sets the preprocessor symbol
18541 "__Xrtsc". This option is deprecated.
18542
18543 -mswape
18544 Passed down to the assembler to enable the swap byte ordering
18545 extension instruction. Also sets the preprocessor symbol
18546 "__Xswape".
18547
18548 -mtelephony
18549 Passed down to the assembler to enable dual- and single-operand
18550 instructions for telephony. Also sets the preprocessor symbol
18551 "__Xtelephony". This option is deprecated.
18552
18553 -mxy
18554 Passed down to the assembler to enable the XY memory extension.
18555 Also sets the preprocessor symbol "__Xxy".
18556
18557 The following options control how the assembly code is annotated:
18558
18559 -misize
18560 Annotate assembler instructions with estimated addresses.
18561
18562 -mannotate-align
18563 Explain what alignment considerations lead to the decision to make
18564 an instruction short or long.
18565
18566 The following options are passed through to the linker:
18567
18568 -marclinux
18569 Passed through to the linker, to specify use of the "arclinux"
18570 emulation. This option is enabled by default in tool chains built
18571 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
18572 profiling is not requested.
18573
18574 -marclinux_prof
18575 Passed through to the linker, to specify use of the "arclinux_prof"
18576 emulation. This option is enabled by default in tool chains built
18577 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
18578 profiling is requested.
18579
18580 The following options control the semantics of generated code:
18581
18582 -mlong-calls
18583 Generate calls as register indirect calls, thus providing access to
18584 the full 32-bit address range.
18585
18586 -mmedium-calls
18587 Don't use less than 25-bit addressing range for calls, which is the
18588 offset available for an unconditional branch-and-link instruction.
18589 Conditional execution of function calls is suppressed, to allow use
18590 of the 25-bit range, rather than the 21-bit range with conditional
18591 branch-and-link. This is the default for tool chains built for
18592 "arc-linux-uclibc" and "arceb-linux-uclibc" targets.
18593
18594 -G num
18595 Put definitions of externally-visible data in a small data section
18596 if that data is no bigger than num bytes. The default value of num
18597 is 4 for any ARC configuration, or 8 when we have double load/store
18598 operations.
18599
18600 -mno-sdata
18601 Do not generate sdata references. This is the default for tool
18602 chains built for "arc-linux-uclibc" and "arceb-linux-uclibc"
18603 targets.
18604
18605 -mvolatile-cache
18606 Use ordinarily cached memory accesses for volatile references.
18607 This is the default.
18608
18609 -mno-volatile-cache
18610 Enable cache bypass for volatile references.
18611
18612 The following options fine tune code generation:
18613
18614 -malign-call
18615 Does nothing. Preserved for backward compatibility.
18616
18617 -mauto-modify-reg
18618 Enable the use of pre/post modify with register displacement.
18619
18620 -mbbit-peephole
18621 Enable bbit peephole2.
18622
18623 -mno-brcc
18624 This option disables a target-specific pass in arc_reorg to
18625 generate compare-and-branch ("brcc") instructions. It has no
18626 effect on generation of these instructions driven by the combiner
18627 pass.
18628
18629 -mcase-vector-pcrel
18630 Use PC-relative switch case tables to enable case table shortening.
18631 This is the default for -Os.
18632
18633 -mcompact-casesi
18634 Enable compact "casesi" pattern. This is the default for -Os, and
18635 only available for ARCv1 cores. This option is deprecated.
18636
18637 -mno-cond-exec
18638 Disable the ARCompact-specific pass to generate conditional
18639 execution instructions.
18640
18641 Due to delay slot scheduling and interactions between operand
18642 numbers, literal sizes, instruction lengths, and the support for
18643 conditional execution, the target-independent pass to generate
18644 conditional execution is often lacking, so the ARC port has kept a
18645 special pass around that tries to find more conditional execution
18646 generation opportunities after register allocation, branch
18647 shortening, and delay slot scheduling have been done. This pass
18648 generally, but not always, improves performance and code size, at
18649 the cost of extra compilation time, which is why there is an option
18650 to switch it off. If you have a problem with call instructions
18651 exceeding their allowable offset range because they are
18652 conditionalized, you should consider using -mmedium-calls instead.
18653
18654 -mearly-cbranchsi
18655 Enable pre-reload use of the "cbranchsi" pattern.
18656
18657 -mexpand-adddi
18658 Expand "adddi3" and "subdi3" at RTL generation time into "add.f",
18659 "adc" etc. This option is deprecated.
18660
18661 -mindexed-loads
18662 Enable the use of indexed loads. This can be problematic because
18663 some optimizers then assume that indexed stores exist, which is not
18664 the case.
18665
18666 -mlra
18667 Enable Local Register Allocation. This is still experimental for
18668 ARC, so by default the compiler uses standard reload (i.e.
18669 -mno-lra).
18670
18671 -mlra-priority-none
18672 Don't indicate any priority for target registers.
18673
18674 -mlra-priority-compact
18675 Indicate target register priority for r0..r3 / r12..r15.
18676
18677 -mlra-priority-noncompact
18678 Reduce target register priority for r0..r3 / r12..r15.
18679
18680 -mmillicode
18681 When optimizing for size (using -Os), prologues and epilogues that
18682 have to save or restore a large number of registers are often
18683 shortened by using call to a special function in libgcc; this is
18684 referred to as a millicode call. As these calls can pose
18685 performance issues, and/or cause linking issues when linking in a
18686 nonstandard way, this option is provided to turn on or off
18687 millicode call generation.
18688
18689 -mcode-density-frame
18690 This option enable the compiler to emit "enter" and "leave"
18691 instructions. These instructions are only valid for CPUs with
18692 code-density feature.
18693
18694 -mmixed-code
18695 Does nothing. Preserved for backward compatibility.
18696
18697 -mq-class
18698 Ths option is deprecated. Enable q instruction alternatives. This
18699 is the default for -Os.
18700
18701 -mRcq
18702 Does nothing. Preserved for backward compatibility.
18703
18704 -mRcw
18705 Does nothing. Preserved for backward compatibility.
18706
18707 -msize-level=level
18708 Fine-tune size optimization with regards to instruction lengths and
18709 alignment. The recognized values for level are:
18710
18711 0 No size optimization. This level is deprecated and treated
18712 like 1.
18713
18714 1 Short instructions are used opportunistically.
18715
18716 2 In addition, alignment of loops and of code after barriers are
18717 dropped.
18718
18719 3 In addition, optional data alignment is dropped, and the option
18720 Os is enabled.
18721
18722 This defaults to 3 when -Os is in effect. Otherwise, the behavior
18723 when this is not set is equivalent to level 1.
18724
18725 -mtune=cpu
18726 Set instruction scheduling parameters for cpu, overriding any
18727 implied by -mcpu=.
18728
18729 Supported values for cpu are
18730
18731 ARC600
18732 Tune for ARC600 CPU.
18733
18734 ARC601
18735 Tune for ARC601 CPU.
18736
18737 ARC700
18738 Tune for ARC700 CPU with standard multiplier block.
18739
18740 ARC700-xmac
18741 Tune for ARC700 CPU with XMAC block.
18742
18743 ARC725D
18744 Tune for ARC725D CPU.
18745
18746 ARC750D
18747 Tune for ARC750D CPU.
18748
18749 core3
18750 Tune for ARCv2 core3 type CPU. This option enable usage of
18751 "dbnz" instruction.
18752
18753 release31a
18754 Tune for ARC4x release 3.10a.
18755
18756 -mmultcost=num
18757 Cost to assume for a multiply instruction, with 4 being equal to a
18758 normal instruction.
18759
18760 -munalign-prob-threshold=probability
18761 Does nothing. Preserved for backward compatibility.
18762
18763 The following options are maintained for backward compatibility, but
18764 are now deprecated and will be removed in a future release:
18765
18766 -margonaut
18767 Obsolete FPX.
18768
18769 -mbig-endian
18770 -EB Compile code for big-endian targets. Use of these options is now
18771 deprecated. Big-endian code is supported by configuring GCC to
18772 build "arceb-elf32" and "arceb-linux-uclibc" targets, for which big
18773 endian is the default.
18774
18775 -mlittle-endian
18776 -EL Compile code for little-endian targets. Use of these options is
18777 now deprecated. Little-endian code is supported by configuring GCC
18778 to build "arc-elf32" and "arc-linux-uclibc" targets, for which
18779 little endian is the default.
18780
18781 -mbarrel_shifter
18782 Replaced by -mbarrel-shifter.
18783
18784 -mdpfp_compact
18785 Replaced by -mdpfp-compact.
18786
18787 -mdpfp_fast
18788 Replaced by -mdpfp-fast.
18789
18790 -mdsp_packa
18791 Replaced by -mdsp-packa.
18792
18793 -mEA
18794 Replaced by -mea.
18795
18796 -mmac_24
18797 Replaced by -mmac-24.
18798
18799 -mmac_d16
18800 Replaced by -mmac-d16.
18801
18802 -mspfp_compact
18803 Replaced by -mspfp-compact.
18804
18805 -mspfp_fast
18806 Replaced by -mspfp-fast.
18807
18808 -mtune=cpu
18809 Values arc600, arc601, arc700 and arc700-xmac for cpu are replaced
18810 by ARC600, ARC601, ARC700 and ARC700-xmac respectively.
18811
18812 -multcost=num
18813 Replaced by -mmultcost.
18814
18815 ARM Options
18816
18817 These -m options are defined for the ARM port:
18818
18819 -mabi=name
18820 Generate code for the specified ABI. Permissible values are: apcs-
18821 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
18822
18823 -mapcs-frame
18824 Generate a stack frame that is compliant with the ARM Procedure
18825 Call Standard for all functions, even if this is not strictly
18826 necessary for correct execution of the code. Specifying
18827 -fomit-frame-pointer with this option causes the stack frames not
18828 to be generated for leaf functions. The default is
18829 -mno-apcs-frame. This option is deprecated.
18830
18831 -mapcs
18832 This is a synonym for -mapcs-frame and is deprecated.
18833
18834 -mthumb-interwork
18835 Generate code that supports calling between the ARM and Thumb
18836 instruction sets. Without this option, on pre-v5 architectures,
18837 the two instruction sets cannot be reliably used inside one
18838 program. The default is -mno-thumb-interwork, since slightly
18839 larger code is generated when -mthumb-interwork is specified. In
18840 AAPCS configurations this option is meaningless.
18841
18842 -mno-sched-prolog
18843 Prevent the reordering of instructions in the function prologue, or
18844 the merging of those instruction with the instructions in the
18845 function's body. This means that all functions start with a
18846 recognizable set of instructions (or in fact one of a choice from a
18847 small set of different function prologues), and this information
18848 can be used to locate the start of functions inside an executable
18849 piece of code. The default is -msched-prolog.
18850
18851 -mfloat-abi=name
18852 Specifies which floating-point ABI to use. Permissible values are:
18853 soft, softfp and hard.
18854
18855 Specifying soft causes GCC to generate output containing library
18856 calls for floating-point operations. softfp allows the generation
18857 of code using hardware floating-point instructions, but still uses
18858 the soft-float calling conventions. hard allows generation of
18859 floating-point instructions and uses FPU-specific calling
18860 conventions.
18861
18862 The default depends on the specific target configuration. Note
18863 that the hard-float and soft-float ABIs are not link-compatible;
18864 you must compile your entire program with the same ABI, and link
18865 with a compatible set of libraries.
18866
18867 -mgeneral-regs-only
18868 Generate code which uses only the general-purpose registers. This
18869 will prevent the compiler from using floating-point and Advanced
18870 SIMD registers but will not impose any restrictions on the
18871 assembler.
18872
18873 -mlittle-endian
18874 Generate code for a processor running in little-endian mode. This
18875 is the default for all standard configurations.
18876
18877 -mbig-endian
18878 Generate code for a processor running in big-endian mode; the
18879 default is to compile code for a little-endian processor.
18880
18881 -mbe8
18882 -mbe32
18883 When linking a big-endian image select between BE8 and BE32
18884 formats. The option has no effect for little-endian images and is
18885 ignored. The default is dependent on the selected target
18886 architecture. For ARMv6 and later architectures the default is
18887 BE8, for older architectures the default is BE32. BE32 format has
18888 been deprecated by ARM.
18889
18890 -march=name[+extension...]
18891 This specifies the name of the target ARM architecture. GCC uses
18892 this name to determine what kind of instructions it can emit when
18893 generating assembly code. This option can be used in conjunction
18894 with or instead of the -mcpu= option.
18895
18896 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
18897 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
18898 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
18899 armv8.6-a, armv9-a, armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m,
18900 armv7e-m, armv8-m.base, armv8-m.main, armv8.1-m.main, armv9-a,
18901 iwmmxt and iwmmxt2.
18902
18903 Additionally, the following architectures, which lack support for
18904 the Thumb execution state, are recognized but support is
18905 deprecated: armv4.
18906
18907 Many of the architectures support extensions. These can be added
18908 by appending +extension to the architecture name. Extension
18909 options are processed in order and capabilities accumulate. An
18910 extension will also enable any necessary base extensions upon which
18911 it depends. For example, the +crypto extension will always enable
18912 the +simd extension. The exception to the additive construction is
18913 for extensions that are prefixed with +no...: these extensions
18914 disable the specified option and any other extensions that may
18915 depend on the presence of that extension.
18916
18917 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
18918 writing -march=armv7-a+vfpv4 since the +simd option is entirely
18919 disabled by the +nofp option that follows it.
18920
18921 Most extension names are generically named, but have an effect that
18922 is dependent upon the architecture to which it is applied. For
18923 example, the +simd option can be applied to both armv7-a and
18924 armv8-a architectures, but will enable the original ARMv7-A
18925 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
18926 for armv8-a.
18927
18928 The table below lists the supported extensions for each
18929 architecture. Architectures not mentioned do not support any
18930 extensions.
18931
18932 armv5te
18933 armv6
18934 armv6j
18935 armv6k
18936 armv6kz
18937 armv6t2
18938 armv6z
18939 armv6zk
18940 +fp The VFPv2 floating-point instructions. The extension
18941 +vfpv2 can be used as an alias for this extension.
18942
18943 +nofp
18944 Disable the floating-point instructions.
18945
18946 armv7
18947 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
18948 architectures.
18949
18950 +fp The VFPv3 floating-point instructions, with 16 double-
18951 precision registers. The extension +vfpv3-d16 can be used
18952 as an alias for this extension. Note that floating-point
18953 is not supported by the base ARMv7-M architecture, but is
18954 compatible with both the ARMv7-A and ARMv7-R architectures.
18955
18956 +nofp
18957 Disable the floating-point instructions.
18958
18959 armv7-a
18960 +mp The multiprocessing extension.
18961
18962 +sec
18963 The security extension.
18964
18965 +fp The VFPv3 floating-point instructions, with 16 double-
18966 precision registers. The extension +vfpv3-d16 can be used
18967 as an alias for this extension.
18968
18969 +simd
18970 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
18971 instructions. The extensions +neon and +neon-vfpv3 can be
18972 used as aliases for this extension.
18973
18974 +vfpv3
18975 The VFPv3 floating-point instructions, with 32 double-
18976 precision registers.
18977
18978 +vfpv3-d16-fp16
18979 The VFPv3 floating-point instructions, with 16 double-
18980 precision registers and the half-precision floating-point
18981 conversion operations.
18982
18983 +vfpv3-fp16
18984 The VFPv3 floating-point instructions, with 32 double-
18985 precision registers and the half-precision floating-point
18986 conversion operations.
18987
18988 +vfpv4-d16
18989 The VFPv4 floating-point instructions, with 16 double-
18990 precision registers.
18991
18992 +vfpv4
18993 The VFPv4 floating-point instructions, with 32 double-
18994 precision registers.
18995
18996 +neon-fp16
18997 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
18998 instructions, with the half-precision floating-point
18999 conversion operations.
19000
19001 +neon-vfpv4
19002 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
19003 instructions.
19004
19005 +nosimd
19006 Disable the Advanced SIMD instructions (does not disable
19007 floating point).
19008
19009 +nofp
19010 Disable the floating-point and Advanced SIMD instructions.
19011
19012 armv7ve
19013 The extended version of the ARMv7-A architecture with support
19014 for virtualization.
19015
19016 +fp The VFPv4 floating-point instructions, with 16 double-
19017 precision registers. The extension +vfpv4-d16 can be used
19018 as an alias for this extension.
19019
19020 +simd
19021 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
19022 instructions. The extension +neon-vfpv4 can be used as an
19023 alias for this extension.
19024
19025 +vfpv3-d16
19026 The VFPv3 floating-point instructions, with 16 double-
19027 precision registers.
19028
19029 +vfpv3
19030 The VFPv3 floating-point instructions, with 32 double-
19031 precision registers.
19032
19033 +vfpv3-d16-fp16
19034 The VFPv3 floating-point instructions, with 16 double-
19035 precision registers and the half-precision floating-point
19036 conversion operations.
19037
19038 +vfpv3-fp16
19039 The VFPv3 floating-point instructions, with 32 double-
19040 precision registers and the half-precision floating-point
19041 conversion operations.
19042
19043 +vfpv4-d16
19044 The VFPv4 floating-point instructions, with 16 double-
19045 precision registers.
19046
19047 +vfpv4
19048 The VFPv4 floating-point instructions, with 32 double-
19049 precision registers.
19050
19051 +neon
19052 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
19053 instructions. The extension +neon-vfpv3 can be used as an
19054 alias for this extension.
19055
19056 +neon-fp16
19057 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
19058 instructions, with the half-precision floating-point
19059 conversion operations.
19060
19061 +nosimd
19062 Disable the Advanced SIMD instructions (does not disable
19063 floating point).
19064
19065 +nofp
19066 Disable the floating-point and Advanced SIMD instructions.
19067
19068 armv8-a
19069 +crc
19070 The Cyclic Redundancy Check (CRC) instructions.
19071
19072 +simd
19073 The ARMv8-A Advanced SIMD and floating-point instructions.
19074
19075 +crypto
19076 The cryptographic instructions.
19077
19078 +nocrypto
19079 Disable the cryptographic instructions.
19080
19081 +nofp
19082 Disable the floating-point, Advanced SIMD and cryptographic
19083 instructions.
19084
19085 +sb Speculation Barrier Instruction.
19086
19087 +predres
19088 Execution and Data Prediction Restriction Instructions.
19089
19090 armv8.1-a
19091 +simd
19092 The ARMv8.1-A Advanced SIMD and floating-point
19093 instructions.
19094
19095 +crypto
19096 The cryptographic instructions. This also enables the
19097 Advanced SIMD and floating-point instructions.
19098
19099 +nocrypto
19100 Disable the cryptographic instructions.
19101
19102 +nofp
19103 Disable the floating-point, Advanced SIMD and cryptographic
19104 instructions.
19105
19106 +sb Speculation Barrier Instruction.
19107
19108 +predres
19109 Execution and Data Prediction Restriction Instructions.
19110
19111 armv8.2-a
19112 armv8.3-a
19113 +fp16
19114 The half-precision floating-point data processing
19115 instructions. This also enables the Advanced SIMD and
19116 floating-point instructions.
19117
19118 +fp16fml
19119 The half-precision floating-point fmla extension. This
19120 also enables the half-precision floating-point extension
19121 and Advanced SIMD and floating-point instructions.
19122
19123 +simd
19124 The ARMv8.1-A Advanced SIMD and floating-point
19125 instructions.
19126
19127 +crypto
19128 The cryptographic instructions. This also enables the
19129 Advanced SIMD and floating-point instructions.
19130
19131 +dotprod
19132 Enable the Dot Product extension. This also enables
19133 Advanced SIMD instructions.
19134
19135 +nocrypto
19136 Disable the cryptographic extension.
19137
19138 +nofp
19139 Disable the floating-point, Advanced SIMD and cryptographic
19140 instructions.
19141
19142 +sb Speculation Barrier Instruction.
19143
19144 +predres
19145 Execution and Data Prediction Restriction Instructions.
19146
19147 +i8mm
19148 8-bit Integer Matrix Multiply instructions. This also
19149 enables Advanced SIMD and floating-point instructions.
19150
19151 +bf16
19152 Brain half-precision floating-point instructions. This
19153 also enables Advanced SIMD and floating-point instructions.
19154
19155 armv8.4-a
19156 +fp16
19157 The half-precision floating-point data processing
19158 instructions. This also enables the Advanced SIMD and
19159 floating-point instructions as well as the Dot Product
19160 extension and the half-precision floating-point fmla
19161 extension.
19162
19163 +simd
19164 The ARMv8.3-A Advanced SIMD and floating-point instructions
19165 as well as the Dot Product extension.
19166
19167 +crypto
19168 The cryptographic instructions. This also enables the
19169 Advanced SIMD and floating-point instructions as well as
19170 the Dot Product extension.
19171
19172 +nocrypto
19173 Disable the cryptographic extension.
19174
19175 +nofp
19176 Disable the floating-point, Advanced SIMD and cryptographic
19177 instructions.
19178
19179 +sb Speculation Barrier Instruction.
19180
19181 +predres
19182 Execution and Data Prediction Restriction Instructions.
19183
19184 +i8mm
19185 8-bit Integer Matrix Multiply instructions. This also
19186 enables Advanced SIMD and floating-point instructions.
19187
19188 +bf16
19189 Brain half-precision floating-point instructions. This
19190 also enables Advanced SIMD and floating-point instructions.
19191
19192 armv8.5-a
19193 +fp16
19194 The half-precision floating-point data processing
19195 instructions. This also enables the Advanced SIMD and
19196 floating-point instructions as well as the Dot Product
19197 extension and the half-precision floating-point fmla
19198 extension.
19199
19200 +simd
19201 The ARMv8.3-A Advanced SIMD and floating-point instructions
19202 as well as the Dot Product extension.
19203
19204 +crypto
19205 The cryptographic instructions. This also enables the
19206 Advanced SIMD and floating-point instructions as well as
19207 the Dot Product extension.
19208
19209 +nocrypto
19210 Disable the cryptographic extension.
19211
19212 +nofp
19213 Disable the floating-point, Advanced SIMD and cryptographic
19214 instructions.
19215
19216 +i8mm
19217 8-bit Integer Matrix Multiply instructions. This also
19218 enables Advanced SIMD and floating-point instructions.
19219
19220 +bf16
19221 Brain half-precision floating-point instructions. This
19222 also enables Advanced SIMD and floating-point instructions.
19223
19224 armv8.6-a
19225 +fp16
19226 The half-precision floating-point data processing
19227 instructions. This also enables the Advanced SIMD and
19228 floating-point instructions as well as the Dot Product
19229 extension and the half-precision floating-point fmla
19230 extension.
19231
19232 +simd
19233 The ARMv8.3-A Advanced SIMD and floating-point instructions
19234 as well as the Dot Product extension.
19235
19236 +crypto
19237 The cryptographic instructions. This also enables the
19238 Advanced SIMD and floating-point instructions as well as
19239 the Dot Product extension.
19240
19241 +nocrypto
19242 Disable the cryptographic extension.
19243
19244 +nofp
19245 Disable the floating-point, Advanced SIMD and cryptographic
19246 instructions.
19247
19248 +i8mm
19249 8-bit Integer Matrix Multiply instructions. This also
19250 enables Advanced SIMD and floating-point instructions.
19251
19252 +bf16
19253 Brain half-precision floating-point instructions. This
19254 also enables Advanced SIMD and floating-point instructions.
19255
19256 armv7-r
19257 +fp.sp
19258 The single-precision VFPv3 floating-point instructions.
19259 The extension +vfpv3xd can be used as an alias for this
19260 extension.
19261
19262 +fp The VFPv3 floating-point instructions with 16 double-
19263 precision registers. The extension +vfpv3-d16 can be used
19264 as an alias for this extension.
19265
19266 +vfpv3xd-d16-fp16
19267 The single-precision VFPv3 floating-point instructions with
19268 16 double-precision registers and the half-precision
19269 floating-point conversion operations.
19270
19271 +vfpv3-d16-fp16
19272 The VFPv3 floating-point instructions with 16 double-
19273 precision registers and the half-precision floating-point
19274 conversion operations.
19275
19276 +nofp
19277 Disable the floating-point extension.
19278
19279 +idiv
19280 The ARM-state integer division instructions.
19281
19282 +noidiv
19283 Disable the ARM-state integer division extension.
19284
19285 armv7e-m
19286 +fp The single-precision VFPv4 floating-point instructions.
19287
19288 +fpv5
19289 The single-precision FPv5 floating-point instructions.
19290
19291 +fp.dp
19292 The single- and double-precision FPv5 floating-point
19293 instructions.
19294
19295 +nofp
19296 Disable the floating-point extensions.
19297
19298 armv8.1-m.main
19299 +dsp
19300 The DSP instructions.
19301
19302 +mve
19303 The M-Profile Vector Extension (MVE) integer instructions.
19304
19305 +mve.fp
19306 The M-Profile Vector Extension (MVE) integer and single
19307 precision floating-point instructions.
19308
19309 +fp The single-precision floating-point instructions.
19310
19311 +fp.dp
19312 The single- and double-precision floating-point
19313 instructions.
19314
19315 +nofp
19316 Disable the floating-point extension.
19317
19318 +cdecp0, +cdecp1, ... , +cdecp7
19319 Enable the Custom Datapath Extension (CDE) on selected
19320 coprocessors according to the numbers given in the options
19321 in the range 0 to 7.
19322
19323 +pacbti
19324 Enable the Pointer Authentication and Branch Target
19325 Identification Extension.
19326
19327 armv8-m.main
19328 +dsp
19329 The DSP instructions.
19330
19331 +nodsp
19332 Disable the DSP extension.
19333
19334 +fp The single-precision floating-point instructions.
19335
19336 +fp.dp
19337 The single- and double-precision floating-point
19338 instructions.
19339
19340 +nofp
19341 Disable the floating-point extension.
19342
19343 +cdecp0, +cdecp1, ... , +cdecp7
19344 Enable the Custom Datapath Extension (CDE) on selected
19345 coprocessors according to the numbers given in the options
19346 in the range 0 to 7.
19347
19348 armv8-r
19349 +crc
19350 The Cyclic Redundancy Check (CRC) instructions.
19351
19352 +fp.sp
19353 The single-precision FPv5 floating-point instructions.
19354
19355 +simd
19356 The ARMv8-A Advanced SIMD and floating-point instructions.
19357
19358 +crypto
19359 The cryptographic instructions.
19360
19361 +nocrypto
19362 Disable the cryptographic instructions.
19363
19364 +nofp
19365 Disable the floating-point, Advanced SIMD and cryptographic
19366 instructions.
19367
19368 -march=native causes the compiler to auto-detect the architecture
19369 of the build computer. At present, this feature is only supported
19370 on GNU/Linux, and not all architectures are recognized. If the
19371 auto-detect is unsuccessful the option has no effect.
19372
19373 -mtune=name
19374 This option specifies the name of the target ARM processor for
19375 which GCC should tune the performance of the code. For some ARM
19376 implementations better performance can be obtained by using this
19377 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
19378 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
19379 strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t, arm922t,
19380 arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t, arm9tdmi,
19381 arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e, arm1022e,
19382 arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp, arm1156t2-s,
19383 arm1156t2f-s, arm1176jz-s, arm1176jzf-s, generic-armv7-a,
19384 cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
19385 cortex-a17, cortex-a32, cortex-a35, cortex-a53, cortex-a55,
19386 cortex-a57, cortex-a72, cortex-a73, cortex-a75, cortex-a76,
19387 cortex-a76ae, cortex-a77, cortex-a78, cortex-a78ae, cortex-a78c,
19388 cortex-a710, ares, cortex-r4, cortex-r4f, cortex-r5, cortex-r7,
19389 cortex-r8, cortex-r52, cortex-r52plus, cortex-m0, cortex-m0plus,
19390 cortex-m1, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33,
19391 cortex-m35p, cortex-m55, cortex-m85, cortex-x1, cortex-x1c,
19392 cortex-m1.small-multiply, cortex-m0.small-multiply,
19393 cortex-m0plus.small-multiply, exynos-m1, marvell-pj4, neoverse-n1,
19394 neoverse-n2, neoverse-v1, xscale, iwmmxt, iwmmxt2, ep9312, fa526,
19395 fa626, fa606te, fa626te, fmp626, fa726te, star-mc1, xgene1.
19396
19397 Additionally, this option can specify that GCC should tune the
19398 performance of the code for a big.LITTLE system. Permissible names
19399 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
19400 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
19401 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
19402 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
19403
19404 -mtune=generic-arch specifies that GCC should tune the performance
19405 for a blend of processors within architecture arch. The aim is to
19406 generate code that run well on the current most popular processors,
19407 balancing between optimizations that benefit some CPUs in the
19408 range, and avoiding performance pitfalls of other CPUs. The
19409 effects of this option may change in future GCC versions as CPU
19410 models come and go.
19411
19412 -mtune permits the same extension options as -mcpu, but the
19413 extension options do not affect the tuning of the generated code.
19414
19415 -mtune=native causes the compiler to auto-detect the CPU of the
19416 build computer. At present, this feature is only supported on
19417 GNU/Linux, and not all architectures are recognized. If the auto-
19418 detect is unsuccessful the option has no effect.
19419
19420 -mcpu=name[+extension...]
19421 This specifies the name of the target ARM processor. GCC uses this
19422 name to derive the name of the target ARM architecture (as if
19423 specified by -march) and the ARM processor type for which to tune
19424 for performance (as if specified by -mtune). Where this option is
19425 used in conjunction with -march or -mtune, those options take
19426 precedence over the appropriate part of this option.
19427
19428 Many of the supported CPUs implement optional architectural
19429 extensions. Where this is so the architectural extensions are
19430 normally enabled by default. If implementations that lack the
19431 extension exist, then the extension syntax can be used to disable
19432 those extensions that have been omitted. For floating-point and
19433 Advanced SIMD (Neon) instructions, the settings of the options
19434 -mfloat-abi and -mfpu must also be considered: floating-point and
19435 Advanced SIMD instructions will only be used if -mfloat-abi is not
19436 set to soft; and any setting of -mfpu other than auto will override
19437 the available floating-point and SIMD extension instructions.
19438
19439 For example, cortex-a9 can be found in three major configurations:
19440 integer only, with just a floating-point unit or with floating-
19441 point and Advanced SIMD. The default is to enable all the
19442 instructions, but the extensions +nosimd and +nofp can be used to
19443 disable just the SIMD or both the SIMD and floating-point
19444 instructions respectively.
19445
19446 Permissible names for this option are the same as those for -mtune.
19447
19448 The following extension options are common to the listed CPUs:
19449
19450 +nodsp
19451 Disable the DSP instructions on cortex-m33, cortex-m35p,
19452 cortex-m55 and cortex-m85. Also disable the M-Profile Vector
19453 Extension (MVE) integer and single precision floating-point
19454 instructions on cortex-m55 and cortex-m85.
19455
19456 +nopacbti
19457 Disable the Pointer Authentication and Branch Target
19458 Identification Extension on cortex-m85.
19459
19460 +nomve
19461 Disable the M-Profile Vector Extension (MVE) integer and single
19462 precision floating-point instructions on cortex-m55 and
19463 cortex-m85.
19464
19465 +nomve.fp
19466 Disable the M-Profile Vector Extension (MVE) single precision
19467 floating-point instructions on cortex-m55 and cortex-m85.
19468
19469 +cdecp0, +cdecp1, ... , +cdecp7
19470 Enable the Custom Datapath Extension (CDE) on selected
19471 coprocessors according to the numbers given in the options in
19472 the range 0 to 7 on cortex-m55.
19473
19474 +nofp
19475 Disables the floating-point instructions on arm9e, arm946e-s,
19476 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
19477 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
19478 cortex-m7, cortex-m33, cortex-m35p cortex-m4, cortex-m7,
19479 cortex-m33, cortex-m35p, cortex-m55 and cortex-m85. Disables
19480 the floating-point and SIMD instructions on generic-armv7-a,
19481 cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a12,
19482 cortex-a15, cortex-a17, cortex-a15.cortex-a7,
19483 cortex-a17.cortex-a7, cortex-a32, cortex-a35, cortex-a53 and
19484 cortex-a55.
19485
19486 +nofp.dp
19487 Disables the double-precision component of the floating-point
19488 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52,
19489 cortex-r52plus and cortex-m7.
19490
19491 +nosimd
19492 Disables the SIMD (but not floating-point) instructions on
19493 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
19494
19495 +crypto
19496 Enables the cryptographic instructions on cortex-a32,
19497 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
19498 cortex-a73, cortex-a75, exynos-m1, xgene1,
19499 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
19500 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
19501 cortex-a75.cortex-a55.
19502
19503 Additionally the generic-armv7-a pseudo target defaults to VFPv3
19504 with 16 double-precision registers. It supports the following
19505 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
19506 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
19507 neon-vfpv4. The meanings are the same as for the extensions to
19508 -march=armv7-a.
19509
19510 -mcpu=generic-arch is also permissible, and is equivalent to
19511 -march=arch -mtune=generic-arch. See -mtune for more information.
19512
19513 -mcpu=native causes the compiler to auto-detect the CPU of the
19514 build computer. At present, this feature is only supported on
19515 GNU/Linux, and not all architectures are recognized. If the auto-
19516 detect is unsuccessful the option has no effect.
19517
19518 -mfpu=name
19519 This specifies what floating-point hardware (or hardware emulation)
19520 is available on the target. Permissible names are: auto, vfpv2,
19521 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
19522 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
19523 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
19524 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
19525 and vfp is an alias for vfpv2.
19526
19527 The setting auto is the default and is special. It causes the
19528 compiler to select the floating-point and Advanced SIMD
19529 instructions based on the settings of -mcpu and -march.
19530
19531 If the selected floating-point hardware includes the NEON extension
19532 (e.g. -mfpu=neon), note that floating-point operations are not
19533 generated by GCC's auto-vectorization pass unless
19534 -funsafe-math-optimizations is also specified. This is because
19535 NEON hardware does not fully implement the IEEE 754 standard for
19536 floating-point arithmetic (in particular denormal values are
19537 treated as zero), so the use of NEON instructions may lead to a
19538 loss of precision.
19539
19540 You can also set the fpu name at function level by using the
19541 target("fpu=") function attributes or pragmas.
19542
19543 -mfp16-format=name
19544 Specify the format of the "__fp16" half-precision floating-point
19545 type. Permissible names are none, ieee, and alternative; the
19546 default is none, in which case the "__fp16" type is not defined.
19547
19548 -mstructure-size-boundary=n
19549 The sizes of all structures and unions are rounded up to a multiple
19550 of the number of bits set by this option. Permissible values are
19551 8, 32 and 64. The default value varies for different toolchains.
19552 For the COFF targeted toolchain the default value is 8. A value of
19553 64 is only allowed if the underlying ABI supports it.
19554
19555 Specifying a larger number can produce faster, more efficient code,
19556 but can also increase the size of the program. Different values
19557 are potentially incompatible. Code compiled with one value cannot
19558 necessarily expect to work with code or libraries compiled with
19559 another value, if they exchange information using structures or
19560 unions.
19561
19562 This option is deprecated.
19563
19564 -mabort-on-noreturn
19565 Generate a call to the function "abort" at the end of a "noreturn"
19566 function. It is executed if the function tries to return.
19567
19568 -mlong-calls
19569 -mno-long-calls
19570 Tells the compiler to perform function calls by first loading the
19571 address of the function into a register and then performing a
19572 subroutine call on this register. This switch is needed if the
19573 target function lies outside of the 64-megabyte addressing range of
19574 the offset-based version of subroutine call instruction.
19575
19576 Even if this switch is enabled, not all function calls are turned
19577 into long calls. The heuristic is that static functions, functions
19578 that have the "short_call" attribute, functions that are inside the
19579 scope of a "#pragma no_long_calls" directive, and functions whose
19580 definitions have already been compiled within the current
19581 compilation unit are not turned into long calls. The exceptions to
19582 this rule are that weak function definitions, functions with the
19583 "long_call" attribute or the "section" attribute, and functions
19584 that are within the scope of a "#pragma long_calls" directive are
19585 always turned into long calls.
19586
19587 This feature is not enabled by default. Specifying -mno-long-calls
19588 restores the default behavior, as does placing the function calls
19589 within the scope of a "#pragma long_calls_off" directive. Note
19590 these switches have no effect on how the compiler generates code to
19591 handle function calls via function pointers.
19592
19593 -msingle-pic-base
19594 Treat the register used for PIC addressing as read-only, rather
19595 than loading it in the prologue for each function. The runtime
19596 system is responsible for initializing this register with an
19597 appropriate value before execution begins.
19598
19599 -mpic-register=reg
19600 Specify the register to be used for PIC addressing. For standard
19601 PIC base case, the default is any suitable register determined by
19602 compiler. For single PIC base case, the default is R9 if target is
19603 EABI based or stack-checking is enabled, otherwise the default is
19604 R10.
19605
19606 -mpic-data-is-text-relative
19607 Assume that the displacement between the text and data segments is
19608 fixed at static link time. This permits using PC-relative
19609 addressing operations to access data known to be in the data
19610 segment. For non-VxWorks RTP targets, this option is enabled by
19611 default. When disabled on such targets, it will enable
19612 -msingle-pic-base by default.
19613
19614 -mpoke-function-name
19615 Write the name of each function into the text section, directly
19616 preceding the function prologue. The generated code is similar to
19617 this:
19618
19619 t0
19620 .ascii "arm_poke_function_name", 0
19621 .align
19622 t1
19623 .word 0xff000000 + (t1 - t0)
19624 arm_poke_function_name
19625 mov ip, sp
19626 stmfd sp!, {fp, ip, lr, pc}
19627 sub fp, ip, #4
19628
19629 When performing a stack backtrace, code can inspect the value of
19630 "pc" stored at "fp + 0". If the trace function then looks at
19631 location "pc - 12" and the top 8 bits are set, then we know that
19632 there is a function name embedded immediately preceding this
19633 location and has length "((pc[-3]) & 0xff000000)".
19634
19635 -mthumb
19636 -marm
19637 Select between generating code that executes in ARM and Thumb
19638 states. The default for most configurations is to generate code
19639 that executes in ARM state, but the default can be changed by
19640 configuring GCC with the --with-mode=state configure option.
19641
19642 You can also override the ARM and Thumb mode for each function by
19643 using the target("thumb") and target("arm") function attributes or
19644 pragmas.
19645
19646 -mflip-thumb
19647 Switch ARM/Thumb modes on alternating functions. This option is
19648 provided for regression testing of mixed Thumb/ARM code generation,
19649 and is not intended for ordinary use in compiling code.
19650
19651 -mtpcs-frame
19652 Generate a stack frame that is compliant with the Thumb Procedure
19653 Call Standard for all non-leaf functions. (A leaf function is one
19654 that does not call any other functions.) The default is
19655 -mno-tpcs-frame.
19656
19657 -mtpcs-leaf-frame
19658 Generate a stack frame that is compliant with the Thumb Procedure
19659 Call Standard for all leaf functions. (A leaf function is one that
19660 does not call any other functions.) The default is
19661 -mno-apcs-leaf-frame.
19662
19663 -mcallee-super-interworking
19664 Gives all externally visible functions in the file being compiled
19665 an ARM instruction set header which switches to Thumb mode before
19666 executing the rest of the function. This allows these functions to
19667 be called from non-interworking code. This option is not valid in
19668 AAPCS configurations because interworking is enabled by default.
19669
19670 -mcaller-super-interworking
19671 Allows calls via function pointers (including virtual functions) to
19672 execute correctly regardless of whether the target code has been
19673 compiled for interworking or not. There is a small overhead in the
19674 cost of executing a function pointer if this option is enabled.
19675 This option is not valid in AAPCS configurations because
19676 interworking is enabled by default.
19677
19678 -mtp=name
19679 Specify the access model for the thread local storage pointer. The
19680 valid models are soft, which generates calls to "__aeabi_read_tp",
19681 cp15, which fetches the thread pointer from "cp15" directly
19682 (supported in the arm6k architecture), and auto, which uses the
19683 best available method for the selected processor. The default
19684 setting is auto.
19685
19686 -mtls-dialect=dialect
19687 Specify the dialect to use for accessing thread local storage. Two
19688 dialects are supported---gnu and gnu2. The gnu dialect selects the
19689 original GNU scheme for supporting local and global dynamic TLS
19690 models. The gnu2 dialect selects the GNU descriptor scheme, which
19691 provides better performance for shared libraries. The GNU
19692 descriptor scheme is compatible with the original scheme, but does
19693 require new assembler, linker and library support. Initial and
19694 local exec TLS models are unaffected by this option and always use
19695 the original scheme.
19696
19697 -mword-relocations
19698 Only generate absolute relocations on word-sized values (i.e.
19699 R_ARM_ABS32). This is enabled by default on targets (uClinux,
19700 SymbianOS) where the runtime loader imposes this restriction, and
19701 when -fpic or -fPIC is specified. This option conflicts with
19702 -mslow-flash-data.
19703
19704 -mfix-cortex-m3-ldrd
19705 Some Cortex-M3 cores can cause data corruption when "ldrd"
19706 instructions with overlapping destination and base registers are
19707 used. This option avoids generating these instructions. This
19708 option is enabled by default when -mcpu=cortex-m3 is specified.
19709
19710 -mfix-cortex-a57-aes-1742098
19711 -mno-fix-cortex-a57-aes-1742098
19712 -mfix-cortex-a72-aes-1655431
19713 -mno-fix-cortex-a72-aes-1655431
19714 Enable (disable) mitigation for an erratum on Cortex-A57 and
19715 Cortex-A72 that affects the AES cryptographic instructions. This
19716 option is enabled by default when either -mcpu=cortex-a57 or
19717 -mcpu=cortex-a72 is specified.
19718
19719 -munaligned-access
19720 -mno-unaligned-access
19721 Enables (or disables) reading and writing of 16- and 32- bit values
19722 from addresses that are not 16- or 32- bit aligned. By default
19723 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
19724 ARMv8-M Baseline architectures, and enabled for all other
19725 architectures. If unaligned access is not enabled then words in
19726 packed data structures are accessed a byte at a time.
19727
19728 The ARM attribute "Tag_CPU_unaligned_access" is set in the
19729 generated object file to either true or false, depending upon the
19730 setting of this option. If unaligned access is enabled then the
19731 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
19732
19733 -mneon-for-64bits
19734 This option is deprecated and has no effect.
19735
19736 -mslow-flash-data
19737 Assume loading data from flash is slower than fetching instruction.
19738 Therefore literal load is minimized for better performance. This
19739 option is only supported when compiling for ARMv7 M-profile and off
19740 by default. It conflicts with -mword-relocations.
19741
19742 -masm-syntax-unified
19743 Assume inline assembler is using unified asm syntax. The default
19744 is currently off which implies divided syntax. This option has no
19745 impact on Thumb2. However, this may change in future releases of
19746 GCC. Divided syntax should be considered deprecated.
19747
19748 -mrestrict-it
19749 Restricts generation of IT blocks to conform to the rules of
19750 ARMv8-A. IT blocks can only contain a single 16-bit instruction
19751 from a select set of instructions. This option is on by default for
19752 ARMv8-A Thumb mode.
19753
19754 -mprint-tune-info
19755 Print CPU tuning information as comment in assembler file. This is
19756 an option used only for regression testing of the compiler and not
19757 intended for ordinary use in compiling code. This option is
19758 disabled by default.
19759
19760 -mverbose-cost-dump
19761 Enable verbose cost model dumping in the debug dump files. This
19762 option is provided for use in debugging the compiler.
19763
19764 -mpure-code
19765 Do not allow constant data to be placed in code sections.
19766 Additionally, when compiling for ELF object format give all text
19767 sections the ELF processor-specific section attribute
19768 "SHF_ARM_PURECODE". This option is only available when generating
19769 non-pic code for M-profile targets.
19770
19771 -mcmse
19772 Generate secure code as per the "ARMv8-M Security Extensions:
19773 Requirements on Development Tools Engineering Specification", which
19774 can be found on
19775 <https://developer.arm.com/documentation/ecm0359818/latest/>.
19776
19777 -mfix-cmse-cve-2021-35465
19778 Mitigate against a potential security issue with the "VLLDM"
19779 instruction in some M-profile devices when using CMSE
19780 (CVE-2021-365465). This option is enabled by default when the
19781 option -mcpu= is used with "cortex-m33", "cortex-m35p",
19782 "cortex-m55", "cortex-m85" or "star-mc1". The option
19783 -mno-fix-cmse-cve-2021-35465 can be used to disable the mitigation.
19784
19785 -mstack-protector-guard=guard
19786 -mstack-protector-guard-offset=offset
19787 Generate stack protection code using canary at guard. Supported
19788 locations are global for a global canary or tls for a canary
19789 accessible via the TLS register. The option
19790 -mstack-protector-guard-offset= is for use with
19791 -fstack-protector-guard=tls and not for use in user-land code.
19792
19793 -mfdpic
19794 -mno-fdpic
19795 Select the FDPIC ABI, which uses 64-bit function descriptors to
19796 represent pointers to functions. When the compiler is configured
19797 for "arm-*-uclinuxfdpiceabi" targets, this option is on by default
19798 and implies -fPIE if none of the PIC/PIE-related options is
19799 provided. On other targets, it only enables the FDPIC-specific
19800 code generation features, and the user should explicitly provide
19801 the PIC/PIE-related options as needed.
19802
19803 Note that static linking is not supported because it would still
19804 involve the dynamic linker when the program self-relocates. If
19805 such behavior is acceptable, use -static and -Wl,-dynamic-linker
19806 options.
19807
19808 The opposite -mno-fdpic option is useful (and required) to build
19809 the Linux kernel using the same ("arm-*-uclinuxfdpiceabi")
19810 toolchain as the one used to build the userland programs.
19811
19812 -mbranch-protection=none|standard|pac-ret[+leaf][+bti]|bti[+pac-
19813 ret[+leaf]]
19814 Enable branch protection features (armv8.1-m.main only). none
19815 generate code without branch protection or return address signing.
19816 standard[+leaf] generate code with all branch protection features
19817 enabled at their standard level. pac-ret[+leaf] generate code with
19818 return address signing set to its standard level, which is to sign
19819 all functions that save the return address to memory. leaf When
19820 return address signing is enabled, also sign leaf functions even if
19821 they do not write the return address to memory. +bti Add landing-
19822 pad instructions at the permitted targets of indirect branch
19823 instructions.
19824
19825 If the +pacbti architecture extension is not enabled, then all
19826 branch protection and return address signing operations are
19827 constrained to use only the instructions defined in the
19828 architectural-NOP space. The generated code will remain backwards-
19829 compatible with earlier versions of the architecture, but the
19830 additional security can be enabled at run time on processors that
19831 support the PACBTI extension.
19832
19833 Branch target enforcement using BTI can only be enabled at runtime
19834 if all code in the application has been compiled with at least
19835 -mbranch-protection=bti.
19836
19837 Any setting other than none is supported only on armv8-m.main or
19838 later.
19839
19840 The default is to generate code without branch protection or return
19841 address signing.
19842
19843 AVR Options
19844
19845 These options are defined for AVR implementations:
19846
19847 -mmcu=mcu
19848 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
19849
19850 The default for this option is avr2.
19851
19852 GCC supports the following AVR devices and ISAs:
19853
19854 "avr2"
19855 "Classic" devices with up to 8 KiB of program memory. mcu =
19856 "attiny22", "attiny26", "at90s2313", "at90s2323", "at90s2333",
19857 "at90s2343", "at90s4414", "at90s4433", "at90s4434",
19858 "at90c8534", "at90s8515", "at90s8535".
19859
19860 "avr25"
19861 "Classic" devices with up to 8 KiB of program memory and with
19862 the "MOVW" instruction. mcu = "attiny13", "attiny13a",
19863 "attiny24", "attiny24a", "attiny25", "attiny261", "attiny261a",
19864 "attiny2313", "attiny2313a", "attiny43u", "attiny44",
19865 "attiny44a", "attiny45", "attiny48", "attiny441", "attiny461",
19866 "attiny461a", "attiny4313", "attiny84", "attiny84a",
19867 "attiny85", "attiny87", "attiny88", "attiny828", "attiny841",
19868 "attiny861", "attiny861a", "ata5272", "ata6616c", "at86rf401".
19869
19870 "avr3"
19871 "Classic" devices with 16 KiB up to 64 KiB of program memory.
19872 mcu = "at76c711", "at43usb355".
19873
19874 "avr31"
19875 "Classic" devices with 128 KiB of program memory. mcu =
19876 "atmega103", "at43usb320".
19877
19878 "avr35"
19879 "Classic" devices with 16 KiB up to 64 KiB of program memory
19880 and with the "MOVW" instruction. mcu = "attiny167",
19881 "attiny1634", "atmega8u2", "atmega16u2", "atmega32u2",
19882 "ata5505", "ata6617c", "ata664251", "at90usb82", "at90usb162".
19883
19884 "avr4"
19885 "Enhanced" devices with up to 8 KiB of program memory. mcu =
19886 "atmega48", "atmega48a", "atmega48p", "atmega48pa",
19887 "atmega48pb", "atmega8", "atmega8a", "atmega8hva", "atmega88",
19888 "atmega88a", "atmega88p", "atmega88pa", "atmega88pb",
19889 "atmega8515", "atmega8535", "ata6285", "ata6286", "ata6289",
19890 "ata6612c", "at90pwm1", "at90pwm2", "at90pwm2b", "at90pwm3",
19891 "at90pwm3b", "at90pwm81".
19892
19893 "avr5"
19894 "Enhanced" devices with 16 KiB up to 64 KiB of program memory.
19895 mcu = "atmega16", "atmega16a", "atmega16hva", "atmega16hva2",
19896 "atmega16hvb", "atmega16hvbrevb", "atmega16m1", "atmega16u4",
19897 "atmega161", "atmega162", "atmega163", "atmega164a",
19898 "atmega164p", "atmega164pa", "atmega165", "atmega165a",
19899 "atmega165p", "atmega165pa", "atmega168", "atmega168a",
19900 "atmega168p", "atmega168pa", "atmega168pb", "atmega169",
19901 "atmega169a", "atmega169p", "atmega169pa", "atmega32",
19902 "atmega32a", "atmega32c1", "atmega32hvb", "atmega32hvbrevb",
19903 "atmega32m1", "atmega32u4", "atmega32u6", "atmega323",
19904 "atmega324a", "atmega324p", "atmega324pa", "atmega324pb",
19905 "atmega325", "atmega325a", "atmega325p", "atmega325pa",
19906 "atmega328", "atmega328p", "atmega328pb", "atmega329",
19907 "atmega329a", "atmega329p", "atmega329pa", "atmega3250",
19908 "atmega3250a", "atmega3250p", "atmega3250pa", "atmega3290",
19909 "atmega3290a", "atmega3290p", "atmega3290pa", "atmega406",
19910 "atmega64", "atmega64a", "atmega64c1", "atmega64hve",
19911 "atmega64hve2", "atmega64m1", "atmega64rfr2", "atmega640",
19912 "atmega644", "atmega644a", "atmega644p", "atmega644pa",
19913 "atmega644rfr2", "atmega645", "atmega645a", "atmega645p",
19914 "atmega649", "atmega649a", "atmega649p", "atmega6450",
19915 "atmega6450a", "atmega6450p", "atmega6490", "atmega6490a",
19916 "atmega6490p", "ata5795", "ata5790", "ata5790n", "ata5791",
19917 "ata6613c", "ata6614q", "ata5782", "ata5831", "ata8210",
19918 "ata8510", "ata5702m322", "at90pwm161", "at90pwm216",
19919 "at90pwm316", "at90can32", "at90can64", "at90scr100",
19920 "at90usb646", "at90usb647", "at94k", "m3000".
19921
19922 "avr51"
19923 "Enhanced" devices with 128 KiB of program memory. mcu =
19924 "atmega128", "atmega128a", "atmega128rfa1", "atmega128rfr2",
19925 "atmega1280", "atmega1281", "atmega1284", "atmega1284p",
19926 "atmega1284rfr2", "at90can128", "at90usb1286", "at90usb1287".
19927
19928 "avr6"
19929 "Enhanced" devices with 3-byte PC, i.e. with more than 128 KiB
19930 of program memory. mcu = "atmega256rfr2", "atmega2560",
19931 "atmega2561", "atmega2564rfr2".
19932
19933 "avrxmega2"
19934 "XMEGA" devices with more than 8 KiB and up to 64 KiB of
19935 program memory. mcu = "atxmega8e5", "atxmega16a4",
19936 "atxmega16a4u", "atxmega16c4", "atxmega16d4", "atxmega16e5",
19937 "atxmega32a4", "atxmega32a4u", "atxmega32c3", "atxmega32c4",
19938 "atxmega32d3", "atxmega32d4", "atxmega32e5", "avr64da28",
19939 "avr64da32", "avr64da48", "avr64da64", "avr64db28",
19940 "avr64db32", "avr64db48", "avr64db64".
19941
19942 "avrxmega3"
19943 "XMEGA" devices with up to 64 KiB of combined program memory
19944 and RAM, and with program memory visible in the RAM address
19945 space. mcu = "attiny202", "attiny204", "attiny212",
19946 "attiny214", "attiny402", "attiny404", "attiny406",
19947 "attiny412", "attiny414", "attiny416", "attiny417",
19948 "attiny804", "attiny806", "attiny807", "attiny814",
19949 "attiny816", "attiny817", "attiny1604", "attiny1606",
19950 "attiny1607", "attiny1614", "attiny1616", "attiny1617",
19951 "attiny3214", "attiny3216", "attiny3217", "atmega808",
19952 "atmega809", "atmega1608", "atmega1609", "atmega3208",
19953 "atmega3209", "atmega4808", "atmega4809", "avr32da28",
19954 "avr32da32", "avr32da48", "avr32db28", "avr32db32",
19955 "avr32db48".
19956
19957 "avrxmega4"
19958 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
19959 program memory. mcu = "atxmega64a3", "atxmega64a3u",
19960 "atxmega64a4u", "atxmega64b1", "atxmega64b3", "atxmega64c3",
19961 "atxmega64d3", "atxmega64d4", "avr128da28", "avr128da32",
19962 "avr128da48", "avr128da64", "avr128db28", "avr128db32",
19963 "avr128db48", "avr128db64".
19964
19965 "avrxmega5"
19966 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
19967 program memory and more than 64 KiB of RAM. mcu =
19968 "atxmega64a1", "atxmega64a1u".
19969
19970 "avrxmega6"
19971 "XMEGA" devices with more than 128 KiB of program memory. mcu
19972 = "atxmega128a3", "atxmega128a3u", "atxmega128b1",
19973 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
19974 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
19975 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
19976 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
19977 "atxmega256d3", "atxmega384c3", "atxmega384d3".
19978
19979 "avrxmega7"
19980 "XMEGA" devices with more than 128 KiB of program memory and
19981 more than 64 KiB of RAM. mcu = "atxmega128a1",
19982 "atxmega128a1u", "atxmega128a4u".
19983
19984 "avrtiny"
19985 "TINY" Tiny core devices with 512 B up to 4 KiB of program
19986 memory. mcu = "attiny4", "attiny5", "attiny9", "attiny10",
19987 "attiny20", "attiny40".
19988
19989 "avr1"
19990 This ISA is implemented by the minimal AVR core and supported
19991 for assembler only. mcu = "attiny11", "attiny12", "attiny15",
19992 "attiny28", "at90s1200".
19993
19994 -mabsdata
19995 Assume that all data in static storage can be accessed by LDS / STS
19996 instructions. This option has only an effect on reduced Tiny
19997 devices like ATtiny40. See also the "absdata" AVR Variable
19998 Attributes,variable attribute.
19999
20000 -maccumulate-args
20001 Accumulate outgoing function arguments and acquire/release the
20002 needed stack space for outgoing function arguments once in function
20003 prologue/epilogue. Without this option, outgoing arguments are
20004 pushed before calling a function and popped afterwards.
20005
20006 Popping the arguments after the function call can be expensive on
20007 AVR so that accumulating the stack space might lead to smaller
20008 executables because arguments need not be removed from the stack
20009 after such a function call.
20010
20011 This option can lead to reduced code size for functions that
20012 perform several calls to functions that get their arguments on the
20013 stack like calls to printf-like functions.
20014
20015 -mbranch-cost=cost
20016 Set the branch costs for conditional branch instructions to cost.
20017 Reasonable values for cost are small, non-negative integers. The
20018 default branch cost is 0.
20019
20020 -mcall-prologues
20021 Functions prologues/epilogues are expanded as calls to appropriate
20022 subroutines. Code size is smaller.
20023
20024 -mdouble=bits
20025 -mlong-double=bits
20026 Set the size (in bits) of the "double" or "long double" type,
20027 respectively. Possible values for bits are 32 and 64. Whether or
20028 not a specific value for bits is allowed depends on the
20029 "--with-double=" and "--with-long-double=" configure options
20030 ("https://gcc.gnu.org/install/configure.html#avr"), and the same
20031 applies for the default values of the options.
20032
20033 -mgas-isr-prologues
20034 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
20035 instruction supported by GNU Binutils. If this option is on, the
20036 feature can still be disabled for individual ISRs by means of the
20037 AVR Function Attributes,,"no_gccisr" function attribute. This
20038 feature is activated per default if optimization is on (but not
20039 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
20040 PR21683 ("https://sourceware.org/PR21683").
20041
20042 -mint8
20043 Assume "int" to be 8-bit integer. This affects the sizes of all
20044 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
20045 and "long long" is 4 bytes. Please note that this option does not
20046 conform to the C standards, but it results in smaller code size.
20047
20048 -mmain-is-OS_task
20049 Do not save registers in "main". The effect is the same like
20050 attaching attribute AVR Function Attributes,,"OS_task" to "main".
20051 It is activated per default if optimization is on.
20052
20053 -mn-flash=num
20054 Assume that the flash memory has a size of num times 64 KiB.
20055
20056 -mno-interrupts
20057 Generated code is not compatible with hardware interrupts. Code
20058 size is smaller.
20059
20060 -mrelax
20061 Try to replace "CALL" resp. "JMP" instruction by the shorter
20062 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
20063 just adds the --mlink-relax option to the assembler's command line
20064 and the --relax option to the linker's command line.
20065
20066 Jump relaxing is performed by the linker because jump offsets are
20067 not known before code is located. Therefore, the assembler code
20068 generated by the compiler is the same, but the instructions in the
20069 executable may differ from instructions in the assembler code.
20070
20071 Relaxing must be turned on if linker stubs are needed, see the
20072 section on "EIND" and linker stubs below.
20073
20074 -mrmw
20075 Assume that the device supports the Read-Modify-Write instructions
20076 "XCH", "LAC", "LAS" and "LAT".
20077
20078 -mshort-calls
20079 Assume that "RJMP" and "RCALL" can target the whole program memory.
20080
20081 This option is used internally for multilib selection. It is not
20082 an optimization option, and you don't need to set it by hand.
20083
20084 -msp8
20085 Treat the stack pointer register as an 8-bit register, i.e. assume
20086 the high byte of the stack pointer is zero. In general, you don't
20087 need to set this option by hand.
20088
20089 This option is used internally by the compiler to select and build
20090 multilibs for architectures "avr2" and "avr25". These
20091 architectures mix devices with and without "SPH". For any setting
20092 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
20093 removes this option from the compiler proper's command line,
20094 because the compiler then knows if the device or architecture has
20095 an 8-bit stack pointer and thus no "SPH" register or not.
20096
20097 -mstrict-X
20098 Use address register "X" in a way proposed by the hardware. This
20099 means that "X" is only used in indirect, post-increment or pre-
20100 decrement addressing.
20101
20102 Without this option, the "X" register may be used in the same way
20103 as "Y" or "Z" which then is emulated by additional instructions.
20104 For example, loading a value with "X+const" addressing with a small
20105 non-negative "const < 64" to a register Rn is performed as
20106
20107 adiw r26, const ; X += const
20108 ld <Rn>, X ; <Rn> = *X
20109 sbiw r26, const ; X -= const
20110
20111 -mtiny-stack
20112 Only change the lower 8 bits of the stack pointer.
20113
20114 -mfract-convert-truncate
20115 Allow to use truncation instead of rounding towards zero for
20116 fractional fixed-point types.
20117
20118 -nodevicelib
20119 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
20120
20121 -nodevicespecs
20122 Don't add -specs=device-specs/specs-mcu to the compiler driver's
20123 command line. The user takes responsibility for supplying the sub-
20124 processes like compiler proper, assembler and linker with
20125 appropriate command line options. This means that the user has to
20126 supply her private device specs file by means of -specs=path-to-
20127 specs-file. There is no more need for option -mmcu=mcu.
20128
20129 This option can also serve as a replacement for the older way of
20130 specifying custom device-specs files that needed -B some-path to
20131 point to a directory which contains a folder named "device-specs"
20132 which contains a specs file named "specs-mcu", where mcu was
20133 specified by -mmcu=mcu.
20134
20135 -Waddr-space-convert
20136 Warn about conversions between address spaces in the case where the
20137 resulting address space is not contained in the incoming address
20138 space.
20139
20140 -Wmisspelled-isr
20141 Warn if the ISR is misspelled, i.e. without __vector prefix.
20142 Enabled by default.
20143
20144 "EIND" and Devices with More Than 128 Ki Bytes of Flash
20145
20146 Pointers in the implementation are 16 bits wide. The address of a
20147 function or label is represented as word address so that indirect jumps
20148 and calls can target any code address in the range of 64 Ki words.
20149
20150 In order to facilitate indirect jump on devices with more than 128 Ki
20151 bytes of program memory space, there is a special function register
20152 called "EIND" that serves as most significant part of the target
20153 address when "EICALL" or "EIJMP" instructions are used.
20154
20155 Indirect jumps and calls on these devices are handled as follows by the
20156 compiler and are subject to some limitations:
20157
20158 * The compiler never sets "EIND".
20159
20160 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
20161 instructions or might read "EIND" directly in order to emulate an
20162 indirect call/jump by means of a "RET" instruction.
20163
20164 * The compiler assumes that "EIND" never changes during the startup
20165 code or during the application. In particular, "EIND" is not
20166 saved/restored in function or interrupt service routine
20167 prologue/epilogue.
20168
20169 * For indirect calls to functions and computed goto, the linker
20170 generates stubs. Stubs are jump pads sometimes also called
20171 trampolines. Thus, the indirect call/jump jumps to such a stub.
20172 The stub contains a direct jump to the desired address.
20173
20174 * Linker relaxation must be turned on so that the linker generates
20175 the stubs correctly in all situations. See the compiler option
20176 -mrelax and the linker option --relax. There are corner cases
20177 where the linker is supposed to generate stubs but aborts without
20178 relaxation and without a helpful error message.
20179
20180 * The default linker script is arranged for code with "EIND = 0". If
20181 code is supposed to work for a setup with "EIND != 0", a custom
20182 linker script has to be used in order to place the sections whose
20183 name start with ".trampolines" into the segment where "EIND" points
20184 to.
20185
20186 * The startup code from libgcc never sets "EIND". Notice that
20187 startup code is a blend of code from libgcc and AVR-LibC. For the
20188 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
20189 ("https://www.nongnu.org/avr-libc/user-manual/").
20190
20191 * It is legitimate for user-specific startup code to set up "EIND"
20192 early, for example by means of initialization code located in
20193 section ".init3". Such code runs prior to general startup code that
20194 initializes RAM and calls constructors, but after the bit of
20195 startup code from AVR-LibC that sets "EIND" to the segment where
20196 the vector table is located.
20197
20198 #include <avr/io.h>
20199
20200 static void
20201 __attribute__((section(".init3"),naked,used,no_instrument_function))
20202 init3_set_eind (void)
20203 {
20204 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
20205 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
20206 }
20207
20208 The "__trampolines_start" symbol is defined in the linker script.
20209
20210 * Stubs are generated automatically by the linker if the following
20211 two conditions are met:
20212
20213 -<The address of a label is taken by means of the "gs" modifier>
20214 (short for generate stubs) like so:
20215
20216 LDI r24, lo8(gs(<func>))
20217 LDI r25, hi8(gs(<func>))
20218
20219 -<The final location of that label is in a code segment>
20220 outside the segment where the stubs are located.
20221
20222 * The compiler emits such "gs" modifiers for code labels in the
20223 following situations:
20224
20225 -<Taking address of a function or code label.>
20226 -<Computed goto.>
20227 -<If prologue-save function is used, see -mcall-prologues>
20228 command-line option.
20229
20230 -<Switch/case dispatch tables. If you do not want such dispatch>
20231 tables you can specify the -fno-jump-tables command-line
20232 option.
20233
20234 -<C and C++ constructors/destructors called during
20235 startup/shutdown.>
20236 -<If the tools hit a gs() modifier explained above.>
20237 * Jumping to non-symbolic addresses like so is not supported:
20238
20239 int main (void)
20240 {
20241 /* Call function at word address 0x2 */
20242 return ((int(*)(void)) 0x2)();
20243 }
20244
20245 Instead, a stub has to be set up, i.e. the function has to be
20246 called through a symbol ("func_4" in the example):
20247
20248 int main (void)
20249 {
20250 extern int func_4 (void);
20251
20252 /* Call function at byte address 0x4 */
20253 return func_4();
20254 }
20255
20256 and the application be linked with -Wl,--defsym,func_4=0x4.
20257 Alternatively, "func_4" can be defined in the linker script.
20258
20259 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
20260 Registers
20261
20262 Some AVR devices support memories larger than the 64 KiB range that can
20263 be accessed with 16-bit pointers. To access memory locations outside
20264 this 64 KiB range, the content of a "RAMP" register is used as high
20265 part of the address: The "X", "Y", "Z" address register is concatenated
20266 with the "RAMPX", "RAMPY", "RAMPZ" special function register,
20267 respectively, to get a wide address. Similarly, "RAMPD" is used
20268 together with direct addressing.
20269
20270 * The startup code initializes the "RAMP" special function registers
20271 with zero.
20272
20273 * If a AVR Named Address Spaces,named address space other than
20274 generic or "__flash" is used, then "RAMPZ" is set as needed before
20275 the operation.
20276
20277 * If the device supports RAM larger than 64 KiB and the compiler
20278 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
20279 reset to zero after the operation.
20280
20281 * If the device comes with a specific "RAMP" register, the ISR
20282 prologue/epilogue saves/restores that SFR and initializes it with
20283 zero in case the ISR code might (implicitly) use it.
20284
20285 * RAM larger than 64 KiB is not supported by GCC for AVR targets. If
20286 you use inline assembler to read from locations outside the 16-bit
20287 address range and change one of the "RAMP" registers, you must
20288 reset it to zero after the access.
20289
20290 AVR Built-in Macros
20291
20292 GCC defines several built-in macros so that the user code can test for
20293 the presence or absence of features. Almost any of the following
20294 built-in macros are deduced from device capabilities and thus triggered
20295 by the -mmcu= command-line option.
20296
20297 For even more AVR-specific built-in macros see AVR Named Address Spaces
20298 and AVR Built-in Functions.
20299
20300 "__AVR_ARCH__"
20301 Build-in macro that resolves to a decimal number that identifies
20302 the architecture and depends on the -mmcu=mcu option. Possible
20303 values are:
20304
20305 2, 25, 3, 31, 35, 4, 5, 51, 6
20306
20307 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
20308 "avr51", "avr6",
20309
20310 respectively and
20311
20312 100, 102, 103, 104, 105, 106, 107
20313
20314 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
20315 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
20316 specifies a device, this built-in macro is set accordingly. For
20317 example, with -mmcu=atmega8 the macro is defined to 4.
20318
20319 "__AVR_Device__"
20320 Setting -mmcu=device defines this built-in macro which reflects the
20321 device's name. For example, -mmcu=atmega8 defines the built-in
20322 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
20323 "__AVR_ATtiny261A__", etc.
20324
20325 The built-in macros' names follow the scheme "__AVR_Device__" where
20326 Device is the device name as from the AVR user manual. The
20327 difference between Device in the built-in macro and device in
20328 -mmcu=device is that the latter is always lowercase.
20329
20330 If device is not a device but only a core architecture like avr51,
20331 this macro is not defined.
20332
20333 "__AVR_DEVICE_NAME__"
20334 Setting -mmcu=device defines this built-in macro to the device's
20335 name. For example, with -mmcu=atmega8 the macro is defined to
20336 "atmega8".
20337
20338 If device is not a device but only a core architecture like avr51,
20339 this macro is not defined.
20340
20341 "__AVR_XMEGA__"
20342 The device / architecture belongs to the XMEGA family of devices.
20343
20344 "__AVR_HAVE_ELPM__"
20345 The device has the "ELPM" instruction.
20346
20347 "__AVR_HAVE_ELPMX__"
20348 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
20349
20350 "__AVR_HAVE_MOVW__"
20351 The device has the "MOVW" instruction to perform 16-bit register-
20352 register moves.
20353
20354 "__AVR_HAVE_LPMX__"
20355 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
20356
20357 "__AVR_HAVE_MUL__"
20358 The device has a hardware multiplier.
20359
20360 "__AVR_HAVE_JMP_CALL__"
20361 The device has the "JMP" and "CALL" instructions. This is the case
20362 for devices with more than 8 KiB of program memory.
20363
20364 "__AVR_HAVE_EIJMP_EICALL__"
20365 "__AVR_3_BYTE_PC__"
20366 The device has the "EIJMP" and "EICALL" instructions. This is the
20367 case for devices with more than 128 KiB of program memory. This
20368 also means that the program counter (PC) is 3 bytes wide.
20369
20370 "__AVR_2_BYTE_PC__"
20371 The program counter (PC) is 2 bytes wide. This is the case for
20372 devices with up to 128 KiB of program memory.
20373
20374 "__AVR_HAVE_8BIT_SP__"
20375 "__AVR_HAVE_16BIT_SP__"
20376 The stack pointer (SP) register is treated as 8-bit respectively
20377 16-bit register by the compiler. The definition of these macros is
20378 affected by -mtiny-stack.
20379
20380 "__AVR_HAVE_SPH__"
20381 "__AVR_SP8__"
20382 The device has the SPH (high part of stack pointer) special
20383 function register or has an 8-bit stack pointer, respectively. The
20384 definition of these macros is affected by -mmcu= and in the cases
20385 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
20386
20387 "__AVR_HAVE_RAMPD__"
20388 "__AVR_HAVE_RAMPX__"
20389 "__AVR_HAVE_RAMPY__"
20390 "__AVR_HAVE_RAMPZ__"
20391 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
20392 function register, respectively.
20393
20394 "__NO_INTERRUPTS__"
20395 This macro reflects the -mno-interrupts command-line option.
20396
20397 "__AVR_ERRATA_SKIP__"
20398 "__AVR_ERRATA_SKIP_JMP_CALL__"
20399 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
20400 instructions because of a hardware erratum. Skip instructions are
20401 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
20402 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
20403
20404 "__AVR_ISA_RMW__"
20405 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
20406 LAT).
20407
20408 "__AVR_SFR_OFFSET__=offset"
20409 Instructions that can address I/O special function registers
20410 directly like "IN", "OUT", "SBI", etc. may use a different address
20411 as if addressed by an instruction to access RAM like "LD" or "STS".
20412 This offset depends on the device architecture and has to be
20413 subtracted from the RAM address in order to get the respective I/O
20414 address.
20415
20416 "__AVR_SHORT_CALLS__"
20417 The -mshort-calls command line option is set.
20418
20419 "__AVR_PM_BASE_ADDRESS__=addr"
20420 Some devices support reading from flash memory by means of "LD*"
20421 instructions. The flash memory is seen in the data address space
20422 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
20423 defined, this feature is not available. If defined, the address
20424 space is linear and there is no need to put ".rodata" into RAM.
20425 This is handled by the default linker description file, and is
20426 currently available for "avrtiny" and "avrxmega3". Even more
20427 convenient, there is no need to use address spaces like "__flash"
20428 or features like attribute "progmem" and "pgm_read_*".
20429
20430 "__WITH_AVRLIBC__"
20431 The compiler is configured to be used together with AVR-Libc. See
20432 the --with-avrlibc configure option.
20433
20434 "__HAVE_DOUBLE_MULTILIB__"
20435 Defined if -mdouble= acts as a multilib option.
20436
20437 "__HAVE_DOUBLE32__"
20438 "__HAVE_DOUBLE64__"
20439 Defined if the compiler supports 32-bit double resp. 64-bit double.
20440 The actual layout is specified by option -mdouble=.
20441
20442 "__DEFAULT_DOUBLE__"
20443 The size in bits of "double" if -mdouble= is not set. To test the
20444 layout of "double" in a program, use the built-in macro
20445 "__SIZEOF_DOUBLE__".
20446
20447 "__HAVE_LONG_DOUBLE32__"
20448 "__HAVE_LONG_DOUBLE64__"
20449 "__HAVE_LONG_DOUBLE_MULTILIB__"
20450 "__DEFAULT_LONG_DOUBLE__"
20451 Same as above, but for "long double" instead of "double".
20452
20453 "__WITH_DOUBLE_COMPARISON__"
20454 Reflects the "--with-double-comparison={tristate|bool|libf7}"
20455 configure option ("https://gcc.gnu.org/install/configure.html#avr")
20456 and is defined to 2 or 3.
20457
20458 "__WITH_LIBF7_LIBGCC__"
20459 "__WITH_LIBF7_MATH__"
20460 "__WITH_LIBF7_MATH_SYMBOLS__"
20461 Reflects the "--with-libf7={libgcc|math|math-symbols}"
20462 configure option
20463 ("https://gcc.gnu.org/install/configure.html#avr").
20464
20465 Blackfin Options
20466
20467 -mcpu=cpu[-sirevision]
20468 Specifies the name of the target Blackfin processor. Currently,
20469 cpu can be one of bf512, bf514, bf516, bf518, bf522, bf523, bf524,
20470 bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf536, bf537,
20471 bf538, bf539, bf542, bf544, bf547, bf548, bf549, bf542m, bf544m,
20472 bf547m, bf548m, bf549m, bf561, bf592.
20473
20474 The optional sirevision specifies the silicon revision of the
20475 target Blackfin processor. Any workarounds available for the
20476 targeted silicon revision are enabled. If sirevision is none, no
20477 workarounds are enabled. If sirevision is any, all workarounds for
20478 the targeted processor are enabled. The "__SILICON_REVISION__"
20479 macro is defined to two hexadecimal digits representing the major
20480 and minor numbers in the silicon revision. If sirevision is none,
20481 the "__SILICON_REVISION__" is not defined. If sirevision is any,
20482 the "__SILICON_REVISION__" is defined to be 0xffff. If this
20483 optional sirevision is not used, GCC assumes the latest known
20484 silicon revision of the targeted Blackfin processor.
20485
20486 GCC defines a preprocessor macro for the specified cpu. For the
20487 bfin-elf toolchain, this option causes the hardware BSP provided by
20488 libgloss to be linked in if -msim is not given.
20489
20490 Without this option, bf532 is used as the processor by default.
20491
20492 Note that support for bf561 is incomplete. For bf561, only the
20493 preprocessor macro is defined.
20494
20495 -msim
20496 Specifies that the program will be run on the simulator. This
20497 causes the simulator BSP provided by libgloss to be linked in.
20498 This option has effect only for bfin-elf toolchain. Certain other
20499 options, such as -mid-shared-library and -mfdpic, imply -msim.
20500
20501 -momit-leaf-frame-pointer
20502 Don't keep the frame pointer in a register for leaf functions.
20503 This avoids the instructions to save, set up and restore frame
20504 pointers and makes an extra register available in leaf functions.
20505
20506 -mspecld-anomaly
20507 When enabled, the compiler ensures that the generated code does not
20508 contain speculative loads after jump instructions. If this option
20509 is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
20510
20511 -mno-specld-anomaly
20512 Don't generate extra code to prevent speculative loads from
20513 occurring.
20514
20515 -mcsync-anomaly
20516 When enabled, the compiler ensures that the generated code does not
20517 contain CSYNC or SSYNC instructions too soon after conditional
20518 branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS"
20519 is defined.
20520
20521 -mno-csync-anomaly
20522 Don't generate extra code to prevent CSYNC or SSYNC instructions
20523 from occurring too soon after a conditional branch.
20524
20525 -mlow64k
20526 When enabled, the compiler is free to take advantage of the
20527 knowledge that the entire program fits into the low 64k of memory.
20528
20529 -mno-low64k
20530 Assume that the program is arbitrarily large. This is the default.
20531
20532 -mstack-check-l1
20533 Do stack checking using information placed into L1 scratchpad
20534 memory by the uClinux kernel.
20535
20536 -mid-shared-library
20537 Generate code that supports shared libraries via the library ID
20538 method. This allows for execute in place and shared libraries in
20539 an environment without virtual memory management. This option
20540 implies -fPIC. With a bfin-elf target, this option implies -msim.
20541
20542 -mno-id-shared-library
20543 Generate code that doesn't assume ID-based shared libraries are
20544 being used. This is the default.
20545
20546 -mleaf-id-shared-library
20547 Generate code that supports shared libraries via the library ID
20548 method, but assumes that this library or executable won't link
20549 against any other ID shared libraries. That allows the compiler to
20550 use faster code for jumps and calls.
20551
20552 -mno-leaf-id-shared-library
20553 Do not assume that the code being compiled won't link against any
20554 ID shared libraries. Slower code is generated for jump and call
20555 insns.
20556
20557 -mshared-library-id=n
20558 Specifies the identification number of the ID-based shared library
20559 being compiled. Specifying a value of 0 generates more compact
20560 code; specifying other values forces the allocation of that number
20561 to the current library but is no more space- or time-efficient than
20562 omitting this option.
20563
20564 -msep-data
20565 Generate code that allows the data segment to be located in a
20566 different area of memory from the text segment. This allows for
20567 execute in place in an environment without virtual memory
20568 management by eliminating relocations against the text section.
20569
20570 -mno-sep-data
20571 Generate code that assumes that the data segment follows the text
20572 segment. This is the default.
20573
20574 -mlong-calls
20575 -mno-long-calls
20576 Tells the compiler to perform function calls by first loading the
20577 address of the function into a register and then performing a
20578 subroutine call on this register. This switch is needed if the
20579 target function lies outside of the 24-bit addressing range of the
20580 offset-based version of subroutine call instruction.
20581
20582 This feature is not enabled by default. Specifying -mno-long-calls
20583 restores the default behavior. Note these switches have no effect
20584 on how the compiler generates code to handle function calls via
20585 function pointers.
20586
20587 -mfast-fp
20588 Link with the fast floating-point library. This library relaxes
20589 some of the IEEE floating-point standard's rules for checking
20590 inputs against Not-a-Number (NAN), in the interest of performance.
20591
20592 -minline-plt
20593 Enable inlining of PLT entries in function calls to functions that
20594 are not known to bind locally. It has no effect without -mfdpic.
20595
20596 -mmulticore
20597 Build a standalone application for multicore Blackfin processors.
20598 This option causes proper start files and link scripts supporting
20599 multicore to be used, and defines the macro "__BFIN_MULTICORE". It
20600 can only be used with -mcpu=bf561[-sirevision].
20601
20602 This option can be used with -mcorea or -mcoreb, which selects the
20603 one-application-per-core programming model. Without -mcorea or
20604 -mcoreb, the single-application/dual-core programming model is
20605 used. In this model, the main function of Core B should be named as
20606 "coreb_main".
20607
20608 If this option is not used, the single-core application programming
20609 model is used.
20610
20611 -mcorea
20612 Build a standalone application for Core A of BF561 when using the
20613 one-application-per-core programming model. Proper start files and
20614 link scripts are used to support Core A, and the macro
20615 "__BFIN_COREA" is defined. This option can only be used in
20616 conjunction with -mmulticore.
20617
20618 -mcoreb
20619 Build a standalone application for Core B of BF561 when using the
20620 one-application-per-core programming model. Proper start files and
20621 link scripts are used to support Core B, and the macro
20622 "__BFIN_COREB" is defined. When this option is used, "coreb_main"
20623 should be used instead of "main". This option can only be used in
20624 conjunction with -mmulticore.
20625
20626 -msdram
20627 Build a standalone application for SDRAM. Proper start files and
20628 link scripts are used to put the application into SDRAM, and the
20629 macro "__BFIN_SDRAM" is defined. The loader should initialize
20630 SDRAM before loading the application.
20631
20632 -micplb
20633 Assume that ICPLBs are enabled at run time. This has an effect on
20634 certain anomaly workarounds. For Linux targets, the default is to
20635 assume ICPLBs are enabled; for standalone applications the default
20636 is off.
20637
20638 C6X Options
20639
20640 -march=name
20641 This specifies the name of the target architecture. GCC uses this
20642 name to determine what kind of instructions it can emit when
20643 generating assembly code. Permissible names are: c62x, c64x,
20644 c64x+, c67x, c67x+, c674x.
20645
20646 -mbig-endian
20647 Generate code for a big-endian target.
20648
20649 -mlittle-endian
20650 Generate code for a little-endian target. This is the default.
20651
20652 -msim
20653 Choose startup files and linker script suitable for the simulator.
20654
20655 -msdata=default
20656 Put small global and static data in the ".neardata" section, which
20657 is pointed to by register "B14". Put small uninitialized global
20658 and static data in the ".bss" section, which is adjacent to the
20659 ".neardata" section. Put small read-only data into the ".rodata"
20660 section. The corresponding sections used for large pieces of data
20661 are ".fardata", ".far" and ".const".
20662
20663 -msdata=all
20664 Put all data, not just small objects, into the sections reserved
20665 for small data, and use addressing relative to the "B14" register
20666 to access them.
20667
20668 -msdata=none
20669 Make no use of the sections reserved for small data, and use
20670 absolute addresses to access all data. Put all initialized global
20671 and static data in the ".fardata" section, and all uninitialized
20672 data in the ".far" section. Put all constant data into the
20673 ".const" section.
20674
20675 CRIS Options
20676
20677 These options are defined specifically for the CRIS ports.
20678
20679 -march=architecture-type
20680 -mcpu=architecture-type
20681 Generate code for the specified architecture. The choices for
20682 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
20683 ETRAX 100, and ETRAX 100 LX. Default is v0.
20684
20685 -mtune=architecture-type
20686 Tune to architecture-type everything applicable about the generated
20687 code, except for the ABI and the set of available instructions.
20688 The choices for architecture-type are the same as for
20689 -march=architecture-type.
20690
20691 -mmax-stack-frame=n
20692 Warn when the stack frame of a function exceeds n bytes.
20693
20694 -metrax4
20695 -metrax100
20696 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
20697 -march=v8 respectively.
20698
20699 -mmul-bug-workaround
20700 -mno-mul-bug-workaround
20701 Work around a bug in the "muls" and "mulu" instructions for CPU
20702 models where it applies. This option is disabled by default.
20703
20704 -mpdebug
20705 Enable CRIS-specific verbose debug-related information in the
20706 assembly code. This option also has the effect of turning off the
20707 #NO_APP formatted-code indicator to the assembler at the beginning
20708 of the assembly file.
20709
20710 -mcc-init
20711 Do not use condition-code results from previous instruction; always
20712 emit compare and test instructions before use of condition codes.
20713
20714 -mno-side-effects
20715 Do not emit instructions with side effects in addressing modes
20716 other than post-increment.
20717
20718 -mstack-align
20719 -mno-stack-align
20720 -mdata-align
20721 -mno-data-align
20722 -mconst-align
20723 -mno-const-align
20724 These options (no- options) arrange (eliminate arrangements) for
20725 the stack frame, individual data and constants to be aligned for
20726 the maximum single data access size for the chosen CPU model. The
20727 default is to arrange for 32-bit alignment. ABI details such as
20728 structure layout are not affected by these options.
20729
20730 -m32-bit
20731 -m16-bit
20732 -m8-bit
20733 Similar to the stack- data- and const-align options above, these
20734 options arrange for stack frame, writable data and constants to all
20735 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
20736 alignment.
20737
20738 -mno-prologue-epilogue
20739 -mprologue-epilogue
20740 With -mno-prologue-epilogue, the normal function prologue and
20741 epilogue which set up the stack frame are omitted and no return
20742 instructions or return sequences are generated in the code. Use
20743 this option only together with visual inspection of the compiled
20744 code: no warnings or errors are generated when call-saved registers
20745 must be saved, or storage for local variables needs to be
20746 allocated.
20747
20748 -melf
20749 Legacy no-op option.
20750
20751 -sim
20752 This option arranges to link with input-output functions from a
20753 simulator library. Code, initialized data and zero-initialized
20754 data are allocated consecutively.
20755
20756 -sim2
20757 Like -sim, but pass linker options to locate initialized data at
20758 0x40000000 and zero-initialized data at 0x80000000.
20759
20760 C-SKY Options
20761
20762 GCC supports these options when compiling for C-SKY V2 processors.
20763
20764 -march=arch
20765 Specify the C-SKY target architecture. Valid values for arch are:
20766 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
20767
20768 -mcpu=cpu
20769 Specify the C-SKY target processor. Valid values for cpu are:
20770 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
20771 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
20772 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
20773 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
20774 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
20775 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
20776 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
20777 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
20778 ck810tv, ck810ft, and ck810ftv.
20779
20780 -mbig-endian
20781 -EB
20782 -mlittle-endian
20783 -EL Select big- or little-endian code. The default is little-endian.
20784
20785 -mfloat-abi=name
20786 Specifies which floating-point ABI to use. Permissible values are:
20787 soft, softfp and hard.
20788
20789 Specifying soft causes GCC to generate output containing library
20790 calls for floating-point operations. softfp allows the generation
20791 of code using hardware floating-point instructions, but still uses
20792 the soft-float calling conventions. hard allows generation of
20793 floating-point instructions and uses FPU-specific calling
20794 conventions.
20795
20796 The default depends on the specific target configuration. Note
20797 that the hard-float and soft-float ABIs are not link-compatible;
20798 you must compile your entire program with the same ABI, and link
20799 with a compatible set of libraries.
20800
20801 -mhard-float
20802 -msoft-float
20803 Select hardware or software floating-point implementations. The
20804 default is soft float.
20805
20806 -mdouble-float
20807 -mno-double-float
20808 When -mhard-float is in effect, enable generation of double-
20809 precision float instructions. This is the default except when
20810 compiling for CK803.
20811
20812 -mfdivdu
20813 -mno-fdivdu
20814 When -mhard-float is in effect, enable generation of "frecipd",
20815 "fsqrtd", and "fdivd" instructions. This is the default except
20816 when compiling for CK803.
20817
20818 -mfpu=fpu
20819 Select the floating-point processor. This option can only be used
20820 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
20821 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
20822 and fpv2_divd (-mdouble-float -mdivdu).
20823
20824 -melrw
20825 -mno-elrw
20826 Enable the extended "lrw" instruction. This option defaults to on
20827 for CK801 and off otherwise.
20828
20829 -mistack
20830 -mno-istack
20831 Enable interrupt stack instructions; the default is off.
20832
20833 The -mistack option is required to handle the "interrupt" and "isr"
20834 function attributes.
20835
20836 -mmp
20837 Enable multiprocessor instructions; the default is off.
20838
20839 -mcp
20840 Enable coprocessor instructions; the default is off.
20841
20842 -mcache
20843 Enable coprocessor instructions; the default is off.
20844
20845 -msecurity
20846 Enable C-SKY security instructions; the default is off.
20847
20848 -mtrust
20849 Enable C-SKY trust instructions; the default is off.
20850
20851 -mdsp
20852 -medsp
20853 -mvdsp
20854 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
20855 respectively. All of these options default to off.
20856
20857 -mdiv
20858 -mno-div
20859 Generate divide instructions. Default is off.
20860
20861 -msmart
20862 -mno-smart
20863 Generate code for Smart Mode, using only registers numbered 0-7 to
20864 allow use of 16-bit instructions. This option is ignored for CK801
20865 where this is the required behavior, and it defaults to on for
20866 CK802. For other targets, the default is off.
20867
20868 -mhigh-registers
20869 -mno-high-registers
20870 Generate code using the high registers numbered 16-31. This option
20871 is not supported on CK801, CK802, or CK803, and is enabled by
20872 default for other processors.
20873
20874 -manchor
20875 -mno-anchor
20876 Generate code using global anchor symbol addresses.
20877
20878 -mpushpop
20879 -mno-pushpop
20880 Generate code using "push" and "pop" instructions. This option
20881 defaults to on.
20882
20883 -mmultiple-stld
20884 -mstm
20885 -mno-multiple-stld
20886 -mno-stm
20887 Generate code using "stm" and "ldm" instructions. This option
20888 isn't supported on CK801 but is enabled by default on other
20889 processors.
20890
20891 -mconstpool
20892 -mno-constpool
20893 Create constant pools in the compiler instead of deferring it to
20894 the assembler. This option is the default and required for correct
20895 code generation on CK801 and CK802, and is optional on other
20896 processors.
20897
20898 -mstack-size
20899 -mno-stack-size
20900 Emit ".stack_size" directives for each function in the assembly
20901 output. This option defaults to off.
20902
20903 -mccrt
20904 -mno-ccrt
20905 Generate code for the C-SKY compiler runtime instead of libgcc.
20906 This option defaults to off.
20907
20908 -mbranch-cost=n
20909 Set the branch costs to roughly "n" instructions. The default is
20910 1.
20911
20912 -msched-prolog
20913 -mno-sched-prolog
20914 Permit scheduling of function prologue and epilogue sequences.
20915 Using this option can result in code that is not compliant with the
20916 C-SKY V2 ABI prologue requirements and that cannot be debugged or
20917 backtraced. It is disabled by default.
20918
20919 -msim
20920 Links the library libsemi.a which is in compatible with simulator.
20921 Applicable to ELF compiler only.
20922
20923 Darwin Options
20924
20925 These options are defined for all architectures running the Darwin
20926 operating system.
20927
20928 FSF GCC on Darwin does not create "fat" object files; it creates an
20929 object file for the single architecture that GCC was built to target.
20930 Apple's GCC on Darwin does create "fat" files if multiple -arch options
20931 are used; it does so by running the compiler or linker multiple times
20932 and joining the results together with lipo.
20933
20934 The subtype of the file created (like ppc7400 or ppc970 or i686) is
20935 determined by the flags that specify the ISA that GCC is targeting,
20936 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
20937 override this.
20938
20939 The Darwin tools vary in their behavior when presented with an ISA
20940 mismatch. The assembler, as, only permits instructions to be used that
20941 are valid for the subtype of the file it is generating, so you cannot
20942 put 64-bit instructions in a ppc750 object file. The linker for shared
20943 libraries, /usr/bin/libtool, fails and prints an error if asked to
20944 create a shared library with a less restrictive subtype than its input
20945 files (for instance, trying to put a ppc970 object file in a ppc7400
20946 library). The linker for executables, ld, quietly gives the executable
20947 the most restrictive subtype of any of its input files.
20948
20949 -Fdir
20950 Add the framework directory dir to the head of the list of
20951 directories to be searched for header files. These directories are
20952 interleaved with those specified by -I options and are scanned in a
20953 left-to-right order.
20954
20955 A framework directory is a directory with frameworks in it. A
20956 framework is a directory with a Headers and/or PrivateHeaders
20957 directory contained directly in it that ends in .framework. The
20958 name of a framework is the name of this directory excluding the
20959 .framework. Headers associated with the framework are found in one
20960 of those two directories, with Headers being searched first. A
20961 subframework is a framework directory that is in a framework's
20962 Frameworks directory. Includes of subframework headers can only
20963 appear in a header of a framework that contains the subframework,
20964 or in a sibling subframework header. Two subframeworks are
20965 siblings if they occur in the same framework. A subframework
20966 should not have the same name as a framework; a warning is issued
20967 if this is violated. Currently a subframework cannot have
20968 subframeworks; in the future, the mechanism may be extended to
20969 support this. The standard frameworks can be found in
20970 /System/Library/Frameworks and /Library/Frameworks. An example
20971 include looks like "#include <Framework/header.h>", where Framework
20972 denotes the name of the framework and header.h is found in the
20973 PrivateHeaders or Headers directory.
20974
20975 -iframeworkdir
20976 Like -F except the directory is a treated as a system directory.
20977 The main difference between this -iframework and -F is that with
20978 -iframework the compiler does not warn about constructs contained
20979 within header files found via dir. This option is valid only for
20980 the C family of languages.
20981
20982 -gused
20983 Emit debugging information for symbols that are used. For stabs
20984 debugging format, this enables -feliminate-unused-debug-symbols.
20985 This is by default ON.
20986
20987 -gfull
20988 Emit debugging information for all symbols and types.
20989
20990 -fconstant-cfstrings
20991 The -fconstant-cfstrings is an alias for -mconstant-cfstrings.
20992
20993 -mconstant-cfstrings
20994 When the NeXT runtime is being used (the default on these systems),
20995 override any -fconstant-string-class setting and cause "@"...""
20996 literals to be laid out as constant CoreFoundation strings.
20997
20998 -mmacosx-version-min=version
20999 The earliest version of MacOS X that this executable will run on is
21000 version. Typical values supported for version include 12, 10.12,
21001 and 10.5.8.
21002
21003 If the compiler was built to use the system's headers by default,
21004 then the default for this option is the system version on which the
21005 compiler is running, otherwise the default is to make choices that
21006 are compatible with as many systems and code bases as possible.
21007
21008 -mkernel
21009 Enable kernel development mode. The -mkernel option sets -static,
21010 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
21011 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
21012 where applicable. This mode also sets -mno-altivec, -msoft-float,
21013 -fno-builtin and -mlong-branch for PowerPC targets.
21014
21015 -mone-byte-bool
21016 Override the defaults for "bool" so that "sizeof(bool)==1". By
21017 default sizeof(bool) is 4 when compiling for Darwin/PowerPC and 1
21018 when compiling for Darwin/x86, so this option has no effect on x86.
21019
21020 Warning: The -mone-byte-bool switch causes GCC to generate code
21021 that is not binary compatible with code generated without that
21022 switch. Using this switch may require recompiling all other
21023 modules in a program, including system libraries. Use this switch
21024 to conform to a non-default data model.
21025
21026 -mfix-and-continue
21027 -ffix-and-continue
21028 -findirect-data
21029 Generate code suitable for fast turnaround development, such as to
21030 allow GDB to dynamically load .o files into already-running
21031 programs. -findirect-data and -ffix-and-continue are provided for
21032 backwards compatibility.
21033
21034 -all_load
21035 Loads all members of static archive libraries. See man ld(1) for
21036 more information.
21037
21038 -arch_errors_fatal
21039 Cause the errors having to do with files that have the wrong
21040 architecture to be fatal.
21041
21042 -bind_at_load
21043 Causes the output file to be marked such that the dynamic linker
21044 will bind all undefined references when the file is loaded or
21045 launched.
21046
21047 -bundle
21048 Produce a Mach-o bundle format file. See man ld(1) for more
21049 information.
21050
21051 -bundle_loader executable
21052 This option specifies the executable that will load the build
21053 output file being linked. See man ld(1) for more information.
21054
21055 -dynamiclib
21056 When passed this option, GCC produces a dynamic library instead of
21057 an executable when linking, using the Darwin libtool command.
21058
21059 -force_cpusubtype_ALL
21060 This causes GCC's output file to have the ALL subtype, instead of
21061 one controlled by the -mcpu or -march option.
21062
21063 -allowable_client client_name
21064 -client_name
21065 -compatibility_version
21066 -current_version
21067 -dead_strip
21068 -dependency-file
21069 -dylib_file
21070 -dylinker_install_name
21071 -dynamic
21072 -exported_symbols_list
21073 -filelist
21074 -flat_namespace
21075 -force_flat_namespace
21076 -headerpad_max_install_names
21077 -image_base
21078 -init
21079 -install_name
21080 -keep_private_externs
21081 -multi_module
21082 -multiply_defined
21083 -multiply_defined_unused
21084 -noall_load
21085 -no_dead_strip_inits_and_terms
21086 -nofixprebinding
21087 -nomultidefs
21088 -noprebind
21089 -noseglinkedit
21090 -pagezero_size
21091 -prebind
21092 -prebind_all_twolevel_modules
21093 -private_bundle
21094 -read_only_relocs
21095 -sectalign
21096 -sectobjectsymbols
21097 -whyload
21098 -seg1addr
21099 -sectcreate
21100 -sectobjectsymbols
21101 -sectorder
21102 -segaddr
21103 -segs_read_only_addr
21104 -segs_read_write_addr
21105 -seg_addr_table
21106 -seg_addr_table_filename
21107 -seglinkedit
21108 -segprot
21109 -segs_read_only_addr
21110 -segs_read_write_addr
21111 -single_module
21112 -static
21113 -sub_library
21114 -sub_umbrella
21115 -twolevel_namespace
21116 -umbrella
21117 -undefined
21118 -unexported_symbols_list
21119 -weak_reference_mismatches
21120 -whatsloaded
21121 These options are passed to the Darwin linker. The Darwin linker
21122 man page describes them in detail.
21123
21124 DEC Alpha Options
21125
21126 These -m options are defined for the DEC Alpha implementations:
21127
21128 -mno-soft-float
21129 -msoft-float
21130 Use (do not use) the hardware floating-point instructions for
21131 floating-point operations. When -msoft-float is specified,
21132 functions in libgcc.a are used to perform floating-point
21133 operations. Unless they are replaced by routines that emulate the
21134 floating-point operations, or compiled in such a way as to call
21135 such emulations routines, these routines issue floating-point
21136 operations. If you are compiling for an Alpha without floating-
21137 point operations, you must ensure that the library is built so as
21138 not to call them.
21139
21140 Note that Alpha implementations without floating-point operations
21141 are required to have floating-point registers.
21142
21143 -mfp-reg
21144 -mno-fp-regs
21145 Generate code that uses (does not use) the floating-point register
21146 set. -mno-fp-regs implies -msoft-float. If the floating-point
21147 register set is not used, floating-point operands are passed in
21148 integer registers as if they were integers and floating-point
21149 results are passed in $0 instead of $f0. This is a non-standard
21150 calling sequence, so any function with a floating-point argument or
21151 return value called by code compiled with -mno-fp-regs must also be
21152 compiled with that option.
21153
21154 A typical use of this option is building a kernel that does not
21155 use, and hence need not save and restore, any floating-point
21156 registers.
21157
21158 -mieee
21159 The Alpha architecture implements floating-point hardware optimized
21160 for maximum performance. It is mostly compliant with the IEEE
21161 floating-point standard. However, for full compliance, software
21162 assistance is required. This option generates code fully IEEE-
21163 compliant code except that the inexact-flag is not maintained (see
21164 below). If this option is turned on, the preprocessor macro
21165 "_IEEE_FP" is defined during compilation. The resulting code is
21166 less efficient but is able to correctly support denormalized
21167 numbers and exceptional IEEE values such as not-a-number and
21168 plus/minus infinity. Other Alpha compilers call this option
21169 -ieee_with_no_inexact.
21170
21171 -mieee-with-inexact
21172 This is like -mieee except the generated code also maintains the
21173 IEEE inexact-flag. Turning on this option causes the generated
21174 code to implement fully-compliant IEEE math. In addition to
21175 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
21176 On some Alpha implementations the resulting code may execute
21177 significantly slower than the code generated by default. Since
21178 there is very little code that depends on the inexact-flag, you
21179 should normally not specify this option. Other Alpha compilers
21180 call this option -ieee_with_inexact.
21181
21182 -mfp-trap-mode=trap-mode
21183 This option controls what floating-point related traps are enabled.
21184 Other Alpha compilers call this option -fptm trap-mode. The trap
21185 mode can be set to one of four values:
21186
21187 n This is the default (normal) setting. The only traps that are
21188 enabled are the ones that cannot be disabled in software (e.g.,
21189 division by zero trap).
21190
21191 u In addition to the traps enabled by n, underflow traps are
21192 enabled as well.
21193
21194 su Like u, but the instructions are marked to be safe for software
21195 completion (see Alpha architecture manual for details).
21196
21197 sui Like su, but inexact traps are enabled as well.
21198
21199 -mfp-rounding-mode=rounding-mode
21200 Selects the IEEE rounding mode. Other Alpha compilers call this
21201 option -fprm rounding-mode. The rounding-mode can be one of:
21202
21203 n Normal IEEE rounding mode. Floating-point numbers are rounded
21204 towards the nearest machine number or towards the even machine
21205 number in case of a tie.
21206
21207 m Round towards minus infinity.
21208
21209 c Chopped rounding mode. Floating-point numbers are rounded
21210 towards zero.
21211
21212 d Dynamic rounding mode. A field in the floating-point control
21213 register (fpcr, see Alpha architecture reference manual)
21214 controls the rounding mode in effect. The C library
21215 initializes this register for rounding towards plus infinity.
21216 Thus, unless your program modifies the fpcr, d corresponds to
21217 round towards plus infinity.
21218
21219 -mtrap-precision=trap-precision
21220 In the Alpha architecture, floating-point traps are imprecise.
21221 This means without software assistance it is impossible to recover
21222 from a floating trap and program execution normally needs to be
21223 terminated. GCC can generate code that can assist operating system
21224 trap handlers in determining the exact location that caused a
21225 floating-point trap. Depending on the requirements of an
21226 application, different levels of precisions can be selected:
21227
21228 p Program precision. This option is the default and means a trap
21229 handler can only identify which program caused a floating-point
21230 exception.
21231
21232 f Function precision. The trap handler can determine the
21233 function that caused a floating-point exception.
21234
21235 i Instruction precision. The trap handler can determine the
21236 exact instruction that caused a floating-point exception.
21237
21238 Other Alpha compilers provide the equivalent options called
21239 -scope_safe and -resumption_safe.
21240
21241 -mieee-conformant
21242 This option marks the generated code as IEEE conformant. You must
21243 not use this option unless you also specify -mtrap-precision=i and
21244 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
21245 to emit the line .eflag 48 in the function prologue of the
21246 generated assembly file.
21247
21248 -mbuild-constants
21249 Normally GCC examines a 32- or 64-bit integer constant to see if it
21250 can construct it from smaller constants in two or three
21251 instructions. If it cannot, it outputs the constant as a literal
21252 and generates code to load it from the data segment at run time.
21253
21254 Use this option to require GCC to construct all integer constants
21255 using code, even if it takes more instructions (the maximum is
21256 six).
21257
21258 You typically use this option to build a shared library dynamic
21259 loader. Itself a shared library, it must relocate itself in memory
21260 before it can find the variables and constants in its own data
21261 segment.
21262
21263 -mbwx
21264 -mno-bwx
21265 -mcix
21266 -mno-cix
21267 -mfix
21268 -mno-fix
21269 -mmax
21270 -mno-max
21271 Indicate whether GCC should generate code to use the optional BWX,
21272 CIX, FIX and MAX instruction sets. The default is to use the
21273 instruction sets supported by the CPU type specified via -mcpu=
21274 option or that of the CPU on which GCC was built if none is
21275 specified.
21276
21277 -mfloat-vax
21278 -mfloat-ieee
21279 Generate code that uses (does not use) VAX F and G floating-point
21280 arithmetic instead of IEEE single and double precision.
21281
21282 -mexplicit-relocs
21283 -mno-explicit-relocs
21284 Older Alpha assemblers provided no way to generate symbol
21285 relocations except via assembler macros. Use of these macros does
21286 not allow optimal instruction scheduling. GNU binutils as of
21287 version 2.12 supports a new syntax that allows the compiler to
21288 explicitly mark which relocations should apply to which
21289 instructions. This option is mostly useful for debugging, as GCC
21290 detects the capabilities of the assembler when it is built and sets
21291 the default accordingly.
21292
21293 -msmall-data
21294 -mlarge-data
21295 When -mexplicit-relocs is in effect, static data is accessed via
21296 gp-relative relocations. When -msmall-data is used, objects 8
21297 bytes long or smaller are placed in a small data area (the ".sdata"
21298 and ".sbss" sections) and are accessed via 16-bit relocations off
21299 of the $gp register. This limits the size of the small data area
21300 to 64KB, but allows the variables to be directly accessed via a
21301 single instruction.
21302
21303 The default is -mlarge-data. With this option the data area is
21304 limited to just below 2GB. Programs that require more than 2GB of
21305 data must use "malloc" or "mmap" to allocate the data in the heap
21306 instead of in the program's data segment.
21307
21308 When generating code for shared libraries, -fpic implies
21309 -msmall-data and -fPIC implies -mlarge-data.
21310
21311 -msmall-text
21312 -mlarge-text
21313 When -msmall-text is used, the compiler assumes that the code of
21314 the entire program (or shared library) fits in 4MB, and is thus
21315 reachable with a branch instruction. When -msmall-data is used,
21316 the compiler can assume that all local symbols share the same $gp
21317 value, and thus reduce the number of instructions required for a
21318 function call from 4 to 1.
21319
21320 The default is -mlarge-text.
21321
21322 -mcpu=cpu_type
21323 Set the instruction set and instruction scheduling parameters for
21324 machine type cpu_type. You can specify either the EV style name or
21325 the corresponding chip number. GCC supports scheduling parameters
21326 for the EV4, EV5 and EV6 family of processors and chooses the
21327 default values for the instruction set from the processor you
21328 specify. If you do not specify a processor type, GCC defaults to
21329 the processor on which the compiler was built.
21330
21331 Supported values for cpu_type are
21332
21333 ev4
21334 ev45
21335 21064
21336 Schedules as an EV4 and has no instruction set extensions.
21337
21338 ev5
21339 21164
21340 Schedules as an EV5 and has no instruction set extensions.
21341
21342 ev56
21343 21164a
21344 Schedules as an EV5 and supports the BWX extension.
21345
21346 pca56
21347 21164pc
21348 21164PC
21349 Schedules as an EV5 and supports the BWX and MAX extensions.
21350
21351 ev6
21352 21264
21353 Schedules as an EV6 and supports the BWX, FIX, and MAX
21354 extensions.
21355
21356 ev67
21357 21264a
21358 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
21359 extensions.
21360
21361 Native toolchains also support the value native, which selects the
21362 best architecture option for the host processor. -mcpu=native has
21363 no effect if GCC does not recognize the processor.
21364
21365 -mtune=cpu_type
21366 Set only the instruction scheduling parameters for machine type
21367 cpu_type. The instruction set is not changed.
21368
21369 Native toolchains also support the value native, which selects the
21370 best architecture option for the host processor. -mtune=native has
21371 no effect if GCC does not recognize the processor.
21372
21373 -mmemory-latency=time
21374 Sets the latency the scheduler should assume for typical memory
21375 references as seen by the application. This number is highly
21376 dependent on the memory access patterns used by the application and
21377 the size of the external cache on the machine.
21378
21379 Valid options for time are
21380
21381 number
21382 A decimal number representing clock cycles.
21383
21384 L1
21385 L2
21386 L3
21387 main
21388 The compiler contains estimates of the number of clock cycles
21389 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
21390 (also called Dcache, Scache, and Bcache), as well as to main
21391 memory. Note that L3 is only valid for EV5.
21392
21393 eBPF Options
21394
21395 -mframe-limit=bytes
21396 This specifies the hard limit for frame sizes, in bytes.
21397 Currently, the value that can be specified should be less than or
21398 equal to 32767. Defaults to whatever limit is imposed by the
21399 version of the Linux kernel targeted.
21400
21401 -mkernel=version
21402 This specifies the minimum version of the kernel that will run the
21403 compiled program. GCC uses this version to determine which
21404 instructions to use, what kernel helpers to allow, etc. Currently,
21405 version can be one of 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8,
21406 4.9, 4.10, 4.11, 4.12, 4.13, 4.14, 4.15, 4.16, 4.17, 4.18, 4.19,
21407 4.20, 5.0, 5.1, 5.2, latest and native.
21408
21409 -mbig-endian
21410 Generate code for a big-endian target.
21411
21412 -mlittle-endian
21413 Generate code for a little-endian target. This is the default.
21414
21415 -mjmpext
21416 Enable generation of extra conditional-branch instructions.
21417 Enabled for CPU v2 and above.
21418
21419 -mjmp32
21420 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
21421
21422 -malu32
21423 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
21424
21425 -mcpu=version
21426 This specifies which version of the eBPF ISA to target. Newer
21427 versions may not be supported by all kernels. The default is v3.
21428
21429 Supported values for version are:
21430
21431 v1 The first stable eBPF ISA with no special features or
21432 extensions.
21433
21434 v2 Supports the jump extensions, as in -mjmpext.
21435
21436 v3 All features of v2, plus:
21437
21438 -<32-bit jump operations, as in -mjmp32>
21439 -<32-bit ALU operations, as in -malu32>
21440 -mco-re
21441 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires
21442 and is implied by -gbtf.
21443
21444 -mno-co-re
21445 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-
21446 RE support is enabled by default when generating BTF debug
21447 information for the BPF target.
21448
21449 -mxbpf
21450 Generate code for an expanded version of BPF, which relaxes some of
21451 the restrictions imposed by the BPF architecture:
21452
21453 -<Save and restore callee-saved registers at function entry and>
21454 exit, respectively.
21455
21456 FR30 Options
21457
21458 These options are defined specifically for the FR30 port.
21459
21460 -msmall-model
21461 Use the small address space model. This can produce smaller code,
21462 but it does assume that all symbolic values and addresses fit into
21463 a 20-bit range.
21464
21465 -mno-lsim
21466 Assume that runtime support has been provided and so there is no
21467 need to include the simulator library (libsim.a) on the linker
21468 command line.
21469
21470 FT32 Options
21471
21472 These options are defined specifically for the FT32 port.
21473
21474 -msim
21475 Specifies that the program will be run on the simulator. This
21476 causes an alternate runtime startup and library to be linked. You
21477 must not use this option when generating programs that will run on
21478 real hardware; you must provide your own runtime library for
21479 whatever I/O functions are needed.
21480
21481 -mlra
21482 Enable Local Register Allocation. This is still experimental for
21483 FT32, so by default the compiler uses standard reload.
21484
21485 -mnodiv
21486 Do not use div and mod instructions.
21487
21488 -mft32b
21489 Enable use of the extended instructions of the FT32B processor.
21490
21491 -mcompress
21492 Compress all code using the Ft32B code compression scheme.
21493
21494 -mnopm
21495 Do not generate code that reads program memory.
21496
21497 FRV Options
21498
21499 -mgpr-32
21500 Only use the first 32 general-purpose registers.
21501
21502 -mgpr-64
21503 Use all 64 general-purpose registers.
21504
21505 -mfpr-32
21506 Use only the first 32 floating-point registers.
21507
21508 -mfpr-64
21509 Use all 64 floating-point registers.
21510
21511 -mhard-float
21512 Use hardware instructions for floating-point operations.
21513
21514 -msoft-float
21515 Use library routines for floating-point operations.
21516
21517 -malloc-cc
21518 Dynamically allocate condition code registers.
21519
21520 -mfixed-cc
21521 Do not try to dynamically allocate condition code registers, only
21522 use "icc0" and "fcc0".
21523
21524 -mdword
21525 Change ABI to use double word insns.
21526
21527 -mno-dword
21528 Do not use double word instructions.
21529
21530 -mdouble
21531 Use floating-point double instructions.
21532
21533 -mno-double
21534 Do not use floating-point double instructions.
21535
21536 -mmedia
21537 Use media instructions.
21538
21539 -mno-media
21540 Do not use media instructions.
21541
21542 -mmuladd
21543 Use multiply and add/subtract instructions.
21544
21545 -mno-muladd
21546 Do not use multiply and add/subtract instructions.
21547
21548 -mfdpic
21549 Select the FDPIC ABI, which uses function descriptors to represent
21550 pointers to functions. Without any PIC/PIE-related options, it
21551 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
21552 small data are within a 12-bit range from the GOT base address;
21553 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
21554 bfin-elf target, this option implies -msim.
21555
21556 -minline-plt
21557 Enable inlining of PLT entries in function calls to functions that
21558 are not known to bind locally. It has no effect without -mfdpic.
21559 It's enabled by default if optimizing for speed and compiling for
21560 shared libraries (i.e., -fPIC or -fpic), or when an optimization
21561 option such as -O3 or above is present in the command line.
21562
21563 -mTLS
21564 Assume a large TLS segment when generating thread-local code.
21565
21566 -mtls
21567 Do not assume a large TLS segment when generating thread-local
21568 code.
21569
21570 -mgprel-ro
21571 Enable the use of "GPREL" relocations in the FDPIC ABI for data
21572 that is known to be in read-only sections. It's enabled by
21573 default, except for -fpic or -fpie: even though it may help make
21574 the global offset table smaller, it trades 1 instruction for 4.
21575 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
21576 may be shared by multiple symbols, and it avoids the need for a GOT
21577 entry for the referenced symbol, so it's more likely to be a win.
21578 If it is not, -mno-gprel-ro can be used to disable it.
21579
21580 -multilib-library-pic
21581 Link with the (library, not FD) pic libraries. It's implied by
21582 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
21583 should never have to use it explicitly.
21584
21585 -mlinked-fp
21586 Follow the EABI requirement of always creating a frame pointer
21587 whenever a stack frame is allocated. This option is enabled by
21588 default and can be disabled with -mno-linked-fp.
21589
21590 -mlong-calls
21591 Use indirect addressing to call functions outside the current
21592 compilation unit. This allows the functions to be placed anywhere
21593 within the 32-bit address space.
21594
21595 -malign-labels
21596 Try to align labels to an 8-byte boundary by inserting NOPs into
21597 the previous packet. This option only has an effect when VLIW
21598 packing is enabled. It doesn't create new packets; it merely adds
21599 NOPs to existing ones.
21600
21601 -mlibrary-pic
21602 Generate position-independent EABI code.
21603
21604 -macc-4
21605 Use only the first four media accumulator registers.
21606
21607 -macc-8
21608 Use all eight media accumulator registers.
21609
21610 -mpack
21611 Pack VLIW instructions.
21612
21613 -mno-pack
21614 Do not pack VLIW instructions.
21615
21616 -mno-eflags
21617 Do not mark ABI switches in e_flags.
21618
21619 -mcond-move
21620 Enable the use of conditional-move instructions (default).
21621
21622 This switch is mainly for debugging the compiler and will likely be
21623 removed in a future version.
21624
21625 -mno-cond-move
21626 Disable the use of conditional-move instructions.
21627
21628 This switch is mainly for debugging the compiler and will likely be
21629 removed in a future version.
21630
21631 -mscc
21632 Enable the use of conditional set instructions (default).
21633
21634 This switch is mainly for debugging the compiler and will likely be
21635 removed in a future version.
21636
21637 -mno-scc
21638 Disable the use of conditional set instructions.
21639
21640 This switch is mainly for debugging the compiler and will likely be
21641 removed in a future version.
21642
21643 -mcond-exec
21644 Enable the use of conditional execution (default).
21645
21646 This switch is mainly for debugging the compiler and will likely be
21647 removed in a future version.
21648
21649 -mno-cond-exec
21650 Disable the use of conditional execution.
21651
21652 This switch is mainly for debugging the compiler and will likely be
21653 removed in a future version.
21654
21655 -mvliw-branch
21656 Run a pass to pack branches into VLIW instructions (default).
21657
21658 This switch is mainly for debugging the compiler and will likely be
21659 removed in a future version.
21660
21661 -mno-vliw-branch
21662 Do not run a pass to pack branches into VLIW instructions.
21663
21664 This switch is mainly for debugging the compiler and will likely be
21665 removed in a future version.
21666
21667 -mmulti-cond-exec
21668 Enable optimization of "&&" and "||" in conditional execution
21669 (default).
21670
21671 This switch is mainly for debugging the compiler and will likely be
21672 removed in a future version.
21673
21674 -mno-multi-cond-exec
21675 Disable optimization of "&&" and "||" in conditional execution.
21676
21677 This switch is mainly for debugging the compiler and will likely be
21678 removed in a future version.
21679
21680 -mnested-cond-exec
21681 Enable nested conditional execution optimizations (default).
21682
21683 This switch is mainly for debugging the compiler and will likely be
21684 removed in a future version.
21685
21686 -mno-nested-cond-exec
21687 Disable nested conditional execution optimizations.
21688
21689 This switch is mainly for debugging the compiler and will likely be
21690 removed in a future version.
21691
21692 -moptimize-membar
21693 This switch removes redundant "membar" instructions from the
21694 compiler-generated code. It is enabled by default.
21695
21696 -mno-optimize-membar
21697 This switch disables the automatic removal of redundant "membar"
21698 instructions from the generated code.
21699
21700 -mtomcat-stats
21701 Cause gas to print out tomcat statistics.
21702
21703 -mcpu=cpu
21704 Select the processor type for which to generate code. Possible
21705 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
21706 and simple.
21707
21708 GNU/Linux Options
21709
21710 These -m options are defined for GNU/Linux targets:
21711
21712 -mglibc
21713 Use the GNU C library. This is the default except on
21714 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
21715 targets.
21716
21717 -muclibc
21718 Use uClibc C library. This is the default on *-*-linux-*uclibc*
21719 targets.
21720
21721 -mmusl
21722 Use the musl C library. This is the default on *-*-linux-*musl*
21723 targets.
21724
21725 -mbionic
21726 Use Bionic C library. This is the default on *-*-linux-*android*
21727 targets.
21728
21729 -mandroid
21730 Compile code compatible with Android platform. This is the default
21731 on *-*-linux-*android* targets.
21732
21733 When compiling, this option enables -mbionic, -fPIC,
21734 -fno-exceptions and -fno-rtti by default. When linking, this
21735 option makes the GCC driver pass Android-specific options to the
21736 linker. Finally, this option causes the preprocessor macro
21737 "__ANDROID__" to be defined.
21738
21739 -tno-android-cc
21740 Disable compilation effects of -mandroid, i.e., do not enable
21741 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
21742
21743 -tno-android-ld
21744 Disable linking effects of -mandroid, i.e., pass standard Linux
21745 linking options to the linker.
21746
21747 H8/300 Options
21748
21749 These -m options are defined for the H8/300 implementations:
21750
21751 -mrelax
21752 Shorten some address references at link time, when possible; uses
21753 the linker option -relax.
21754
21755 -mh Generate code for the H8/300H.
21756
21757 -ms Generate code for the H8S.
21758
21759 -mn Generate code for the H8S and H8/300H in the normal mode. This
21760 switch must be used either with -mh or -ms.
21761
21762 -ms2600
21763 Generate code for the H8S/2600. This switch must be used with -ms.
21764
21765 -mexr
21766 Extended registers are stored on stack before execution of function
21767 with monitor attribute. Default option is -mexr. This option is
21768 valid only for H8S targets.
21769
21770 -mno-exr
21771 Extended registers are not stored on stack before execution of
21772 function with monitor attribute. Default option is -mno-exr. This
21773 option is valid only for H8S targets.
21774
21775 -mint32
21776 Make "int" data 32 bits by default.
21777
21778 -malign-300
21779 On the H8/300H and H8S, use the same alignment rules as for the
21780 H8/300. The default for the H8/300H and H8S is to align longs and
21781 floats on 4-byte boundaries. -malign-300 causes them to be aligned
21782 on 2-byte boundaries. This option has no effect on the H8/300.
21783
21784 HPPA Options
21785
21786 These -m options are defined for the HPPA family of computers:
21787
21788 -march=architecture-type
21789 Generate code for the specified architecture. The choices for
21790 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
21791 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
21792 system to determine the proper architecture option for your
21793 machine. Code compiled for lower numbered architectures runs on
21794 higher numbered architectures, but not the other way around.
21795
21796 -mpa-risc-1-0
21797 -mpa-risc-1-1
21798 -mpa-risc-2-0
21799 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
21800
21801 -matomic-libcalls
21802 Generate libcalls for atomic loads and stores when sync libcalls
21803 are disabled. This option is enabled by default. It only affects
21804 the generation of atomic libcalls by the HPPA backend.
21805
21806 Both the sync and libatomic libcall implementations use locking.
21807 As a result, processor stores are not atomic with respect to other
21808 atomic operations. Processor loads up to DImode are atomic with
21809 respect to other atomic operations provided they are implemented as
21810 a single access.
21811
21812 The PA-RISC architecture does not support any atomic operations in
21813 hardware except for the "ldcw" instruction. Thus, all atomic
21814 support is implemented using sync and atomic libcalls. Sync
21815 libcall support is in libgcc.a. Atomic libcall support is in
21816 libatomic.
21817
21818 This option generates "__atomic_exchange" calls for atomic stores.
21819 It also provides special handling for atomic DImode accesses on
21820 32-bit targets.
21821
21822 -mbig-switch
21823 Does nothing. Preserved for backward compatibility.
21824
21825 -mcaller-copies
21826 The caller copies function arguments passed by hidden reference.
21827 This option should be used with care as it is not compatible with
21828 the default 32-bit runtime. However, only aggregates larger than
21829 eight bytes are passed by hidden reference and the option provides
21830 better compatibility with OpenMP.
21831
21832 -mcoherent-ldcw
21833 Use ldcw/ldcd coherent cache-control hint.
21834
21835 -mdisable-fpregs
21836 Disable floating-point registers. Equivalent to "-msoft-float".
21837
21838 -mdisable-indexing
21839 Prevent the compiler from using indexing address modes. This
21840 avoids some rather obscure problems when compiling MIG generated
21841 code under MACH.
21842
21843 -mfast-indirect-calls
21844 Generate code that assumes calls never cross space boundaries.
21845 This allows GCC to emit code that performs faster indirect calls.
21846
21847 This option does not work in the presence of shared libraries or
21848 nested functions.
21849
21850 -mfixed-range=register-range
21851 Generate code treating the given register range as fixed registers.
21852 A fixed register is one that the register allocator cannot use.
21853 This is useful when compiling kernel code. A register range is
21854 specified as two registers separated by a dash. Multiple register
21855 ranges can be specified separated by a comma.
21856
21857 -mgas
21858 Enable the use of assembler directives only GAS understands.
21859
21860 -mgnu-ld
21861 Use options specific to GNU ld. This passes -shared to ld when
21862 building a shared library. It is the default when GCC is
21863 configured, explicitly or implicitly, with the GNU linker. This
21864 option does not affect which ld is called; it only changes what
21865 parameters are passed to that ld. The ld that is called is
21866 determined by the --with-ld configure option, GCC's program search
21867 path, and finally by the user's PATH. The linker used by GCC can
21868 be printed using which `gcc -print-prog-name=ld`. This option is
21869 only available on the 64-bit HP-UX GCC, i.e. configured with
21870 hppa*64*-*-hpux*.
21871
21872 -mhp-ld
21873 Use options specific to HP ld. This passes -b to ld when building
21874 a shared library and passes +Accept TypeMismatch to ld on all
21875 links. It is the default when GCC is configured, explicitly or
21876 implicitly, with the HP linker. This option does not affect which
21877 ld is called; it only changes what parameters are passed to that
21878 ld. The ld that is called is determined by the --with-ld configure
21879 option, GCC's program search path, and finally by the user's PATH.
21880 The linker used by GCC can be printed using which `gcc
21881 -print-prog-name=ld`. This option is only available on the 64-bit
21882 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
21883
21884 -mlinker-opt
21885 Enable the optimization pass in the HP-UX linker. Note this makes
21886 symbolic debugging impossible. It also triggers a bug in the HP-UX
21887 8 and HP-UX 9 linkers in which they give bogus error messages when
21888 linking some programs.
21889
21890 -mlong-calls
21891 Generate code that uses long call sequences. This ensures that a
21892 call is always able to reach linker generated stubs. The default
21893 is to generate long calls only when the distance from the call site
21894 to the beginning of the function or translation unit, as the case
21895 may be, exceeds a predefined limit set by the branch type being
21896 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
21897 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
21898 always limited at 240,000 bytes.
21899
21900 Distances are measured from the beginning of functions when using
21901 the -ffunction-sections option, or when using the -mgas and
21902 -mno-portable-runtime options together under HP-UX with the SOM
21903 linker.
21904
21905 It is normally not desirable to use this option as it degrades
21906 performance. However, it may be useful in large applications,
21907 particularly when partial linking is used to build the application.
21908
21909 The types of long calls used depends on the capabilities of the
21910 assembler and linker, and the type of code being generated. The
21911 impact on systems that support long absolute calls, and long pic
21912 symbol-difference or pc-relative calls should be relatively small.
21913 However, an indirect call is used on 32-bit ELF systems in pic code
21914 and it is quite long.
21915
21916 -mlong-load-store
21917 Generate 3-instruction load and store sequences as sometimes
21918 required by the HP-UX 10 linker. This is equivalent to the +k
21919 option to the HP compilers.
21920
21921 -mjump-in-delay
21922 This option is ignored and provided for compatibility purposes
21923 only.
21924
21925 -mno-space-regs
21926 Generate code that assumes the target has no space registers. This
21927 allows GCC to generate faster indirect calls and use unscaled index
21928 address modes.
21929
21930 Such code is suitable for level 0 PA systems and kernels.
21931
21932 -mordered
21933 Assume memory references are ordered and barriers are not needed.
21934
21935 -mportable-runtime
21936 Use the portable calling conventions proposed by HP for ELF
21937 systems.
21938
21939 -mschedule=cpu-type
21940 Schedule code according to the constraints for the machine type
21941 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
21942 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
21943 to determine the proper scheduling option for your machine. The
21944 default scheduling is 8000.
21945
21946 -msio
21947 Generate the predefine, "_SIO", for server IO. The default is
21948 -mwsio. This generates the predefines, "__hp9000s700",
21949 "__hp9000s700__" and "_WSIO", for workstation IO. These options
21950 are available under HP-UX and HI-UX.
21951
21952 -msoft-float
21953 Generate output containing library calls for floating point.
21954 Warning: the requisite libraries are not available for all HPPA
21955 targets. Normally the facilities of the machine's usual C compiler
21956 are used, but this cannot be done directly in cross-compilation.
21957 You must make your own arrangements to provide suitable library
21958 functions for cross-compilation.
21959
21960 -msoft-float changes the calling convention in the output file;
21961 therefore, it is only useful if you compile all of a program with
21962 this option. In particular, you need to compile libgcc.a, the
21963 library that comes with GCC, with -msoft-float in order for this to
21964 work.
21965
21966 -msoft-mult
21967 Use software integer multiplication.
21968
21969 This disables the use of the "xmpyu" instruction.
21970
21971 -munix=unix-std
21972 Generate compiler predefines and select a startfile for the
21973 specified UNIX standard. The choices for unix-std are 93, 95 and
21974 98. 93 is supported on all HP-UX versions. 95 is available on HP-
21975 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
21976 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
21977 11.00, and 98 for HP-UX 11.11 and later.
21978
21979 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
21980 -munix=95 provides additional predefines for "XOPEN_UNIX" and
21981 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
21982 provides additional predefines for "_XOPEN_UNIX",
21983 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
21984 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
21985
21986 It is important to note that this option changes the interfaces for
21987 various library routines. It also affects the operational behavior
21988 of the C library. Thus, extreme care is needed in using this
21989 option.
21990
21991 Library code that is intended to operate with more than one UNIX
21992 standard must test, set and restore the variable
21993 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
21994 provide this capability.
21995
21996 -nolibdld
21997 Suppress the generation of link options to search libdld.sl when
21998 the -static option is specified on HP-UX 10 and later.
21999
22000 -static
22001 The HP-UX implementation of setlocale in libc has a dependency on
22002 libdld.sl. There isn't an archive version of libdld.sl. Thus,
22003 when the -static option is specified, special link options are
22004 needed to resolve this dependency.
22005
22006 On HP-UX 10 and later, the GCC driver adds the necessary options to
22007 link with libdld.sl when the -static option is specified. This
22008 causes the resulting binary to be dynamic. On the 64-bit port, the
22009 linkers generate dynamic binaries by default in any case. The
22010 -nolibdld option can be used to prevent the GCC driver from adding
22011 these link options.
22012
22013 -threads
22014 Add support for multithreading with the dce thread library under
22015 HP-UX. This option sets flags for both the preprocessor and
22016 linker.
22017
22018 IA-64 Options
22019
22020 These are the -m options defined for the Intel IA-64 architecture.
22021
22022 -mbig-endian
22023 Generate code for a big-endian target. This is the default for HP-
22024 UX.
22025
22026 -mlittle-endian
22027 Generate code for a little-endian target. This is the default for
22028 AIX5 and GNU/Linux.
22029
22030 -mgnu-as
22031 -mno-gnu-as
22032 Generate (or don't) code for the GNU assembler. This is the
22033 default.
22034
22035 -mgnu-ld
22036 -mno-gnu-ld
22037 Generate (or don't) code for the GNU linker. This is the default.
22038
22039 -mno-pic
22040 Generate code that does not use a global pointer register. The
22041 result is not position independent code, and violates the IA-64
22042 ABI.
22043
22044 -mvolatile-asm-stop
22045 -mno-volatile-asm-stop
22046 Generate (or don't) a stop bit immediately before and after
22047 volatile asm statements.
22048
22049 -mregister-names
22050 -mno-register-names
22051 Generate (or don't) in, loc, and out register names for the stacked
22052 registers. This may make assembler output more readable.
22053
22054 -mno-sdata
22055 -msdata
22056 Disable (or enable) optimizations that use the small data section.
22057 This may be useful for working around optimizer bugs.
22058
22059 -mconstant-gp
22060 Generate code that uses a single constant global pointer value.
22061 This is useful when compiling kernel code.
22062
22063 -mauto-pic
22064 Generate code that is self-relocatable. This implies
22065 -mconstant-gp. This is useful when compiling firmware code.
22066
22067 -minline-float-divide-min-latency
22068 Generate code for inline divides of floating-point values using the
22069 minimum latency algorithm.
22070
22071 -minline-float-divide-max-throughput
22072 Generate code for inline divides of floating-point values using the
22073 maximum throughput algorithm.
22074
22075 -mno-inline-float-divide
22076 Do not generate inline code for divides of floating-point values.
22077
22078 -minline-int-divide-min-latency
22079 Generate code for inline divides of integer values using the
22080 minimum latency algorithm.
22081
22082 -minline-int-divide-max-throughput
22083 Generate code for inline divides of integer values using the
22084 maximum throughput algorithm.
22085
22086 -mno-inline-int-divide
22087 Do not generate inline code for divides of integer values.
22088
22089 -minline-sqrt-min-latency
22090 Generate code for inline square roots using the minimum latency
22091 algorithm.
22092
22093 -minline-sqrt-max-throughput
22094 Generate code for inline square roots using the maximum throughput
22095 algorithm.
22096
22097 -mno-inline-sqrt
22098 Do not generate inline code for "sqrt".
22099
22100 -mfused-madd
22101 -mno-fused-madd
22102 Do (don't) generate code that uses the fused multiply/add or
22103 multiply/subtract instructions. The default is to use these
22104 instructions.
22105
22106 -mno-dwarf2-asm
22107 -mdwarf2-asm
22108 Don't (or do) generate assembler code for the DWARF line number
22109 debugging info. This may be useful when not using the GNU
22110 assembler.
22111
22112 -mearly-stop-bits
22113 -mno-early-stop-bits
22114 Allow stop bits to be placed earlier than immediately preceding the
22115 instruction that triggered the stop bit. This can improve
22116 instruction scheduling, but does not always do so.
22117
22118 -mfixed-range=register-range
22119 Generate code treating the given register range as fixed registers.
22120 A fixed register is one that the register allocator cannot use.
22121 This is useful when compiling kernel code. A register range is
22122 specified as two registers separated by a dash. Multiple register
22123 ranges can be specified separated by a comma.
22124
22125 -mtls-size=tls-size
22126 Specify bit size of immediate TLS offsets. Valid values are 14,
22127 22, and 64.
22128
22129 -mtune=cpu-type
22130 Tune the instruction scheduling for a particular CPU, Valid values
22131 are itanium, itanium1, merced, itanium2, and mckinley.
22132
22133 -milp32
22134 -mlp64
22135 Generate code for a 32-bit or 64-bit environment. The 32-bit
22136 environment sets int, long and pointer to 32 bits. The 64-bit
22137 environment sets int to 32 bits and long and pointer to 64 bits.
22138 These are HP-UX specific flags.
22139
22140 -mno-sched-br-data-spec
22141 -msched-br-data-spec
22142 (Dis/En)able data speculative scheduling before reload. This
22143 results in generation of "ld.a" instructions and the corresponding
22144 check instructions ("ld.c" / "chk.a"). The default setting is
22145 disabled.
22146
22147 -msched-ar-data-spec
22148 -mno-sched-ar-data-spec
22149 (En/Dis)able data speculative scheduling after reload. This
22150 results in generation of "ld.a" instructions and the corresponding
22151 check instructions ("ld.c" / "chk.a"). The default setting is
22152 enabled.
22153
22154 -mno-sched-control-spec
22155 -msched-control-spec
22156 (Dis/En)able control speculative scheduling. This feature is
22157 available only during region scheduling (i.e. before reload). This
22158 results in generation of the "ld.s" instructions and the
22159 corresponding check instructions "chk.s". The default setting is
22160 disabled.
22161
22162 -msched-br-in-data-spec
22163 -mno-sched-br-in-data-spec
22164 (En/Dis)able speculative scheduling of the instructions that are
22165 dependent on the data speculative loads before reload. This is
22166 effective only with -msched-br-data-spec enabled. The default
22167 setting is enabled.
22168
22169 -msched-ar-in-data-spec
22170 -mno-sched-ar-in-data-spec
22171 (En/Dis)able speculative scheduling of the instructions that are
22172 dependent on the data speculative loads after reload. This is
22173 effective only with -msched-ar-data-spec enabled. The default
22174 setting is enabled.
22175
22176 -msched-in-control-spec
22177 -mno-sched-in-control-spec
22178 (En/Dis)able speculative scheduling of the instructions that are
22179 dependent on the control speculative loads. This is effective only
22180 with -msched-control-spec enabled. The default setting is enabled.
22181
22182 -mno-sched-prefer-non-data-spec-insns
22183 -msched-prefer-non-data-spec-insns
22184 If enabled, data-speculative instructions are chosen for schedule
22185 only if there are no other choices at the moment. This makes the
22186 use of the data speculation much more conservative. The default
22187 setting is disabled.
22188
22189 -mno-sched-prefer-non-control-spec-insns
22190 -msched-prefer-non-control-spec-insns
22191 If enabled, control-speculative instructions are chosen for
22192 schedule only if there are no other choices at the moment. This
22193 makes the use of the control speculation much more conservative.
22194 The default setting is disabled.
22195
22196 -mno-sched-count-spec-in-critical-path
22197 -msched-count-spec-in-critical-path
22198 If enabled, speculative dependencies are considered during
22199 computation of the instructions priorities. This makes the use of
22200 the speculation a bit more conservative. The default setting is
22201 disabled.
22202
22203 -msched-spec-ldc
22204 Use a simple data speculation check. This option is on by default.
22205
22206 -msched-control-spec-ldc
22207 Use a simple check for control speculation. This option is on by
22208 default.
22209
22210 -msched-stop-bits-after-every-cycle
22211 Place a stop bit after every cycle when scheduling. This option is
22212 on by default.
22213
22214 -msched-fp-mem-deps-zero-cost
22215 Assume that floating-point stores and loads are not likely to cause
22216 a conflict when placed into the same instruction group. This
22217 option is disabled by default.
22218
22219 -msel-sched-dont-check-control-spec
22220 Generate checks for control speculation in selective scheduling.
22221 This flag is disabled by default.
22222
22223 -msched-max-memory-insns=max-insns
22224 Limit on the number of memory insns per instruction group, giving
22225 lower priority to subsequent memory insns attempting to schedule in
22226 the same instruction group. Frequently useful to prevent cache bank
22227 conflicts. The default value is 1.
22228
22229 -msched-max-memory-insns-hard-limit
22230 Makes the limit specified by msched-max-memory-insns a hard limit,
22231 disallowing more than that number in an instruction group.
22232 Otherwise, the limit is "soft", meaning that non-memory operations
22233 are preferred when the limit is reached, but memory operations may
22234 still be scheduled.
22235
22236 LM32 Options
22237
22238 These -m options are defined for the LatticeMico32 architecture:
22239
22240 -mbarrel-shift-enabled
22241 Enable barrel-shift instructions.
22242
22243 -mdivide-enabled
22244 Enable divide and modulus instructions.
22245
22246 -mmultiply-enabled
22247 Enable multiply instructions.
22248
22249 -msign-extend-enabled
22250 Enable sign extend instructions.
22251
22252 -muser-enabled
22253 Enable user-defined instructions.
22254
22255 LoongArch Options
22256
22257 These command-line options are defined for LoongArch targets:
22258
22259 -march=cpu-type
22260 Generate instructions for the machine type cpu-type. In contrast
22261 to -mtune=cpu-type, which merely tunes the generated code for the
22262 specified cpu-type, -march=cpu-type allows GCC to generate code
22263 that may not run at all on processors other than the one indicated.
22264 Specifying -march=cpu-type implies -mtune=cpu-type, except where
22265 noted otherwise.
22266
22267 The choices for cpu-type are:
22268
22269 native
22270 This selects the CPU to generate code for at compilation time
22271 by determining the processor type of the compiling machine.
22272 Using -march=native enables all instruction subsets supported
22273 by the local machine (hence the result might not run on
22274 different machines). Using -mtune=native produces code
22275 optimized for the local machine under the constraints of the
22276 selected instruction set.
22277
22278 loongarch64
22279 A generic CPU with 64-bit extensions.
22280
22281 la464
22282 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
22283
22284 -mtune=cpu-type
22285 Optimize the output for the given processor, specified by
22286 microarchitecture name.
22287
22288 -mabi=base-abi-type
22289 Generate code for the specified calling convention. base-abi-type
22290 can be one of:
22291
22292 lp64d
22293 Uses 64-bit general purpose registers and 32/64-bit floating-
22294 point registers for parameter passing. Data model is LP64,
22295 where int is 32 bits, while long int and pointers are 64 bits.
22296
22297 lp64f
22298 Uses 64-bit general purpose registers and 32-bit floating-point
22299 registers for parameter passing. Data model is LP64, where int
22300 is 32 bits, while long int and pointers are 64 bits.
22301
22302 lp64s
22303 Uses 64-bit general purpose registers and no floating-point
22304 registers for parameter passing. Data model is LP64, where int
22305 is 32 bits, while long int and pointers are 64 bits.
22306
22307 -mfpu=fpu-type
22308 Generate code for the specified FPU type, which can be one of:
22309
22310 64 Allow the use of hardware floating-point instructions for
22311 32-bit and 64-bit operations.
22312
22313 32 Allow the use of hardware floating-point instructions for
22314 32-bit operations.
22315
22316 none
22317 0 Prevent the use of hardware floating-point instructions.
22318
22319 -msoft-float
22320 Force -mfpu=none and prevents the use of floating-point registers
22321 for parameter passing. This option may change the target ABI.
22322
22323 -msingle-float
22324 Force -mfpu=32 and allow the use of 32-bit floating-point registers
22325 for parameter passing. This option may change the target ABI.
22326
22327 -mdouble-float
22328 Force -mfpu=64 and allow the use of 32/64-bit floating-point
22329 registers for parameter passing. This option may change the target
22330 ABI.
22331
22332 -mbranch-cost=n
22333 Set the cost of branches to roughly n instructions.
22334
22335 -mcheck-zero-division
22336 -mno-check-zero-divison
22337 Trap (do not trap) on integer division by zero. The default is
22338 -mcheck-zero-division for -O0 or -Og, and -mno-check-zero-division
22339 for other optimization levels.
22340
22341 -mcond-move-int
22342 -mno-cond-move-int
22343 Conditional moves for integral data in general-purpose registers
22344 are enabled (disabled). The default is -mcond-move-int.
22345
22346 -mcond-move-float
22347 -mno-cond-move-float
22348 Conditional moves for floating-point registers are enabled
22349 (disabled). The default is -mcond-move-float.
22350
22351 -mmemcpy
22352 -mno-memcpy
22353 Force (do not force) the use of "memcpy" for non-trivial block
22354 moves. The default is -mno-memcpy, which allows GCC to inline most
22355 constant-sized copies. Setting optimization level to -Os also
22356 forces the use of "memcpy", but -mno-memcpy may override this
22357 behavior if explicitly specified, regardless of the order these
22358 options on the command line.
22359
22360 -mstrict-align
22361 -mno-strict-align
22362 Avoid or allow generating memory accesses that may not be aligned
22363 on a natural object boundary as described in the architecture
22364 specification. The default is -mno-strict-align.
22365
22366 -msmall-data-limit=number
22367 Put global and static data smaller than number bytes into a special
22368 section (on some targets). The default value is 0.
22369
22370 -mmax-inline-memcpy-size=n
22371 Inline all block moves (such as calls to "memcpy" or structure
22372 copies) less than or equal to n bytes. The default value of n is
22373 1024.
22374
22375 -mcmodel=code-model
22376 Set the code model to one of:
22377
22378 tiny-static (Not implemented yet)
22379 tiny (Not implemented yet)
22380 normal
22381 The text segment must be within 128MB addressing space. The
22382 data segment must be within 2GB addressing space.
22383
22384 medium
22385 The text segment and data segment must be within 2GB addressing
22386 space.
22387
22388 large (Not implemented yet)
22389 extreme
22390 This mode does not limit the size of the code segment and data
22391 segment. The -mcmodel=extreme option is incompatible with
22392 -fplt and -mno-explicit-relocs.
22393
22394 The default code model is "normal".
22395
22396 -mexplicit-relocs
22397 -mno-explicit-relocs
22398 Use or do not use assembler relocation operators when dealing with
22399 symbolic addresses. The alternative is to use assembler macros
22400 instead, which may limit optimization. The default value for the
22401 option is determined during GCC build-time by detecting
22402 corresponding assembler support: "-mexplicit-relocs" if said
22403 support is present, "-mno-explicit-relocs" otherwise. This option
22404 is mostly useful for debugging, or interoperation with assemblers
22405 different from the build-time one.
22406
22407 -mdirect-extern-access
22408 -mno-direct-extern-access
22409 Do not use or use GOT to access external symbols. The default is
22410 -mno-direct-extern-access: GOT is used for external symbols with
22411 default visibility, but not used for other external symbols.
22412
22413 With -mdirect-extern-access, GOT is not used and all external
22414 symbols are PC-relatively addressed. It is only suitable for
22415 environments where no dynamic link is performed, like firmwares, OS
22416 kernels, executables linked with -static or -static-pie.
22417 -mdirect-extern-access is not compatible with -fPIC or -fpic.
22418
22419 M32C Options
22420
22421 -mcpu=name
22422 Select the CPU for which code is generated. name may be one of r8c
22423 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
22424 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
22425
22426 -msim
22427 Specifies that the program will be run on the simulator. This
22428 causes an alternate runtime library to be linked in which supports,
22429 for example, file I/O. You must not use this option when
22430 generating programs that will run on real hardware; you must
22431 provide your own runtime library for whatever I/O functions are
22432 needed.
22433
22434 -memregs=number
22435 Specifies the number of memory-based pseudo-registers GCC uses
22436 during code generation. These pseudo-registers are used like real
22437 registers, so there is a tradeoff between GCC's ability to fit the
22438 code into available registers, and the performance penalty of using
22439 memory instead of registers. Note that all modules in a program
22440 must be compiled with the same value for this option. Because of
22441 that, you must not use this option with GCC's default runtime
22442 libraries.
22443
22444 M32R/D Options
22445
22446 These -m options are defined for Renesas M32R/D architectures:
22447
22448 -m32r2
22449 Generate code for the M32R/2.
22450
22451 -m32rx
22452 Generate code for the M32R/X.
22453
22454 -m32r
22455 Generate code for the M32R. This is the default.
22456
22457 -mmodel=small
22458 Assume all objects live in the lower 16MB of memory (so that their
22459 addresses can be loaded with the "ld24" instruction), and assume
22460 all subroutines are reachable with the "bl" instruction. This is
22461 the default.
22462
22463 The addressability of a particular object can be set with the
22464 "model" attribute.
22465
22466 -mmodel=medium
22467 Assume objects may be anywhere in the 32-bit address space (the
22468 compiler generates "seth/add3" instructions to load their
22469 addresses), and assume all subroutines are reachable with the "bl"
22470 instruction.
22471
22472 -mmodel=large
22473 Assume objects may be anywhere in the 32-bit address space (the
22474 compiler generates "seth/add3" instructions to load their
22475 addresses), and assume subroutines may not be reachable with the
22476 "bl" instruction (the compiler generates the much slower
22477 "seth/add3/jl" instruction sequence).
22478
22479 -msdata=none
22480 Disable use of the small data area. Variables are put into one of
22481 ".data", ".bss", or ".rodata" (unless the "section" attribute has
22482 been specified). This is the default.
22483
22484 The small data area consists of sections ".sdata" and ".sbss".
22485 Objects may be explicitly put in the small data area with the
22486 "section" attribute using one of these sections.
22487
22488 -msdata=sdata
22489 Put small global and static data in the small data area, but do not
22490 generate special code to reference them.
22491
22492 -msdata=use
22493 Put small global and static data in the small data area, and
22494 generate special instructions to reference them.
22495
22496 -G num
22497 Put global and static objects less than or equal to num bytes into
22498 the small data or BSS sections instead of the normal data or BSS
22499 sections. The default value of num is 8. The -msdata option must
22500 be set to one of sdata or use for this option to have any effect.
22501
22502 All modules should be compiled with the same -G num value.
22503 Compiling with different values of num may or may not work; if it
22504 doesn't the linker gives an error message---incorrect code is not
22505 generated.
22506
22507 -mdebug
22508 Makes the M32R-specific code in the compiler display some
22509 statistics that might help in debugging programs.
22510
22511 -malign-loops
22512 Align all loops to a 32-byte boundary.
22513
22514 -mno-align-loops
22515 Do not enforce a 32-byte alignment for loops. This is the default.
22516
22517 -missue-rate=number
22518 Issue number instructions per cycle. number can only be 1 or 2.
22519
22520 -mbranch-cost=number
22521 number can only be 1 or 2. If it is 1 then branches are preferred
22522 over conditional code, if it is 2, then the opposite applies.
22523
22524 -mflush-trap=number
22525 Specifies the trap number to use to flush the cache. The default
22526 is 12. Valid numbers are between 0 and 15 inclusive.
22527
22528 -mno-flush-trap
22529 Specifies that the cache cannot be flushed by using a trap.
22530
22531 -mflush-func=name
22532 Specifies the name of the operating system function to call to
22533 flush the cache. The default is _flush_cache, but a function call
22534 is only used if a trap is not available.
22535
22536 -mno-flush-func
22537 Indicates that there is no OS function for flushing the cache.
22538
22539 M680x0 Options
22540
22541 These are the -m options defined for M680x0 and ColdFire processors.
22542 The default settings depend on which architecture was selected when the
22543 compiler was configured; the defaults for the most common choices are
22544 given below.
22545
22546 -march=arch
22547 Generate code for a specific M680x0 or ColdFire instruction set
22548 architecture. Permissible values of arch for M680x0 architectures
22549 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
22550 architectures are selected according to Freescale's ISA
22551 classification and the permissible values are: isaa, isaaplus, isab
22552 and isac.
22553
22554 GCC defines a macro "__mcfarch__" whenever it is generating code
22555 for a ColdFire target. The arch in this macro is one of the -march
22556 arguments given above.
22557
22558 When used together, -march and -mtune select code that runs on a
22559 family of similar processors but that is optimized for a particular
22560 microarchitecture.
22561
22562 -mcpu=cpu
22563 Generate code for a specific M680x0 or ColdFire processor. The
22564 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
22565 68332 and cpu32. The ColdFire cpus are given by the table below,
22566 which also classifies the CPUs into families:
22567
22568 Family : -mcpu arguments
22569 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
22570 5206 : 5202 5204 5206
22571 5206e : 5206e
22572 5208 : 5207 5208
22573 5211a : 5210a 5211a
22574 5213 : 5211 5212 5213
22575 5216 : 5214 5216
22576 52235 : 52230 52231 52232 52233 52234 52235
22577 5225 : 5224 5225
22578 52259 : 52252 52254 52255 52256 52258 52259
22579 5235 : 5232 5233 5234 5235 523x
22580 5249 : 5249
22581 5250 : 5250
22582 5271 : 5270 5271
22583 5272 : 5272
22584 5275 : 5274 5275
22585 5282 : 5280 5281 5282 528x
22586 53017 : 53011 53012 53013 53014 53015 53016 53017
22587 5307 : 5307
22588 5329 : 5327 5328 5329 532x
22589 5373 : 5372 5373 537x
22590 5407 : 5407
22591 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
22592 5485
22593
22594 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
22595 Other combinations of -mcpu and -march are rejected.
22596
22597 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
22598 selected. It also defines "__mcf_family_family", where the value
22599 of family is given by the table above.
22600
22601 -mtune=tune
22602 Tune the code for a particular microarchitecture within the
22603 constraints set by -march and -mcpu. The M680x0 microarchitectures
22604 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
22605 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
22606
22607 You can also use -mtune=68020-40 for code that needs to run
22608 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
22609 is similar but includes 68060 targets as well. These two options
22610 select the same tuning decisions as -m68020-40 and -m68020-60
22611 respectively.
22612
22613 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
22614 680x0 architecture arch. It also defines "mcarch" unless either
22615 -ansi or a non-GNU -std option is used. If GCC is tuning for a
22616 range of architectures, as selected by -mtune=68020-40 or
22617 -mtune=68020-60, it defines the macros for every architecture in
22618 the range.
22619
22620 GCC also defines the macro "__muarch__" when tuning for ColdFire
22621 microarchitecture uarch, where uarch is one of the arguments given
22622 above.
22623
22624 -m68000
22625 -mc68000
22626 Generate output for a 68000. This is the default when the compiler
22627 is configured for 68000-based systems. It is equivalent to
22628 -march=68000.
22629
22630 Use this option for microcontrollers with a 68000 or EC000 core,
22631 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
22632
22633 -m68010
22634 Generate output for a 68010. This is the default when the compiler
22635 is configured for 68010-based systems. It is equivalent to
22636 -march=68010.
22637
22638 -m68020
22639 -mc68020
22640 Generate output for a 68020. This is the default when the compiler
22641 is configured for 68020-based systems. It is equivalent to
22642 -march=68020.
22643
22644 -m68030
22645 Generate output for a 68030. This is the default when the compiler
22646 is configured for 68030-based systems. It is equivalent to
22647 -march=68030.
22648
22649 -m68040
22650 Generate output for a 68040. This is the default when the compiler
22651 is configured for 68040-based systems. It is equivalent to
22652 -march=68040.
22653
22654 This option inhibits the use of 68881/68882 instructions that have
22655 to be emulated by software on the 68040. Use this option if your
22656 68040 does not have code to emulate those instructions.
22657
22658 -m68060
22659 Generate output for a 68060. This is the default when the compiler
22660 is configured for 68060-based systems. It is equivalent to
22661 -march=68060.
22662
22663 This option inhibits the use of 68020 and 68881/68882 instructions
22664 that have to be emulated by software on the 68060. Use this option
22665 if your 68060 does not have code to emulate those instructions.
22666
22667 -mcpu32
22668 Generate output for a CPU32. This is the default when the compiler
22669 is configured for CPU32-based systems. It is equivalent to
22670 -march=cpu32.
22671
22672 Use this option for microcontrollers with a CPU32 or CPU32+ core,
22673 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
22674 68341, 68349 and 68360.
22675
22676 -m5200
22677 Generate output for a 520X ColdFire CPU. This is the default when
22678 the compiler is configured for 520X-based systems. It is
22679 equivalent to -mcpu=5206, and is now deprecated in favor of that
22680 option.
22681
22682 Use this option for microcontroller with a 5200 core, including the
22683 MCF5202, MCF5203, MCF5204 and MCF5206.
22684
22685 -m5206e
22686 Generate output for a 5206e ColdFire CPU. The option is now
22687 deprecated in favor of the equivalent -mcpu=5206e.
22688
22689 -m528x
22690 Generate output for a member of the ColdFire 528X family. The
22691 option is now deprecated in favor of the equivalent -mcpu=528x.
22692
22693 -m5307
22694 Generate output for a ColdFire 5307 CPU. The option is now
22695 deprecated in favor of the equivalent -mcpu=5307.
22696
22697 -m5407
22698 Generate output for a ColdFire 5407 CPU. The option is now
22699 deprecated in favor of the equivalent -mcpu=5407.
22700
22701 -mcfv4e
22702 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
22703 This includes use of hardware floating-point instructions. The
22704 option is equivalent to -mcpu=547x, and is now deprecated in favor
22705 of that option.
22706
22707 -m68020-40
22708 Generate output for a 68040, without using any of the new
22709 instructions. This results in code that can run relatively
22710 efficiently on either a 68020/68881 or a 68030 or a 68040. The
22711 generated code does use the 68881 instructions that are emulated on
22712 the 68040.
22713
22714 The option is equivalent to -march=68020 -mtune=68020-40.
22715
22716 -m68020-60
22717 Generate output for a 68060, without using any of the new
22718 instructions. This results in code that can run relatively
22719 efficiently on either a 68020/68881 or a 68030 or a 68040. The
22720 generated code does use the 68881 instructions that are emulated on
22721 the 68060.
22722
22723 The option is equivalent to -march=68020 -mtune=68020-60.
22724
22725 -mhard-float
22726 -m68881
22727 Generate floating-point instructions. This is the default for
22728 68020 and above, and for ColdFire devices that have an FPU. It
22729 defines the macro "__HAVE_68881__" on M680x0 targets and
22730 "__mcffpu__" on ColdFire targets.
22731
22732 -msoft-float
22733 Do not generate floating-point instructions; use library calls
22734 instead. This is the default for 68000, 68010, and 68832 targets.
22735 It is also the default for ColdFire devices that have no FPU.
22736
22737 -mdiv
22738 -mno-div
22739 Generate (do not generate) ColdFire hardware divide and remainder
22740 instructions. If -march is used without -mcpu, the default is "on"
22741 for ColdFire architectures and "off" for M680x0 architectures.
22742 Otherwise, the default is taken from the target CPU (either the
22743 default CPU, or the one specified by -mcpu). For example, the
22744 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
22745
22746 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
22747
22748 -mshort
22749 Consider type "int" to be 16 bits wide, like "short int".
22750 Additionally, parameters passed on the stack are also aligned to a
22751 16-bit boundary even on targets whose API mandates promotion to
22752 32-bit.
22753
22754 -mno-short
22755 Do not consider type "int" to be 16 bits wide. This is the
22756 default.
22757
22758 -mnobitfield
22759 -mno-bitfield
22760 Do not use the bit-field instructions. The -m68000, -mcpu32 and
22761 -m5200 options imply -mnobitfield.
22762
22763 -mbitfield
22764 Do use the bit-field instructions. The -m68020 option implies
22765 -mbitfield. This is the default if you use a configuration
22766 designed for a 68020.
22767
22768 -mrtd
22769 Use a different function-calling convention, in which functions
22770 that take a fixed number of arguments return with the "rtd"
22771 instruction, which pops their arguments while returning. This
22772 saves one instruction in the caller since there is no need to pop
22773 the arguments there.
22774
22775 This calling convention is incompatible with the one normally used
22776 on Unix, so you cannot use it if you need to call libraries
22777 compiled with the Unix compiler.
22778
22779 Also, you must provide function prototypes for all functions that
22780 take variable numbers of arguments (including "printf"); otherwise
22781 incorrect code is generated for calls to those functions.
22782
22783 In addition, seriously incorrect code results if you call a
22784 function with too many arguments. (Normally, extra arguments are
22785 harmlessly ignored.)
22786
22787 The "rtd" instruction is supported by the 68010, 68020, 68030,
22788 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
22789
22790 The default is -mno-rtd.
22791
22792 -malign-int
22793 -mno-align-int
22794 Control whether GCC aligns "int", "long", "long long", "float",
22795 "double", and "long double" variables on a 32-bit boundary
22796 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
22797 variables on 32-bit boundaries produces code that runs somewhat
22798 faster on processors with 32-bit busses at the expense of more
22799 memory.
22800
22801 Warning: if you use the -malign-int switch, GCC aligns structures
22802 containing the above types differently than most published
22803 application binary interface specifications for the m68k.
22804
22805 Use the pc-relative addressing mode of the 68000 directly, instead
22806 of using a global offset table. At present, this option implies
22807 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
22808 -fPIC is not presently supported with -mpcrel, though this could be
22809 supported for 68020 and higher processors.
22810
22811 -mno-strict-align
22812 -mstrict-align
22813 Do not (do) assume that unaligned memory references are handled by
22814 the system.
22815
22816 -msep-data
22817 Generate code that allows the data segment to be located in a
22818 different area of memory from the text segment. This allows for
22819 execute-in-place in an environment without virtual memory
22820 management. This option implies -fPIC.
22821
22822 -mno-sep-data
22823 Generate code that assumes that the data segment follows the text
22824 segment. This is the default.
22825
22826 -mid-shared-library
22827 Generate code that supports shared libraries via the library ID
22828 method. This allows for execute-in-place and shared libraries in
22829 an environment without virtual memory management. This option
22830 implies -fPIC.
22831
22832 -mno-id-shared-library
22833 Generate code that doesn't assume ID-based shared libraries are
22834 being used. This is the default.
22835
22836 -mshared-library-id=n
22837 Specifies the identification number of the ID-based shared library
22838 being compiled. Specifying a value of 0 generates more compact
22839 code; specifying other values forces the allocation of that number
22840 to the current library, but is no more space- or time-efficient
22841 than omitting this option.
22842
22843 -mxgot
22844 -mno-xgot
22845 When generating position-independent code for ColdFire, generate
22846 code that works if the GOT has more than 8192 entries. This code
22847 is larger and slower than code generated without this option. On
22848 M680x0 processors, this option is not needed; -fPIC suffices.
22849
22850 GCC normally uses a single instruction to load values from the GOT.
22851 While this is relatively efficient, it only works if the GOT is
22852 smaller than about 64k. Anything larger causes the linker to
22853 report an error such as:
22854
22855 relocation truncated to fit: R_68K_GOT16O foobar
22856
22857 If this happens, you should recompile your code with -mxgot. It
22858 should then work with very large GOTs. However, code generated
22859 with -mxgot is less efficient, since it takes 4 instructions to
22860 fetch the value of a global symbol.
22861
22862 Note that some linkers, including newer versions of the GNU linker,
22863 can create multiple GOTs and sort GOT entries. If you have such a
22864 linker, you should only need to use -mxgot when compiling a single
22865 object file that accesses more than 8192 GOT entries. Very few do.
22866
22867 These options have no effect unless GCC is generating position-
22868 independent code.
22869
22870 -mlong-jump-table-offsets
22871 Use 32-bit offsets in "switch" tables. The default is to use
22872 16-bit offsets.
22873
22874 MCore Options
22875
22876 These are the -m options defined for the Motorola M*Core processors.
22877
22878 -mhardlit
22879 -mno-hardlit
22880 Inline constants into the code stream if it can be done in two
22881 instructions or less.
22882
22883 -mdiv
22884 -mno-div
22885 Use the divide instruction. (Enabled by default).
22886
22887 -mrelax-immediate
22888 -mno-relax-immediate
22889 Allow arbitrary-sized immediates in bit operations.
22890
22891 -mwide-bitfields
22892 -mno-wide-bitfields
22893 Always treat bit-fields as "int"-sized.
22894
22895 -m4byte-functions
22896 -mno-4byte-functions
22897 Force all functions to be aligned to a 4-byte boundary.
22898
22899 -mcallgraph-data
22900 -mno-callgraph-data
22901 Emit callgraph information.
22902
22903 -mslow-bytes
22904 -mno-slow-bytes
22905 Prefer word access when reading byte quantities.
22906
22907 -mlittle-endian
22908 -mbig-endian
22909 Generate code for a little-endian target.
22910
22911 -m210
22912 -m340
22913 Generate code for the 210 processor.
22914
22915 -mno-lsim
22916 Assume that runtime support has been provided and so omit the
22917 simulator library (libsim.a) from the linker command line.
22918
22919 -mstack-increment=size
22920 Set the maximum amount for a single stack increment operation.
22921 Large values can increase the speed of programs that contain
22922 functions that need a large amount of stack space, but they can
22923 also trigger a segmentation fault if the stack is extended too
22924 much. The default value is 0x1000.
22925
22926 MicroBlaze Options
22927
22928 -msoft-float
22929 Use software emulation for floating point (default).
22930
22931 -mhard-float
22932 Use hardware floating-point instructions.
22933
22934 -mmemcpy
22935 Do not optimize block moves, use "memcpy".
22936
22937 -mno-clearbss
22938 This option is deprecated. Use -fno-zero-initialized-in-bss
22939 instead.
22940
22941 -mcpu=cpu-type
22942 Use features of, and schedule code for, the given CPU. Supported
22943 values are in the format vX.YY.Z, where X is a major version, YY is
22944 the minor version, and Z is compatibility code. Example values are
22945 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
22946
22947 -mxl-soft-mul
22948 Use software multiply emulation (default).
22949
22950 -mxl-soft-div
22951 Use software emulation for divides (default).
22952
22953 -mxl-barrel-shift
22954 Use the hardware barrel shifter.
22955
22956 -mxl-pattern-compare
22957 Use pattern compare instructions.
22958
22959 -msmall-divides
22960 Use table lookup optimization for small signed integer divisions.
22961
22962 -mxl-stack-check
22963 This option is deprecated. Use -fstack-check instead.
22964
22965 -mxl-gp-opt
22966 Use GP-relative ".sdata"/".sbss" sections.
22967
22968 -mxl-multiply-high
22969 Use multiply high instructions for high part of 32x32 multiply.
22970
22971 -mxl-float-convert
22972 Use hardware floating-point conversion instructions.
22973
22974 -mxl-float-sqrt
22975 Use hardware floating-point square root instruction.
22976
22977 -mbig-endian
22978 Generate code for a big-endian target.
22979
22980 -mlittle-endian
22981 Generate code for a little-endian target.
22982
22983 -mxl-reorder
22984 Use reorder instructions (swap and byte reversed load/store).
22985
22986 -mxl-mode-app-model
22987 Select application model app-model. Valid models are
22988
22989 executable
22990 normal executable (default), uses startup code crt0.o.
22991
22992 xmdstub
22993 for use with Xilinx Microprocessor Debugger (XMD) based
22994 software intrusive debug agent called xmdstub. This uses
22995 startup file crt1.o and sets the start address of the program
22996 to 0x800.
22997
22998 bootstrap
22999 for applications that are loaded using a bootloader. This
23000 model uses startup file crt2.o which does not contain a
23001 processor reset vector handler. This is suitable for
23002 transferring control on a processor reset to the bootloader
23003 rather than the application.
23004
23005 novectors
23006 for applications that do not require any of the MicroBlaze
23007 vectors. This option may be useful for applications running
23008 within a monitoring application. This model uses crt3.o as a
23009 startup file.
23010
23011 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
23012 model.
23013
23014 -mpic-data-is-text-relative
23015 Assume that the displacement between the text and data segments is
23016 fixed at static link time. This allows data to be referenced by
23017 offset from start of text address instead of GOT since PC-relative
23018 addressing is not supported.
23019
23020 MIPS Options
23021
23022 -EB Generate big-endian code.
23023
23024 -EL Generate little-endian code. This is the default for mips*el-*-*
23025 configurations.
23026
23027 -march=arch
23028 Generate code that runs on arch, which can be the name of a generic
23029 MIPS ISA, or the name of a particular processor. The ISA names
23030 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
23031 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
23032 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
23033 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
23034 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
23035 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
23036 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
23037 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
23038 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
23039 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
23040 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
23041 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
23042 and xlp. The special value from-abi selects the most compatible
23043 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
23044 and mips3 for 64-bit ABIs).
23045
23046 The native Linux/GNU toolchain also supports the value native,
23047 which selects the best architecture option for the host processor.
23048 -march=native has no effect if GCC does not recognize the
23049 processor.
23050
23051 In processor names, a final 000 can be abbreviated as k (for
23052 example, -march=r2k). Prefixes are optional, and vr may be written
23053 r.
23054
23055 Names of the form nf2_1 refer to processors with FPUs clocked at
23056 half the rate of the core, names of the form nf1_1 refer to
23057 processors with FPUs clocked at the same rate as the core, and
23058 names of the form nf3_2 refer to processors with FPUs clocked a
23059 ratio of 3:2 with respect to the core. For compatibility reasons,
23060 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
23061 as synonyms for nf1_1.
23062
23063 GCC defines two macros based on the value of this option. The
23064 first is "_MIPS_ARCH", which gives the name of target architecture,
23065 as a string. The second has the form "_MIPS_ARCH_foo", where foo
23066 is the capitalized value of "_MIPS_ARCH". For example,
23067 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
23068 "_MIPS_ARCH_R2000".
23069
23070 Note that the "_MIPS_ARCH" macro uses the processor names given
23071 above. In other words, it has the full prefix and does not
23072 abbreviate 000 as k. In the case of from-abi, the macro names the
23073 resolved architecture (either "mips1" or "mips3"). It names the
23074 default architecture when no -march option is given.
23075
23076 -mtune=arch
23077 Optimize for arch. Among other things, this option controls the
23078 way instructions are scheduled, and the perceived cost of
23079 arithmetic operations. The list of arch values is the same as for
23080 -march.
23081
23082 When this option is not used, GCC optimizes for the processor
23083 specified by -march. By using -march and -mtune together, it is
23084 possible to generate code that runs on a family of processors, but
23085 optimize the code for one particular member of that family.
23086
23087 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
23088 work in the same way as the -march ones described above.
23089
23090 -mips1
23091 Equivalent to -march=mips1.
23092
23093 -mips2
23094 Equivalent to -march=mips2.
23095
23096 -mips3
23097 Equivalent to -march=mips3.
23098
23099 -mips4
23100 Equivalent to -march=mips4.
23101
23102 -mips32
23103 Equivalent to -march=mips32.
23104
23105 -mips32r3
23106 Equivalent to -march=mips32r3.
23107
23108 -mips32r5
23109 Equivalent to -march=mips32r5.
23110
23111 -mips32r6
23112 Equivalent to -march=mips32r6.
23113
23114 -mips64
23115 Equivalent to -march=mips64.
23116
23117 -mips64r2
23118 Equivalent to -march=mips64r2.
23119
23120 -mips64r3
23121 Equivalent to -march=mips64r3.
23122
23123 -mips64r5
23124 Equivalent to -march=mips64r5.
23125
23126 -mips64r6
23127 Equivalent to -march=mips64r6.
23128
23129 -mips16
23130 -mno-mips16
23131 Generate (do not generate) MIPS16 code. If GCC is targeting a
23132 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
23133
23134 MIPS16 code generation can also be controlled on a per-function
23135 basis by means of "mips16" and "nomips16" attributes.
23136
23137 -mflip-mips16
23138 Generate MIPS16 code on alternating functions. This option is
23139 provided for regression testing of mixed MIPS16/non-MIPS16 code
23140 generation, and is not intended for ordinary use in compiling user
23141 code.
23142
23143 -minterlink-compressed
23144 -mno-interlink-compressed
23145 Require (do not require) that code using the standard
23146 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
23147 microMIPS code, and vice versa.
23148
23149 For example, code using the standard ISA encoding cannot jump
23150 directly to MIPS16 or microMIPS code; it must either use a call or
23151 an indirect jump. -minterlink-compressed therefore disables direct
23152 jumps unless GCC knows that the target of the jump is not
23153 compressed.
23154
23155 -minterlink-mips16
23156 -mno-interlink-mips16
23157 Aliases of -minterlink-compressed and -mno-interlink-compressed.
23158 These options predate the microMIPS ASE and are retained for
23159 backwards compatibility.
23160
23161 -mabi=32
23162 -mabi=o64
23163 -mabi=n32
23164 -mabi=64
23165 -mabi=eabi
23166 Generate code for the given ABI.
23167
23168 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
23169 generates 64-bit code when you select a 64-bit architecture, but
23170 you can use -mgp32 to get 32-bit code instead.
23171
23172 For information about the O64 ABI, see
23173 <https://gcc.gnu.org/projects/mipso64-abi.html>.
23174
23175 GCC supports a variant of the o32 ABI in which floating-point
23176 registers are 64 rather than 32 bits wide. You can select this
23177 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
23178 and "mfhc1" instructions and is therefore only supported for
23179 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
23180
23181 The register assignments for arguments and return values remain the
23182 same, but each scalar value is passed in a single 64-bit register
23183 rather than a pair of 32-bit registers. For example, scalar
23184 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
23185 The set of call-saved registers also remains the same in that the
23186 even-numbered double-precision registers are saved.
23187
23188 Two additional variants of the o32 ABI are supported to enable a
23189 transition from 32-bit to 64-bit registers. These are FPXX
23190 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
23191 mandates that all code must execute correctly when run using 32-bit
23192 or 64-bit registers. The code can be interlinked with either FP32
23193 or FP64, but not both. The FP64A extension is similar to the FP64
23194 extension but forbids the use of odd-numbered single-precision
23195 registers. This can be used in conjunction with the "FRE" mode of
23196 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
23197 interlink and run in the same process without changing FPU modes.
23198
23199 -mabicalls
23200 -mno-abicalls
23201 Generate (do not generate) code that is suitable for SVR4-style
23202 dynamic objects. -mabicalls is the default for SVR4-based systems.
23203
23204 -mshared
23205 -mno-shared
23206 Generate (do not generate) code that is fully position-independent,
23207 and that can therefore be linked into shared libraries. This
23208 option only affects -mabicalls.
23209
23210 All -mabicalls code has traditionally been position-independent,
23211 regardless of options like -fPIC and -fpic. However, as an
23212 extension, the GNU toolchain allows executables to use absolute
23213 accesses for locally-binding symbols. It can also use shorter GP
23214 initialization sequences and generate direct calls to locally-
23215 defined functions. This mode is selected by -mno-shared.
23216
23217 -mno-shared depends on binutils 2.16 or higher and generates
23218 objects that can only be linked by the GNU linker. However, the
23219 option does not affect the ABI of the final executable; it only
23220 affects the ABI of relocatable objects. Using -mno-shared
23221 generally makes executables both smaller and quicker.
23222
23223 -mshared is the default.
23224
23225 -mplt
23226 -mno-plt
23227 Assume (do not assume) that the static and dynamic linkers support
23228 PLTs and copy relocations. This option only affects -mno-shared
23229 -mabicalls. For the n64 ABI, this option has no effect without
23230 -msym32.
23231
23232 You can make -mplt the default by configuring GCC with
23233 --with-mips-plt. The default is -mno-plt otherwise.
23234
23235 -mxgot
23236 -mno-xgot
23237 Lift (do not lift) the usual restrictions on the size of the global
23238 offset table.
23239
23240 GCC normally uses a single instruction to load values from the GOT.
23241 While this is relatively efficient, it only works if the GOT is
23242 smaller than about 64k. Anything larger causes the linker to
23243 report an error such as:
23244
23245 relocation truncated to fit: R_MIPS_GOT16 foobar
23246
23247 If this happens, you should recompile your code with -mxgot. This
23248 works with very large GOTs, although the code is also less
23249 efficient, since it takes three instructions to fetch the value of
23250 a global symbol.
23251
23252 Note that some linkers can create multiple GOTs. If you have such
23253 a linker, you should only need to use -mxgot when a single object
23254 file accesses more than 64k's worth of GOT entries. Very few do.
23255
23256 These options have no effect unless GCC is generating position
23257 independent code.
23258
23259 -mgp32
23260 Assume that general-purpose registers are 32 bits wide.
23261
23262 -mgp64
23263 Assume that general-purpose registers are 64 bits wide.
23264
23265 -mfp32
23266 Assume that floating-point registers are 32 bits wide.
23267
23268 -mfp64
23269 Assume that floating-point registers are 64 bits wide.
23270
23271 -mfpxx
23272 Do not assume the width of floating-point registers.
23273
23274 -mhard-float
23275 Use floating-point coprocessor instructions.
23276
23277 -msoft-float
23278 Do not use floating-point coprocessor instructions. Implement
23279 floating-point calculations using library calls instead.
23280
23281 -mno-float
23282 Equivalent to -msoft-float, but additionally asserts that the
23283 program being compiled does not perform any floating-point
23284 operations. This option is presently supported only by some bare-
23285 metal MIPS configurations, where it may select a special set of
23286 libraries that lack all floating-point support (including, for
23287 example, the floating-point "printf" formats). If code compiled
23288 with -mno-float accidentally contains floating-point operations, it
23289 is likely to suffer a link-time or run-time failure.
23290
23291 -msingle-float
23292 Assume that the floating-point coprocessor only supports single-
23293 precision operations.
23294
23295 -mdouble-float
23296 Assume that the floating-point coprocessor supports double-
23297 precision operations. This is the default.
23298
23299 -modd-spreg
23300 -mno-odd-spreg
23301 Enable the use of odd-numbered single-precision floating-point
23302 registers for the o32 ABI. This is the default for processors that
23303 are known to support these registers. When using the o32 FPXX ABI,
23304 -mno-odd-spreg is set by default.
23305
23306 -mabs=2008
23307 -mabs=legacy
23308 These options control the treatment of the special not-a-number
23309 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
23310 machine instructions.
23311
23312 By default or when -mabs=legacy is used the legacy treatment is
23313 selected. In this case these instructions are considered
23314 arithmetic and avoided where correct operation is required and the
23315 input operand might be a NaN. A longer sequence of instructions
23316 that manipulate the sign bit of floating-point datum manually is
23317 used instead unless the -ffinite-math-only option has also been
23318 specified.
23319
23320 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
23321 case these instructions are considered non-arithmetic and therefore
23322 operating correctly in all cases, including in particular where the
23323 input operand is a NaN. These instructions are therefore always
23324 used for the respective operations.
23325
23326 -mnan=2008
23327 -mnan=legacy
23328 These options control the encoding of the special not-a-number
23329 (NaN) IEEE 754 floating-point data.
23330
23331 The -mnan=legacy option selects the legacy encoding. In this case
23332 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
23333 significand field being 0, whereas signaling NaNs (sNaNs) are
23334 denoted by the first bit of their trailing significand field being
23335 1.
23336
23337 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
23338 case qNaNs are denoted by the first bit of their trailing
23339 significand field being 1, whereas sNaNs are denoted by the first
23340 bit of their trailing significand field being 0.
23341
23342 The default is -mnan=legacy unless GCC has been configured with
23343 --with-nan=2008.
23344
23345 -mllsc
23346 -mno-llsc
23347 Use (do not use) ll, sc, and sync instructions to implement atomic
23348 memory built-in functions. When neither option is specified, GCC
23349 uses the instructions if the target architecture supports them.
23350
23351 -mllsc is useful if the runtime environment can emulate the
23352 instructions and -mno-llsc can be useful when compiling for
23353 nonstandard ISAs. You can make either option the default by
23354 configuring GCC with --with-llsc and --without-llsc respectively.
23355 --with-llsc is the default for some configurations; see the
23356 installation documentation for details.
23357
23358 -mdsp
23359 -mno-dsp
23360 Use (do not use) revision 1 of the MIPS DSP ASE.
23361 This option defines the preprocessor macro "__mips_dsp". It also
23362 defines "__mips_dsp_rev" to 1.
23363
23364 -mdspr2
23365 -mno-dspr2
23366 Use (do not use) revision 2 of the MIPS DSP ASE.
23367 This option defines the preprocessor macros "__mips_dsp" and
23368 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
23369
23370 -msmartmips
23371 -mno-smartmips
23372 Use (do not use) the MIPS SmartMIPS ASE.
23373
23374 -mpaired-single
23375 -mno-paired-single
23376 Use (do not use) paired-single floating-point instructions.
23377 This option requires hardware floating-point support to be
23378 enabled.
23379
23380 -mdmx
23381 -mno-mdmx
23382 Use (do not use) MIPS Digital Media Extension instructions. This
23383 option can only be used when generating 64-bit code and requires
23384 hardware floating-point support to be enabled.
23385
23386 -mips3d
23387 -mno-mips3d
23388 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
23389 -mpaired-single.
23390
23391 -mmicromips
23392 -mno-micromips
23393 Generate (do not generate) microMIPS code.
23394
23395 MicroMIPS code generation can also be controlled on a per-function
23396 basis by means of "micromips" and "nomicromips" attributes.
23397
23398 -mmt
23399 -mno-mt
23400 Use (do not use) MT Multithreading instructions.
23401
23402 -mmcu
23403 -mno-mcu
23404 Use (do not use) the MIPS MCU ASE instructions.
23405
23406 -meva
23407 -mno-eva
23408 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
23409
23410 -mvirt
23411 -mno-virt
23412 Use (do not use) the MIPS Virtualization (VZ) instructions.
23413
23414 -mxpa
23415 -mno-xpa
23416 Use (do not use) the MIPS eXtended Physical Address (XPA)
23417 instructions.
23418
23419 -mcrc
23420 -mno-crc
23421 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
23422 instructions.
23423
23424 -mginv
23425 -mno-ginv
23426 Use (do not use) the MIPS Global INValidate (GINV) instructions.
23427
23428 -mloongson-mmi
23429 -mno-loongson-mmi
23430 Use (do not use) the MIPS Loongson MultiMedia extensions
23431 Instructions (MMI).
23432
23433 -mloongson-ext
23434 -mno-loongson-ext
23435 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
23436
23437 -mloongson-ext2
23438 -mno-loongson-ext2
23439 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
23440 instructions.
23441
23442 -mlong64
23443 Force "long" types to be 64 bits wide. See -mlong32 for an
23444 explanation of the default and the way that the pointer size is
23445 determined.
23446
23447 -mlong32
23448 Force "long", "int", and pointer types to be 32 bits wide.
23449
23450 The default size of "int"s, "long"s and pointers depends on the
23451 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
23452 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
23453 "long"s. Pointers are the same size as "long"s, or the same size
23454 as integer registers, whichever is smaller.
23455
23456 -msym32
23457 -mno-sym32
23458 Assume (do not assume) that all symbols have 32-bit values,
23459 regardless of the selected ABI. This option is useful in
23460 combination with -mabi=64 and -mno-abicalls because it allows GCC
23461 to generate shorter and faster references to symbolic addresses.
23462
23463 -G num
23464 Put definitions of externally-visible data in a small data section
23465 if that data is no bigger than num bytes. GCC can then generate
23466 more efficient accesses to the data; see -mgpopt for details.
23467
23468 The default -G option depends on the configuration.
23469
23470 -mlocal-sdata
23471 -mno-local-sdata
23472 Extend (do not extend) the -G behavior to local data too, such as
23473 to static variables in C. -mlocal-sdata is the default for all
23474 configurations.
23475
23476 If the linker complains that an application is using too much small
23477 data, you might want to try rebuilding the less performance-
23478 critical parts with -mno-local-sdata. You might also want to build
23479 large libraries with -mno-local-sdata, so that the libraries leave
23480 more room for the main program.
23481
23482 -mextern-sdata
23483 -mno-extern-sdata
23484 Assume (do not assume) that externally-defined data is in a small
23485 data section if the size of that data is within the -G limit.
23486 -mextern-sdata is the default for all configurations.
23487
23488 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
23489 Mod references a variable Var that is no bigger than num bytes, you
23490 must make sure that Var is placed in a small data section. If Var
23491 is defined by another module, you must either compile that module
23492 with a high-enough -G setting or attach a "section" attribute to
23493 Var's definition. If Var is common, you must link the application
23494 with a high-enough -G setting.
23495
23496 The easiest way of satisfying these restrictions is to compile and
23497 link every module with the same -G option. However, you may wish
23498 to build a library that supports several different small data
23499 limits. You can do this by compiling the library with the highest
23500 supported -G setting and additionally using -mno-extern-sdata to
23501 stop the library from making assumptions about externally-defined
23502 data.
23503
23504 -mgpopt
23505 -mno-gpopt
23506 Use (do not use) GP-relative accesses for symbols that are known to
23507 be in a small data section; see -G, -mlocal-sdata and
23508 -mextern-sdata. -mgpopt is the default for all configurations.
23509
23510 -mno-gpopt is useful for cases where the $gp register might not
23511 hold the value of "_gp". For example, if the code is part of a
23512 library that might be used in a boot monitor, programs that call
23513 boot monitor routines pass an unknown value in $gp. (In such
23514 situations, the boot monitor itself is usually compiled with -G0.)
23515
23516 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
23517
23518 -membedded-data
23519 -mno-embedded-data
23520 Allocate variables to the read-only data section first if possible,
23521 then next in the small data section if possible, otherwise in data.
23522 This gives slightly slower code than the default, but reduces the
23523 amount of RAM required when executing, and thus may be preferred
23524 for some embedded systems.
23525
23526 -muninit-const-in-rodata
23527 -mno-uninit-const-in-rodata
23528 Put uninitialized "const" variables in the read-only data section.
23529 This option is only meaningful in conjunction with -membedded-data.
23530
23531 -mcode-readable=setting
23532 Specify whether GCC may generate code that reads from executable
23533 sections. There are three possible settings:
23534
23535 -mcode-readable=yes
23536 Instructions may freely access executable sections. This is
23537 the default setting.
23538
23539 -mcode-readable=pcrel
23540 MIPS16 PC-relative load instructions can access executable
23541 sections, but other instructions must not do so. This option
23542 is useful on 4KSc and 4KSd processors when the code TLBs have
23543 the Read Inhibit bit set. It is also useful on processors that
23544 can be configured to have a dual instruction/data SRAM
23545 interface and that, like the M4K, automatically redirect PC-
23546 relative loads to the instruction RAM.
23547
23548 -mcode-readable=no
23549 Instructions must not access executable sections. This option
23550 can be useful on targets that are configured to have a dual
23551 instruction/data SRAM interface but that (unlike the M4K) do
23552 not automatically redirect PC-relative loads to the instruction
23553 RAM.
23554
23555 -msplit-addresses
23556 -mno-split-addresses
23557 Enable (disable) use of the %hi() and %lo() assembler relocation
23558 operators. This option has been superseded by -mexplicit-relocs
23559 but is retained for backwards compatibility.
23560
23561 -mexplicit-relocs
23562 -mno-explicit-relocs
23563 Use (do not use) assembler relocation operators when dealing with
23564 symbolic addresses. The alternative, selected by
23565 -mno-explicit-relocs, is to use assembler macros instead.
23566
23567 -mexplicit-relocs is the default if GCC was configured to use an
23568 assembler that supports relocation operators.
23569
23570 -mcheck-zero-division
23571 -mno-check-zero-division
23572 Trap (do not trap) on integer division by zero.
23573
23574 The default is -mcheck-zero-division.
23575
23576 -mdivide-traps
23577 -mdivide-breaks
23578 MIPS systems check for division by zero by generating either a
23579 conditional trap or a break instruction. Using traps results in
23580 smaller code, but is only supported on MIPS II and later. Also,
23581 some versions of the Linux kernel have a bug that prevents trap
23582 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
23583 to allow conditional traps on architectures that support them and
23584 -mdivide-breaks to force the use of breaks.
23585
23586 The default is usually -mdivide-traps, but this can be overridden
23587 at configure time using --with-divide=breaks. Divide-by-zero
23588 checks can be completely disabled using -mno-check-zero-division.
23589
23590 -mload-store-pairs
23591 -mno-load-store-pairs
23592 Enable (disable) an optimization that pairs consecutive load or
23593 store instructions to enable load/store bonding. This option is
23594 enabled by default but only takes effect when the selected
23595 architecture is known to support bonding.
23596
23597 -munaligned-access
23598 -mno-unaligned-access
23599 Enable (disable) direct unaligned access for MIPS Release 6.
23600 MIPSr6 requires load/store unaligned-access support, by hardware or
23601 trap&emulate. So -mno-unaligned-access may be needed by kernel.
23602
23603 -mmemcpy
23604 -mno-memcpy
23605 Force (do not force) the use of "memcpy" for non-trivial block
23606 moves. The default is -mno-memcpy, which allows GCC to inline most
23607 constant-sized copies.
23608
23609 -mlong-calls
23610 -mno-long-calls
23611 Disable (do not disable) use of the "jal" instruction. Calling
23612 functions using "jal" is more efficient but requires the caller and
23613 callee to be in the same 256 megabyte segment.
23614
23615 This option has no effect on abicalls code. The default is
23616 -mno-long-calls.
23617
23618 -mmad
23619 -mno-mad
23620 Enable (disable) use of the "mad", "madu" and "mul" instructions,
23621 as provided by the R4650 ISA.
23622
23623 -mimadd
23624 -mno-imadd
23625 Enable (disable) use of the "madd" and "msub" integer instructions.
23626 The default is -mimadd on architectures that support "madd" and
23627 "msub" except for the 74k architecture where it was found to
23628 generate slower code.
23629
23630 -mfused-madd
23631 -mno-fused-madd
23632 Enable (disable) use of the floating-point multiply-accumulate
23633 instructions, when they are available. The default is
23634 -mfused-madd.
23635
23636 On the R8000 CPU when multiply-accumulate instructions are used,
23637 the intermediate product is calculated to infinite precision and is
23638 not subject to the FCSR Flush to Zero bit. This may be undesirable
23639 in some circumstances. On other processors the result is
23640 numerically identical to the equivalent computation using separate
23641 multiply, add, subtract and negate instructions.
23642
23643 -nocpp
23644 Tell the MIPS assembler to not run its preprocessor over user
23645 assembler files (with a .s suffix) when assembling them.
23646
23647 -mfix-24k
23648 -mno-fix-24k
23649 Work around the 24K E48 (lost data on stores during refill) errata.
23650 The workarounds are implemented by the assembler rather than by
23651 GCC.
23652
23653 -mfix-r4000
23654 -mno-fix-r4000
23655 Work around certain R4000 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 - A double-word or a variable shift may give an incorrect result
23661 if executed while an integer multiplication is in progress.
23662
23663 - An integer division may give an incorrect result if started in
23664 a delay slot of a taken branch or a jump.
23665
23666 -mfix-r4400
23667 -mno-fix-r4400
23668 Work around certain R4400 CPU errata:
23669
23670 - A double-word or a variable shift may give an incorrect result
23671 if executed immediately after starting an integer division.
23672
23673 -mfix-r10000
23674 -mno-fix-r10000
23675 Work around certain R10000 errata:
23676
23677 - "ll"/"sc" sequences may not behave atomically on revisions
23678 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
23679
23680 This option can only be used if the target architecture supports
23681 branch-likely instructions. -mfix-r10000 is the default when
23682 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
23683
23684 -mfix-r5900
23685 -mno-fix-r5900
23686 Do not attempt to schedule the preceding instruction into the delay
23687 slot of a branch instruction placed at the end of a short loop of
23688 six instructions or fewer and always schedule a "nop" instruction
23689 there instead. The short loop bug under certain conditions causes
23690 loops to execute only once or twice, due to a hardware bug in the
23691 R5900 chip. The workaround is implemented by the assembler rather
23692 than by GCC.
23693
23694 -mfix-rm7000
23695 -mno-fix-rm7000
23696 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
23697 are implemented by the assembler rather than by GCC.
23698
23699 -mfix-vr4120
23700 -mno-fix-vr4120
23701 Work around certain VR4120 errata:
23702
23703 - "dmultu" does not always produce the correct result.
23704
23705 - "div" and "ddiv" do not always produce the correct result if
23706 one of the operands is negative.
23707
23708 The workarounds for the division errata rely on special functions
23709 in libgcc.a. At present, these functions are only provided by the
23710 "mips64vr*-elf" configurations.
23711
23712 Other VR4120 errata require a NOP to be inserted between certain
23713 pairs of instructions. These errata are handled by the assembler,
23714 not by GCC itself.
23715
23716 -mfix-vr4130
23717 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
23718 implemented by the assembler rather than by GCC, although GCC
23719 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
23720 "dmacc" and "dmacchi" instructions are available instead.
23721
23722 -mfix-sb1
23723 -mno-fix-sb1
23724 Work around certain SB-1 CPU core errata. (This flag currently
23725 works around the SB-1 revision 2 "F1" and "F2" floating-point
23726 errata.)
23727
23728 -mr10k-cache-barrier=setting
23729 Specify whether GCC should insert cache barriers to avoid the side
23730 effects of speculation on R10K processors.
23731
23732 In common with many processors, the R10K tries to predict the
23733 outcome of a conditional branch and speculatively executes
23734 instructions from the "taken" branch. It later aborts these
23735 instructions if the predicted outcome is wrong. However, on the
23736 R10K, even aborted instructions can have side effects.
23737
23738 This problem only affects kernel stores and, depending on the
23739 system, kernel loads. As an example, a speculatively-executed
23740 store may load the target memory into cache and mark the cache line
23741 as dirty, even if the store itself is later aborted. If a DMA
23742 operation writes to the same area of memory before the "dirty" line
23743 is flushed, the cached data overwrites the DMA-ed data. See the
23744 R10K processor manual for a full description, including other
23745 potential problems.
23746
23747 One workaround is to insert cache barrier instructions before every
23748 memory access that might be speculatively executed and that might
23749 have side effects even if aborted. -mr10k-cache-barrier=setting
23750 controls GCC's implementation of this workaround. It assumes that
23751 aborted accesses to any byte in the following regions does not have
23752 side effects:
23753
23754 1. the memory occupied by the current function's stack frame;
23755
23756 2. the memory occupied by an incoming stack argument;
23757
23758 3. the memory occupied by an object with a link-time-constant
23759 address.
23760
23761 It is the kernel's responsibility to ensure that speculative
23762 accesses to these regions are indeed safe.
23763
23764 If the input program contains a function declaration such as:
23765
23766 void foo (void);
23767
23768 then the implementation of "foo" must allow "j foo" and "jal foo"
23769 to be executed speculatively. GCC honors this restriction for
23770 functions it compiles itself. It expects non-GCC functions (such
23771 as hand-written assembly code) to do the same.
23772
23773 The option has three forms:
23774
23775 -mr10k-cache-barrier=load-store
23776 Insert a cache barrier before a load or store that might be
23777 speculatively executed and that might have side effects even if
23778 aborted.
23779
23780 -mr10k-cache-barrier=store
23781 Insert a cache barrier before a store that might be
23782 speculatively executed and that might have side effects even if
23783 aborted.
23784
23785 -mr10k-cache-barrier=none
23786 Disable the insertion of cache barriers. This is the default
23787 setting.
23788
23789 -mflush-func=func
23790 -mno-flush-func
23791 Specifies the function to call to flush the I and D caches, or to
23792 not call any such function. If called, the function must take the
23793 same arguments as the common "_flush_func", that is, the address of
23794 the memory range for which the cache is being flushed, the size of
23795 the memory range, and the number 3 (to flush both caches). The
23796 default depends on the target GCC was configured for, but commonly
23797 is either "_flush_func" or "__cpu_flush".
23798
23799 mbranch-cost=num
23800 Set the cost of branches to roughly num "simple" instructions.
23801 This cost is only a heuristic and is not guaranteed to produce
23802 consistent results across releases. A zero cost redundantly
23803 selects the default, which is based on the -mtune setting.
23804
23805 -mbranch-likely
23806 -mno-branch-likely
23807 Enable or disable use of Branch Likely instructions, regardless of
23808 the default for the selected architecture. By default, Branch
23809 Likely instructions may be generated if they are supported by the
23810 selected architecture. An exception is for the MIPS32 and MIPS64
23811 architectures and processors that implement those architectures;
23812 for those, Branch Likely instructions are not be generated by
23813 default because the MIPS32 and MIPS64 architectures specifically
23814 deprecate their use.
23815
23816 -mcompact-branches=never
23817 -mcompact-branches=optimal
23818 -mcompact-branches=always
23819 These options control which form of branches will be generated.
23820 The default is -mcompact-branches=optimal.
23821
23822 The -mcompact-branches=never option ensures that compact branch
23823 instructions will never be generated.
23824
23825 The -mcompact-branches=always option ensures that a compact branch
23826 instruction will be generated if available for MIPS Release 6
23827 onwards. If a compact branch instruction is not available (or
23828 pre-R6), a delay slot form of the branch will be used instead.
23829
23830 If it is used for MIPS16/microMIPS targets, it will be just ignored
23831 now. The behaviour for MIPS16/microMIPS may change in future,
23832 since they do have some compact branch instructions.
23833
23834 The -mcompact-branches=optimal option will cause a delay slot
23835 branch to be used if one is available in the current ISA and the
23836 delay slot is successfully filled. If the delay slot is not
23837 filled, a compact branch will be chosen if one is available.
23838
23839 -mfp-exceptions
23840 -mno-fp-exceptions
23841 Specifies whether FP exceptions are enabled. This affects how FP
23842 instructions are scheduled for some processors. The default is
23843 that FP exceptions are enabled.
23844
23845 For instance, on the SB-1, if FP exceptions are disabled, and we
23846 are emitting 64-bit code, then we can use both FP pipes.
23847 Otherwise, we can only use one FP pipe.
23848
23849 -mvr4130-align
23850 -mno-vr4130-align
23851 The VR4130 pipeline is two-way superscalar, but can only issue two
23852 instructions together if the first one is 8-byte aligned. When
23853 this option is enabled, GCC aligns pairs of instructions that it
23854 thinks should execute in parallel.
23855
23856 This option only has an effect when optimizing for the VR4130. It
23857 normally makes code faster, but at the expense of making it bigger.
23858 It is enabled by default at optimization level -O3.
23859
23860 -msynci
23861 -mno-synci
23862 Enable (disable) generation of "synci" instructions on
23863 architectures that support it. The "synci" instructions (if
23864 enabled) are generated when "__builtin___clear_cache" is compiled.
23865
23866 This option defaults to -mno-synci, but the default can be
23867 overridden by configuring GCC with --with-synci.
23868
23869 When compiling code for single processor systems, it is generally
23870 safe to use "synci". However, on many multi-core (SMP) systems, it
23871 does not invalidate the instruction caches on all cores and may
23872 lead to undefined behavior.
23873
23874 -mrelax-pic-calls
23875 -mno-relax-pic-calls
23876 Try to turn PIC calls that are normally dispatched via register $25
23877 into direct calls. This is only possible if the linker can resolve
23878 the destination at link time and if the destination is within range
23879 for a direct call.
23880
23881 -mrelax-pic-calls is the default if GCC was configured to use an
23882 assembler and a linker that support the ".reloc" assembly directive
23883 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
23884 this optimization can be performed by the assembler and the linker
23885 alone without help from the compiler.
23886
23887 -mmcount-ra-address
23888 -mno-mcount-ra-address
23889 Emit (do not emit) code that allows "_mcount" to modify the calling
23890 function's return address. When enabled, this option extends the
23891 usual "_mcount" interface with a new ra-address parameter, which
23892 has type "intptr_t *" and is passed in register $12. "_mcount" can
23893 then modify the return address by doing both of the following:
23894
23895 * Returning the new address in register $31.
23896
23897 * Storing the new address in "*ra-address", if ra-address is
23898 nonnull.
23899
23900 The default is -mno-mcount-ra-address.
23901
23902 -mframe-header-opt
23903 -mno-frame-header-opt
23904 Enable (disable) frame header optimization in the o32 ABI. When
23905 using the o32 ABI, calling functions will allocate 16 bytes on the
23906 stack for the called function to write out register arguments.
23907 When enabled, this optimization will suppress the allocation of the
23908 frame header if it can be determined that it is unused.
23909
23910 This optimization is off by default at all optimization levels.
23911
23912 -mlxc1-sxc1
23913 -mno-lxc1-sxc1
23914 When applicable, enable (disable) the generation of "lwxc1",
23915 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
23916
23917 -mmadd4
23918 -mno-madd4
23919 When applicable, enable (disable) the generation of 4-operand
23920 "madd.s", "madd.d" and related instructions. Enabled by default.
23921
23922 MMIX Options
23923
23924 These options are defined for the MMIX:
23925
23926 -mlibfuncs
23927 -mno-libfuncs
23928 Specify that intrinsic library functions are being compiled,
23929 passing all values in registers, no matter the size.
23930
23931 -mepsilon
23932 -mno-epsilon
23933 Generate floating-point comparison instructions that compare with
23934 respect to the "rE" epsilon register.
23935
23936 -mabi=mmixware
23937 -mabi=gnu
23938 Generate code that passes function parameters and return values
23939 that (in the called function) are seen as registers $0 and up, as
23940 opposed to the GNU ABI which uses global registers $231 and up.
23941
23942 -mzero-extend
23943 -mno-zero-extend
23944 When reading data from memory in sizes shorter than 64 bits, use
23945 (do not use) zero-extending load instructions by default, rather
23946 than sign-extending ones.
23947
23948 -mknuthdiv
23949 -mno-knuthdiv
23950 Make the result of a division yielding a remainder have the same
23951 sign as the divisor. With the default, -mno-knuthdiv, the sign of
23952 the remainder follows the sign of the dividend. Both methods are
23953 arithmetically valid, the latter being almost exclusively used.
23954
23955 -mtoplevel-symbols
23956 -mno-toplevel-symbols
23957 Prepend (do not prepend) a : to all global symbols, so the assembly
23958 code can be used with the "PREFIX" assembly directive.
23959
23960 -melf
23961 Generate an executable in the ELF format, rather than the default
23962 mmo format used by the mmix simulator.
23963
23964 -mbranch-predict
23965 -mno-branch-predict
23966 Use (do not use) the probable-branch instructions, when static
23967 branch prediction indicates a probable branch.
23968
23969 -mbase-addresses
23970 -mno-base-addresses
23971 Generate (do not generate) code that uses base addresses. Using a
23972 base address automatically generates a request (handled by the
23973 assembler and the linker) for a constant to be set up in a global
23974 register. The register is used for one or more base address
23975 requests within the range 0 to 255 from the value held in the
23976 register. The generally leads to short and fast code, but the
23977 number of different data items that can be addressed is limited.
23978 This means that a program that uses lots of static data may require
23979 -mno-base-addresses.
23980
23981 -msingle-exit
23982 -mno-single-exit
23983 Force (do not force) generated code to have a single exit point in
23984 each function.
23985
23986 MN10300 Options
23987
23988 These -m options are defined for Matsushita MN10300 architectures:
23989
23990 -mmult-bug
23991 Generate code to avoid bugs in the multiply instructions for the
23992 MN10300 processors. This is the default.
23993
23994 -mno-mult-bug
23995 Do not generate code to avoid bugs in the multiply instructions for
23996 the MN10300 processors.
23997
23998 -mam33
23999 Generate code using features specific to the AM33 processor.
24000
24001 -mno-am33
24002 Do not generate code using features specific to the AM33 processor.
24003 This is the default.
24004
24005 -mam33-2
24006 Generate code using features specific to the AM33/2.0 processor.
24007
24008 -mam34
24009 Generate code using features specific to the AM34 processor.
24010
24011 -mtune=cpu-type
24012 Use the timing characteristics of the indicated CPU type when
24013 scheduling instructions. This does not change the targeted
24014 processor type. The CPU type must be one of mn10300, am33, am33-2
24015 or am34.
24016
24017 -mreturn-pointer-on-d0
24018 When generating a function that returns a pointer, return the
24019 pointer in both "a0" and "d0". Otherwise, the pointer is returned
24020 only in "a0", and attempts to call such functions without a
24021 prototype result in errors. Note that this option is on by
24022 default; use -mno-return-pointer-on-d0 to disable it.
24023
24024 -mno-crt0
24025 Do not link in the C run-time initialization object file.
24026
24027 -mrelax
24028 Indicate to the linker that it should perform a relaxation
24029 optimization pass to shorten branches, calls and absolute memory
24030 addresses. This option only has an effect when used on the command
24031 line for the final link step.
24032
24033 This option makes symbolic debugging impossible.
24034
24035 -mliw
24036 Allow the compiler to generate Long Instruction Word instructions
24037 if the target is the AM33 or later. This is the default. This
24038 option defines the preprocessor macro "__LIW__".
24039
24040 -mno-liw
24041 Do not allow the compiler to generate Long Instruction Word
24042 instructions. This option defines the preprocessor macro
24043 "__NO_LIW__".
24044
24045 -msetlb
24046 Allow the compiler to generate the SETLB and Lcc instructions if
24047 the target is the AM33 or later. This is the default. This option
24048 defines the preprocessor macro "__SETLB__".
24049
24050 -mno-setlb
24051 Do not allow the compiler to generate SETLB or Lcc instructions.
24052 This option defines the preprocessor macro "__NO_SETLB__".
24053
24054 Moxie Options
24055
24056 -meb
24057 Generate big-endian code. This is the default for moxie-*-*
24058 configurations.
24059
24060 -mel
24061 Generate little-endian code.
24062
24063 -mmul.x
24064 Generate mul.x and umul.x instructions. This is the default for
24065 moxiebox-*-* configurations.
24066
24067 -mno-crt0
24068 Do not link in the C run-time initialization object file.
24069
24070 MSP430 Options
24071
24072 These options are defined for the MSP430:
24073
24074 -masm-hex
24075 Force assembly output to always use hex constants. Normally such
24076 constants are signed decimals, but this option is available for
24077 testsuite and/or aesthetic purposes.
24078
24079 -mmcu=
24080 Select the MCU to target. This is used to create a C preprocessor
24081 symbol based upon the MCU name, converted to upper case and pre-
24082 and post-fixed with __. This in turn is used by the msp430.h
24083 header file to select an MCU-specific supplementary header file.
24084
24085 The option also sets the ISA to use. If the MCU name is one that
24086 is known to only support the 430 ISA then that is selected,
24087 otherwise the 430X ISA is selected. A generic MCU name of msp430
24088 can also be used to select the 430 ISA. Similarly the generic
24089 msp430x MCU name selects the 430X ISA.
24090
24091 In addition an MCU-specific linker script is added to the linker
24092 command line. The script's name is the name of the MCU with .ld
24093 appended. Thus specifying -mmcu=xxx on the gcc command line
24094 defines the C preprocessor symbol "__XXX__" and cause the linker to
24095 search for a script called xxx.ld.
24096
24097 The ISA and hardware multiply supported for the different MCUs is
24098 hard-coded into GCC. However, an external devices.csv file can be
24099 used to extend device support beyond those that have been hard-
24100 coded.
24101
24102 GCC searches for the devices.csv file using the following methods
24103 in the given precedence order, where the first method takes
24104 precendence over the second which takes precedence over the third.
24105
24106 Include path specified with "-I" and "-L"
24107 devices.csv will be searched for in each of the directories
24108 specified by include paths and linker library search paths.
24109
24110 Path specified by the environment variable MSP430_GCC_INCLUDE_DIR
24111 Define the value of the global environment variable
24112 MSP430_GCC_INCLUDE_DIR to the full path to the directory
24113 containing devices.csv, and GCC will search this directory for
24114 devices.csv. If devices.csv is found, this directory will also
24115 be registered as an include path, and linker library path.
24116 Header files and linker scripts in this directory can therefore
24117 be used without manually specifying "-I" and "-L" on the
24118 command line.
24119
24120 The msp430-elf{,bare}/include/devices directory
24121 Finally, GCC will examine msp430-elf{,bare}/include/devices
24122 from the toolchain root directory. This directory does not
24123 exist in a default installation, but if the user has created it
24124 and copied devices.csv there, then the MCU data will be read.
24125 As above, this directory will also be registered as an include
24126 path, and linker library path.
24127
24128 If none of the above search methods find devices.csv, then the
24129 hard-coded MCU data is used.
24130
24131 -mwarn-mcu
24132 -mno-warn-mcu
24133 This option enables or disables warnings about conflicts between
24134 the MCU name specified by the -mmcu option and the ISA set by the
24135 -mcpu option and/or the hardware multiply support set by the
24136 -mhwmult option. It also toggles warnings about unrecognized MCU
24137 names. This option is on by default.
24138
24139 -mcpu=
24140 Specifies the ISA to use. Accepted values are msp430, msp430x and
24141 msp430xv2. This option is deprecated. The -mmcu= option should be
24142 used to select the ISA.
24143
24144 -msim
24145 Link to the simulator runtime libraries and linker script.
24146 Overrides any scripts that would be selected by the -mmcu= option.
24147
24148 -mlarge
24149 Use large-model addressing (20-bit pointers, 20-bit "size_t").
24150
24151 -msmall
24152 Use small-model addressing (16-bit pointers, 16-bit "size_t").
24153
24154 -mrelax
24155 This option is passed to the assembler and linker, and allows the
24156 linker to perform certain optimizations that cannot be done until
24157 the final link.
24158
24159 mhwmult=
24160 Describes the type of hardware multiply supported by the target.
24161 Accepted values are none for no hardware multiply, 16bit for the
24162 original 16-bit-only multiply supported by early MCUs. 32bit for
24163 the 16/32-bit multiply supported by later MCUs and f5series for the
24164 16/32-bit multiply supported by F5-series MCUs. A value of auto
24165 can also be given. This tells GCC to deduce the hardware multiply
24166 support based upon the MCU name provided by the -mmcu option. If
24167 no -mmcu option is specified or if the MCU name is not recognized
24168 then no hardware multiply support is assumed. "auto" is the
24169 default setting.
24170
24171 Hardware multiplies are normally performed by calling a library
24172 routine. This saves space in the generated code. When compiling
24173 at -O3 or higher however the hardware multiplier is invoked inline.
24174 This makes for bigger, but faster code.
24175
24176 The hardware multiply routines disable interrupts whilst running
24177 and restore the previous interrupt state when they finish. This
24178 makes them safe to use inside interrupt handlers as well as in
24179 normal code.
24180
24181 -minrt
24182 Enable the use of a minimum runtime environment - no static
24183 initializers or constructors. This is intended for memory-
24184 constrained devices. The compiler includes special symbols in some
24185 objects that tell the linker and runtime which code fragments are
24186 required.
24187
24188 -mtiny-printf
24189 Enable reduced code size "printf" and "puts" library functions.
24190 The tiny implementations of these functions are not reentrant, so
24191 must be used with caution in multi-threaded applications.
24192
24193 Support for streams has been removed and the string to be printed
24194 will always be sent to stdout via the "write" syscall. The string
24195 is not buffered before it is sent to write.
24196
24197 This option requires Newlib Nano IO, so GCC must be configured with
24198 --enable-newlib-nano-formatted-io.
24199
24200 -mmax-inline-shift=
24201 This option takes an integer between 0 and 64 inclusive, and sets
24202 the maximum number of inline shift instructions which should be
24203 emitted to perform a shift operation by a constant amount. When
24204 this value needs to be exceeded, an mspabi helper function is used
24205 instead. The default value is 4.
24206
24207 This only affects cases where a shift by multiple positions cannot
24208 be completed with a single instruction (e.g. all shifts >1 on the
24209 430 ISA).
24210
24211 Shifts of a 32-bit value are at least twice as costly, so the value
24212 passed for this option is divided by 2 and the resulting value used
24213 instead.
24214
24215 -mcode-region=
24216 -mdata-region=
24217 These options tell the compiler where to place functions and data
24218 that do not have one of the "lower", "upper", "either" or "section"
24219 attributes. Possible values are "lower", "upper", "either" or
24220 "any". The first three behave like the corresponding attribute.
24221 The fourth possible value - "any" - is the default. It leaves
24222 placement entirely up to the linker script and how it assigns the
24223 standard sections (".text", ".data", etc) to the memory regions.
24224
24225 -msilicon-errata=
24226 This option passes on a request to assembler to enable the fixes
24227 for the named silicon errata.
24228
24229 -msilicon-errata-warn=
24230 This option passes on a request to the assembler to enable warning
24231 messages when a silicon errata might need to be applied.
24232
24233 -mwarn-devices-csv
24234 -mno-warn-devices-csv
24235 Warn if devices.csv is not found or there are problem parsing it
24236 (default: on).
24237
24238 NDS32 Options
24239
24240 These options are defined for NDS32 implementations:
24241
24242 -mbig-endian
24243 Generate code in big-endian mode.
24244
24245 -mlittle-endian
24246 Generate code in little-endian mode.
24247
24248 -mreduced-regs
24249 Use reduced-set registers for register allocation.
24250
24251 -mfull-regs
24252 Use full-set registers for register allocation.
24253
24254 -mcmov
24255 Generate conditional move instructions.
24256
24257 -mno-cmov
24258 Do not generate conditional move instructions.
24259
24260 -mext-perf
24261 Generate performance extension instructions.
24262
24263 -mno-ext-perf
24264 Do not generate performance extension instructions.
24265
24266 -mext-perf2
24267 Generate performance extension 2 instructions.
24268
24269 -mno-ext-perf2
24270 Do not generate performance extension 2 instructions.
24271
24272 -mext-string
24273 Generate string extension instructions.
24274
24275 -mno-ext-string
24276 Do not generate string extension instructions.
24277
24278 -mv3push
24279 Generate v3 push25/pop25 instructions.
24280
24281 -mno-v3push
24282 Do not generate v3 push25/pop25 instructions.
24283
24284 -m16-bit
24285 Generate 16-bit instructions.
24286
24287 -mno-16-bit
24288 Do not generate 16-bit instructions.
24289
24290 -misr-vector-size=num
24291 Specify the size of each interrupt vector, which must be 4 or 16.
24292
24293 -mcache-block-size=num
24294 Specify the size of each cache block, which must be a power of 2
24295 between 4 and 512.
24296
24297 -march=arch
24298 Specify the name of the target architecture.
24299
24300 -mcmodel=code-model
24301 Set the code model to one of
24302
24303 small
24304 All the data and read-only data segments must be within 512KB
24305 addressing space. The text segment must be within 16MB
24306 addressing space.
24307
24308 medium
24309 The data segment must be within 512KB while the read-only data
24310 segment can be within 4GB addressing space. The text segment
24311 should be still within 16MB addressing space.
24312
24313 large
24314 All the text and data segments can be within 4GB addressing
24315 space.
24316
24317 -mctor-dtor
24318 Enable constructor/destructor feature.
24319
24320 -mrelax
24321 Guide linker to relax instructions.
24322
24323 Nios II Options
24324
24325 These are the options defined for the Altera Nios II processor.
24326
24327 -G num
24328 Put global and static objects less than or equal to num bytes into
24329 the small data or BSS sections instead of the normal data or BSS
24330 sections. The default value of num is 8.
24331
24332 -mgpopt=option
24333 -mgpopt
24334 -mno-gpopt
24335 Generate (do not generate) GP-relative accesses. The following
24336 option names are recognized:
24337
24338 none
24339 Do not generate GP-relative accesses.
24340
24341 local
24342 Generate GP-relative accesses for small data objects that are
24343 not external, weak, or uninitialized common symbols. Also use
24344 GP-relative addressing for objects that have been explicitly
24345 placed in a small data section via a "section" attribute.
24346
24347 global
24348 As for local, but also generate GP-relative accesses for small
24349 data objects that are external, weak, or common. If you use
24350 this option, you must ensure that all parts of your program
24351 (including libraries) are compiled with the same -G setting.
24352
24353 data
24354 Generate GP-relative accesses for all data objects in the
24355 program. If you use this option, the entire data and BSS
24356 segments of your program must fit in 64K of memory and you must
24357 use an appropriate linker script to allocate them within the
24358 addressable range of the global pointer.
24359
24360 all Generate GP-relative addresses for function pointers as well as
24361 data pointers. If you use this option, the entire text, data,
24362 and BSS segments of your program must fit in 64K of memory and
24363 you must use an appropriate linker script to allocate them
24364 within the addressable range of the global pointer.
24365
24366 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
24367 equivalent to -mgpopt=none.
24368
24369 The default is -mgpopt except when -fpic or -fPIC is specified to
24370 generate position-independent code. Note that the Nios II ABI does
24371 not permit GP-relative accesses from shared libraries.
24372
24373 You may need to specify -mno-gpopt explicitly when building
24374 programs that include large amounts of small data, including large
24375 GOT data sections. In this case, the 16-bit offset for GP-relative
24376 addressing may not be large enough to allow access to the entire
24377 small data section.
24378
24379 -mgprel-sec=regexp
24380 This option specifies additional section names that can be accessed
24381 via GP-relative addressing. It is most useful in conjunction with
24382 "section" attributes on variable declarations and a custom linker
24383 script. The regexp is a POSIX Extended Regular Expression.
24384
24385 This option does not affect the behavior of the -G option, and the
24386 specified sections are in addition to the standard ".sdata" and
24387 ".sbss" small-data sections that are recognized by -mgpopt.
24388
24389 -mr0rel-sec=regexp
24390 This option specifies names of sections that can be accessed via a
24391 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
24392 32-bit address space. It is most useful in conjunction with
24393 "section" attributes on variable declarations and a custom linker
24394 script. The regexp is a POSIX Extended Regular Expression.
24395
24396 In contrast to the use of GP-relative addressing for small data,
24397 zero-based addressing is never generated by default and there are
24398 no conventional section names used in standard linker scripts for
24399 sections in the low or high areas of memory.
24400
24401 -mel
24402 -meb
24403 Generate little-endian (default) or big-endian (experimental) code,
24404 respectively.
24405
24406 -march=arch
24407 This specifies the name of the target Nios II architecture. GCC
24408 uses this name to determine what kind of instructions it can emit
24409 when generating assembly code. Permissible names are: r1, r2.
24410
24411 The preprocessor macro "__nios2_arch__" is available to programs,
24412 with value 1 or 2, indicating the targeted ISA level.
24413
24414 -mbypass-cache
24415 -mno-bypass-cache
24416 Force all load and store instructions to always bypass cache by
24417 using I/O variants of the instructions. The default is not to
24418 bypass the cache.
24419
24420 -mno-cache-volatile
24421 -mcache-volatile
24422 Volatile memory access bypass the cache using the I/O variants of
24423 the load and store instructions. The default is not to bypass the
24424 cache.
24425
24426 -mno-fast-sw-div
24427 -mfast-sw-div
24428 Do not use table-based fast divide for small numbers. The default
24429 is to use the fast divide at -O3 and above.
24430
24431 -mno-hw-mul
24432 -mhw-mul
24433 -mno-hw-mulx
24434 -mhw-mulx
24435 -mno-hw-div
24436 -mhw-div
24437 Enable or disable emitting "mul", "mulx" and "div" family of
24438 instructions by the compiler. The default is to emit "mul" and not
24439 emit "div" and "mulx".
24440
24441 -mbmx
24442 -mno-bmx
24443 -mcdx
24444 -mno-cdx
24445 Enable or disable generation of Nios II R2 BMX (bit manipulation)
24446 and CDX (code density) instructions. Enabling these instructions
24447 also requires -march=r2. Since these instructions are optional
24448 extensions to the R2 architecture, the default is not to emit them.
24449
24450 -mcustom-insn=N
24451 -mno-custom-insn
24452 Each -mcustom-insn=N option enables use of a custom instruction
24453 with encoding N when generating code that uses insn. For example,
24454 -mcustom-fadds=253 generates custom instruction 253 for single-
24455 precision floating-point add operations instead of the default
24456 behavior of using a library call.
24457
24458 The following values of insn are supported. Except as otherwise
24459 noted, floating-point operations are expected to be implemented
24460 with normal IEEE 754 semantics and correspond directly to the C
24461 operators or the equivalent GCC built-in functions.
24462
24463 Single-precision floating point:
24464
24465 fadds, fsubs, fdivs, fmuls
24466 Binary arithmetic operations.
24467
24468 fnegs
24469 Unary negation.
24470
24471 fabss
24472 Unary absolute value.
24473
24474 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
24475 Comparison operations.
24476
24477 fmins, fmaxs
24478 Floating-point minimum and maximum. These instructions are
24479 only generated if -ffinite-math-only is specified.
24480
24481 fsqrts
24482 Unary square root operation.
24483
24484 fcoss, fsins, ftans, fatans, fexps, flogs
24485 Floating-point trigonometric and exponential functions. These
24486 instructions are only generated if -funsafe-math-optimizations
24487 is also specified.
24488
24489 Double-precision floating point:
24490
24491 faddd, fsubd, fdivd, fmuld
24492 Binary arithmetic operations.
24493
24494 fnegd
24495 Unary negation.
24496
24497 fabsd
24498 Unary absolute value.
24499
24500 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
24501 Comparison operations.
24502
24503 fmind, fmaxd
24504 Double-precision minimum and maximum. These instructions are
24505 only generated if -ffinite-math-only is specified.
24506
24507 fsqrtd
24508 Unary square root operation.
24509
24510 fcosd, fsind, ftand, fatand, fexpd, flogd
24511 Double-precision trigonometric and exponential functions.
24512 These instructions are only generated if
24513 -funsafe-math-optimizations is also specified.
24514
24515 Conversions:
24516
24517 fextsd
24518 Conversion from single precision to double precision.
24519
24520 ftruncds
24521 Conversion from double precision to single precision.
24522
24523 fixsi, fixsu, fixdi, fixdu
24524 Conversion from floating point to signed or unsigned integer
24525 types, with truncation towards zero.
24526
24527 round
24528 Conversion from single-precision floating point to signed
24529 integer, rounding to the nearest integer and ties away from
24530 zero. This corresponds to the "__builtin_lroundf" function
24531 when -fno-math-errno is used.
24532
24533 floatis, floatus, floatid, floatud
24534 Conversion from signed or unsigned integer types to floating-
24535 point types.
24536
24537 In addition, all of the following transfer instructions for
24538 internal registers X and Y must be provided to use any of the
24539 double-precision floating-point instructions. Custom instructions
24540 taking two double-precision source operands expect the first
24541 operand in the 64-bit register X. The other operand (or only
24542 operand of a unary operation) is given to the custom arithmetic
24543 instruction with the least significant half in source register src1
24544 and the most significant half in src2. A custom instruction that
24545 returns a double-precision result returns the most significant 32
24546 bits in the destination register and the other half in 32-bit
24547 register Y. GCC automatically generates the necessary code
24548 sequences to write register X and/or read register Y when double-
24549 precision floating-point instructions are used.
24550
24551 fwrx
24552 Write src1 into the least significant half of X and src2 into
24553 the most significant half of X.
24554
24555 fwry
24556 Write src1 into Y.
24557
24558 frdxhi, frdxlo
24559 Read the most or least (respectively) significant half of X and
24560 store it in dest.
24561
24562 frdy
24563 Read the value of Y and store it into dest.
24564
24565 Note that you can gain more local control over generation of Nios
24566 II custom instructions by using the target("custom-insn=N") and
24567 target("no-custom-insn") function attributes or pragmas.
24568
24569 -mcustom-fpu-cfg=name
24570 This option enables a predefined, named set of custom instruction
24571 encodings (see -mcustom-insn above). Currently, the following sets
24572 are defined:
24573
24574 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
24575 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
24576
24577 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
24578 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
24579 -fsingle-precision-constant
24580
24581 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
24582 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
24583 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
24584 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
24585 -mcustom-fdivs=255 -fsingle-precision-constant
24586
24587 -mcustom-fpu-cfg=fph2 is equivalent to: -mcustom-fabss=224
24588 -mcustom-fnegs=225 -mcustom-fcmpnes=226 -mcustom-fcmpeqs=227
24589 -mcustom-fcmpges=228 -mcustom-fcmpgts=229 -mcustom-fcmples=230
24590 -mcustom-fcmplts=231 -mcustom-fmaxs=232 -mcustom-fmins=233
24591 -mcustom-round=248 -mcustom-fixsi=249 -mcustom-floatis=250
24592 -mcustom-fsqrts=251 -mcustom-fmuls=252 -mcustom-fadds=253
24593 -mcustom-fsubs=254 -mcustom-fdivs=255
24594
24595 Custom instruction assignments given by individual -mcustom-insn=
24596 options override those given by -mcustom-fpu-cfg=, regardless of
24597 the order of the options on the command line.
24598
24599 Note that you can gain more local control over selection of a FPU
24600 configuration by using the target("custom-fpu-cfg=name") function
24601 attribute or pragma.
24602
24603 The name fph2 is an abbreviation for Nios II Floating Point
24604 Hardware 2 Component. Please note that the custom instructions
24605 enabled by -mcustom-fmins=233 and -mcustom-fmaxs=234 are only
24606 generated if -ffinite-math-only is specified. The custom
24607 instruction enabled by -mcustom-round=248 is only generated if
24608 -fno-math-errno is specified. In contrast to the other
24609 configurations, -fsingle-precision-constant is not set.
24610
24611 These additional -m options are available for the Altera Nios II ELF
24612 (bare-metal) target:
24613
24614 -mhal
24615 Link with HAL BSP. This suppresses linking with the GCC-provided C
24616 runtime startup and termination code, and is typically used in
24617 conjunction with -msys-crt0= to specify the location of the
24618 alternate startup code provided by the HAL BSP.
24619
24620 -msmallc
24621 Link with a limited version of the C library, -lsmallc, rather than
24622 Newlib.
24623
24624 -msys-crt0=startfile
24625 startfile is the file name of the startfile (crt0) to use when
24626 linking. This option is only useful in conjunction with -mhal.
24627
24628 -msys-lib=systemlib
24629 systemlib is the library name of the library that provides low-
24630 level system calls required by the C library, e.g. "read" and
24631 "write". This option is typically used to link with a library
24632 provided by a HAL BSP.
24633
24634 Nvidia PTX Options
24635
24636 These options are defined for Nvidia PTX:
24637
24638 -m64
24639 Ignored, but preserved for backward compatibility. Only 64-bit ABI
24640 is supported.
24641
24642 -march=architecture-string
24643 Generate code for the specified PTX ISA target architecture (e.g.
24644 sm_35). Valid architecture strings are sm_30, sm_35, sm_53, sm_70,
24645 sm_75 and sm_80. The default depends on how the compiler has been
24646 configured, see --with-arch.
24647
24648 This option sets the value of the preprocessor macro "__PTX_SM__";
24649 for instance, for sm_35, it has the value 350.
24650
24651 -misa=architecture-string
24652 Alias of -march=.
24653
24654 -march-map=architecture-string
24655 Select the closest available -march= value that is not more
24656 capable. For instance, for -march-map=sm_50 select -march=sm_35,
24657 and for -march-map=sm_53 select -march=sm_53.
24658
24659 -mptx=version-string
24660 Generate code for the specified PTX ISA version (e.g. 7.0). Valid
24661 version strings include 3.1, 6.0, 6.3, and 7.0. The default PTX
24662 ISA version is 6.0, unless a higher version is required for
24663 specified PTX ISA target architecture via option -march=.
24664
24665 This option sets the values of the preprocessor macros
24666 "__PTX_ISA_VERSION_MAJOR__" and "__PTX_ISA_VERSION_MINOR__"; for
24667 instance, for 3.1 the macros have the values 3 and 1, respectively.
24668
24669 -mmainkernel
24670 Link in code for a __main kernel. This is for stand-alone instead
24671 of offloading execution.
24672
24673 -moptimize
24674 Apply partitioned execution optimizations. This is the default
24675 when any level of optimization is selected.
24676
24677 -msoft-stack
24678 Generate code that does not use ".local" memory directly for stack
24679 storage. Instead, a per-warp stack pointer is maintained
24680 explicitly. This enables variable-length stack allocation (with
24681 variable-length arrays or "alloca"), and when global memory is used
24682 for underlying storage, makes it possible to access automatic
24683 variables from other threads, or with atomic instructions. This
24684 code generation variant is used for OpenMP offloading, but the
24685 option is exposed on its own for the purpose of testing the
24686 compiler; to generate code suitable for linking into programs using
24687 OpenMP offloading, use option -mgomp.
24688
24689 -muniform-simt
24690 Switch to code generation variant that allows to execute all
24691 threads in each warp, while maintaining memory state and side
24692 effects as if only one thread in each warp was active outside of
24693 OpenMP SIMD regions. All atomic operations and calls to runtime
24694 (malloc, free, vprintf) are conditionally executed (iff current
24695 lane index equals the master lane index), and the register being
24696 assigned is copied via a shuffle instruction from the master lane.
24697 Outside of SIMD regions lane 0 is the master; inside, each thread
24698 sees itself as the master. Shared memory array "int __nvptx_uni[]"
24699 stores all-zeros or all-ones bitmasks for each warp, indicating
24700 current mode (0 outside of SIMD regions). Each thread can bitwise-
24701 and the bitmask at position "tid.y" with current lane index to
24702 compute the master lane index.
24703
24704 -mgomp
24705 Generate code for use in OpenMP offloading: enables -msoft-stack
24706 and -muniform-simt options, and selects corresponding multilib
24707 variant.
24708
24709 OpenRISC Options
24710
24711 These options are defined for OpenRISC:
24712
24713 -mboard=name
24714 Configure a board specific runtime. This will be passed to the
24715 linker for newlib board library linking. The default is "or1ksim".
24716
24717 -mnewlib
24718 This option is ignored; it is for compatibility purposes only.
24719 This used to select linker and preprocessor options for use with
24720 newlib.
24721
24722 -msoft-div
24723 -mhard-div
24724 Select software or hardware divide ("l.div", "l.divu")
24725 instructions. This default is hardware divide.
24726
24727 -msoft-mul
24728 -mhard-mul
24729 Select software or hardware multiply ("l.mul", "l.muli")
24730 instructions. This default is hardware multiply.
24731
24732 -msoft-float
24733 -mhard-float
24734 Select software or hardware for floating point operations. The
24735 default is software.
24736
24737 -mdouble-float
24738 When -mhard-float is selected, enables generation of double-
24739 precision floating point instructions. By default functions from
24740 libgcc are used to perform double-precision floating point
24741 operations.
24742
24743 -munordered-float
24744 When -mhard-float is selected, enables generation of unordered
24745 floating point compare and set flag ("lf.sfun*") instructions. By
24746 default functions from libgcc are used to perform unordered
24747 floating point compare and set flag operations.
24748
24749 -mcmov
24750 Enable generation of conditional move ("l.cmov") instructions. By
24751 default the equivalent will be generated using set and branch.
24752
24753 -mror
24754 Enable generation of rotate right ("l.ror") instructions. By
24755 default functions from libgcc are used to perform rotate right
24756 operations.
24757
24758 -mrori
24759 Enable generation of rotate right with immediate ("l.rori")
24760 instructions. By default functions from libgcc are used to perform
24761 rotate right with immediate operations.
24762
24763 -msext
24764 Enable generation of sign extension ("l.ext*") instructions. By
24765 default memory loads are used to perform sign extension.
24766
24767 -msfimm
24768 Enable generation of compare and set flag with immediate ("l.sf*i")
24769 instructions. By default extra instructions will be generated to
24770 store the immediate to a register first.
24771
24772 -mshftimm
24773 Enable generation of shift with immediate ("l.srai", "l.srli",
24774 "l.slli") instructions. By default extra instructions will be
24775 generated to store the immediate to a register first.
24776
24777 -mcmodel=small
24778 Generate OpenRISC code for the small model: The GOT is limited to
24779 64k. This is the default model.
24780
24781 -mcmodel=large
24782 Generate OpenRISC code for the large model: The GOT may grow up to
24783 4G in size.
24784
24785 PDP-11 Options
24786
24787 These options are defined for the PDP-11:
24788
24789 -mfpu
24790 Use hardware FPP floating point. This is the default. (FIS
24791 floating point on the PDP-11/40 is not supported.) Implies -m45.
24792
24793 -msoft-float
24794 Do not use hardware floating point.
24795
24796 -mac0
24797 Return floating-point results in ac0 (fr0 in Unix assembler
24798 syntax).
24799
24800 -mno-ac0
24801 Return floating-point results in memory. This is the default.
24802
24803 -m40
24804 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
24805
24806 -m45
24807 Generate code for a PDP-11/45. This is the default.
24808
24809 -m10
24810 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
24811
24812 -mint16
24813 -mno-int32
24814 Use 16-bit "int". This is the default.
24815
24816 -mint32
24817 -mno-int16
24818 Use 32-bit "int".
24819
24820 -msplit
24821 Target has split instruction and data space. Implies -m45.
24822
24823 -munix-asm
24824 Use Unix assembler syntax.
24825
24826 -mdec-asm
24827 Use DEC assembler syntax.
24828
24829 -mgnu-asm
24830 Use GNU assembler syntax. This is the default.
24831
24832 -mlra
24833 Use the new LRA register allocator. By default, the old "reload"
24834 allocator is used.
24835
24836 PowerPC Options
24837
24838 These are listed under
24839
24840 PRU Options
24841
24842 These command-line options are defined for PRU target:
24843
24844 -minrt
24845 Link with a minimum runtime environment, with no support for static
24846 initializers and constructors. Using this option can significantly
24847 reduce the size of the final ELF binary. Beware that the compiler
24848 could still generate code with static initializers and
24849 constructors. It is up to the programmer to ensure that the source
24850 program will not use those features.
24851
24852 -mmcu=mcu
24853 Specify the PRU MCU variant to use. Check Newlib for the exact
24854 list of supported MCUs.
24855
24856 -mno-relax
24857 Make GCC pass the --no-relax command-line option to the linker
24858 instead of the --relax option.
24859
24860 -mloop
24861 Allow (or do not allow) GCC to use the LOOP instruction.
24862
24863 -mabi=variant
24864 Specify the ABI variant to output code for. -mabi=ti selects the
24865 unmodified TI ABI while -mabi=gnu selects a GNU variant that copes
24866 more naturally with certain GCC assumptions. These are the
24867 differences:
24868
24869 Function Pointer Size
24870 TI ABI specifies that function (code) pointers are 16-bit,
24871 whereas GNU supports only 32-bit data and code pointers.
24872
24873 Optional Return Value Pointer
24874 Function return values larger than 64 bits are passed by using
24875 a hidden pointer as the first argument of the function. TI
24876 ABI, though, mandates that the pointer can be NULL in case the
24877 caller is not using the returned value. GNU always passes and
24878 expects a valid return value pointer.
24879
24880 The current -mabi=ti implementation simply raises a compile error
24881 when any of the above code constructs is detected. As a
24882 consequence the standard C library cannot be built and it is
24883 omitted when linking with -mabi=ti.
24884
24885 Relaxation is a GNU feature and for safety reasons is disabled when
24886 using -mabi=ti. The TI toolchain does not emit relocations for
24887 QBBx instructions, so the GNU linker cannot adjust them when
24888 shortening adjacent LDI32 pseudo instructions.
24889
24890 RISC-V Options
24891
24892 These command-line options are defined for RISC-V targets:
24893
24894 -mbranch-cost=n
24895 Set the cost of branches to roughly n instructions.
24896
24897 -mplt
24898 -mno-plt
24899 When generating PIC code, do or don't allow the use of PLTs.
24900 Ignored for non-PIC. The default is -mplt.
24901
24902 -mabi=ABI-string
24903 Specify integer and floating-point calling convention. ABI-string
24904 contains two parts: the size of integer types and the registers
24905 used for floating-point types. For example -march=rv64ifd
24906 -mabi=lp64d means that long and pointers are 64-bit (implicitly
24907 defining int to be 32-bit), and that floating-point values up to 64
24908 bits wide are passed in F registers. Contrast this with
24909 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
24910 generate code that uses the F and D extensions but only allows
24911 floating-point values up to 32 bits long to be passed in registers;
24912 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
24913 will be passed in registers.
24914
24915 The default for this argument is system dependent, users who want a
24916 specific calling convention should specify one explicitly. The
24917 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
24918 and lp64d. Some calling conventions are impossible to implement on
24919 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
24920 because the ABI requires 64-bit values be passed in F registers,
24921 but F registers are only 32 bits wide. There is also the ilp32e
24922 ABI that can only be used with the rv32e architecture. This ABI is
24923 not well specified at present, and is subject to change.
24924
24925 -mfdiv
24926 -mno-fdiv
24927 Do or don't use hardware floating-point divide and square root
24928 instructions. This requires the F or D extensions for floating-
24929 point registers. The default is to use them if the specified
24930 architecture has these instructions.
24931
24932 -mdiv
24933 -mno-div
24934 Do or don't use hardware instructions for integer division. This
24935 requires the M extension. The default is to use them if the
24936 specified architecture has these instructions.
24937
24938 -misa-spec=ISA-spec-string
24939 Specify the version of the RISC-V Unprivileged (formerly User-
24940 Level) ISA specification to produce code conforming to. The
24941 possibilities for ISA-spec-string are:
24942
24943 2.2 Produce code conforming to version 2.2.
24944
24945 20190608
24946 Produce code conforming to version 20190608.
24947
24948 20191213
24949 Produce code conforming to version 20191213.
24950
24951 The default is -misa-spec=20191213 unless GCC has been configured
24952 with --with-isa-spec= specifying a different default version.
24953
24954 -march=ISA-string
24955 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
24956 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
24957
24958 When -march= is not specified, use the setting from -mcpu.
24959
24960 If both -march and -mcpu= are not specified, the default for this
24961 argument is system dependent, users who want a specific
24962 architecture extensions should specify one explicitly.
24963
24964 -mcpu=processor-string
24965 Use architecture of and optimize the output for the given
24966 processor, specified by particular CPU name. Permissible values
24967 for this option are: sifive-e20, sifive-e21, sifive-e24,
24968 sifive-e31, sifive-e34, sifive-e76, sifive-s21, sifive-s51,
24969 sifive-s54, sifive-s76, sifive-u54, and sifive-u74.
24970
24971 -mtune=processor-string
24972 Optimize the output for the given processor, specified by
24973 microarchitecture or particular CPU name. Permissible values for
24974 this option are: rocket, sifive-3-series, sifive-5-series,
24975 sifive-7-series, thead-c906, size, and all valid options for
24976 -mcpu=.
24977
24978 When -mtune= is not specified, use the setting from -mcpu, the
24979 default is rocket if both are not specified.
24980
24981 The size choice is not intended for use by end-users. This is used
24982 when -Os is specified. It overrides the instruction cost info
24983 provided by -mtune=, but does not override the pipeline info. This
24984 helps reduce code size while still giving good performance.
24985
24986 -mpreferred-stack-boundary=num
24987 Attempt to keep the stack boundary aligned to a 2 raised to num
24988 byte boundary. If -mpreferred-stack-boundary is not specified, the
24989 default is 4 (16 bytes or 128-bits).
24990
24991 Warning: If you use this switch, then you must build all modules
24992 with the same value, including any libraries. This includes the
24993 system libraries and startup modules.
24994
24995 -msmall-data-limit=n
24996 Put global and static data smaller than n bytes into a special
24997 section (on some targets).
24998
24999 -msave-restore
25000 -mno-save-restore
25001 Do or don't use smaller but slower prologue and epilogue code that
25002 uses library function calls. The default is to use fast inline
25003 prologues and epilogues.
25004
25005 -minline-atomics
25006 -mno-inline-atomics
25007 Do or don't use smaller but slower subword atomic emulation code
25008 that uses libatomic function calls. The default is to use fast
25009 inline subword atomics that do not require libatomic.
25010
25011 -mshorten-memrefs
25012 -mno-shorten-memrefs
25013 Do or do not attempt to make more use of compressed load/store
25014 instructions by replacing a load/store of 'base register + large
25015 offset' with a new load/store of 'new base + small offset'. If the
25016 new base gets stored in a compressed register, then the new
25017 load/store can be compressed. Currently targets 32-bit integer
25018 load/stores only.
25019
25020 -mstrict-align
25021 -mno-strict-align
25022 Do not or do generate unaligned memory accesses. The default is
25023 set depending on whether the processor we are optimizing for
25024 supports fast unaligned access or not.
25025
25026 -mcmodel=medlow
25027 Generate code for the medium-low code model. The program and its
25028 statically defined symbols must lie within a single 2 GiB address
25029 range and must lie between absolute addresses -2 GiB and +2 GiB.
25030 Programs can be statically or dynamically linked. This is the
25031 default code model.
25032
25033 -mcmodel=medany
25034 Generate code for the medium-any code model. The program and its
25035 statically defined symbols must be within any single 2 GiB address
25036 range. Programs can be statically or dynamically linked.
25037
25038 The code generated by the medium-any code model is position-
25039 independent, but is not guaranteed to function correctly when
25040 linked into position-independent executables or libraries.
25041
25042 -mexplicit-relocs
25043 -mno-exlicit-relocs
25044 Use or do not use assembler relocation operators when dealing with
25045 symbolic addresses. The alternative is to use assembler macros
25046 instead, which may limit optimization.
25047
25048 -mrelax
25049 -mno-relax
25050 Take advantage of linker relaxations to reduce the number of
25051 instructions required to materialize symbol addresses. The default
25052 is to take advantage of linker relaxations.
25053
25054 -mriscv-attribute
25055 -mno-riscv-attribute
25056 Emit (do not emit) RISC-V attribute to record extra information
25057 into ELF objects. This feature requires at least binutils 2.32.
25058
25059 -mcsr-check
25060 -mno-csr-check
25061 Enables or disables the CSR checking.
25062
25063 -malign-data=type
25064 Control how GCC aligns variables and constants of array, structure,
25065 or union types. Supported values for type are xlen which uses x
25066 register width as the alignment value, and natural which uses
25067 natural alignment. xlen is the default.
25068
25069 -mbig-endian
25070 Generate big-endian code. This is the default when GCC is
25071 configured for a riscv64be-*-* or riscv32be-*-* target.
25072
25073 -mlittle-endian
25074 Generate little-endian code. This is the default when GCC is
25075 configured for a riscv64-*-* or riscv32-*-* but not a riscv64be-*-*
25076 or riscv32be-*-* target.
25077
25078 -mstack-protector-guard=guard
25079 -mstack-protector-guard-reg=reg
25080 -mstack-protector-guard-offset=offset
25081 Generate stack protection code using canary at guard. Supported
25082 locations are global for a global canary or tls for per-thread
25083 canary in the TLS block.
25084
25085 With the latter choice the options -mstack-protector-guard-reg=reg
25086 and -mstack-protector-guard-offset=offset furthermore specify which
25087 register to use as base register for reading the canary, and from
25088 what offset from that base register. There is no default register
25089 or offset as this is entirely for use within the Linux kernel.
25090
25091 RL78 Options
25092
25093 -msim
25094 Links in additional target libraries to support operation within a
25095 simulator.
25096
25097 -mmul=none
25098 -mmul=g10
25099 -mmul=g13
25100 -mmul=g14
25101 -mmul=rl78
25102 Specifies the type of hardware multiplication and division support
25103 to be used. The simplest is "none", which uses software for both
25104 multiplication and division. This is the default. The "g13" value
25105 is for the hardware multiply/divide peripheral found on the
25106 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
25107 multiplication and division instructions supported by the RL78/G14
25108 (S3 core) parts. The value "rl78" is an alias for "g14" and the
25109 value "mg10" is an alias for "none".
25110
25111 In addition a C preprocessor macro is defined, based upon the
25112 setting of this option. Possible values are: "__RL78_MUL_NONE__",
25113 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
25114
25115 -mcpu=g10
25116 -mcpu=g13
25117 -mcpu=g14
25118 -mcpu=rl78
25119 Specifies the RL78 core to target. The default is the G14 core,
25120 also known as an S3 core or just RL78. The G13 or S2 core does not
25121 have multiply or divide instructions, instead it uses a hardware
25122 peripheral for these operations. The G10 or S1 core does not have
25123 register banks, so it uses a different calling convention.
25124
25125 If this option is set it also selects the type of hardware multiply
25126 support to use, unless this is overridden by an explicit -mmul=none
25127 option on the command line. Thus specifying -mcpu=g13 enables the
25128 use of the G13 hardware multiply peripheral and specifying
25129 -mcpu=g10 disables the use of hardware multiplications altogether.
25130
25131 Note, although the RL78/G14 core is the default target, specifying
25132 -mcpu=g14 or -mcpu=rl78 on the command line does change the
25133 behavior of the toolchain since it also enables G14 hardware
25134 multiply support. If these options are not specified on the
25135 command line then software multiplication routines will be used
25136 even though the code targets the RL78 core. This is for backwards
25137 compatibility with older toolchains which did not have hardware
25138 multiply and divide support.
25139
25140 In addition a C preprocessor macro is defined, based upon the
25141 setting of this option. Possible values are: "__RL78_G10__",
25142 "__RL78_G13__" or "__RL78_G14__".
25143
25144 -mg10
25145 -mg13
25146 -mg14
25147 -mrl78
25148 These are aliases for the corresponding -mcpu= option. They are
25149 provided for backwards compatibility.
25150
25151 -mallregs
25152 Allow the compiler to use all of the available registers. By
25153 default registers "r24..r31" are reserved for use in interrupt
25154 handlers. With this option enabled these registers can be used in
25155 ordinary functions as well.
25156
25157 -m64bit-doubles
25158 -m32bit-doubles
25159 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
25160 (-m32bit-doubles) in size. The default is -m32bit-doubles.
25161
25162 -msave-mduc-in-interrupts
25163 -mno-save-mduc-in-interrupts
25164 Specifies that interrupt handler functions should preserve the MDUC
25165 registers. This is only necessary if normal code might use the
25166 MDUC registers, for example because it performs multiplication and
25167 division operations. The default is to ignore the MDUC registers
25168 as this makes the interrupt handlers faster. The target option
25169 -mg13 needs to be passed for this to work as this feature is only
25170 available on the G13 target (S2 core). The MDUC registers will
25171 only be saved if the interrupt handler performs a multiplication or
25172 division operation or it calls another function.
25173
25174 IBM RS/6000 and PowerPC Options
25175
25176 These -m options are defined for the IBM RS/6000 and PowerPC:
25177
25178 -mpowerpc-gpopt
25179 -mno-powerpc-gpopt
25180 -mpowerpc-gfxopt
25181 -mno-powerpc-gfxopt
25182 -mpowerpc64
25183 -mno-powerpc64
25184 -mmfcrf
25185 -mno-mfcrf
25186 -mpopcntb
25187 -mno-popcntb
25188 -mpopcntd
25189 -mno-popcntd
25190 -mfprnd
25191 -mno-fprnd
25192 -mcmpb
25193 -mno-cmpb
25194 -mhard-dfp
25195 -mno-hard-dfp
25196 You use these options to specify which instructions are available
25197 on the processor you are using. The default value of these options
25198 is determined when configuring GCC. Specifying the -mcpu=cpu_type
25199 overrides the specification of these options. We recommend you use
25200 the -mcpu=cpu_type option rather than the options listed above.
25201
25202 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
25203 architecture instructions in the General Purpose group, including
25204 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
25205 to use the optional PowerPC architecture instructions in the
25206 Graphics group, including floating-point select.
25207
25208 The -mmfcrf option allows GCC to generate the move from condition
25209 register field instruction implemented on the POWER4 processor and
25210 other processors that support the PowerPC V2.01 architecture. The
25211 -mpopcntb option allows GCC to generate the popcount and double-
25212 precision FP reciprocal estimate instruction implemented on the
25213 POWER5 processor and other processors that support the PowerPC
25214 V2.02 architecture. The -mpopcntd option allows GCC to generate
25215 the popcount instruction implemented on the POWER7 processor and
25216 other processors that support the PowerPC V2.06 architecture. The
25217 -mfprnd option allows GCC to generate the FP round to integer
25218 instructions implemented on the POWER5+ processor and other
25219 processors that support the PowerPC V2.03 architecture. The -mcmpb
25220 option allows GCC to generate the compare bytes instruction
25221 implemented on the POWER6 processor and other processors that
25222 support the PowerPC V2.05 architecture. The -mhard-dfp option
25223 allows GCC to generate the decimal floating-point instructions
25224 implemented on some POWER processors.
25225
25226 The -mpowerpc64 option allows GCC to generate the additional 64-bit
25227 instructions that are found in the full PowerPC64 architecture and
25228 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
25229 -mno-powerpc64.
25230
25231 -mcpu=cpu_type
25232 Set architecture type, register usage, and instruction scheduling
25233 parameters for machine type cpu_type. Supported values for
25234 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
25235 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
25236 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
25237 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
25238 power4, power5, power5+, power6, power6x, power7, power8, power9,
25239 power10, powerpc, powerpc64, powerpc64le, rs64, and native.
25240
25241 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
25242 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
25243 64-bit little endian PowerPC architecture machine types, with an
25244 appropriate, generic processor model assumed for scheduling
25245 purposes.
25246
25247 Specifying native as cpu type detects and selects the architecture
25248 option that corresponds to the host processor of the system
25249 performing the compilation. -mcpu=native has no effect if GCC does
25250 not recognize the processor.
25251
25252 The other options specify a specific processor. Code generated
25253 under those options runs best on that processor, and may not run at
25254 all on others.
25255
25256 The -mcpu options automatically enable or disable the following
25257 options:
25258
25259 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
25260 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
25261 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
25262 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
25263 -mfloat128-hardware -mprefixed -mpcrel -mmma -mrop-protect
25264
25265 The particular options set for any particular CPU varies between
25266 compiler versions, depending on what setting seems to produce
25267 optimal code for that CPU; it doesn't necessarily reflect the
25268 actual hardware's capabilities. If you wish to set an individual
25269 option to a particular value, you may specify it after the -mcpu
25270 option, like -mcpu=970 -mno-altivec.
25271
25272 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
25273 disabled by the -mcpu option at present because AIX does not have
25274 full support for these options. You may still enable or disable
25275 them individually if you're sure it'll work in your environment.
25276
25277 -mtune=cpu_type
25278 Set the instruction scheduling parameters for machine type
25279 cpu_type, but do not set the architecture type or register usage,
25280 as -mcpu=cpu_type does. The same values for cpu_type are used for
25281 -mtune as for -mcpu. If both are specified, the code generated
25282 uses the architecture and registers set by -mcpu, but the
25283 scheduling parameters set by -mtune.
25284
25285 -mcmodel=small
25286 Generate PowerPC64 code for the small model: The TOC is limited to
25287 64k.
25288
25289 -mcmodel=medium
25290 Generate PowerPC64 code for the medium model: The TOC and other
25291 static data may be up to a total of 4G in size. This is the
25292 default for 64-bit Linux.
25293
25294 -mcmodel=large
25295 Generate PowerPC64 code for the large model: The TOC may be up to
25296 4G in size. Other data and code is only limited by the 64-bit
25297 address space.
25298
25299 -maltivec
25300 -mno-altivec
25301 Generate code that uses (does not use) AltiVec instructions, and
25302 also enable the use of built-in functions that allow more direct
25303 access to the AltiVec instruction set. You may also need to set
25304 -mabi=altivec to adjust the current ABI with AltiVec ABI
25305 enhancements.
25306
25307 When -maltivec is used, the element order for AltiVec intrinsics
25308 such as "vec_splat", "vec_extract", and "vec_insert" match array
25309 element order corresponding to the endianness of the target. That
25310 is, element zero identifies the leftmost element in a vector
25311 register when targeting a big-endian platform, and identifies the
25312 rightmost element in a vector register when targeting a little-
25313 endian platform.
25314
25315 -mvrsave
25316 -mno-vrsave
25317 Generate VRSAVE instructions when generating AltiVec code.
25318
25319 -msecure-plt
25320 Generate code that allows ld and ld.so to build executables and
25321 shared libraries with non-executable ".plt" and ".got" sections.
25322 This is a PowerPC 32-bit SYSV ABI option.
25323
25324 -mbss-plt
25325 Generate code that uses a BSS ".plt" section that ld.so fills in,
25326 and requires ".plt" and ".got" sections that are both writable and
25327 executable. This is a PowerPC 32-bit SYSV ABI option.
25328
25329 -misel
25330 -mno-isel
25331 This switch enables or disables the generation of ISEL
25332 instructions.
25333
25334 -mvsx
25335 -mno-vsx
25336 Generate code that uses (does not use) vector/scalar (VSX)
25337 instructions, and also enable the use of built-in functions that
25338 allow more direct access to the VSX instruction set.
25339
25340 -mcrypto
25341 -mno-crypto
25342 Enable the use (disable) of the built-in functions that allow
25343 direct access to the cryptographic instructions that were added in
25344 version 2.07 of the PowerPC ISA.
25345
25346 -mhtm
25347 -mno-htm
25348 Enable (disable) the use of the built-in functions that allow
25349 direct access to the Hardware Transactional Memory (HTM)
25350 instructions that were added in version 2.07 of the PowerPC ISA.
25351
25352 -mpower8-fusion
25353 -mno-power8-fusion
25354 Generate code that keeps (does not keeps) some integer operations
25355 adjacent so that the instructions can be fused together on power8
25356 and later processors.
25357
25358 -mpower8-vector
25359 -mno-power8-vector
25360 Generate code that uses (does not use) the vector and scalar
25361 instructions that were added in version 2.07 of the PowerPC ISA.
25362 Also enable the use of built-in functions that allow more direct
25363 access to the vector instructions.
25364
25365 -mquad-memory
25366 -mno-quad-memory
25367 Generate code that uses (does not use) the non-atomic quad word
25368 memory instructions. The -mquad-memory option requires use of
25369 64-bit mode.
25370
25371 -mquad-memory-atomic
25372 -mno-quad-memory-atomic
25373 Generate code that uses (does not use) the atomic quad word memory
25374 instructions. The -mquad-memory-atomic option requires use of
25375 64-bit mode.
25376
25377 -mfloat128
25378 -mno-float128
25379 Enable/disable the __float128 keyword for IEEE 128-bit floating
25380 point and use either software emulation for IEEE 128-bit floating
25381 point or hardware instructions.
25382
25383 The VSX instruction set (-mvsx) must be enabled to use the IEEE
25384 128-bit floating point support. The IEEE 128-bit floating point is
25385 only supported on Linux.
25386
25387 The default for -mfloat128 is enabled on PowerPC Linux systems
25388 using the VSX instruction set, and disabled on other systems.
25389
25390 If you use the ISA 3.0 instruction set (-mpower9-vector or
25391 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
25392 support will also enable the generation of ISA 3.0 IEEE 128-bit
25393 floating point instructions. Otherwise, if you do not specify to
25394 generate ISA 3.0 instructions or you are targeting a 32-bit big
25395 endian system, IEEE 128-bit floating point will be done with
25396 software emulation.
25397
25398 -mfloat128-hardware
25399 -mno-float128-hardware
25400 Enable/disable using ISA 3.0 hardware instructions to support the
25401 __float128 data type.
25402
25403 The default for -mfloat128-hardware is enabled on PowerPC Linux
25404 systems using the ISA 3.0 instruction set, and disabled on other
25405 systems.
25406
25407 -m32
25408 -m64
25409 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
25410 targets (including GNU/Linux). The 32-bit environment sets int,
25411 long and pointer to 32 bits and generates code that runs on any
25412 PowerPC variant. The 64-bit environment sets int to 32 bits and
25413 long and pointer to 64 bits, and generates code for PowerPC64, as
25414 for -mpowerpc64.
25415
25416 -mfull-toc
25417 -mno-fp-in-toc
25418 -mno-sum-in-toc
25419 -mminimal-toc
25420 Modify generation of the TOC (Table Of Contents), which is created
25421 for every executable file. The -mfull-toc option is selected by
25422 default. In that case, GCC allocates at least one TOC entry for
25423 each unique non-automatic variable reference in your program. GCC
25424 also places floating-point constants in the TOC. However, only
25425 16,384 entries are available in the TOC.
25426
25427 If you receive a linker error message that saying you have
25428 overflowed the available TOC space, you can reduce the amount of
25429 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
25430 -mno-fp-in-toc prevents GCC from putting floating-point constants
25431 in the TOC and -mno-sum-in-toc forces GCC to generate code to
25432 calculate the sum of an address and a constant at run time instead
25433 of putting that sum into the TOC. You may specify one or both of
25434 these options. Each causes GCC to produce very slightly slower and
25435 larger code at the expense of conserving TOC space.
25436
25437 If you still run out of space in the TOC even when you specify both
25438 of these options, specify -mminimal-toc instead. This option
25439 causes GCC to make only one TOC entry for every file. When you
25440 specify this option, GCC produces code that is slower and larger
25441 but which uses extremely little TOC space. You may wish to use
25442 this option only on files that contain less frequently-executed
25443 code.
25444
25445 -maix64
25446 -maix32
25447 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
25448 64-bit "long" type, and the infrastructure needed to support them.
25449 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
25450 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
25451
25452 -mxl-compat
25453 -mno-xl-compat
25454 Produce code that conforms more closely to IBM XL compiler
25455 semantics when using AIX-compatible ABI. Pass floating-point
25456 arguments to prototyped functions beyond the register save area
25457 (RSA) on the stack in addition to argument FPRs. Do not assume
25458 that most significant double in 128-bit long double value is
25459 properly rounded when comparing values and converting to double.
25460 Use XL symbol names for long double support routines.
25461
25462 The AIX calling convention was extended but not initially
25463 documented to handle an obscure K&R C case of calling a function
25464 that takes the address of its arguments with fewer arguments than
25465 declared. IBM XL compilers access floating-point arguments that do
25466 not fit in the RSA from the stack when a subroutine is compiled
25467 without optimization. Because always storing floating-point
25468 arguments on the stack is inefficient and rarely needed, this
25469 option is not enabled by default and only is necessary when calling
25470 subroutines compiled by IBM XL compilers without optimization.
25471
25472 -mpe
25473 Support IBM RS/6000 SP Parallel Environment (PE). Link an
25474 application written to use message passing with special startup
25475 code to enable the application to run. The system must have PE
25476 installed in the standard location (/usr/lpp/ppe.poe/), or the
25477 specs file must be overridden with the -specs= option to specify
25478 the appropriate directory location. The Parallel Environment does
25479 not support threads, so the -mpe option and the -pthread option are
25480 incompatible.
25481
25482 -malign-natural
25483 -malign-power
25484 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
25485 -malign-natural overrides the ABI-defined alignment of larger
25486 types, such as floating-point doubles, on their natural size-based
25487 boundary. The option -malign-power instructs GCC to follow the
25488 ABI-specified alignment rules. GCC defaults to the standard
25489 alignment defined in the ABI.
25490
25491 On 64-bit Darwin, natural alignment is the default, and
25492 -malign-power is not supported.
25493
25494 -msoft-float
25495 -mhard-float
25496 Generate code that does not use (uses) the floating-point register
25497 set. Software floating-point emulation is provided if you use the
25498 -msoft-float option, and pass the option to GCC when linking.
25499
25500 -mmultiple
25501 -mno-multiple
25502 Generate code that uses (does not use) the load multiple word
25503 instructions and the store multiple word instructions. These
25504 instructions are generated by default on POWER systems, and not
25505 generated on PowerPC systems. Do not use -mmultiple on little-
25506 endian PowerPC systems, since those instructions do not work when
25507 the processor is in little-endian mode. The exceptions are PPC740
25508 and PPC750 which permit these instructions in little-endian mode.
25509
25510 -mupdate
25511 -mno-update
25512 Generate code that uses (does not use) the load or store
25513 instructions that update the base register to the address of the
25514 calculated memory location. These instructions are generated by
25515 default. If you use -mno-update, there is a small window between
25516 the time that the stack pointer is updated and the address of the
25517 previous frame is stored, which means code that walks the stack
25518 frame across interrupts or signals may get corrupted data.
25519
25520 -mavoid-indexed-addresses
25521 -mno-avoid-indexed-addresses
25522 Generate code that tries to avoid (not avoid) the use of indexed
25523 load or store instructions. These instructions can incur a
25524 performance penalty on Power6 processors in certain situations,
25525 such as when stepping through large arrays that cross a 16M
25526 boundary. This option is enabled by default when targeting Power6
25527 and disabled otherwise.
25528
25529 -mfused-madd
25530 -mno-fused-madd
25531 Generate code that uses (does not use) the floating-point multiply
25532 and accumulate instructions. These instructions are generated by
25533 default if hardware floating point is used. The machine-dependent
25534 -mfused-madd option is now mapped to the machine-independent
25535 -ffp-contract=fast option, and -mno-fused-madd is mapped to
25536 -ffp-contract=off.
25537
25538 -mmulhw
25539 -mno-mulhw
25540 Generate code that uses (does not use) the half-word multiply and
25541 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
25542 processors. These instructions are generated by default when
25543 targeting those processors.
25544
25545 -mdlmzb
25546 -mno-dlmzb
25547 Generate code that uses (does not use) the string-search dlmzb
25548 instruction on the IBM 405, 440, 464 and 476 processors. This
25549 instruction is generated by default when targeting those
25550 processors.
25551
25552 -mno-bit-align
25553 -mbit-align
25554 On System V.4 and embedded PowerPC systems do not (do) force
25555 structures and unions that contain bit-fields to be aligned to the
25556 base type of the bit-field.
25557
25558 For example, by default a structure containing nothing but 8
25559 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
25560 and has a size of 4 bytes. By using -mno-bit-align, the structure
25561 is aligned to a 1-byte boundary and is 1 byte in size.
25562
25563 -mno-strict-align
25564 -mstrict-align
25565 On System V.4 and embedded PowerPC systems do not (do) assume that
25566 unaligned memory references are handled by the system.
25567
25568 -mrelocatable
25569 -mno-relocatable
25570 Generate code that allows (does not allow) a static executable to
25571 be relocated to a different address at run time. A simple embedded
25572 PowerPC system loader should relocate the entire contents of
25573 ".got2" and 4-byte locations listed in the ".fixup" section, a
25574 table of 32-bit addresses generated by this option. For this to
25575 work, all objects linked together must be compiled with
25576 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
25577 stack to an 8-byte boundary.
25578
25579 -mrelocatable-lib
25580 -mno-relocatable-lib
25581 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
25582 to allow static executables to be relocated at run time, but
25583 -mrelocatable-lib does not use the smaller stack alignment of
25584 -mrelocatable. Objects compiled with -mrelocatable-lib may be
25585 linked with objects compiled with any combination of the
25586 -mrelocatable options.
25587
25588 -mno-toc
25589 -mtoc
25590 On System V.4 and embedded PowerPC systems do not (do) assume that
25591 register 2 contains a pointer to a global area pointing to the
25592 addresses used in the program.
25593
25594 -mlittle
25595 -mlittle-endian
25596 On System V.4 and embedded PowerPC systems compile code for the
25597 processor in little-endian mode. The -mlittle-endian option is the
25598 same as -mlittle.
25599
25600 -mbig
25601 -mbig-endian
25602 On System V.4 and embedded PowerPC systems compile code for the
25603 processor in big-endian mode. The -mbig-endian option is the same
25604 as -mbig.
25605
25606 -mdynamic-no-pic
25607 On Darwin and Mac OS X systems, compile code so that it is not
25608 relocatable, but that its external references are relocatable. The
25609 resulting code is suitable for applications, but not shared
25610 libraries.
25611
25612 -msingle-pic-base
25613 Treat the register used for PIC addressing as read-only, rather
25614 than loading it in the prologue for each function. The runtime
25615 system is responsible for initializing this register with an
25616 appropriate value before execution begins.
25617
25618 -mprioritize-restricted-insns=priority
25619 This option controls the priority that is assigned to dispatch-slot
25620 restricted instructions during the second scheduling pass. The
25621 argument priority takes the value 0, 1, or 2 to assign no, highest,
25622 or second-highest (respectively) priority to dispatch-slot
25623 restricted instructions.
25624
25625 -msched-costly-dep=dependence_type
25626 This option controls which dependences are considered costly by the
25627 target during instruction scheduling. The argument dependence_type
25628 takes one of the following values:
25629
25630 no No dependence is costly.
25631
25632 all All dependences are costly.
25633
25634 true_store_to_load
25635 A true dependence from store to load is costly.
25636
25637 store_to_load
25638 Any dependence from store to load is costly.
25639
25640 number
25641 Any dependence for which the latency is greater than or equal
25642 to number is costly.
25643
25644 -minsert-sched-nops=scheme
25645 This option controls which NOP insertion scheme is used during the
25646 second scheduling pass. The argument scheme takes one of the
25647 following values:
25648
25649 no Don't insert NOPs.
25650
25651 pad Pad with NOPs any dispatch group that has vacant issue slots,
25652 according to the scheduler's grouping.
25653
25654 regroup_exact
25655 Insert NOPs to force costly dependent insns into separate
25656 groups. Insert exactly as many NOPs as needed to force an insn
25657 to a new group, according to the estimated processor grouping.
25658
25659 number
25660 Insert NOPs to force costly dependent insns into separate
25661 groups. Insert number NOPs to force an insn to a new group.
25662
25663 -mcall-sysv
25664 On System V.4 and embedded PowerPC systems compile code using
25665 calling conventions that adhere to the March 1995 draft of the
25666 System V Application Binary Interface, PowerPC processor
25667 supplement. This is the default unless you configured GCC using
25668 powerpc-*-eabiaix.
25669
25670 -mcall-sysv-eabi
25671 -mcall-eabi
25672 Specify both -mcall-sysv and -meabi options.
25673
25674 -mcall-sysv-noeabi
25675 Specify both -mcall-sysv and -mno-eabi options.
25676
25677 -mcall-aixdesc
25678 On System V.4 and embedded PowerPC systems compile code for the AIX
25679 operating system.
25680
25681 -mcall-linux
25682 On System V.4 and embedded PowerPC systems compile code for the
25683 Linux-based GNU system.
25684
25685 -mcall-freebsd
25686 On System V.4 and embedded PowerPC systems compile code for the
25687 FreeBSD operating system.
25688
25689 -mcall-netbsd
25690 On System V.4 and embedded PowerPC systems compile code for the
25691 NetBSD operating system.
25692
25693 -mcall-openbsd
25694 On System V.4 and embedded PowerPC systems compile code for the
25695 OpenBSD operating system.
25696
25697 -mtraceback=traceback_type
25698 Select the type of traceback table. Valid values for traceback_type
25699 are full, part, and no.
25700
25701 -maix-struct-return
25702 Return all structures in memory (as specified by the AIX ABI).
25703
25704 -msvr4-struct-return
25705 Return structures smaller than 8 bytes in registers (as specified
25706 by the SVR4 ABI).
25707
25708 -mabi=abi-type
25709 Extend the current ABI with a particular extension, or remove such
25710 extension. Valid values are: altivec, no-altivec, ibmlongdouble,
25711 ieeelongdouble, elfv1, elfv2, and for AIX: vec-extabi, vec-default.
25712
25713 -mabi=ibmlongdouble
25714 Change the current ABI to use IBM extended-precision long double.
25715 This is not likely to work if your system defaults to using IEEE
25716 extended-precision long double. If you change the long double type
25717 from IEEE extended-precision, the compiler will issue a warning
25718 unless you use the -Wno-psabi option. Requires -mlong-double-128
25719 to be enabled.
25720
25721 -mabi=ieeelongdouble
25722 Change the current ABI to use IEEE extended-precision long double.
25723 This is not likely to work if your system defaults to using IBM
25724 extended-precision long double. If you change the long double type
25725 from IBM extended-precision, the compiler will issue a warning
25726 unless you use the -Wno-psabi option. Requires -mlong-double-128
25727 to be enabled.
25728
25729 -mabi=elfv1
25730 Change the current ABI to use the ELFv1 ABI. This is the default
25731 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
25732 ABI requires special system support and is likely to fail in
25733 spectacular ways.
25734
25735 -mabi=elfv2
25736 Change the current ABI to use the ELFv2 ABI. This is the default
25737 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
25738 ABI requires special system support and is likely to fail in
25739 spectacular ways.
25740
25741 -mgnu-attribute
25742 -mno-gnu-attribute
25743 Emit .gnu_attribute assembly directives to set tag/value pairs in a
25744 .gnu.attributes section that specify ABI variations in function
25745 parameters or return values.
25746
25747 -mprototype
25748 -mno-prototype
25749 On System V.4 and embedded PowerPC systems assume that all calls to
25750 variable argument functions are properly prototyped. Otherwise,
25751 the compiler must insert an instruction before every non-prototyped
25752 call to set or clear bit 6 of the condition code register ("CR") to
25753 indicate whether floating-point values are passed in the floating-
25754 point registers in case the function takes variable arguments.
25755 With -mprototype, only calls to prototyped variable argument
25756 functions set or clear the bit.
25757
25758 -msim
25759 On embedded PowerPC systems, assume that the startup module is
25760 called sim-crt0.o and that the standard C libraries are libsim.a
25761 and libc.a. This is the default for powerpc-*-eabisim
25762 configurations.
25763
25764 -mmvme
25765 On embedded PowerPC systems, assume that the startup module is
25766 called crt0.o and the standard C libraries are libmvme.a and
25767 libc.a.
25768
25769 -mads
25770 On embedded PowerPC systems, assume that the startup module is
25771 called crt0.o and the standard C libraries are libads.a and libc.a.
25772
25773 -myellowknife
25774 On embedded PowerPC systems, assume that the startup module is
25775 called crt0.o and the standard C libraries are libyk.a and libc.a.
25776
25777 -mvxworks
25778 On System V.4 and embedded PowerPC systems, specify that you are
25779 compiling for a VxWorks system.
25780
25781 -memb
25782 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
25783 header to indicate that eabi extended relocations are used.
25784
25785 -meabi
25786 -mno-eabi
25787 On System V.4 and embedded PowerPC systems do (do not) adhere to
25788 the Embedded Applications Binary Interface (EABI), which is a set
25789 of modifications to the System V.4 specifications. Selecting
25790 -meabi means that the stack is aligned to an 8-byte boundary, a
25791 function "__eabi" is called from "main" to set up the EABI
25792 environment, and the -msdata option can use both "r2" and "r13" to
25793 point to two separate small data areas. Selecting -mno-eabi means
25794 that the stack is aligned to a 16-byte boundary, no EABI
25795 initialization function is called from "main", and the -msdata
25796 option only uses "r13" to point to a single small data area. The
25797 -meabi option is on by default if you configured GCC using one of
25798 the powerpc*-*-eabi* options.
25799
25800 -msdata=eabi
25801 On System V.4 and embedded PowerPC systems, put small initialized
25802 "const" global and static data in the ".sdata2" section, which is
25803 pointed to by register "r2". Put small initialized non-"const"
25804 global and static data in the ".sdata" section, which is pointed to
25805 by register "r13". Put small uninitialized global and static data
25806 in the ".sbss" section, which is adjacent to the ".sdata" section.
25807 The -msdata=eabi option is incompatible with the -mrelocatable
25808 option. The -msdata=eabi option also sets the -memb option.
25809
25810 -msdata=sysv
25811 On System V.4 and embedded PowerPC systems, put small global and
25812 static data in the ".sdata" section, which is pointed to by
25813 register "r13". Put small uninitialized global and static data in
25814 the ".sbss" section, which is adjacent to the ".sdata" section.
25815 The -msdata=sysv option is incompatible with the -mrelocatable
25816 option.
25817
25818 -msdata=default
25819 -msdata
25820 On System V.4 and embedded PowerPC systems, if -meabi is used,
25821 compile code the same as -msdata=eabi, otherwise compile code the
25822 same as -msdata=sysv.
25823
25824 -msdata=data
25825 On System V.4 and embedded PowerPC systems, put small global data
25826 in the ".sdata" section. Put small uninitialized global data in
25827 the ".sbss" section. Do not use register "r13" to address small
25828 data however. This is the default behavior unless other -msdata
25829 options are used.
25830
25831 -msdata=none
25832 -mno-sdata
25833 On embedded PowerPC systems, put all initialized global and static
25834 data in the ".data" section, and all uninitialized data in the
25835 ".bss" section.
25836
25837 -mreadonly-in-sdata
25838 Put read-only objects in the ".sdata" section as well. This is the
25839 default.
25840
25841 -mblock-move-inline-limit=num
25842 Inline all block moves (such as calls to "memcpy" or structure
25843 copies) less than or equal to num bytes. The minimum value for num
25844 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
25845 default value is target-specific.
25846
25847 -mblock-compare-inline-limit=num
25848 Generate non-looping inline code for all block compares (such as
25849 calls to "memcmp" or structure compares) less than or equal to num
25850 bytes. If num is 0, all inline expansion (non-loop and loop) of
25851 block compare is disabled. The default value is target-specific.
25852
25853 -mblock-compare-inline-loop-limit=num
25854 Generate an inline expansion using loop code for all block compares
25855 that are less than or equal to num bytes, but greater than the
25856 limit for non-loop inline block compare expansion. If the block
25857 length is not constant, at most num bytes will be compared before
25858 "memcmp" is called to compare the remainder of the block. The
25859 default value is target-specific.
25860
25861 -mstring-compare-inline-limit=num
25862 Compare at most num string bytes with inline code. If the
25863 difference or end of string is not found at the end of the inline
25864 compare a call to "strcmp" or "strncmp" will take care of the rest
25865 of the comparison. The default is 64 bytes.
25866
25867 -G num
25868 On embedded PowerPC systems, put global and static items less than
25869 or equal to num bytes into the small data or BSS sections instead
25870 of the normal data or BSS section. By default, num is 8. The -G
25871 num switch is also passed to the linker. All modules should be
25872 compiled with the same -G num value.
25873
25874 -mregnames
25875 -mno-regnames
25876 On System V.4 and embedded PowerPC systems do (do not) emit
25877 register names in the assembly language output using symbolic
25878 forms.
25879
25880 -mlongcall
25881 -mno-longcall
25882 By default assume that all calls are far away so that a longer and
25883 more expensive calling sequence is required. This is required for
25884 calls farther than 32 megabytes (33,554,432 bytes) from the current
25885 location. A short call is generated if the compiler knows the call
25886 cannot be that far away. This setting can be overridden by the
25887 "shortcall" function attribute, or by #pragma longcall(0).
25888
25889 Some linkers are capable of detecting out-of-range calls and
25890 generating glue code on the fly. On these systems, long calls are
25891 unnecessary and generate slower code. As of this writing, the AIX
25892 linker can do this, as can the GNU linker for PowerPC/64. It is
25893 planned to add this feature to the GNU linker for 32-bit PowerPC
25894 systems as well.
25895
25896 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25897 linkers, GCC can generate long calls using an inline PLT call
25898 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
25899 ELFv1 (big-endian) do not support inline PLT calls.
25900
25901 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
25902 L42", plus a branch island (glue code). The two target addresses
25903 represent the callee and the branch island. The Darwin/PPC linker
25904 prefers the first address and generates a "bl callee" if the PPC
25905 "bl" instruction reaches the callee directly; otherwise, the linker
25906 generates "bl L42" to call the branch island. The branch island is
25907 appended to the body of the calling function; it computes the full
25908 32-bit address of the callee and jumps to it.
25909
25910 On Mach-O (Darwin) systems, this option directs the compiler emit
25911 to the glue for every direct call, and the Darwin linker decides
25912 whether to use or discard it.
25913
25914 In the future, GCC may ignore all longcall specifications when the
25915 linker is known to generate glue.
25916
25917 -mpltseq
25918 -mno-pltseq
25919 Implement (do not implement) -fno-plt and long calls using an
25920 inline PLT call sequence that supports lazy linking and long calls
25921 to functions in dlopen'd shared libraries. Inline PLT calls are
25922 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
25923 newer GNU linkers, and are enabled by default if the support is
25924 detected when configuring GCC, and, in the case of 32-bit PowerPC,
25925 if GCC is configured with --enable-secureplt. -mpltseq code and
25926 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
25927 together.
25928
25929 -mtls-markers
25930 -mno-tls-markers
25931 Mark (do not mark) calls to "__tls_get_addr" with a relocation
25932 specifying the function argument. The relocation allows the linker
25933 to reliably associate function call with argument setup
25934 instructions for TLS optimization, which in turn allows GCC to
25935 better schedule the sequence.
25936
25937 -mrecip
25938 -mno-recip
25939 This option enables use of the reciprocal estimate and reciprocal
25940 square root estimate instructions with additional Newton-Raphson
25941 steps to increase precision instead of doing a divide or square
25942 root and divide for floating-point arguments. You should use the
25943 -ffast-math option when using -mrecip (or at least
25944 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
25945 and -fno-trapping-math). Note that while the throughput of the
25946 sequence is generally higher than the throughput of the non-
25947 reciprocal instruction, the precision of the sequence can be
25948 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
25949 0.99999994) for reciprocal square roots.
25950
25951 -mrecip=opt
25952 This option controls which reciprocal estimate instructions may be
25953 used. opt is a comma-separated list of options, which may be
25954 preceded by a "!" to invert the option:
25955
25956 all Enable all estimate instructions.
25957
25958 default
25959 Enable the default instructions, equivalent to -mrecip.
25960
25961 none
25962 Disable all estimate instructions, equivalent to -mno-recip.
25963
25964 div Enable the reciprocal approximation instructions for both
25965 single and double precision.
25966
25967 divf
25968 Enable the single-precision reciprocal approximation
25969 instructions.
25970
25971 divd
25972 Enable the double-precision reciprocal approximation
25973 instructions.
25974
25975 rsqrt
25976 Enable the reciprocal square root approximation instructions
25977 for both single and double precision.
25978
25979 rsqrtf
25980 Enable the single-precision reciprocal square root
25981 approximation instructions.
25982
25983 rsqrtd
25984 Enable the double-precision reciprocal square root
25985 approximation instructions.
25986
25987 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
25988 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
25989 "XVRSQRTEDP" instructions which handle the double-precision
25990 reciprocal square root calculations.
25991
25992 -mrecip-precision
25993 -mno-recip-precision
25994 Assume (do not assume) that the reciprocal estimate instructions
25995 provide higher-precision estimates than is mandated by the PowerPC
25996 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
25997 automatically selects -mrecip-precision. The double-precision
25998 square root estimate instructions are not generated by default on
25999 low-precision machines, since they do not provide an estimate that
26000 converges after three steps.
26001
26002 -mveclibabi=type
26003 Specifies the ABI type to use for vectorizing intrinsics using an
26004 external library. The only type supported at present is mass,
26005 which specifies to use IBM's Mathematical Acceleration Subsystem
26006 (MASS) libraries for vectorizing intrinsics using external
26007 libraries. GCC currently emits calls to "acosd2", "acosf4",
26008 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
26009 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
26010 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
26011 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
26012 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
26013 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
26014 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
26015 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
26016 "tanhf4" when generating code for power7. Both -ftree-vectorize
26017 and -funsafe-math-optimizations must also be enabled. The MASS
26018 libraries must be specified at link time.
26019
26020 -mfriz
26021 -mno-friz
26022 Generate (do not generate) the "friz" instruction when the
26023 -funsafe-math-optimizations option is used to optimize rounding of
26024 floating-point values to 64-bit integer and back to floating point.
26025 The "friz" instruction does not return the same value if the
26026 floating-point number is too large to fit in an integer.
26027
26028 -mpointers-to-nested-functions
26029 -mno-pointers-to-nested-functions
26030 Generate (do not generate) code to load up the static chain
26031 register ("r11") when calling through a pointer on AIX and 64-bit
26032 Linux systems where a function pointer points to a 3-word
26033 descriptor giving the function address, TOC value to be loaded in
26034 register "r2", and static chain value to be loaded in register
26035 "r11". The -mpointers-to-nested-functions is on by default. You
26036 cannot call through pointers to nested functions or pointers to
26037 functions compiled in other languages that use the static chain if
26038 you use -mno-pointers-to-nested-functions.
26039
26040 -msave-toc-indirect
26041 -mno-save-toc-indirect
26042 Generate (do not generate) code to save the TOC value in the
26043 reserved stack location in the function prologue if the function
26044 calls through a pointer on AIX and 64-bit Linux systems. If the
26045 TOC value is not saved in the prologue, it is saved just before the
26046 call through the pointer. The -mno-save-toc-indirect option is the
26047 default.
26048
26049 -mcompat-align-parm
26050 -mno-compat-align-parm
26051 Generate (do not generate) code to pass structure parameters with a
26052 maximum alignment of 64 bits, for compatibility with older versions
26053 of GCC.
26054
26055 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
26056 structure parameter on a 128-bit boundary when that structure
26057 contained a member requiring 128-bit alignment. This is corrected
26058 in more recent versions of GCC. This option may be used to
26059 generate code that is compatible with functions compiled with older
26060 versions of GCC.
26061
26062 The -mno-compat-align-parm option is the default.
26063
26064 -mstack-protector-guard=guard
26065 -mstack-protector-guard-reg=reg
26066 -mstack-protector-guard-offset=offset
26067 -mstack-protector-guard-symbol=symbol
26068 Generate stack protection code using canary at guard. Supported
26069 locations are global for global canary or tls for per-thread canary
26070 in the TLS block (the default with GNU libc version 2.4 or later).
26071
26072 With the latter choice the options -mstack-protector-guard-reg=reg
26073 and -mstack-protector-guard-offset=offset furthermore specify which
26074 register to use as base register for reading the canary, and from
26075 what offset from that base register. The default for those is as
26076 specified in the relevant ABI.
26077 -mstack-protector-guard-symbol=symbol overrides the offset with a
26078 symbol reference to a canary in the TLS block.
26079
26080 -mpcrel
26081 -mno-pcrel
26082 Generate (do not generate) pc-relative addressing. The -mpcrel
26083 option requires that the medium code model (-mcmodel=medium) and
26084 prefixed addressing (-mprefixed) options are enabled.
26085
26086 -mprefixed
26087 -mno-prefixed
26088 Generate (do not generate) addressing modes using prefixed load and
26089 store instructions. The -mprefixed option requires that the option
26090 -mcpu=power10 (or later) is enabled.
26091
26092 -mmma
26093 -mno-mma
26094 Generate (do not generate) the MMA instructions. The -mma option
26095 requires that the option -mcpu=power10 (or later) is enabled.
26096
26097 -mrop-protect
26098 -mno-rop-protect
26099 Generate (do not generate) ROP protection instructions when the
26100 target processor supports them. Currently this option disables the
26101 shrink-wrap optimization (-fshrink-wrap).
26102
26103 -mprivileged
26104 -mno-privileged
26105 Generate (do not generate) code that will run in privileged state.
26106
26107 -mblock-ops-unaligned-vsx
26108 -mno-block-ops-unaligned-vsx
26109 Generate (do not generate) unaligned vsx loads and stores for
26110 inline expansion of "memcpy" and "memmove".
26111
26112 --param rs6000-vect-unroll-limit=
26113 The vectorizer will check with target information to determine
26114 whether it would be beneficial to unroll the main vectorized loop
26115 and by how much. This parameter sets the upper bound of how much
26116 the vectorizer will unroll the main loop. The default value is
26117 four.
26118
26119 RX Options
26120
26121 These command-line options are defined for RX targets:
26122
26123 -m64bit-doubles
26124 -m32bit-doubles
26125 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
26126 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
26127 RX floating-point hardware only works on 32-bit values, which is
26128 why the default is -m32bit-doubles.
26129
26130 -fpu
26131 -nofpu
26132 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
26133 hardware. The default is enabled for the RX600 series and disabled
26134 for the RX200 series.
26135
26136 Floating-point instructions are only generated for 32-bit floating-
26137 point values, however, so the FPU hardware is not used for doubles
26138 if the -m64bit-doubles option is used.
26139
26140 Note If the -fpu option is enabled then -funsafe-math-optimizations
26141 is also enabled automatically. This is because the RX FPU
26142 instructions are themselves unsafe.
26143
26144 -mcpu=name
26145 Selects the type of RX CPU to be targeted. Currently three types
26146 are supported, the generic RX600 and RX200 series hardware and the
26147 specific RX610 CPU. The default is RX600.
26148
26149 The only difference between RX600 and RX610 is that the RX610 does
26150 not support the "MVTIPL" instruction.
26151
26152 The RX200 series does not have a hardware floating-point unit and
26153 so -nofpu is enabled by default when this type is selected.
26154
26155 -mbig-endian-data
26156 -mlittle-endian-data
26157 Store data (but not code) in the big-endian format. The default is
26158 -mlittle-endian-data, i.e. to store data in the little-endian
26159 format.
26160
26161 -msmall-data-limit=N
26162 Specifies the maximum size in bytes of global and static variables
26163 which can be placed into the small data area. Using the small data
26164 area can lead to smaller and faster code, but the size of area is
26165 limited and it is up to the programmer to ensure that the area does
26166 not overflow. Also when the small data area is used one of the
26167 RX's registers (usually "r13") is reserved for use pointing to this
26168 area, so it is no longer available for use by the compiler. This
26169 could result in slower and/or larger code if variables are pushed
26170 onto the stack instead of being held in this register.
26171
26172 Note, common variables (variables that have not been initialized)
26173 and constants are not placed into the small data area as they are
26174 assigned to other sections in the output executable.
26175
26176 The default value is zero, which disables this feature. Note, this
26177 feature is not enabled by default with higher optimization levels
26178 (-O2 etc) because of the potentially detrimental effects of
26179 reserving a register. It is up to the programmer to experiment and
26180 discover whether this feature is of benefit to their program. See
26181 the description of the -mpid option for a description of how the
26182 actual register to hold the small data area pointer is chosen.
26183
26184 -msim
26185 -mno-sim
26186 Use the simulator runtime. The default is to use the libgloss
26187 board-specific runtime.
26188
26189 -mas100-syntax
26190 -mno-as100-syntax
26191 When generating assembler output use a syntax that is compatible
26192 with Renesas's AS100 assembler. This syntax can also be handled by
26193 the GAS assembler, but it has some restrictions so it is not
26194 generated by default.
26195
26196 -mmax-constant-size=N
26197 Specifies the maximum size, in bytes, of a constant that can be
26198 used as an operand in a RX instruction. Although the RX
26199 instruction set does allow constants of up to 4 bytes in length to
26200 be used in instructions, a longer value equates to a longer
26201 instruction. Thus in some circumstances it can be beneficial to
26202 restrict the size of constants that are used in instructions.
26203 Constants that are too big are instead placed into a constant pool
26204 and referenced via register indirection.
26205
26206 The value N can be between 0 and 4. A value of 0 (the default) or
26207 4 means that constants of any size are allowed.
26208
26209 -mrelax
26210 Enable linker relaxation. Linker relaxation is a process whereby
26211 the linker attempts to reduce the size of a program by finding
26212 shorter versions of various instructions. Disabled by default.
26213
26214 -mint-register=N
26215 Specify the number of registers to reserve for fast interrupt
26216 handler functions. The value N can be between 0 and 4. A value of
26217 1 means that register "r13" is reserved for the exclusive use of
26218 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
26219 value of 3 reserves "r13", "r12" and "r11", and a value of 4
26220 reserves "r13" through "r10". A value of 0, the default, does not
26221 reserve any registers.
26222
26223 -msave-acc-in-interrupts
26224 Specifies that interrupt handler functions should preserve the
26225 accumulator register. This is only necessary if normal code might
26226 use the accumulator register, for example because it performs
26227 64-bit multiplications. The default is to ignore the accumulator
26228 as this makes the interrupt handlers faster.
26229
26230 -mpid
26231 -mno-pid
26232 Enables the generation of position independent data. When enabled
26233 any access to constant data is done via an offset from a base
26234 address held in a register. This allows the location of constant
26235 data to be determined at run time without requiring the executable
26236 to be relocated, which is a benefit to embedded applications with
26237 tight memory constraints. Data that can be modified is not
26238 affected by this option.
26239
26240 Note, using this feature reserves a register, usually "r13", for
26241 the constant data base address. This can result in slower and/or
26242 larger code, especially in complicated functions.
26243
26244 The actual register chosen to hold the constant data base address
26245 depends upon whether the -msmall-data-limit and/or the
26246 -mint-register command-line options are enabled. Starting with
26247 register "r13" and proceeding downwards, registers are allocated
26248 first to satisfy the requirements of -mint-register, then -mpid and
26249 finally -msmall-data-limit. Thus it is possible for the small data
26250 area register to be "r8" if both -mint-register=4 and -mpid are
26251 specified on the command line.
26252
26253 By default this feature is not enabled. The default can be
26254 restored via the -mno-pid command-line option.
26255
26256 -mno-warn-multiple-fast-interrupts
26257 -mwarn-multiple-fast-interrupts
26258 Prevents GCC from issuing a warning message if it finds more than
26259 one fast interrupt handler when it is compiling a file. The
26260 default is to issue a warning for each extra fast interrupt handler
26261 found, as the RX only supports one such interrupt.
26262
26263 -mallow-string-insns
26264 -mno-allow-string-insns
26265 Enables or disables the use of the string manipulation instructions
26266 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
26267 "RMPA" instruction. These instructions may prefetch data, which is
26268 not safe to do if accessing an I/O register. (See section 12.2.7
26269 of the RX62N Group User's Manual for more information).
26270
26271 The default is to allow these instructions, but it is not possible
26272 for GCC to reliably detect all circumstances where a string
26273 instruction might be used to access an I/O register, so their use
26274 cannot be disabled automatically. Instead it is reliant upon the
26275 programmer to use the -mno-allow-string-insns option if their
26276 program accesses I/O space.
26277
26278 When the instructions are enabled GCC defines the C preprocessor
26279 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
26280 "__RX_DISALLOW_STRING_INSNS__".
26281
26282 -mjsr
26283 -mno-jsr
26284 Use only (or not only) "JSR" instructions to access functions.
26285 This option can be used when code size exceeds the range of "BSR"
26286 instructions. Note that -mno-jsr does not mean to not use "JSR"
26287 but instead means that any type of branch may be used.
26288
26289 Note: The generic GCC command-line option -ffixed-reg has special
26290 significance to the RX port when used with the "interrupt" function
26291 attribute. This attribute indicates a function intended to process
26292 fast interrupts. GCC ensures that it only uses the registers "r10",
26293 "r11", "r12" and/or "r13" and only provided that the normal use of the
26294 corresponding registers have been restricted via the -ffixed-reg or
26295 -mint-register command-line options.
26296
26297 S/390 and zSeries Options
26298
26299 These are the -m options defined for the S/390 and zSeries
26300 architecture.
26301
26302 -mhard-float
26303 -msoft-float
26304 Use (do not use) the hardware floating-point instructions and
26305 registers for floating-point operations. When -msoft-float is
26306 specified, functions in libgcc.a are used to perform floating-point
26307 operations. When -mhard-float is specified, the compiler generates
26308 IEEE floating-point instructions. This is the default.
26309
26310 -mhard-dfp
26311 -mno-hard-dfp
26312 Use (do not use) the hardware decimal-floating-point instructions
26313 for decimal-floating-point operations. When -mno-hard-dfp is
26314 specified, functions in libgcc.a are used to perform decimal-
26315 floating-point operations. When -mhard-dfp is specified, the
26316 compiler generates decimal-floating-point hardware instructions.
26317 This is the default for -march=z9-ec or higher.
26318
26319 -mlong-double-64
26320 -mlong-double-128
26321 These switches control the size of "long double" type. A size of 64
26322 bits makes the "long double" type equivalent to the "double" type.
26323 This is the default.
26324
26325 -mbackchain
26326 -mno-backchain
26327 Store (do not store) the address of the caller's frame as backchain
26328 pointer into the callee's stack frame. A backchain may be needed
26329 to allow debugging using tools that do not understand DWARF call
26330 frame information. When -mno-packed-stack is in effect, the
26331 backchain pointer is stored at the bottom of the stack frame; when
26332 -mpacked-stack is in effect, the backchain is placed into the
26333 topmost word of the 96/160 byte register save area.
26334
26335 In general, code compiled with -mbackchain is call-compatible with
26336 code compiled with -mno-backchain; however, use of the backchain
26337 for debugging purposes usually requires that the whole binary is
26338 built with -mbackchain. Note that the combination of -mbackchain,
26339 -mpacked-stack and -mhard-float is not supported. In order to
26340 build a linux kernel use -msoft-float.
26341
26342 The default is to not maintain the backchain.
26343
26344 -mpacked-stack
26345 -mno-packed-stack
26346 Use (do not use) the packed stack layout. When -mno-packed-stack
26347 is specified, the compiler uses the all fields of the 96/160 byte
26348 register save area only for their default purpose; unused fields
26349 still take up stack space. When -mpacked-stack is specified,
26350 register save slots are densely packed at the top of the register
26351 save area; unused space is reused for other purposes, allowing for
26352 more efficient use of the available stack space. However, when
26353 -mbackchain is also in effect, the topmost word of the save area is
26354 always used to store the backchain, and the return address register
26355 is always saved two words below the backchain.
26356
26357 As long as the stack frame backchain is not used, code generated
26358 with -mpacked-stack is call-compatible with code generated with
26359 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
26360 S/390 or zSeries generated code that uses the stack frame backchain
26361 at run time, not just for debugging purposes. Such code is not
26362 call-compatible with code compiled with -mpacked-stack. Also, note
26363 that the combination of -mbackchain, -mpacked-stack and
26364 -mhard-float is not supported. In order to build a linux kernel
26365 use -msoft-float.
26366
26367 The default is to not use the packed stack layout.
26368
26369 -msmall-exec
26370 -mno-small-exec
26371 Generate (or do not generate) code using the "bras" instruction to
26372 do subroutine calls. This only works reliably if the total
26373 executable size does not exceed 64k. The default is to use the
26374 "basr" instruction instead, which does not have this limitation.
26375
26376 -m64
26377 -m31
26378 When -m31 is specified, generate code compliant to the GNU/Linux
26379 for S/390 ABI. When -m64 is specified, generate code compliant to
26380 the GNU/Linux for zSeries ABI. This allows GCC in particular to
26381 generate 64-bit instructions. For the s390 targets, the default is
26382 -m31, while the s390x targets default to -m64.
26383
26384 -mzarch
26385 -mesa
26386 When -mzarch is specified, generate code using the instructions
26387 available on z/Architecture. When -mesa is specified, generate
26388 code using the instructions available on ESA/390. Note that -mesa
26389 is not possible with -m64. When generating code compliant to the
26390 GNU/Linux for S/390 ABI, the default is -mesa. When generating
26391 code compliant to the GNU/Linux for zSeries ABI, the default is
26392 -mzarch.
26393
26394 -mhtm
26395 -mno-htm
26396 The -mhtm option enables a set of builtins making use of
26397 instructions available with the transactional execution facility
26398 introduced with the IBM zEnterprise EC12 machine generation S/390
26399 System z Built-in Functions. -mhtm is enabled by default when
26400 using -march=zEC12.
26401
26402 -mvx
26403 -mno-vx
26404 When -mvx is specified, generate code using the instructions
26405 available with the vector extension facility introduced with the
26406 IBM z13 machine generation. This option changes the ABI for some
26407 vector type values with regard to alignment and calling
26408 conventions. In case vector type values are being used in an ABI-
26409 relevant context a GAS .gnu_attribute command will be added to mark
26410 the resulting binary with the ABI used. -mvx is enabled by default
26411 when using -march=z13.
26412
26413 -mzvector
26414 -mno-zvector
26415 The -mzvector option enables vector language extensions and
26416 builtins using instructions available with the vector extension
26417 facility introduced with the IBM z13 machine generation. This
26418 option adds support for vector to be used as a keyword to define
26419 vector type variables and arguments. vector is only available when
26420 GNU extensions are enabled. It will not be expanded when
26421 requesting strict standard compliance e.g. with -std=c99. In
26422 addition to the GCC low-level builtins -mzvector enables a set of
26423 builtins added for compatibility with AltiVec-style implementations
26424 like Power and Cell. In order to make use of these builtins the
26425 header file vecintrin.h needs to be included. -mzvector is
26426 disabled by default.
26427
26428 -mmvcle
26429 -mno-mvcle
26430 Generate (or do not generate) code using the "mvcle" instruction to
26431 perform block moves. When -mno-mvcle is specified, use a "mvc"
26432 loop instead. This is the default unless optimizing for size.
26433
26434 -mdebug
26435 -mno-debug
26436 Print (or do not print) additional debug information when
26437 compiling. The default is to not print debug information.
26438
26439 -march=cpu-type
26440 Generate code that runs on cpu-type, which is the name of a system
26441 representing a certain processor type. Possible values for cpu-
26442 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
26443 z196/arch9, zEC12, z13/arch11, z14/arch12, z15/arch13, z16/arch14,
26444 and native.
26445
26446 The default is -march=z900.
26447
26448 Specifying native as cpu type can be used to select the best
26449 architecture option for the host processor. -march=native has no
26450 effect if GCC does not recognize the processor.
26451
26452 -mtune=cpu-type
26453 Tune to cpu-type everything applicable about the generated code,
26454 except for the ABI and the set of available instructions. The list
26455 of cpu-type values is the same as for -march. The default is the
26456 value used for -march.
26457
26458 -mtpf-trace
26459 -mno-tpf-trace
26460 Generate code that adds (does not add) in TPF OS specific branches
26461 to trace routines in the operating system. This option is off by
26462 default, even when compiling for the TPF OS.
26463
26464 -mtpf-trace-skip
26465 -mno-tpf-trace-skip
26466 Generate code that changes (does not change) the default branch
26467 targets enabled by -mtpf-trace to point to specialized trace
26468 routines providing the ability of selectively skipping function
26469 trace entries for the TPF OS. This option is off by default, even
26470 when compiling for the TPF OS and specifying -mtpf-trace.
26471
26472 -mfused-madd
26473 -mno-fused-madd
26474 Generate code that uses (does not use) the floating-point multiply
26475 and accumulate instructions. These instructions are generated by
26476 default if hardware floating point is used.
26477
26478 -mwarn-framesize=framesize
26479 Emit a warning if the current function exceeds the given frame
26480 size. Because this is a compile-time check it doesn't need to be a
26481 real problem when the program runs. It is intended to identify
26482 functions that most probably cause a stack overflow. It is useful
26483 to be used in an environment with limited stack size e.g. the linux
26484 kernel.
26485
26486 -mwarn-dynamicstack
26487 Emit a warning if the function calls "alloca" or uses dynamically-
26488 sized arrays. This is generally a bad idea with a limited stack
26489 size.
26490
26491 -mstack-guard=stack-guard
26492 -mstack-size=stack-size
26493 If these options are provided the S/390 back end emits additional
26494 instructions in the function prologue that trigger a trap if the
26495 stack size is stack-guard bytes above the stack-size (remember that
26496 the stack on S/390 grows downward). If the stack-guard option is
26497 omitted the smallest power of 2 larger than the frame size of the
26498 compiled function is chosen. These options are intended to be used
26499 to help debugging stack overflow problems. The additionally
26500 emitted code causes only little overhead and hence can also be used
26501 in production-like systems without greater performance degradation.
26502 The given values have to be exact powers of 2 and stack-size has to
26503 be greater than stack-guard without exceeding 64k. In order to be
26504 efficient the extra code makes the assumption that the stack starts
26505 at an address aligned to the value given by stack-size. The stack-
26506 guard option can only be used in conjunction with stack-size.
26507
26508 -mhotpatch=pre-halfwords,post-halfwords
26509 If the hotpatch option is enabled, a "hot-patching" function
26510 prologue is generated for all functions in the compilation unit.
26511 The funtion label is prepended with the given number of two-byte
26512 NOP instructions (pre-halfwords, maximum 1000000). After the
26513 label, 2 * post-halfwords bytes are appended, using the largest NOP
26514 like instructions the architecture allows (maximum 1000000).
26515
26516 If both arguments are zero, hotpatching is disabled.
26517
26518 This option can be overridden for individual functions with the
26519 "hotpatch" attribute.
26520
26521 SH Options
26522
26523 These -m options are defined for the SH implementations:
26524
26525 -m1 Generate code for the SH1.
26526
26527 -m2 Generate code for the SH2.
26528
26529 -m2e
26530 Generate code for the SH2e.
26531
26532 -m2a-nofpu
26533 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
26534 way that the floating-point unit is not used.
26535
26536 -m2a-single-only
26537 Generate code for the SH2a-FPU, in such a way that no double-
26538 precision floating-point operations are used.
26539
26540 -m2a-single
26541 Generate code for the SH2a-FPU assuming the floating-point unit is
26542 in single-precision mode by default.
26543
26544 -m2a
26545 Generate code for the SH2a-FPU assuming the floating-point unit is
26546 in double-precision mode by default.
26547
26548 -m3 Generate code for the SH3.
26549
26550 -m3e
26551 Generate code for the SH3e.
26552
26553 -m4-nofpu
26554 Generate code for the SH4 without a floating-point unit.
26555
26556 -m4-single-only
26557 Generate code for the SH4 with a floating-point unit that only
26558 supports single-precision arithmetic.
26559
26560 -m4-single
26561 Generate code for the SH4 assuming the floating-point unit is in
26562 single-precision mode by default.
26563
26564 -m4 Generate code for the SH4.
26565
26566 -m4-100
26567 Generate code for SH4-100.
26568
26569 -m4-100-nofpu
26570 Generate code for SH4-100 in such a way that the floating-point
26571 unit is not used.
26572
26573 -m4-100-single
26574 Generate code for SH4-100 assuming the floating-point unit is in
26575 single-precision mode by default.
26576
26577 -m4-100-single-only
26578 Generate code for SH4-100 in such a way that no double-precision
26579 floating-point operations are used.
26580
26581 -m4-200
26582 Generate code for SH4-200.
26583
26584 -m4-200-nofpu
26585 Generate code for SH4-200 without in such a way that the floating-
26586 point unit is not used.
26587
26588 -m4-200-single
26589 Generate code for SH4-200 assuming the floating-point unit is in
26590 single-precision mode by default.
26591
26592 -m4-200-single-only
26593 Generate code for SH4-200 in such a way that no double-precision
26594 floating-point operations are used.
26595
26596 -m4-300
26597 Generate code for SH4-300.
26598
26599 -m4-300-nofpu
26600 Generate code for SH4-300 without in such a way that the floating-
26601 point unit is not used.
26602
26603 -m4-300-single
26604 Generate code for SH4-300 in such a way that no double-precision
26605 floating-point operations are used.
26606
26607 -m4-300-single-only
26608 Generate code for SH4-300 in such a way that no double-precision
26609 floating-point operations are used.
26610
26611 -m4-340
26612 Generate code for SH4-340 (no MMU, no FPU).
26613
26614 -m4-500
26615 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
26616 assembler.
26617
26618 -m4a-nofpu
26619 Generate code for the SH4al-dsp, or for a SH4a in such a way that
26620 the floating-point unit is not used.
26621
26622 -m4a-single-only
26623 Generate code for the SH4a, in such a way that no double-precision
26624 floating-point operations are used.
26625
26626 -m4a-single
26627 Generate code for the SH4a assuming the floating-point unit is in
26628 single-precision mode by default.
26629
26630 -m4a
26631 Generate code for the SH4a.
26632
26633 -m4al
26634 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
26635 assembler. GCC doesn't generate any DSP instructions at the
26636 moment.
26637
26638 -mb Compile code for the processor in big-endian mode.
26639
26640 -ml Compile code for the processor in little-endian mode.
26641
26642 -mdalign
26643 Align doubles at 64-bit boundaries. Note that this changes the
26644 calling conventions, and thus some functions from the standard C
26645 library do not work unless you recompile it first with -mdalign.
26646
26647 -mrelax
26648 Shorten some address references at link time, when possible; uses
26649 the linker option -relax.
26650
26651 -mbigtable
26652 Use 32-bit offsets in "switch" tables. The default is to use
26653 16-bit offsets.
26654
26655 -mbitops
26656 Enable the use of bit manipulation instructions on SH2A.
26657
26658 -mfmovd
26659 Enable the use of the instruction "fmovd". Check -mdalign for
26660 alignment constraints.
26661
26662 -mrenesas
26663 Comply with the calling conventions defined by Renesas.
26664
26665 -mno-renesas
26666 Comply with the calling conventions defined for GCC before the
26667 Renesas conventions were available. This option is the default for
26668 all targets of the SH toolchain.
26669
26670 -mnomacsave
26671 Mark the "MAC" register as call-clobbered, even if -mrenesas is
26672 given.
26673
26674 -mieee
26675 -mno-ieee
26676 Control the IEEE compliance of floating-point comparisons, which
26677 affects the handling of cases where the result of a comparison is
26678 unordered. By default -mieee is implicitly enabled. If
26679 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
26680 results in faster floating-point greater-equal and less-equal
26681 comparisons. The implicit settings can be overridden by specifying
26682 either -mieee or -mno-ieee.
26683
26684 -minline-ic_invalidate
26685 Inline code to invalidate instruction cache entries after setting
26686 up nested function trampolines. This option has no effect if
26687 -musermode is in effect and the selected code generation option
26688 (e.g. -m4) does not allow the use of the "icbi" instruction. If
26689 the selected code generation option does not allow the use of the
26690 "icbi" instruction, and -musermode is not in effect, the inlined
26691 code manipulates the instruction cache address array directly with
26692 an associative write. This not only requires privileged mode at
26693 run time, but it also fails if the cache line had been mapped via
26694 the TLB and has become unmapped.
26695
26696 -misize
26697 Dump instruction size and location in the assembly code.
26698
26699 -mpadstruct
26700 This option is deprecated. It pads structures to multiple of 4
26701 bytes, which is incompatible with the SH ABI.
26702
26703 -matomic-model=model
26704 Sets the model of atomic operations and additional parameters as a
26705 comma separated list. For details on the atomic built-in functions
26706 see __atomic Builtins. The following models and parameters are
26707 supported:
26708
26709 none
26710 Disable compiler generated atomic sequences and emit library
26711 calls for atomic operations. This is the default if the target
26712 is not "sh*-*-linux*".
26713
26714 soft-gusa
26715 Generate GNU/Linux compatible gUSA software atomic sequences
26716 for the atomic built-in functions. The generated atomic
26717 sequences require additional support from the
26718 interrupt/exception handling code of the system and are only
26719 suitable for SH3* and SH4* single-core systems. This option is
26720 enabled by default when the target is "sh*-*-linux*" and SH3*
26721 or SH4*. When the target is SH4A, this option also partially
26722 utilizes the hardware atomic instructions "movli.l" and
26723 "movco.l" to create more efficient code, unless strict is
26724 specified.
26725
26726 soft-tcb
26727 Generate software atomic sequences that use a variable in the
26728 thread control block. This is a variation of the gUSA
26729 sequences which can also be used on SH1* and SH2* targets. The
26730 generated atomic sequences require additional support from the
26731 interrupt/exception handling code of the system and are only
26732 suitable for single-core systems. When using this model, the
26733 gbr-offset= parameter has to be specified as well.
26734
26735 soft-imask
26736 Generate software atomic sequences that temporarily disable
26737 interrupts by setting "SR.IMASK = 1111". This model works only
26738 when the program runs in privileged mode and is only suitable
26739 for single-core systems. Additional support from the
26740 interrupt/exception handling code of the system is not
26741 required. This model is enabled by default when the target is
26742 "sh*-*-linux*" and SH1* or SH2*.
26743
26744 hard-llcs
26745 Generate hardware atomic sequences using the "movli.l" and
26746 "movco.l" instructions only. This is only available on SH4A
26747 and is suitable for multi-core systems. Since the hardware
26748 instructions support only 32 bit atomic variables access to 8
26749 or 16 bit variables is emulated with 32 bit accesses. Code
26750 compiled with this option is also compatible with other
26751 software atomic model interrupt/exception handling systems if
26752 executed on an SH4A system. Additional support from the
26753 interrupt/exception handling code of the system is not required
26754 for this model.
26755
26756 gbr-offset=
26757 This parameter specifies the offset in bytes of the variable in
26758 the thread control block structure that should be used by the
26759 generated atomic sequences when the soft-tcb model has been
26760 selected. For other models this parameter is ignored. The
26761 specified value must be an integer multiple of four and in the
26762 range 0-1020.
26763
26764 strict
26765 This parameter prevents mixed usage of multiple atomic models,
26766 even if they are compatible, and makes the compiler generate
26767 atomic sequences of the specified model only.
26768
26769 -mtas
26770 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
26771 that depending on the particular hardware and software
26772 configuration this can degrade overall performance due to the
26773 operand cache line flushes that are implied by the "tas.b"
26774 instruction. On multi-core SH4A processors the "tas.b" instruction
26775 must be used with caution since it can result in data corruption
26776 for certain cache configurations.
26777
26778 -mprefergot
26779 When generating position-independent code, emit function calls
26780 using the Global Offset Table instead of the Procedure Linkage
26781 Table.
26782
26783 -musermode
26784 -mno-usermode
26785 Don't allow (allow) the compiler generating privileged mode code.
26786 Specifying -musermode also implies -mno-inline-ic_invalidate if the
26787 inlined code would not work in user mode. -musermode is the
26788 default when the target is "sh*-*-linux*". If the target is SH1*
26789 or SH2* -musermode has no effect, since there is no user mode.
26790
26791 -multcost=number
26792 Set the cost to assume for a multiply insn.
26793
26794 -mdiv=strategy
26795 Set the division strategy to be used for integer division
26796 operations. strategy can be one of:
26797
26798 call-div1
26799 Calls a library function that uses the single-step division
26800 instruction "div1" to perform the operation. Division by zero
26801 calculates an unspecified result and does not trap. This is
26802 the default except for SH4, SH2A and SHcompact.
26803
26804 call-fp
26805 Calls a library function that performs the operation in double
26806 precision floating point. Division by zero causes a floating-
26807 point exception. This is the default for SHcompact with FPU.
26808 Specifying this for targets that do not have a double precision
26809 FPU defaults to "call-div1".
26810
26811 call-table
26812 Calls a library function that uses a lookup table for small
26813 divisors and the "div1" instruction with case distinction for
26814 larger divisors. Division by zero calculates an unspecified
26815 result and does not trap. This is the default for SH4.
26816 Specifying this for targets that do not have dynamic shift
26817 instructions defaults to "call-div1".
26818
26819 When a division strategy has not been specified the default
26820 strategy is selected based on the current target. For SH2A the
26821 default strategy is to use the "divs" and "divu" instructions
26822 instead of library function calls.
26823
26824 -maccumulate-outgoing-args
26825 Reserve space once for outgoing arguments in the function prologue
26826 rather than around each call. Generally beneficial for performance
26827 and size. Also needed for unwinding to avoid changing the stack
26828 frame around conditional code.
26829
26830 -mdivsi3_libfunc=name
26831 Set the name of the library function used for 32-bit signed
26832 division to name. This only affects the name used in the call
26833 division strategies, and the compiler still expects the same sets
26834 of input/output/clobbered registers as if this option were not
26835 present.
26836
26837 -mfixed-range=register-range
26838 Generate code treating the given register range as fixed registers.
26839 A fixed register is one that the register allocator cannot use.
26840 This is useful when compiling kernel code. A register range is
26841 specified as two registers separated by a dash. Multiple register
26842 ranges can be specified separated by a comma.
26843
26844 -mbranch-cost=num
26845 Assume num to be the cost for a branch instruction. Higher numbers
26846 make the compiler try to generate more branch-free code if
26847 possible. If not specified the value is selected depending on the
26848 processor type that is being compiled for.
26849
26850 -mzdcbranch
26851 -mno-zdcbranch
26852 Assume (do not assume) that zero displacement conditional branch
26853 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
26854 the compiler prefers zero displacement branch code sequences. This
26855 is enabled by default when generating code for SH4 and SH4A. It
26856 can be explicitly disabled by specifying -mno-zdcbranch.
26857
26858 -mcbranch-force-delay-slot
26859 Force the usage of delay slots for conditional branches, which
26860 stuffs the delay slot with a "nop" if a suitable instruction cannot
26861 be found. By default this option is disabled. It can be enabled
26862 to work around hardware bugs as found in the original SH7055.
26863
26864 -mfused-madd
26865 -mno-fused-madd
26866 Generate code that uses (does not use) the floating-point multiply
26867 and accumulate instructions. These instructions are generated by
26868 default if hardware floating point is used. The machine-dependent
26869 -mfused-madd option is now mapped to the machine-independent
26870 -ffp-contract=fast option, and -mno-fused-madd is mapped to
26871 -ffp-contract=off.
26872
26873 -mfsca
26874 -mno-fsca
26875 Allow or disallow the compiler to emit the "fsca" instruction for
26876 sine and cosine approximations. The option -mfsca must be used in
26877 combination with -funsafe-math-optimizations. It is enabled by
26878 default when generating code for SH4A. Using -mno-fsca disables
26879 sine and cosine approximations even if -funsafe-math-optimizations
26880 is in effect.
26881
26882 -mfsrra
26883 -mno-fsrra
26884 Allow or disallow the compiler to emit the "fsrra" instruction for
26885 reciprocal square root approximations. The option -mfsrra must be
26886 used in combination with -funsafe-math-optimizations and
26887 -ffinite-math-only. It is enabled by default when generating code
26888 for SH4A. Using -mno-fsrra disables reciprocal square root
26889 approximations even if -funsafe-math-optimizations and
26890 -ffinite-math-only are in effect.
26891
26892 -mpretend-cmove
26893 Prefer zero-displacement conditional branches for conditional move
26894 instruction patterns. This can result in faster code on the SH4
26895 processor.
26896
26897 -mfdpic
26898 Generate code using the FDPIC ABI.
26899
26900 Solaris 2 Options
26901
26902 These -m options are supported on Solaris 2:
26903
26904 -mclear-hwcap
26905 -mclear-hwcap tells the compiler to remove the hardware
26906 capabilities generated by the Solaris assembler. This is only
26907 necessary when object files use ISA extensions not supported by the
26908 current machine, but check at runtime whether or not to use them.
26909
26910 -mimpure-text
26911 -mimpure-text, used in addition to -shared, tells the compiler to
26912 not pass -z text to the linker when linking a shared object. Using
26913 this option, you can link position-dependent code into a shared
26914 object.
26915
26916 -mimpure-text suppresses the "relocations remain against
26917 allocatable but non-writable sections" linker error message.
26918 However, the necessary relocations trigger copy-on-write, and the
26919 shared object is not actually shared across processes. Instead of
26920 using -mimpure-text, you should compile all source code with -fpic
26921 or -fPIC.
26922
26923 These switches are supported in addition to the above on Solaris 2:
26924
26925 -pthreads
26926 This is a synonym for -pthread.
26927
26928 SPARC Options
26929
26930 These -m options are supported on the SPARC:
26931
26932 -mno-app-regs
26933 -mapp-regs
26934 Specify -mapp-regs to generate output using the global registers 2
26935 through 4, which the SPARC SVR4 ABI reserves for applications.
26936 Like the global register 1, each global register 2 through 4 is
26937 then treated as an allocable register that is clobbered by function
26938 calls. This is the default.
26939
26940 To be fully SVR4 ABI-compliant at the cost of some performance
26941 loss, specify -mno-app-regs. You should compile libraries and
26942 system software with this option.
26943
26944 -mflat
26945 -mno-flat
26946 With -mflat, the compiler does not generate save/restore
26947 instructions and uses a "flat" or single register window model.
26948 This model is compatible with the regular register window model.
26949 The local registers and the input registers (0--5) are still
26950 treated as "call-saved" registers and are saved on the stack as
26951 needed.
26952
26953 With -mno-flat (the default), the compiler generates save/restore
26954 instructions (except for leaf functions). This is the normal
26955 operating mode.
26956
26957 -mfpu
26958 -mhard-float
26959 Generate output containing floating-point instructions. This is
26960 the default.
26961
26962 -mno-fpu
26963 -msoft-float
26964 Generate output containing library calls for floating point.
26965 Warning: the requisite libraries are not available for all SPARC
26966 targets. Normally the facilities of the machine's usual C compiler
26967 are used, but this cannot be done directly in cross-compilation.
26968 You must make your own arrangements to provide suitable library
26969 functions for cross-compilation. The embedded targets sparc-*-aout
26970 and sparclite-*-* do provide software floating-point support.
26971
26972 -msoft-float changes the calling convention in the output file;
26973 therefore, it is only useful if you compile all of a program with
26974 this option. In particular, you need to compile libgcc.a, the
26975 library that comes with GCC, with -msoft-float in order for this to
26976 work.
26977
26978 -mhard-quad-float
26979 Generate output containing quad-word (long double) floating-point
26980 instructions.
26981
26982 -msoft-quad-float
26983 Generate output containing library calls for quad-word (long
26984 double) floating-point instructions. The functions called are
26985 those specified in the SPARC ABI. This is the default.
26986
26987 As of this writing, there are no SPARC implementations that have
26988 hardware support for the quad-word floating-point instructions.
26989 They all invoke a trap handler for one of these instructions, and
26990 then the trap handler emulates the effect of the instruction.
26991 Because of the trap handler overhead, this is much slower than
26992 calling the ABI library routines. Thus the -msoft-quad-float
26993 option is the default.
26994
26995 -mno-unaligned-doubles
26996 -munaligned-doubles
26997 Assume that doubles have 8-byte alignment. This is the default.
26998
26999 With -munaligned-doubles, GCC assumes that doubles have 8-byte
27000 alignment only if they are contained in another type, or if they
27001 have an absolute address. Otherwise, it assumes they have 4-byte
27002 alignment. Specifying this option avoids some rare compatibility
27003 problems with code generated by other compilers. It is not the
27004 default because it results in a performance loss, especially for
27005 floating-point code.
27006
27007 -muser-mode
27008 -mno-user-mode
27009 Do not generate code that can only run in supervisor mode. This is
27010 relevant only for the "casa" instruction emitted for the LEON3
27011 processor. This is the default.
27012
27013 -mfaster-structs
27014 -mno-faster-structs
27015 With -mfaster-structs, the compiler assumes that structures should
27016 have 8-byte alignment. This enables the use of pairs of "ldd" and
27017 "std" instructions for copies in structure assignment, in place of
27018 twice as many "ld" and "st" pairs. However, the use of this
27019 changed alignment directly violates the SPARC ABI. Thus, it's
27020 intended only for use on targets where the developer acknowledges
27021 that their resulting code is not directly in line with the rules of
27022 the ABI.
27023
27024 -mstd-struct-return
27025 -mno-std-struct-return
27026 With -mstd-struct-return, the compiler generates checking code in
27027 functions returning structures or unions to detect size mismatches
27028 between the two sides of function calls, as per the 32-bit ABI.
27029
27030 The default is -mno-std-struct-return. This option has no effect
27031 in 64-bit mode.
27032
27033 -mlra
27034 -mno-lra
27035 Enable Local Register Allocation. This is the default for SPARC
27036 since GCC 7 so -mno-lra needs to be passed to get old Reload.
27037
27038 -mcpu=cpu_type
27039 Set the instruction set, register set, and instruction scheduling
27040 parameters for machine type cpu_type. Supported values for
27041 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
27042 leon3v7, leon5, sparclite, f930, f934, sparclite86x, sparclet,
27043 tsc701, v9, ultrasparc, ultrasparc3, niagara, niagara2, niagara3,
27044 niagara4, niagara7 and m8.
27045
27046 Native Solaris and GNU/Linux toolchains also support the value
27047 native, which selects the best architecture option for the host
27048 processor. -mcpu=native has no effect if GCC does not recognize
27049 the processor.
27050
27051 Default instruction scheduling parameters are used for values that
27052 select an architecture and not an implementation. These are v7,
27053 v8, sparclite, sparclet, v9.
27054
27055 Here is a list of each supported architecture and their supported
27056 implementations.
27057
27058 v7 cypress, leon3v7
27059
27060 v8 supersparc, hypersparc, leon, leon3, leon5
27061
27062 sparclite
27063 f930, f934, sparclite86x
27064
27065 sparclet
27066 tsc701
27067
27068 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
27069 niagara7, m8
27070
27071 By default (unless configured otherwise), GCC generates code for
27072 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
27073 compiler additionally optimizes it for the Cypress CY7C602 chip, as
27074 used in the SPARCStation/SPARCServer 3xx series. This is also
27075 appropriate for the older SPARCStation 1, 2, IPX etc.
27076
27077 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
27078 architecture. The only difference from V7 code is that the
27079 compiler emits the integer multiply and integer divide instructions
27080 which exist in SPARC-V8 but not in SPARC-V7. With
27081 -mcpu=supersparc, the compiler additionally optimizes it for the
27082 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
27083 series.
27084
27085 With -mcpu=sparclite, GCC generates code for the SPARClite variant
27086 of the SPARC architecture. This adds the integer multiply, integer
27087 divide step and scan ("ffs") instructions which exist in SPARClite
27088 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
27089 optimizes it for the Fujitsu MB86930 chip, which is the original
27090 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
27091 optimizes it for the Fujitsu MB86934 chip, which is the more recent
27092 SPARClite with FPU.
27093
27094 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
27095 the SPARC architecture. This adds the integer multiply,
27096 multiply/accumulate, integer divide step and scan ("ffs")
27097 instructions which exist in SPARClet but not in SPARC-V7. With
27098 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
27099 SPARClet chip.
27100
27101 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
27102 architecture. This adds 64-bit integer and floating-point move
27103 instructions, 3 additional floating-point condition code registers
27104 and conditional move instructions. With -mcpu=ultrasparc, the
27105 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
27106 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
27107 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
27108 -mcpu=niagara, the compiler additionally optimizes it for Sun
27109 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
27110 additionally optimizes it for Sun UltraSPARC T2 chips. With
27111 -mcpu=niagara3, the compiler additionally optimizes it for Sun
27112 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
27113 additionally optimizes it for Sun UltraSPARC T4 chips. With
27114 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
27115 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
27116 it for Oracle M8 chips.
27117
27118 -mtune=cpu_type
27119 Set the instruction scheduling parameters for machine type
27120 cpu_type, but do not set the instruction set or register set that
27121 the option -mcpu=cpu_type does.
27122
27123 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
27124 but the only useful values are those that select a particular CPU
27125 implementation. Those are cypress, supersparc, hypersparc, leon,
27126 leon3, leon3v7, leon5, f930, f934, sparclite86x, tsc701,
27127 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
27128 niagara7 and m8. With native Solaris and GNU/Linux toolchains,
27129 native can also be used.
27130
27131 -mv8plus
27132 -mno-v8plus
27133 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
27134 difference from the V8 ABI is that the global and out registers are
27135 considered 64 bits wide. This is enabled by default on Solaris in
27136 32-bit mode for all SPARC-V9 processors.
27137
27138 -mvis
27139 -mno-vis
27140 With -mvis, GCC generates code that takes advantage of the
27141 UltraSPARC Visual Instruction Set extensions. The default is
27142 -mno-vis.
27143
27144 -mvis2
27145 -mno-vis2
27146 With -mvis2, GCC generates code that takes advantage of version 2.0
27147 of the UltraSPARC Visual Instruction Set extensions. The default
27148 is -mvis2 when targeting a cpu that supports such instructions,
27149 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
27150
27151 -mvis3
27152 -mno-vis3
27153 With -mvis3, GCC generates code that takes advantage of version 3.0
27154 of the UltraSPARC Visual Instruction Set extensions. The default
27155 is -mvis3 when targeting a cpu that supports such instructions,
27156 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
27157 -mvis.
27158
27159 -mvis4
27160 -mno-vis4
27161 With -mvis4, GCC generates code that takes advantage of version 4.0
27162 of the UltraSPARC Visual Instruction Set extensions. The default
27163 is -mvis4 when targeting a cpu that supports such instructions,
27164 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
27165 -mvis2 and -mvis.
27166
27167 -mvis4b
27168 -mno-vis4b
27169 With -mvis4b, GCC generates code that takes advantage of version
27170 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
27171 additional VIS instructions introduced in the Oracle SPARC
27172 Architecture 2017. The default is -mvis4b when targeting a cpu
27173 that supports such instructions, such as m8 and later. Setting
27174 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
27175
27176 -mcbcond
27177 -mno-cbcond
27178 With -mcbcond, GCC generates code that takes advantage of the
27179 UltraSPARC Compare-and-Branch-on-Condition instructions. The
27180 default is -mcbcond when targeting a CPU that supports such
27181 instructions, such as Niagara-4 and later.
27182
27183 -mfmaf
27184 -mno-fmaf
27185 With -mfmaf, GCC generates code that takes advantage of the
27186 UltraSPARC Fused Multiply-Add Floating-point instructions. The
27187 default is -mfmaf when targeting a CPU that supports such
27188 instructions, such as Niagara-3 and later.
27189
27190 -mfsmuld
27191 -mno-fsmuld
27192 With -mfsmuld, GCC generates code that takes advantage of the
27193 Floating-point Multiply Single to Double (FsMULd) instruction. The
27194 default is -mfsmuld when targeting a CPU supporting the
27195 architecture versions V8 or V9 with FPU except -mcpu=leon.
27196
27197 -mpopc
27198 -mno-popc
27199 With -mpopc, GCC generates code that takes advantage of the
27200 UltraSPARC Population Count instruction. The default is -mpopc
27201 when targeting a CPU that supports such an instruction, such as
27202 Niagara-2 and later.
27203
27204 -msubxc
27205 -mno-subxc
27206 With -msubxc, GCC generates code that takes advantage of the
27207 UltraSPARC Subtract-Extended-with-Carry instruction. The default
27208 is -msubxc when targeting a CPU that supports such an instruction,
27209 such as Niagara-7 and later.
27210
27211 -mfix-at697f
27212 Enable the documented workaround for the single erratum of the
27213 Atmel AT697F processor (which corresponds to erratum #13 of the
27214 AT697E processor).
27215
27216 -mfix-ut699
27217 Enable the documented workarounds for the floating-point errata and
27218 the data cache nullify errata of the UT699 processor.
27219
27220 -mfix-ut700
27221 Enable the documented workaround for the back-to-back store errata
27222 of the UT699E/UT700 processor.
27223
27224 -mfix-gr712rc
27225 Enable the documented workaround for the back-to-back store errata
27226 of the GR712RC processor.
27227
27228 These -m options are supported in addition to the above on SPARC-V9
27229 processors in 64-bit environments:
27230
27231 -m32
27232 -m64
27233 Generate code for a 32-bit or 64-bit environment. The 32-bit
27234 environment sets int, long and pointer to 32 bits. The 64-bit
27235 environment sets int to 32 bits and long and pointer to 64 bits.
27236
27237 -mcmodel=which
27238 Set the code model to one of
27239
27240 medlow
27241 The Medium/Low code model: 64-bit addresses, programs must be
27242 linked in the low 32 bits of memory. Programs can be
27243 statically or dynamically linked.
27244
27245 medmid
27246 The Medium/Middle code model: 64-bit addresses, programs must
27247 be linked in the low 44 bits of memory, the text and data
27248 segments must be less than 2GB in size and the data segment
27249 must be located within 2GB of the text segment.
27250
27251 medany
27252 The Medium/Anywhere code model: 64-bit addresses, programs may
27253 be linked anywhere in memory, the text and data segments must
27254 be less than 2GB in size and the data segment must be located
27255 within 2GB of the text segment.
27256
27257 embmedany
27258 The Medium/Anywhere code model for embedded systems: 64-bit
27259 addresses, the text and data segments must be less than 2GB in
27260 size, both starting anywhere in memory (determined at link
27261 time). The global register %g4 points to the base of the data
27262 segment. Programs are statically linked and PIC is not
27263 supported.
27264
27265 -mmemory-model=mem-model
27266 Set the memory model in force on the processor to one of
27267
27268 default
27269 The default memory model for the processor and operating
27270 system.
27271
27272 rmo Relaxed Memory Order
27273
27274 pso Partial Store Order
27275
27276 tso Total Store Order
27277
27278 sc Sequential Consistency
27279
27280 These memory models are formally defined in Appendix D of the
27281 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
27282 field.
27283
27284 -mstack-bias
27285 -mno-stack-bias
27286 With -mstack-bias, GCC assumes that the stack pointer, and frame
27287 pointer if present, are offset by -2047 which must be added back
27288 when making stack frame references. This is the default in 64-bit
27289 mode. Otherwise, assume no such offset is present.
27290
27291 Options for System V
27292
27293 These additional options are available on System V Release 4 for
27294 compatibility with other compilers on those systems:
27295
27296 -G Create a shared object. It is recommended that -symbolic or
27297 -shared be used instead.
27298
27299 -Qy Identify the versions of each tool used by the compiler, in a
27300 ".ident" assembler directive in the output.
27301
27302 -Qn Refrain from adding ".ident" directives to the output file (this is
27303 the default).
27304
27305 -YP,dirs
27306 Search the directories dirs, and no others, for libraries specified
27307 with -l.
27308
27309 -Ym,dir
27310 Look in the directory dir to find the M4 preprocessor. The
27311 assembler uses this option.
27312
27313 V850 Options
27314
27315 These -m options are defined for V850 implementations:
27316
27317 -mlong-calls
27318 -mno-long-calls
27319 Treat all calls as being far away (near). If calls are assumed to
27320 be far away, the compiler always loads the function's address into
27321 a register, and calls indirect through the pointer.
27322
27323 -mno-ep
27324 -mep
27325 Do not optimize (do optimize) basic blocks that use the same index
27326 pointer 4 or more times to copy pointer into the "ep" register, and
27327 use the shorter "sld" and "sst" instructions. The -mep option is
27328 on by default if you optimize.
27329
27330 -mno-prolog-function
27331 -mprolog-function
27332 Do not use (do use) external functions to save and restore
27333 registers at the prologue and epilogue of a function. The external
27334 functions are slower, but use less code space if more than one
27335 function saves the same number of registers. The -mprolog-function
27336 option is on by default if you optimize.
27337
27338 -mspace
27339 Try to make the code as small as possible. At present, this just
27340 turns on the -mep and -mprolog-function options.
27341
27342 -mtda=n
27343 Put static or global variables whose size is n bytes or less into
27344 the tiny data area that register "ep" points to. The tiny data
27345 area can hold up to 256 bytes in total (128 bytes for byte
27346 references).
27347
27348 -msda=n
27349 Put static or global variables whose size is n bytes or less into
27350 the small data area that register "gp" points to. The small data
27351 area can hold up to 64 kilobytes.
27352
27353 -mzda=n
27354 Put static or global variables whose size is n bytes or less into
27355 the first 32 kilobytes of memory.
27356
27357 -mv850
27358 Specify that the target processor is the V850.
27359
27360 -mv850e3v5
27361 Specify that the target processor is the V850E3V5. The
27362 preprocessor constant "__v850e3v5__" is defined if this option is
27363 used.
27364
27365 -mv850e2v4
27366 Specify that the target processor is the V850E3V5. This is an
27367 alias for the -mv850e3v5 option.
27368
27369 -mv850e2v3
27370 Specify that the target processor is the V850E2V3. The
27371 preprocessor constant "__v850e2v3__" is defined if this option is
27372 used.
27373
27374 -mv850e2
27375 Specify that the target processor is the V850E2. The preprocessor
27376 constant "__v850e2__" is defined if this option is used.
27377
27378 -mv850e1
27379 Specify that the target processor is the V850E1. The preprocessor
27380 constants "__v850e1__" and "__v850e__" are defined if this option
27381 is used.
27382
27383 -mv850es
27384 Specify that the target processor is the V850ES. This is an alias
27385 for the -mv850e1 option.
27386
27387 -mv850e
27388 Specify that the target processor is the V850E. The preprocessor
27389 constant "__v850e__" is defined if this option is used.
27390
27391 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
27392 -mv850e2v3 nor -mv850e3v5 are defined then a default target
27393 processor is chosen and the relevant __v850*__ preprocessor
27394 constant is defined.
27395
27396 The preprocessor constants "__v850" and "__v851__" are always
27397 defined, regardless of which processor variant is the target.
27398
27399 -mdisable-callt
27400 -mno-disable-callt
27401 This option suppresses generation of the "CALLT" instruction for
27402 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
27403 v850 architecture.
27404
27405 This option is enabled by default when the RH850 ABI is in use (see
27406 -mrh850-abi), and disabled by default when the GCC ABI is in use.
27407 If "CALLT" instructions are being generated then the C preprocessor
27408 symbol "__V850_CALLT__" is defined.
27409
27410 -mrelax
27411 -mno-relax
27412 Pass on (or do not pass on) the -mrelax command-line option to the
27413 assembler.
27414
27415 -mlong-jumps
27416 -mno-long-jumps
27417 Disable (or re-enable) the generation of PC-relative jump
27418 instructions.
27419
27420 -msoft-float
27421 -mhard-float
27422 Disable (or re-enable) the generation of hardware floating point
27423 instructions. This option is only significant when the target
27424 architecture is V850E2V3 or higher. If hardware floating point
27425 instructions are being generated then the C preprocessor symbol
27426 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
27427 defined.
27428
27429 -mloop
27430 Enables the use of the e3v5 LOOP instruction. The use of this
27431 instruction is not enabled by default when the e3v5 architecture is
27432 selected because its use is still experimental.
27433
27434 -mrh850-abi
27435 -mghs
27436 Enables support for the RH850 version of the V850 ABI. This is the
27437 default. With this version of the ABI the following rules apply:
27438
27439 * Integer sized structures and unions are returned via a memory
27440 pointer rather than a register.
27441
27442 * Large structures and unions (more than 8 bytes in size) are
27443 passed by value.
27444
27445 * Functions are aligned to 16-bit boundaries.
27446
27447 * The -m8byte-align command-line option is supported.
27448
27449 * The -mdisable-callt command-line option is enabled by default.
27450 The -mno-disable-callt command-line option is not supported.
27451
27452 When this version of the ABI is enabled the C preprocessor symbol
27453 "__V850_RH850_ABI__" is defined.
27454
27455 -mgcc-abi
27456 Enables support for the old GCC version of the V850 ABI. With this
27457 version of the ABI the following rules apply:
27458
27459 * Integer sized structures and unions are returned in register
27460 "r10".
27461
27462 * Large structures and unions (more than 8 bytes in size) are
27463 passed by reference.
27464
27465 * Functions are aligned to 32-bit boundaries, unless optimizing
27466 for size.
27467
27468 * The -m8byte-align command-line option is not supported.
27469
27470 * The -mdisable-callt command-line option is supported but not
27471 enabled by default.
27472
27473 When this version of the ABI is enabled the C preprocessor symbol
27474 "__V850_GCC_ABI__" is defined.
27475
27476 -m8byte-align
27477 -mno-8byte-align
27478 Enables support for "double" and "long long" types to be aligned on
27479 8-byte boundaries. The default is to restrict the alignment of all
27480 objects to at most 4-bytes. When -m8byte-align is in effect the C
27481 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
27482
27483 -mbig-switch
27484 Generate code suitable for big switch tables. Use this option only
27485 if the assembler/linker complain about out of range branches within
27486 a switch table.
27487
27488 -mapp-regs
27489 This option causes r2 and r5 to be used in the code generated by
27490 the compiler. This setting is the default.
27491
27492 -mno-app-regs
27493 This option causes r2 and r5 to be treated as fixed registers.
27494
27495 VAX Options
27496
27497 These -m options are defined for the VAX:
27498
27499 -munix
27500 Do not output certain jump instructions ("aobleq" and so on) that
27501 the Unix assembler for the VAX cannot handle across long ranges.
27502
27503 -mgnu
27504 Do output those jump instructions, on the assumption that the GNU
27505 assembler is being used.
27506
27507 -mg Output code for G-format floating-point numbers instead of
27508 D-format.
27509
27510 -mlra
27511 -mno-lra
27512 Enable Local Register Allocation. This is still experimental for
27513 the VAX, so by default the compiler uses standard reload.
27514
27515 Visium Options
27516
27517 -mdebug
27518 A program which performs file I/O and is destined to run on an MCM
27519 target should be linked with this option. It causes the libraries
27520 libc.a and libdebug.a to be linked. The program should be run on
27521 the target under the control of the GDB remote debugging stub.
27522
27523 -msim
27524 A program which performs file I/O and is destined to run on the
27525 simulator should be linked with option. This causes libraries
27526 libc.a and libsim.a to be linked.
27527
27528 -mfpu
27529 -mhard-float
27530 Generate code containing floating-point instructions. This is the
27531 default.
27532
27533 -mno-fpu
27534 -msoft-float
27535 Generate code containing library calls for floating-point.
27536
27537 -msoft-float changes the calling convention in the output file;
27538 therefore, it is only useful if you compile all of a program with
27539 this option. In particular, you need to compile libgcc.a, the
27540 library that comes with GCC, with -msoft-float in order for this to
27541 work.
27542
27543 -mcpu=cpu_type
27544 Set the instruction set, register set, and instruction scheduling
27545 parameters for machine type cpu_type. Supported values for
27546 cpu_type are mcm, gr5 and gr6.
27547
27548 mcm is a synonym of gr5 present for backward compatibility.
27549
27550 By default (unless configured otherwise), GCC generates code for
27551 the GR5 variant of the Visium architecture.
27552
27553 With -mcpu=gr6, GCC generates code for the GR6 variant of the
27554 Visium architecture. The only difference from GR5 code is that the
27555 compiler will generate block move instructions.
27556
27557 -mtune=cpu_type
27558 Set the instruction scheduling parameters for machine type
27559 cpu_type, but do not set the instruction set or register set that
27560 the option -mcpu=cpu_type would.
27561
27562 -msv-mode
27563 Generate code for the supervisor mode, where there are no
27564 restrictions on the access to general registers. This is the
27565 default.
27566
27567 -muser-mode
27568 Generate code for the user mode, where the access to some general
27569 registers is forbidden: on the GR5, registers r24 to r31 cannot be
27570 accessed in this mode; on the GR6, only registers r29 to r31 are
27571 affected.
27572
27573 VMS Options
27574
27575 These -m options are defined for the VMS implementations:
27576
27577 -mvms-return-codes
27578 Return VMS condition codes from "main". The default is to return
27579 POSIX-style condition (e.g. error) codes.
27580
27581 -mdebug-main=prefix
27582 Flag the first routine whose name starts with prefix as the main
27583 routine for the debugger.
27584
27585 -mmalloc64
27586 Default to 64-bit memory allocation routines.
27587
27588 -mpointer-size=size
27589 Set the default size of pointers. Possible options for size are 32
27590 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
27591 no for supporting only 32 bit pointers. The later option disables
27592 "pragma pointer_size".
27593
27594 VxWorks Options
27595
27596 The options in this section are defined for all VxWorks targets.
27597 Options specific to the target hardware are listed with the other
27598 options for that target.
27599
27600 -mrtp
27601 GCC can generate code for both VxWorks kernels and real time
27602 processes (RTPs). This option switches from the former to the
27603 latter. It also defines the preprocessor macro "__RTP__".
27604
27605 -non-static
27606 Link an RTP executable against shared libraries rather than static
27607 libraries. The options -static and -shared can also be used for
27608 RTPs; -static is the default.
27609
27610 -Bstatic
27611 -Bdynamic
27612 These options are passed down to the linker. They are defined for
27613 compatibility with Diab.
27614
27615 -Xbind-lazy
27616 Enable lazy binding of function calls. This option is equivalent
27617 to -Wl,-z,now and is defined for compatibility with Diab.
27618
27619 -Xbind-now
27620 Disable lazy binding of function calls. This option is the default
27621 and is defined for compatibility with Diab.
27622
27623 x86 Options
27624
27625 These -m options are defined for the x86 family of computers.
27626
27627 -march=cpu-type
27628 Generate instructions for the machine type cpu-type. In contrast
27629 to -mtune=cpu-type, which merely tunes the generated code for the
27630 specified cpu-type, -march=cpu-type allows GCC to generate code
27631 that may not run at all on processors other than the one indicated.
27632 Specifying -march=cpu-type implies -mtune=cpu-type, except where
27633 noted otherwise.
27634
27635 The choices for cpu-type are:
27636
27637 native
27638 This selects the CPU to generate code for at compilation time
27639 by determining the processor type of the compiling machine.
27640 Using -march=native enables all instruction subsets supported
27641 by the local machine (hence the result might not run on
27642 different machines). Using -mtune=native produces code
27643 optimized for the local machine under the constraints of the
27644 selected instruction set.
27645
27646 x86-64
27647 A generic CPU with 64-bit extensions.
27648
27649 x86-64-v2
27650 x86-64-v3
27651 x86-64-v4
27652 These choices for cpu-type select the corresponding micro-
27653 architecture level from the x86-64 psABI. On ABIs other than
27654 the x86-64 psABI they select the same CPU features as the
27655 x86-64 psABI documents for the particular micro-architecture
27656 level.
27657
27658 Since these cpu-type values do not have a corresponding -mtune
27659 setting, using -march with these values enables generic tuning.
27660 Specific tuning can be enabled using the -mtune=other-cpu-type
27661 option with an appropriate other-cpu-type value.
27662
27663 i386
27664 Original Intel i386 CPU.
27665
27666 i486
27667 Intel i486 CPU. (No scheduling is implemented for this chip.)
27668
27669 i586
27670 pentium
27671 Intel Pentium CPU with no MMX support.
27672
27673 lakemont
27674 Intel Lakemont MCU, based on Intel Pentium CPU.
27675
27676 pentium-mmx
27677 Intel Pentium MMX CPU, based on Pentium core with MMX
27678 instruction set support.
27679
27680 pentiumpro
27681 Intel Pentium Pro CPU.
27682
27683 i686
27684 When used with -march, the Pentium Pro instruction set is used,
27685 so the code runs on all i686 family chips. When used with
27686 -mtune, it has the same meaning as generic.
27687
27688 pentium2
27689 Intel Pentium II CPU, based on Pentium Pro core with MMX and
27690 FXSR instruction set support.
27691
27692 pentium3
27693 pentium3m
27694 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR
27695 and SSE instruction set support.
27696
27697 pentium-m
27698 Intel Pentium M; low-power version of Intel Pentium III CPU
27699 with MMX, SSE, SSE2 and FXSR instruction set support. Used by
27700 Centrino notebooks.
27701
27702 pentium4
27703 pentium4m
27704 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction
27705 set support.
27706
27707 prescott
27708 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2,
27709 SSE3 and FXSR instruction set support.
27710
27711 nocona
27712 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
27713 MMX, SSE, SSE2, SSE3 and FXSR instruction set support.
27714
27715 core2
27716 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
27717 SSSE3, CX16, SAHF and FXSR instruction set support.
27718
27719 nehalem
27720 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
27721 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction
27722 set support.
27723
27724 westmere
27725 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
27726 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and
27727 PCLMUL instruction set support.
27728
27729 sandybridge
27730 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
27731 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
27732 XSAVE and PCLMUL instruction set support.
27733
27734 ivybridge
27735 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
27736 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
27737 XSAVE, PCLMUL, FSGSBASE, RDRND and F16C instruction set
27738 support.
27739
27740 haswell
27741 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
27742 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27743 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27744 LZCNT, FMA, MOVBE and HLE instruction set support.
27745
27746 broadwell
27747 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
27748 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27749 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27750 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW instruction
27751 set support.
27752
27753 skylake
27754 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27755 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27756 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27757 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27758 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
27759
27760 bonnell
27761 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
27762 SSE2, SSE3 and SSSE3 instruction set support.
27763
27764 silvermont
27765 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
27766 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27767 PCLMUL, PREFETCHW and RDRND instruction set support.
27768
27769 goldmont
27770 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
27771 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27772 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
27773 XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction set
27774 support.
27775
27776 goldmont-plus
27777 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
27778 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27779 FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE,
27780 XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID
27781 and SGX instruction set support.
27782
27783 tremont
27784 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
27785 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27786 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
27787 XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID, SGX,
27788 CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG
27789 instruction set support.
27790
27791 sierraforest
27792 Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX,
27793 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
27794 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
27795 PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
27796 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
27797 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
27798 WIDEKL, AVX-VNNI, AVXIFMA, AVXVNNIINT8, AVXNECONVERT,
27799 CMPCCXADD, ENQCMD and UINTR instruction set support.
27800
27801 grandridge
27802 Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE,
27803 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
27804 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
27805 PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
27806 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
27807 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
27808 WIDEKL, AVX-VNNI, AVXIFMA, AVXVNNIINT8, AVXNECONVERT,
27809 CMPCCXADD, ENQCMD, UINTR and RAOINT instruction set support.
27810
27811 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
27812 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27813 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27814 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
27815 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1
27816 instruction set support.
27817
27818 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
27819 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27820 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27821 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AVX512PF,
27822 AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
27823 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27824
27825 skylake-avx512
27826 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
27827 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27828 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27829 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27830 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
27831 AVX512BW, AVX512DQ and AVX512CD instruction set support.
27832
27833 cannonlake
27834 Intel Cannonlake 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 and SHA
27840 instruction set support.
27841
27842 icelake-client
27843 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX,
27844 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27845 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27846 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27847 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27848 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27849 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
27850 RDPID and AVX512VPOPCNTDQ instruction set support.
27851
27852 icelake-server
27853 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
27854 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27855 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27856 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27857 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27858 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27859 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
27860 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB instruction
27861 set support.
27862
27863 cascadelake
27864 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27865 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27866 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27867 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27868 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
27869 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
27870 support.
27871
27872 cooperlake
27873 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27874 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27875 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27876 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27877 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
27878 AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16
27879 instruction set support.
27880
27881 tigerlake
27882 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27883 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27884 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27885 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27886 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27887 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
27888 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27889 RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
27890 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
27891
27892 sapphirerapids
27893 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX,
27894 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27895 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27896 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27897 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27898 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27899 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27900 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI,
27901 MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE,
27902 TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI,
27903 AVX512-FP16 and AVX512BF16 instruction set support.
27904
27905 alderlake
27906 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27907 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
27908 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
27909 PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
27910 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
27911 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
27912 WIDEKL and AVX-VNNI instruction set support.
27913
27914 rocketlake
27915 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27916 SSE2, SSE3, SSSE3 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27917 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27918 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27919 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW,
27920 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
27921 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27922 RDPID and AVX512VPOPCNTDQ instruction set support.
27923
27924 graniterapids
27925 Intel graniterapids CPU with 64-bit extensions, MOVBE, MMX,
27926 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27927 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27928 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27929 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27930 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27931 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27932 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI,
27933 MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE,
27934 TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI,
27935 AVX512-FP16, AVX512BF16, AMX-FP16 and PREFETCHI instruction set
27936 support.
27937
27938 graniterapids-d
27939 Intel graniterapids D CPU with 64-bit extensions, MOVBE, MMX,
27940 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
27941 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
27942 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27943 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
27944 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
27945 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27946 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI,
27947 MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE,
27948 TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI,
27949 AVX512FP16, AVX512BF16, AMX-FP16, PREFETCHI and AMX-COMPLEX
27950 instruction set support.
27951
27952 k6 AMD K6 CPU with MMX instruction set support.
27953
27954 k6-2
27955 k6-3
27956 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
27957 set support.
27958
27959 athlon
27960 athlon-tbird
27961 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
27962 prefetch instructions support.
27963
27964 athlon-4
27965 athlon-xp
27966 athlon-mp
27967 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
27968 full SSE instruction set support.
27969
27970 k8
27971 opteron
27972 athlon64
27973 athlon-fx
27974 Processors based on the AMD K8 core with x86-64 instruction set
27975 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
27976 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
27977 3DNow! and 64-bit instruction set extensions.)
27978
27979 k8-sse3
27980 opteron-sse3
27981 athlon64-sse3
27982 Improved versions of AMD K8 cores with SSE3 instruction set
27983 support.
27984
27985 amdfam10
27986 barcelona
27987 CPUs based on AMD Family 10h cores with x86-64 instruction set
27988 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
27989 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
27990
27991 bdver1
27992 CPUs based on AMD Family 15h cores with x86-64 instruction set
27993 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL,
27994 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
27995 and 64-bit instruction set extensions.)
27996
27997 bdver2
27998 AMD Family 15h core based CPUs with x86-64 instruction set
27999 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
28000 LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
28001 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
28002
28003 bdver3
28004 AMD Family 15h core based CPUs with x86-64 instruction set
28005 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
28006 AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
28007 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
28008 extensions.)
28009
28010 bdver4
28011 AMD Family 15h core based CPUs with x86-64 instruction set
28012 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
28013 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX,
28014 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
28015 instruction set extensions.)
28016
28017 znver1
28018 AMD Family 17h core based CPUs with x86-64 instruction set
28019 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
28020 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16,
28021 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
28022 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
28023 extensions.)
28024
28025 znver2
28026 AMD Family 17h core based CPUs with x86-64 instruction set
28027 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
28028 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
28029 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
28030 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
28031 WBNOINVD, and 64-bit instruction set extensions.)
28032
28033 znver3
28034 AMD Family 19h core based CPUs with x86-64 instruction set
28035 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
28036 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
28037 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
28038 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
28039 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set
28040 extensions.)
28041
28042 znver4
28043 AMD Family 19h core based CPUs with x86-64 instruction set
28044 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
28045 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
28046 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
28047 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
28048 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA,
28049 AVX512CD, AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI,
28050 AVX512VBMI2, AVX512VNNI, AVX512BITALG, AVX512VPOPCNTDQ, GFNI
28051 and 64-bit instruction set extensions.)
28052
28053 btver1
28054 CPUs based on AMD Family 14h cores with x86-64 instruction set
28055 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
28056 CX16, ABM and 64-bit instruction set extensions.)
28057
28058 btver2
28059 CPUs based on AMD Family 16h cores with x86-64 instruction set
28060 support. This includes MOVBE, F16C, BMI, AVX, PCLMUL, AES,
28061 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
28062 and 64-bit instruction set extensions.
28063
28064 winchip-c6
28065 IDT WinChip C6 CPU, dealt in same way as i486 with additional
28066 MMX instruction set support.
28067
28068 winchip2
28069 IDT WinChip 2 CPU, dealt in same way as i486 with additional
28070 MMX and 3DNow! instruction set support.
28071
28072 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
28073 scheduling is implemented for this chip.)
28074
28075 c3-2
28076 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
28077 support. (No scheduling is implemented for this chip.)
28078
28079 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
28080 set support. (No scheduling is implemented for this chip.)
28081
28082 samuel-2
28083 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
28084 support. (No scheduling is implemented for this chip.)
28085
28086 nehemiah
28087 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
28088 (No scheduling is implemented for this chip.)
28089
28090 esther
28091 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
28092 set support. (No scheduling is implemented for this chip.)
28093
28094 eden-x2
28095 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
28096 instruction set support. (No scheduling is implemented for
28097 this chip.)
28098
28099 eden-x4
28100 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
28101 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
28102 scheduling is implemented for this chip.)
28103
28104 nano
28105 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
28106 SSSE3 instruction set support. (No scheduling is implemented
28107 for this chip.)
28108
28109 nano-1000
28110 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28111 instruction set support. (No scheduling is implemented for
28112 this chip.)
28113
28114 nano-2000
28115 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28116 instruction set support. (No scheduling is implemented for
28117 this chip.)
28118
28119 nano-3000
28120 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
28121 SSE4.1 instruction set support. (No scheduling is implemented
28122 for this chip.)
28123
28124 nano-x2
28125 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
28126 and SSE4.1 instruction set support. (No scheduling is
28127 implemented for this chip.)
28128
28129 nano-x4
28130 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
28131 and SSE4.1 instruction set support. (No scheduling is
28132 implemented for this chip.)
28133
28134 lujiazui
28135 ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3,
28136 SSSE3, SSE4.1, SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE,
28137 XSAVEOPT, FSGSBASE, CX16, ABM, BMI, BMI2, F16C, FXSR, RDSEED
28138 instruction set support.
28139
28140 geode
28141 AMD Geode embedded processor with MMX and 3DNow! instruction
28142 set support.
28143
28144 -mtune=cpu-type
28145 Tune to cpu-type everything applicable about the generated code,
28146 except for the ABI and the set of available instructions. While
28147 picking a specific cpu-type schedules things appropriately for that
28148 particular chip, the compiler does not generate any code that
28149 cannot run on the default machine type unless you use a -march=cpu-
28150 type option. For example, if GCC is configured for
28151 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
28152 for Pentium 4 but still runs on i686 machines.
28153
28154 The choices for cpu-type are the same as for -march. In addition,
28155 -mtune supports 2 extra choices for cpu-type:
28156
28157 generic
28158 Produce code optimized for the most common IA32/AMD64/EM64T
28159 processors. If you know the CPU on which your code will run,
28160 then you should use the corresponding -mtune or -march option
28161 instead of -mtune=generic. But, if you do not know exactly
28162 what CPU users of your application will have, then you should
28163 use this option.
28164
28165 As new processors are deployed in the marketplace, the behavior
28166 of this option will change. Therefore, if you upgrade to a
28167 newer version of GCC, code generation controlled by this option
28168 will change to reflect the processors that are most common at
28169 the time that version of GCC is released.
28170
28171 There is no -march=generic option because -march indicates the
28172 instruction set the compiler can use, and there is no generic
28173 instruction set applicable to all processors. In contrast,
28174 -mtune indicates the processor (or, in this case, collection of
28175 processors) for which the code is optimized.
28176
28177 intel
28178 Produce code optimized for the most current Intel processors,
28179 which are Haswell and Silvermont for this version of GCC. If
28180 you know the CPU on which your code will run, then you should
28181 use the corresponding -mtune or -march option instead of
28182 -mtune=intel. But, if you want your application performs
28183 better on both Haswell and Silvermont, then you should use this
28184 option.
28185
28186 As new Intel processors are deployed in the marketplace, the
28187 behavior of this option will change. Therefore, if you upgrade
28188 to a newer version of GCC, code generation controlled by this
28189 option will change to reflect the most current Intel processors
28190 at the time that version of GCC is released.
28191
28192 There is no -march=intel option because -march indicates the
28193 instruction set the compiler can use, and there is no common
28194 instruction set applicable to all processors. In contrast,
28195 -mtune indicates the processor (or, in this case, collection of
28196 processors) for which the code is optimized.
28197
28198 -mcpu=cpu-type
28199 A deprecated synonym for -mtune.
28200
28201 -mfpmath=unit
28202 Generate floating-point arithmetic for selected unit unit. The
28203 choices for unit are:
28204
28205 387 Use the standard 387 floating-point coprocessor present on the
28206 majority of chips and emulated otherwise. Code compiled with
28207 this option runs almost everywhere. The temporary results are
28208 computed in 80-bit precision instead of the precision specified
28209 by the type, resulting in slightly different results compared
28210 to most of other chips. See -ffloat-store for more detailed
28211 description.
28212
28213 This is the default choice for non-Darwin x86-32 targets.
28214
28215 sse Use scalar floating-point instructions present in the SSE
28216 instruction set. This instruction set is supported by Pentium
28217 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
28218 and Athlon MP chips. The earlier version of the SSE
28219 instruction set supports only single-precision arithmetic, thus
28220 the double and extended-precision arithmetic are still done
28221 using 387. A later version, present only in Pentium 4 and AMD
28222 x86-64 chips, supports double-precision arithmetic too.
28223
28224 For the x86-32 compiler, you must use -march=cpu-type, -msse or
28225 -msse2 switches to enable SSE extensions and make this option
28226 effective. For the x86-64 compiler, these extensions are
28227 enabled by default.
28228
28229 The resulting code should be considerably faster in the
28230 majority of cases and avoid the numerical instability problems
28231 of 387 code, but may break some existing code that expects
28232 temporaries to be 80 bits.
28233
28234 This is the default choice for the x86-64 compiler, Darwin
28235 x86-32 targets, and the default choice for x86-32 targets with
28236 the SSE2 instruction set when -ffast-math is enabled.
28237
28238 sse,387
28239 sse+387
28240 both
28241 Attempt to utilize both instruction sets at once. This
28242 effectively doubles the amount of available registers, and on
28243 chips with separate execution units for 387 and SSE the
28244 execution resources too. Use this option with care, as it is
28245 still experimental, because the GCC register allocator does not
28246 model separate functional units well, resulting in unstable
28247 performance.
28248
28249 -masm=dialect
28250 Output assembly instructions using selected dialect. Also affects
28251 which dialect is used for basic "asm" and extended "asm". Supported
28252 choices (in dialect order) are att or intel. The default is att.
28253 Darwin does not support intel.
28254
28255 -mieee-fp
28256 -mno-ieee-fp
28257 Control whether or not the compiler uses IEEE floating-point
28258 comparisons. These correctly handle the case where the result of a
28259 comparison is unordered.
28260
28261 -m80387
28262 -mhard-float
28263 Generate output containing 80387 instructions for floating point.
28264
28265 -mno-80387
28266 -msoft-float
28267 Generate output containing library calls for floating point.
28268
28269 Warning: the requisite libraries are not part of GCC. Normally the
28270 facilities of the machine's usual C compiler are used, but this
28271 cannot be done directly in cross-compilation. You must make your
28272 own arrangements to provide suitable library functions for cross-
28273 compilation.
28274
28275 On machines where a function returns floating-point results in the
28276 80387 register stack, some floating-point opcodes may be emitted
28277 even if -msoft-float is used.
28278
28279 -mno-fp-ret-in-387
28280 Do not use the FPU registers for return values of functions.
28281
28282 The usual calling convention has functions return values of types
28283 "float" and "double" in an FPU register, even if there is no FPU.
28284 The idea is that the operating system should emulate an FPU.
28285
28286 The option -mno-fp-ret-in-387 causes such values to be returned in
28287 ordinary CPU registers instead.
28288
28289 -mno-fancy-math-387
28290 Some 387 emulators do not support the "sin", "cos" and "sqrt"
28291 instructions for the 387. Specify this option to avoid generating
28292 those instructions. This option is overridden when -march
28293 indicates that the target CPU always has an FPU and so the
28294 instruction does not need emulation. These instructions are not
28295 generated unless you also use the -funsafe-math-optimizations
28296 switch.
28297
28298 -malign-double
28299 -mno-align-double
28300 Control whether GCC aligns "double", "long double", and "long long"
28301 variables on a two-word boundary or a one-word boundary. Aligning
28302 "double" variables on a two-word boundary produces code that runs
28303 somewhat faster on a Pentium at the expense of more memory.
28304
28305 On x86-64, -malign-double is enabled by default.
28306
28307 Warning: if you use the -malign-double switch, structures
28308 containing the above types are aligned differently than the
28309 published application binary interface specifications for the
28310 x86-32 and are not binary compatible with structures in code
28311 compiled without that switch.
28312
28313 -m96bit-long-double
28314 -m128bit-long-double
28315 These switches control the size of "long double" type. The x86-32
28316 application binary interface specifies the size to be 96 bits, so
28317 -m96bit-long-double is the default in 32-bit mode.
28318
28319 Modern architectures (Pentium and newer) prefer "long double" to be
28320 aligned to an 8- or 16-byte boundary. In arrays or structures
28321 conforming to the ABI, this is not possible. So specifying
28322 -m128bit-long-double aligns "long double" to a 16-byte boundary by
28323 padding the "long double" with an additional 32-bit zero.
28324
28325 In the x86-64 compiler, -m128bit-long-double is the default choice
28326 as its ABI specifies that "long double" is aligned on 16-byte
28327 boundary.
28328
28329 Notice that neither of these options enable any extra precision
28330 over the x87 standard of 80 bits for a "long double".
28331
28332 Warning: if you override the default value for your target ABI,
28333 this changes the size of structures and arrays containing "long
28334 double" variables, as well as modifying the function calling
28335 convention for functions taking "long double". Hence they are not
28336 binary-compatible with code compiled without that switch.
28337
28338 -mlong-double-64
28339 -mlong-double-80
28340 -mlong-double-128
28341 These switches control the size of "long double" type. A size of 64
28342 bits makes the "long double" type equivalent to the "double" type.
28343 This is the default for 32-bit Bionic C library. A size of 128
28344 bits makes the "long double" type equivalent to the "__float128"
28345 type. This is the default for 64-bit Bionic C library.
28346
28347 Warning: if you override the default value for your target ABI,
28348 this changes the size of structures and arrays containing "long
28349 double" variables, as well as modifying the function calling
28350 convention for functions taking "long double". Hence they are not
28351 binary-compatible with code compiled without that switch.
28352
28353 -malign-data=type
28354 Control how GCC aligns variables. Supported values for type are
28355 compat uses increased alignment value compatible uses GCC 4.8 and
28356 earlier, abi uses alignment value as specified by the psABI, and
28357 cacheline uses increased alignment value to match the cache line
28358 size. compat is the default.
28359
28360 -mlarge-data-threshold=threshold
28361 When -mcmodel=medium is specified, data objects larger than
28362 threshold are placed in the large data section. This value must be
28363 the same across all objects linked into the binary, and defaults to
28364 65535.
28365
28366 -mrtd
28367 Use a different function-calling convention, in which functions
28368 that take a fixed number of arguments return with the "ret num"
28369 instruction, which pops their arguments while returning. This
28370 saves one instruction in the caller since there is no need to pop
28371 the arguments there.
28372
28373 You can specify that an individual function is called with this
28374 calling sequence with the function attribute "stdcall". You can
28375 also override the -mrtd option by using the function attribute
28376 "cdecl".
28377
28378 Warning: this calling convention is incompatible with the one
28379 normally used on Unix, so you cannot use it if you need to call
28380 libraries compiled with the Unix compiler.
28381
28382 Also, you must provide function prototypes for all functions that
28383 take variable numbers of arguments (including "printf"); otherwise
28384 incorrect code is generated for calls to those functions.
28385
28386 In addition, seriously incorrect code results if you call a
28387 function with too many arguments. (Normally, extra arguments are
28388 harmlessly ignored.)
28389
28390 -mregparm=num
28391 Control how many registers are used to pass integer arguments. By
28392 default, no registers are used to pass arguments, and at most 3
28393 registers can be used. You can control this behavior for a
28394 specific function by using the function attribute "regparm".
28395
28396 Warning: if you use this switch, and num is nonzero, then you must
28397 build all modules with the same value, including any libraries.
28398 This includes the system libraries and startup modules.
28399
28400 -msseregparm
28401 Use SSE register passing conventions for float and double arguments
28402 and return values. You can control this behavior for a specific
28403 function by using the function attribute "sseregparm".
28404
28405 Warning: if you use this switch then you must build all modules
28406 with the same value, including any libraries. This includes the
28407 system libraries and startup modules.
28408
28409 -mvect8-ret-in-mem
28410 Return 8-byte vectors in memory instead of MMX registers. This is
28411 the default on VxWorks to match the ABI of the Sun Studio compilers
28412 until version 12. Only use this option if you need to remain
28413 compatible with existing code produced by those previous compiler
28414 versions or older versions of GCC.
28415
28416 -mpc32
28417 -mpc64
28418 -mpc80
28419 Set 80387 floating-point precision to 32, 64 or 80 bits. When
28420 -mpc32 is specified, the significands of results of floating-point
28421 operations are rounded to 24 bits (single precision); -mpc64 rounds
28422 the significands of results of floating-point operations to 53 bits
28423 (double precision) and -mpc80 rounds the significands of results of
28424 floating-point operations to 64 bits (extended double precision),
28425 which is the default. When this option is used, floating-point
28426 operations in higher precisions are not available to the programmer
28427 without setting the FPU control word explicitly.
28428
28429 Setting the rounding of floating-point operations to less than the
28430 default 80 bits can speed some programs by 2% or more. Note that
28431 some mathematical libraries assume that extended-precision (80-bit)
28432 floating-point operations are enabled by default; routines in such
28433 libraries could suffer significant loss of accuracy, typically
28434 through so-called "catastrophic cancellation", when this option is
28435 used to set the precision to less than extended precision.
28436
28437 -mdaz-ftz
28438 The flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the
28439 MXCSR register are used to control floating-point calculations.SSE
28440 and AVX instructions including scalar and vector instructions could
28441 benefit from enabling the FTZ and DAZ flags when -mdaz-ftz is
28442 specified. Don't set FTZ/DAZ flags when -mno-daz-ftz or -shared is
28443 specified, -mdaz-ftz will set FTZ/DAZ flags even with -shared.
28444
28445 -mstackrealign
28446 Realign the stack at entry. On the x86, the -mstackrealign option
28447 generates an alternate prologue and epilogue that realigns the run-
28448 time stack if necessary. This supports mixing legacy codes that
28449 keep 4-byte stack alignment with modern codes that keep 16-byte
28450 stack alignment for SSE compatibility. See also the attribute
28451 "force_align_arg_pointer", applicable to individual functions.
28452
28453 -mpreferred-stack-boundary=num
28454 Attempt to keep the stack boundary aligned to a 2 raised to num
28455 byte boundary. If -mpreferred-stack-boundary is not specified, the
28456 default is 4 (16 bytes or 128 bits).
28457
28458 Warning: When generating code for the x86-64 architecture with SSE
28459 extensions disabled, -mpreferred-stack-boundary=3 can be used to
28460 keep the stack boundary aligned to 8 byte boundary. Since x86-64
28461 ABI require 16 byte stack alignment, this is ABI incompatible and
28462 intended to be used in controlled environment where stack space is
28463 important limitation. This option leads to wrong code when
28464 functions compiled with 16 byte stack alignment (such as functions
28465 from a standard library) are called with misaligned stack. In this
28466 case, SSE instructions may lead to misaligned memory access traps.
28467 In addition, variable arguments are handled incorrectly for 16 byte
28468 aligned objects (including x87 long double and __int128), leading
28469 to wrong results. You must build all modules with
28470 -mpreferred-stack-boundary=3, including any libraries. This
28471 includes the system libraries and startup modules.
28472
28473 -mincoming-stack-boundary=num
28474 Assume the incoming stack is aligned to a 2 raised to num byte
28475 boundary. If -mincoming-stack-boundary is not specified, the one
28476 specified by -mpreferred-stack-boundary is used.
28477
28478 On Pentium and Pentium Pro, "double" and "long double" values
28479 should be aligned to an 8-byte boundary (see -malign-double) or
28480 suffer significant run time performance penalties. On Pentium III,
28481 the Streaming SIMD Extension (SSE) data type "__m128" may not work
28482 properly if it is not 16-byte aligned.
28483
28484 To ensure proper alignment of this values on the stack, the stack
28485 boundary must be as aligned as that required by any value stored on
28486 the stack. Further, every function must be generated such that it
28487 keeps the stack aligned. Thus calling a function compiled with a
28488 higher preferred stack boundary from a function compiled with a
28489 lower preferred stack boundary most likely misaligns the stack. It
28490 is recommended that libraries that use callbacks always use the
28491 default setting.
28492
28493 This extra alignment does consume extra stack space, and generally
28494 increases code size. Code that is sensitive to stack space usage,
28495 such as embedded systems and operating system kernels, may want to
28496 reduce the preferred alignment to -mpreferred-stack-boundary=2.
28497
28498 -mmmx
28499 -msse
28500 -msse2
28501 -msse3
28502 -mssse3
28503 -msse4
28504 -msse4a
28505 -msse4.1
28506 -msse4.2
28507 -mavx
28508 -mavx2
28509 -mavx512f
28510 -mavx512pf
28511 -mavx512er
28512 -mavx512cd
28513 -mavx512vl
28514 -mavx512bw
28515 -mavx512dq
28516 -mavx512ifma
28517 -mavx512vbmi
28518 -msha
28519 -maes
28520 -mpclmul
28521 -mclflushopt
28522 -mclwb
28523 -mfsgsbase
28524 -mptwrite
28525 -mrdrnd
28526 -mf16c
28527 -mfma
28528 -mpconfig
28529 -mwbnoinvd
28530 -mfma4
28531 -mprfchw
28532 -mrdpid
28533 -mprefetchwt1
28534 -mrdseed
28535 -msgx
28536 -mxop
28537 -mlwp
28538 -m3dnow
28539 -m3dnowa
28540 -mpopcnt
28541 -mabm
28542 -madx
28543 -mbmi
28544 -mbmi2
28545 -mlzcnt
28546 -mfxsr
28547 -mxsave
28548 -mxsaveopt
28549 -mxsavec
28550 -mxsaves
28551 -mrtm
28552 -mhle
28553 -mtbm
28554 -mmwaitx
28555 -mclzero
28556 -mpku
28557 -mavx512vbmi2
28558 -mavx512bf16
28559 -mavx512fp16
28560 -mgfni
28561 -mvaes
28562 -mwaitpkg
28563 -mvpclmulqdq
28564 -mavx512bitalg
28565 -mmovdiri
28566 -mmovdir64b
28567 -menqcmd
28568 -muintr
28569 -mtsxldtrk
28570 -mavx512vpopcntdq
28571 -mavx512vp2intersect
28572 -mavx5124fmaps
28573 -mavx512vnni
28574 -mavxvnni
28575 -mavx5124vnniw
28576 -mcldemote
28577 -mserialize
28578 -mamx-tile
28579 -mamx-int8
28580 -mamx-bf16
28581 -mhreset
28582 -mkl
28583 -mwidekl
28584 -mavxifma
28585 -mavxvnniint8
28586 -mavxneconvert
28587 -mcmpccxadd
28588 -mamx-fp16
28589 -mprefetchi
28590 -mraoint
28591 -mamx-complex
28592 These switches enable the use of instructions in the MMX, SSE,
28593 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
28594 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
28595 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
28596 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
28597 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
28598 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28599 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
28600 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
28601 MOVDIRI, MOVDIR64B, AVX512BF16, ENQCMD, AVX512VPOPCNTDQ,
28602 AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE, UINTR, HRESET,
28603 AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512-FP16,
28604 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AMX-FP16, PREFETCHI,
28605 RAOINT, AMX-COMPLEX or CLDEMOTE extended instruction sets. Each has
28606 a corresponding -mno- option to disable use of these instructions.
28607
28608 These extensions are also available as built-in functions: see x86
28609 Built-in Functions, for details of the functions enabled and
28610 disabled by these switches.
28611
28612 To generate SSE/SSE2 instructions automatically from floating-point
28613 code (as opposed to 387 instructions), see -mfpmath=sse.
28614
28615 GCC depresses SSEx instructions when -mavx is used. Instead, it
28616 generates new AVX instructions or AVX equivalence for all SSEx
28617 instructions when needed.
28618
28619 These options enable GCC to use these extended instructions in
28620 generated code, even without -mfpmath=sse. Applications that
28621 perform run-time CPU detection must compile separate files for each
28622 supported architecture, using the appropriate flags. In
28623 particular, the file containing the CPU detection code should be
28624 compiled without these options.
28625
28626 -mdump-tune-features
28627 This option instructs GCC to dump the names of the x86 performance
28628 tuning features and default settings. The names can be used in
28629 -mtune-ctrl=feature-list.
28630
28631 -mtune-ctrl=feature-list
28632 This option is used to do fine grain control of x86 code generation
28633 features. feature-list is a comma separated list of feature names.
28634 See also -mdump-tune-features. When specified, the feature is
28635 turned on if it is not preceded with ^, otherwise, it is turned
28636 off. -mtune-ctrl=feature-list is intended to be used by GCC
28637 developers. Using it may lead to code paths not covered by testing
28638 and can potentially result in compiler ICEs or runtime errors.
28639
28640 -mno-default
28641 This option instructs GCC to turn off all tunable features. See
28642 also -mtune-ctrl=feature-list and -mdump-tune-features.
28643
28644 -mcld
28645 This option instructs GCC to emit a "cld" instruction in the
28646 prologue of functions that use string instructions. String
28647 instructions depend on the DF flag to select between autoincrement
28648 or autodecrement mode. While the ABI specifies the DF flag to be
28649 cleared on function entry, some operating systems violate this
28650 specification by not clearing the DF flag in their exception
28651 dispatchers. The exception handler can be invoked with the DF flag
28652 set, which leads to wrong direction mode when string instructions
28653 are used. This option can be enabled by default on 32-bit x86
28654 targets by configuring GCC with the --enable-cld configure option.
28655 Generation of "cld" instructions can be suppressed with the
28656 -mno-cld compiler option in this case.
28657
28658 -mvzeroupper
28659 This option instructs GCC to emit a "vzeroupper" instruction before
28660 a transfer of control flow out of the function to minimize the AVX
28661 to SSE transition penalty as well as remove unnecessary "zeroupper"
28662 intrinsics.
28663
28664 -mprefer-avx128
28665 This option instructs GCC to use 128-bit AVX instructions instead
28666 of 256-bit AVX instructions in the auto-vectorizer.
28667
28668 -mprefer-vector-width=opt
28669 This option instructs GCC to use opt-bit vector width in
28670 instructions instead of default on the selected platform.
28671
28672 -mmove-max=bits
28673 This option instructs GCC to set the maximum number of bits can be
28674 moved from memory to memory efficiently to bits. The valid bits
28675 are 128, 256 and 512.
28676
28677 -mstore-max=bits
28678 This option instructs GCC to set the maximum number of bits can be
28679 stored to memory efficiently to bits. The valid bits are 128, 256
28680 and 512.
28681
28682 none
28683 No extra limitations applied to GCC other than defined by the
28684 selected platform.
28685
28686 128 Prefer 128-bit vector width for instructions.
28687
28688 256 Prefer 256-bit vector width for instructions.
28689
28690 512 Prefer 512-bit vector width for instructions.
28691
28692 -mcx16
28693 This option enables GCC to generate "CMPXCHG16B" instructions in
28694 64-bit code to implement compare-and-exchange operations on 16-byte
28695 aligned 128-bit objects. This is useful for atomic updates of data
28696 structures exceeding one machine word in size. The compiler uses
28697 this instruction to implement __sync Builtins. However, for
28698 __atomic Builtins operating on 128-bit integers, a library call is
28699 always used.
28700
28701 -msahf
28702 This option enables generation of "SAHF" instructions in 64-bit
28703 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
28704 the introduction of Pentium 4 G1 step in December 2005, lacked the
28705 "LAHF" and "SAHF" instructions which are supported by AMD64. These
28706 are load and store instructions, respectively, for certain status
28707 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
28708 "fmod", "drem", and "remainder" built-in functions; see Other
28709 Builtins for details.
28710
28711 -mmovbe
28712 This option enables use of the "movbe" instruction to implement
28713 "__builtin_bswap32" and "__builtin_bswap64".
28714
28715 -mshstk
28716 The -mshstk option enables shadow stack built-in functions from x86
28717 Control-flow Enforcement Technology (CET).
28718
28719 -mcrc32
28720 This option enables built-in functions "__builtin_ia32_crc32qi",
28721 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
28722 "__builtin_ia32_crc32di" to generate the "crc32" machine
28723 instruction.
28724
28725 -mmwait
28726 This option enables built-in functions "__builtin_ia32_monitor",
28727 and "__builtin_ia32_mwait" to generate the "monitor" and "mwait"
28728 machine instructions.
28729
28730 -mrecip
28731 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
28732 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
28733 Newton-Raphson step to increase precision instead of "DIVSS" and
28734 "SQRTSS" (and their vectorized variants) for single-precision
28735 floating-point arguments. These instructions are generated only
28736 when -funsafe-math-optimizations is enabled together with
28737 -ffinite-math-only and -fno-trapping-math. Note that while the
28738 throughput of the sequence is higher than the throughput of the
28739 non-reciprocal instruction, the precision of the sequence can be
28740 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
28741 0.99999994).
28742
28743 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
28744 "RSQRTPS") already with -ffast-math (or the above option
28745 combination), and doesn't need -mrecip.
28746
28747 Also note that GCC emits the above sequence with additional Newton-
28748 Raphson step for vectorized single-float division and vectorized
28749 sqrtf(x) already with -ffast-math (or the above option
28750 combination), and doesn't need -mrecip.
28751
28752 -mrecip=opt
28753 This option controls which reciprocal estimate instructions may be
28754 used. opt is a comma-separated list of options, which may be
28755 preceded by a ! to invert the option:
28756
28757 all Enable all estimate instructions.
28758
28759 default
28760 Enable the default instructions, equivalent to -mrecip.
28761
28762 none
28763 Disable all estimate instructions, equivalent to -mno-recip.
28764
28765 div Enable the approximation for scalar division.
28766
28767 vec-div
28768 Enable the approximation for vectorized division.
28769
28770 sqrt
28771 Enable the approximation for scalar square root.
28772
28773 vec-sqrt
28774 Enable the approximation for vectorized square root.
28775
28776 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
28777 approximations, except for square root.
28778
28779 -mveclibabi=type
28780 Specifies the ABI type to use for vectorizing intrinsics using an
28781 external library. Supported values for type are svml for the Intel
28782 short vector math library and acml for the AMD math core library.
28783 To use this option, both -ftree-vectorize and
28784 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
28785 ABI-compatible library must be specified at link time.
28786
28787 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
28788 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
28789 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
28790 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
28791 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
28792 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
28793 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
28794 and "vmlsAcos4" for corresponding function type when
28795 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
28796 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
28797 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
28798 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
28799 corresponding function type when -mveclibabi=acml is used.
28800
28801 -mabi=name
28802 Generate code for the specified calling convention. Permissible
28803 values are sysv for the ABI used on GNU/Linux and other systems,
28804 and ms for the Microsoft ABI. The default is to use the Microsoft
28805 ABI when targeting Microsoft Windows and the SysV ABI on all other
28806 systems. You can control this behavior for specific functions by
28807 using the function attributes "ms_abi" and "sysv_abi".
28808
28809 -mforce-indirect-call
28810 Force all calls to functions to be indirect. This is useful when
28811 using Intel Processor Trace where it generates more precise timing
28812 information for function calls.
28813
28814 -mmanual-endbr
28815 Insert ENDBR instruction at function entry only via the "cf_check"
28816 function attribute. This is useful when used with the option
28817 -fcf-protection=branch to control ENDBR insertion at the function
28818 entry.
28819
28820 -mcet-switch
28821 By default, CET instrumentation is turned off on switch statements
28822 that use a jump table and indirect branch track is disabled. Since
28823 jump tables are stored in read-only memory, this does not result in
28824 a direct loss of hardening. But if the jump table index is
28825 attacker-controlled, the indirect jump may not be constrained by
28826 CET. This option turns on CET instrumentation to enable indirect
28827 branch track for switch statements with jump tables which leads to
28828 the jump targets reachable via any indirect jumps.
28829
28830 -mcall-ms2sysv-xlogues
28831 Due to differences in 64-bit ABIs, any Microsoft ABI function that
28832 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
28833 clobbered. By default, the code for saving and restoring these
28834 registers is emitted inline, resulting in fairly lengthy prologues
28835 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
28836 epilogues that use stubs in the static portion of libgcc to perform
28837 these saves and restores, thus reducing function size at the cost
28838 of a few extra instructions.
28839
28840 -mtls-dialect=type
28841 Generate code to access thread-local storage using the gnu or gnu2
28842 conventions. gnu is the conservative default; gnu2 is more
28843 efficient, but it may add compile- and run-time requirements that
28844 cannot be satisfied on all systems.
28845
28846 -mpush-args
28847 -mno-push-args
28848 Use PUSH operations to store outgoing parameters. This method is
28849 shorter and usually equally fast as method using SUB/MOV operations
28850 and is enabled by default. In some cases disabling it may improve
28851 performance because of improved scheduling and reduced
28852 dependencies.
28853
28854 -maccumulate-outgoing-args
28855 If enabled, the maximum amount of space required for outgoing
28856 arguments is computed in the function prologue. This is faster on
28857 most modern CPUs because of reduced dependencies, improved
28858 scheduling and reduced stack usage when the preferred stack
28859 boundary is not equal to 2. The drawback is a notable increase in
28860 code size. This switch implies -mno-push-args.
28861
28862 -mthreads
28863 Support thread-safe exception handling on MinGW. Programs that
28864 rely on thread-safe exception handling must compile and link all
28865 code with the -mthreads option. When compiling, -mthreads defines
28866 -D_MT; when linking, it links in a special thread helper library
28867 -lmingwthrd which cleans up per-thread exception-handling data.
28868
28869 -mms-bitfields
28870 -mno-ms-bitfields
28871 Enable/disable bit-field layout compatible with the native
28872 Microsoft Windows compiler.
28873
28874 If "packed" is used on a structure, or if bit-fields are used, it
28875 may be that the Microsoft ABI lays out the structure differently
28876 than the way GCC normally does. Particularly when moving packed
28877 data between functions compiled with GCC and the native Microsoft
28878 compiler (either via function call or as data in a file), it may be
28879 necessary to access either format.
28880
28881 This option is enabled by default for Microsoft Windows targets.
28882 This behavior can also be controlled locally by use of variable or
28883 type attributes. For more information, see x86 Variable Attributes
28884 and x86 Type Attributes.
28885
28886 The Microsoft structure layout algorithm is fairly simple with the
28887 exception of the bit-field packing. The padding and alignment of
28888 members of structures and whether a bit-field can straddle a
28889 storage-unit boundary are determine by these rules:
28890
28891 1. Structure members are stored sequentially in the order in which
28892 they are
28893 declared: the first member has the lowest memory address and
28894 the last member the highest.
28895
28896 2. Every data object has an alignment requirement. The alignment
28897 requirement
28898 for all data except structures, unions, and arrays is either
28899 the size of the object or the current packing size (specified
28900 with either the "aligned" attribute or the "pack" pragma),
28901 whichever is less. For structures, unions, and arrays, the
28902 alignment requirement is the largest alignment requirement of
28903 its members. Every object is allocated an offset so that:
28904
28905 offset % alignment_requirement == 0
28906
28907 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
28908 allocation
28909 unit if the integral types are the same size and if the next
28910 bit-field fits into the current allocation unit without
28911 crossing the boundary imposed by the common alignment
28912 requirements of the bit-fields.
28913
28914 MSVC interprets zero-length bit-fields in the following ways:
28915
28916 1. If a zero-length bit-field is inserted between two bit-fields
28917 that
28918 are normally coalesced, the bit-fields are not coalesced.
28919
28920 For example:
28921
28922 struct
28923 {
28924 unsigned long bf_1 : 12;
28925 unsigned long : 0;
28926 unsigned long bf_2 : 12;
28927 } t1;
28928
28929 The size of "t1" is 8 bytes with the zero-length bit-field. If
28930 the zero-length bit-field were removed, "t1"'s size would be 4
28931 bytes.
28932
28933 2. If a zero-length bit-field is inserted after a bit-field, "foo",
28934 and the
28935 alignment of the zero-length bit-field is greater than the
28936 member that follows it, "bar", "bar" is aligned as the type of
28937 the zero-length bit-field.
28938
28939 For example:
28940
28941 struct
28942 {
28943 char foo : 4;
28944 short : 0;
28945 char bar;
28946 } t2;
28947
28948 struct
28949 {
28950 char foo : 4;
28951 short : 0;
28952 double bar;
28953 } t3;
28954
28955 For "t2", "bar" is placed at offset 2, rather than offset 1.
28956 Accordingly, the size of "t2" is 4. For "t3", the zero-length
28957 bit-field does not affect the alignment of "bar" or, as a
28958 result, the size of the structure.
28959
28960 Taking this into account, it is important to note the
28961 following:
28962
28963 1. If a zero-length bit-field follows a normal bit-field, the
28964 type of the
28965 zero-length bit-field may affect the alignment of the
28966 structure as whole. For example, "t2" has a size of 4
28967 bytes, since the zero-length bit-field follows a normal
28968 bit-field, and is of type short.
28969
28970 2. Even if a zero-length bit-field is not followed by a normal
28971 bit-field, it may
28972 still affect the alignment of the structure:
28973
28974 struct
28975 {
28976 char foo : 6;
28977 long : 0;
28978 } t4;
28979
28980 Here, "t4" takes up 4 bytes.
28981
28982 3. Zero-length bit-fields following non-bit-field members are
28983 ignored:
28984 struct
28985 {
28986 char foo;
28987 long : 0;
28988 char bar;
28989 } t5;
28990
28991 Here, "t5" takes up 2 bytes.
28992
28993 -mno-align-stringops
28994 Do not align the destination of inlined string operations. This
28995 switch reduces code size and improves performance in case the
28996 destination is already aligned, but GCC doesn't know about it.
28997
28998 -minline-all-stringops
28999 By default GCC inlines string operations only when the destination
29000 is known to be aligned to least a 4-byte boundary. This enables
29001 more inlining and increases code size, but may improve performance
29002 of code that depends on fast "memcpy" and "memset" for short
29003 lengths. The option enables inline expansion of "strlen" for all
29004 pointer alignments.
29005
29006 -minline-stringops-dynamically
29007 For string operations of unknown size, use run-time checks with
29008 inline code for small blocks and a library call for large blocks.
29009
29010 -mstringop-strategy=alg
29011 Override the internal decision heuristic for the particular
29012 algorithm to use for inlining string operations. The allowed
29013 values for alg are:
29014
29015 rep_byte
29016 rep_4byte
29017 rep_8byte
29018 Expand using i386 "rep" prefix of the specified size.
29019
29020 byte_loop
29021 loop
29022 unrolled_loop
29023 Expand into an inline loop.
29024
29025 libcall
29026 Always use a library call.
29027
29028 -mmemcpy-strategy=strategy
29029 Override the internal decision heuristic to decide if
29030 "__builtin_memcpy" should be inlined and what inline algorithm to
29031 use when the expected size of the copy operation is known. strategy
29032 is a comma-separated list of alg:max_size:dest_align triplets. alg
29033 is specified in -mstringop-strategy, max_size specifies the max
29034 byte size with which inline algorithm alg is allowed. For the last
29035 triplet, the max_size must be -1. The max_size of the triplets in
29036 the list must be specified in increasing order. The minimal byte
29037 size for alg is 0 for the first triplet and "max_size + 1" of the
29038 preceding range.
29039
29040 -mmemset-strategy=strategy
29041 The option is similar to -mmemcpy-strategy= except that it is to
29042 control "__builtin_memset" expansion.
29043
29044 -momit-leaf-frame-pointer
29045 Don't keep the frame pointer in a register for leaf functions.
29046 This avoids the instructions to save, set up, and restore frame
29047 pointers and makes an extra register available in leaf functions.
29048 The option -fomit-leaf-frame-pointer removes the frame pointer for
29049 leaf functions, which might make debugging harder.
29050
29051 -mtls-direct-seg-refs
29052 -mno-tls-direct-seg-refs
29053 Controls whether TLS variables may be accessed with offsets from
29054 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
29055 whether the thread base pointer must be added. Whether or not this
29056 is valid depends on the operating system, and whether it maps the
29057 segment to cover the entire TLS area.
29058
29059 For systems that use the GNU C Library, the default is on.
29060
29061 -msse2avx
29062 -mno-sse2avx
29063 Specify that the assembler should encode SSE instructions with VEX
29064 prefix. The option -mavx turns this on by default.
29065
29066 -mfentry
29067 -mno-fentry
29068 If profiling is active (-pg), put the profiling counter call before
29069 the prologue. Note: On x86 architectures the attribute
29070 "ms_hook_prologue" isn't possible at the moment for -mfentry and
29071 -pg.
29072
29073 -mrecord-mcount
29074 -mno-record-mcount
29075 If profiling is active (-pg), generate a __mcount_loc section that
29076 contains pointers to each profiling call. This is useful for
29077 automatically patching and out calls.
29078
29079 -mnop-mcount
29080 -mno-nop-mcount
29081 If profiling is active (-pg), generate the calls to the profiling
29082 functions as NOPs. This is useful when they should be patched in
29083 later dynamically. This is likely only useful together with
29084 -mrecord-mcount.
29085
29086 -minstrument-return=type
29087 Instrument function exit in -pg -mfentry instrumented functions
29088 with call to specified function. This only instruments true returns
29089 ending with ret, but not sibling calls ending with jump. Valid
29090 types are none to not instrument, call to generate a call to
29091 __return__, or nop5 to generate a 5 byte nop.
29092
29093 -mrecord-return
29094 -mno-record-return
29095 Generate a __return_loc section pointing to all return
29096 instrumentation code.
29097
29098 -mfentry-name=name
29099 Set name of __fentry__ symbol called at function entry for -pg
29100 -mfentry functions.
29101
29102 -mfentry-section=name
29103 Set name of section to record -mrecord-mcount calls (default
29104 __mcount_loc).
29105
29106 -mskip-rax-setup
29107 -mno-skip-rax-setup
29108 When generating code for the x86-64 architecture with SSE
29109 extensions disabled, -mskip-rax-setup can be used to skip setting
29110 up RAX register when there are no variable arguments passed in
29111 vector registers.
29112
29113 Warning: Since RAX register is used to avoid unnecessarily saving
29114 vector registers on stack when passing variable arguments, the
29115 impacts of this option are callees may waste some stack space,
29116 misbehave or jump to a random location. GCC 4.4 or newer don't
29117 have those issues, regardless the RAX register value.
29118
29119 -m8bit-idiv
29120 -mno-8bit-idiv
29121 On some processors, like Intel Atom, 8-bit unsigned integer divide
29122 is much faster than 32-bit/64-bit integer divide. This option
29123 generates a run-time check. If both dividend and divisor are
29124 within range of 0 to 255, 8-bit unsigned integer divide is used
29125 instead of 32-bit/64-bit integer divide.
29126
29127 -mavx256-split-unaligned-load
29128 -mavx256-split-unaligned-store
29129 Split 32-byte AVX unaligned load and store.
29130
29131 -mstack-protector-guard=guard
29132 -mstack-protector-guard-reg=reg
29133 -mstack-protector-guard-offset=offset
29134 Generate stack protection code using canary at guard. Supported
29135 locations are global for global canary or tls for per-thread canary
29136 in the TLS block (the default). This option has effect only when
29137 -fstack-protector or -fstack-protector-all is specified.
29138
29139 With the latter choice the options -mstack-protector-guard-reg=reg
29140 and -mstack-protector-guard-offset=offset furthermore specify which
29141 segment register (%fs or %gs) to use as base register for reading
29142 the canary, and from what offset from that base register. The
29143 default for those is as specified in the relevant ABI.
29144
29145 -mgeneral-regs-only
29146 Generate code that uses only the general-purpose registers. This
29147 prevents the compiler from using floating-point, vector, mask and
29148 bound registers.
29149
29150 -mrelax-cmpxchg-loop
29151 When emitting a compare-and-swap loop for __sync Builtins and
29152 __atomic Builtins lacking a native instruction, optimize for the
29153 highly contended case by issuing an atomic load before the
29154 "CMPXCHG" instruction, and using the "PAUSE" instruction to save
29155 CPU power when restarting the loop.
29156
29157 -mindirect-branch=choice
29158 Convert indirect call and jump with choice. The default is keep,
29159 which keeps indirect call and jump unmodified. thunk converts
29160 indirect call and jump to call and return thunk. thunk-inline
29161 converts indirect call and jump to inlined call and return thunk.
29162 thunk-extern converts indirect call and jump to external call and
29163 return thunk provided in a separate object file. You can control
29164 this behavior for a specific function by using the function
29165 attribute "indirect_branch".
29166
29167 Note that -mcmodel=large is incompatible with
29168 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
29169 the thunk function may not be reachable in the large code model.
29170
29171 Note that -mindirect-branch=thunk-extern is compatible with
29172 -fcf-protection=branch since the external thunk can be made to
29173 enable control-flow check.
29174
29175 -mfunction-return=choice
29176 Convert function return with choice. The default is keep, which
29177 keeps function return unmodified. thunk converts function return
29178 to call and return thunk. thunk-inline converts function return to
29179 inlined call and return thunk. thunk-extern converts function
29180 return to external call and return thunk provided in a separate
29181 object file. You can control this behavior for a specific function
29182 by using the function attribute "function_return".
29183
29184 Note that -mindirect-return=thunk-extern is compatible with
29185 -fcf-protection=branch since the external thunk can be made to
29186 enable control-flow check.
29187
29188 Note that -mcmodel=large is incompatible with
29189 -mfunction-return=thunk and -mfunction-return=thunk-extern since
29190 the thunk function may not be reachable in the large code model.
29191
29192 -mindirect-branch-register
29193 Force indirect call and jump via register.
29194
29195 -mharden-sls=choice
29196 Generate code to mitigate against straight line speculation (SLS)
29197 with choice. The default is none which disables all SLS hardening.
29198 return enables SLS hardening for function returns. indirect-jmp
29199 enables SLS hardening for indirect jumps. all enables all SLS
29200 hardening.
29201
29202 -mindirect-branch-cs-prefix
29203 Add CS prefix to call and jmp to indirect thunk with branch target
29204 in r8-r15 registers so that the call and jmp instruction length is
29205 6 bytes to allow them to be replaced with lfence; call *%r8-r15 or
29206 lfence; jmp *%r8-r15 at run-time.
29207
29208 These -m switches are supported in addition to the above on x86-64
29209 processors in 64-bit environments.
29210
29211 -m32
29212 -m64
29213 -mx32
29214 -m16
29215 -miamcu
29216 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
29217 option sets "int", "long", and pointer types to 32 bits, and
29218 generates code that runs in 32-bit mode.
29219
29220 The -m64 option sets "int" to 32 bits and "long" and pointer types
29221 to 64 bits, and generates code for the x86-64 architecture. For
29222 Darwin only the -m64 option also turns off the -fno-pic and
29223 -mdynamic-no-pic options.
29224
29225 The -mx32 option sets "int", "long", and pointer types to 32 bits,
29226 and generates code for the x86-64 architecture.
29227
29228 The -m16 option is the same as -m32, except for that it outputs the
29229 ".code16gcc" assembly directive at the beginning of the assembly
29230 output so that the binary can run in 16-bit mode.
29231
29232 The -miamcu option generates code which conforms to Intel MCU
29233 psABI. It requires the -m32 option to be turned on.
29234
29235 -mno-red-zone
29236 Do not use a so-called "red zone" for x86-64 code. The red zone is
29237 mandated by the x86-64 ABI; it is a 128-byte area beyond the
29238 location of the stack pointer that is not modified by signal or
29239 interrupt handlers and therefore can be used for temporary data
29240 without adjusting the stack pointer. The flag -mno-red-zone
29241 disables this red zone.
29242
29243 -mcmodel=small
29244 Generate code for the small code model: the program and its symbols
29245 must be linked in the lower 2 GB of the address space. Pointers
29246 are 64 bits. Programs can be statically or dynamically linked.
29247 This is the default code model.
29248
29249 -mcmodel=kernel
29250 Generate code for the kernel code model. The kernel runs in the
29251 negative 2 GB of the address space. This model has to be used for
29252 Linux kernel code.
29253
29254 -mcmodel=medium
29255 Generate code for the medium model: the program is linked in the
29256 lower 2 GB of the address space. Small symbols are also placed
29257 there. Symbols with sizes larger than -mlarge-data-threshold are
29258 put into large data or BSS sections and can be located above 2GB.
29259 Programs can be statically or dynamically linked.
29260
29261 -mcmodel=large
29262 Generate code for the large model. This model makes no assumptions
29263 about addresses and sizes of sections.
29264
29265 -maddress-mode=long
29266 Generate code for long address mode. This is only supported for
29267 64-bit and x32 environments. It is the default address mode for
29268 64-bit environments.
29269
29270 -maddress-mode=short
29271 Generate code for short address mode. This is only supported for
29272 32-bit and x32 environments. It is the default address mode for
29273 32-bit and x32 environments.
29274
29275 -mneeded
29276 -mno-needed
29277 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
29278 indicate the micro-architecture ISA level required to execute the
29279 binary.
29280
29281 -mno-direct-extern-access
29282 Without -fpic nor -fPIC, always use the GOT pointer to access
29283 external symbols. With -fpic or -fPIC, treat access to protected
29284 symbols as local symbols. The default is -mdirect-extern-access.
29285
29286 Warning: shared libraries compiled with -mno-direct-extern-access
29287 and executable compiled with -mdirect-extern-access may not be
29288 binary compatible if protected symbols are used in shared libraries
29289 and executable.
29290
29291 -munroll-only-small-loops
29292 Controls conservative small loop unrolling. It is default enabled
29293 by O2, and unrolls loop with less than 4 insns by 1 time. Explicit
29294 -f[no-]unroll-[all-]loops would disable this flag to avoid any
29295 unintended unrolling behavior that user does not want.
29296
29297 -mlam=choice
29298 LAM(linear-address masking) allows special bits in the pointer to
29299 be used for metadata. The default is none. With u48, pointer bits
29300 in positions 62:48 can be used for metadata; With u57, pointer bits
29301 in positions 62:57 can be used for metadata.
29302
29303 x86 Windows Options
29304
29305 These additional options are available for Microsoft Windows targets:
29306
29307 -mconsole
29308 This option specifies that a console application is to be
29309 generated, by instructing the linker to set the PE header subsystem
29310 type required for console applications. This option is available
29311 for Cygwin and MinGW targets and is enabled by default on those
29312 targets.
29313
29314 -mdll
29315 This option is available for Cygwin and MinGW targets. It
29316 specifies that a DLL---a dynamic link library---is to be generated,
29317 enabling the selection of the required runtime startup object and
29318 entry point.
29319
29320 -mnop-fun-dllimport
29321 This option is available for Cygwin and MinGW targets. It
29322 specifies that the "dllimport" attribute should be ignored.
29323
29324 -mthreads
29325 This option is available for MinGW targets. It specifies that
29326 MinGW-specific thread support is to be used.
29327
29328 -municode
29329 This option is available for MinGW-w64 targets. It causes the
29330 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
29331 capable runtime startup code.
29332
29333 -mwin32
29334 This option is available for Cygwin and MinGW targets. It
29335 specifies that the typical Microsoft Windows predefined macros are
29336 to be set in the pre-processor, but does not influence the choice
29337 of runtime library/startup code.
29338
29339 -mwindows
29340 This option is available for Cygwin and MinGW targets. It
29341 specifies that a GUI application is to be generated by instructing
29342 the linker to set the PE header subsystem type appropriately.
29343
29344 -fno-set-stack-executable
29345 This option is available for MinGW targets. It specifies that the
29346 executable flag for the stack used by nested functions isn't set.
29347 This is necessary for binaries running in kernel mode of Microsoft
29348 Windows, as there the User32 API, which is used to set executable
29349 privileges, isn't available.
29350
29351 -fwritable-relocated-rdata
29352 This option is available for MinGW and Cygwin targets. It
29353 specifies that relocated-data in read-only section is put into the
29354 ".data" section. This is a necessary for older runtimes not
29355 supporting modification of ".rdata" sections for pseudo-relocation.
29356
29357 -mpe-aligned-commons
29358 This option is available for Cygwin and MinGW targets. It
29359 specifies that the GNU extension to the PE file format that permits
29360 the correct alignment of COMMON variables should be used when
29361 generating code. It is enabled by default if GCC detects that the
29362 target assembler found during configuration supports the feature.
29363
29364 See also under x86 Options for standard options.
29365
29366 Xstormy16 Options
29367
29368 These options are defined for Xstormy16:
29369
29370 -msim
29371 Choose startup files and linker script suitable for the simulator.
29372
29373 Xtensa Options
29374
29375 These options are supported for Xtensa targets:
29376
29377 -mconst16
29378 -mno-const16
29379 Enable or disable use of "CONST16" instructions for loading
29380 constant values. The "CONST16" instruction is currently not a
29381 standard option from Tensilica. When enabled, "CONST16"
29382 instructions are always used in place of the standard "L32R"
29383 instructions. The use of "CONST16" is enabled by default only if
29384 the "L32R" instruction is not available.
29385
29386 -mfused-madd
29387 -mno-fused-madd
29388 Enable or disable use of fused multiply/add and multiply/subtract
29389 instructions in the floating-point option. This has no effect if
29390 the floating-point option is not also enabled. Disabling fused
29391 multiply/add and multiply/subtract instructions forces the compiler
29392 to use separate instructions for the multiply and add/subtract
29393 operations. This may be desirable in some cases where strict IEEE
29394 754-compliant results are required: the fused multiply add/subtract
29395 instructions do not round the intermediate result, thereby
29396 producing results with more bits of precision than specified by the
29397 IEEE standard. Disabling fused multiply add/subtract instructions
29398 also ensures that the program output is not sensitive to the
29399 compiler's ability to combine multiply and add/subtract operations.
29400
29401 -mserialize-volatile
29402 -mno-serialize-volatile
29403 When this option is enabled, GCC inserts "MEMW" instructions before
29404 "volatile" memory references to guarantee sequential consistency.
29405 The default is -mserialize-volatile. Use -mno-serialize-volatile
29406 to omit the "MEMW" instructions.
29407
29408 -mforce-no-pic
29409 For targets, like GNU/Linux, where all user-mode Xtensa code must
29410 be position-independent code (PIC), this option disables PIC for
29411 compiling kernel code.
29412
29413 -mtext-section-literals
29414 -mno-text-section-literals
29415 These options control the treatment of literal pools. The default
29416 is -mno-text-section-literals, which places literals in a separate
29417 section in the output file. This allows the literal pool to be
29418 placed in a data RAM/ROM, and it also allows the linker to combine
29419 literal pools from separate object files to remove redundant
29420 literals and improve code size. With -mtext-section-literals, the
29421 literals are interspersed in the text section in order to keep them
29422 as close as possible to their references. This may be necessary
29423 for large assembly files. Literals for each function are placed
29424 right before that function.
29425
29426 -mauto-litpools
29427 -mno-auto-litpools
29428 These options control the treatment of literal pools. The default
29429 is -mno-auto-litpools, which places literals in a separate section
29430 in the output file unless -mtext-section-literals is used. With
29431 -mauto-litpools the literals are interspersed in the text section
29432 by the assembler. Compiler does not produce explicit ".literal"
29433 directives and loads literals into registers with "MOVI"
29434 instructions instead of "L32R" to let the assembler do relaxation
29435 and place literals as necessary. This option allows assembler to
29436 create several literal pools per function and assemble very big
29437 functions, which may not be possible with -mtext-section-literals.
29438
29439 -mtarget-align
29440 -mno-target-align
29441 When this option is enabled, GCC instructs the assembler to
29442 automatically align instructions to reduce branch penalties at the
29443 expense of some code density. The assembler attempts to widen
29444 density instructions to align branch targets and the instructions
29445 following call instructions. If there are not enough preceding
29446 safe density instructions to align a target, no widening is
29447 performed. The default is -mtarget-align. These options do not
29448 affect the treatment of auto-aligned instructions like "LOOP",
29449 which the assembler always aligns, either by widening density
29450 instructions or by inserting NOP instructions.
29451
29452 -mlongcalls
29453 -mno-longcalls
29454 When this option is enabled, GCC instructs the assembler to
29455 translate direct calls to indirect calls unless it can determine
29456 that the target of a direct call is in the range allowed by the
29457 call instruction. This translation typically occurs for calls to
29458 functions in other source files. Specifically, the assembler
29459 translates a direct "CALL" instruction into an "L32R" followed by a
29460 "CALLX" instruction. The default is -mno-longcalls. This option
29461 should be used in programs where the call target can potentially be
29462 out of range. This option is implemented in the assembler, not the
29463 compiler, so the assembly code generated by GCC still shows direct
29464 call instructions---look at the disassembled object code to see the
29465 actual instructions. Note that the assembler uses an indirect call
29466 for every cross-file call, not just those that really are out of
29467 range.
29468
29469 -mabi=name
29470 Generate code for the specified ABI. Permissible values are:
29471 call0, windowed. Default ABI is chosen by the Xtensa core
29472 configuration.
29473
29474 -mabi=call0
29475 When this option is enabled function parameters are passed in
29476 registers "a2" through "a7", registers "a12" through "a15" are
29477 caller-saved, and register "a15" may be used as a frame pointer.
29478 When this version of the ABI is enabled the C preprocessor symbol
29479 "__XTENSA_CALL0_ABI__" is defined.
29480
29481 -mabi=windowed
29482 When this option is enabled function parameters are passed in
29483 registers "a10" through "a15", and called function rotates register
29484 window by 8 registers on entry so that its arguments are found in
29485 registers "a2" through "a7". Register "a7" may be used as a frame
29486 pointer. Register window is rotated 8 registers back upon return.
29487 When this version of the ABI is enabled the C preprocessor symbol
29488 "__XTENSA_WINDOWED_ABI__" is defined.
29489
29490 -mextra-l32r-costs=n
29491 Specify an extra cost of instruction RAM/ROM access for "L32R"
29492 instructions, in clock cycles. This affects, when optimizing for
29493 speed, whether loading a constant from literal pool using "L32R" or
29494 synthesizing the constant from a small one with a couple of
29495 arithmetic instructions. The default value is 0.
29496
29497 zSeries Options
29498
29499 These are listed under
29500
29502 This section describes several environment variables that affect how
29503 GCC operates. Some of them work by specifying directories or prefixes
29504 to use when searching for various kinds of files. Some are used to
29505 specify other aspects of the compilation environment.
29506
29507 Note that you can also specify places to search using options such as
29508 -B, -I and -L. These take precedence over places specified using
29509 environment variables, which in turn take precedence over those
29510 specified by the configuration of GCC.
29511
29512 LANG
29513 LC_CTYPE
29514 LC_MESSAGES
29515 LC_ALL
29516 These environment variables control the way that GCC uses
29517 localization information which allows GCC to work with different
29518 national conventions. GCC inspects the locale categories LC_CTYPE
29519 and LC_MESSAGES if it has been configured to do so. These locale
29520 categories can be set to any value supported by your installation.
29521 A typical value is en_GB.UTF-8 for English in the United Kingdom
29522 encoded in UTF-8.
29523
29524 The LC_CTYPE environment variable specifies character
29525 classification. GCC uses it to determine the character boundaries
29526 in a string; this is needed for some multibyte encodings that
29527 contain quote and escape characters that are otherwise interpreted
29528 as a string end or escape.
29529
29530 The LC_MESSAGES environment variable specifies the language to use
29531 in diagnostic messages.
29532
29533 If the LC_ALL environment variable is set, it overrides the value
29534 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
29535 default to the value of the LANG environment variable. If none of
29536 these variables are set, GCC defaults to traditional C English
29537 behavior.
29538
29539 TMPDIR
29540 If TMPDIR is set, it specifies the directory to use for temporary
29541 files. GCC uses temporary files to hold the output of one stage of
29542 compilation which is to be used as input to the next stage: for
29543 example, the output of the preprocessor, which is the input to the
29544 compiler proper.
29545
29546 GCC_COMPARE_DEBUG
29547 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
29548 -fcompare-debug to the compiler driver. See the documentation of
29549 this option for more details.
29550
29551 GCC_EXEC_PREFIX
29552 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
29553 names of the subprograms executed by the compiler. No slash is
29554 added when this prefix is combined with the name of a subprogram,
29555 but you can specify a prefix that ends with a slash if you wish.
29556
29557 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
29558 appropriate prefix to use based on the pathname it is invoked with.
29559
29560 If GCC cannot find the subprogram using the specified prefix, it
29561 tries looking in the usual places for the subprogram.
29562
29563 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
29564 prefix is the prefix to the installed compiler. In many cases
29565 prefix is the value of "prefix" when you ran the configure script.
29566
29567 Other prefixes specified with -B take precedence over this prefix.
29568
29569 This prefix is also used for finding files such as crt0.o that are
29570 used for linking.
29571
29572 In addition, the prefix is used in an unusual way in finding the
29573 directories to search for header files. For each of the standard
29574 directories whose name normally begins with /usr/local/lib/gcc
29575 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
29576 replacing that beginning with the specified prefix to produce an
29577 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
29578 just before it searches the standard directory /usr/local/lib/bar.
29579 If a standard directory begins with the configured prefix then the
29580 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
29581 header files.
29582
29583 COMPILER_PATH
29584 The value of COMPILER_PATH is a colon-separated list of
29585 directories, much like PATH. GCC tries the directories thus
29586 specified when searching for subprograms, if it cannot find the
29587 subprograms using GCC_EXEC_PREFIX.
29588
29589 LIBRARY_PATH
29590 The value of LIBRARY_PATH is a colon-separated list of directories,
29591 much like PATH. When configured as a native compiler, GCC tries
29592 the directories thus specified when searching for special linker
29593 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
29594 GCC also uses these directories when searching for ordinary
29595 libraries for the -l option (but directories specified with -L come
29596 first).
29597
29598 LANG
29599 This variable is used to pass locale information to the compiler.
29600 One way in which this information is used is to determine the
29601 character set to be used when character literals, string literals
29602 and comments are parsed in C and C++. When the compiler is
29603 configured to allow multibyte characters, the following values for
29604 LANG are recognized:
29605
29606 C-JIS
29607 Recognize JIS characters.
29608
29609 C-SJIS
29610 Recognize SJIS characters.
29611
29612 C-EUCJP
29613 Recognize EUCJP characters.
29614
29615 If LANG is not defined, or if it has some other value, then the
29616 compiler uses "mblen" and "mbtowc" as defined by the default locale
29617 to recognize and translate multibyte characters.
29618
29619 GCC_EXTRA_DIAGNOSTIC_OUTPUT
29620 If GCC_EXTRA_DIAGNOSTIC_OUTPUT is set to one of the following
29621 values, then additional text will be emitted to stderr when fix-it
29622 hints are emitted. -fdiagnostics-parseable-fixits and
29623 -fno-diagnostics-parseable-fixits take precedence over this
29624 environment variable.
29625
29626 fixits-v1
29627 Emit parseable fix-it hints, equivalent to
29628 -fdiagnostics-parseable-fixits. In particular, columns are
29629 expressed as a count of bytes, starting at byte 1 for the
29630 initial column.
29631
29632 fixits-v2
29633 As "fixits-v1", but columns are expressed as display columns,
29634 as per -fdiagnostics-column-unit=display.
29635
29636 Some additional environment variables affect the behavior of the
29637 preprocessor.
29638
29639 CPATH
29640 C_INCLUDE_PATH
29641 CPLUS_INCLUDE_PATH
29642 OBJC_INCLUDE_PATH
29643 Each variable's value is a list of directories separated by a
29644 special character, much like PATH, in which to look for header
29645 files. The special character, "PATH_SEPARATOR", is target-
29646 dependent and determined at GCC build time. For Microsoft Windows-
29647 based targets it is a semicolon, and for almost all other targets
29648 it is a colon.
29649
29650 CPATH specifies a list of directories to be searched as if
29651 specified with -I, but after any paths given with -I options on the
29652 command line. This environment variable is used regardless of
29653 which language is being preprocessed.
29654
29655 The remaining environment variables apply only when preprocessing
29656 the particular language indicated. Each specifies a list of
29657 directories to be searched as if specified with -isystem, but after
29658 any paths given with -isystem options on the command line.
29659
29660 In all these variables, an empty element instructs the compiler to
29661 search its current working directory. Empty elements can appear at
29662 the beginning or end of a path. For instance, if the value of
29663 CPATH is ":/special/include", that has the same effect as
29664 -I. -I/special/include.
29665
29666 DEPENDENCIES_OUTPUT
29667 If this variable is set, its value specifies how to output
29668 dependencies for Make based on the non-system header files
29669 processed by the compiler. System header files are ignored in the
29670 dependency output.
29671
29672 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
29673 case the Make rules are written to that file, guessing the target
29674 name from the source file name. Or the value can have the form
29675 file target, in which case the rules are written to file file using
29676 target as the target name.
29677
29678 In other words, this environment variable is equivalent to
29679 combining the options -MM and -MF, with an optional -MT switch too.
29680
29681 SUNPRO_DEPENDENCIES
29682 This variable is the same as DEPENDENCIES_OUTPUT (see above),
29683 except that system header files are not ignored, so it implies -M
29684 rather than -MM. However, the dependence on the main input file is
29685 omitted.
29686
29687 SOURCE_DATE_EPOCH
29688 If this variable is set, its value specifies a UNIX timestamp to be
29689 used in replacement of the current date and time in the "__DATE__"
29690 and "__TIME__" macros, so that the embedded timestamps become
29691 reproducible.
29692
29693 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
29694 the number of seconds (excluding leap seconds) since 01 Jan 1970
29695 00:00:00 represented in ASCII; identical to the output of "date
29696 +%s" on GNU/Linux and other systems that support the %s extension
29697 in the "date" command.
29698
29699 The value should be a known timestamp such as the last modification
29700 time of the source or package and it should be set by the build
29701 process.
29702
29704 For instructions on reporting bugs, see <https://bugzilla.redhat.com/>.
29705
29707 1. On some systems, gcc -shared needs to build supplementary stub code
29708 for constructors to work. On multi-libbed systems, gcc -shared
29709 must select the correct support libraries to link against. Failing
29710 to supply the correct flags may lead to subtle defects. Supplying
29711 them in cases where they are not necessary is innocuous. -shared
29712 suppresses the addition of startup code to alter the floating-point
29713 environment as done with -ffast-math, -Ofast or
29714 -funsafe-math-optimizations on some targets.
29715
29717 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1)
29718 and the Info entries for gcc, cpp, as, ld, binutils and gdb.
29719
29721 See the Info entry for gcc, or
29722 <https://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for
29723 contributors to GCC.
29724
29726 Copyright (c) 1988-2023 Free Software Foundation, Inc.
29727
29728 Permission is granted to copy, distribute and/or modify this document
29729 under the terms of the GNU Free Documentation License, Version 1.3 or
29730 any later version published by the Free Software Foundation; with the
29731 Invariant Sections being "GNU General Public License" and "Funding Free
29732 Software", the Front-Cover texts being (a) (see below), and with the
29733 Back-Cover Texts being (b) (see below). A copy of the license is
29734 included in the gfdl(7) man page.
29735
29736 (a) The FSF's Front-Cover Text is:
29737
29738 A GNU Manual
29739
29740 (b) The FSF's Back-Cover Text is:
29741
29742 You have freedom to copy and modify this GNU Manual, like GNU
29743 software. Copies published by the Free Software Foundation raise
29744 funds for GNU development.
29745
29746
29747
29748gcc-13.2.0 2023-07-27 GCC(1)