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 -fplugin=file
84 -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
89 -fallow-parameterless-variadic-functions -fno-asm -fno-builtin
90 -fno-builtin-function -fcond-mismatch -ffreestanding -fgimple
91 -fgnu-tm -fgnu89-inline -fhosted -flax-vector-conversions
92 -fms-extensions -foffload=arg -foffload-options=arg -fopenacc
93 -fopenacc-dim=geom -fopenmp -fopenmp-simd
94 -fpermitted-flt-eval-methods=standard -fplan9-extensions
95 -fsigned-bitfields -funsigned-bitfields -fsigned-char
96 -funsigned-char -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
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-imported-macros
127 -Wno-invalid-offsetof -Wno-literal-suffix -Wmismatched-new-delete
128 -Wmismatched-tags -Wmultiple-inheritance -Wnamespaces -Wnarrowing
129 -Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor -Wpessimizing-move
130 -Wno-placement-new -Wplacement-new=n -Wrange-loop-construct
131 -Wredundant-move -Wredundant-tags -Wreorder -Wregister
132 -Wstrict-null-sentinel -Wno-subobject-linkage -Wtemplates
133 -Wno-non-template-friend -Wold-style-cast -Woverloaded-virtual
134 -Wno-pmf-conversions -Wsign-promo -Wsized-deallocation
135 -Wsuggest-final-methods -Wsuggest-final-types -Wsuggest-override
136 -Wno-terminate -Wuseless-cast -Wno-vexing-parse
137 -Wvirtual-inheritance -Wno-virtual-move-assign -Wvolatile
138 -Wzero-as-null-pointer-constant
139
140 Objective-C and Objective-C++ Language Options
141 -fconstant-string-class=class-name -fgnu-runtime -fnext-runtime
142 -fno-nil-receivers -fobjc-abi-version=n -fobjc-call-cxx-cdtors
143 -fobjc-direct-dispatch -fobjc-exceptions -fobjc-gc -fobjc-nilcheck
144 -fobjc-std=objc1 -fno-local-ivars
145 -fivar-visibility=[public|protected|private|package]
146 -freplace-objc-classes -fzero-link -gen-decls -Wassign-intercept
147 -Wno-property-assign-default -Wno-protocol -Wobjc-root-class
148 -Wselector -Wstrict-selector-match -Wundeclared-selector
149
150 Diagnostic Message Formatting Options
151 -fmessage-length=n -fdiagnostics-plain-output
152 -fdiagnostics-show-location=[once|every-line]
153 -fdiagnostics-color=[auto|never|always]
154 -fdiagnostics-urls=[auto|never|always]
155 -fdiagnostics-format=[text|json] -fno-diagnostics-show-option
156 -fno-diagnostics-show-caret -fno-diagnostics-show-labels
157 -fno-diagnostics-show-line-numbers -fno-diagnostics-show-cwe
158 -fdiagnostics-minimum-margin-width=width
159 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch
160 -fdiagnostics-show-template-tree -fno-elide-type
161 -fdiagnostics-path-format=[none|separate-events|inline-events]
162 -fdiagnostics-show-path-depths -fno-show-column
163 -fdiagnostics-column-unit=[display|byte]
164 -fdiagnostics-column-origin=origin
165 -fdiagnostics-escape-format=[unicode|bytes]
166
167 Warning Options
168 -fsyntax-only -fmax-errors=n -Wpedantic -pedantic-errors -w
169 -Wextra -Wall -Wabi=n -Waddress -Wno-address-of-packed-member
170 -Waggregate-return -Walloc-size-larger-than=byte-size -Walloc-zero
171 -Walloca -Walloca-larger-than=byte-size
172 -Wno-aggressive-loop-optimizations -Warith-conversion
173 -Warray-bounds -Warray-bounds=n -Warray-compare -Wno-attributes
174 -Wattribute-alias=n -Wno-attribute-alias -Wno-attribute-warning
175 -Wbidi-chars=[none|unpaired|any|ucn] -Wbool-compare
176 -Wbool-operation -Wno-builtin-declaration-mismatch
177 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat
178 -Wc11-c2x-compat -Wc++-compat -Wc++11-compat -Wc++14-compat
179 -Wc++17-compat -Wc++20-compat -Wno-c++11-extensions
180 -Wno-c++14-extensions -Wno-c++17-extensions -Wno-c++20-extensions
181 -Wno-c++23-extensions -Wcast-align -Wcast-align=strict
182 -Wcast-function-type -Wcast-qual -Wchar-subscripts -Wclobbered
183 -Wcomment -Wconversion -Wno-coverage-mismatch -Wno-cpp
184 -Wdangling-else -Wdangling-pointer -Wdangling-pointer=n
185 -Wdate-time -Wno-deprecated -Wno-deprecated-declarations
186 -Wno-designated-init -Wdisabled-optimization
187 -Wno-discarded-array-qualifiers -Wno-discarded-qualifiers
188 -Wno-div-by-zero -Wdouble-promotion -Wduplicated-branches
189 -Wduplicated-cond -Wempty-body -Wno-endif-labels -Wenum-compare
190 -Wenum-conversion -Werror -Werror=* -Wexpansion-to-defined
191 -Wfatal-errors -Wfloat-conversion -Wfloat-equal -Wformat
192 -Wformat=2 -Wno-format-contains-nul -Wno-format-extra-args
193 -Wformat-nonliteral -Wformat-overflow=n -Wformat-security
194 -Wformat-signedness -Wformat-truncation=n -Wformat-y2k
195 -Wframe-address -Wframe-larger-than=byte-size
196 -Wno-free-nonheap-object -Wno-if-not-aligned
197 -Wno-ignored-attributes -Wignored-qualifiers
198 -Wno-incompatible-pointer-types -Wimplicit -Wimplicit-fallthrough
199 -Wimplicit-fallthrough=n -Wno-implicit-function-declaration
200 -Wno-implicit-int -Winfinite-recursion -Winit-self -Winline
201 -Wno-int-conversion -Wint-in-bool-context -Wno-int-to-pointer-cast
202 -Wno-invalid-memory-model -Winvalid-pch -Wjump-misses-init
203 -Wlarger-than=byte-size -Wlogical-not-parentheses -Wlogical-op
204 -Wlong-long -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized
205 -Wmemset-elt-size -Wmemset-transposed-args
206 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces
207 -Wmissing-field-initializers -Wmissing-format-attribute
208 -Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile
209 -Wno-multichar -Wmultistatement-macros -Wnonnull
210 -Wnonnull-compare -Wnormalized=[none|id|nfc|nfkc]
211 -Wnull-dereference -Wno-odr -Wopenacc-parallelism -Wopenmp-simd
212 -Wno-overflow -Woverlength-strings
213 -Wno-override-init-side-effects -Wpacked
214 -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
215 -Wparentheses -Wno-pedantic-ms-format -Wpointer-arith
216 -Wno-pointer-compare -Wno-pointer-to-int-cast -Wno-pragmas
217 -Wno-prio-ctor-dtor -Wredundant-decls -Wrestrict
218 -Wno-return-local-addr -Wreturn-type -Wno-scalar-storage-order
219 -Wsequence-point -Wshadow -Wshadow=global -Wshadow=local
220 -Wshadow=compatible-local -Wno-shadow-ivar
221 -Wno-shift-count-negative -Wno-shift-count-overflow
222 -Wshift-negative-value -Wno-shift-overflow -Wshift-overflow=n
223 -Wsign-compare -Wsign-conversion -Wno-sizeof-array-argument
224 -Wsizeof-array-div -Wsizeof-pointer-div -Wsizeof-pointer-memaccess
225 -Wstack-protector -Wstack-usage=byte-size -Wstrict-aliasing
226 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=n
227 -Wstring-compare -Wno-stringop-overflow -Wno-stringop-overread
228 -Wno-stringop-truncation
229 -Wsuggest-attribute=[pure|const|noreturn|format|malloc] -Wswitch
230 -Wno-switch-bool -Wswitch-default -Wswitch-enum
231 -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand
232 -Wsystem-headers -Wtautological-compare -Wtrampolines
233 -Wtrigraphs -Wtrivial-auto-var-init -Wtsan -Wtype-limits -Wundef
234 -Wuninitialized -Wunknown-pragmas -Wunsuffixed-float-constants
235 -Wunused -Wunused-but-set-parameter -Wunused-but-set-variable
236 -Wunused-const-variable -Wunused-const-variable=n
237 -Wunused-function -Wunused-label -Wunused-local-typedefs
238 -Wunused-macros -Wunused-parameter -Wno-unused-result
239 -Wunused-value -Wunused-variable -Wno-varargs -Wvariadic-macros
240 -Wvector-operation-performance -Wvla -Wvla-larger-than=byte-size
241 -Wno-vla-larger-than -Wvolatile-register-var -Wwrite-strings
242 -Wzero-length-bounds
243
244 Static Analyzer Options
245 -fanalyzer -fanalyzer-call-summaries -fanalyzer-checker=name
246 -fno-analyzer-feasibility -fanalyzer-fine-grained
247 -fno-analyzer-state-merge -fno-analyzer-state-purge
248 -fanalyzer-transitivity -fanalyzer-verbose-edges
249 -fanalyzer-verbose-state-changes -fanalyzer-verbosity=level
250 -fdump-analyzer -fdump-analyzer-callgraph
251 -fdump-analyzer-exploded-graph -fdump-analyzer-exploded-nodes
252 -fdump-analyzer-exploded-nodes-2 -fdump-analyzer-exploded-nodes-3
253 -fdump-analyzer-exploded-paths -fdump-analyzer-feasibility
254 -fdump-analyzer-json -fdump-analyzer-state-purge
255 -fdump-analyzer-stderr -fdump-analyzer-supergraph
256 -fdump-analyzer-untracked -Wno-analyzer-double-fclose
257 -Wno-analyzer-double-free
258 -Wno-analyzer-exposure-through-output-file -Wno-analyzer-file-leak
259 -Wno-analyzer-free-of-non-heap -Wno-analyzer-malloc-leak
260 -Wno-analyzer-mismatching-deallocation -Wno-analyzer-null-argument
261 -Wno-analyzer-null-dereference -Wno-analyzer-possible-null-argument
262 -Wno-analyzer-possible-null-dereference
263 -Wno-analyzer-shift-count-negative
264 -Wno-analyzer-shift-count-overflow
265 -Wno-analyzer-stale-setjmp-buffer
266 -Wno-analyzer-tainted-allocation-size
267 -Wno-analyzer-tainted-array-index -Wno-analyzer-tainted-divisor
268 -Wno-analyzer-tainted-offset -Wno-analyzer-tainted-size
269 -Wanalyzer-too-complex
270 -Wno-analyzer-unsafe-call-within-signal-handler
271 -Wno-analyzer-use-after-free
272 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
273 -Wno-analyzer-use-of-uninitialized-value
274 -Wno-analyzer-write-to-const -Wno-analyzer-write-to-string-literal
275
276 C and Objective-C-only Warning Options
277 -Wbad-function-cast -Wmissing-declarations
278 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs
279 -Wold-style-declaration -Wold-style-definition -Wstrict-prototypes
280 -Wtraditional -Wtraditional-conversion
281 -Wdeclaration-after-statement -Wpointer-sign
282
283 Debugging Options
284 -g -glevel -gdwarf -gdwarf-version -gbtf -gctf -gctflevel -ggdb
285 -grecord-gcc-switches -gno-record-gcc-switches -gstabs -gstabs+
286 -gstrict-dwarf -gno-strict-dwarf -gas-loc-support
287 -gno-as-loc-support -gas-locview-support -gno-as-locview-support
288 -gcolumn-info -gno-column-info -gdwarf32 -gdwarf64
289 -gstatement-frontiers -gno-statement-frontiers
290 -gvariable-location-views -gno-variable-location-views
291 -ginternal-reset-location-views -gno-internal-reset-location-views
292 -ginline-points -gno-inline-points -gvms -gxcoff -gxcoff+
293 -gz[=type] -gsplit-dwarf -gdescribe-dies -gno-describe-dies
294 -fdebug-prefix-map=old=new -fdebug-types-section
295 -fno-eliminate-unused-debug-types -femit-struct-debug-baseonly
296 -femit-struct-debug-reduced -femit-struct-debug-detailed[=spec-
297 list] -fno-eliminate-unused-debug-symbols
298 -femit-class-debug-always -fno-merge-debug-strings
299 -fno-dwarf2-cfi-asm -fvar-tracking -fvar-tracking-assignments
300
301 Optimization Options
302 -faggressive-loop-optimizations -falign-functions[=n[:m:[n2[:m2]]]]
303 -falign-jumps[=n[:m:[n2[:m2]]]] -falign-labels[=n[:m:[n2[:m2]]]]
304 -falign-loops[=n[:m:[n2[:m2]]]] -fno-allocation-dce
305 -fallow-store-data-races -fassociative-math -fauto-profile
306 -fauto-profile[=path] -fauto-inc-dec -fbranch-probabilities
307 -fcaller-saves -fcombine-stack-adjustments -fconserve-stack
308 -fcompare-elim -fcprop-registers -fcrossjumping
309 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules
310 -fcx-limited-range -fdata-sections -fdce -fdelayed-branch
311 -fdelete-null-pointer-checks -fdevirtualize
312 -fdevirtualize-speculatively -fdevirtualize-at-ltrans -fdse
313 -fearly-inlining -fipa-sra -fexpensive-optimizations
314 -ffat-lto-objects -ffast-math -ffinite-math-only -ffloat-store
315 -fexcess-precision=style -ffinite-loops -fforward-propagate
316 -ffp-contract=style -ffunction-sections -fgcse
317 -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity
318 -fgcse-sm -fhoist-adjacent-loads -fif-conversion -fif-conversion2
319 -findirect-inlining -finline-functions
320 -finline-functions-called-once -finline-limit=n
321 -finline-small-functions -fipa-modref -fipa-cp -fipa-cp-clone
322 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const
323 -fipa-reference -fipa-reference-addressable -fipa-stack-alignment
324 -fipa-icf -fira-algorithm=algorithm -flive-patching=level
325 -fira-region=region -fira-hoist-pressure -fira-loop-pressure
326 -fno-ira-share-save-slots -fno-ira-share-spill-slots
327 -fisolate-erroneous-paths-dereference
328 -fisolate-erroneous-paths-attribute -fivopts
329 -fkeep-inline-functions -fkeep-static-functions
330 -fkeep-static-consts -flimit-function-alignment
331 -flive-range-shrinkage -floop-block -floop-interchange
332 -floop-strip-mine -floop-unroll-and-jam -floop-nest-optimize
333 -floop-parallelize-all -flra-remat -flto -flto-compression-level
334 -flto-partition=alg -fmerge-all-constants -fmerge-constants
335 -fmodulo-sched -fmodulo-sched-allow-regmoves
336 -fmove-loop-invariants -fmove-loop-stores -fno-branch-count-reg
337 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse
338 -fno-guess-branch-probability -fno-inline -fno-math-errno
339 -fno-peephole -fno-peephole2 -fno-printf-return-value
340 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros
341 -fno-toplevel-reorder -fno-trapping-math
342 -fno-zero-initialized-in-bss -fomit-frame-pointer
343 -foptimize-sibling-calls -fpartial-inlining -fpeel-loops
344 -fpredictive-commoning -fprefetch-loop-arrays -fprofile-correction
345 -fprofile-use -fprofile-use=path -fprofile-partial-training
346 -fprofile-values -fprofile-reorder-functions -freciprocal-math
347 -free -frename-registers -freorder-blocks
348 -freorder-blocks-algorithm=algorithm -freorder-blocks-and-partition
349 -freorder-functions -frerun-cse-after-loop
350 -freschedule-modulo-scheduled-loops -frounding-math
351 -fsave-optimization-record -fsched2-use-superblocks
352 -fsched-pressure -fsched-spec-load -fsched-spec-load-dangerous
353 -fsched-stalled-insns-dep[=n] -fsched-stalled-insns[=n]
354 -fsched-group-heuristic -fsched-critical-path-heuristic
355 -fsched-spec-insn-heuristic -fsched-rank-heuristic
356 -fsched-last-insn-heuristic -fsched-dep-count-heuristic
357 -fschedule-fusion -fschedule-insns -fschedule-insns2
358 -fsection-anchors -fselective-scheduling -fselective-scheduling2
359 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops
360 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate
361 -fsignaling-nans -fsingle-precision-constant
362 -fsplit-ivs-in-unroller -fsplit-loops -fsplit-paths
363 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop
364 -fssa-phiopt -fstdarg-opt -fstore-merging -fstrict-aliasing
365 -fipa-strict-aliasing -fthread-jumps -ftracer -ftree-bit-ccp
366 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-coalesce-vars
367 -ftree-copy-prop -ftree-dce -ftree-dominator-opts -ftree-dse
368 -ftree-forwprop -ftree-fre -fcode-hoisting -ftree-loop-if-convert
369 -ftree-loop-im -ftree-phiprop -ftree-loop-distribution
370 -ftree-loop-distribute-patterns -ftree-loop-ivcanon
371 -ftree-loop-linear -ftree-loop-optimize -ftree-loop-vectorize
372 -ftree-parallelize-loops=n -ftree-pre -ftree-partial-pre
373 -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-sink
374 -ftree-slsr -ftree-sra -ftree-switch-conversion -ftree-tail-merge
375 -ftree-ter -ftree-vectorize -ftree-vrp -ftrivial-auto-var-init
376 -funconstrained-commons -funit-at-a-time -funroll-all-loops
377 -funroll-loops -funsafe-math-optimizations -funswitch-loops
378 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model
379 -fvpt -fweb -fwhole-program -fwpa -fuse-linker-plugin
380 -fzero-call-used-regs --param name=value -O -O0 -O1 -O2 -O3
381 -Os -Ofast -Og -Oz
382
383 Program Instrumentation Options
384 -p -pg -fprofile-arcs --coverage -ftest-coverage
385 -fprofile-abs-path -fprofile-dir=path -fprofile-generate
386 -fprofile-generate=path -fprofile-info-section
387 -fprofile-info-section=name -fprofile-note=path
388 -fprofile-prefix-path=path -fprofile-update=method
389 -fprofile-filter-files=regex -fprofile-exclude-files=regex
390 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
391 -fsanitize=style -fsanitize-recover -fsanitize-recover=style
392 -fasan-shadow-offset=number -fsanitize-sections=s1,s2,...
393 -fsanitize-undefined-trap-on-error -fbounds-check
394 -fcf-protection=[full|branch|return|none|check] -fharden-compares
395 -fharden-conditional-branches -fstack-protector
396 -fstack-protector-all -fstack-protector-strong
397 -fstack-protector-explicit -fstack-check
398 -fstack-limit-register=reg -fstack-limit-symbol=sym
399 -fno-stack-limit -fsplit-stack -fvtable-verify=[std|preinit|none]
400 -fvtv-counts -fvtv-debug -finstrument-functions
401 -finstrument-functions-exclude-function-list=sym,sym,...
402 -finstrument-functions-exclude-file-list=file,file,...
403 -fprofile-prefix-map=old=new
404
405 Preprocessor Options
406 -Aquestion=answer -A-question[=answer] -C -CC -Dmacro[=defn] -dD
407 -dI -dM -dN -dU -fdebug-cpp -fdirectives-only
408 -fdollars-in-identifiers -fexec-charset=charset
409 -fextended-identifiers -finput-charset=charset
410 -flarge-source-files -fmacro-prefix-map=old=new
411 -fmax-include-depth=depth -fno-canonical-system-headers -fpch-deps
412 -fpch-preprocess -fpreprocessed -ftabstop=width
413 -ftrack-macro-expansion -fwide-exec-charset=charset
414 -fworking-directory -H -imacros file -include file -M -MD -MF
415 -MG -MM -MMD -MP -MQ -MT -Mno-modules -no-integrated-cpp -P
416 -pthread -remap -traditional -traditional-cpp -trigraphs -Umacro
417 -undef -Wp,option -Xpreprocessor option
418
419 Assembler Options
420 -Wa,option -Xassembler option
421
422 Linker Options
423 object-file-name -fuse-ld=linker -llibrary -nostartfiles
424 -nodefaultlibs -nolibc -nostdlib -e entry --entry=entry -pie
425 -pthread -r -rdynamic -s -static -static-pie -static-libgcc
426 -static-libstdc++ -static-libasan -static-libtsan -static-liblsan
427 -static-libubsan -shared -shared-libgcc -symbolic -T script
428 -Wl,option -Xlinker option -u symbol -z keyword
429
430 Directory Options
431 -Bprefix -Idir -I- -idirafter dir -imacros file -imultilib dir
432 -iplugindir=dir -iprefix file -iquote dir -isysroot dir -isystem
433 dir -iwithprefix dir -iwithprefixbefore dir -Ldir
434 -no-canonical-prefixes --no-sysroot-suffix -nostdinc -nostdinc++
435 --sysroot=dir
436
437 Code Generation Options
438 -fcall-saved-reg -fcall-used-reg -ffixed-reg -fexceptions
439 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables
440 -fasynchronous-unwind-tables -fno-gnu-unique
441 -finhibit-size-directive -fcommon -fno-ident -fpcc-struct-return
442 -fpic -fPIC -fpie -fPIE -fno-plt -fno-jump-tables
443 -fno-bit-tests -frecord-gcc-switches -freg-struct-return
444 -fshort-enums -fshort-wchar -fverbose-asm -fpack-struct[=n]
445 -fleading-underscore -ftls-model=model -fstack-reuse=reuse_level
446 -ftrampolines -ftrapv -fwrapv
447 -fvisibility=[default|internal|hidden|protected]
448 -fstrict-volatile-bitfields -fsync-libcalls
449
450 Developer Options
451 -dletters -dumpspecs -dumpmachine -dumpversion -dumpfullversion
452 -fcallgraph-info[=su,da] -fchecking -fchecking=n -fdbg-cnt-list
453 -fdbg-cnt=counter-value-list -fdisable-ipa-pass_name
454 -fdisable-rtl-pass_name -fdisable-rtl-pass-name=range-list
455 -fdisable-tree-pass_name -fdisable-tree-pass-name=range-list
456 -fdump-debug -fdump-earlydebug -fdump-noaddr -fdump-unnumbered
457 -fdump-unnumbered-links -fdump-final-insns[=file] -fdump-ipa-all
458 -fdump-ipa-cgraph -fdump-ipa-inline -fdump-lang-all
459 -fdump-lang-switch -fdump-lang-switch-options
460 -fdump-lang-switch-options=filename -fdump-passes -fdump-rtl-pass
461 -fdump-rtl-pass=filename -fdump-statistics -fdump-tree-all
462 -fdump-tree-switch -fdump-tree-switch-options
463 -fdump-tree-switch-options=filename -fcompare-debug[=opts]
464 -fcompare-debug-second -fenable-kind-pass -fenable-kind-pass=range-
465 list -fira-verbose=n -flto-report -flto-report-wpa
466 -fmem-report-wpa -fmem-report -fpre-ipa-mem-report
467 -fpost-ipa-mem-report -fopt-info -fopt-info-options[=file]
468 -fprofile-report -frandom-seed=string -fsched-verbose=n
469 -fsel-sched-verbose -fsel-sched-dump-cfg
470 -fsel-sched-pipelining-verbose -fstats -fstack-usage
471 -ftime-report -ftime-report-details
472 -fvar-tracking-assignments-toggle -gtoggle
473 -print-file-name=library -print-libgcc-file-name
474 -print-multi-directory -print-multi-lib -print-multi-os-directory
475 -print-prog-name=program -print-search-dirs -Q -print-sysroot
476 -print-sysroot-headers-suffix -save-temps -save-temps=cwd
477 -save-temps=obj -time[=file]
478
479 Machine-Dependent Options
480 AArch64 Options -mabi=name -mbig-endian -mlittle-endian
481 -mgeneral-regs-only -mcmodel=tiny -mcmodel=small -mcmodel=large
482 -mstrict-align -mno-strict-align -momit-leaf-frame-pointer
483 -mtls-dialect=desc -mtls-dialect=traditional -mtls-size=size
484 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419
485 -mlow-precision-recip-sqrt -mlow-precision-sqrt
486 -mlow-precision-div -mpc-relative-literal-loads
487 -msign-return-address=scope -mbranch-protection=none|standard|pac-
488 ret[+leaf +b-key]|bti -mharden-sls=opts -march=name -mcpu=name
489 -mtune=name -moverride=string -mverbose-cost-dump
490 -mstack-protector-guard=guard -mstack-protector-guard-reg=sysreg
491 -mstack-protector-guard-offset=offset -mtrack-speculation
492 -moutline-atomics
493
494 Adapteva Epiphany Options -mhalf-reg-file -mprefer-short-insn-regs
495 -mbranch-cost=num -mcmove -mnops=num -msoft-cmpsf -msplit-lohi
496 -mpost-inc -mpost-modify -mstack-offset=num -mround-nearest
497 -mlong-calls -mshort-calls -msmall16 -mfp-mode=mode
498 -mvect-double -max-vect-align=num -msplit-vecmove-early
499 -m1reg-reg
500
501 AMD GCN Options -march=gpu -mtune=gpu -mstack-size=bytes
502
503 ARC Options -mbarrel-shifter -mjli-always -mcpu=cpu -mA6
504 -mARC600 -mA7 -mARC700 -mdpfp -mdpfp-compact -mdpfp-fast
505 -mno-dpfp-lrsr -mea -mno-mpy -mmul32x16 -mmul64 -matomic -mnorm
506 -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap
507 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc
508 -mswape -mtelephony -mxy -misize -mannotate-align -marclinux
509 -marclinux_prof -mlong-calls -mmedium-calls -msdata
510 -mirq-ctrl-saved -mrgf-banked-regs -mlpc-width=width -G num
511 -mvolatile-cache -mtp-regno=regno -malign-call -mauto-modify-reg
512 -mbbit-peephole -mno-brcc -mcase-vector-pcrel -mcompact-casesi
513 -mno-cond-exec -mearly-cbranchsi -mexpand-adddi -mindexed-loads
514 -mlra -mlra-priority-none -mlra-priority-compact
515 -mlra-priority-noncompact -mmillicode -mmixed-code -mq-class
516 -mRcq -mRcw -msize-level=level -mtune=cpu -mmultcost=num
517 -mcode-density-frame -munalign-prob-threshold=probability
518 -mmpy-option=multo -mdiv-rem -mcode-density -mll64 -mfpu=fpu
519 -mrf16 -mbranch-index
520
521 ARM Options -mapcs-frame -mno-apcs-frame -mabi=name
522 -mapcs-stack-check -mno-apcs-stack-check -mapcs-reentrant
523 -mno-apcs-reentrant -mgeneral-regs-only -msched-prolog
524 -mno-sched-prolog -mlittle-endian -mbig-endian -mbe8 -mbe32
525 -mfloat-abi=name -mfp16-format=name -mthumb-interwork
526 -mno-thumb-interwork -mcpu=name -march=name -mfpu=name
527 -mtune=name -mprint-tune-info -mstructure-size-boundary=n
528 -mabort-on-noreturn -mlong-calls -mno-long-calls -msingle-pic-base
529 -mno-single-pic-base -mpic-register=reg -mnop-fun-dllimport
530 -mpoke-function-name -mthumb -marm -mflip-thumb -mtpcs-frame
531 -mtpcs-leaf-frame -mcaller-super-interworking
532 -mcallee-super-interworking -mtp=name -mtls-dialect=dialect
533 -mword-relocations -mfix-cortex-m3-ldrd
534 -mfix-cortex-a57-aes-1742098 -mfix-cortex-a72-aes-1655431
535 -munaligned-access -mneon-for-64bits -mslow-flash-data
536 -masm-syntax-unified -mrestrict-it -mverbose-cost-dump -mpure-code
537 -mcmse -mfix-cmse-cve-2021-35465 -mstack-protector-guard=guard
538 -mstack-protector-guard-offset=offset -mfdpic
539
540 AVR Options -mmcu=mcu -mabsdata -maccumulate-args
541 -mbranch-cost=cost -mcall-prologues -mgas-isr-prologues -mint8
542 -mdouble=bits -mlong-double=bits -mn_flash=size -mno-interrupts
543 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack
544 -mfract-convert-truncate -mshort-calls -nodevicelib
545 -nodevicespecs -Waddr-space-convert -Wmisspelled-isr
546
547 Blackfin Options -mcpu=cpu[-sirevision] -msim
548 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer
549 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly
550 -mno-csync-anomaly -mlow-64k -mno-low64k -mstack-check-l1
551 -mid-shared-library -mno-id-shared-library -mshared-library-id=n
552 -mleaf-id-shared-library -mno-leaf-id-shared-library -msep-data
553 -mno-sep-data -mlong-calls -mno-long-calls -mfast-fp
554 -minline-plt -mmulticore -mcorea -mcoreb -msdram -micplb
555
556 C6X Options -mbig-endian -mlittle-endian -march=cpu -msim
557 -msdata=sdata-type
558
559 CRIS Options -mcpu=cpu -march=cpu -mtune=cpu -mmax-stack-frame=n
560 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects
561 -mstack-align -mdata-align -mconst-align -m32-bit -m16-bit
562 -m8-bit -mno-prologue-epilogue -melf -maout -sim -sim2
563 -mmul-bug-workaround -mno-mul-bug-workaround
564
565 CR16 Options -mmac -mcr16cplus -mcr16c -msim -mint32 -mbit-ops
566 -mdata-model=model
567
568 C-SKY Options -march=arch -mcpu=cpu -mbig-endian -EB
569 -mlittle-endian -EL -mhard-float -msoft-float -mfpu=fpu
570 -mdouble-float -mfdivdu -mfloat-abi=name -melrw -mistack -mmp
571 -mcp -mcache -msecurity -mtrust -mdsp -medsp -mvdsp -mdiv
572 -msmart -mhigh-registers -manchor -mpushpop -mmultiple-stld
573 -mconstpool -mstack-size -mccrt -mbranch-cost=n -mcse-cc
574 -msched-prolog -msim
575
576 Darwin Options -all_load -allowable_client -arch
577 -arch_errors_fatal -arch_only -bind_at_load -bundle
578 -bundle_loader -client_name -compatibility_version
579 -current_version -dead_strip -dependency-file -dylib_file
580 -dylinker_install_name -dynamic -dynamiclib
581 -exported_symbols_list -filelist -flat_namespace
582 -force_cpusubtype_ALL -force_flat_namespace
583 -headerpad_max_install_names -iframework -image_base -init
584 -install_name -keep_private_externs -multi_module
585 -multiply_defined -multiply_defined_unused -noall_load
586 -no_dead_strip_inits_and_terms -nofixprebinding -nomultidefs
587 -noprebind -noseglinkedit -pagezero_size -prebind
588 -prebind_all_twolevel_modules -private_bundle -read_only_relocs
589 -sectalign -sectobjectsymbols -whyload -seg1addr -sectcreate
590 -sectobjectsymbols -sectorder -segaddr -segs_read_only_addr
591 -segs_read_write_addr -seg_addr_table -seg_addr_table_filename
592 -seglinkedit -segprot -segs_read_only_addr -segs_read_write_addr
593 -single_module -static -sub_library -sub_umbrella
594 -twolevel_namespace -umbrella -undefined -unexported_symbols_list
595 -weak_reference_mismatches -whatsloaded -F -gused -gfull
596 -mmacosx-version-min=version -mkernel -mone-byte-bool
597
598 DEC Alpha Options -mno-fp-regs -msoft-float -mieee
599 -mieee-with-inexact -mieee-conformant -mfp-trap-mode=mode
600 -mfp-rounding-mode=mode -mtrap-precision=mode -mbuild-constants
601 -mcpu=cpu-type -mtune=cpu-type -mbwx -mmax -mfix -mcix
602 -mfloat-vax -mfloat-ieee -mexplicit-relocs -msmall-data
603 -mlarge-data -msmall-text -mlarge-text -mmemory-latency=time
604
605 eBPF Options -mbig-endian -mlittle-endian -mkernel=version
606 -mframe-limit=bytes -mxbpf -mco-re -mno-co-re -mjmpext -mjmp32
607 -malu32 -mcpu=version
608
609 FR30 Options -msmall-model -mno-lsim
610
611 FT32 Options -msim -mlra -mnodiv -mft32b -mcompress -mnopm
612
613 FRV Options -mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 -mhard-float
614 -msoft-float -malloc-cc -mfixed-cc -mdword -mno-dword -mdouble
615 -mno-double -mmedia -mno-media -mmuladd -mno-muladd -mfdpic
616 -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp
617 -mlong-calls -malign-labels -mlibrary-pic -macc-4 -macc-8 -mpack
618 -mno-pack -mno-eflags -mcond-move -mno-cond-move
619 -moptimize-membar -mno-optimize-membar -mscc -mno-scc
620 -mcond-exec -mno-cond-exec -mvliw-branch -mno-vliw-branch
621 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec
622 -mno-nested-cond-exec -mtomcat-stats -mTLS -mtls -mcpu=cpu
623
624 GNU/Linux Options -mglibc -muclibc -mmusl -mbionic -mandroid
625 -tno-android-cc -tno-android-ld
626
627 H8/300 Options -mrelax -mh -ms -mn -mexr -mno-exr -mint32
628 -malign-300
629
630 HPPA Options -march=architecture-type -mcaller-copies
631 -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls -mgas
632 -mgnu-ld -mhp-ld -mfixed-range=register-range -mjump-in-delay
633 -mlinker-opt -mlong-calls -mlong-load-store -mno-disable-fpregs
634 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas
635 -mno-jump-in-delay -mno-long-load-store -mno-portable-runtime
636 -mno-soft-float -mno-space-regs -msoft-float -mpa-risc-1-0
637 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime -mschedule=cpu-
638 type -mspace-regs -msio -mwsio -munix=unix-std -nolibdld
639 -static -threads
640
641 IA-64 Options -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld
642 -mno-pic -mvolatile-asm-stop -mregister-names -msdata -mno-sdata
643 -mconstant-gp -mauto-pic -mfused-madd
644 -minline-float-divide-min-latency
645 -minline-float-divide-max-throughput -mno-inline-float-divide
646 -minline-int-divide-min-latency -minline-int-divide-max-throughput
647 -mno-inline-int-divide -minline-sqrt-min-latency
648 -minline-sqrt-max-throughput -mno-inline-sqrt -mdwarf2-asm
649 -mearly-stop-bits -mfixed-range=register-range -mtls-size=tls-size
650 -mtune=cpu-type -milp32 -mlp64 -msched-br-data-spec
651 -msched-ar-data-spec -msched-control-spec -msched-br-in-data-spec
652 -msched-ar-in-data-spec -msched-in-control-spec -msched-spec-ldc
653 -msched-spec-control-ldc -msched-prefer-non-data-spec-insns
654 -msched-prefer-non-control-spec-insns
655 -msched-stop-bits-after-every-cycle
656 -msched-count-spec-in-critical-path
657 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost
658 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=max-
659 insns
660
661 LM32 Options -mbarrel-shift-enabled -mdivide-enabled
662 -mmultiply-enabled -msign-extend-enabled -muser-enabled
663
664 LoongArch Options -march=cpu-type -mtune=cpu-type -mabi=base-abi-
665 type -mfpu=fpu-type -msoft-float -msingle-float -mdouble-float
666 -mbranch-cost=n -mcheck-zero-division -mno-check-zero-division
667 -mcond-move-int -mno-cond-move-int -mcond-move-float
668 -mno-cond-move-float -memcpy -mno-memcpy -mstrict-align
669 -mno-strict-align -mmax-inline-memcpy-size=n -mcmodel=code-model
670
671 M32R/D Options -m32r2 -m32rx -m32r -mdebug -malign-loops
672 -mno-align-loops -missue-rate=number -mbranch-cost=number
673 -mmodel=code-size-model-type -msdata=sdata-type -mno-flush-func
674 -mflush-func=name -mno-flush-trap -mflush-trap=number -G num
675
676 M32C Options -mcpu=cpu -msim -memregs=number
677
678 M680x0 Options -march=arch -mcpu=cpu -mtune=tune -m68000 -m68020
679 -m68020-40 -m68020-60 -m68030 -m68040 -m68060 -mcpu32 -m5200
680 -m5206e -m528x -m5307 -m5407 -mcfv4e -mbitfield -mno-bitfield
681 -mc68000 -mc68020 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div
682 -mshort -mno-short -mhard-float -m68881 -msoft-float -mpcrel
683 -malign-int -mstrict-align -msep-data -mno-sep-data
684 -mshared-library-id=n -mid-shared-library -mno-id-shared-library
685 -mxgot -mno-xgot -mlong-jump-table-offsets
686
687 MCore Options -mhardlit -mno-hardlit -mdiv -mno-div
688 -mrelax-immediates -mno-relax-immediates -mwide-bitfields
689 -mno-wide-bitfields -m4byte-functions -mno-4byte-functions
690 -mcallgraph-data -mno-callgraph-data -mslow-bytes -mno-slow-bytes
691 -mno-lsim -mlittle-endian -mbig-endian -m210 -m340
692 -mstack-increment
693
694 MeP Options -mabsdiff -mall-opts -maverage -mbased=n -mbitops
695 -mc=n -mclip -mconfig=name -mcop -mcop32 -mcop64 -mivc2 -mdc
696 -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax
697 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim
698 -msimnovec -mtf -mtiny=n
699
700 MicroBlaze Options -msoft-float -mhard-float -msmall-divides
701 -mcpu=cpu -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift
702 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss
703 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt
704 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-app-model
705 -mpic-data-is-text-relative
706
707 MIPS Options -EL -EB -march=arch -mtune=arch -mips1 -mips2
708 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 -mips32r6
709 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 -mips16
710 -mno-mips16 -mflip-mips16 -minterlink-compressed
711 -mno-interlink-compressed -minterlink-mips16 -mno-interlink-mips16
712 -mabi=abi -mabicalls -mno-abicalls -mshared -mno-shared -mplt
713 -mno-plt -mxgot -mno-xgot -mgp32 -mgp64 -mfp32 -mfpxx -mfp64
714 -mhard-float -msoft-float -mno-float -msingle-float
715 -mdouble-float -modd-spreg -mno-odd-spreg -mabs=mode
716 -mnan=encoding -mdsp -mno-dsp -mdspr2 -mno-dspr2 -mmcu
717 -mmno-mcu -meva -mno-eva -mvirt -mno-virt -mxpa -mno-xpa -mcrc
718 -mno-crc -mginv -mno-ginv -mmicromips -mno-micromips -mmsa
719 -mno-msa -mloongson-mmi -mno-loongson-mmi -mloongson-ext
720 -mno-loongson-ext -mloongson-ext2 -mno-loongson-ext2 -mfpu=fpu-
721 type -msmartmips -mno-smartmips -mpaired-single
722 -mno-paired-single -mdmx -mno-mdmx -mips3d -mno-mips3d -mmt
723 -mno-mt -mllsc -mno-llsc -mlong64 -mlong32 -msym32 -mno-sym32
724 -Gnum -mlocal-sdata -mno-local-sdata -mextern-sdata
725 -mno-extern-sdata -mgpopt -mno-gopt -membedded-data
726 -mno-embedded-data -muninit-const-in-rodata
727 -mno-uninit-const-in-rodata -mcode-readable=setting
728 -msplit-addresses -mno-split-addresses -mexplicit-relocs
729 -mno-explicit-relocs -mcheck-zero-division
730 -mno-check-zero-division -mdivide-traps -mdivide-breaks
731 -mload-store-pairs -mno-load-store-pairs -munaligned-access
732 -mno-unaligned-access -mmemcpy -mno-memcpy -mlong-calls
733 -mno-long-calls -mmad -mno-mad -mimadd -mno-imadd -mfused-madd
734 -mno-fused-madd -nocpp -mfix-24k -mno-fix-24k -mfix-r4000
735 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 -mfix-r5900
736 -mno-fix-r5900 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000
737 -mno-fix-rm7000 -mfix-vr4120 -mno-fix-vr4120 -mfix-vr4130
738 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 -mflush-func=func
739 -mno-flush-func -mbranch-cost=num -mbranch-likely
740 -mno-branch-likely -mcompact-branches=policy -mfp-exceptions
741 -mno-fp-exceptions -mvr4130-align -mno-vr4130-align -msynci
742 -mno-synci -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4
743 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address
744 -mframe-header-opt -mno-frame-header-opt
745
746 MMIX Options -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon
747 -mabi=gnu -mabi=mmixware -mzero-extend -mknuthdiv
748 -mtoplevel-symbols -melf -mbranch-predict -mno-branch-predict
749 -mbase-addresses -mno-base-addresses -msingle-exit
750 -mno-single-exit
751
752 MN10300 Options -mmult-bug -mno-mult-bug -mno-am33 -mam33
753 -mam33-2 -mam34 -mtune=cpu-type -mreturn-pointer-on-d0 -mno-crt0
754 -mrelax -mliw -msetlb
755
756 Moxie Options -meb -mel -mmul.x -mno-crt0
757
758 MSP430 Options -msim -masm-hex -mmcu= -mcpu= -mlarge -msmall
759 -mrelax -mwarn-mcu -mcode-region= -mdata-region= -msilicon-errata=
760 -msilicon-errata-warn= -mhwmult= -minrt -mtiny-printf
761 -mmax-inline-shift=
762
763 NDS32 Options -mbig-endian -mlittle-endian -mreduced-regs
764 -mfull-regs -mcmov -mno-cmov -mext-perf -mno-ext-perf -mext-perf2
765 -mno-ext-perf2 -mext-string -mno-ext-string -mv3push -mno-v3push
766 -m16bit -mno-16bit -misr-vector-size=num -mcache-block-size=num
767 -march=arch -mcmodel=code-model -mctor-dtor -mrelax
768
769 Nios II Options -G num -mgpopt=option -mgpopt -mno-gpopt
770 -mgprel-sec=regexp -mr0rel-sec=regexp -mel -meb -mno-bypass-cache
771 -mbypass-cache -mno-cache-volatile -mcache-volatile
772 -mno-fast-sw-div -mfast-sw-div -mhw-mul -mno-hw-mul -mhw-mulx
773 -mno-hw-mulx -mno-hw-div -mhw-div -mcustom-insn=N
774 -mno-custom-insn -mcustom-fpu-cfg=name -mhal -msmallc
775 -msys-crt0=name -msys-lib=name -march=arch -mbmx -mno-bmx -mcdx
776 -mno-cdx
777
778 Nvidia PTX Options -m64 -mmainkernel -moptimize
779
780 OpenRISC Options -mboard=name -mnewlib -mhard-mul -mhard-div
781 -msoft-mul -msoft-div -msoft-float -mhard-float -mdouble-float
782 -munordered-float -mcmov -mror -mrori -msext -msfimm -mshftimm
783 -mcmodel=code-model
784
785 PDP-11 Options -mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45
786 -m10 -mint32 -mno-int16 -mint16 -mno-int32 -msplit -munix-asm
787 -mdec-asm -mgnu-asm -mlra
788
789 picoChip Options -mae=ae_type -mvliw-lookahead=N
790 -msymbol-as-address -mno-inefficient-warnings
791
792 PowerPC Options See RS/6000 and PowerPC Options.
793
794 PRU Options -mmcu=mcu -minrt -mno-relax -mloop -mabi=variant
795
796 RISC-V Options -mbranch-cost=N-instruction -mplt -mno-plt
797 -mabi=ABI-string -mfdiv -mno-fdiv -mdiv -mno-div -misa-spec=ISA-
798 spec-string -march=ISA-string -mtune=processor-string
799 -mpreferred-stack-boundary=num -msmall-data-limit=N-bytes
800 -msave-restore -mno-save-restore -mshorten-memrefs
801 -mno-shorten-memrefs -mstrict-align -mno-strict-align
802 -mcmodel=medlow -mcmodel=medany -mexplicit-relocs
803 -mno-explicit-relocs -mrelax -mno-relax -mriscv-attribute
804 -mmo-riscv-attribute -malign-data=type -mbig-endian
805 -mlittle-endian -mstack-protector-guard=guard
806 -mstack-protector-guard-reg=reg
807 -mstack-protector-guard-offset=offset
808
809 RL78 Options -msim -mmul=none -mmul=g13 -mmul=g14 -mallregs
810 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14
811 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts
812
813 RS/6000 and PowerPC Options -mcpu=cpu-type -mtune=cpu-type
814 -mcmodel=code-model -mpowerpc64 -maltivec -mno-altivec
815 -mpowerpc-gpopt -mno-powerpc-gpopt -mpowerpc-gfxopt
816 -mno-powerpc-gfxopt -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb
817 -mpopcntd -mno-popcntd -mfprnd -mno-fprnd -mcmpb -mno-cmpb
818 -mhard-dfp -mno-hard-dfp -mfull-toc -mminimal-toc
819 -mno-fp-in-toc -mno-sum-in-toc -m64 -m32 -mxl-compat
820 -mno-xl-compat -mpe -malign-power -malign-natural -msoft-float
821 -mhard-float -mmultiple -mno-multiple -mupdate -mno-update
822 -mavoid-indexed-addresses -mno-avoid-indexed-addresses
823 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align
824 -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
825 -mrelocatable-lib -mno-relocatable-lib -mtoc -mno-toc -mlittle
826 -mlittle-endian -mbig -mbig-endian -mdynamic-no-pic -mswdiv
827 -msingle-pic-base -mprioritize-restricted-insns=priority
828 -msched-costly-dep=dependence_type -minsert-sched-nops=scheme
829 -mcall-aixdesc -mcall-eabi -mcall-freebsd -mcall-linux
830 -mcall-netbsd -mcall-openbsd -mcall-sysv -mcall-sysv-eabi
831 -mcall-sysv-noeabi -mtraceback=traceback_type -maix-struct-return
832 -msvr4-struct-return -mabi=abi-type -msecure-plt -mbss-plt
833 -mlongcall -mno-longcall -mpltseq -mno-pltseq
834 -mblock-move-inline-limit=num -mblock-compare-inline-limit=num
835 -mblock-compare-inline-loop-limit=num -mno-block-ops-unaligned-vsx
836 -mstring-compare-inline-limit=num -misel -mno-isel -mvrsave
837 -mno-vrsave -mmulhw -mno-mulhw -mdlmzb -mno-dlmzb -mprototype
838 -mno-prototype -msim -mmvme -mads -myellowknife -memb -msdata
839 -msdata=opt -mreadonly-in-sdata -mvxworks -G num -mrecip
840 -mrecip=opt -mno-recip -mrecip-precision -mno-recip-precision
841 -mveclibabi=type -mfriz -mno-friz -mpointers-to-nested-functions
842 -mno-pointers-to-nested-functions -msave-toc-indirect
843 -mno-save-toc-indirect -mpower8-fusion -mno-mpower8-fusion
844 -mpower8-vector -mno-power8-vector -mcrypto -mno-crypto -mhtm
845 -mno-htm -mquad-memory -mno-quad-memory -mquad-memory-atomic
846 -mno-quad-memory-atomic -mcompat-align-parm -mno-compat-align-parm
847 -mfloat128 -mno-float128 -mfloat128-hardware
848 -mno-float128-hardware -mgnu-attribute -mno-gnu-attribute
849 -mstack-protector-guard=guard -mstack-protector-guard-reg=reg
850 -mstack-protector-guard-offset=offset -mprefixed -mno-prefixed
851 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
852 -mprivileged -mno-privileged
853
854 RX Options -m64bit-doubles -m32bit-doubles -fpu -nofpu -mcpu=
855 -mbig-endian-data -mlittle-endian-data -msmall-data -msim
856 -mno-sim -mas100-syntax -mno-as100-syntax -mrelax
857 -mmax-constant-size= -mint-register= -mpid -mallow-string-insns
858 -mno-allow-string-insns -mjsr -mno-warn-multiple-fast-interrupts
859 -msave-acc-in-interrupts
860
861 S/390 and zSeries Options -mtune=cpu-type -march=cpu-type
862 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp
863 -mlong-double-64 -mlong-double-128 -mbackchain -mno-backchain
864 -mpacked-stack -mno-packed-stack -msmall-exec -mno-small-exec
865 -mmvcle -mno-mvcle -m64 -m31 -mdebug -mno-debug -mesa -mzarch
866 -mhtm -mvx -mzvector -mtpf-trace -mno-tpf-trace
867 -mtpf-trace-skip -mno-tpf-trace-skip -mfused-madd -mno-fused-madd
868 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard
869 -mhotpatch=halfwords,halfwords
870
871 Score Options -meb -mel -mnhwloop -muls -mmac -mscore5 -mscore5u
872 -mscore7 -mscore7d
873
874 SH Options -m1 -m2 -m2e -m2a-nofpu -m2a-single-only -m2a-single
875 -m2a -m3 -m3e -m4-nofpu -m4-single-only -m4-single -m4
876 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al -mb -ml
877 -mdalign -mrelax -mbigtable -mfmovd -mrenesas -mno-renesas
878 -mnomacsave -mieee -mno-ieee -mbitops -misize
879 -minline-ic_invalidate -mpadstruct -mprefergot -musermode
880 -multcost=number -mdiv=strategy -mdivsi3_libfunc=name
881 -mfixed-range=register-range -maccumulate-outgoing-args
882 -matomic-model=atomic-model -mbranch-cost=num -mzdcbranch
883 -mno-zdcbranch -mcbranch-force-delay-slot -mfused-madd
884 -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra
885 -mpretend-cmove -mtas
886
887 Solaris 2 Options -mclear-hwcap -mno-clear-hwcap -mimpure-text
888 -mno-impure-text -pthreads
889
890 SPARC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model
891 -mmemory-model=mem-model -m32 -m64 -mapp-regs -mno-app-regs
892 -mfaster-structs -mno-faster-structs -mflat -mno-flat -mfpu
893 -mno-fpu -mhard-float -msoft-float -mhard-quad-float
894 -msoft-quad-float -mstack-bias -mno-stack-bias -mstd-struct-return
895 -mno-std-struct-return -munaligned-doubles -mno-unaligned-doubles
896 -muser-mode -mno-user-mode -mv8plus -mno-v8plus -mvis -mno-vis
897 -mvis2 -mno-vis2 -mvis3 -mno-vis3 -mvis4 -mno-vis4 -mvis4b
898 -mno-vis4b -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld
899 -mno-fsmuld -mpopc -mno-popc -msubxc -mno-subxc -mfix-at697f
900 -mfix-ut699 -mfix-ut700 -mfix-gr712rc -mlra -mno-lra
901
902 System V Options -Qy -Qn -YP,paths -Ym,dir
903
904 TILE-Gx Options -mcpu=CPU -m32 -m64 -mbig-endian
905 -mlittle-endian -mcmodel=code-model
906
907 TILEPro Options -mcpu=cpu -m32
908
909 V850 Options -mlong-calls -mno-long-calls -mep -mno-ep
910 -mprolog-function -mno-prolog-function -mspace -mtda=n -msda=n
911 -mzda=n -mapp-regs -mno-app-regs -mdisable-callt
912 -mno-disable-callt -mv850e2v3 -mv850e2 -mv850e1 -mv850es -mv850e
913 -mv850 -mv850e3v5 -mloop -mrelax -mlong-jumps -msoft-float
914 -mhard-float -mgcc-abi -mrh850-abi -mbig-switch
915
916 VAX Options -mg -mgnu -munix -mlra
917
918 Visium Options -mdebug -msim -mfpu -mno-fpu -mhard-float
919 -msoft-float -mcpu=cpu-type -mtune=cpu-type -msv-mode
920 -muser-mode
921
922 VMS Options -mvms-return-codes -mdebug-main=prefix -mmalloc64
923 -mpointer-size=size
924
925 VxWorks Options -mrtp -non-static -Bstatic -Bdynamic -Xbind-lazy
926 -Xbind-now
927
928 x86 Options -mtune=cpu-type -march=cpu-type -mtune-ctrl=feature-
929 list -mdump-tune-features -mno-default -mfpmath=unit
930 -masm=dialect -mno-fancy-math-387 -mno-fp-ret-in-387 -m80387
931 -mhard-float -msoft-float -mno-wide-multiply -mrtd
932 -malign-double -mpreferred-stack-boundary=num
933 -mincoming-stack-boundary=num -mcld -mcx16 -msahf -mmovbe
934 -mcrc32 -mmwait -mrecip -mrecip=opt -mvzeroupper -mprefer-avx128
935 -mprefer-vector-width=opt -mmove-max=bits -mstore-max=bits -mmmx
936 -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx
937 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl
938 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes
939 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd
940 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves
941 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4
942 -mxop -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm
943 -mhle -mlwp -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes
944 -mwaitpkg -mshstk -mmanual-endbr -mforce-indirect-call
945 -mavx512vbmi2 -mavx512bf16 -menqcmd -mvpclmulqdq -mavx512bitalg
946 -mmovdiri -mmovdir64b -mavx512vpopcntdq -mavx5124fmaps
947 -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid -mrdseed -msgx
948 -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8
949 -mamx-bf16 -muintr -mhreset -mavxvnni -mavx512fp16 -mcldemote
950 -mms-bitfields -mno-align-stringops -minline-all-stringops
951 -minline-stringops-dynamically -mstringop-strategy=alg -mkl
952 -mwidekl -mmemcpy-strategy=strategy -mmemset-strategy=strategy
953 -mpush-args -maccumulate-outgoing-args -m128bit-long-double
954 -m96bit-long-double -mlong-double-64 -mlong-double-80
955 -mlong-double-128 -mregparm=num -msseregparm -mveclibabi=type
956 -mvect8-ret-in-mem -mpc32 -mpc64 -mpc80 -mstackrealign
957 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs
958 -mcmodel=code-model -mabi=name -maddress-mode=mode -m32 -m64
959 -mx32 -m16 -miamcu -mlarge-data-threshold=num -msse2avx
960 -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv
961 -minstrument-return=type -mfentry-name=name -mfentry-section=name
962 -mavx256-split-unaligned-load -mavx256-split-unaligned-store
963 -malign-data=type -mstack-protector-guard=guard
964 -mstack-protector-guard-reg=reg
965 -mstack-protector-guard-offset=offset
966 -mstack-protector-guard-symbol=symbol -mgeneral-regs-only
967 -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop
968 -mindirect-branch=choice -mfunction-return=choice
969 -mindirect-branch-register -mharden-sls=choice
970 -mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access
971
972 x86 Windows Options -mconsole -mcygwin -mno-cygwin -mdll
973 -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows
974 -fno-set-stack-executable
975
976 Xstormy16 Options -msim
977
978 Xtensa Options -mconst16 -mno-const16 -mfused-madd
979 -mno-fused-madd -mforce-no-pic -mserialize-volatile
980 -mno-serialize-volatile -mtext-section-literals
981 -mno-text-section-literals -mauto-litpools -mno-auto-litpools
982 -mtarget-align -mno-target-align -mlongcalls -mno-longcalls
983 -mabi=abi-type
984
985 zSeries Options See S/390 and zSeries Options.
986
987 Options Controlling the Kind of Output
988 Compilation can involve up to four stages: preprocessing, compilation
989 proper, assembly and linking, always in that order. GCC is capable of
990 preprocessing and compiling several files either into several assembler
991 input files, or into one assembler input file; then each assembler
992 input file produces an object file, and linking combines all the object
993 files (those newly compiled, and those specified as input) into an
994 executable file.
995
996 For any given input file, the file name suffix determines what kind of
997 compilation is done:
998
999 file.c
1000 C source code that must be preprocessed.
1001
1002 file.i
1003 C source code that should not be preprocessed.
1004
1005 file.ii
1006 C++ source code that should not be preprocessed.
1007
1008 file.m
1009 Objective-C source code. Note that you must link with the libobjc
1010 library to make an Objective-C program work.
1011
1012 file.mi
1013 Objective-C source code that should not be preprocessed.
1014
1015 file.mm
1016 file.M
1017 Objective-C++ source code. Note that you must link with the
1018 libobjc library to make an Objective-C++ program work. Note that
1019 .M refers to a literal capital M.
1020
1021 file.mii
1022 Objective-C++ source code that should not be preprocessed.
1023
1024 file.h
1025 C, C++, Objective-C or Objective-C++ header file to be turned into
1026 a precompiled header (default), or C, C++ header file to be turned
1027 into an Ada spec (via the -fdump-ada-spec switch).
1028
1029 file.cc
1030 file.cp
1031 file.cxx
1032 file.cpp
1033 file.CPP
1034 file.c++
1035 file.C
1036 C++ source code that must be preprocessed. Note that in .cxx, the
1037 last two letters must both be literally x. Likewise, .C refers to
1038 a literal capital C.
1039
1040 file.mm
1041 file.M
1042 Objective-C++ source code that must be preprocessed.
1043
1044 file.mii
1045 Objective-C++ source code that should not be preprocessed.
1046
1047 file.hh
1048 file.H
1049 file.hp
1050 file.hxx
1051 file.hpp
1052 file.HPP
1053 file.h++
1054 file.tcc
1055 C++ header file to be turned into a precompiled header or Ada spec.
1056
1057 file.f
1058 file.for
1059 file.ftn
1060 Fixed form Fortran source code that should not be preprocessed.
1061
1062 file.F
1063 file.FOR
1064 file.fpp
1065 file.FPP
1066 file.FTN
1067 Fixed form Fortran source code that must be preprocessed (with the
1068 traditional preprocessor).
1069
1070 file.f90
1071 file.f95
1072 file.f03
1073 file.f08
1074 Free form Fortran source code that should not be preprocessed.
1075
1076 file.F90
1077 file.F95
1078 file.F03
1079 file.F08
1080 Free form Fortran source code that must be preprocessed (with the
1081 traditional preprocessor).
1082
1083 file.go
1084 Go source code.
1085
1086 file.d
1087 D source code.
1088
1089 file.di
1090 D interface file.
1091
1092 file.dd
1093 D documentation code (Ddoc).
1094
1095 file.ads
1096 Ada source code file that contains a library unit declaration (a
1097 declaration of a package, subprogram, or generic, or a generic
1098 instantiation), or a library unit renaming declaration (a package,
1099 generic, or subprogram renaming declaration). Such files are also
1100 called specs.
1101
1102 file.adb
1103 Ada source code file containing a library unit body (a subprogram
1104 or package body). Such files are also called bodies.
1105
1106 file.s
1107 Assembler code.
1108
1109 file.S
1110 file.sx
1111 Assembler code that must be preprocessed.
1112
1113 other
1114 An object file to be fed straight into linking. Any file name with
1115 no recognized suffix is treated this way.
1116
1117 You can specify the input language explicitly with the -x option:
1118
1119 -x language
1120 Specify explicitly the language for the following input files
1121 (rather than letting the compiler choose a default based on the
1122 file name suffix). This option applies to all following input
1123 files until the next -x option. Possible values for language are:
1124
1125 c c-header cpp-output
1126 c++ c++-header c++-system-header c++-user-header c++-cpp-output
1127 objective-c objective-c-header objective-c-cpp-output
1128 objective-c++ objective-c++-header objective-c++-cpp-output
1129 assembler assembler-with-cpp
1130 ada
1131 d
1132 f77 f77-cpp-input f95 f95-cpp-input
1133 go
1134
1135 -x none
1136 Turn off any specification of a language, so that subsequent files
1137 are handled according to their file name suffixes (as they are if
1138 -x has not been used at all).
1139
1140 If you only want some of the stages of compilation, you can use -x (or
1141 filename suffixes) to tell gcc where to start, and one of the options
1142 -c, -S, or -E to say where gcc is to stop. Note that some combinations
1143 (for example, -x cpp-output -E) instruct gcc to do nothing at all.
1144
1145 -c Compile or assemble the source files, but do not link. The linking
1146 stage simply is not done. The ultimate output is in the form of an
1147 object file for each source file.
1148
1149 By default, the object file name for a source file is made by
1150 replacing the suffix .c, .i, .s, etc., with .o.
1151
1152 Unrecognized input files, not requiring compilation or assembly,
1153 are ignored.
1154
1155 -S Stop after the stage of compilation proper; do not assemble. The
1156 output is in the form of an assembler code file for each non-
1157 assembler input file specified.
1158
1159 By default, the assembler file name for a source file is made by
1160 replacing the suffix .c, .i, etc., with .s.
1161
1162 Input files that don't require compilation are ignored.
1163
1164 -E Stop after the preprocessing stage; do not run the compiler proper.
1165 The output is in the form of preprocessed source code, which is
1166 sent to the standard output.
1167
1168 Input files that don't require preprocessing are ignored.
1169
1170 -o file
1171 Place the primary output in file file. This applies to whatever
1172 sort of output is being produced, whether it be an executable file,
1173 an object file, an assembler file or preprocessed C code.
1174
1175 If -o is not specified, the default is to put an executable file in
1176 a.out, the object file for source.suffix in source.o, its assembler
1177 file in source.s, a precompiled header file in source.suffix.gch,
1178 and all preprocessed C source on standard output.
1179
1180 Though -o names only the primary output, it also affects the naming
1181 of auxiliary and dump outputs. See the examples below. Unless
1182 overridden, both auxiliary outputs and dump outputs are placed in
1183 the same directory as the primary output. In auxiliary outputs,
1184 the suffix of the input file is replaced with that of the auxiliary
1185 output file type; in dump outputs, the suffix of the dump file is
1186 appended to the input file suffix. In compilation commands, the
1187 base name of both auxiliary and dump outputs is that of the primary
1188 output; in compile and link commands, the primary output name,
1189 minus the executable suffix, is combined with the input file name.
1190 If both share the same base name, disregarding the suffix, the
1191 result of the combination is that base name, otherwise, they are
1192 concatenated, separated by a dash.
1193
1194 gcc -c foo.c ...
1195
1196 will use foo.o as the primary output, and place aux outputs and
1197 dumps next to it, e.g., aux file foo.dwo for -gsplit-dwarf, and
1198 dump file foo.c.???r.final for -fdump-rtl-final.
1199
1200 If a non-linker output file is explicitly specified, aux and dump
1201 files by default take the same base name:
1202
1203 gcc -c foo.c -o dir/foobar.o ...
1204
1205 will name aux outputs dir/foobar.* and dump outputs dir/foobar.c.*.
1206
1207 A linker output will instead prefix aux and dump outputs:
1208
1209 gcc foo.c bar.c -o dir/foobar ...
1210
1211 will generally name aux outputs dir/foobar-foo.* and
1212 dir/foobar-bar.*, and dump outputs dir/foobar-foo.c.* and
1213 dir/foobar-bar.c.*.
1214
1215 The one exception to the above is when the executable shares the
1216 base name with the single input:
1217
1218 gcc foo.c -o dir/foo ...
1219
1220 in which case aux outputs are named dir/foo.* and dump outputs
1221 named dir/foo.c.*.
1222
1223 The location and the names of auxiliary and dump outputs can be
1224 adjusted by the options -dumpbase, -dumpbase-ext, -dumpdir,
1225 -save-temps=cwd, and -save-temps=obj.
1226
1227 -dumpbase dumpbase
1228 This option sets the base name for auxiliary and dump output files.
1229 It does not affect the name of the primary output file.
1230 Intermediate outputs, when preserved, are not regarded as primary
1231 outputs, but as auxiliary outputs:
1232
1233 gcc -save-temps -S foo.c
1234
1235 saves the (no longer) temporary preprocessed file in foo.i, and
1236 then compiles to the (implied) output file foo.s, whereas:
1237
1238 gcc -save-temps -dumpbase save-foo -c foo.c
1239
1240 preprocesses to in save-foo.i, compiles to save-foo.s (now an
1241 intermediate, thus auxiliary output), and then assembles to the
1242 (implied) output file foo.o.
1243
1244 Absent this option, dump and aux files take their names from the
1245 input file, or from the (non-linker) output file, if one is
1246 explicitly specified: dump output files (e.g. those requested by
1247 -fdump-* options) with the input name suffix, and aux output files
1248 (those requested by other non-dump options, e.g. "-save-temps",
1249 "-gsplit-dwarf", "-fcallgraph-info") without it.
1250
1251 Similar suffix differentiation of dump and aux outputs can be
1252 attained for explicitly-given -dumpbase basename.suf by also
1253 specifying -dumpbase-ext .suf.
1254
1255 If dumpbase is explicitly specified with any directory component,
1256 any dumppfx specification (e.g. -dumpdir or -save-temps=*) is
1257 ignored, and instead of appending to it, dumpbase fully overrides
1258 it:
1259
1260 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1261 -dumpdir pfx- -save-temps=cwd ...
1262
1263 creates auxiliary and dump outputs named alt/foo.*, disregarding
1264 dir/ in -o, the ./ prefix implied by -save-temps=cwd, and pfx- in
1265 -dumpdir.
1266
1267 When -dumpbase is specified in a command that compiles multiple
1268 inputs, or that compiles and then links, it may be combined with
1269 dumppfx, as specified under -dumpdir. Then, each input file is
1270 compiled using the combined dumppfx, and default values for
1271 dumpbase and auxdropsuf are computed for each input file:
1272
1273 gcc foo.c bar.c -c -dumpbase main ...
1274
1275 creates foo.o and bar.o as primary outputs, and avoids overwriting
1276 the auxiliary and dump outputs by using the dumpbase as a prefix,
1277 creating auxiliary and dump outputs named main-foo.* and
1278 main-bar.*.
1279
1280 An empty string specified as dumpbase avoids the influence of the
1281 output basename in the naming of auxiliary and dump outputs during
1282 compilation, computing default values :
1283
1284 gcc -c foo.c -o dir/foobar.o -dumpbase " ...
1285
1286 will name aux outputs dir/foo.* and dump outputs dir/foo.c.*. Note
1287 how their basenames are taken from the input name, but the
1288 directory still defaults to that of the output.
1289
1290 The empty-string dumpbase does not prevent the use of the output
1291 basename for outputs during linking:
1292
1293 gcc foo.c bar.c -o dir/foobar -dumpbase " -flto ...
1294
1295 The compilation of the source files will name auxiliary outputs
1296 dir/foo.* and dir/bar.*, and dump outputs dir/foo.c.* and
1297 dir/bar.c.*. LTO recompilation during linking will use dir/foobar.
1298 as the prefix for dumps and auxiliary files.
1299
1300 -dumpbase-ext auxdropsuf
1301 When forming the name of an auxiliary (but not a dump) output file,
1302 drop trailing auxdropsuf from dumpbase before appending any
1303 suffixes. If not specified, this option defaults to the suffix of
1304 a default dumpbase, i.e., the suffix of the input file when
1305 -dumpbase is not present in the command line, or dumpbase is
1306 combined with dumppfx.
1307
1308 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1309
1310 creates dir/foo.o as the main output, and generates auxiliary
1311 outputs in dir/x-foo.*, taking the location of the primary output,
1312 and dropping the .c suffix from the dumpbase. Dump outputs retain
1313 the suffix: dir/x-foo.c.*.
1314
1315 This option is disregarded if it does not match the suffix of a
1316 specified dumpbase, except as an alternative to the executable
1317 suffix when appending the linker output base name to dumppfx, as
1318 specified below:
1319
1320 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1321
1322 creates main.out as the primary output, and avoids overwriting the
1323 auxiliary and dump outputs by using the executable name minus
1324 auxdropsuf as a prefix, creating auxiliary outputs named main-foo.*
1325 and main-bar.* and dump outputs named main-foo.c.* and
1326 main-bar.c.*.
1327
1328 -dumpdir dumppfx
1329 When forming the name of an auxiliary or dump output file, use
1330 dumppfx as a prefix:
1331
1332 gcc -dumpdir pfx- -c foo.c ...
1333
1334 creates foo.o as the primary output, and auxiliary outputs named
1335 pfx-foo.*, combining the given dumppfx with the default dumpbase
1336 derived from the default primary output, derived in turn from the
1337 input name. Dump outputs also take the input name suffix:
1338 pfx-foo.c.*.
1339
1340 If dumppfx is to be used as a directory name, it must end with a
1341 directory separator:
1342
1343 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1344
1345 creates obj/bar.o as the primary output, and auxiliary outputs
1346 named dir/bar.*, combining the given dumppfx with the default
1347 dumpbase derived from the primary output name. Dump outputs also
1348 take the input name suffix: dir/bar.c.*.
1349
1350 It defaults to the location of the output file, unless the output
1351 file is a special file like "/dev/null". Options -save-temps=cwd
1352 and -save-temps=obj override this default, just like an explicit
1353 -dumpdir option. In case multiple such options are given, the last
1354 one prevails:
1355
1356 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1357
1358 outputs foo.o, with auxiliary outputs named foo.* because
1359 -save-temps=* overrides the dumppfx given by the earlier -dumpdir
1360 option. It does not matter that =obj is the default for
1361 -save-temps, nor that the output directory is implicitly the
1362 current directory. Dump outputs are named foo.c.*.
1363
1364 When compiling from multiple input files, if -dumpbase is
1365 specified, dumpbase, minus a auxdropsuf suffix, and a dash are
1366 appended to (or override, if containing any directory components)
1367 an explicit or defaulted dumppfx, so that each of the multiple
1368 compilations gets differently-named aux and dump outputs.
1369
1370 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1371
1372 outputs auxiliary dumps to dir/pfx-main-foo.* and
1373 dir/pfx-main-bar.*, appending dumpbase- to dumppfx. Dump outputs
1374 retain the input file suffix: dir/pfx-main-foo.c.* and
1375 dir/pfx-main-bar.c.*, respectively. Contrast with the single-input
1376 compilation:
1377
1378 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1379
1380 that, applying -dumpbase to a single source, does not compute and
1381 append a separate dumpbase per input file. Its auxiliary and dump
1382 outputs go in dir/pfx-main.*.
1383
1384 When compiling and then linking from multiple input files, a
1385 defaulted or explicitly specified dumppfx also undergoes the
1386 dumpbase- transformation above (e.g. the compilation of foo.c and
1387 bar.c above, but without -c). If neither -dumpdir nor -dumpbase
1388 are given, the linker output base name, minus auxdropsuf, if
1389 specified, or the executable suffix otherwise, plus a dash is
1390 appended to the default dumppfx instead. Note, however, that
1391 unlike earlier cases of linking:
1392
1393 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1394
1395 does not append the output name main to dumppfx, because -dumpdir
1396 is explicitly specified. The goal is that the explicitly-specified
1397 dumppfx may contain the specified output name as part of the
1398 prefix, if desired; only an explicitly-specified -dumpbase would be
1399 combined with it, in order to avoid simply discarding a meaningful
1400 option.
1401
1402 When compiling and then linking from a single input file, the
1403 linker output base name will only be appended to the default
1404 dumppfx as above if it does not share the base name with the single
1405 input file name. This has been covered in single-input linking
1406 cases above, but not with an explicit -dumpdir that inhibits the
1407 combination, even if overridden by -save-temps=*:
1408
1409 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1410
1411 Auxiliary outputs are named foo.*, and dump outputs foo.c.*, in the
1412 current working directory as ultimately requested by
1413 -save-temps=cwd.
1414
1415 Summing it all up for an intuitive though slightly imprecise data
1416 flow: the primary output name is broken into a directory part and a
1417 basename part; dumppfx is set to the former, unless overridden by
1418 -dumpdir or -save-temps=*, and dumpbase is set to the latter,
1419 unless overriden by -dumpbase. If there are multiple inputs or
1420 linking, this dumpbase may be combined with dumppfx and taken from
1421 each input file. Auxiliary output names for each input are formed
1422 by combining dumppfx, dumpbase minus suffix, and the auxiliary
1423 output suffix; dump output names are only different in that the
1424 suffix from dumpbase is retained.
1425
1426 When it comes to auxiliary and dump outputs created during LTO
1427 recompilation, a combination of dumppfx and dumpbase, as given or
1428 as derived from the linker output name but not from inputs, even in
1429 cases in which this combination would not otherwise be used as
1430 such, is passed down with a trailing period replacing the compiler-
1431 added dash, if any, as a -dumpdir option to lto-wrapper; being
1432 involved in linking, this program does not normally get any
1433 -dumpbase and -dumpbase-ext, and it ignores them.
1434
1435 When running sub-compilers, lto-wrapper appends LTO stage names to
1436 the received dumppfx, ensures it contains a directory component so
1437 that it overrides any -dumpdir, and passes that as -dumpbase to
1438 sub-compilers.
1439
1440 -v Print (on standard error output) the commands executed to run the
1441 stages of compilation. Also print the version number of the
1442 compiler driver program and of the preprocessor and the compiler
1443 proper.
1444
1445 -###
1446 Like -v except the commands are not executed and arguments are
1447 quoted unless they contain only alphanumeric characters or "./-_".
1448 This is useful for shell scripts to capture the driver-generated
1449 command lines.
1450
1451 --help
1452 Print (on the standard output) a description of the command-line
1453 options understood by gcc. If the -v option is also specified then
1454 --help is also passed on to the various processes invoked by gcc,
1455 so that they can display the command-line options they accept. If
1456 the -Wextra option has also been specified (prior to the --help
1457 option), then command-line options that have no documentation
1458 associated with them are also displayed.
1459
1460 --target-help
1461 Print (on the standard output) a description of target-specific
1462 command-line options for each tool. For some targets extra target-
1463 specific information may also be printed.
1464
1465 --help={class|[^]qualifier}[,...]
1466 Print (on the standard output) a description of the command-line
1467 options understood by the compiler that fit into all specified
1468 classes and qualifiers. These are the supported classes:
1469
1470 optimizers
1471 Display all of the optimization options supported by the
1472 compiler.
1473
1474 warnings
1475 Display all of the options controlling warning messages
1476 produced by the compiler.
1477
1478 target
1479 Display target-specific options. Unlike the --target-help
1480 option however, target-specific options of the linker and
1481 assembler are not displayed. This is because those tools do
1482 not currently support the extended --help= syntax.
1483
1484 params
1485 Display the values recognized by the --param option.
1486
1487 language
1488 Display the options supported for language, where language is
1489 the name of one of the languages supported in this version of
1490 GCC. If an option is supported by all languages, one needs to
1491 select common class.
1492
1493 common
1494 Display the options that are common to all languages.
1495
1496 These are the supported qualifiers:
1497
1498 undocumented
1499 Display only those options that are undocumented.
1500
1501 joined
1502 Display options taking an argument that appears after an equal
1503 sign in the same continuous piece of text, such as:
1504 --help=target.
1505
1506 separate
1507 Display options taking an argument that appears as a separate
1508 word following the original option, such as: -o output-file.
1509
1510 Thus for example to display all the undocumented target-specific
1511 switches supported by the compiler, use:
1512
1513 --help=target,undocumented
1514
1515 The sense of a qualifier can be inverted by prefixing it with the ^
1516 character, so for example to display all binary warning options
1517 (i.e., ones that are either on or off and that do not take an
1518 argument) that have a description, use:
1519
1520 --help=warnings,^joined,^undocumented
1521
1522 The argument to --help= should not consist solely of inverted
1523 qualifiers.
1524
1525 Combining several classes is possible, although this usually
1526 restricts the output so much that there is nothing to display. One
1527 case where it does work, however, is when one of the classes is
1528 target. For example, to display all the target-specific
1529 optimization options, use:
1530
1531 --help=target,optimizers
1532
1533 The --help= option can be repeated on the command line. Each
1534 successive use displays its requested class of options, skipping
1535 those that have already been displayed. If --help is also
1536 specified anywhere on the command line then this takes precedence
1537 over any --help= option.
1538
1539 If the -Q option appears on the command line before the --help=
1540 option, then the descriptive text displayed by --help= is changed.
1541 Instead of describing the displayed options, an indication is given
1542 as to whether the option is enabled, disabled or set to a specific
1543 value (assuming that the compiler knows this at the point where the
1544 --help= option is used).
1545
1546 Here is a truncated example from the ARM port of gcc:
1547
1548 % gcc -Q -mabi=2 --help=target -c
1549 The following options are target specific:
1550 -mabi= 2
1551 -mabort-on-noreturn [disabled]
1552 -mapcs [disabled]
1553
1554 The output is sensitive to the effects of previous command-line
1555 options, so for example it is possible to find out which
1556 optimizations are enabled at -O2 by using:
1557
1558 -Q -O2 --help=optimizers
1559
1560 Alternatively you can discover which binary optimizations are
1561 enabled by -O3 by using:
1562
1563 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1564 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1565 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1566
1567 --version
1568 Display the version number and copyrights of the invoked GCC.
1569
1570 -pass-exit-codes
1571 Normally the gcc program exits with the code of 1 if any phase of
1572 the compiler returns a non-success return code. If you specify
1573 -pass-exit-codes, the gcc program instead returns with the
1574 numerically highest error produced by any phase returning an error
1575 indication. The C, C++, and Fortran front ends return 4 if an
1576 internal compiler error is encountered.
1577
1578 -pipe
1579 Use pipes rather than temporary files for communication between the
1580 various stages of compilation. This fails to work on some systems
1581 where the assembler is unable to read from a pipe; but the GNU
1582 assembler has no trouble.
1583
1584 -specs=file
1585 Process file after the compiler reads in the standard specs file,
1586 in order to override the defaults which the gcc driver program uses
1587 when determining what switches to pass to cc1, cc1plus, as, ld,
1588 etc. More than one -specs=file can be specified on the command
1589 line, and they are processed in order, from left to right.
1590
1591 -wrapper
1592 Invoke all subcommands under a wrapper program. The name of the
1593 wrapper program and its parameters are passed as a comma separated
1594 list.
1595
1596 gcc -c t.c -wrapper gdb,--args
1597
1598 This invokes all subprograms of gcc under gdb --args, thus the
1599 invocation of cc1 is gdb --args cc1 ....
1600
1601 -ffile-prefix-map=old=new
1602 When compiling files residing in directory old, record any
1603 references to them in the result of the compilation as if the files
1604 resided in directory new instead. Specifying this option is
1605 equivalent to specifying all the individual -f*-prefix-map options.
1606 This can be used to make reproducible builds that are location
1607 independent. See also -fmacro-prefix-map, -fdebug-prefix-map and
1608 -fprofile-prefix-map.
1609
1610 -fplugin=name.so
1611 Load the plugin code in file name.so, assumed to be a shared object
1612 to be dlopen'd by the compiler. The base name of the shared object
1613 file is used to identify the plugin for the purposes of argument
1614 parsing (See -fplugin-arg-name-key=value below). Each plugin
1615 should define the callback functions specified in the Plugins API.
1616
1617 -fplugin-arg-name-key=value
1618 Define an argument called key with a value of value for the plugin
1619 called name.
1620
1621 -fdump-ada-spec[-slim]
1622 For C and C++ source and include files, generate corresponding Ada
1623 specs.
1624
1625 -fada-spec-parent=unit
1626 In conjunction with -fdump-ada-spec[-slim] above, generate Ada
1627 specs as child units of parent unit.
1628
1629 -fdump-go-spec=file
1630 For input files in any language, generate corresponding Go
1631 declarations in file. This generates Go "const", "type", "var",
1632 and "func" declarations which may be a useful way to start writing
1633 a Go interface to code written in some other language.
1634
1635 @file
1636 Read command-line options from file. The options read are inserted
1637 in place of the original @file option. If file does not exist, or
1638 cannot be read, then the option will be treated literally, and not
1639 removed.
1640
1641 Options in file are separated by whitespace. A whitespace
1642 character may be included in an option by surrounding the entire
1643 option in either single or double quotes. Any character (including
1644 a backslash) may be included by prefixing the character to be
1645 included with a backslash. The file may itself contain additional
1646 @file options; any such options will be processed recursively.
1647
1648 Compiling C++ Programs
1649 C++ source files conventionally use one of the suffixes .C, .cc, .cpp,
1650 .CPP, .c++, .cp, or .cxx; C++ header files often use .hh, .hpp, .H, or
1651 (for shared template code) .tcc; and preprocessed C++ files use the
1652 suffix .ii. GCC recognizes files with these names and compiles them as
1653 C++ programs even if you call the compiler the same way as for
1654 compiling C programs (usually with the name gcc).
1655
1656 However, the use of gcc does not add the C++ library. g++ is a program
1657 that calls GCC and automatically specifies linking against the C++
1658 library. It treats .c, .h and .i files as C++ source files instead of
1659 C source files unless -x is used. This program is also useful when
1660 precompiling a C header file with a .h extension for use in C++
1661 compilations. On many systems, g++ is also installed with the name
1662 c++.
1663
1664 When you compile C++ programs, you may specify many of the same
1665 command-line options that you use for compiling programs in any
1666 language; or command-line options meaningful for C and related
1667 languages; or options that are meaningful only for C++ programs.
1668
1669 Options Controlling C Dialect
1670 The following options control the dialect of C (or languages derived
1671 from C, such as C++, Objective-C and Objective-C++) that the compiler
1672 accepts:
1673
1674 -ansi
1675 In C mode, this is equivalent to -std=c90. In C++ mode, it is
1676 equivalent to -std=c++98.
1677
1678 This turns off certain features of GCC that are incompatible with
1679 ISO C90 (when compiling C code), or of standard C++ (when compiling
1680 C++ code), such as the "asm" and "typeof" keywords, and predefined
1681 macros such as "unix" and "vax" that identify the type of system
1682 you are using. It also enables the undesirable and rarely used ISO
1683 trigraph feature. For the C compiler, it disables recognition of
1684 C++ style // comments as well as the "inline" keyword.
1685
1686 The alternate keywords "__asm__", "__extension__", "__inline__" and
1687 "__typeof__" continue to work despite -ansi. You would not want to
1688 use them in an ISO C program, of course, but it is useful to put
1689 them in header files that might be included in compilations done
1690 with -ansi. Alternate predefined macros such as "__unix__" and
1691 "__vax__" are also available, with or without -ansi.
1692
1693 The -ansi option does not cause non-ISO programs to be rejected
1694 gratuitously. For that, -Wpedantic is required in addition to
1695 -ansi.
1696
1697 The macro "__STRICT_ANSI__" is predefined when the -ansi option is
1698 used. Some header files may notice this macro and refrain from
1699 declaring certain functions or defining certain macros that the ISO
1700 standard doesn't call for; this is to avoid interfering with any
1701 programs that might use these names for other things.
1702
1703 Functions that are normally built in but do not have semantics
1704 defined by ISO C (such as "alloca" and "ffs") are not built-in
1705 functions when -ansi is used.
1706
1707 -std=
1708 Determine the language standard. This option is currently only
1709 supported when compiling C or C++.
1710
1711 The compiler can accept several base standards, such as c90 or
1712 c++98, and GNU dialects of those standards, such as gnu90 or
1713 gnu++98. When a base standard is specified, the compiler accepts
1714 all programs following that standard plus those using GNU
1715 extensions that do not contradict it. For example, -std=c90 turns
1716 off certain features of GCC that are incompatible with ISO C90,
1717 such as the "asm" and "typeof" keywords, but not other GNU
1718 extensions that do not have a meaning in ISO C90, such as omitting
1719 the middle term of a "?:" expression. On the other hand, when a GNU
1720 dialect of a standard is specified, all features supported by the
1721 compiler are enabled, even when those features change the meaning
1722 of the base standard. As a result, some strict-conforming programs
1723 may be rejected. The particular standard is used by -Wpedantic to
1724 identify which features are GNU extensions given that version of
1725 the standard. For example -std=gnu90 -Wpedantic warns about C++
1726 style // comments, while -std=gnu99 -Wpedantic does not.
1727
1728 A value for this option must be provided; possible values are
1729
1730 c90
1731 c89
1732 iso9899:1990
1733 Support all ISO C90 programs (certain GNU extensions that
1734 conflict with ISO C90 are disabled). Same as -ansi for C code.
1735
1736 iso9899:199409
1737 ISO C90 as modified in amendment 1.
1738
1739 c99
1740 c9x
1741 iso9899:1999
1742 iso9899:199x
1743 ISO C99. This standard is substantially completely supported,
1744 modulo bugs and floating-point issues (mainly but not entirely
1745 relating to optional C99 features from Annexes F and G). See
1746 <https://gcc.gnu.org/c99status.html> for more information. The
1747 names c9x and iso9899:199x are deprecated.
1748
1749 c11
1750 c1x
1751 iso9899:2011
1752 ISO C11, the 2011 revision of the ISO C standard. This
1753 standard is substantially completely supported, modulo bugs,
1754 floating-point issues (mainly but not entirely relating to
1755 optional C11 features from Annexes F and G) and the optional
1756 Annexes K (Bounds-checking interfaces) and L (Analyzability).
1757 The name c1x is deprecated.
1758
1759 c17
1760 c18
1761 iso9899:2017
1762 iso9899:2018
1763 ISO C17, the 2017 revision of the ISO C standard (published in
1764 2018). This standard is same as C11 except for corrections of
1765 defects (all of which are also applied with -std=c11) and a new
1766 value of "__STDC_VERSION__", and so is supported to the same
1767 extent as C11.
1768
1769 c2x The next version of the ISO C standard, still under
1770 development. The support for this version is experimental and
1771 incomplete.
1772
1773 gnu90
1774 gnu89
1775 GNU dialect of ISO C90 (including some C99 features).
1776
1777 gnu99
1778 gnu9x
1779 GNU dialect of ISO C99. The name gnu9x is deprecated.
1780
1781 gnu11
1782 gnu1x
1783 GNU dialect of ISO C11. The name gnu1x is deprecated.
1784
1785 gnu17
1786 gnu18
1787 GNU dialect of ISO C17. This is the default for C code.
1788
1789 gnu2x
1790 The next version of the ISO C standard, still under
1791 development, plus GNU extensions. The support for this version
1792 is experimental and incomplete.
1793
1794 c++98
1795 c++03
1796 The 1998 ISO C++ standard plus the 2003 technical corrigendum
1797 and some additional defect reports. Same as -ansi for C++ code.
1798
1799 gnu++98
1800 gnu++03
1801 GNU dialect of -std=c++98.
1802
1803 c++11
1804 c++0x
1805 The 2011 ISO C++ standard plus amendments. The name c++0x is
1806 deprecated.
1807
1808 gnu++11
1809 gnu++0x
1810 GNU dialect of -std=c++11. The name gnu++0x is deprecated.
1811
1812 c++14
1813 c++1y
1814 The 2014 ISO C++ standard plus amendments. The name c++1y is
1815 deprecated.
1816
1817 gnu++14
1818 gnu++1y
1819 GNU dialect of -std=c++14. The name gnu++1y is deprecated.
1820
1821 c++17
1822 c++1z
1823 The 2017 ISO C++ standard plus amendments. The name c++1z is
1824 deprecated.
1825
1826 gnu++17
1827 gnu++1z
1828 GNU dialect of -std=c++17. This is the default for C++ code.
1829 The name gnu++1z is deprecated.
1830
1831 c++20
1832 c++2a
1833 The 2020 ISO C++ standard plus amendments. Support is
1834 experimental, and could change in incompatible ways in future
1835 releases. The name c++2a is deprecated.
1836
1837 gnu++20
1838 gnu++2a
1839 GNU dialect of -std=c++20. Support is experimental, and could
1840 change in incompatible ways in future releases. The name
1841 gnu++2a is deprecated.
1842
1843 c++2b
1844 c++23
1845 The next revision of the ISO C++ standard, planned for 2023.
1846 Support is highly experimental, and will almost certainly
1847 change in incompatible ways in future releases.
1848
1849 gnu++2b
1850 gnu++23
1851 GNU dialect of -std=c++2b. Support is highly experimental, and
1852 will almost certainly change in incompatible ways in future
1853 releases.
1854
1855 -aux-info filename
1856 Output to the given filename prototyped declarations for all
1857 functions declared and/or defined in a translation unit, including
1858 those in header files. This option is silently ignored in any
1859 language other than C.
1860
1861 Besides declarations, the file indicates, in comments, the origin
1862 of each declaration (source file and line), whether the declaration
1863 was implicit, prototyped or unprototyped (I, N for new or O for
1864 old, respectively, in the first character after the line number and
1865 the colon), and whether it came from a declaration or a definition
1866 (C or F, respectively, in the following character). In the case of
1867 function definitions, a K&R-style list of arguments followed by
1868 their declarations is also provided, inside comments, after the
1869 declaration.
1870
1871 -fallow-parameterless-variadic-functions
1872 Accept variadic functions without named parameters.
1873
1874 Although it is possible to define such a function, this is not very
1875 useful as it is not possible to read the arguments. This is only
1876 supported for C as this construct is allowed by C++.
1877
1878 -fno-asm
1879 Do not recognize "asm", "inline" or "typeof" as a keyword, so that
1880 code can use these words as identifiers. You can use the keywords
1881 "__asm__", "__inline__" and "__typeof__" instead. In C, -ansi
1882 implies -fno-asm.
1883
1884 In C++, "inline" is a standard keyword and is not affected by this
1885 switch. You may want to use the -fno-gnu-keywords flag instead,
1886 which disables "typeof" but not "asm" and "inline". In C99 mode
1887 (-std=c99 or -std=gnu99), this switch only affects the "asm" and
1888 "typeof" keywords, since "inline" is a standard keyword in ISO C99.
1889
1890 -fno-builtin
1891 -fno-builtin-function
1892 Don't recognize built-in functions that do not begin with
1893 __builtin_ as prefix.
1894
1895 GCC normally generates special code to handle certain built-in
1896 functions more efficiently; for instance, calls to "alloca" may
1897 become single instructions which adjust the stack directly, and
1898 calls to "memcpy" may become inline copy loops. The resulting code
1899 is often both smaller and faster, but since the function calls no
1900 longer appear as such, you cannot set a breakpoint on those calls,
1901 nor can you change the behavior of the functions by linking with a
1902 different library. In addition, when a function is recognized as a
1903 built-in function, GCC may use information about that function to
1904 warn about problems with calls to that function, or to generate
1905 more efficient code, even if the resulting code still contains
1906 calls to that function. For example, warnings are given with
1907 -Wformat for bad calls to "printf" when "printf" is built in and
1908 "strlen" is known not to modify global memory.
1909
1910 With the -fno-builtin-function option only the built-in function
1911 function is disabled. function must not begin with __builtin_. If
1912 a function is named that is not built-in in this version of GCC,
1913 this option is ignored. There is no corresponding
1914 -fbuiltin-function option; if you wish to enable built-in functions
1915 selectively when using -fno-builtin or -ffreestanding, you may
1916 define macros such as:
1917
1918 #define abs(n) __builtin_abs ((n))
1919 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1920
1921 -fcond-mismatch
1922 Allow conditional expressions with mismatched types in the second
1923 and third arguments. The value of such an expression is void.
1924 This option is not supported for C++.
1925
1926 -ffreestanding
1927 Assert that compilation targets a freestanding environment. This
1928 implies -fno-builtin. A freestanding environment is one in which
1929 the standard library may not exist, and program startup may not
1930 necessarily be at "main". The most obvious example is an OS
1931 kernel. This is equivalent to -fno-hosted.
1932
1933 -fgimple
1934 Enable parsing of function definitions marked with "__GIMPLE".
1935 This is an experimental feature that allows unit testing of GIMPLE
1936 passes.
1937
1938 -fgnu-tm
1939 When the option -fgnu-tm is specified, the compiler generates code
1940 for the Linux variant of Intel's current Transactional Memory ABI
1941 specification document (Revision 1.1, May 6 2009). This is an
1942 experimental feature whose interface may change in future versions
1943 of GCC, as the official specification changes. Please note that
1944 not all architectures are supported for this feature.
1945
1946 For more information on GCC's support for transactional memory,
1947
1948 Note that the transactional memory feature is not supported with
1949 non-call exceptions (-fnon-call-exceptions).
1950
1951 -fgnu89-inline
1952 The option -fgnu89-inline tells GCC to use the traditional GNU
1953 semantics for "inline" functions when in C99 mode.
1954
1955 Using this option is roughly equivalent to adding the "gnu_inline"
1956 function attribute to all inline functions.
1957
1958 The option -fno-gnu89-inline explicitly tells GCC to use the C99
1959 semantics for "inline" when in C99 or gnu99 mode (i.e., it
1960 specifies the default behavior). This option is not supported in
1961 -std=c90 or -std=gnu90 mode.
1962
1963 The preprocessor macros "__GNUC_GNU_INLINE__" and
1964 "__GNUC_STDC_INLINE__" may be used to check which semantics are in
1965 effect for "inline" functions.
1966
1967 -fhosted
1968 Assert that compilation targets a hosted environment. This implies
1969 -fbuiltin. A hosted environment is one in which the entire
1970 standard library is available, and in which "main" has a return
1971 type of "int". Examples are nearly everything except a kernel.
1972 This is equivalent to -fno-freestanding.
1973
1974 -flax-vector-conversions
1975 Allow implicit conversions between vectors with differing numbers
1976 of elements and/or incompatible element types. This option should
1977 not be used for new code.
1978
1979 -fms-extensions
1980 Accept some non-standard constructs used in Microsoft header files.
1981
1982 In C++ code, this allows member names in structures to be similar
1983 to previous types declarations.
1984
1985 typedef int UOW;
1986 struct ABC {
1987 UOW UOW;
1988 };
1989
1990 Some cases of unnamed fields in structures and unions are only
1991 accepted with this option.
1992
1993 Note that this option is off for all targets except for x86 targets
1994 using ms-abi.
1995
1996 -foffload=disable
1997 -foffload=default
1998 -foffload=target-list
1999 Specify for which OpenMP and OpenACC offload targets code should be
2000 generated. The default behavior, equivalent to -foffload=default,
2001 is to generate code for all supported offload targets. The
2002 -foffload=disable form generates code only for the host fallback,
2003 while -foffload=target-list generates code only for the specified
2004 comma-separated list of offload targets.
2005
2006 Offload targets are specified in GCC's internal target-triplet
2007 format. You can run the compiler with -v to show the list of
2008 configured offload targets under "OFFLOAD_TARGET_NAMES".
2009
2010 -foffload-options=options
2011 -foffload-options=target-triplet-list=options
2012 With -foffload-options=options, GCC passes the specified options to
2013 the compilers for all enabled offloading targets. You can specify
2014 options that apply only to a specific target or targets by using
2015 the -foffload-options=target-list=options form. The target-list is
2016 a comma-separated list in the same format as for the -foffload=
2017 option.
2018
2019 Typical command lines are
2020
2021 -foffload-options=-lgfortran -foffload-options=-lm
2022 -foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic
2023 -foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm
2024
2025 -fopenacc
2026 Enable handling of OpenACC directives "#pragma acc" in C/C++ and
2027 "!$acc" in Fortran. When -fopenacc is specified, the compiler
2028 generates accelerated code according to the OpenACC Application
2029 Programming Interface v2.6 <https://www.openacc.org>. This option
2030 implies -pthread, and thus is only supported on targets that have
2031 support for -pthread.
2032
2033 -fopenacc-dim=geom
2034 Specify default compute dimensions for parallel offload regions
2035 that do not explicitly specify. The geom value is a triple of
2036 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A
2037 size can be omitted, to use a target-specific default value.
2038
2039 -fopenmp
2040 Enable handling of OpenMP directives "#pragma omp" in C/C++ and
2041 "!$omp" in Fortran. When -fopenmp is specified, the compiler
2042 generates parallel code according to the OpenMP Application Program
2043 Interface v4.5 <https://www.openmp.org>. This option implies
2044 -pthread, and thus is only supported on targets that have support
2045 for -pthread. -fopenmp implies -fopenmp-simd.
2046
2047 -fopenmp-simd
2048 Enable handling of OpenMP's SIMD directives with "#pragma omp" in
2049 C/C++ and "!$omp" in Fortran. Other OpenMP directives are ignored.
2050
2051 -fpermitted-flt-eval-methods=style
2052 ISO/IEC TS 18661-3 defines new permissible values for
2053 "FLT_EVAL_METHOD" that indicate that operations and constants with
2054 a semantic type that is an interchange or extended format should be
2055 evaluated to the precision and range of that type. These new
2056 values are a superset of those permitted under C99/C11, which does
2057 not specify the meaning of other positive values of
2058 "FLT_EVAL_METHOD". As such, code conforming to C11 may not have
2059 been written expecting the possibility of the new values.
2060
2061 -fpermitted-flt-eval-methods specifies whether the compiler should
2062 allow only the values of "FLT_EVAL_METHOD" specified in C99/C11, or
2063 the extended set of values specified in ISO/IEC TS 18661-3.
2064
2065 style is either "c11" or "ts-18661-3" as appropriate.
2066
2067 The default when in a standards compliant mode (-std=c11 or
2068 similar) is -fpermitted-flt-eval-methods=c11. The default when in
2069 a GNU dialect (-std=gnu11 or similar) is
2070 -fpermitted-flt-eval-methods=ts-18661-3.
2071
2072 -fplan9-extensions
2073 Accept some non-standard constructs used in Plan 9 code.
2074
2075 This enables -fms-extensions, permits passing pointers to
2076 structures with anonymous fields to functions that expect pointers
2077 to elements of the type of the field, and permits referring to
2078 anonymous fields declared using a typedef. This is only
2079 supported for C, not C++.
2080
2081 -fsigned-bitfields
2082 -funsigned-bitfields
2083 -fno-signed-bitfields
2084 -fno-unsigned-bitfields
2085 These options control whether a bit-field is signed or unsigned,
2086 when the declaration does not use either "signed" or "unsigned".
2087 By default, such a bit-field is signed, because this is consistent:
2088 the basic integer types such as "int" are signed types.
2089
2090 -fsigned-char
2091 Let the type "char" be signed, like "signed char".
2092
2093 Note that this is equivalent to -fno-unsigned-char, which is the
2094 negative form of -funsigned-char. Likewise, the option
2095 -fno-signed-char is equivalent to -funsigned-char.
2096
2097 -funsigned-char
2098 Let the type "char" be unsigned, like "unsigned char".
2099
2100 Each kind of machine has a default for what "char" should be. It
2101 is either like "unsigned char" by default or like "signed char" by
2102 default.
2103
2104 Ideally, a portable program should always use "signed char" or
2105 "unsigned char" when it depends on the signedness of an object.
2106 But many programs have been written to use plain "char" and expect
2107 it to be signed, or expect it to be unsigned, depending on the
2108 machines they were written for. This option, and its inverse, let
2109 you make such a program work with the opposite default.
2110
2111 The type "char" is always a distinct type from each of "signed
2112 char" or "unsigned char", even though its behavior is always just
2113 like one of those two.
2114
2115 -fsso-struct=endianness
2116 Set the default scalar storage order of structures and unions to
2117 the specified endianness. The accepted values are big-endian,
2118 little-endian and native for the native endianness of the target
2119 (the default). This option is not supported for C++.
2120
2121 Warning: the -fsso-struct switch causes GCC to generate code that
2122 is not binary compatible with code generated without it if the
2123 specified endianness is not the native endianness of the target.
2124
2125 Options Controlling C++ Dialect
2126 This section describes the command-line options that are only
2127 meaningful for C++ programs. You can also use most of the GNU compiler
2128 options regardless of what language your program is in. For example,
2129 you might compile a file firstClass.C like this:
2130
2131 g++ -g -fstrict-enums -O -c firstClass.C
2132
2133 In this example, only -fstrict-enums is an option meant only for C++
2134 programs; you can use the other options with any language supported by
2135 GCC.
2136
2137 Some options for compiling C programs, such as -std, are also relevant
2138 for C++ programs.
2139
2140 Here is a list of options that are only for compiling C++ programs:
2141
2142 -fabi-version=n
2143 Use version n of the C++ ABI. The default is version 0.
2144
2145 Version 0 refers to the version conforming most closely to the C++
2146 ABI specification. Therefore, the ABI obtained using version 0
2147 will change in different versions of G++ as ABI bugs are fixed.
2148
2149 Version 1 is the version of the C++ ABI that first appeared in G++
2150 3.2.
2151
2152 Version 2 is the version of the C++ ABI that first appeared in G++
2153 3.4, and was the default through G++ 4.9.
2154
2155 Version 3 corrects an error in mangling a constant address as a
2156 template argument.
2157
2158 Version 4, which first appeared in G++ 4.5, implements a standard
2159 mangling for vector types.
2160
2161 Version 5, which first appeared in G++ 4.6, corrects the mangling
2162 of attribute const/volatile on function pointer types, decltype of
2163 a plain decl, and use of a function parameter in the declaration of
2164 another parameter.
2165
2166 Version 6, which first appeared in G++ 4.7, corrects the promotion
2167 behavior of C++11 scoped enums and the mangling of template
2168 argument packs, const/static_cast, prefix ++ and --, and a class
2169 scope function used as a template argument.
2170
2171 Version 7, which first appeared in G++ 4.8, that treats nullptr_t
2172 as a builtin type and corrects the mangling of lambdas in default
2173 argument scope.
2174
2175 Version 8, which first appeared in G++ 4.9, corrects the
2176 substitution behavior of function types with function-cv-
2177 qualifiers.
2178
2179 Version 9, which first appeared in G++ 5.2, corrects the alignment
2180 of "nullptr_t".
2181
2182 Version 10, which first appeared in G++ 6.1, adds mangling of
2183 attributes that affect type identity, such as ia32 calling
2184 convention attributes (e.g. stdcall).
2185
2186 Version 11, which first appeared in G++ 7, corrects the mangling of
2187 sizeof... expressions and operator names. For multiple entities
2188 with the same name within a function, that are declared in
2189 different scopes, the mangling now changes starting with the
2190 twelfth occurrence. It also implies -fnew-inheriting-ctors.
2191
2192 Version 12, which first appeared in G++ 8, corrects the calling
2193 conventions for empty classes on the x86_64 target and for classes
2194 with only deleted copy/move constructors. It accidentally changes
2195 the calling convention for classes with a deleted copy constructor
2196 and a trivial move constructor.
2197
2198 Version 13, which first appeared in G++ 8.2, fixes the accidental
2199 change in version 12.
2200
2201 Version 14, which first appeared in G++ 10, corrects the mangling
2202 of the nullptr expression.
2203
2204 Version 15, which first appeared in G++ 11, changes the mangling of
2205 "__alignof__" to be distinct from that of "alignof", and dependent
2206 operator names.
2207
2208 See also -Wabi.
2209
2210 -fabi-compat-version=n
2211 On targets that support strong aliases, G++ works around mangling
2212 changes by creating an alias with the correct mangled name when
2213 defining a symbol with an incorrect mangled name. This switch
2214 specifies which ABI version to use for the alias.
2215
2216 With -fabi-version=0 (the default), this defaults to 11 (GCC 7
2217 compatibility). If another ABI version is explicitly selected,
2218 this defaults to 0. For compatibility with GCC versions 3.2
2219 through 4.9, use -fabi-compat-version=2.
2220
2221 If this option is not provided but -Wabi=n is, that version is used
2222 for compatibility aliases. If this option is provided along with
2223 -Wabi (without the version), the version from this option is used
2224 for the warning.
2225
2226 -fno-access-control
2227 Turn off all access checking. This switch is mainly useful for
2228 working around bugs in the access control code.
2229
2230 -faligned-new
2231 Enable support for C++17 "new" of types that require more alignment
2232 than "void* ::operator new(std::size_t)" provides. A numeric
2233 argument such as "-faligned-new=32" can be used to specify how much
2234 alignment (in bytes) is provided by that function, but few users
2235 will need to override the default of "alignof(std::max_align_t)".
2236
2237 This flag is enabled by default for -std=c++17.
2238
2239 -fchar8_t
2240 -fno-char8_t
2241 Enable support for "char8_t" as adopted for C++20. This includes
2242 the addition of a new "char8_t" fundamental type, changes to the
2243 types of UTF-8 string and character literals, new signatures for
2244 user-defined literals, associated standard library updates, and new
2245 "__cpp_char8_t" and "__cpp_lib_char8_t" feature test macros.
2246
2247 This option enables functions to be overloaded for ordinary and
2248 UTF-8 strings:
2249
2250 int f(const char *); // #1
2251 int f(const char8_t *); // #2
2252 int v1 = f("text"); // Calls #1
2253 int v2 = f(u8"text"); // Calls #2
2254
2255 and introduces new signatures for user-defined literals:
2256
2257 int operator""_udl1(char8_t);
2258 int v3 = u8'x'_udl1;
2259 int operator""_udl2(const char8_t*, std::size_t);
2260 int v4 = u8"text"_udl2;
2261 template<typename T, T...> int operator""_udl3();
2262 int v5 = u8"text"_udl3;
2263
2264 The change to the types of UTF-8 string and character literals
2265 introduces incompatibilities with ISO C++11 and later standards.
2266 For example, the following code is well-formed under ISO C++11, but
2267 is ill-formed when -fchar8_t is specified.
2268
2269 char ca[] = u8"xx"; // error: char-array initialized from wide
2270 // string
2271 const char *cp = u8"xx";// error: invalid conversion from
2272 // `const char8_t*' to `const char*'
2273 int f(const char*);
2274 auto v = f(u8"xx"); // error: invalid conversion from
2275 // `const char8_t*' to `const char*'
2276 std::string s{u8"xx"}; // error: no matching function for call to
2277 // `std::basic_string<char>::basic_string()'
2278 using namespace std::literals;
2279 s = u8"xx"s; // error: conversion from
2280 // `basic_string<char8_t>' to non-scalar
2281 // type `basic_string<char>' requested
2282
2283 -fcheck-new
2284 Check that the pointer returned by "operator new" is non-null
2285 before attempting to modify the storage allocated. This check is
2286 normally unnecessary because the C++ standard specifies that
2287 "operator new" only returns 0 if it is declared "throw()", in which
2288 case the compiler always checks the return value even without this
2289 option. In all other cases, when "operator new" has a non-empty
2290 exception specification, memory exhaustion is signalled by throwing
2291 "std::bad_alloc". See also new (nothrow).
2292
2293 -fconcepts
2294 -fconcepts-ts
2295 Below -std=c++20, -fconcepts enables support for the C++ Extensions
2296 for Concepts Technical Specification, ISO 19217 (2015).
2297
2298 With -std=c++20 and above, Concepts are part of the language
2299 standard, so -fconcepts defaults to on. But the standard
2300 specification of Concepts differs significantly from the TS, so
2301 some constructs that were allowed in the TS but didn't make it into
2302 the standard can still be enabled by -fconcepts-ts.
2303
2304 -fconstexpr-depth=n
2305 Set the maximum nested evaluation depth for C++11 constexpr
2306 functions to n. A limit is needed to detect endless recursion
2307 during constant expression evaluation. The minimum specified by
2308 the standard is 512.
2309
2310 -fconstexpr-cache-depth=n
2311 Set the maximum level of nested evaluation depth for C++11
2312 constexpr functions that will be cached to n. This is a heuristic
2313 that trades off compilation speed (when the cache avoids repeated
2314 calculations) against memory consumption (when the cache grows very
2315 large from highly recursive evaluations). The default is 8. Very
2316 few users are likely to want to adjust it, but if your code does
2317 heavy constexpr calculations you might want to experiment to find
2318 which value works best for you.
2319
2320 -fconstexpr-fp-except
2321 Annex F of the C standard specifies that IEC559 floating point
2322 exceptions encountered at compile time should not stop compilation.
2323 C++ compilers have historically not followed this guidance, instead
2324 treating floating point division by zero as non-constant even
2325 though it has a well defined value. This flag tells the compiler
2326 to give Annex F priority over other rules saying that a particular
2327 operation is undefined.
2328
2329 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
2330
2331 -fconstexpr-loop-limit=n
2332 Set the maximum number of iterations for a loop in C++14 constexpr
2333 functions to n. A limit is needed to detect infinite loops during
2334 constant expression evaluation. The default is 262144 (1<<18).
2335
2336 -fconstexpr-ops-limit=n
2337 Set the maximum number of operations during a single constexpr
2338 evaluation. Even when number of iterations of a single loop is
2339 limited with the above limit, if there are several nested loops and
2340 each of them has many iterations but still smaller than the above
2341 limit, or if in a body of some loop or even outside of a loop too
2342 many expressions need to be evaluated, the resulting constexpr
2343 evaluation might take too long. The default is 33554432 (1<<25).
2344
2345 -fcoroutines
2346 Enable support for the C++ coroutines extension (experimental).
2347
2348 -fno-elide-constructors
2349 The C++ standard allows an implementation to omit creating a
2350 temporary that is only used to initialize another object of the
2351 same type. Specifying this option disables that optimization, and
2352 forces G++ to call the copy constructor in all cases. This option
2353 also causes G++ to call trivial member functions which otherwise
2354 would be expanded inline.
2355
2356 In C++17, the compiler is required to omit these temporaries, but
2357 this option still affects trivial member functions.
2358
2359 -fno-enforce-eh-specs
2360 Don't generate code to check for violation of exception
2361 specifications at run time. This option violates the C++ standard,
2362 but may be useful for reducing code size in production builds, much
2363 like defining "NDEBUG". This does not give user code permission to
2364 throw exceptions in violation of the exception specifications; the
2365 compiler still optimizes based on the specifications, so throwing
2366 an unexpected exception results in undefined behavior at run time.
2367
2368 -fextern-tls-init
2369 -fno-extern-tls-init
2370 The C++11 and OpenMP standards allow "thread_local" and
2371 "threadprivate" variables to have dynamic (runtime) initialization.
2372 To support this, any use of such a variable goes through a wrapper
2373 function that performs any necessary initialization. When the use
2374 and definition of the variable are in the same translation unit,
2375 this overhead can be optimized away, but when the use is in a
2376 different translation unit there is significant overhead even if
2377 the variable doesn't actually need dynamic initialization. If the
2378 programmer can be sure that no use of the variable in a non-
2379 defining TU needs to trigger dynamic initialization (either because
2380 the variable is statically initialized, or a use of the variable in
2381 the defining TU will be executed before any uses in another TU),
2382 they can avoid this overhead with the -fno-extern-tls-init option.
2383
2384 On targets that support symbol aliases, the default is
2385 -fextern-tls-init. On targets that do not support symbol aliases,
2386 the default is -fno-extern-tls-init.
2387
2388 -ffold-simple-inlines
2389 -fno-fold-simple-inlines
2390 Permit the C++ frontend to fold calls to "std::move",
2391 "std::forward", "std::addressof" and "std::as_const". In contrast
2392 to inlining, this means no debug information will be generated for
2393 such calls. Since these functions are rarely interesting to debug,
2394 this flag is enabled by default unless -fno-inline is active.
2395
2396 -fno-gnu-keywords
2397 Do not recognize "typeof" as a keyword, so that code can use this
2398 word as an identifier. You can use the keyword "__typeof__"
2399 instead. This option is implied by the strict ISO C++ dialects:
2400 -ansi, -std=c++98, -std=c++11, etc.
2401
2402 -fimplicit-constexpr
2403 Make inline functions implicitly constexpr, if they satisfy the
2404 requirements for a constexpr function. This option can be used in
2405 C++14 mode or later. This can result in initialization changing
2406 from dynamic to static and other optimizations.
2407
2408 -fno-implicit-templates
2409 Never emit code for non-inline templates that are instantiated
2410 implicitly (i.e. by use); only emit code for explicit
2411 instantiations. If you use this option, you must take care to
2412 structure your code to include all the necessary explicit
2413 instantiations to avoid getting undefined symbols at link time.
2414
2415 -fno-implicit-inline-templates
2416 Don't emit code for implicit instantiations of inline templates,
2417 either. The default is to handle inlines differently so that
2418 compiles with and without optimization need the same set of
2419 explicit instantiations.
2420
2421 -fno-implement-inlines
2422 To save space, do not emit out-of-line copies of inline functions
2423 controlled by "#pragma implementation". This causes linker errors
2424 if these functions are not inlined everywhere they are called.
2425
2426 -fmodules-ts
2427 -fno-modules-ts
2428 Enable support for C++20 modules. The -fno-modules-ts is usually
2429 not needed, as that is the default. Even though this is a C++20
2430 feature, it is not currently implicitly enabled by selecting that
2431 standard version.
2432
2433 -fmodule-header
2434 -fmodule-header=user
2435 -fmodule-header=system
2436 Compile a header file to create an importable header unit.
2437
2438 -fmodule-implicit-inline
2439 Member functions defined in their class definitions are not
2440 implicitly inline for modular code. This is different to
2441 traditional C++ behavior, for good reasons. However, it may result
2442 in a difficulty during code porting. This option makes such
2443 function definitions implicitly inline. It does however generate
2444 an ABI incompatibility, so you must use it everywhere or nowhere.
2445 (Such definitions outside of a named module remain implicitly
2446 inline, regardless.)
2447
2448 -fno-module-lazy
2449 Disable lazy module importing and module mapper creation.
2450
2451 -fmodule-mapper=[hostname]:port[?ident]
2452 -fmodule-mapper=|program[?ident] args...
2453 -fmodule-mapper==socket[?ident]
2454 -fmodule-mapper=<>[inout][?ident]
2455 -fmodule-mapper=<in>out[?ident]
2456 -fmodule-mapper=file[?ident]
2457 An oracle to query for module name to filename mappings. If
2458 unspecified the CXX_MODULE_MAPPER environment variable is used, and
2459 if that is unset, an in-process default is provided.
2460
2461 -fmodule-only
2462 Only emit the Compiled Module Interface, inhibiting any object
2463 file.
2464
2465 -fms-extensions
2466 Disable Wpedantic warnings about constructs used in MFC, such as
2467 implicit int and getting a pointer to member function via non-
2468 standard syntax.
2469
2470 -fnew-inheriting-ctors
2471 Enable the P0136 adjustment to the semantics of C++11 constructor
2472 inheritance. This is part of C++17 but also considered to be a
2473 Defect Report against C++11 and C++14. This flag is enabled by
2474 default unless -fabi-version=10 or lower is specified.
2475
2476 -fnew-ttp-matching
2477 Enable the P0522 resolution to Core issue 150, template template
2478 parameters and default arguments: this allows a template with
2479 default template arguments as an argument for a template template
2480 parameter with fewer template parameters. This flag is enabled by
2481 default for -std=c++17.
2482
2483 -fno-nonansi-builtins
2484 Disable built-in declarations of functions that are not mandated by
2485 ANSI/ISO C. These include "ffs", "alloca", "_exit", "index",
2486 "bzero", "conjf", and other related functions.
2487
2488 -fnothrow-opt
2489 Treat a "throw()" exception specification as if it were a
2490 "noexcept" specification to reduce or eliminate the text size
2491 overhead relative to a function with no exception specification.
2492 If the function has local variables of types with non-trivial
2493 destructors, the exception specification actually makes the
2494 function smaller because the EH cleanups for those variables can be
2495 optimized away. The semantic effect is that an exception thrown
2496 out of a function with such an exception specification results in a
2497 call to "terminate" rather than "unexpected".
2498
2499 -fno-operator-names
2500 Do not treat the operator name keywords "and", "bitand", "bitor",
2501 "compl", "not", "or" and "xor" as synonyms as keywords.
2502
2503 -fno-optional-diags
2504 Disable diagnostics that the standard says a compiler does not need
2505 to issue. Currently, the only such diagnostic issued by G++ is the
2506 one for a name having multiple meanings within a class.
2507
2508 -fpermissive
2509 Downgrade some diagnostics about nonconformant code from errors to
2510 warnings. Thus, using -fpermissive allows some nonconforming code
2511 to compile.
2512
2513 -fno-pretty-templates
2514 When an error message refers to a specialization of a function
2515 template, the compiler normally prints the signature of the
2516 template followed by the template arguments and any typedefs or
2517 typenames in the signature (e.g. "void f(T) [with T = int]" rather
2518 than "void f(int)") so that it's clear which template is involved.
2519 When an error message refers to a specialization of a class
2520 template, the compiler omits any template arguments that match the
2521 default template arguments for that template. If either of these
2522 behaviors make it harder to understand the error message rather
2523 than easier, you can use -fno-pretty-templates to disable them.
2524
2525 -fno-rtti
2526 Disable generation of information about every class with virtual
2527 functions for use by the C++ run-time type identification features
2528 ("dynamic_cast" and "typeid"). If you don't use those parts of the
2529 language, you can save some space by using this flag. Note that
2530 exception handling uses the same information, but G++ generates it
2531 as needed. The "dynamic_cast" operator can still be used for casts
2532 that do not require run-time type information, i.e. casts to "void
2533 *" or to unambiguous base classes.
2534
2535 Mixing code compiled with -frtti with that compiled with -fno-rtti
2536 may not work. For example, programs may fail to link if a class
2537 compiled with -fno-rtti is used as a base for a class compiled with
2538 -frtti.
2539
2540 -fsized-deallocation
2541 Enable the built-in global declarations
2542
2543 void operator delete (void *, std::size_t) noexcept;
2544 void operator delete[] (void *, std::size_t) noexcept;
2545
2546 as introduced in C++14. This is useful for user-defined
2547 replacement deallocation functions that, for example, use the size
2548 of the object to make deallocation faster. Enabled by default
2549 under -std=c++14 and above. The flag -Wsized-deallocation warns
2550 about places that might want to add a definition.
2551
2552 -fstrict-enums
2553 Allow the compiler to optimize using the assumption that a value of
2554 enumerated type can only be one of the values of the enumeration
2555 (as defined in the C++ standard; basically, a value that can be
2556 represented in the minimum number of bits needed to represent all
2557 the enumerators). This assumption may not be valid if the program
2558 uses a cast to convert an arbitrary integer value to the enumerated
2559 type.
2560
2561 -fstrong-eval-order
2562 Evaluate member access, array subscripting, and shift expressions
2563 in left-to-right order, and evaluate assignment in right-to-left
2564 order, as adopted for C++17. Enabled by default with -std=c++17.
2565 -fstrong-eval-order=some enables just the ordering of member access
2566 and shift expressions, and is the default without -std=c++17.
2567
2568 -ftemplate-backtrace-limit=n
2569 Set the maximum number of template instantiation notes for a single
2570 warning or error to n. The default value is 10.
2571
2572 -ftemplate-depth=n
2573 Set the maximum instantiation depth for template classes to n. A
2574 limit on the template instantiation depth is needed to detect
2575 endless recursions during template class instantiation. ANSI/ISO
2576 C++ conforming programs must not rely on a maximum depth greater
2577 than 17 (changed to 1024 in C++11). The default value is 900, as
2578 the compiler can run out of stack space before hitting 1024 in some
2579 situations.
2580
2581 -fno-threadsafe-statics
2582 Do not emit the extra code to use the routines specified in the C++
2583 ABI for thread-safe initialization of local statics. You can use
2584 this option to reduce code size slightly in code that doesn't need
2585 to be thread-safe.
2586
2587 -fuse-cxa-atexit
2588 Register destructors for objects with static storage duration with
2589 the "__cxa_atexit" function rather than the "atexit" function.
2590 This option is required for fully standards-compliant handling of
2591 static destructors, but only works if your C library supports
2592 "__cxa_atexit".
2593
2594 -fno-use-cxa-get-exception-ptr
2595 Don't use the "__cxa_get_exception_ptr" runtime routine. This
2596 causes "std::uncaught_exception" to be incorrect, but is necessary
2597 if the runtime routine is not available.
2598
2599 -fvisibility-inlines-hidden
2600 This switch declares that the user does not attempt to compare
2601 pointers to inline functions or methods where the addresses of the
2602 two functions are taken in different shared objects.
2603
2604 The effect of this is that GCC may, effectively, mark inline
2605 methods with "__attribute__ ((visibility ("hidden")))" so that they
2606 do not appear in the export table of a DSO and do not require a PLT
2607 indirection when used within the DSO. Enabling this option can
2608 have a dramatic effect on load and link times of a DSO as it
2609 massively reduces the size of the dynamic export table when the
2610 library makes heavy use of templates.
2611
2612 The behavior of this switch is not quite the same as marking the
2613 methods as hidden directly, because it does not affect static
2614 variables local to the function or cause the compiler to deduce
2615 that the function is defined in only one shared object.
2616
2617 You may mark a method as having a visibility explicitly to negate
2618 the effect of the switch for that method. For example, if you do
2619 want to compare pointers to a particular inline method, you might
2620 mark it as having default visibility. Marking the enclosing class
2621 with explicit visibility has no effect.
2622
2623 Explicitly instantiated inline methods are unaffected by this
2624 option as their linkage might otherwise cross a shared library
2625 boundary.
2626
2627 -fvisibility-ms-compat
2628 This flag attempts to use visibility settings to make GCC's C++
2629 linkage model compatible with that of Microsoft Visual Studio.
2630
2631 The flag makes these changes to GCC's linkage model:
2632
2633 1. It sets the default visibility to "hidden", like
2634 -fvisibility=hidden.
2635
2636 2. Types, but not their members, are not hidden by default.
2637
2638 3. The One Definition Rule is relaxed for types without explicit
2639 visibility specifications that are defined in more than one
2640 shared object: those declarations are permitted if they are
2641 permitted when this option is not used.
2642
2643 In new code it is better to use -fvisibility=hidden and export
2644 those classes that are intended to be externally visible.
2645 Unfortunately it is possible for code to rely, perhaps
2646 accidentally, on the Visual Studio behavior.
2647
2648 Among the consequences of these changes are that static data
2649 members of the same type with the same name but defined in
2650 different shared objects are different, so changing one does not
2651 change the other; and that pointers to function members defined in
2652 different shared objects may not compare equal. When this flag is
2653 given, it is a violation of the ODR to define types with the same
2654 name differently.
2655
2656 -fno-weak
2657 Do not use weak symbol support, even if it is provided by the
2658 linker. By default, G++ uses weak symbols if they are available.
2659 This option exists only for testing, and should not be used by end-
2660 users; it results in inferior code and has no benefits. This
2661 option may be removed in a future release of G++.
2662
2663 -fext-numeric-literals (C++ and Objective-C++ only)
2664 Accept imaginary, fixed-point, or machine-defined literal number
2665 suffixes as GNU extensions. When this option is turned off these
2666 suffixes are treated as C++11 user-defined literal numeric
2667 suffixes. This is on by default for all pre-C++11 dialects and all
2668 GNU dialects: -std=c++98, -std=gnu++98, -std=gnu++11, -std=gnu++14.
2669 This option is off by default for ISO C++11 onwards (-std=c++11,
2670 ...).
2671
2672 -nostdinc++
2673 Do not search for header files in the standard directories specific
2674 to C++, but do still search the other standard directories. (This
2675 option is used when building the C++ library.)
2676
2677 -flang-info-include-translate
2678 -flang-info-include-translate-not
2679 -flang-info-include-translate=header
2680 Inform of include translation events. The first will note accepted
2681 include translations, the second will note declined include
2682 translations. The header form will inform of include translations
2683 relating to that specific header. If header is of the form "user"
2684 or "<system>" it will be resolved to a specific user or system
2685 header using the include path.
2686
2687 -flang-info-module-cmi
2688 -flang-info-module-cmi=module
2689 Inform of Compiled Module Interface pathnames. The first will note
2690 all read CMI pathnames. The module form will not reading a
2691 specific module's CMI. module may be a named module or a header-
2692 unit (the latter indicated by either being a pathname containing
2693 directory separators or enclosed in "<>" or "").
2694
2695 -stdlib=libstdc++,libc++
2696 When G++ is configured to support this option, it allows
2697 specification of alternate C++ runtime libraries. Two options are
2698 available: libstdc++ (the default, native C++ runtime for G++) and
2699 libc++ which is the C++ runtime installed on some operating systems
2700 (e.g. Darwin versions from Darwin11 onwards). The option switches
2701 G++ to use the headers from the specified library and to emit
2702 "-lstdc++" or "-lc++" respectively, when a C++ runtime is required
2703 for linking.
2704
2705 In addition, these warning options have meanings only for C++ programs:
2706
2707 -Wabi-tag (C++ and Objective-C++ only)
2708 Warn when a type with an ABI tag is used in a context that does not
2709 have that ABI tag. See C++ Attributes for more information about
2710 ABI tags.
2711
2712 -Wcomma-subscript (C++ and Objective-C++ only)
2713 Warn about uses of a comma expression within a subscripting
2714 expression. This usage was deprecated in C++20 and is going to be
2715 removed in C++23. However, a comma expression wrapped in "( )" is
2716 not deprecated. Example:
2717
2718 void f(int *a, int b, int c) {
2719 a[b,c]; // deprecated in C++20, invalid in C++23
2720 a[(b,c)]; // OK
2721 }
2722
2723 In C++23 it is valid to have comma separated expressions in a
2724 subscript when an overloaded subscript operator is found and
2725 supports the right number and types of arguments. G++ will accept
2726 the formerly valid syntax for code that is not valid in C++23 but
2727 used to be valid but deprecated in C++20 with a pedantic warning
2728 that can be disabled with -Wno-comma-subscript.
2729
2730 Enabled by default with -std=c++20 unless -Wno-deprecated, and with
2731 -std=c++23 regardless of -Wno-deprecated.
2732
2733 -Wctad-maybe-unsupported (C++ and Objective-C++ only)
2734 Warn when performing class template argument deduction (CTAD) on a
2735 type with no explicitly written deduction guides. This warning
2736 will point out cases where CTAD succeeded only because the compiler
2737 synthesized the implicit deduction guides, which might not be what
2738 the programmer intended. Certain style guides allow CTAD only on
2739 types that specifically "opt-in"; i.e., on types that are designed
2740 to support CTAD. This warning can be suppressed with the following
2741 pattern:
2742
2743 struct allow_ctad_t; // any name works
2744 template <typename T> struct S {
2745 S(T) { }
2746 };
2747 S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered
2748
2749 -Wctor-dtor-privacy (C++ and Objective-C++ only)
2750 Warn when a class seems unusable because all the constructors or
2751 destructors in that class are private, and it has neither friends
2752 nor public static member functions. Also warn if there are no non-
2753 private methods, and there's at least one private member function
2754 that isn't a constructor or destructor.
2755
2756 -Wdelete-non-virtual-dtor (C++ and Objective-C++ only)
2757 Warn when "delete" is used to destroy an instance of a class that
2758 has virtual functions and non-virtual destructor. It is unsafe to
2759 delete an instance of a derived class through a pointer to a base
2760 class if the base class does not have a virtual destructor. This
2761 warning is enabled by -Wall.
2762
2763 -Wdeprecated-copy (C++ and Objective-C++ only)
2764 Warn that the implicit declaration of a copy constructor or copy
2765 assignment operator is deprecated if the class has a user-provided
2766 copy constructor or copy assignment operator, in C++11 and up.
2767 This warning is enabled by -Wextra. With -Wdeprecated-copy-dtor,
2768 also deprecate if the class has a user-provided destructor.
2769
2770 -Wno-deprecated-enum-enum-conversion (C++ and Objective-C++ only)
2771 Disable the warning about the case when the usual arithmetic
2772 conversions are applied on operands where one is of enumeration
2773 type and the other is of a different enumeration type. This
2774 conversion was deprecated in C++20. For example:
2775
2776 enum E1 { e };
2777 enum E2 { f };
2778 int k = f - e;
2779
2780 -Wdeprecated-enum-enum-conversion is enabled by default with
2781 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2782 -Wenum-conversion.
2783
2784 -Wno-deprecated-enum-float-conversion (C++ and Objective-C++ only)
2785 Disable the warning about the case when the usual arithmetic
2786 conversions are applied on operands where one is of enumeration
2787 type and the other is of a floating-point type. This conversion
2788 was deprecated in C++20. For example:
2789
2790 enum E1 { e };
2791 enum E2 { f };
2792 bool b = e <= 3.7;
2793
2794 -Wdeprecated-enum-float-conversion is enabled by default with
2795 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2796 -Wenum-conversion.
2797
2798 -Wno-init-list-lifetime (C++ and Objective-C++ only)
2799 Do not warn about uses of "std::initializer_list" that are likely
2800 to result in dangling pointers. Since the underlying array for an
2801 "initializer_list" is handled like a normal C++ temporary object,
2802 it is easy to inadvertently keep a pointer to the array past the
2803 end of the array's lifetime. For example:
2804
2805 * If a function returns a temporary "initializer_list", or a
2806 local "initializer_list" variable, the array's lifetime ends at
2807 the end of the return statement, so the value returned has a
2808 dangling pointer.
2809
2810 * If a new-expression creates an "initializer_list", the array
2811 only lives until the end of the enclosing full-expression, so
2812 the "initializer_list" in the heap has a dangling pointer.
2813
2814 * When an "initializer_list" variable is assigned from a brace-
2815 enclosed initializer list, the temporary array created for the
2816 right side of the assignment only lives until the end of the
2817 full-expression, so at the next statement the
2818 "initializer_list" variable has a dangling pointer.
2819
2820 // li's initial underlying array lives as long as li
2821 std::initializer_list<int> li = { 1,2,3 };
2822 // assignment changes li to point to a temporary array
2823 li = { 4, 5 };
2824 // now the temporary is gone and li has a dangling pointer
2825 int i = li.begin()[0] // undefined behavior
2826
2827 * When a list constructor stores the "begin" pointer from the
2828 "initializer_list" argument, this doesn't extend the lifetime
2829 of the array, so if a class variable is constructed from a
2830 temporary "initializer_list", the pointer is left dangling by
2831 the end of the variable declaration statement.
2832
2833 -Winvalid-imported-macros
2834 Verify all imported macro definitions are valid at the end of
2835 compilation. This is not enabled by default, as it requires
2836 additional processing to determine. It may be useful when
2837 preparing sets of header-units to ensure consistent macros.
2838
2839 -Wno-literal-suffix (C++ and Objective-C++ only)
2840 Do not warn when a string or character literal is followed by a ud-
2841 suffix which does not begin with an underscore. As a conforming
2842 extension, GCC treats such suffixes as separate preprocessing
2843 tokens in order to maintain backwards compatibility with code that
2844 uses formatting macros from "<inttypes.h>". For example:
2845
2846 #define __STDC_FORMAT_MACROS
2847 #include <inttypes.h>
2848 #include <stdio.h>
2849
2850 int main() {
2851 int64_t i64 = 123;
2852 printf("My int64: %" PRId64"\n", i64);
2853 }
2854
2855 In this case, "PRId64" is treated as a separate preprocessing
2856 token.
2857
2858 This option also controls warnings when a user-defined literal
2859 operator is declared with a literal suffix identifier that doesn't
2860 begin with an underscore. Literal suffix identifiers that don't
2861 begin with an underscore are reserved for future standardization.
2862
2863 These warnings are enabled by default.
2864
2865 -Wno-narrowing (C++ and Objective-C++ only)
2866 For C++11 and later standards, narrowing conversions are diagnosed
2867 by default, as required by the standard. A narrowing conversion
2868 from a constant produces an error, and a narrowing conversion from
2869 a non-constant produces a warning, but -Wno-narrowing suppresses
2870 the diagnostic. Note that this does not affect the meaning of
2871 well-formed code; narrowing conversions are still considered ill-
2872 formed in SFINAE contexts.
2873
2874 With -Wnarrowing in C++98, warn when a narrowing conversion
2875 prohibited by C++11 occurs within { }, e.g.
2876
2877 int i = { 2.2 }; // error: narrowing from double to int
2878
2879 This flag is included in -Wall and -Wc++11-compat.
2880
2881 -Wnoexcept (C++ and Objective-C++ only)
2882 Warn when a noexcept-expression evaluates to false because of a
2883 call to a function that does not have a non-throwing exception
2884 specification (i.e. "throw()" or "noexcept") but is known by the
2885 compiler to never throw an exception.
2886
2887 -Wnoexcept-type (C++ and Objective-C++ only)
2888 Warn if the C++17 feature making "noexcept" part of a function type
2889 changes the mangled name of a symbol relative to C++14. Enabled by
2890 -Wabi and -Wc++17-compat.
2891
2892 As an example:
2893
2894 template <class T> void f(T t) { t(); };
2895 void g() noexcept;
2896 void h() { f(g); }
2897
2898 In C++14, "f" calls "f<void(*)()>", but in C++17 it calls
2899 "f<void(*)()noexcept>".
2900
2901 -Wclass-memaccess (C++ and Objective-C++ only)
2902 Warn when the destination of a call to a raw memory function such
2903 as "memset" or "memcpy" is an object of class type, and when
2904 writing into such an object might bypass the class non-trivial or
2905 deleted constructor or copy assignment, violate const-correctness
2906 or encapsulation, or corrupt virtual table pointers. Modifying the
2907 representation of such objects may violate invariants maintained by
2908 member functions of the class. For example, the call to "memset"
2909 below is undefined because it modifies a non-trivial class object
2910 and is, therefore, diagnosed. The safe way to either initialize or
2911 clear the storage of objects of such types is by using the
2912 appropriate constructor or assignment operator, if one is
2913 available.
2914
2915 std::string str = "abc";
2916 memset (&str, 0, sizeof str);
2917
2918 The -Wclass-memaccess option is enabled by -Wall. Explicitly
2919 casting the pointer to the class object to "void *" or to a type
2920 that can be safely accessed by the raw memory function suppresses
2921 the warning.
2922
2923 -Wnon-virtual-dtor (C++ and Objective-C++ only)
2924 Warn when a class has virtual functions and an accessible non-
2925 virtual destructor itself or in an accessible polymorphic base
2926 class, in which case it is possible but unsafe to delete an
2927 instance of a derived class through a pointer to the class itself
2928 or base class. This warning is automatically enabled if -Weffc++
2929 is specified.
2930
2931 -Wregister (C++ and Objective-C++ only)
2932 Warn on uses of the "register" storage class specifier, except when
2933 it is part of the GNU Explicit Register Variables extension. The
2934 use of the "register" keyword as storage class specifier has been
2935 deprecated in C++11 and removed in C++17. Enabled by default with
2936 -std=c++17.
2937
2938 -Wreorder (C++ and Objective-C++ only)
2939 Warn when the order of member initializers given in the code does
2940 not match the order in which they must be executed. For instance:
2941
2942 struct A {
2943 int i;
2944 int j;
2945 A(): j (0), i (1) { }
2946 };
2947
2948 The compiler rearranges the member initializers for "i" and "j" to
2949 match the declaration order of the members, emitting a warning to
2950 that effect. This warning is enabled by -Wall.
2951
2952 -Wno-pessimizing-move (C++ and Objective-C++ only)
2953 This warning warns when a call to "std::move" prevents copy
2954 elision. A typical scenario when copy elision can occur is when
2955 returning in a function with a class return type, when the
2956 expression being returned is the name of a non-volatile automatic
2957 object, and is not a function parameter, and has the same type as
2958 the function return type.
2959
2960 struct T {
2961 ...
2962 };
2963 T fn()
2964 {
2965 T t;
2966 ...
2967 return std::move (t);
2968 }
2969
2970 But in this example, the "std::move" call prevents copy elision.
2971
2972 This warning is enabled by -Wall.
2973
2974 -Wno-redundant-move (C++ and Objective-C++ only)
2975 This warning warns about redundant calls to "std::move"; that is,
2976 when a move operation would have been performed even without the
2977 "std::move" call. This happens because the compiler is forced to
2978 treat the object as if it were an rvalue in certain situations such
2979 as returning a local variable, where copy elision isn't applicable.
2980 Consider:
2981
2982 struct T {
2983 ...
2984 };
2985 T fn(T t)
2986 {
2987 ...
2988 return std::move (t);
2989 }
2990
2991 Here, the "std::move" call is redundant. Because G++ implements
2992 Core Issue 1579, another example is:
2993
2994 struct T { // convertible to U
2995 ...
2996 };
2997 struct U {
2998 ...
2999 };
3000 U fn()
3001 {
3002 T t;
3003 ...
3004 return std::move (t);
3005 }
3006
3007 In this example, copy elision isn't applicable because the type of
3008 the expression being returned and the function return type differ,
3009 yet G++ treats the return value as if it were designated by an
3010 rvalue.
3011
3012 This warning is enabled by -Wextra.
3013
3014 -Wrange-loop-construct (C++ and Objective-C++ only)
3015 This warning warns when a C++ range-based for-loop is creating an
3016 unnecessary copy. This can happen when the range declaration is
3017 not a reference, but probably should be. For example:
3018
3019 struct S { char arr[128]; };
3020 void fn () {
3021 S arr[5];
3022 for (const auto x : arr) { ... }
3023 }
3024
3025 It does not warn when the type being copied is a trivially-copyable
3026 type whose size is less than 64 bytes.
3027
3028 This warning also warns when a loop variable in a range-based for-
3029 loop is initialized with a value of a different type resulting in a
3030 copy. For example:
3031
3032 void fn() {
3033 int arr[10];
3034 for (const double &x : arr) { ... }
3035 }
3036
3037 In the example above, in every iteration of the loop a temporary
3038 value of type "double" is created and destroyed, to which the
3039 reference "const double &" is bound.
3040
3041 This warning is enabled by -Wall.
3042
3043 -Wredundant-tags (C++ and Objective-C++ only)
3044 Warn about redundant class-key and enum-key in references to class
3045 types and enumerated types in contexts where the key can be
3046 eliminated without causing an ambiguity. For example:
3047
3048 struct foo;
3049 struct foo *p; // warn that keyword struct can be eliminated
3050
3051 On the other hand, in this example there is no warning:
3052
3053 struct foo;
3054 void foo (); // "hides" struct foo
3055 void bar (struct foo&); // no warning, keyword struct is necessary
3056
3057 -Wno-subobject-linkage (C++ and Objective-C++ only)
3058 Do not warn if a class type has a base or a field whose type uses
3059 the anonymous namespace or depends on a type with no linkage. If a
3060 type A depends on a type B with no or internal linkage, defining it
3061 in multiple translation units would be an ODR violation because the
3062 meaning of B is different in each translation unit. If A only
3063 appears in a single translation unit, the best way to silence the
3064 warning is to give it internal linkage by putting it in an
3065 anonymous namespace as well. The compiler doesn't give this
3066 warning for types defined in the main .C file, as those are
3067 unlikely to have multiple definitions. -Wsubobject-linkage is
3068 enabled by default.
3069
3070 -Weffc++ (C++ and Objective-C++ only)
3071 Warn about violations of the following style guidelines from Scott
3072 Meyers' Effective C++ series of books:
3073
3074 * Define a copy constructor and an assignment operator for
3075 classes with dynamically-allocated memory.
3076
3077 * Prefer initialization to assignment in constructors.
3078
3079 * Have "operator=" return a reference to *this.
3080
3081 * Don't try to return a reference when you must return an object.
3082
3083 * Distinguish between prefix and postfix forms of increment and
3084 decrement operators.
3085
3086 * Never overload "&&", "||", or ",".
3087
3088 This option also enables -Wnon-virtual-dtor, which is also one of
3089 the effective C++ recommendations. However, the check is extended
3090 to warn about the lack of virtual destructor in accessible non-
3091 polymorphic bases classes too.
3092
3093 When selecting this option, be aware that the standard library
3094 headers do not obey all of these guidelines; use grep -v to filter
3095 out those warnings.
3096
3097 -Wno-exceptions (C++ and Objective-C++ only)
3098 Disable the warning about the case when an exception handler is
3099 shadowed by another handler, which can point out a wrong ordering
3100 of exception handlers.
3101
3102 -Wstrict-null-sentinel (C++ and Objective-C++ only)
3103 Warn about the use of an uncasted "NULL" as sentinel. When
3104 compiling only with GCC this is a valid sentinel, as "NULL" is
3105 defined to "__null". Although it is a null pointer constant rather
3106 than a null pointer, it is guaranteed to be of the same size as a
3107 pointer. But this use is not portable across different compilers.
3108
3109 -Wno-non-template-friend (C++ and Objective-C++ only)
3110 Disable warnings when non-template friend functions are declared
3111 within a template. In very old versions of GCC that predate
3112 implementation of the ISO standard, declarations such as friend int
3113 foo(int), where the name of the friend is an unqualified-id, could
3114 be interpreted as a particular specialization of a template
3115 function; the warning exists to diagnose compatibility problems,
3116 and is enabled by default.
3117
3118 -Wold-style-cast (C++ and Objective-C++ only)
3119 Warn if an old-style (C-style) cast to a non-void type is used
3120 within a C++ program. The new-style casts ("dynamic_cast",
3121 "static_cast", "reinterpret_cast", and "const_cast") are less
3122 vulnerable to unintended effects and much easier to search for.
3123
3124 -Woverloaded-virtual (C++ and Objective-C++ only)
3125 Warn when a function declaration hides virtual functions from a
3126 base class. For example, in:
3127
3128 struct A {
3129 virtual void f();
3130 };
3131
3132 struct B: public A {
3133 void f(int);
3134 };
3135
3136 the "A" class version of "f" is hidden in "B", and code like:
3137
3138 B* b;
3139 b->f();
3140
3141 fails to compile.
3142
3143 -Wno-pmf-conversions (C++ and Objective-C++ only)
3144 Disable the diagnostic for converting a bound pointer to member
3145 function to a plain pointer.
3146
3147 -Wsign-promo (C++ and Objective-C++ only)
3148 Warn when overload resolution chooses a promotion from unsigned or
3149 enumerated type to a signed type, over a conversion to an unsigned
3150 type of the same size. Previous versions of G++ tried to preserve
3151 unsignedness, but the standard mandates the current behavior.
3152
3153 -Wtemplates (C++ and Objective-C++ only)
3154 Warn when a primary template declaration is encountered. Some
3155 coding rules disallow templates, and this may be used to enforce
3156 that rule. The warning is inactive inside a system header file,
3157 such as the STL, so one can still use the STL. One may also
3158 instantiate or specialize templates.
3159
3160 -Wmismatched-new-delete (C++ and Objective-C++ only)
3161 Warn for mismatches between calls to "operator new" or "operator
3162 delete" and the corresponding call to the allocation or
3163 deallocation function. This includes invocations of C++ "operator
3164 delete" with pointers returned from either mismatched forms of
3165 "operator new", or from other functions that allocate objects for
3166 which the "operator delete" isn't a suitable deallocator, as well
3167 as calls to other deallocation functions with pointers returned
3168 from "operator new" for which the deallocation function isn't
3169 suitable.
3170
3171 For example, the "delete" expression in the function below is
3172 diagnosed because it doesn't match the array form of the "new"
3173 expression the pointer argument was returned from. Similarly, the
3174 call to "free" is also diagnosed.
3175
3176 void f ()
3177 {
3178 int *a = new int[n];
3179 delete a; // warning: mismatch in array forms of expressions
3180
3181 char *p = new char[n];
3182 free (p); // warning: mismatch between new and free
3183 }
3184
3185 The related option -Wmismatched-dealloc diagnoses mismatches
3186 involving allocation and deallocation functions other than
3187 "operator new" and "operator delete".
3188
3189 -Wmismatched-new-delete is included in -Wall.
3190
3191 -Wmismatched-tags (C++ and Objective-C++ only)
3192 Warn for declarations of structs, classes, and class templates and
3193 their specializations with a class-key that does not match either
3194 the definition or the first declaration if no definition is
3195 provided.
3196
3197 For example, the declaration of "struct Object" in the argument
3198 list of "draw" triggers the warning. To avoid it, either remove
3199 the redundant class-key "struct" or replace it with "class" to
3200 match its definition.
3201
3202 class Object {
3203 public:
3204 virtual ~Object () = 0;
3205 };
3206 void draw (struct Object*);
3207
3208 It is not wrong to declare a class with the class-key "struct" as
3209 the example above shows. The -Wmismatched-tags option is intended
3210 to help achieve a consistent style of class declarations. In code
3211 that is intended to be portable to Windows-based compilers the
3212 warning helps prevent unresolved references due to the difference
3213 in the mangling of symbols declared with different class-keys. The
3214 option can be used either on its own or in conjunction with
3215 -Wredundant-tags.
3216
3217 -Wmultiple-inheritance (C++ and Objective-C++ only)
3218 Warn when a class is defined with multiple direct base classes.
3219 Some coding rules disallow multiple inheritance, and this may be
3220 used to enforce that rule. The warning is inactive inside a system
3221 header file, such as the STL, so one can still use the STL. One
3222 may also define classes that indirectly use multiple inheritance.
3223
3224 -Wvirtual-inheritance
3225 Warn when a class is defined with a virtual direct base class.
3226 Some coding rules disallow multiple inheritance, and this may be
3227 used to enforce that rule. The warning is inactive inside a system
3228 header file, such as the STL, so one can still use the STL. One
3229 may also define classes that indirectly use virtual inheritance.
3230
3231 -Wno-virtual-move-assign
3232 Suppress warnings about inheriting from a virtual base with a non-
3233 trivial C++11 move assignment operator. This is dangerous because
3234 if the virtual base is reachable along more than one path, it is
3235 moved multiple times, which can mean both objects end up in the
3236 moved-from state. If the move assignment operator is written to
3237 avoid moving from a moved-from object, this warning can be
3238 disabled.
3239
3240 -Wnamespaces
3241 Warn when a namespace definition is opened. Some coding rules
3242 disallow namespaces, and this may be used to enforce that rule.
3243 The warning is inactive inside a system header file, such as the
3244 STL, so one can still use the STL. One may also use using
3245 directives and qualified names.
3246
3247 -Wno-terminate (C++ and Objective-C++ only)
3248 Disable the warning about a throw-expression that will immediately
3249 result in a call to "terminate".
3250
3251 -Wno-vexing-parse (C++ and Objective-C++ only)
3252 Warn about the most vexing parse syntactic ambiguity. This warns
3253 about the cases when a declaration looks like a variable
3254 definition, but the C++ language requires it to be interpreted as a
3255 function declaration. For instance:
3256
3257 void f(double a) {
3258 int i(); // extern int i (void);
3259 int n(int(a)); // extern int n (int);
3260 }
3261
3262 Another example:
3263
3264 struct S { S(int); };
3265 void f(double a) {
3266 S x(int(a)); // extern struct S x (int);
3267 S y(int()); // extern struct S y (int (*) (void));
3268 S z(); // extern struct S z (void);
3269 }
3270
3271 The warning will suggest options how to deal with such an
3272 ambiguity; e.g., it can suggest removing the parentheses or using
3273 braces instead.
3274
3275 This warning is enabled by default.
3276
3277 -Wno-class-conversion (C++ and Objective-C++ only)
3278 Do not warn when a conversion function converts an object to the
3279 same type, to a base class of that type, or to void; such a
3280 conversion function will never be called.
3281
3282 -Wvolatile (C++ and Objective-C++ only)
3283 Warn about deprecated uses of the "volatile" qualifier. This
3284 includes postfix and prefix "++" and "--" expressions of
3285 "volatile"-qualified types, using simple assignments where the left
3286 operand is a "volatile"-qualified non-class type for their value,
3287 compound assignments where the left operand is a
3288 "volatile"-qualified non-class type, "volatile"-qualified function
3289 return type, "volatile"-qualified parameter type, and structured
3290 bindings of a "volatile"-qualified type. This usage was deprecated
3291 in C++20.
3292
3293 Enabled by default with -std=c++20.
3294
3295 -Wzero-as-null-pointer-constant (C++ and Objective-C++ only)
3296 Warn when a literal 0 is used as null pointer constant. This can
3297 be useful to facilitate the conversion to "nullptr" in C++11.
3298
3299 -Waligned-new
3300 Warn about a new-expression of a type that requires greater
3301 alignment than the "alignof(std::max_align_t)" but uses an
3302 allocation function without an explicit alignment parameter. This
3303 option is enabled by -Wall.
3304
3305 Normally this only warns about global allocation functions, but
3306 -Waligned-new=all also warns about class member allocation
3307 functions.
3308
3309 -Wno-placement-new
3310 -Wplacement-new=n
3311 Warn about placement new expressions with undefined behavior, such
3312 as constructing an object in a buffer that is smaller than the type
3313 of the object. For example, the placement new expression below is
3314 diagnosed because it attempts to construct an array of 64 integers
3315 in a buffer only 64 bytes large.
3316
3317 char buf [64];
3318 new (buf) int[64];
3319
3320 This warning is enabled by default.
3321
3322 -Wplacement-new=1
3323 This is the default warning level of -Wplacement-new. At this
3324 level the warning is not issued for some strictly undefined
3325 constructs that GCC allows as extensions for compatibility with
3326 legacy code. For example, the following "new" expression is
3327 not diagnosed at this level even though it has undefined
3328 behavior according to the C++ standard because it writes past
3329 the end of the one-element array.
3330
3331 struct S { int n, a[1]; };
3332 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
3333 new (s->a)int [32]();
3334
3335 -Wplacement-new=2
3336 At this level, in addition to diagnosing all the same
3337 constructs as at level 1, a diagnostic is also issued for
3338 placement new expressions that construct an object in the last
3339 member of structure whose type is an array of a single element
3340 and whose size is less than the size of the object being
3341 constructed. While the previous example would be diagnosed,
3342 the following construct makes use of the flexible member array
3343 extension to avoid the warning at level 2.
3344
3345 struct S { int n, a[]; };
3346 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
3347 new (s->a)int [32]();
3348
3349 -Wcatch-value
3350 -Wcatch-value=n (C++ and Objective-C++ only)
3351 Warn about catch handlers that do not catch via reference. With
3352 -Wcatch-value=1 (or -Wcatch-value for short) warn about polymorphic
3353 class types that are caught by value. With -Wcatch-value=2 warn
3354 about all class types that are caught by value. With
3355 -Wcatch-value=3 warn about all types that are not caught by
3356 reference. -Wcatch-value is enabled by -Wall.
3357
3358 -Wconditionally-supported (C++ and Objective-C++ only)
3359 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
3360
3361 -Wno-delete-incomplete (C++ and Objective-C++ only)
3362 Do not warn when deleting a pointer to incomplete type, which may
3363 cause undefined behavior at runtime. This warning is enabled by
3364 default.
3365
3366 -Wextra-semi (C++, Objective-C++ only)
3367 Warn about redundant semicolons after in-class function
3368 definitions.
3369
3370 -Wno-inaccessible-base (C++, Objective-C++ only)
3371 This option controls warnings when a base class is inaccessible in
3372 a class derived from it due to ambiguity. The warning is enabled
3373 by default. Note that the warning for ambiguous virtual bases is
3374 enabled by the -Wextra option.
3375
3376 struct A { int a; };
3377
3378 struct B : A { };
3379
3380 struct C : B, A { };
3381
3382 -Wno-inherited-variadic-ctor
3383 Suppress warnings about use of C++11 inheriting constructors when
3384 the base class inherited from has a C variadic constructor; the
3385 warning is on by default because the ellipsis is not inherited.
3386
3387 -Wno-invalid-offsetof (C++ and Objective-C++ only)
3388 Suppress warnings from applying the "offsetof" macro to a non-POD
3389 type. According to the 2014 ISO C++ standard, applying "offsetof"
3390 to a non-standard-layout type is undefined. In existing C++
3391 implementations, however, "offsetof" typically gives meaningful
3392 results. This flag is for users who are aware that they are
3393 writing nonportable code and who have deliberately chosen to ignore
3394 the warning about it.
3395
3396 The restrictions on "offsetof" may be relaxed in a future version
3397 of the C++ standard.
3398
3399 -Wsized-deallocation (C++ and Objective-C++ only)
3400 Warn about a definition of an unsized deallocation function
3401
3402 void operator delete (void *) noexcept;
3403 void operator delete[] (void *) noexcept;
3404
3405 without a definition of the corresponding sized deallocation
3406 function
3407
3408 void operator delete (void *, std::size_t) noexcept;
3409 void operator delete[] (void *, std::size_t) noexcept;
3410
3411 or vice versa. Enabled by -Wextra along with -fsized-deallocation.
3412
3413 -Wsuggest-final-types
3414 Warn about types with virtual methods where code quality would be
3415 improved if the type were declared with the C++11 "final"
3416 specifier, or, if possible, declared in an anonymous namespace.
3417 This allows GCC to more aggressively devirtualize the polymorphic
3418 calls. This warning is more effective with link-time optimization,
3419 where the information about the class hierarchy graph is more
3420 complete.
3421
3422 -Wsuggest-final-methods
3423 Warn about virtual methods where code quality would be improved if
3424 the method were declared with the C++11 "final" specifier, or, if
3425 possible, its type were declared in an anonymous namespace or with
3426 the "final" specifier. This warning is more effective with link-
3427 time optimization, where the information about the class hierarchy
3428 graph is more complete. It is recommended to first consider
3429 suggestions of -Wsuggest-final-types and then rebuild with new
3430 annotations.
3431
3432 -Wsuggest-override
3433 Warn about overriding virtual functions that are not marked with
3434 the "override" keyword.
3435
3436 -Wuse-after-free
3437 -Wuse-after-free=n
3438 Warn about uses of pointers to dynamically allocated objects that
3439 have been rendered indeterminate by a call to a deallocation
3440 function. The warning is enabled at all optimization levels but
3441 may yield different results with optimization than without.
3442
3443 -Wuse-after-free=1
3444 At level 1 the warning attempts to diagnose only unconditional
3445 uses of pointers made indeterminate by a deallocation call or a
3446 successful call to "realloc", regardless of whether or not the
3447 call resulted in an actual reallocatio of memory. This
3448 includes double-"free" calls as well as uses in arithmetic and
3449 relational expressions. Although undefined, uses of
3450 indeterminate pointers in equality (or inequality) expressions
3451 are not diagnosed at this level.
3452
3453 -Wuse-after-free=2
3454 At level 2, in addition to unconditional uses, the warning also
3455 diagnoses conditional uses of pointers made indeterminate by a
3456 deallocation call. As at level 2, uses in equality (or
3457 inequality) expressions are not diagnosed. For example, the
3458 second call to "free" in the following function is diagnosed at
3459 this level:
3460
3461 struct A { int refcount; void *data; };
3462
3463 void release (struct A *p)
3464 {
3465 int refcount = --p->refcount;
3466 free (p);
3467 if (refcount == 0)
3468 free (p->data); // warning: p may be used after free
3469 }
3470
3471 -Wuse-after-free=3
3472 At level 3, the warning also diagnoses uses of indeterminate
3473 pointers in equality expressions. All uses of indeterminate
3474 pointers are undefined but equality tests sometimes appear
3475 after calls to "realloc" as an attempt to determine whether the
3476 call resulted in relocating the object to a different address.
3477 They are diagnosed at a separate level to aid legacy code
3478 gradually transition to safe alternatives. For example, the
3479 equality test in the function below is diagnosed at this level:
3480
3481 void adjust_pointers (int**, int);
3482
3483 void grow (int **p, int n)
3484 {
3485 int **q = (int**)realloc (p, n *= 2);
3486 if (q == p)
3487 return;
3488 adjust_pointers ((int**)q, n);
3489 }
3490
3491 To avoid the warning at this level, store offsets into
3492 allocated memory instead of pointers. This approach obviates
3493 needing to adjust the stored pointers after reallocation.
3494
3495 -Wuse-after-free=2 is included in -Wall.
3496
3497 -Wuseless-cast (C++ and Objective-C++ only)
3498 Warn when an expression is casted to its own type.
3499
3500 -Wno-conversion-null (C++ and Objective-C++ only)
3501 Do not warn for conversions between "NULL" and non-pointer types.
3502 -Wconversion-null is enabled by default.
3503
3504 Options Controlling Objective-C and Objective-C++ Dialects
3505 (NOTE: This manual does not describe the Objective-C and Objective-C++
3506 languages themselves.
3507
3508 This section describes the command-line options that are only
3509 meaningful for Objective-C and Objective-C++ programs. You can also
3510 use most of the language-independent GNU compiler options. For
3511 example, you might compile a file some_class.m like this:
3512
3513 gcc -g -fgnu-runtime -O -c some_class.m
3514
3515 In this example, -fgnu-runtime is an option meant only for Objective-C
3516 and Objective-C++ programs; you can use the other options with any
3517 language supported by GCC.
3518
3519 Note that since Objective-C is an extension of the C language,
3520 Objective-C compilations may also use options specific to the C front-
3521 end (e.g., -Wtraditional). Similarly, Objective-C++ compilations may
3522 use C++-specific options (e.g., -Wabi).
3523
3524 Here is a list of options that are only for compiling Objective-C and
3525 Objective-C++ programs:
3526
3527 -fconstant-string-class=class-name
3528 Use class-name as the name of the class to instantiate for each
3529 literal string specified with the syntax "@"..."". The default
3530 class name is "NXConstantString" if the GNU runtime is being used,
3531 and "NSConstantString" if the NeXT runtime is being used (see
3532 below). The -fconstant-cfstrings option, if also present,
3533 overrides the -fconstant-string-class setting and cause "@"...""
3534 literals to be laid out as constant CoreFoundation strings.
3535
3536 -fgnu-runtime
3537 Generate object code compatible with the standard GNU Objective-C
3538 runtime. This is the default for most types of systems.
3539
3540 -fnext-runtime
3541 Generate output compatible with the NeXT runtime. This is the
3542 default for NeXT-based systems, including Darwin and Mac OS X. The
3543 macro "__NEXT_RUNTIME__" is predefined if (and only if) this option
3544 is used.
3545
3546 -fno-nil-receivers
3547 Assume that all Objective-C message dispatches ("[receiver
3548 message:arg]") in this translation unit ensure that the receiver is
3549 not "nil". This allows for more efficient entry points in the
3550 runtime to be used. This option is only available in conjunction
3551 with the NeXT runtime and ABI version 0 or 1.
3552
3553 -fobjc-abi-version=n
3554 Use version n of the Objective-C ABI for the selected runtime.
3555 This option is currently supported only for the NeXT runtime. In
3556 that case, Version 0 is the traditional (32-bit) ABI without
3557 support for properties and other Objective-C 2.0 additions.
3558 Version 1 is the traditional (32-bit) ABI with support for
3559 properties and other Objective-C 2.0 additions. Version 2 is the
3560 modern (64-bit) ABI. If nothing is specified, the default is
3561 Version 0 on 32-bit target machines, and Version 2 on 64-bit target
3562 machines.
3563
3564 -fobjc-call-cxx-cdtors
3565 For each Objective-C class, check if any of its instance variables
3566 is a C++ object with a non-trivial default constructor. If so,
3567 synthesize a special "- (id) .cxx_construct" instance method which
3568 runs non-trivial default constructors on any such instance
3569 variables, in order, and then return "self". Similarly, check if
3570 any instance variable is a C++ object with a non-trivial
3571 destructor, and if so, synthesize a special "- (void)
3572 .cxx_destruct" method which runs all such default destructors, in
3573 reverse order.
3574
3575 The "- (id) .cxx_construct" and "- (void) .cxx_destruct" methods
3576 thusly generated only operate on instance variables declared in the
3577 current Objective-C class, and not those inherited from
3578 superclasses. It is the responsibility of the Objective-C runtime
3579 to invoke all such methods in an object's inheritance hierarchy.
3580 The "- (id) .cxx_construct" methods are invoked by the runtime
3581 immediately after a new object instance is allocated; the "- (void)
3582 .cxx_destruct" methods are invoked immediately before the runtime
3583 deallocates an object instance.
3584
3585 As of this writing, only the NeXT runtime on Mac OS X 10.4 and
3586 later has support for invoking the "- (id) .cxx_construct" and "-
3587 (void) .cxx_destruct" methods.
3588
3589 -fobjc-direct-dispatch
3590 Allow fast jumps to the message dispatcher. On Darwin this is
3591 accomplished via the comm page.
3592
3593 -fobjc-exceptions
3594 Enable syntactic support for structured exception handling in
3595 Objective-C, similar to what is offered by C++. This option is
3596 required to use the Objective-C keywords @try, @throw, @catch,
3597 @finally and @synchronized. This option is available with both the
3598 GNU runtime and the NeXT runtime (but not available in conjunction
3599 with the NeXT runtime on Mac OS X 10.2 and earlier).
3600
3601 -fobjc-gc
3602 Enable garbage collection (GC) in Objective-C and Objective-C++
3603 programs. This option is only available with the NeXT runtime; the
3604 GNU runtime has a different garbage collection implementation that
3605 does not require special compiler flags.
3606
3607 -fobjc-nilcheck
3608 For the NeXT runtime with version 2 of the ABI, check for a nil
3609 receiver in method invocations before doing the actual method call.
3610 This is the default and can be disabled using -fno-objc-nilcheck.
3611 Class methods and super calls are never checked for nil in this way
3612 no matter what this flag is set to. Currently this flag does
3613 nothing when the GNU runtime, or an older version of the NeXT
3614 runtime ABI, is used.
3615
3616 -fobjc-std=objc1
3617 Conform to the language syntax of Objective-C 1.0, the language
3618 recognized by GCC 4.0. This only affects the Objective-C additions
3619 to the C/C++ language; it does not affect conformance to C/C++
3620 standards, which is controlled by the separate C/C++ dialect option
3621 flags. When this option is used with the Objective-C or
3622 Objective-C++ compiler, any Objective-C syntax that is not
3623 recognized by GCC 4.0 is rejected. This is useful if you need to
3624 make sure that your Objective-C code can be compiled with older
3625 versions of GCC.
3626
3627 -freplace-objc-classes
3628 Emit a special marker instructing ld(1) not to statically link in
3629 the resulting object file, and allow dyld(1) to load it in at run
3630 time instead. This is used in conjunction with the Fix-and-
3631 Continue debugging mode, where the object file in question may be
3632 recompiled and dynamically reloaded in the course of program
3633 execution, without the need to restart the program itself.
3634 Currently, Fix-and-Continue functionality is only available in
3635 conjunction with the NeXT runtime on Mac OS X 10.3 and later.
3636
3637 -fzero-link
3638 When compiling for the NeXT runtime, the compiler ordinarily
3639 replaces calls to "objc_getClass("...")" (when the name of the
3640 class is known at compile time) with static class references that
3641 get initialized at load time, which improves run-time performance.
3642 Specifying the -fzero-link flag suppresses this behavior and causes
3643 calls to "objc_getClass("...")" to be retained. This is useful in
3644 Zero-Link debugging mode, since it allows for individual class
3645 implementations to be modified during program execution. The GNU
3646 runtime currently always retains calls to "objc_get_class("...")"
3647 regardless of command-line options.
3648
3649 -fno-local-ivars
3650 By default instance variables in Objective-C can be accessed as if
3651 they were local variables from within the methods of the class
3652 they're declared in. This can lead to shadowing between instance
3653 variables and other variables declared either locally inside a
3654 class method or globally with the same name. Specifying the
3655 -fno-local-ivars flag disables this behavior thus avoiding variable
3656 shadowing issues.
3657
3658 -fivar-visibility=[public|protected|private|package]
3659 Set the default instance variable visibility to the specified
3660 option so that instance variables declared outside the scope of any
3661 access modifier directives default to the specified visibility.
3662
3663 -gen-decls
3664 Dump interface declarations for all classes seen in the source file
3665 to a file named sourcename.decl.
3666
3667 -Wassign-intercept (Objective-C and Objective-C++ only)
3668 Warn whenever an Objective-C assignment is being intercepted by the
3669 garbage collector.
3670
3671 -Wno-property-assign-default (Objective-C and Objective-C++ only)
3672 Do not warn if a property for an Objective-C object has no assign
3673 semantics specified.
3674
3675 -Wno-protocol (Objective-C and Objective-C++ only)
3676 If a class is declared to implement a protocol, a warning is issued
3677 for every method in the protocol that is not implemented by the
3678 class. The default behavior is to issue a warning for every method
3679 not explicitly implemented in the class, even if a method
3680 implementation is inherited from the superclass. If you use the
3681 -Wno-protocol option, then methods inherited from the superclass
3682 are considered to be implemented, and no warning is issued for
3683 them.
3684
3685 -Wobjc-root-class (Objective-C and Objective-C++ only)
3686 Warn if a class interface lacks a superclass. Most classes will
3687 inherit from "NSObject" (or "Object") for example. When declaring
3688 classes intended to be root classes, the warning can be suppressed
3689 by marking their interfaces with
3690 "__attribute__((objc_root_class))".
3691
3692 -Wselector (Objective-C and Objective-C++ only)
3693 Warn if multiple methods of different types for the same selector
3694 are found during compilation. The check is performed on the list
3695 of methods in the final stage of compilation. Additionally, a
3696 check is performed for each selector appearing in a
3697 "@selector(...)" expression, and a corresponding method for that
3698 selector has been found during compilation. Because these checks
3699 scan the method table only at the end of compilation, these
3700 warnings are not produced if the final stage of compilation is not
3701 reached, for example because an error is found during compilation,
3702 or because the -fsyntax-only option is being used.
3703
3704 -Wstrict-selector-match (Objective-C and Objective-C++ only)
3705 Warn if multiple methods with differing argument and/or return
3706 types are found for a given selector when attempting to send a
3707 message using this selector to a receiver of type "id" or "Class".
3708 When this flag is off (which is the default behavior), the compiler
3709 omits such warnings if any differences found are confined to types
3710 that share the same size and alignment.
3711
3712 -Wundeclared-selector (Objective-C and Objective-C++ only)
3713 Warn if a "@selector(...)" expression referring to an undeclared
3714 selector is found. A selector is considered undeclared if no
3715 method with that name has been declared before the "@selector(...)"
3716 expression, either explicitly in an @interface or @protocol
3717 declaration, or implicitly in an @implementation section. This
3718 option always performs its checks as soon as a "@selector(...)"
3719 expression is found, while -Wselector only performs its checks in
3720 the final stage of compilation. This also enforces the coding
3721 style convention that methods and selectors must be declared before
3722 being used.
3723
3724 -print-objc-runtime-info
3725 Generate C header describing the largest structure that is passed
3726 by value, if any.
3727
3728 Options to Control Diagnostic Messages Formatting
3729 Traditionally, diagnostic messages have been formatted irrespective of
3730 the output device's aspect (e.g. its width, ...). You can use the
3731 options described below to control the formatting algorithm for
3732 diagnostic messages, e.g. how many characters per line, how often
3733 source location information should be reported. Note that some
3734 language front ends may not honor these options.
3735
3736 -fmessage-length=n
3737 Try to format error messages so that they fit on lines of about n
3738 characters. If n is zero, then no line-wrapping is done; each
3739 error message appears on a single line. This is the default for
3740 all front ends.
3741
3742 Note - this option also affects the display of the #error and
3743 #warning pre-processor directives, and the deprecated
3744 function/type/variable attribute. It does not however affect the
3745 pragma GCC warning and pragma GCC error pragmas.
3746
3747 -fdiagnostics-plain-output
3748 This option requests that diagnostic output look as plain as
3749 possible, which may be useful when running dejagnu or other
3750 utilities that need to parse diagnostics output and prefer that it
3751 remain more stable over time. -fdiagnostics-plain-output is
3752 currently equivalent to the following options:
3753 -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
3754 -fdiagnostics-color=never -fdiagnostics-urls=never
3755 -fdiagnostics-path-format=separate-events In the future, if GCC
3756 changes the default appearance of its diagnostics, the
3757 corresponding option to disable the new behavior will be added to
3758 this list.
3759
3760 -fdiagnostics-show-location=once
3761 Only meaningful in line-wrapping mode. Instructs the diagnostic
3762 messages reporter to emit source location information once; that
3763 is, in case the message is too long to fit on a single physical
3764 line and has to be wrapped, the source location won't be emitted
3765 (as prefix) again, over and over, in subsequent continuation lines.
3766 This is the default behavior.
3767
3768 -fdiagnostics-show-location=every-line
3769 Only meaningful in line-wrapping mode. Instructs the diagnostic
3770 messages reporter to emit the same source location information (as
3771 prefix) for physical lines that result from the process of breaking
3772 a message which is too long to fit on a single line.
3773
3774 -fdiagnostics-color[=WHEN]
3775 -fno-diagnostics-color
3776 Use color in diagnostics. WHEN is never, always, or auto. The
3777 default depends on how the compiler has been configured, it can be
3778 any of the above WHEN options or also never if GCC_COLORS
3779 environment variable isn't present in the environment, and auto
3780 otherwise. auto makes GCC use color only when the standard error
3781 is a terminal, and when not executing in an emacs shell. The forms
3782 -fdiagnostics-color and -fno-diagnostics-color are aliases for
3783 -fdiagnostics-color=always and -fdiagnostics-color=never,
3784 respectively.
3785
3786 The colors are defined by the environment variable GCC_COLORS. Its
3787 value is a colon-separated list of capabilities and Select Graphic
3788 Rendition (SGR) substrings. SGR commands are interpreted by the
3789 terminal or terminal emulator. (See the section in the
3790 documentation of your text terminal for permitted values and their
3791 meanings as character attributes.) These substring values are
3792 integers in decimal representation and can be concatenated with
3793 semicolons. Common values to concatenate include 1 for bold, 4 for
3794 underline, 5 for blink, 7 for inverse, 39 for default foreground
3795 color, 30 to 37 for foreground colors, 90 to 97 for 16-color mode
3796 foreground colors, 38;5;0 to 38;5;255 for 88-color and 256-color
3797 modes foreground colors, 49 for default background color, 40 to 47
3798 for background colors, 100 to 107 for 16-color mode background
3799 colors, and 48;5;0 to 48;5;255 for 88-color and 256-color modes
3800 background colors.
3801
3802 The default GCC_COLORS is
3803
3804 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3805 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
3806 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3807 type-diff=01;32
3808
3809 where 01;31 is bold red, 01;35 is bold magenta, 01;36 is bold cyan,
3810 32 is green, 34 is blue, 01 is bold, and 31 is red. Setting
3811 GCC_COLORS to the empty string disables colors. Supported
3812 capabilities are as follows.
3813
3814 "error="
3815 SGR substring for error: markers.
3816
3817 "warning="
3818 SGR substring for warning: markers.
3819
3820 "note="
3821 SGR substring for note: markers.
3822
3823 "path="
3824 SGR substring for colorizing paths of control-flow events as
3825 printed via -fdiagnostics-path-format=, such as the identifiers
3826 of individual events and lines indicating interprocedural calls
3827 and returns.
3828
3829 "range1="
3830 SGR substring for first additional range.
3831
3832 "range2="
3833 SGR substring for second additional range.
3834
3835 "locus="
3836 SGR substring for location information, file:line or
3837 file:line:column etc.
3838
3839 "quote="
3840 SGR substring for information printed within quotes.
3841
3842 "fixit-insert="
3843 SGR substring for fix-it hints suggesting text to be inserted
3844 or replaced.
3845
3846 "fixit-delete="
3847 SGR substring for fix-it hints suggesting text to be deleted.
3848
3849 "diff-filename="
3850 SGR substring for filename headers within generated patches.
3851
3852 "diff-hunk="
3853 SGR substring for the starts of hunks within generated patches.
3854
3855 "diff-delete="
3856 SGR substring for deleted lines within generated patches.
3857
3858 "diff-insert="
3859 SGR substring for inserted lines within generated patches.
3860
3861 "type-diff="
3862 SGR substring for highlighting mismatching types within
3863 template arguments in the C++ frontend.
3864
3865 -fdiagnostics-urls[=WHEN]
3866 Use escape sequences to embed URLs in diagnostics. For example,
3867 when -fdiagnostics-show-option emits text showing the command-line
3868 option controlling a diagnostic, embed a URL for documentation of
3869 that option.
3870
3871 WHEN is never, always, or auto. auto makes GCC use URL escape
3872 sequences only when the standard error is a terminal, and when not
3873 executing in an emacs shell or any graphical terminal which is
3874 known to be incompatible with this feature, see below.
3875
3876 The default depends on how the compiler has been configured. It
3877 can be any of the above WHEN options.
3878
3879 GCC can also be configured (via the
3880 --with-diagnostics-urls=auto-if-env configure-time option) so that
3881 the default is affected by environment variables. Under such a
3882 configuration, GCC defaults to using auto if either GCC_URLS or
3883 TERM_URLS environment variables are present and non-empty in the
3884 environment of the compiler, or never if neither are.
3885
3886 However, even with -fdiagnostics-urls=always the behavior is
3887 dependent on those environment variables: If GCC_URLS is set to
3888 empty or no, do not embed URLs in diagnostics. If set to st, URLs
3889 use ST escape sequences. If set to bel, the default, URLs use BEL
3890 escape sequences. Any other non-empty value enables the feature.
3891 If GCC_URLS is not set, use TERM_URLS as a fallback. Note: ST is
3892 an ANSI escape sequence, string terminator ESC \, BEL is an ASCII
3893 character, CTRL-G that usually sounds like a beep.
3894
3895 At this time GCC tries to detect also a few terminals that are
3896 known to not implement the URL feature, and have bugs or at least
3897 had bugs in some versions that are still in use, where the URL
3898 escapes are likely to misbehave, i.e. print garbage on the screen.
3899 That list is currently xfce4-terminal, certain known to be buggy
3900 gnome-terminal versions, the linux console, and mingw. This check
3901 can be skipped with the -fdiagnostics-urls=always.
3902
3903 -fno-diagnostics-show-option
3904 By default, each diagnostic emitted includes text indicating the
3905 command-line option that directly controls the diagnostic (if such
3906 an option is known to the diagnostic machinery). Specifying the
3907 -fno-diagnostics-show-option flag suppresses that behavior.
3908
3909 -fno-diagnostics-show-caret
3910 By default, each diagnostic emitted includes the original source
3911 line and a caret ^ indicating the column. This option suppresses
3912 this information. The source line is truncated to n characters, if
3913 the -fmessage-length=n option is given. When the output is done to
3914 the terminal, the width is limited to the width given by the
3915 COLUMNS environment variable or, if not set, to the terminal width.
3916
3917 -fno-diagnostics-show-labels
3918 By default, when printing source code (via
3919 -fdiagnostics-show-caret), diagnostics can label ranges of source
3920 code with pertinent information, such as the types of expressions:
3921
3922 printf ("foo %s bar", long_i + long_j);
3923 ~^ ~~~~~~~~~~~~~~~
3924 | |
3925 char * long int
3926
3927 This option suppresses the printing of these labels (in the example
3928 above, the vertical bars and the "char *" and "long int" text).
3929
3930 -fno-diagnostics-show-cwe
3931 Diagnostic messages can optionally have an associated
3932 @url{https://cwe.mitre.org/index.html, CWE} identifier. GCC itself
3933 only provides such metadata for some of the -fanalyzer diagnostics.
3934 GCC plugins may also provide diagnostics with such metadata. By
3935 default, if this information is present, it will be printed with
3936 the diagnostic. This option suppresses the printing of this
3937 metadata.
3938
3939 -fno-diagnostics-show-line-numbers
3940 By default, when printing source code (via
3941 -fdiagnostics-show-caret), a left margin is printed, showing line
3942 numbers. This option suppresses this left margin.
3943
3944 -fdiagnostics-minimum-margin-width=width
3945 This option controls the minimum width of the left margin printed
3946 by -fdiagnostics-show-line-numbers. It defaults to 6.
3947
3948 -fdiagnostics-parseable-fixits
3949 Emit fix-it hints in a machine-parseable format, suitable for
3950 consumption by IDEs. For each fix-it, a line will be printed after
3951 the relevant diagnostic, starting with the string "fix-it:". For
3952 example:
3953
3954 fix-it:"test.c":{45:3-45:21}:"gtk_widget_show_all"
3955
3956 The location is expressed as a half-open range, expressed as a
3957 count of bytes, starting at byte 1 for the initial column. In the
3958 above example, bytes 3 through 20 of line 45 of "test.c" are to be
3959 replaced with the given string:
3960
3961 00000000011111111112222222222
3962 12345678901234567890123456789
3963 gtk_widget_showall (dlg);
3964 ^^^^^^^^^^^^^^^^^^
3965 gtk_widget_show_all
3966
3967 The filename and replacement string escape backslash as "\\", tab
3968 as "\t", newline as "\n", double quotes as "\"", non-printable
3969 characters as octal (e.g. vertical tab as "\013").
3970
3971 An empty replacement string indicates that the given range is to be
3972 removed. An empty range (e.g. "45:3-45:3") indicates that the
3973 string is to be inserted at the given position.
3974
3975 -fdiagnostics-generate-patch
3976 Print fix-it hints to stderr in unified diff format, after any
3977 diagnostics are printed. For example:
3978
3979 --- test.c
3980 +++ test.c
3981 @ -42,5 +42,5 @
3982
3983 void show_cb(GtkDialog *dlg)
3984 {
3985 - gtk_widget_showall(dlg);
3986 + gtk_widget_show_all(dlg);
3987 }
3988
3989 The diff may or may not be colorized, following the same rules as
3990 for diagnostics (see -fdiagnostics-color).
3991
3992 -fdiagnostics-show-template-tree
3993 In the C++ frontend, when printing diagnostics showing mismatching
3994 template types, such as:
3995
3996 could not convert 'std::map<int, std::vector<double> >()'
3997 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3998
3999 the -fdiagnostics-show-template-tree flag enables printing a tree-
4000 like structure showing the common and differing parts of the types,
4001 such as:
4002
4003 map<
4004 [...],
4005 vector<
4006 [double != float]>>
4007
4008 The parts that differ are highlighted with color ("double" and
4009 "float" in this case).
4010
4011 -fno-elide-type
4012 By default when the C++ frontend prints diagnostics showing
4013 mismatching template types, common parts of the types are printed
4014 as "[...]" to simplify the error message. For example:
4015
4016 could not convert 'std::map<int, std::vector<double> >()'
4017 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4018
4019 Specifying the -fno-elide-type flag suppresses that behavior. This
4020 flag also affects the output of the
4021 -fdiagnostics-show-template-tree flag.
4022
4023 -fdiagnostics-path-format=KIND
4024 Specify how to print paths of control-flow events for diagnostics
4025 that have such a path associated with them.
4026
4027 KIND is none, separate-events, or inline-events, the default.
4028
4029 none means to not print diagnostic paths.
4030
4031 separate-events means to print a separate "note" diagnostic for
4032 each event within the diagnostic. For example:
4033
4034 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
4035 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
4036 test.c:27:3: note: (2) when 'i < count'
4037 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4038
4039 inline-events means to print the events "inline" within the source
4040 code. This view attempts to consolidate the events into runs of
4041 sufficiently-close events, printing them as labelled ranges within
4042 the source.
4043
4044 For example, the same events as above might be printed as:
4045
4046 'test': events 1-3
4047 |
4048 | 25 | list = PyList_New(0);
4049 | | ^~~~~~~~~~~~~
4050 | | |
4051 | | (1) when 'PyList_New' fails, returning NULL
4052 | 26 |
4053 | 27 | for (i = 0; i < count; i++) {
4054 | | ~~~
4055 | | |
4056 | | (2) when 'i < count'
4057 | 28 | item = PyLong_FromLong(random());
4058 | 29 | PyList_Append(list, item);
4059 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
4060 | | |
4061 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4062 |
4063
4064 Interprocedural control flow is shown by grouping the events by
4065 stack frame, and using indentation to show how stack frames are
4066 nested, pushed, and popped.
4067
4068 For example:
4069
4070 'test': events 1-2
4071 |
4072 | 133 | {
4073 | | ^
4074 | | |
4075 | | (1) entering 'test'
4076 | 134 | boxed_int *obj = make_boxed_int (i);
4077 | | ~~~~~~~~~~~~~~~~~~
4078 | | |
4079 | | (2) calling 'make_boxed_int'
4080 |
4081 +--> 'make_boxed_int': events 3-4
4082 |
4083 | 120 | {
4084 | | ^
4085 | | |
4086 | | (3) entering 'make_boxed_int'
4087 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
4088 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4089 | | |
4090 | | (4) calling 'wrapped_malloc'
4091 |
4092 +--> 'wrapped_malloc': events 5-6
4093 |
4094 | 7 | {
4095 | | ^
4096 | | |
4097 | | (5) entering 'wrapped_malloc'
4098 | 8 | return malloc (size);
4099 | | ~~~~~~~~~~~~~
4100 | | |
4101 | | (6) calling 'malloc'
4102 |
4103 <-------------+
4104 |
4105 'test': event 7
4106 |
4107 | 138 | free_boxed_int (obj);
4108 | | ^~~~~~~~~~~~~~~~~~~~
4109 | | |
4110 | | (7) calling 'free_boxed_int'
4111 |
4112 (etc)
4113
4114 -fdiagnostics-show-path-depths
4115 This option provides additional information when printing control-
4116 flow paths associated with a diagnostic.
4117
4118 If this is option is provided then the stack depth will be printed
4119 for each run of events within
4120 -fdiagnostics-path-format=separate-events.
4121
4122 This is intended for use by GCC developers and plugin developers
4123 when debugging diagnostics that report interprocedural control
4124 flow.
4125
4126 -fno-show-column
4127 Do not print column numbers in diagnostics. This may be necessary
4128 if diagnostics are being scanned by a program that does not
4129 understand the column numbers, such as dejagnu.
4130
4131 -fdiagnostics-column-unit=UNIT
4132 Select the units for the column number. This affects traditional
4133 diagnostics (in the absence of -fno-show-column), as well as JSON
4134 format diagnostics if requested.
4135
4136 The default UNIT, display, considers the number of display columns
4137 occupied by each character. This may be larger than the number of
4138 bytes required to encode the character, in the case of tab
4139 characters, or it may be smaller, in the case of multibyte
4140 characters. For example, the character "GREEK SMALL LETTER PI
4141 (U+03C0)" occupies one display column, and its UTF-8 encoding
4142 requires two bytes; the character "SLIGHTLY SMILING FACE (U+1F642)"
4143 occupies two display columns, and its UTF-8 encoding requires four
4144 bytes.
4145
4146 Setting UNIT to byte changes the column number to the raw byte
4147 count in all cases, as was traditionally output by GCC prior to
4148 version 11.1.0.
4149
4150 -fdiagnostics-column-origin=ORIGIN
4151 Select the origin for column numbers, i.e. the column number
4152 assigned to the first column. The default value of 1 corresponds
4153 to traditional GCC behavior and to the GNU style guide. Some
4154 utilities may perform better with an origin of 0; any non-negative
4155 value may be specified.
4156
4157 -fdiagnostics-escape-format=FORMAT
4158 When GCC prints pertinent source lines for a diagnostic it normally
4159 attempts to print the source bytes directly. However, some
4160 diagnostics relate to encoding issues in the source file, such as
4161 malformed UTF-8, or issues with Unicode normalization. These
4162 diagnostics are flagged so that GCC will escape bytes that are not
4163 printable ASCII when printing their pertinent source lines.
4164
4165 This option controls how such bytes should be escaped.
4166
4167 The default FORMAT, unicode displays Unicode characters that are
4168 not printable ASCII in the form <U+XXXX>, and bytes that do not
4169 correspond to a Unicode character validly-encoded in UTF-8-encoded
4170 will be displayed as hexadecimal in the form <XX>.
4171
4172 For example, a source line containing the string before followed by
4173 the Unicode character U+03C0 ("GREEK SMALL LETTER PI", with UTF-8
4174 encoding 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8
4175 trailing byte), followed by the string after will be printed for
4176 such a diagnostic as:
4177
4178 before<U+03C0><BF>after
4179
4180 Setting FORMAT to bytes will display all non-printable-ASCII bytes
4181 in the form <XX>, thus showing the underlying encoding of non-ASCII
4182 Unicode characters. For the example above, the following will be
4183 printed:
4184
4185 before<CF><80><BF>after
4186
4187 -fdiagnostics-format=FORMAT
4188 Select a different format for printing diagnostics. FORMAT is text
4189 or json. The default is text.
4190
4191 The json format consists of a top-level JSON array containing JSON
4192 objects representing the diagnostics.
4193
4194 The JSON is emitted as one line, without formatting; the examples
4195 below have been formatted for clarity.
4196
4197 Diagnostics can have child diagnostics. For example, this error
4198 and note:
4199
4200 misleading-indentation.c:15:3: warning: this 'if' clause does not
4201 guard... [-Wmisleading-indentation]
4202 15 | if (flag)
4203 | ^~
4204 misleading-indentation.c:17:5: note: ...this statement, but the latter
4205 is misleadingly indented as if it were guarded by the 'if'
4206 17 | y = 2;
4207 | ^
4208
4209 might be printed in JSON form (after formatting) like this:
4210
4211 [
4212 {
4213 "kind": "warning",
4214 "locations": [
4215 {
4216 "caret": {
4217 "display-column": 3,
4218 "byte-column": 3,
4219 "column": 3,
4220 "file": "misleading-indentation.c",
4221 "line": 15
4222 },
4223 "finish": {
4224 "display-column": 4,
4225 "byte-column": 4,
4226 "column": 4,
4227 "file": "misleading-indentation.c",
4228 "line": 15
4229 }
4230 }
4231 ],
4232 "message": "this \u2018if\u2019 clause does not guard...",
4233 "option": "-Wmisleading-indentation",
4234 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4235 "children": [
4236 {
4237 "kind": "note",
4238 "locations": [
4239 {
4240 "caret": {
4241 "display-column": 5,
4242 "byte-column": 5,
4243 "column": 5,
4244 "file": "misleading-indentation.c",
4245 "line": 17
4246 }
4247 }
4248 ],
4249 "escape-source": false,
4250 "message": "...this statement, but the latter is ..."
4251 }
4252 ]
4253 "escape-source": false,
4254 "column-origin": 1,
4255 }
4256 ]
4257
4258 where the "note" is a child of the "warning".
4259
4260 A diagnostic has a "kind". If this is "warning", then there is an
4261 "option" key describing the command-line option controlling the
4262 warning.
4263
4264 A diagnostic can contain zero or more locations. Each location has
4265 an optional "label" string and up to three positions within it: a
4266 "caret" position and optional "start" and "finish" positions. A
4267 position is described by a "file" name, a "line" number, and three
4268 numbers indicating a column position:
4269
4270 * "display-column" counts display columns, accounting for tabs
4271 and multibyte characters.
4272
4273 * "byte-column" counts raw bytes.
4274
4275 * "column" is equal to one of the previous two, as dictated by
4276 the -fdiagnostics-column-unit option.
4277
4278 All three columns are relative to the origin specified by
4279 -fdiagnostics-column-origin, which is typically equal to 1 but may
4280 be set, for instance, to 0 for compatibility with other utilities
4281 that number columns from 0. The column origin is recorded in the
4282 JSON output in the "column-origin" tag. In the remaining examples
4283 below, the extra column number outputs have been omitted for
4284 brevity.
4285
4286 For example, this error:
4287
4288 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' {aka
4289 'struct s'} and 'T' {aka 'struct t'})
4290 64 | return callee_4a () + callee_4b ();
4291 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4292 | | |
4293 | | T {aka struct t}
4294 | S {aka struct s}
4295
4296 has three locations. Its primary location is at the "+" token at
4297 column 23. It has two secondary locations, describing the left and
4298 right-hand sides of the expression, which have labels. It might be
4299 printed in JSON form as:
4300
4301 {
4302 "children": [],
4303 "kind": "error",
4304 "locations": [
4305 {
4306 "caret": {
4307 "column": 23, "file": "bad-binary-ops.c", "line": 64
4308 }
4309 },
4310 {
4311 "caret": {
4312 "column": 10, "file": "bad-binary-ops.c", "line": 64
4313 },
4314 "finish": {
4315 "column": 21, "file": "bad-binary-ops.c", "line": 64
4316 },
4317 "label": "S {aka struct s}"
4318 },
4319 {
4320 "caret": {
4321 "column": 25, "file": "bad-binary-ops.c", "line": 64
4322 },
4323 "finish": {
4324 "column": 36, "file": "bad-binary-ops.c", "line": 64
4325 },
4326 "label": "T {aka struct t}"
4327 }
4328 ],
4329 "escape-source": false,
4330 "message": "invalid operands to binary + ..."
4331 }
4332
4333 If a diagnostic contains fix-it hints, it has a "fixits" array,
4334 consisting of half-open intervals, similar to the output of
4335 -fdiagnostics-parseable-fixits. For example, this diagnostic with
4336 a replacement fix-it hint:
4337
4338 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4339 mean 'color'?
4340 8 | return ptr->colour;
4341 | ^~~~~~
4342 | color
4343
4344 might be printed in JSON form as:
4345
4346 {
4347 "children": [],
4348 "fixits": [
4349 {
4350 "next": {
4351 "column": 21,
4352 "file": "demo.c",
4353 "line": 8
4354 },
4355 "start": {
4356 "column": 15,
4357 "file": "demo.c",
4358 "line": 8
4359 },
4360 "string": "color"
4361 }
4362 ],
4363 "kind": "error",
4364 "locations": [
4365 {
4366 "caret": {
4367 "column": 15,
4368 "file": "demo.c",
4369 "line": 8
4370 },
4371 "finish": {
4372 "column": 20,
4373 "file": "demo.c",
4374 "line": 8
4375 }
4376 }
4377 ],
4378 "escape-source": false,
4379 "message": "\u2018struct s\u2019 has no member named ..."
4380 }
4381
4382 where the fix-it hint suggests replacing the text from "start" up
4383 to but not including "next" with "string"'s value. Deletions are
4384 expressed via an empty value for "string", insertions by having
4385 "start" equal "next".
4386
4387 If the diagnostic has a path of control-flow events associated with
4388 it, it has a "path" array of objects representing the events. Each
4389 event object has a "description" string, a "location" object, along
4390 with a "function" string and a "depth" number for representing
4391 interprocedural paths. The "function" represents the current
4392 function at that event, and the "depth" represents the stack depth
4393 relative to some baseline: the higher, the more frames are within
4394 the stack.
4395
4396 For example, the intraprocedural example shown for
4397 -fdiagnostics-path-format= might have this JSON for its path:
4398
4399 "path": [
4400 {
4401 "depth": 0,
4402 "description": "when 'PyList_New' fails, returning NULL",
4403 "function": "test",
4404 "location": {
4405 "column": 10,
4406 "file": "test.c",
4407 "line": 25
4408 }
4409 },
4410 {
4411 "depth": 0,
4412 "description": "when 'i < count'",
4413 "function": "test",
4414 "location": {
4415 "column": 3,
4416 "file": "test.c",
4417 "line": 27
4418 }
4419 },
4420 {
4421 "depth": 0,
4422 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
4423 "function": "test",
4424 "location": {
4425 "column": 5,
4426 "file": "test.c",
4427 "line": 29
4428 }
4429 }
4430 ]
4431
4432 Diagnostics have a boolean attribute "escape-source", hinting
4433 whether non-ASCII bytes should be escaped when printing the
4434 pertinent lines of source code ("true" for diagnostics involving
4435 source encoding issues).
4436
4437 Options to Request or Suppress Warnings
4438 Warnings are diagnostic messages that report constructions that are not
4439 inherently erroneous but that are risky or suggest there may have been
4440 an error.
4441
4442 The following language-independent options do not enable specific
4443 warnings but control the kinds of diagnostics produced by GCC.
4444
4445 -fsyntax-only
4446 Check the code for syntax errors, but don't do anything beyond
4447 that.
4448
4449 -fmax-errors=n
4450 Limits the maximum number of error messages to n, at which point
4451 GCC bails out rather than attempting to continue processing the
4452 source code. If n is 0 (the default), there is no limit on the
4453 number of error messages produced. If -Wfatal-errors is also
4454 specified, then -Wfatal-errors takes precedence over this option.
4455
4456 -w Inhibit all warning messages.
4457
4458 -Werror
4459 Make all warnings into errors.
4460
4461 -Werror=
4462 Make the specified warning into an error. The specifier for a
4463 warning is appended; for example -Werror=switch turns the warnings
4464 controlled by -Wswitch into errors. This switch takes a negative
4465 form, to be used to negate -Werror for specific warnings; for
4466 example -Wno-error=switch makes -Wswitch warnings not be errors,
4467 even when -Werror is in effect.
4468
4469 The warning message for each controllable warning includes the
4470 option that controls the warning. That option can then be used
4471 with -Werror= and -Wno-error= as described above. (Printing of the
4472 option in the warning message can be disabled using the
4473 -fno-diagnostics-show-option flag.)
4474
4475 Note that specifying -Werror=foo automatically implies -Wfoo.
4476 However, -Wno-error=foo does not imply anything.
4477
4478 -Wfatal-errors
4479 This option causes the compiler to abort compilation on the first
4480 error occurred rather than trying to keep going and printing
4481 further error messages.
4482
4483 You can request many specific warnings with options beginning with -W,
4484 for example -Wimplicit to request warnings on implicit declarations.
4485 Each of these specific warning options also has a negative form
4486 beginning -Wno- to turn off warnings; for example, -Wno-implicit. This
4487 manual lists only one of the two forms, whichever is not the default.
4488 For further language-specific options also refer to C++ Dialect Options
4489 and Objective-C and Objective-C++ Dialect Options. Additional warnings
4490 can be produced by enabling the static analyzer;
4491
4492 Some options, such as -Wall and -Wextra, turn on other options, such as
4493 -Wunused, which may turn on further options, such as -Wunused-value.
4494 The combined effect of positive and negative forms is that more
4495 specific options have priority over less specific ones, independently
4496 of their position in the command-line. For options of the same
4497 specificity, the last one takes effect. Options enabled or disabled via
4498 pragmas take effect as if they appeared at the end of the command-line.
4499
4500 When an unrecognized warning option is requested (e.g.,
4501 -Wunknown-warning), GCC emits a diagnostic stating that the option is
4502 not recognized. However, if the -Wno- form is used, the behavior is
4503 slightly different: no diagnostic is produced for -Wno-unknown-warning
4504 unless other diagnostics are being produced. This allows the use of
4505 new -Wno- options with old compilers, but if something goes wrong, the
4506 compiler warns that an unrecognized option is present.
4507
4508 The effectiveness of some warnings depends on optimizations also being
4509 enabled. For example -Wsuggest-final-types is more effective with link-
4510 time optimization and some instances of other warnings may not be
4511 issued at all unless optimization is enabled. While optimization in
4512 general improves the efficacy of control and data flow sensitive
4513 warnings, in some cases it may also cause false positives.
4514
4515 -Wpedantic
4516 -pedantic
4517 Issue all the warnings demanded by strict ISO C and ISO C++; reject
4518 all programs that use forbidden extensions, and some other programs
4519 that do not follow ISO C and ISO C++. For ISO C, follows the
4520 version of the ISO C standard specified by any -std option used.
4521
4522 Valid ISO C and ISO C++ programs should compile properly with or
4523 without this option (though a rare few require -ansi or a -std
4524 option specifying the required version of ISO C). However, without
4525 this option, certain GNU extensions and traditional C and C++
4526 features are supported as well. With this option, they are
4527 rejected.
4528
4529 -Wpedantic does not cause warning messages for use of the alternate
4530 keywords whose names begin and end with __. This alternate format
4531 can also be used to disable warnings for non-ISO __intN types, i.e.
4532 __intN__. Pedantic warnings are also disabled in the expression
4533 that follows "__extension__". However, only system header files
4534 should use these escape routes; application programs should avoid
4535 them.
4536
4537 Some users try to use -Wpedantic to check programs for strict ISO C
4538 conformance. They soon find that it does not do quite what they
4539 want: it finds some non-ISO practices, but not all---only those for
4540 which ISO C requires a diagnostic, and some others for which
4541 diagnostics have been added.
4542
4543 A feature to report any failure to conform to ISO C might be useful
4544 in some instances, but would require considerable additional work
4545 and would be quite different from -Wpedantic. We don't have plans
4546 to support such a feature in the near future.
4547
4548 Where the standard specified with -std represents a GNU extended
4549 dialect of C, such as gnu90 or gnu99, there is a corresponding base
4550 standard, the version of ISO C on which the GNU extended dialect is
4551 based. Warnings from -Wpedantic are given where they are required
4552 by the base standard. (It does not make sense for such warnings to
4553 be given only for features not in the specified GNU C dialect,
4554 since by definition the GNU dialects of C include all features the
4555 compiler supports with the given option, and there would be nothing
4556 to warn about.)
4557
4558 -pedantic-errors
4559 Give an error whenever the base standard (see -Wpedantic) requires
4560 a diagnostic, in some cases where there is undefined behavior at
4561 compile-time and in some other cases that do not prevent
4562 compilation of programs that are valid according to the standard.
4563 This is not equivalent to -Werror=pedantic, since there are errors
4564 enabled by this option and not enabled by the latter and vice
4565 versa.
4566
4567 -Wall
4568 This enables all the warnings about constructions that some users
4569 consider questionable, and that are easy to avoid (or modify to
4570 prevent the warning), even in conjunction with macros. This also
4571 enables some language-specific warnings described in C++ Dialect
4572 Options and Objective-C and Objective-C++ Dialect Options.
4573
4574 -Wall turns on the following warning flags:
4575
4576 -Waddress -Warray-bounds=1 (only with -O2) -Warray-compare
4577 -Warray-parameter=2 (C and Objective-C only) -Wbool-compare
4578 -Wbool-operation -Wc++11-compat -Wc++14-compat -Wcatch-value (C++
4579 and Objective-C++ only) -Wchar-subscripts -Wcomment
4580 -Wdangling-pointer=2 -Wduplicate-decl-specifier (C and Objective-C
4581 only) -Wenum-compare (in C/ObjC; this is on by default in C++)
4582 -Wformat -Wformat-overflow -Wformat-truncation
4583 -Wint-in-bool-context -Wimplicit (C and Objective-C only)
4584 -Wimplicit-int (C and Objective-C only)
4585 -Wimplicit-function-declaration (C and Objective-C only)
4586 -Winit-self (only for C++) -Wlogical-not-parentheses -Wmain (only
4587 for C/ObjC and unless -ffreestanding) -Wmaybe-uninitialized
4588 -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation
4589 (only for C/C++) -Wmismatched-dealloc -Wmismatched-new-delete (only
4590 for C/C++) -Wmissing-attributes -Wmissing-braces (only for C/ObjC)
4591 -Wmultistatement-macros -Wnarrowing (only for C++) -Wnonnull
4592 -Wnonnull-compare -Wopenmp-simd -Wparentheses -Wpessimizing-move
4593 (only for C++) -Wpointer-sign -Wrange-loop-construct (only for C++)
4594 -Wreorder -Wrestrict -Wreturn-type -Wsequence-point -Wsign-compare
4595 (only in C++) -Wsizeof-array-div -Wsizeof-pointer-div
4596 -Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstrict-overflow=1
4597 -Wswitch -Wtautological-compare -Wtrigraphs -Wuninitialized
4598 -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value
4599 -Wunused-variable -Wuse-after-free=3 -Wvla-parameter (C and
4600 Objective-C only) -Wvolatile-register-var -Wzero-length-bounds
4601
4602 Note that some warning flags are not implied by -Wall. Some of
4603 them warn about constructions that users generally do not consider
4604 questionable, but which occasionally you might wish to check for;
4605 others warn about constructions that are necessary or hard to avoid
4606 in some cases, and there is no simple way to modify the code to
4607 suppress the warning. Some of them are enabled by -Wextra but many
4608 of them must be enabled individually.
4609
4610 -Wextra
4611 This enables some extra warning flags that are not enabled by
4612 -Wall. (This option used to be called -W. The older name is still
4613 supported, but the newer name is more descriptive.)
4614
4615 -Wclobbered -Wcast-function-type -Wdeprecated-copy (C++ only)
4616 -Wempty-body -Wenum-conversion (C only) -Wignored-qualifiers
4617 -Wimplicit-fallthrough=3 -Wmissing-field-initializers
4618 -Wmissing-parameter-type (C only) -Wold-style-declaration (C only)
4619 -Woverride-init -Wsign-compare (C only) -Wstring-compare
4620 -Wredundant-move (only for C++) -Wtype-limits -Wuninitialized
4621 -Wshift-negative-value (in C++11 to C++17 and in C99 and newer)
4622 -Wunused-parameter (only with -Wunused or -Wall)
4623 -Wunused-but-set-parameter (only with -Wunused or -Wall)
4624
4625 The option -Wextra also prints warning messages for the following
4626 cases:
4627
4628 * A pointer is compared against integer zero with "<", "<=", ">",
4629 or ">=".
4630
4631 * (C++ only) An enumerator and a non-enumerator both appear in a
4632 conditional expression.
4633
4634 * (C++ only) Ambiguous virtual bases.
4635
4636 * (C++ only) Subscripting an array that has been declared
4637 "register".
4638
4639 * (C++ only) Taking the address of a variable that has been
4640 declared "register".
4641
4642 * (C++ only) A base class is not initialized in the copy
4643 constructor of a derived class.
4644
4645 -Wabi (C, Objective-C, C++ and Objective-C++ only)
4646 Warn about code affected by ABI changes. This includes code that
4647 may not be compatible with the vendor-neutral C++ ABI as well as
4648 the psABI for the particular target.
4649
4650 Since G++ now defaults to updating the ABI with each major release,
4651 normally -Wabi warns only about C++ ABI compatibility problems if
4652 there is a check added later in a release series for an ABI issue
4653 discovered since the initial release. -Wabi warns about more
4654 things if an older ABI version is selected (with -fabi-version=n).
4655
4656 -Wabi can also be used with an explicit version number to warn
4657 about C++ ABI compatibility with a particular -fabi-version level,
4658 e.g. -Wabi=2 to warn about changes relative to -fabi-version=2.
4659
4660 If an explicit version number is provided and -fabi-compat-version
4661 is not specified, the version number from this option is used for
4662 compatibility aliases. If no explicit version number is provided
4663 with this option, but -fabi-compat-version is specified, that
4664 version number is used for C++ ABI warnings.
4665
4666 Although an effort has been made to warn about all such cases,
4667 there are probably some cases that are not warned about, even
4668 though G++ is generating incompatible code. There may also be
4669 cases where warnings are emitted even though the code that is
4670 generated is compatible.
4671
4672 You should rewrite your code to avoid these warnings if you are
4673 concerned about the fact that code generated by G++ may not be
4674 binary compatible with code generated by other compilers.
4675
4676 Known incompatibilities in -fabi-version=2 (which was the default
4677 from GCC 3.4 to 4.9) include:
4678
4679 * A template with a non-type template parameter of reference type
4680 was mangled incorrectly:
4681
4682 extern int N;
4683 template <int &> struct S {};
4684 void n (S<N>) {2}
4685
4686 This was fixed in -fabi-version=3.
4687
4688 * SIMD vector types declared using "__attribute ((vector_size))"
4689 were mangled in a non-standard way that does not allow for
4690 overloading of functions taking vectors of different sizes.
4691
4692 The mangling was changed in -fabi-version=4.
4693
4694 * "__attribute ((const))" and "noreturn" were mangled as type
4695 qualifiers, and "decltype" of a plain declaration was folded
4696 away.
4697
4698 These mangling issues were fixed in -fabi-version=5.
4699
4700 * Scoped enumerators passed as arguments to a variadic function
4701 are promoted like unscoped enumerators, causing "va_arg" to
4702 complain. On most targets this does not actually affect the
4703 parameter passing ABI, as there is no way to pass an argument
4704 smaller than "int".
4705
4706 Also, the ABI changed the mangling of template argument packs,
4707 "const_cast", "static_cast", prefix increment/decrement, and a
4708 class scope function used as a template argument.
4709
4710 These issues were corrected in -fabi-version=6.
4711
4712 * Lambdas in default argument scope were mangled incorrectly, and
4713 the ABI changed the mangling of "nullptr_t".
4714
4715 These issues were corrected in -fabi-version=7.
4716
4717 * When mangling a function type with function-cv-qualifiers, the
4718 un-qualified function type was incorrectly treated as a
4719 substitution candidate.
4720
4721 This was fixed in -fabi-version=8, the default for GCC 5.1.
4722
4723 * "decltype(nullptr)" incorrectly had an alignment of 1, leading
4724 to unaligned accesses. Note that this did not affect the ABI
4725 of a function with a "nullptr_t" parameter, as parameters have
4726 a minimum alignment.
4727
4728 This was fixed in -fabi-version=9, the default for GCC 5.2.
4729
4730 * Target-specific attributes that affect the identity of a type,
4731 such as ia32 calling conventions on a function type (stdcall,
4732 regparm, etc.), did not affect the mangled name, leading to
4733 name collisions when function pointers were used as template
4734 arguments.
4735
4736 This was fixed in -fabi-version=10, the default for GCC 6.1.
4737
4738 This option also enables warnings about psABI-related changes. The
4739 known psABI changes at this point include:
4740
4741 * For SysV/x86-64, unions with "long double" members are passed
4742 in memory as specified in psABI. Prior to GCC 4.4, this was
4743 not the case. For example:
4744
4745 union U {
4746 long double ld;
4747 int i;
4748 };
4749
4750 "union U" is now always passed in memory.
4751
4752 -Wchar-subscripts
4753 Warn if an array subscript has type "char". This is a common cause
4754 of error, as programmers often forget that this type is signed on
4755 some machines. This warning is enabled by -Wall.
4756
4757 -Wno-coverage-mismatch
4758 Warn if feedback profiles do not match when using the -fprofile-use
4759 option. If a source file is changed between compiling with
4760 -fprofile-generate and with -fprofile-use, the files with the
4761 profile feedback can fail to match the source file and GCC cannot
4762 use the profile feedback information. By default, this warning is
4763 enabled and is treated as an error. -Wno-coverage-mismatch can be
4764 used to disable the warning or -Wno-error=coverage-mismatch can be
4765 used to disable the error. Disabling the error for this warning
4766 can result in poorly optimized code and is useful only in the case
4767 of very minor changes such as bug fixes to an existing code-base.
4768 Completely disabling the warning is not recommended.
4769
4770 -Wno-coverage-invalid-line-number
4771 Warn in case a function ends earlier than it begins due to an
4772 invalid linenum macros. The warning is emitted only with
4773 --coverage enabled.
4774
4775 By default, this warning is enabled and is treated as an error.
4776 -Wno-coverage-invalid-line-number can be used to disable the
4777 warning or -Wno-error=coverage-invalid-line-number can be used to
4778 disable the error.
4779
4780 -Wno-cpp (C, Objective-C, C++, Objective-C++ and Fortran only)
4781 Suppress warning messages emitted by "#warning" directives.
4782
4783 -Wdouble-promotion (C, C++, Objective-C and Objective-C++ only)
4784 Give a warning when a value of type "float" is implicitly promoted
4785 to "double". CPUs with a 32-bit "single-precision" floating-point
4786 unit implement "float" in hardware, but emulate "double" in
4787 software. On such a machine, doing computations using "double"
4788 values is much more expensive because of the overhead required for
4789 software emulation.
4790
4791 It is easy to accidentally do computations with "double" because
4792 floating-point literals are implicitly of type "double". For
4793 example, in:
4794
4795 float area(float radius)
4796 {
4797 return 3.14159 * radius * radius;
4798 }
4799
4800 the compiler performs the entire computation with "double" because
4801 the floating-point literal is a "double".
4802
4803 -Wduplicate-decl-specifier (C and Objective-C only)
4804 Warn if a declaration has duplicate "const", "volatile", "restrict"
4805 or "_Atomic" specifier. This warning is enabled by -Wall.
4806
4807 -Wformat
4808 -Wformat=n
4809 Check calls to "printf" and "scanf", etc., to make sure that the
4810 arguments supplied have types appropriate to the format string
4811 specified, and that the conversions specified in the format string
4812 make sense. This includes standard functions, and others specified
4813 by format attributes, in the "printf", "scanf", "strftime" and
4814 "strfmon" (an X/Open extension, not in the C standard) families (or
4815 other target-specific families). Which functions are checked
4816 without format attributes having been specified depends on the
4817 standard version selected, and such checks of functions without the
4818 attribute specified are disabled by -ffreestanding or -fno-builtin.
4819
4820 The formats are checked against the format features supported by
4821 GNU libc version 2.2. These include all ISO C90 and C99 features,
4822 as well as features from the Single Unix Specification and some BSD
4823 and GNU extensions. Other library implementations may not support
4824 all these features; GCC does not support warning about features
4825 that go beyond a particular library's limitations. However, if
4826 -Wpedantic is used with -Wformat, warnings are given about format
4827 features not in the selected standard version (but not for
4828 "strfmon" formats, since those are not in any version of the C
4829 standard).
4830
4831 -Wformat=1
4832 -Wformat
4833 Option -Wformat is equivalent to -Wformat=1, and -Wno-format is
4834 equivalent to -Wformat=0. Since -Wformat also checks for null
4835 format arguments for several functions, -Wformat also implies
4836 -Wnonnull. Some aspects of this level of format checking can
4837 be disabled by the options: -Wno-format-contains-nul,
4838 -Wno-format-extra-args, and -Wno-format-zero-length. -Wformat
4839 is enabled by -Wall.
4840
4841 -Wformat=2
4842 Enable -Wformat plus additional format checks. Currently
4843 equivalent to -Wformat -Wformat-nonliteral -Wformat-security
4844 -Wformat-y2k.
4845
4846 -Wno-format-contains-nul
4847 If -Wformat is specified, do not warn about format strings that
4848 contain NUL bytes.
4849
4850 -Wno-format-extra-args
4851 If -Wformat is specified, do not warn about excess arguments to a
4852 "printf" or "scanf" format function. The C standard specifies that
4853 such arguments are ignored.
4854
4855 Where the unused arguments lie between used arguments that are
4856 specified with $ operand number specifications, normally warnings
4857 are still given, since the implementation could not know what type
4858 to pass to "va_arg" to skip the unused arguments. However, in the
4859 case of "scanf" formats, this option suppresses the warning if the
4860 unused arguments are all pointers, since the Single Unix
4861 Specification says that such unused arguments are allowed.
4862
4863 -Wformat-overflow
4864 -Wformat-overflow=level
4865 Warn about calls to formatted input/output functions such as
4866 "sprintf" and "vsprintf" that might overflow the destination
4867 buffer. When the exact number of bytes written by a format
4868 directive cannot be determined at compile-time it is estimated
4869 based on heuristics that depend on the level argument and on
4870 optimization. While enabling optimization will in most cases
4871 improve the accuracy of the warning, it may also result in false
4872 positives.
4873
4874 -Wformat-overflow
4875 -Wformat-overflow=1
4876 Level 1 of -Wformat-overflow enabled by -Wformat employs a
4877 conservative approach that warns only about calls that most
4878 likely overflow the buffer. At this level, numeric arguments
4879 to format directives with unknown values are assumed to have
4880 the value of one, and strings of unknown length to be empty.
4881 Numeric arguments that are known to be bounded to a subrange of
4882 their type, or string arguments whose output is bounded either
4883 by their directive's precision or by a finite set of string
4884 literals, are assumed to take on the value within the range
4885 that results in the most bytes on output. For example, the
4886 call to "sprintf" below is diagnosed because even with both a
4887 and b equal to zero, the terminating NUL character ('\0')
4888 appended by the function to the destination buffer will be
4889 written past its end. Increasing the size of the buffer by a
4890 single byte is sufficient to avoid the warning, though it may
4891 not be sufficient to avoid the overflow.
4892
4893 void f (int a, int b)
4894 {
4895 char buf [13];
4896 sprintf (buf, "a = %i, b = %i\n", a, b);
4897 }
4898
4899 -Wformat-overflow=2
4900 Level 2 warns also about calls that might overflow the
4901 destination buffer given an argument of sufficient length or
4902 magnitude. At level 2, unknown numeric arguments are assumed
4903 to have the minimum representable value for signed types with a
4904 precision greater than 1, and the maximum representable value
4905 otherwise. Unknown string arguments whose length cannot be
4906 assumed to be bounded either by the directive's precision, or
4907 by a finite set of string literals they may evaluate to, or the
4908 character array they may point to, are assumed to be 1
4909 character long.
4910
4911 At level 2, the call in the example above is again diagnosed,
4912 but this time because with a equal to a 32-bit "INT_MIN" the
4913 first %i directive will write some of its digits beyond the end
4914 of the destination buffer. To make the call safe regardless of
4915 the values of the two variables, the size of the destination
4916 buffer must be increased to at least 34 bytes. GCC includes
4917 the minimum size of the buffer in an informational note
4918 following the warning.
4919
4920 An alternative to increasing the size of the destination buffer
4921 is to constrain the range of formatted values. The maximum
4922 length of string arguments can be bounded by specifying the
4923 precision in the format directive. When numeric arguments of
4924 format directives can be assumed to be bounded by less than the
4925 precision of their type, choosing an appropriate length
4926 modifier to the format specifier will reduce the required
4927 buffer size. For example, if a and b in the example above can
4928 be assumed to be within the precision of the "short int" type
4929 then using either the %hi format directive or casting the
4930 argument to "short" reduces the maximum required size of the
4931 buffer to 24 bytes.
4932
4933 void f (int a, int b)
4934 {
4935 char buf [23];
4936 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4937 }
4938
4939 -Wno-format-zero-length
4940 If -Wformat is specified, do not warn about zero-length formats.
4941 The C standard specifies that zero-length formats are allowed.
4942
4943 -Wformat-nonliteral
4944 If -Wformat is specified, also warn if the format string is not a
4945 string literal and so cannot be checked, unless the format function
4946 takes its format arguments as a "va_list".
4947
4948 -Wformat-security
4949 If -Wformat is specified, also warn about uses of format functions
4950 that represent possible security problems. At present, this warns
4951 about calls to "printf" and "scanf" functions where the format
4952 string is not a string literal and there are no format arguments,
4953 as in "printf (foo);". This may be a security hole if the format
4954 string came from untrusted input and contains %n. (This is
4955 currently a subset of what -Wformat-nonliteral warns about, but in
4956 future warnings may be added to -Wformat-security that are not
4957 included in -Wformat-nonliteral.)
4958
4959 -Wformat-signedness
4960 If -Wformat is specified, also warn if the format string requires
4961 an unsigned argument and the argument is signed and vice versa.
4962
4963 -Wformat-truncation
4964 -Wformat-truncation=level
4965 Warn about calls to formatted input/output functions such as
4966 "snprintf" and "vsnprintf" that might result in output truncation.
4967 When the exact number of bytes written by a format directive cannot
4968 be determined at compile-time it is estimated based on heuristics
4969 that depend on the level argument and on optimization. While
4970 enabling optimization will in most cases improve the accuracy of
4971 the warning, it may also result in false positives. Except as
4972 noted otherwise, the option uses the same logic -Wformat-overflow.
4973
4974 -Wformat-truncation
4975 -Wformat-truncation=1
4976 Level 1 of -Wformat-truncation enabled by -Wformat employs a
4977 conservative approach that warns only about calls to bounded
4978 functions whose return value is unused and that will most
4979 likely result in output truncation.
4980
4981 -Wformat-truncation=2
4982 Level 2 warns also about calls to bounded functions whose
4983 return value is used and that might result in truncation given
4984 an argument of sufficient length or magnitude.
4985
4986 -Wformat-y2k
4987 If -Wformat is specified, also warn about "strftime" formats that
4988 may yield only a two-digit year.
4989
4990 -Wnonnull
4991 Warn about passing a null pointer for arguments marked as requiring
4992 a non-null value by the "nonnull" function attribute.
4993
4994 -Wnonnull is included in -Wall and -Wformat. It can be disabled
4995 with the -Wno-nonnull option.
4996
4997 -Wnonnull-compare
4998 Warn when comparing an argument marked with the "nonnull" function
4999 attribute against null inside the function.
5000
5001 -Wnonnull-compare is included in -Wall. It can be disabled with
5002 the -Wno-nonnull-compare option.
5003
5004 -Wnull-dereference
5005 Warn if the compiler detects paths that trigger erroneous or
5006 undefined behavior due to dereferencing a null pointer. This
5007 option is only active when -fdelete-null-pointer-checks is active,
5008 which is enabled by optimizations in most targets. The precision
5009 of the warnings depends on the optimization options used.
5010
5011 -Winfinite-recursion
5012 Warn about infinitely recursive calls. The warning is effective at
5013 all optimization levels but requires optimization in order to
5014 detect infinite recursion in calls between two or more functions.
5015 -Winfinite-recursion is included in -Wall.
5016
5017 -Winit-self (C, C++, Objective-C and Objective-C++ only)
5018 Warn about uninitialized variables that are initialized with
5019 themselves. Note this option can only be used with the
5020 -Wuninitialized option.
5021
5022 For example, GCC warns about "i" being uninitialized in the
5023 following snippet only when -Winit-self has been specified:
5024
5025 int f()
5026 {
5027 int i = i;
5028 return i;
5029 }
5030
5031 This warning is enabled by -Wall in C++.
5032
5033 -Wno-implicit-int (C and Objective-C only)
5034 This option controls warnings when a declaration does not specify a
5035 type. This warning is enabled by default in C99 and later dialects
5036 of C, and also by -Wall.
5037
5038 -Wno-implicit-function-declaration (C and Objective-C only)
5039 This option controls warnings when a function is used before being
5040 declared. This warning is enabled by default in C99 and later
5041 dialects of C, and also by -Wall. The warning is made into an
5042 error by -pedantic-errors.
5043
5044 -Wimplicit (C and Objective-C only)
5045 Same as -Wimplicit-int and -Wimplicit-function-declaration. This
5046 warning is enabled by -Wall.
5047
5048 -Wimplicit-fallthrough
5049 -Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3 and
5050 -Wno-implicit-fallthrough is the same as -Wimplicit-fallthrough=0.
5051
5052 -Wimplicit-fallthrough=n
5053 Warn when a switch case falls through. For example:
5054
5055 switch (cond)
5056 {
5057 case 1:
5058 a = 1;
5059 break;
5060 case 2:
5061 a = 2;
5062 case 3:
5063 a = 3;
5064 break;
5065 }
5066
5067 This warning does not warn when the last statement of a case cannot
5068 fall through, e.g. when there is a return statement or a call to
5069 function declared with the noreturn attribute.
5070 -Wimplicit-fallthrough= also takes into account control flow
5071 statements, such as ifs, and only warns when appropriate. E.g.
5072
5073 switch (cond)
5074 {
5075 case 1:
5076 if (i > 3) {
5077 bar (5);
5078 break;
5079 } else if (i < 1) {
5080 bar (0);
5081 } else
5082 return;
5083 default:
5084 ...
5085 }
5086
5087 Since there are occasions where a switch case fall through is
5088 desirable, GCC provides an attribute, "__attribute__
5089 ((fallthrough))", that is to be used along with a null statement to
5090 suppress this warning that would normally occur:
5091
5092 switch (cond)
5093 {
5094 case 1:
5095 bar (0);
5096 __attribute__ ((fallthrough));
5097 default:
5098 ...
5099 }
5100
5101 C++17 provides a standard way to suppress the
5102 -Wimplicit-fallthrough warning using "[[fallthrough]];" instead of
5103 the GNU attribute. In C++11 or C++14 users can use
5104 "[[gnu::fallthrough]];", which is a GNU extension. Instead of
5105 these attributes, it is also possible to add a fallthrough comment
5106 to silence the warning. The whole body of the C or C++ style
5107 comment should match the given regular expressions listed below.
5108 The option argument n specifies what kind of comments are accepted:
5109
5110 *<-Wimplicit-fallthrough=0 disables the warning altogether.>
5111 *<-Wimplicit-fallthrough=1 matches ".*" regular>
5112 expression, any comment is used as fallthrough comment.
5113
5114 *<-Wimplicit-fallthrough=2 case insensitively matches>
5115 ".*falls?[ \t-]*thr(ough|u).*" regular expression.
5116
5117 *<-Wimplicit-fallthrough=3 case sensitively matches one of the>
5118 following regular expressions:
5119
5120 *<"-fallthrough">
5121 *<"@fallthrough@">
5122 *<"lint -fallthrough[ \t]*">
5123 *<"[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?FALL(S |
5124 |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?">
5125 *<"[ \t.!]*(Else,? |Intentional(ly)? )?Fall((s |
5126 |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?">
5127 *<"[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?fall(s |
5128 |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?">
5129 *<-Wimplicit-fallthrough=4 case sensitively matches one of the>
5130 following regular expressions:
5131
5132 *<"-fallthrough">
5133 *<"@fallthrough@">
5134 *<"lint -fallthrough[ \t]*">
5135 *<"[ \t]*FALLTHR(OUGH|U)[ \t]*">
5136 *<-Wimplicit-fallthrough=5 doesn't recognize any comments as>
5137 fallthrough comments, only attributes disable the warning.
5138
5139 The comment needs to be followed after optional whitespace and
5140 other comments by "case" or "default" keywords or by a user label
5141 that precedes some "case" or "default" label.
5142
5143 switch (cond)
5144 {
5145 case 1:
5146 bar (0);
5147 /* FALLTHRU */
5148 default:
5149 ...
5150 }
5151
5152 The -Wimplicit-fallthrough=3 warning is enabled by -Wextra.
5153
5154 -Wno-if-not-aligned (C, C++, Objective-C and Objective-C++ only)
5155 Control if warnings triggered by the "warn_if_not_aligned"
5156 attribute should be issued. These warnings are enabled by default.
5157
5158 -Wignored-qualifiers (C and C++ only)
5159 Warn if the return type of a function has a type qualifier such as
5160 "const". For ISO C such a type qualifier has no effect, since the
5161 value returned by a function is not an lvalue. For C++, the
5162 warning is only emitted for scalar types or "void". ISO C
5163 prohibits qualified "void" return types on function definitions, so
5164 such return types always receive a warning even without this
5165 option.
5166
5167 This warning is also enabled by -Wextra.
5168
5169 -Wno-ignored-attributes (C and C++ only)
5170 This option controls warnings when an attribute is ignored. This
5171 is different from the -Wattributes option in that it warns whenever
5172 the compiler decides to drop an attribute, not that the attribute
5173 is either unknown, used in a wrong place, etc. This warning is
5174 enabled by default.
5175
5176 -Wmain
5177 Warn if the type of "main" is suspicious. "main" should be a
5178 function with external linkage, returning int, taking either zero
5179 arguments, two, or three arguments of appropriate types. This
5180 warning is enabled by default in C++ and is enabled by either -Wall
5181 or -Wpedantic.
5182
5183 -Wmisleading-indentation (C and C++ only)
5184 Warn when the indentation of the code does not reflect the block
5185 structure. Specifically, a warning is issued for "if", "else",
5186 "while", and "for" clauses with a guarded statement that does not
5187 use braces, followed by an unguarded statement with the same
5188 indentation.
5189
5190 In the following example, the call to "bar" is misleadingly
5191 indented as if it were guarded by the "if" conditional.
5192
5193 if (some_condition ())
5194 foo ();
5195 bar (); /* Gotcha: this is not guarded by the "if". */
5196
5197 In the case of mixed tabs and spaces, the warning uses the
5198 -ftabstop= option to determine if the statements line up
5199 (defaulting to 8).
5200
5201 The warning is not issued for code involving multiline preprocessor
5202 logic such as the following example.
5203
5204 if (flagA)
5205 foo (0);
5206 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5207 if (flagB)
5208 #endif
5209 foo (1);
5210
5211 The warning is not issued after a "#line" directive, since this
5212 typically indicates autogenerated code, and no assumptions can be
5213 made about the layout of the file that the directive references.
5214
5215 This warning is enabled by -Wall in C and C++.
5216
5217 -Wmissing-attributes
5218 Warn when a declaration of a function is missing one or more
5219 attributes that a related function is declared with and whose
5220 absence may adversely affect the correctness or efficiency of
5221 generated code. For example, the warning is issued for
5222 declarations of aliases that use attributes to specify less
5223 restrictive requirements than those of their targets. This
5224 typically represents a potential optimization opportunity. By
5225 contrast, the -Wattribute-alias=2 option controls warnings issued
5226 when the alias is more restrictive than the target, which could
5227 lead to incorrect code generation. Attributes considered include
5228 "alloc_align", "alloc_size", "cold", "const", "hot", "leaf",
5229 "malloc", "nonnull", "noreturn", "nothrow", "pure",
5230 "returns_nonnull", and "returns_twice".
5231
5232 In C++, the warning is issued when an explicit specialization of a
5233 primary template declared with attribute "alloc_align",
5234 "alloc_size", "assume_aligned", "format", "format_arg", "malloc",
5235 or "nonnull" is declared without it. Attributes "deprecated",
5236 "error", and "warning" suppress the warning..
5237
5238 You can use the "copy" attribute to apply the same set of
5239 attributes to a declaration as that on another declaration without
5240 explicitly enumerating the attributes. This attribute can be
5241 applied to declarations of functions, variables, or types.
5242
5243 -Wmissing-attributes is enabled by -Wall.
5244
5245 For example, since the declaration of the primary function template
5246 below makes use of both attribute "malloc" and "alloc_size" the
5247 declaration of the explicit specialization of the template is
5248 diagnosed because it is missing one of the attributes.
5249
5250 template <class T>
5251 T* __attribute__ ((malloc, alloc_size (1)))
5252 allocate (size_t);
5253
5254 template <>
5255 void* __attribute__ ((malloc)) // missing alloc_size
5256 allocate<void> (size_t);
5257
5258 -Wmissing-braces
5259 Warn if an aggregate or union initializer is not fully bracketed.
5260 In the following example, the initializer for "a" is not fully
5261 bracketed, but that for "b" is fully bracketed.
5262
5263 int a[2][2] = { 0, 1, 2, 3 };
5264 int b[2][2] = { { 0, 1 }, { 2, 3 } };
5265
5266 This warning is enabled by -Wall.
5267
5268 -Wmissing-include-dirs (C, C++, Objective-C, Objective-C++ and Fortran
5269 only)
5270 Warn if a user-supplied include directory does not exist. This
5271 opions is disabled by default for C, C++, Objective-C and
5272 Objective-C++. For Fortran, it is partially enabled by default by
5273 warning for -I and -J, only.
5274
5275 -Wno-missing-profile
5276 This option controls warnings if feedback profiles are missing when
5277 using the -fprofile-use option. This option diagnoses those cases
5278 where a new function or a new file is added between compiling with
5279 -fprofile-generate and with -fprofile-use, without regenerating the
5280 profiles. In these cases, the profile feedback data files do not
5281 contain any profile feedback information for the newly added
5282 function or file respectively. Also, in the case when profile
5283 count data (.gcda) files are removed, GCC cannot use any profile
5284 feedback information. In all these cases, warnings are issued to
5285 inform you that a profile generation step is due. Ignoring the
5286 warning can result in poorly optimized code. -Wno-missing-profile
5287 can be used to disable the warning, but this is not recommended and
5288 should be done only when non-existent profile data is justified.
5289
5290 -Wmismatched-dealloc
5291 Warn for calls to deallocation functions with pointer arguments
5292 returned from from allocations functions for which the former isn't
5293 a suitable deallocator. A pair of functions can be associated as
5294 matching allocators and deallocators by use of attribute "malloc".
5295 Unless disabled by the -fno-builtin option the standard functions
5296 "calloc", "malloc", "realloc", and "free", as well as the
5297 corresponding forms of C++ "operator new" and "operator delete" are
5298 implicitly associated as matching allocators and deallocators. In
5299 the following example "mydealloc" is the deallocator for pointers
5300 returned from "myalloc".
5301
5302 void mydealloc (void*);
5303
5304 __attribute__ ((malloc (mydealloc, 1))) void*
5305 myalloc (size_t);
5306
5307 void f (void)
5308 {
5309 void *p = myalloc (32);
5310 // ...use p...
5311 free (p); // warning: not a matching deallocator for myalloc
5312 mydealloc (p); // ok
5313 }
5314
5315 In C++, the related option -Wmismatched-new-delete diagnoses
5316 mismatches involving either "operator new" or "operator delete".
5317
5318 Option -Wmismatched-dealloc is included in -Wall.
5319
5320 -Wmultistatement-macros
5321 Warn about unsafe multiple statement macros that appear to be
5322 guarded by a clause such as "if", "else", "for", "switch", or
5323 "while", in which only the first statement is actually guarded
5324 after the macro is expanded.
5325
5326 For example:
5327
5328 #define DOIT x++; y++
5329 if (c)
5330 DOIT;
5331
5332 will increment "y" unconditionally, not just when "c" holds. The
5333 can usually be fixed by wrapping the macro in a do-while loop:
5334
5335 #define DOIT do { x++; y++; } while (0)
5336 if (c)
5337 DOIT;
5338
5339 This warning is enabled by -Wall in C and C++.
5340
5341 -Wparentheses
5342 Warn if parentheses are omitted in certain contexts, such as when
5343 there is an assignment in a context where a truth value is
5344 expected, or when operators are nested whose precedence people
5345 often get confused about.
5346
5347 Also warn if a comparison like "x<=y<=z" appears; this is
5348 equivalent to "(x<=y ? 1 : 0) <= z", which is a different
5349 interpretation from that of ordinary mathematical notation.
5350
5351 Also warn for dangerous uses of the GNU extension to "?:" with
5352 omitted middle operand. When the condition in the "?": operator is
5353 a boolean expression, the omitted value is always 1. Often
5354 programmers expect it to be a value computed inside the conditional
5355 expression instead.
5356
5357 For C++ this also warns for some cases of unnecessary parentheses
5358 in declarations, which can indicate an attempt at a function call
5359 instead of a declaration:
5360
5361 {
5362 // Declares a local variable called mymutex.
5363 std::unique_lock<std::mutex> (mymutex);
5364 // User meant std::unique_lock<std::mutex> lock (mymutex);
5365 }
5366
5367 This warning is enabled by -Wall.
5368
5369 -Wsequence-point
5370 Warn about code that may have undefined semantics because of
5371 violations of sequence point rules in the C and C++ standards.
5372
5373 The C and C++ standards define the order in which expressions in a
5374 C/C++ program are evaluated in terms of sequence points, which
5375 represent a partial ordering between the execution of parts of the
5376 program: those executed before the sequence point, and those
5377 executed after it. These occur after the evaluation of a full
5378 expression (one which is not part of a larger expression), after
5379 the evaluation of the first operand of a "&&", "||", "? :" or ","
5380 (comma) operator, before a function is called (but after the
5381 evaluation of its arguments and the expression denoting the called
5382 function), and in certain other places. Other than as expressed by
5383 the sequence point rules, the order of evaluation of subexpressions
5384 of an expression is not specified. All these rules describe only a
5385 partial order rather than a total order, since, for example, if two
5386 functions are called within one expression with no sequence point
5387 between them, the order in which the functions are called is not
5388 specified. However, the standards committee have ruled that
5389 function calls do not overlap.
5390
5391 It is not specified when between sequence points modifications to
5392 the values of objects take effect. Programs whose behavior depends
5393 on this have undefined behavior; the C and C++ standards specify
5394 that "Between the previous and next sequence point an object shall
5395 have its stored value modified at most once by the evaluation of an
5396 expression. Furthermore, the prior value shall be read only to
5397 determine the value to be stored.". If a program breaks these
5398 rules, the results on any particular implementation are entirely
5399 unpredictable.
5400
5401 Examples of code with undefined behavior are "a = a++;", "a[n] =
5402 b[n++]" and "a[i++] = i;". Some more complicated cases are not
5403 diagnosed by this option, and it may give an occasional false
5404 positive result, but in general it has been found fairly effective
5405 at detecting this sort of problem in programs.
5406
5407 The C++17 standard will define the order of evaluation of operands
5408 in more cases: in particular it requires that the right-hand side
5409 of an assignment be evaluated before the left-hand side, so the
5410 above examples are no longer undefined. But this option will still
5411 warn about them, to help people avoid writing code that is
5412 undefined in C and earlier revisions of C++.
5413
5414 The standard is worded confusingly, therefore there is some debate
5415 over the precise meaning of the sequence point rules in subtle
5416 cases. Links to discussions of the problem, including proposed
5417 formal definitions, may be found on the GCC readings page, at
5418 <https://gcc.gnu.org/readings.html>.
5419
5420 This warning is enabled by -Wall for C and C++.
5421
5422 -Wno-return-local-addr
5423 Do not warn about returning a pointer (or in C++, a reference) to a
5424 variable that goes out of scope after the function returns.
5425
5426 -Wreturn-type
5427 Warn whenever a function is defined with a return type that
5428 defaults to "int". Also warn about any "return" statement with no
5429 return value in a function whose return type is not "void" (falling
5430 off the end of the function body is considered returning without a
5431 value).
5432
5433 For C only, warn about a "return" statement with an expression in a
5434 function whose return type is "void", unless the expression type is
5435 also "void". As a GNU extension, the latter case is accepted
5436 without a warning unless -Wpedantic is used. Attempting to use the
5437 return value of a non-"void" function other than "main" that flows
5438 off the end by reaching the closing curly brace that terminates the
5439 function is undefined.
5440
5441 Unlike in C, in C++, flowing off the end of a non-"void" function
5442 other than "main" results in undefined behavior even when the value
5443 of the function is not used.
5444
5445 This warning is enabled by default in C++ and by -Wall otherwise.
5446
5447 -Wno-shift-count-negative
5448 Controls warnings if a shift count is negative. This warning is
5449 enabled by default.
5450
5451 -Wno-shift-count-overflow
5452 Controls warnings if a shift count is greater than or equal to the
5453 bit width of the type. This warning is enabled by default.
5454
5455 -Wshift-negative-value
5456 Warn if left shifting a negative value. This warning is enabled by
5457 -Wextra in C99 (and newer) and C++11 to C++17 modes.
5458
5459 -Wno-shift-overflow
5460 -Wshift-overflow=n
5461 These options control warnings about left shift overflows.
5462
5463 -Wshift-overflow=1
5464 This is the warning level of -Wshift-overflow and is enabled by
5465 default in C99 and C++11 modes (and newer). This warning level
5466 does not warn about left-shifting 1 into the sign bit.
5467 (However, in C, such an overflow is still rejected in contexts
5468 where an integer constant expression is required.) No warning
5469 is emitted in C++20 mode (and newer), as signed left shifts
5470 always wrap.
5471
5472 -Wshift-overflow=2
5473 This warning level also warns about left-shifting 1 into the
5474 sign bit, unless C++14 mode (or newer) is active.
5475
5476 -Wswitch
5477 Warn whenever a "switch" statement has an index of enumerated type
5478 and lacks a "case" for one or more of the named codes of that
5479 enumeration. (The presence of a "default" label prevents this
5480 warning.) "case" labels outside the enumeration range also provoke
5481 warnings when this option is used (even if there is a "default"
5482 label). This warning is enabled by -Wall.
5483
5484 -Wswitch-default
5485 Warn whenever a "switch" statement does not have a "default" case.
5486
5487 -Wswitch-enum
5488 Warn whenever a "switch" statement has an index of enumerated type
5489 and lacks a "case" for one or more of the named codes of that
5490 enumeration. "case" labels outside the enumeration range also
5491 provoke warnings when this option is used. The only difference
5492 between -Wswitch and this option is that this option gives a
5493 warning about an omitted enumeration code even if there is a
5494 "default" label.
5495
5496 -Wno-switch-bool
5497 Do not warn when a "switch" statement has an index of boolean type
5498 and the case values are outside the range of a boolean type. It is
5499 possible to suppress this warning by casting the controlling
5500 expression to a type other than "bool". For example:
5501
5502 switch ((int) (a == 4))
5503 {
5504 ...
5505 }
5506
5507 This warning is enabled by default for C and C++ programs.
5508
5509 -Wno-switch-outside-range
5510 This option controls warnings when a "switch" case has a value that
5511 is outside of its respective type range. This warning is enabled
5512 by default for C and C++ programs.
5513
5514 -Wno-switch-unreachable
5515 Do not warn when a "switch" statement contains statements between
5516 the controlling expression and the first case label, which will
5517 never be executed. For example:
5518
5519 switch (cond)
5520 {
5521 i = 15;
5522 ...
5523 case 5:
5524 ...
5525 }
5526
5527 -Wswitch-unreachable does not warn if the statement between the
5528 controlling expression and the first case label is just a
5529 declaration:
5530
5531 switch (cond)
5532 {
5533 int i;
5534 ...
5535 case 5:
5536 i = 5;
5537 ...
5538 }
5539
5540 This warning is enabled by default for C and C++ programs.
5541
5542 -Wsync-nand (C and C++ only)
5543 Warn when "__sync_fetch_and_nand" and "__sync_nand_and_fetch"
5544 built-in functions are used. These functions changed semantics in
5545 GCC 4.4.
5546
5547 -Wtrivial-auto-var-init
5548 Warn when "-ftrivial-auto-var-init" cannot initialize the automatic
5549 variable. A common situation is an automatic variable that is
5550 declared between the controlling expression and the first case
5551 label of a "switch" statement.
5552
5553 -Wunused-but-set-parameter
5554 Warn whenever a function parameter is assigned to, but otherwise
5555 unused (aside from its declaration).
5556
5557 To suppress this warning use the "unused" attribute.
5558
5559 This warning is also enabled by -Wunused together with -Wextra.
5560
5561 -Wunused-but-set-variable
5562 Warn whenever a local variable is assigned to, but otherwise unused
5563 (aside from its declaration). This warning is enabled by -Wall.
5564
5565 To suppress this warning use the "unused" attribute.
5566
5567 This warning is also enabled by -Wunused, which is enabled by
5568 -Wall.
5569
5570 -Wunused-function
5571 Warn whenever a static function is declared but not defined or a
5572 non-inline static function is unused. This warning is enabled by
5573 -Wall.
5574
5575 -Wunused-label
5576 Warn whenever a label is declared but not used. This warning is
5577 enabled by -Wall.
5578
5579 To suppress this warning use the "unused" attribute.
5580
5581 -Wunused-local-typedefs (C, Objective-C, C++ and Objective-C++ only)
5582 Warn when a typedef locally defined in a function is not used.
5583 This warning is enabled by -Wall.
5584
5585 -Wunused-parameter
5586 Warn whenever a function parameter is unused aside from its
5587 declaration.
5588
5589 To suppress this warning use the "unused" attribute.
5590
5591 -Wno-unused-result
5592 Do not warn if a caller of a function marked with attribute
5593 "warn_unused_result" does not use its return value. The default is
5594 -Wunused-result.
5595
5596 -Wunused-variable
5597 Warn whenever a local or static variable is unused aside from its
5598 declaration. This option implies -Wunused-const-variable=1 for C,
5599 but not for C++. This warning is enabled by -Wall.
5600
5601 To suppress this warning use the "unused" attribute.
5602
5603 -Wunused-const-variable
5604 -Wunused-const-variable=n
5605 Warn whenever a constant static variable is unused aside from its
5606 declaration. -Wunused-const-variable=1 is enabled by
5607 -Wunused-variable for C, but not for C++. In C this declares
5608 variable storage, but in C++ this is not an error since const
5609 variables take the place of "#define"s.
5610
5611 To suppress this warning use the "unused" attribute.
5612
5613 -Wunused-const-variable=1
5614 This is the warning level that is enabled by -Wunused-variable
5615 for C. It warns only about unused static const variables
5616 defined in the main compilation unit, but not about static
5617 const variables declared in any header included.
5618
5619 -Wunused-const-variable=2
5620 This warning level also warns for unused constant static
5621 variables in headers (excluding system headers). This is the
5622 warning level of -Wunused-const-variable and must be explicitly
5623 requested since in C++ this isn't an error and in C it might be
5624 harder to clean up all headers included.
5625
5626 -Wunused-value
5627 Warn whenever a statement computes a result that is explicitly not
5628 used. To suppress this warning cast the unused expression to
5629 "void". This includes an expression-statement or the left-hand side
5630 of a comma expression that contains no side effects. For example,
5631 an expression such as "x[i,j]" causes a warning, while
5632 "x[(void)i,j]" does not.
5633
5634 This warning is enabled by -Wall.
5635
5636 -Wunused
5637 All the above -Wunused options combined.
5638
5639 In order to get a warning about an unused function parameter, you
5640 must either specify -Wextra -Wunused (note that -Wall implies
5641 -Wunused), or separately specify -Wunused-parameter.
5642
5643 -Wuninitialized
5644 Warn if an object with automatic or allocated storage duration is
5645 used without having been initialized. In C++, also warn if a non-
5646 static reference or non-static "const" member appears in a class
5647 without constructors.
5648
5649 In addition, passing a pointer (or in C++, a reference) to an
5650 uninitialized object to a "const"-qualified argument of a built-in
5651 function known to read the object is also diagnosed by this
5652 warning. (-Wmaybe-uninitialized is issued for ordinary functions.)
5653
5654 If you want to warn about code that uses the uninitialized value of
5655 the variable in its own initializer, use the -Winit-self option.
5656
5657 These warnings occur for individual uninitialized elements of
5658 structure, union or array variables as well as for variables that
5659 are uninitialized as a whole. They do not occur for variables or
5660 elements declared "volatile". Because these warnings depend on
5661 optimization, the exact variables or elements for which there are
5662 warnings depend on the precise optimization options and version of
5663 GCC used.
5664
5665 Note that there may be no warning about a variable that is used
5666 only to compute a value that itself is never used, because such
5667 computations may be deleted by data flow analysis before the
5668 warnings are printed.
5669
5670 In C++, this warning also warns about using uninitialized objects
5671 in member-initializer-lists. For example, GCC warns about "b"
5672 being uninitialized in the following snippet:
5673
5674 struct A {
5675 int a;
5676 int b;
5677 A() : a(b) { }
5678 };
5679
5680 -Wno-invalid-memory-model
5681 This option controls warnings for invocations of __atomic Builtins,
5682 __sync Builtins, and the C11 atomic generic functions with a memory
5683 consistency argument that is either invalid for the operation or
5684 outside the range of values of the "memory_order" enumeration. For
5685 example, since the "__atomic_store" and "__atomic_store_n" built-
5686 ins are only defined for the relaxed, release, and sequentially
5687 consistent memory orders the following code is diagnosed:
5688
5689 void store (int *i)
5690 {
5691 __atomic_store_n (i, 0, memory_order_consume);
5692 }
5693
5694 -Winvalid-memory-model is enabled by default.
5695
5696 -Wmaybe-uninitialized
5697 For an object with automatic or allocated storage duration, if
5698 there exists a path from the function entry to a use of the object
5699 that is initialized, but there exist some other paths for which the
5700 object is not initialized, the compiler emits a warning if it
5701 cannot prove the uninitialized paths are not executed at run time.
5702
5703 In addition, passing a pointer (or in C++, a reference) to an
5704 uninitialized object to a "const"-qualified function argument is
5705 also diagnosed by this warning. (-Wuninitialized is issued for
5706 built-in functions known to read the object.) Annotating the
5707 function with attribute "access (none)" indicates that the argument
5708 isn't used to access the object and avoids the warning.
5709
5710 These warnings are only possible in optimizing compilation, because
5711 otherwise GCC does not keep track of the state of variables.
5712
5713 These warnings are made optional because GCC may not be able to
5714 determine when the code is correct in spite of appearing to have an
5715 error. Here is one example of how this can happen:
5716
5717 {
5718 int x;
5719 switch (y)
5720 {
5721 case 1: x = 1;
5722 break;
5723 case 2: x = 4;
5724 break;
5725 case 3: x = 5;
5726 }
5727 foo (x);
5728 }
5729
5730 If the value of "y" is always 1, 2 or 3, then "x" is always
5731 initialized, but GCC doesn't know this. To suppress the warning,
5732 you need to provide a default case with assert(0) or similar code.
5733
5734 This option also warns when a non-volatile automatic variable might
5735 be changed by a call to "longjmp". The compiler sees only the
5736 calls to "setjmp". It cannot know where "longjmp" will be called;
5737 in fact, a signal handler could call it at any point in the code.
5738 As a result, you may get a warning even when there is in fact no
5739 problem because "longjmp" cannot in fact be called at the place
5740 that would cause a problem.
5741
5742 Some spurious warnings can be avoided if you declare all the
5743 functions you use that never return as "noreturn".
5744
5745 This warning is enabled by -Wall or -Wextra.
5746
5747 -Wunknown-pragmas
5748 Warn when a "#pragma" directive is encountered that is not
5749 understood by GCC. If this command-line option is used, warnings
5750 are even issued for unknown pragmas in system header files. This
5751 is not the case if the warnings are only enabled by the -Wall
5752 command-line option.
5753
5754 -Wno-pragmas
5755 Do not warn about misuses of pragmas, such as incorrect parameters,
5756 invalid syntax, or conflicts between pragmas. See also
5757 -Wunknown-pragmas.
5758
5759 -Wno-prio-ctor-dtor
5760 Do not warn if a priority from 0 to 100 is used for constructor or
5761 destructor. The use of constructor and destructor attributes allow
5762 you to assign a priority to the constructor/destructor to control
5763 its order of execution before "main" is called or after it returns.
5764 The priority values must be greater than 100 as the compiler
5765 reserves priority values between 0--100 for the implementation.
5766
5767 -Wstrict-aliasing
5768 This option is only active when -fstrict-aliasing is active. It
5769 warns about code that might break the strict aliasing rules that
5770 the compiler is using for optimization. The warning does not catch
5771 all cases, but does attempt to catch the more common pitfalls. It
5772 is included in -Wall. It is equivalent to -Wstrict-aliasing=3
5773
5774 -Wstrict-aliasing=n
5775 This option is only active when -fstrict-aliasing is active. It
5776 warns about code that might break the strict aliasing rules that
5777 the compiler is using for optimization. Higher levels correspond
5778 to higher accuracy (fewer false positives). Higher levels also
5779 correspond to more effort, similar to the way -O works.
5780 -Wstrict-aliasing is equivalent to -Wstrict-aliasing=3.
5781
5782 Level 1: Most aggressive, quick, least accurate. Possibly useful
5783 when higher levels do not warn but -fstrict-aliasing still breaks
5784 the code, as it has very few false negatives. However, it has many
5785 false positives. Warns for all pointer conversions between
5786 possibly incompatible types, even if never dereferenced. Runs in
5787 the front end only.
5788
5789 Level 2: Aggressive, quick, not too precise. May still have many
5790 false positives (not as many as level 1 though), and few false
5791 negatives (but possibly more than level 1). Unlike level 1, it
5792 only warns when an address is taken. Warns about incomplete types.
5793 Runs in the front end only.
5794
5795 Level 3 (default for -Wstrict-aliasing): Should have very few false
5796 positives and few false negatives. Slightly slower than levels 1
5797 or 2 when optimization is enabled. Takes care of the common
5798 pun+dereference pattern in the front end: "*(int*)&some_float". If
5799 optimization is enabled, it also runs in the back end, where it
5800 deals with multiple statement cases using flow-sensitive points-to
5801 information. Only warns when the converted pointer is
5802 dereferenced. Does not warn about incomplete types.
5803
5804 -Wstrict-overflow
5805 -Wstrict-overflow=n
5806 This option is only active when signed overflow is undefined. It
5807 warns about cases where the compiler optimizes based on the
5808 assumption that signed overflow does not occur. Note that it does
5809 not warn about all cases where the code might overflow: it only
5810 warns about cases where the compiler implements some optimization.
5811 Thus this warning depends on the optimization level.
5812
5813 An optimization that assumes that signed overflow does not occur is
5814 perfectly safe if the values of the variables involved are such
5815 that overflow never does, in fact, occur. Therefore this warning
5816 can easily give a false positive: a warning about code that is not
5817 actually a problem. To help focus on important issues, several
5818 warning levels are defined. No warnings are issued for the use of
5819 undefined signed overflow when estimating how many iterations a
5820 loop requires, in particular when determining whether a loop will
5821 be executed at all.
5822
5823 -Wstrict-overflow=1
5824 Warn about cases that are both questionable and easy to avoid.
5825 For example the compiler simplifies "x + 1 > x" to 1. This
5826 level of -Wstrict-overflow is enabled by -Wall; higher levels
5827 are not, and must be explicitly requested.
5828
5829 -Wstrict-overflow=2
5830 Also warn about other cases where a comparison is simplified to
5831 a constant. For example: "abs (x) >= 0". This can only be
5832 simplified when signed integer overflow is undefined, because
5833 "abs (INT_MIN)" overflows to "INT_MIN", which is less than
5834 zero. -Wstrict-overflow (with no level) is the same as
5835 -Wstrict-overflow=2.
5836
5837 -Wstrict-overflow=3
5838 Also warn about other cases where a comparison is simplified.
5839 For example: "x + 1 > 1" is simplified to "x > 0".
5840
5841 -Wstrict-overflow=4
5842 Also warn about other simplifications not covered by the above
5843 cases. For example: "(x * 10) / 5" is simplified to "x * 2".
5844
5845 -Wstrict-overflow=5
5846 Also warn about cases where the compiler reduces the magnitude
5847 of a constant involved in a comparison. For example: "x + 2 >
5848 y" is simplified to "x + 1 >= y". This is reported only at the
5849 highest warning level because this simplification applies to
5850 many comparisons, so this warning level gives a very large
5851 number of false positives.
5852
5853 -Wstring-compare
5854 Warn for calls to "strcmp" and "strncmp" whose result is determined
5855 to be either zero or non-zero in tests for such equality owing to
5856 the length of one argument being greater than the size of the array
5857 the other argument is stored in (or the bound in the case of
5858 "strncmp"). Such calls could be mistakes. For example, the call
5859 to "strcmp" below is diagnosed because its result is necessarily
5860 non-zero irrespective of the contents of the array "a".
5861
5862 extern char a[4];
5863 void f (char *d)
5864 {
5865 strcpy (d, "string");
5866 ...
5867 if (0 == strcmp (a, d)) // cannot be true
5868 puts ("a and d are the same");
5869 }
5870
5871 -Wstring-compare is enabled by -Wextra.
5872
5873 -Wno-stringop-overflow
5874 -Wstringop-overflow
5875 -Wstringop-overflow=type
5876 Warn for calls to string manipulation functions such as "memcpy"
5877 and "strcpy" that are determined to overflow the destination
5878 buffer. The optional argument is one greater than the type of
5879 Object Size Checking to perform to determine the size of the
5880 destination. The argument is meaningful only for functions that
5881 operate on character arrays but not for raw memory functions like
5882 "memcpy" which always make use of Object Size type-0. The option
5883 also warns for calls that specify a size in excess of the largest
5884 possible object or at most "SIZE_MAX / 2" bytes. The option
5885 produces the best results with optimization enabled but can detect
5886 a small subset of simple buffer overflows even without optimization
5887 in calls to the GCC built-in functions like "__builtin_memcpy" that
5888 correspond to the standard functions. In any case, the option
5889 warns about just a subset of buffer overflows detected by the
5890 corresponding overflow checking built-ins. For example, the option
5891 issues a warning for the "strcpy" call below because it copies at
5892 least 5 characters (the string "blue" including the terminating
5893 NUL) into the buffer of size 4.
5894
5895 enum Color { blue, purple, yellow };
5896 const char* f (enum Color clr)
5897 {
5898 static char buf [4];
5899 const char *str;
5900 switch (clr)
5901 {
5902 case blue: str = "blue"; break;
5903 case purple: str = "purple"; break;
5904 case yellow: str = "yellow"; break;
5905 }
5906
5907 return strcpy (buf, str); // warning here
5908 }
5909
5910 Option -Wstringop-overflow=2 is enabled by default.
5911
5912 -Wstringop-overflow
5913 -Wstringop-overflow=1
5914 The -Wstringop-overflow=1 option uses type-zero Object Size
5915 Checking to determine the sizes of destination objects. At
5916 this setting the option does not warn for writes past the end
5917 of subobjects of larger objects accessed by pointers unless the
5918 size of the largest surrounding object is known. When the
5919 destination may be one of several objects it is assumed to be
5920 the largest one of them. On Linux systems, when optimization
5921 is enabled at this setting the option warns for the same code
5922 as when the "_FORTIFY_SOURCE" macro is defined to a non-zero
5923 value.
5924
5925 -Wstringop-overflow=2
5926 The -Wstringop-overflow=2 option uses type-one Object Size
5927 Checking to determine the sizes of destination objects. At
5928 this setting the option warns about overflows when writing to
5929 members of the largest complete objects whose exact size is
5930 known. However, it does not warn for excessive writes to the
5931 same members of unknown objects referenced by pointers since
5932 they may point to arrays containing unknown numbers of
5933 elements. This is the default setting of the option.
5934
5935 -Wstringop-overflow=3
5936 The -Wstringop-overflow=3 option uses type-two Object Size
5937 Checking to determine the sizes of destination objects. At
5938 this setting the option warns about overflowing the smallest
5939 object or data member. This is the most restrictive setting of
5940 the option that may result in warnings for safe code.
5941
5942 -Wstringop-overflow=4
5943 The -Wstringop-overflow=4 option uses type-three Object Size
5944 Checking to determine the sizes of destination objects. At
5945 this setting the option warns about overflowing any data
5946 members, and when the destination is one of several objects it
5947 uses the size of the largest of them to decide whether to issue
5948 a warning. Similarly to -Wstringop-overflow=3 this setting of
5949 the option may result in warnings for benign code.
5950
5951 -Wno-stringop-overread
5952 Warn for calls to string manipulation functions such as "memchr",
5953 or "strcpy" that are determined to read past the end of the source
5954 sequence.
5955
5956 Option -Wstringop-overread is enabled by default.
5957
5958 -Wno-stringop-truncation
5959 Do not warn for calls to bounded string manipulation functions such
5960 as "strncat", "strncpy", and "stpncpy" that may either truncate the
5961 copied string or leave the destination unchanged.
5962
5963 In the following example, the call to "strncat" specifies a bound
5964 that is less than the length of the source string. As a result,
5965 the copy of the source will be truncated and so the call is
5966 diagnosed. To avoid the warning use "bufsize - strlen (buf) - 1)"
5967 as the bound.
5968
5969 void append (char *buf, size_t bufsize)
5970 {
5971 strncat (buf, ".txt", 3);
5972 }
5973
5974 As another example, the following call to "strncpy" results in
5975 copying to "d" just the characters preceding the terminating NUL,
5976 without appending the NUL to the end. Assuming the result of
5977 "strncpy" is necessarily a NUL-terminated string is a common
5978 mistake, and so the call is diagnosed. To avoid the warning when
5979 the result is not expected to be NUL-terminated, call "memcpy"
5980 instead.
5981
5982 void copy (char *d, const char *s)
5983 {
5984 strncpy (d, s, strlen (s));
5985 }
5986
5987 In the following example, the call to "strncpy" specifies the size
5988 of the destination buffer as the bound. If the length of the
5989 source string is equal to or greater than this size the result of
5990 the copy will not be NUL-terminated. Therefore, the call is also
5991 diagnosed. To avoid the warning, specify "sizeof buf - 1" as the
5992 bound and set the last element of the buffer to "NUL".
5993
5994 void copy (const char *s)
5995 {
5996 char buf[80];
5997 strncpy (buf, s, sizeof buf);
5998 ...
5999 }
6000
6001 In situations where a character array is intended to store a
6002 sequence of bytes with no terminating "NUL" such an array may be
6003 annotated with attribute "nonstring" to avoid this warning. Such
6004 arrays, however, are not suitable arguments to functions that
6005 expect "NUL"-terminated strings. To help detect accidental misuses
6006 of such arrays GCC issues warnings unless it can prove that the use
6007 is safe.
6008
6009 -Wsuggest-attribute=[pure|const|noreturn|format|cold|malloc]
6010 Warn for cases where adding an attribute may be beneficial. The
6011 attributes currently supported are listed below.
6012
6013 -Wsuggest-attribute=pure
6014 -Wsuggest-attribute=const
6015 -Wsuggest-attribute=noreturn
6016 -Wmissing-noreturn
6017 -Wsuggest-attribute=malloc
6018 Warn about functions that might be candidates for attributes
6019 "pure", "const" or "noreturn" or "malloc". The compiler only
6020 warns for functions visible in other compilation units or (in
6021 the case of "pure" and "const") if it cannot prove that the
6022 function returns normally. A function returns normally if it
6023 doesn't contain an infinite loop or return abnormally by
6024 throwing, calling "abort" or trapping. This analysis requires
6025 option -fipa-pure-const, which is enabled by default at -O and
6026 higher. Higher optimization levels improve the accuracy of the
6027 analysis.
6028
6029 -Wsuggest-attribute=format
6030 -Wmissing-format-attribute
6031 Warn about function pointers that might be candidates for
6032 "format" attributes. Note these are only possible candidates,
6033 not absolute ones. GCC guesses that function pointers with
6034 "format" attributes that are used in assignment,
6035 initialization, parameter passing or return statements should
6036 have a corresponding "format" attribute in the resulting type.
6037 I.e. the left-hand side of the assignment or initialization,
6038 the type of the parameter variable, or the return type of the
6039 containing function respectively should also have a "format"
6040 attribute to avoid the warning.
6041
6042 GCC also warns about function definitions that might be
6043 candidates for "format" attributes. Again, these are only
6044 possible candidates. GCC guesses that "format" attributes
6045 might be appropriate for any function that calls a function
6046 like "vprintf" or "vscanf", but this might not always be the
6047 case, and some functions for which "format" attributes are
6048 appropriate may not be detected.
6049
6050 -Wsuggest-attribute=cold
6051 Warn about functions that might be candidates for "cold"
6052 attribute. This is based on static detection and generally
6053 only warns about functions which always leads to a call to
6054 another "cold" function such as wrappers of C++ "throw" or
6055 fatal error reporting functions leading to "abort".
6056
6057 -Walloc-zero
6058 Warn about calls to allocation functions decorated with attribute
6059 "alloc_size" that specify zero bytes, including those to the built-
6060 in forms of the functions "aligned_alloc", "alloca", "calloc",
6061 "malloc", and "realloc". Because the behavior of these functions
6062 when called with a zero size differs among implementations (and in
6063 the case of "realloc" has been deprecated) relying on it may result
6064 in subtle portability bugs and should be avoided.
6065
6066 -Walloc-size-larger-than=byte-size
6067 Warn about calls to functions decorated with attribute "alloc_size"
6068 that attempt to allocate objects larger than the specified number
6069 of bytes, or where the result of the size computation in an integer
6070 type with infinite precision would exceed the value of PTRDIFF_MAX
6071 on the target. -Walloc-size-larger-than=PTRDIFF_MAX is enabled by
6072 default. Warnings controlled by the option can be disabled either
6073 by specifying byte-size of SIZE_MAX or more or by
6074 -Wno-alloc-size-larger-than.
6075
6076 -Wno-alloc-size-larger-than
6077 Disable -Walloc-size-larger-than= warnings. The option is
6078 equivalent to -Walloc-size-larger-than=SIZE_MAX or larger.
6079
6080 -Walloca
6081 This option warns on all uses of "alloca" in the source.
6082
6083 -Walloca-larger-than=byte-size
6084 This option warns on calls to "alloca" with an integer argument
6085 whose value is either zero, or that is not bounded by a controlling
6086 predicate that limits its value to at most byte-size. It also
6087 warns for calls to "alloca" where the bound value is unknown.
6088 Arguments of non-integer types are considered unbounded even if
6089 they appear to be constrained to the expected range.
6090
6091 For example, a bounded case of "alloca" could be:
6092
6093 void func (size_t n)
6094 {
6095 void *p;
6096 if (n <= 1000)
6097 p = alloca (n);
6098 else
6099 p = malloc (n);
6100 f (p);
6101 }
6102
6103 In the above example, passing "-Walloca-larger-than=1000" would not
6104 issue a warning because the call to "alloca" is known to be at most
6105 1000 bytes. However, if "-Walloca-larger-than=500" were passed,
6106 the compiler would emit a warning.
6107
6108 Unbounded uses, on the other hand, are uses of "alloca" with no
6109 controlling predicate constraining its integer argument. For
6110 example:
6111
6112 void func ()
6113 {
6114 void *p = alloca (n);
6115 f (p);
6116 }
6117
6118 If "-Walloca-larger-than=500" were passed, the above would trigger
6119 a warning, but this time because of the lack of bounds checking.
6120
6121 Note, that even seemingly correct code involving signed integers
6122 could cause a warning:
6123
6124 void func (signed int n)
6125 {
6126 if (n < 500)
6127 {
6128 p = alloca (n);
6129 f (p);
6130 }
6131 }
6132
6133 In the above example, n could be negative, causing a larger than
6134 expected argument to be implicitly cast into the "alloca" call.
6135
6136 This option also warns when "alloca" is used in a loop.
6137
6138 -Walloca-larger-than=PTRDIFF_MAX is enabled by default but is
6139 usually only effective when -ftree-vrp is active (default for -O2
6140 and above).
6141
6142 See also -Wvla-larger-than=byte-size.
6143
6144 -Wno-alloca-larger-than
6145 Disable -Walloca-larger-than= warnings. The option is equivalent
6146 to -Walloca-larger-than=SIZE_MAX or larger.
6147
6148 -Warith-conversion
6149 Do warn about implicit conversions from arithmetic operations even
6150 when conversion of the operands to the same type cannot change
6151 their values. This affects warnings from -Wconversion,
6152 -Wfloat-conversion, and -Wsign-conversion.
6153
6154 void f (char c, int i)
6155 {
6156 c = c + i; // warns with B<-Wconversion>
6157 c = c + 1; // only warns with B<-Warith-conversion>
6158 }
6159
6160 -Warray-bounds
6161 -Warray-bounds=n
6162 Warn about out of bounds subscripts or offsets into arrays. This
6163 warning is enabled by -Wall. It is more effective when -ftree-vrp
6164 is active (the default for -O2 and above) but a subset of instances
6165 are issued even without optimization.
6166
6167 -Warray-bounds=1
6168 This is the default warning level of -Warray-bounds and is
6169 enabled by -Wall; higher levels are not, and must be explicitly
6170 requested.
6171
6172 -Warray-bounds=2
6173 This warning level also warns about out of bounds accesses to
6174 trailing struct members of one-element array types and about
6175 the intermediate results of pointer arithmetic that may yield
6176 out of bounds values. This warning level may give a larger
6177 number of false positives and is deactivated by default.
6178
6179 -Warray-compare
6180 Warn about equality and relational comparisons between two operands
6181 of array type. This comparison was deprecated in C++20. For
6182 example:
6183
6184 int arr1[5];
6185 int arr2[5];
6186 bool same = arr1 == arr2;
6187
6188 -Warray-compare is enabled by -Wall.
6189
6190 -Warray-parameter
6191 -Warray-parameter=n
6192 Warn about redeclarations of functions involving arguments of array
6193 or pointer types of inconsistent kinds or forms, and enable the
6194 detection of out-of-bounds accesses to such parameters by warnings
6195 such as -Warray-bounds.
6196
6197 If the first function declaration uses the array form the bound
6198 specified in the array is assumed to be the minimum number of
6199 elements expected to be provided in calls to the function and the
6200 maximum number of elements accessed by it. Failing to provide
6201 arguments of sufficient size or accessing more than the maximum
6202 number of elements may be diagnosed by warnings such as
6203 -Warray-bounds. At level 1 the warning diagnoses inconsistencies
6204 involving array parameters declared using the "T[static N]" form.
6205
6206 For example, the warning triggers for the following redeclarations
6207 because the first one allows an array of any size to be passed to
6208 "f" while the second one with the keyword "static" specifies that
6209 the array argument must have at least four elements.
6210
6211 void f (int[static 4]);
6212 void f (int[]); // warning (inconsistent array form)
6213
6214 void g (void)
6215 {
6216 int *p = (int *)malloc (4);
6217 f (p); // warning (array too small)
6218 ...
6219 }
6220
6221 At level 2 the warning also triggers for redeclarations involving
6222 any other inconsistency in array or pointer argument forms denoting
6223 array sizes. Pointers and arrays of unspecified bound are
6224 considered equivalent and do not trigger a warning.
6225
6226 void g (int*);
6227 void g (int[]); // no warning
6228 void g (int[8]); // warning (inconsistent array bound)
6229
6230 -Warray-parameter=2 is included in -Wall. The -Wvla-parameter
6231 option triggers warnings for similar inconsistencies involving
6232 Variable Length Array arguments.
6233
6234 -Wattribute-alias=n
6235 -Wno-attribute-alias
6236 Warn about declarations using the "alias" and similar attributes
6237 whose target is incompatible with the type of the alias.
6238
6239 -Wattribute-alias=1
6240 The default warning level of the -Wattribute-alias option
6241 diagnoses incompatibilities between the type of the alias
6242 declaration and that of its target. Such incompatibilities are
6243 typically indicative of bugs.
6244
6245 -Wattribute-alias=2
6246 At this level -Wattribute-alias also diagnoses cases where the
6247 attributes of the alias declaration are more restrictive than
6248 the attributes applied to its target. These mismatches can
6249 potentially result in incorrect code generation. In other
6250 cases they may be benign and could be resolved simply by adding
6251 the missing attribute to the target. For comparison, see the
6252 -Wmissing-attributes option, which controls diagnostics when
6253 the alias declaration is less restrictive than the target,
6254 rather than more restrictive.
6255
6256 Attributes considered include "alloc_align", "alloc_size",
6257 "cold", "const", "hot", "leaf", "malloc", "nonnull",
6258 "noreturn", "nothrow", "pure", "returns_nonnull", and
6259 "returns_twice".
6260
6261 -Wattribute-alias is equivalent to -Wattribute-alias=1. This is
6262 the default. You can disable these warnings with either
6263 -Wno-attribute-alias or -Wattribute-alias=0.
6264
6265 -Wbidi-chars=[none|unpaired|any|ucn]
6266 Warn about possibly misleading UTF-8 bidirectional control
6267 characters in comments, string literals, character constants, and
6268 identifiers. Such characters can change left-to-right writing
6269 direction into right-to-left (and vice versa), which can cause
6270 confusion between the logical order and visual order. This may be
6271 dangerous; for instance, it may seem that a piece of code is not
6272 commented out, whereas it in fact is.
6273
6274 There are three levels of warning supported by GCC. The default is
6275 -Wbidi-chars=unpaired, which warns about improperly terminated bidi
6276 contexts. -Wbidi-chars=none turns the warning off.
6277 -Wbidi-chars=any warns about any use of bidirectional control
6278 characters.
6279
6280 By default, this warning does not warn about UCNs. It is, however,
6281 possible to turn on such checking by using
6282 -Wbidi-chars=unpaired,ucn or -Wbidi-chars=any,ucn. Using
6283 -Wbidi-chars=ucn is valid, and is equivalent to
6284 -Wbidi-chars=unpaired,ucn, if no previous -Wbidi-chars=any was
6285 specified.
6286
6287 -Wbool-compare
6288 Warn about boolean expression compared with an integer value
6289 different from "true"/"false". For instance, the following
6290 comparison is always false:
6291
6292 int n = 5;
6293 ...
6294 if ((n > 1) == 2) { ... }
6295
6296 This warning is enabled by -Wall.
6297
6298 -Wbool-operation
6299 Warn about suspicious operations on expressions of a boolean type.
6300 For instance, bitwise negation of a boolean is very likely a bug in
6301 the program. For C, this warning also warns about incrementing or
6302 decrementing a boolean, which rarely makes sense. (In C++,
6303 decrementing a boolean is always invalid. Incrementing a boolean
6304 is invalid in C++17, and deprecated otherwise.)
6305
6306 This warning is enabled by -Wall.
6307
6308 -Wduplicated-branches
6309 Warn when an if-else has identical branches. This warning detects
6310 cases like
6311
6312 if (p != NULL)
6313 return 0;
6314 else
6315 return 0;
6316
6317 It doesn't warn when both branches contain just a null statement.
6318 This warning also warn for conditional operators:
6319
6320 int i = x ? *p : *p;
6321
6322 -Wduplicated-cond
6323 Warn about duplicated conditions in an if-else-if chain. For
6324 instance, warn for the following code:
6325
6326 if (p->q != NULL) { ... }
6327 else if (p->q != NULL) { ... }
6328
6329 -Wframe-address
6330 Warn when the __builtin_frame_address or __builtin_return_address
6331 is called with an argument greater than 0. Such calls may return
6332 indeterminate values or crash the program. The warning is included
6333 in -Wall.
6334
6335 -Wno-discarded-qualifiers (C and Objective-C only)
6336 Do not warn if type qualifiers on pointers are being discarded.
6337 Typically, the compiler warns if a "const char *" variable is
6338 passed to a function that takes a "char *" parameter. This option
6339 can be used to suppress such a warning.
6340
6341 -Wno-discarded-array-qualifiers (C and Objective-C only)
6342 Do not warn if type qualifiers on arrays which are pointer targets
6343 are being discarded. Typically, the compiler warns if a "const int
6344 (*)[]" variable is passed to a function that takes a "int (*)[]"
6345 parameter. This option can be used to suppress such a warning.
6346
6347 -Wno-incompatible-pointer-types (C and Objective-C only)
6348 Do not warn when there is a conversion between pointers that have
6349 incompatible types. This warning is for cases not covered by
6350 -Wno-pointer-sign, which warns for pointer argument passing or
6351 assignment with different signedness.
6352
6353 -Wno-int-conversion (C and Objective-C only)
6354 Do not warn about incompatible integer to pointer and pointer to
6355 integer conversions. This warning is about implicit conversions;
6356 for explicit conversions the warnings -Wno-int-to-pointer-cast and
6357 -Wno-pointer-to-int-cast may be used.
6358
6359 -Wzero-length-bounds
6360 Warn about accesses to elements of zero-length array members that
6361 might overlap other members of the same object. Declaring interior
6362 zero-length arrays is discouraged because accesses to them are
6363 undefined. See
6364
6365 For example, the first two stores in function "bad" are diagnosed
6366 because the array elements overlap the subsequent members "b" and
6367 "c". The third store is diagnosed by -Warray-bounds because it is
6368 beyond the bounds of the enclosing object.
6369
6370 struct X { int a[0]; int b, c; };
6371 struct X x;
6372
6373 void bad (void)
6374 {
6375 x.a[0] = 0; // -Wzero-length-bounds
6376 x.a[1] = 1; // -Wzero-length-bounds
6377 x.a[2] = 2; // -Warray-bounds
6378 }
6379
6380 Option -Wzero-length-bounds is enabled by -Warray-bounds.
6381
6382 -Wno-div-by-zero
6383 Do not warn about compile-time integer division by zero. Floating-
6384 point division by zero is not warned about, as it can be a
6385 legitimate way of obtaining infinities and NaNs.
6386
6387 -Wsystem-headers
6388 Print warning messages for constructs found in system header files.
6389 Warnings from system headers are normally suppressed, on the
6390 assumption that they usually do not indicate real problems and
6391 would only make the compiler output harder to read. Using this
6392 command-line option tells GCC to emit warnings from system headers
6393 as if they occurred in user code. However, note that using -Wall
6394 in conjunction with this option does not warn about unknown pragmas
6395 in system headers---for that, -Wunknown-pragmas must also be used.
6396
6397 -Wtautological-compare
6398 Warn if a self-comparison always evaluates to true or false. This
6399 warning detects various mistakes such as:
6400
6401 int i = 1;
6402 ...
6403 if (i > i) { ... }
6404
6405 This warning also warns about bitwise comparisons that always
6406 evaluate to true or false, for instance:
6407
6408 if ((a & 16) == 10) { ... }
6409
6410 will always be false.
6411
6412 This warning is enabled by -Wall.
6413
6414 -Wtrampolines
6415 Warn about trampolines generated for pointers to nested functions.
6416 A trampoline is a small piece of data or code that is created at
6417 run time on the stack when the address of a nested function is
6418 taken, and is used to call the nested function indirectly. For
6419 some targets, it is made up of data only and thus requires no
6420 special treatment. But, for most targets, it is made up of code
6421 and thus requires the stack to be made executable in order for the
6422 program to work properly.
6423
6424 -Wfloat-equal
6425 Warn if floating-point values are used in equality comparisons.
6426
6427 The idea behind this is that sometimes it is convenient (for the
6428 programmer) to consider floating-point values as approximations to
6429 infinitely precise real numbers. If you are doing this, then you
6430 need to compute (by analyzing the code, or in some other way) the
6431 maximum or likely maximum error that the computation introduces,
6432 and allow for it when performing comparisons (and when producing
6433 output, but that's a different problem). In particular, instead of
6434 testing for equality, you should check to see whether the two
6435 values have ranges that overlap; and this is done with the
6436 relational operators, so equality comparisons are probably
6437 mistaken.
6438
6439 -Wtraditional (C and Objective-C only)
6440 Warn about certain constructs that behave differently in
6441 traditional and ISO C. Also warn about ISO C constructs that have
6442 no traditional C equivalent, and/or problematic constructs that
6443 should be avoided.
6444
6445 * Macro parameters that appear within string literals in the
6446 macro body. In traditional C macro replacement takes place
6447 within string literals, but in ISO C it does not.
6448
6449 * In traditional C, some preprocessor directives did not exist.
6450 Traditional preprocessors only considered a line to be a
6451 directive if the # appeared in column 1 on the line. Therefore
6452 -Wtraditional warns about directives that traditional C
6453 understands but ignores because the # does not appear as the
6454 first character on the line. It also suggests you hide
6455 directives like "#pragma" not understood by traditional C by
6456 indenting them. Some traditional implementations do not
6457 recognize "#elif", so this option suggests avoiding it
6458 altogether.
6459
6460 * A function-like macro that appears without arguments.
6461
6462 * The unary plus operator.
6463
6464 * The U integer constant suffix, or the F or L floating-point
6465 constant suffixes. (Traditional C does support the L suffix on
6466 integer constants.) Note, these suffixes appear in macros
6467 defined in the system headers of most modern systems, e.g. the
6468 _MIN/_MAX macros in "<limits.h>". Use of these macros in user
6469 code might normally lead to spurious warnings, however GCC's
6470 integrated preprocessor has enough context to avoid warning in
6471 these cases.
6472
6473 * A function declared external in one block and then used after
6474 the end of the block.
6475
6476 * A "switch" statement has an operand of type "long".
6477
6478 * A non-"static" function declaration follows a "static" one.
6479 This construct is not accepted by some traditional C compilers.
6480
6481 * The ISO type of an integer constant has a different width or
6482 signedness from its traditional type. This warning is only
6483 issued if the base of the constant is ten. I.e. hexadecimal or
6484 octal values, which typically represent bit patterns, are not
6485 warned about.
6486
6487 * Usage of ISO string concatenation is detected.
6488
6489 * Initialization of automatic aggregates.
6490
6491 * Identifier conflicts with labels. Traditional C lacks a
6492 separate namespace for labels.
6493
6494 * Initialization of unions. If the initializer is zero, the
6495 warning is omitted. This is done under the assumption that the
6496 zero initializer in user code appears conditioned on e.g.
6497 "__STDC__" to avoid missing initializer warnings and relies on
6498 default initialization to zero in the traditional C case.
6499
6500 * Conversions by prototypes between fixed/floating-point values
6501 and vice versa. The absence of these prototypes when compiling
6502 with traditional C causes serious problems. This is a subset
6503 of the possible conversion warnings; for the full set use
6504 -Wtraditional-conversion.
6505
6506 * Use of ISO C style function definitions. This warning
6507 intentionally is not issued for prototype declarations or
6508 variadic functions because these ISO C features appear in your
6509 code when using libiberty's traditional C compatibility macros,
6510 "PARAMS" and "VPARAMS". This warning is also bypassed for
6511 nested functions because that feature is already a GCC
6512 extension and thus not relevant to traditional C compatibility.
6513
6514 -Wtraditional-conversion (C and Objective-C only)
6515 Warn if a prototype causes a type conversion that is different from
6516 what would happen to the same argument in the absence of a
6517 prototype. This includes conversions of fixed point to floating
6518 and vice versa, and conversions changing the width or signedness of
6519 a fixed-point argument except when the same as the default
6520 promotion.
6521
6522 -Wdeclaration-after-statement (C and Objective-C only)
6523 Warn when a declaration is found after a statement in a block.
6524 This construct, known from C++, was introduced with ISO C99 and is
6525 by default allowed in GCC. It is not supported by ISO C90.
6526
6527 -Wshadow
6528 Warn whenever a local variable or type declaration shadows another
6529 variable, parameter, type, class member (in C++), or instance
6530 variable (in Objective-C) or whenever a built-in function is
6531 shadowed. Note that in C++, the compiler warns if a local variable
6532 shadows an explicit typedef, but not if it shadows a
6533 struct/class/enum. If this warning is enabled, it includes also
6534 all instances of local shadowing. This means that
6535 -Wno-shadow=local and -Wno-shadow=compatible-local are ignored when
6536 -Wshadow is used. Same as -Wshadow=global.
6537
6538 -Wno-shadow-ivar (Objective-C only)
6539 Do not warn whenever a local variable shadows an instance variable
6540 in an Objective-C method.
6541
6542 -Wshadow=global
6543 Warn for any shadowing. Same as -Wshadow.
6544
6545 -Wshadow=local
6546 Warn when a local variable shadows another local variable or
6547 parameter.
6548
6549 -Wshadow=compatible-local
6550 Warn when a local variable shadows another local variable or
6551 parameter whose type is compatible with that of the shadowing
6552 variable. In C++, type compatibility here means the type of the
6553 shadowing variable can be converted to that of the shadowed
6554 variable. The creation of this flag (in addition to
6555 -Wshadow=local) is based on the idea that when a local variable
6556 shadows another one of incompatible type, it is most likely
6557 intentional, not a bug or typo, as shown in the following example:
6558
6559 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6560 {
6561 for (int i = 0; i < N; ++i)
6562 {
6563 ...
6564 }
6565 ...
6566 }
6567
6568 Since the two variable "i" in the example above have incompatible
6569 types, enabling only -Wshadow=compatible-local does not emit a
6570 warning. Because their types are incompatible, if a programmer
6571 accidentally uses one in place of the other, type checking is
6572 expected to catch that and emit an error or warning. Use of this
6573 flag instead of -Wshadow=local can possibly reduce the number of
6574 warnings triggered by intentional shadowing. Note that this also
6575 means that shadowing "const char *i" by "char *i" does not emit a
6576 warning.
6577
6578 This warning is also enabled by -Wshadow=local.
6579
6580 -Wlarger-than=byte-size
6581 Warn whenever an object is defined whose size exceeds byte-size.
6582 -Wlarger-than=PTRDIFF_MAX is enabled by default. Warnings
6583 controlled by the option can be disabled either by specifying byte-
6584 size of SIZE_MAX or more or by -Wno-larger-than.
6585
6586 Also warn for calls to bounded functions such as "memchr" or
6587 "strnlen" that specify a bound greater than the largest possible
6588 object, which is PTRDIFF_MAX bytes by default. These warnings can
6589 only be disabled by -Wno-larger-than.
6590
6591 -Wno-larger-than
6592 Disable -Wlarger-than= warnings. The option is equivalent to
6593 -Wlarger-than=SIZE_MAX or larger.
6594
6595 -Wframe-larger-than=byte-size
6596 Warn if the size of a function frame exceeds byte-size. The
6597 computation done to determine the stack frame size is approximate
6598 and not conservative. The actual requirements may be somewhat
6599 greater than byte-size even if you do not get a warning. In
6600 addition, any space allocated via "alloca", variable-length arrays,
6601 or related constructs is not included by the compiler when
6602 determining whether or not to issue a warning.
6603 -Wframe-larger-than=PTRDIFF_MAX is enabled by default. Warnings
6604 controlled by the option can be disabled either by specifying byte-
6605 size of SIZE_MAX or more or by -Wno-frame-larger-than.
6606
6607 -Wno-frame-larger-than
6608 Disable -Wframe-larger-than= warnings. The option is equivalent to
6609 -Wframe-larger-than=SIZE_MAX or larger.
6610
6611 -Wfree-nonheap-object
6612 Warn when attempting to deallocate an object that was either not
6613 allocated on the heap, or by using a pointer that was not returned
6614 from a prior call to the corresponding allocation function. For
6615 example, because the call to "stpcpy" returns a pointer to the
6616 terminating nul character and not to the beginning of the object,
6617 the call to "free" below is diagnosed.
6618
6619 void f (char *p)
6620 {
6621 p = stpcpy (p, "abc");
6622 // ...
6623 free (p); // warning
6624 }
6625
6626 -Wfree-nonheap-object is included in -Wall.
6627
6628 -Wstack-usage=byte-size
6629 Warn if the stack usage of a function might exceed byte-size. The
6630 computation done to determine the stack usage is conservative. Any
6631 space allocated via "alloca", variable-length arrays, or related
6632 constructs is included by the compiler when determining whether or
6633 not to issue a warning.
6634
6635 The message is in keeping with the output of -fstack-usage.
6636
6637 * If the stack usage is fully static but exceeds the specified
6638 amount, it's:
6639
6640 warning: stack usage is 1120 bytes
6641
6642 * If the stack usage is (partly) dynamic but bounded, it's:
6643
6644 warning: stack usage might be 1648 bytes
6645
6646 * If the stack usage is (partly) dynamic and not bounded, it's:
6647
6648 warning: stack usage might be unbounded
6649
6650 -Wstack-usage=PTRDIFF_MAX is enabled by default. Warnings
6651 controlled by the option can be disabled either by specifying byte-
6652 size of SIZE_MAX or more or by -Wno-stack-usage.
6653
6654 -Wno-stack-usage
6655 Disable -Wstack-usage= warnings. The option is equivalent to
6656 -Wstack-usage=SIZE_MAX or larger.
6657
6658 -Wunsafe-loop-optimizations
6659 Warn if the loop cannot be optimized because the compiler cannot
6660 assume anything on the bounds of the loop indices. With
6661 -funsafe-loop-optimizations warn if the compiler makes such
6662 assumptions.
6663
6664 -Wno-pedantic-ms-format (MinGW targets only)
6665 When used in combination with -Wformat and -pedantic without GNU
6666 extensions, this option disables the warnings about non-ISO
6667 "printf" / "scanf" format width specifiers "I32", "I64", and "I"
6668 used on Windows targets, which depend on the MS runtime.
6669
6670 -Wpointer-arith
6671 Warn about anything that depends on the "size of" a function type
6672 or of "void". GNU C assigns these types a size of 1, for
6673 convenience in calculations with "void *" pointers and pointers to
6674 functions. In C++, warn also when an arithmetic operation involves
6675 "NULL". This warning is also enabled by -Wpedantic.
6676
6677 -Wno-pointer-compare
6678 Do not warn if a pointer is compared with a zero character
6679 constant. This usually means that the pointer was meant to be
6680 dereferenced. For example:
6681
6682 const char *p = foo ();
6683 if (p == '\0')
6684 return 42;
6685
6686 Note that the code above is invalid in C++11.
6687
6688 This warning is enabled by default.
6689
6690 -Wtsan
6691 Warn about unsupported features in ThreadSanitizer.
6692
6693 ThreadSanitizer does not support "std::atomic_thread_fence" and can
6694 report false positives.
6695
6696 This warning is enabled by default.
6697
6698 -Wtype-limits
6699 Warn if a comparison is always true or always false due to the
6700 limited range of the data type, but do not warn for constant
6701 expressions. For example, warn if an unsigned variable is compared
6702 against zero with "<" or ">=". This warning is also enabled by
6703 -Wextra.
6704
6705 -Wabsolute-value (C and Objective-C only)
6706 Warn for calls to standard functions that compute the absolute
6707 value of an argument when a more appropriate standard function is
6708 available. For example, calling "abs(3.14)" triggers the warning
6709 because the appropriate function to call to compute the absolute
6710 value of a double argument is "fabs". The option also triggers
6711 warnings when the argument in a call to such a function has an
6712 unsigned type. This warning can be suppressed with an explicit
6713 type cast and it is also enabled by -Wextra.
6714
6715 -Wcomment
6716 -Wcomments
6717 Warn whenever a comment-start sequence /* appears in a /* comment,
6718 or whenever a backslash-newline appears in a // comment. This
6719 warning is enabled by -Wall.
6720
6721 -Wtrigraphs
6722 Warn if any trigraphs are encountered that might change the meaning
6723 of the program. Trigraphs within comments are not warned about,
6724 except those that would form escaped newlines.
6725
6726 This option is implied by -Wall. If -Wall is not given, this
6727 option is still enabled unless trigraphs are enabled. To get
6728 trigraph conversion without warnings, but get the other -Wall
6729 warnings, use -trigraphs -Wall -Wno-trigraphs.
6730
6731 -Wundef
6732 Warn if an undefined identifier is evaluated in an "#if" directive.
6733 Such identifiers are replaced with zero.
6734
6735 -Wexpansion-to-defined
6736 Warn whenever defined is encountered in the expansion of a macro
6737 (including the case where the macro is expanded by an #if
6738 directive). Such usage is not portable. This warning is also
6739 enabled by -Wpedantic and -Wextra.
6740
6741 -Wunused-macros
6742 Warn about macros defined in the main file that are unused. A
6743 macro is used if it is expanded or tested for existence at least
6744 once. The preprocessor also warns if the macro has not been used
6745 at the time it is redefined or undefined.
6746
6747 Built-in macros, macros defined on the command line, and macros
6748 defined in include files are not warned about.
6749
6750 Note: If a macro is actually used, but only used in skipped
6751 conditional blocks, then the preprocessor reports it as unused. To
6752 avoid the warning in such a case, you might improve the scope of
6753 the macro's definition by, for example, moving it into the first
6754 skipped block. Alternatively, you could provide a dummy use with
6755 something like:
6756
6757 #if defined the_macro_causing_the_warning
6758 #endif
6759
6760 -Wno-endif-labels
6761 Do not warn whenever an "#else" or an "#endif" are followed by
6762 text. This sometimes happens in older programs with code of the
6763 form
6764
6765 #if FOO
6766 ...
6767 #else FOO
6768 ...
6769 #endif FOO
6770
6771 The second and third "FOO" should be in comments. This warning is
6772 on by default.
6773
6774 -Wbad-function-cast (C and Objective-C only)
6775 Warn when a function call is cast to a non-matching type. For
6776 example, warn if a call to a function returning an integer type is
6777 cast to a pointer type.
6778
6779 -Wc90-c99-compat (C and Objective-C only)
6780 Warn about features not present in ISO C90, but present in ISO C99.
6781 For instance, warn about use of variable length arrays, "long long"
6782 type, "bool" type, compound literals, designated initializers, and
6783 so on. This option is independent of the standards mode. Warnings
6784 are disabled in the expression that follows "__extension__".
6785
6786 -Wc99-c11-compat (C and Objective-C only)
6787 Warn about features not present in ISO C99, but present in ISO C11.
6788 For instance, warn about use of anonymous structures and unions,
6789 "_Atomic" type qualifier, "_Thread_local" storage-class specifier,
6790 "_Alignas" specifier, "Alignof" operator, "_Generic" keyword, and
6791 so on. This option is independent of the standards mode. Warnings
6792 are disabled in the expression that follows "__extension__".
6793
6794 -Wc11-c2x-compat (C and Objective-C only)
6795 Warn about features not present in ISO C11, but present in ISO C2X.
6796 For instance, warn about omitting the string in "_Static_assert",
6797 use of [[]] syntax for attributes, use of decimal floating-point
6798 types, and so on. This option is independent of the standards
6799 mode. Warnings are disabled in the expression that follows
6800 "__extension__".
6801
6802 -Wc++-compat (C and Objective-C only)
6803 Warn about ISO C constructs that are outside of the common subset
6804 of ISO C and ISO C++, e.g. request for implicit conversion from
6805 "void *" to a pointer to non-"void" type.
6806
6807 -Wc++11-compat (C++ and Objective-C++ only)
6808 Warn about C++ constructs whose meaning differs between ISO C++
6809 1998 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are
6810 keywords in ISO C++ 2011. This warning turns on -Wnarrowing and is
6811 enabled by -Wall.
6812
6813 -Wc++14-compat (C++ and Objective-C++ only)
6814 Warn about C++ constructs whose meaning differs between ISO C++
6815 2011 and ISO C++ 2014. This warning is enabled by -Wall.
6816
6817 -Wc++17-compat (C++ and Objective-C++ only)
6818 Warn about C++ constructs whose meaning differs between ISO C++
6819 2014 and ISO C++ 2017. This warning is enabled by -Wall.
6820
6821 -Wc++20-compat (C++ and Objective-C++ only)
6822 Warn about C++ constructs whose meaning differs between ISO C++
6823 2017 and ISO C++ 2020. This warning is enabled by -Wall.
6824
6825 -Wno-c++11-extensions (C++ and Objective-C++ only)
6826 Do not warn about C++11 constructs in code being compiled using an
6827 older C++ standard. Even without this option, some C++11
6828 constructs will only be diagnosed if -Wpedantic is used.
6829
6830 -Wno-c++14-extensions (C++ and Objective-C++ only)
6831 Do not warn about C++14 constructs in code being compiled using an
6832 older C++ standard. Even without this option, some C++14
6833 constructs will only be diagnosed if -Wpedantic is used.
6834
6835 -Wno-c++17-extensions (C++ and Objective-C++ only)
6836 Do not warn about C++17 constructs in code being compiled using an
6837 older C++ standard. Even without this option, some C++17
6838 constructs will only be diagnosed if -Wpedantic is used.
6839
6840 -Wno-c++20-extensions (C++ and Objective-C++ only)
6841 Do not warn about C++20 constructs in code being compiled using an
6842 older C++ standard. Even without this option, some C++20
6843 constructs will only be diagnosed if -Wpedantic is used.
6844
6845 -Wno-c++23-extensions (C++ and Objective-C++ only)
6846 Do not warn about C++23 constructs in code being compiled using an
6847 older C++ standard. Even without this option, some C++23
6848 constructs will only be diagnosed if -Wpedantic is used.
6849
6850 -Wcast-qual
6851 Warn whenever a pointer is cast so as to remove a type qualifier
6852 from the target type. For example, warn if a "const char *" is
6853 cast to an ordinary "char *".
6854
6855 Also warn when making a cast that introduces a type qualifier in an
6856 unsafe way. For example, casting "char **" to "const char **" is
6857 unsafe, as in this example:
6858
6859 /* p is char ** value. */
6860 const char **q = (const char **) p;
6861 /* Assignment of readonly string to const char * is OK. */
6862 *q = "string";
6863 /* Now char** pointer points to read-only memory. */
6864 **p = 'b';
6865
6866 -Wcast-align
6867 Warn whenever a pointer is cast such that the required alignment of
6868 the target is increased. For example, warn if a "char *" is cast
6869 to an "int *" on machines where integers can only be accessed at
6870 two- or four-byte boundaries.
6871
6872 -Wcast-align=strict
6873 Warn whenever a pointer is cast such that the required alignment of
6874 the target is increased. For example, warn if a "char *" is cast
6875 to an "int *" regardless of the target machine.
6876
6877 -Wcast-function-type
6878 Warn when a function pointer is cast to an incompatible function
6879 pointer. In a cast involving function types with a variable
6880 argument list only the types of initial arguments that are provided
6881 are considered. Any parameter of pointer-type matches any other
6882 pointer-type. Any benign differences in integral types are
6883 ignored, like "int" vs. "long" on ILP32 targets. Likewise type
6884 qualifiers are ignored. The function type "void (*) (void)" is
6885 special and matches everything, which can be used to suppress this
6886 warning. In a cast involving pointer to member types this warning
6887 warns whenever the type cast is changing the pointer to member
6888 type. This warning is enabled by -Wextra.
6889
6890 -Wwrite-strings
6891 When compiling C, give string constants the type "const
6892 char[length]" so that copying the address of one into a non-"const"
6893 "char *" pointer produces a warning. These warnings help you find
6894 at compile time code that can try to write into a string constant,
6895 but only if you have been very careful about using "const" in
6896 declarations and prototypes. Otherwise, it is just a nuisance.
6897 This is why we did not make -Wall request these warnings.
6898
6899 When compiling C++, warn about the deprecated conversion from
6900 string literals to "char *". This warning is enabled by default
6901 for C++ programs.
6902
6903 -Wclobbered
6904 Warn for variables that might be changed by "longjmp" or "vfork".
6905 This warning is also enabled by -Wextra.
6906
6907 -Wconversion
6908 Warn for implicit conversions that may alter a value. This includes
6909 conversions between real and integer, like "abs (x)" when "x" is
6910 "double"; conversions between signed and unsigned, like "unsigned
6911 ui = -1"; and conversions to smaller types, like "sqrtf (M_PI)". Do
6912 not warn for explicit casts like "abs ((int) x)" and "ui =
6913 (unsigned) -1", or if the value is not changed by the conversion
6914 like in "abs (2.0)". Warnings about conversions between signed and
6915 unsigned integers can be disabled by using -Wno-sign-conversion.
6916
6917 For C++, also warn for confusing overload resolution for user-
6918 defined conversions; and conversions that never use a type
6919 conversion operator: conversions to "void", the same type, a base
6920 class or a reference to them. Warnings about conversions between
6921 signed and unsigned integers are disabled by default in C++ unless
6922 -Wsign-conversion is explicitly enabled.
6923
6924 Warnings about conversion from arithmetic on a small type back to
6925 that type are only given with -Warith-conversion.
6926
6927 -Wdangling-else
6928 Warn about constructions where there may be confusion to which "if"
6929 statement an "else" branch belongs. Here is an example of such a
6930 case:
6931
6932 {
6933 if (a)
6934 if (b)
6935 foo ();
6936 else
6937 bar ();
6938 }
6939
6940 In C/C++, every "else" branch belongs to the innermost possible
6941 "if" statement, which in this example is "if (b)". This is often
6942 not what the programmer expected, as illustrated in the above
6943 example by indentation the programmer chose. When there is the
6944 potential for this confusion, GCC issues a warning when this flag
6945 is specified. To eliminate the warning, add explicit braces around
6946 the innermost "if" statement so there is no way the "else" can
6947 belong to the enclosing "if". The resulting code looks like this:
6948
6949 {
6950 if (a)
6951 {
6952 if (b)
6953 foo ();
6954 else
6955 bar ();
6956 }
6957 }
6958
6959 This warning is enabled by -Wparentheses.
6960
6961 -Wdangling-pointer
6962 -Wdangling-pointer=n
6963 Warn about uses of pointers (or C++ references) to objects with
6964 automatic storage duration after their lifetime has ended. This
6965 includes local variables declared in nested blocks, compound
6966 literals and other unnamed temporary objects. In addition, warn
6967 about storing the address of such objects in escaped pointers. The
6968 warning is enabled at all optimization levels but may yield
6969 different results with optimization than without.
6970
6971 -Wdangling-pointer=1
6972 At level 1 the warning diagnoses only unconditional uses of
6973 dangling pointers. For example
6974
6975 int f (int c1, int c2, x)
6976 {
6977 char *p = strchr ((char[]){ c1, c2 }, c3);
6978 return p ? *p : 'x'; // warning: dangling pointer to a compound literal
6979 }
6980
6981 In the following function the store of the address of the local
6982 variable "x" in the escaped pointer *p also triggers the
6983 warning.
6984
6985 void g (int **p)
6986 {
6987 int x = 7;
6988 *p = &x; // warning: storing the address of a local variable in *p
6989 }
6990
6991 -Wdangling-pointer=2
6992 At level 2, in addition to unconditional uses the warning also
6993 diagnoses conditional uses of dangling pointers.
6994
6995 For example, because the array a in the following function is
6996 out of scope when the pointer s that was set to point is used,
6997 the warning triggers at this level.
6998
6999 void f (char *s)
7000 {
7001 if (!s)
7002 {
7003 char a[12] = "tmpname";
7004 s = a;
7005 }
7006 strcat (s, ".tmp"); // warning: dangling pointer to a may be used
7007 ...
7008 }
7009
7010 -Wdangling-pointer=2 is included in -Wall.
7011
7012 -Wdate-time
7013 Warn when macros "__TIME__", "__DATE__" or "__TIMESTAMP__" are
7014 encountered as they might prevent bit-wise-identical reproducible
7015 compilations.
7016
7017 -Wempty-body
7018 Warn if an empty body occurs in an "if", "else" or "do while"
7019 statement. This warning is also enabled by -Wextra.
7020
7021 -Wno-endif-labels
7022 Do not warn about stray tokens after "#else" and "#endif".
7023
7024 -Wenum-compare
7025 Warn about a comparison between values of different enumerated
7026 types. In C++ enumerated type mismatches in conditional
7027 expressions are also diagnosed and the warning is enabled by
7028 default. In C this warning is enabled by -Wall.
7029
7030 -Wenum-conversion
7031 Warn when a value of enumerated type is implicitly converted to a
7032 different enumerated type. This warning is enabled by -Wextra in
7033 C.
7034
7035 -Wjump-misses-init (C, Objective-C only)
7036 Warn if a "goto" statement or a "switch" statement jumps forward
7037 across the initialization of a variable, or jumps backward to a
7038 label after the variable has been initialized. This only warns
7039 about variables that are initialized when they are declared. This
7040 warning is only supported for C and Objective-C; in C++ this sort
7041 of branch is an error in any case.
7042
7043 -Wjump-misses-init is included in -Wc++-compat. It can be disabled
7044 with the -Wno-jump-misses-init option.
7045
7046 -Wsign-compare
7047 Warn when a comparison between signed and unsigned values could
7048 produce an incorrect result when the signed value is converted to
7049 unsigned. In C++, this warning is also enabled by -Wall. In C, it
7050 is also enabled by -Wextra.
7051
7052 -Wsign-conversion
7053 Warn for implicit conversions that may change the sign of an
7054 integer value, like assigning a signed integer expression to an
7055 unsigned integer variable. An explicit cast silences the warning.
7056 In C, this option is enabled also by -Wconversion.
7057
7058 -Wfloat-conversion
7059 Warn for implicit conversions that reduce the precision of a real
7060 value. This includes conversions from real to integer, and from
7061 higher precision real to lower precision real values. This option
7062 is also enabled by -Wconversion.
7063
7064 -Wno-scalar-storage-order
7065 Do not warn on suspicious constructs involving reverse scalar
7066 storage order.
7067
7068 -Wsizeof-array-div
7069 Warn about divisions of two sizeof operators when the first one is
7070 applied to an array and the divisor does not equal the size of the
7071 array element. In such a case, the computation will not yield the
7072 number of elements in the array, which is likely what the user
7073 intended. This warning warns e.g. about
7074
7075 int fn ()
7076 {
7077 int arr[10];
7078 return sizeof (arr) / sizeof (short);
7079 }
7080
7081 This warning is enabled by -Wall.
7082
7083 -Wsizeof-pointer-div
7084 Warn for suspicious divisions of two sizeof expressions that divide
7085 the pointer size by the element size, which is the usual way to
7086 compute the array size but won't work out correctly with pointers.
7087 This warning warns e.g. about "sizeof (ptr) / sizeof (ptr[0])" if
7088 "ptr" is not an array, but a pointer. This warning is enabled by
7089 -Wall.
7090
7091 -Wsizeof-pointer-memaccess
7092 Warn for suspicious length parameters to certain string and memory
7093 built-in functions if the argument uses "sizeof". This warning
7094 triggers for example for "memset (ptr, 0, sizeof (ptr));" if "ptr"
7095 is not an array, but a pointer, and suggests a possible fix, or
7096 about "memcpy (&foo, ptr, sizeof (&foo));".
7097 -Wsizeof-pointer-memaccess also warns about calls to bounded string
7098 copy functions like "strncat" or "strncpy" that specify as the
7099 bound a "sizeof" expression of the source array. For example, in
7100 the following function the call to "strncat" specifies the size of
7101 the source string as the bound. That is almost certainly a mistake
7102 and so the call is diagnosed.
7103
7104 void make_file (const char *name)
7105 {
7106 char path[PATH_MAX];
7107 strncpy (path, name, sizeof path - 1);
7108 strncat (path, ".text", sizeof ".text");
7109 ...
7110 }
7111
7112 The -Wsizeof-pointer-memaccess option is enabled by -Wall.
7113
7114 -Wno-sizeof-array-argument
7115 Do not warn when the "sizeof" operator is applied to a parameter
7116 that is declared as an array in a function definition. This
7117 warning is enabled by default for C and C++ programs.
7118
7119 -Wmemset-elt-size
7120 Warn for suspicious calls to the "memset" built-in function, if the
7121 first argument references an array, and the third argument is a
7122 number equal to the number of elements, but not equal to the size
7123 of the array in memory. This indicates that the user has omitted a
7124 multiplication by the element size. This warning is enabled by
7125 -Wall.
7126
7127 -Wmemset-transposed-args
7128 Warn for suspicious calls to the "memset" built-in function where
7129 the second argument is not zero and the third argument is zero.
7130 For example, the call "memset (buf, sizeof buf, 0)" is diagnosed
7131 because "memset (buf, 0, sizeof buf)" was meant instead. The
7132 diagnostic is only emitted if the third argument is a literal zero.
7133 Otherwise, if it is an expression that is folded to zero, or a cast
7134 of zero to some type, it is far less likely that the arguments have
7135 been mistakenly transposed and no warning is emitted. This warning
7136 is enabled by -Wall.
7137
7138 -Waddress
7139 Warn about suspicious uses of address expressions. These include
7140 comparing the address of a function or a declared object to the
7141 null pointer constant such as in
7142
7143 void f (void);
7144 void g (void)
7145 {
7146 if (!func) // warning: expression evaluates to false
7147 abort ();
7148 }
7149
7150 comparisons of a pointer to a string literal, such as in
7151
7152 void f (const char *x)
7153 {
7154 if (x == "abc") // warning: expression evaluates to false
7155 puts ("equal");
7156 }
7157
7158 and tests of the results of pointer addition or subtraction for
7159 equality to null, such as in
7160
7161 void f (const int *p, int i)
7162 {
7163 return p + i == NULL;
7164 }
7165
7166 Such uses typically indicate a programmer error: the address of
7167 most functions and objects necessarily evaluates to true (the
7168 exception are weak symbols), so their use in a conditional might
7169 indicate missing parentheses in a function call or a missing
7170 dereference in an array expression. The subset of the warning for
7171 object pointers can be suppressed by casting the pointer operand to
7172 an integer type such as "inptr_t" or "uinptr_t". Comparisons
7173 against string literals result in unspecified behavior and are not
7174 portable, and suggest the intent was to call "strcmp". The warning
7175 is suppressed if the suspicious expression is the result of macro
7176 expansion. -Waddress warning is enabled by -Wall.
7177
7178 -Wno-address-of-packed-member
7179 Do not warn when the address of packed member of struct or union is
7180 taken, which usually results in an unaligned pointer value. This
7181 is enabled by default.
7182
7183 -Wlogical-op
7184 Warn about suspicious uses of logical operators in expressions.
7185 This includes using logical operators in contexts where a bit-wise
7186 operator is likely to be expected. Also warns when the operands of
7187 a logical operator are the same:
7188
7189 extern int a;
7190 if (a < 0 && a < 0) { ... }
7191
7192 -Wlogical-not-parentheses
7193 Warn about logical not used on the left hand side operand of a
7194 comparison. This option does not warn if the right operand is
7195 considered to be a boolean expression. Its purpose is to detect
7196 suspicious code like the following:
7197
7198 int a;
7199 ...
7200 if (!a > 1) { ... }
7201
7202 It is possible to suppress the warning by wrapping the LHS into
7203 parentheses:
7204
7205 if ((!a) > 1) { ... }
7206
7207 This warning is enabled by -Wall.
7208
7209 -Waggregate-return
7210 Warn if any functions that return structures or unions are defined
7211 or called. (In languages where you can return an array, this also
7212 elicits a warning.)
7213
7214 -Wno-aggressive-loop-optimizations
7215 Warn if in a loop with constant number of iterations the compiler
7216 detects undefined behavior in some statement during one or more of
7217 the iterations.
7218
7219 -Wno-attributes
7220 Do not warn if an unexpected "__attribute__" is used, such as
7221 unrecognized attributes, function attributes applied to variables,
7222 etc. This does not stop errors for incorrect use of supported
7223 attributes.
7224
7225 Additionally, using -Wno-attributes=, it is possible to suppress
7226 warnings about unknown scoped attributes (in C++11 and C2X). For
7227 example, -Wno-attributes=vendor::attr disables warning about the
7228 following declaration:
7229
7230 [[vendor::attr]] void f();
7231
7232 It is also possible to disable warning about all attributes in a
7233 namespace using -Wno-attributes=vendor:: which prevents warning
7234 about both of these declarations:
7235
7236 [[vendor::safe]] void f();
7237 [[vendor::unsafe]] void f2();
7238
7239 Note that -Wno-attributes= does not imply -Wno-attributes.
7240
7241 -Wno-builtin-declaration-mismatch
7242 Warn if a built-in function is declared with an incompatible
7243 signature or as a non-function, or when a built-in function
7244 declared with a type that does not include a prototype is called
7245 with arguments whose promoted types do not match those expected by
7246 the function. When -Wextra is specified, also warn when a built-in
7247 function that takes arguments is declared without a prototype. The
7248 -Wbuiltin-declaration-mismatch warning is enabled by default. To
7249 avoid the warning include the appropriate header to bring the
7250 prototypes of built-in functions into scope.
7251
7252 For example, the call to "memset" below is diagnosed by the warning
7253 because the function expects a value of type "size_t" as its
7254 argument but the type of 32 is "int". With -Wextra, the
7255 declaration of the function is diagnosed as well.
7256
7257 extern void* memset ();
7258 void f (void *d)
7259 {
7260 memset (d, '\0', 32);
7261 }
7262
7263 -Wno-builtin-macro-redefined
7264 Do not warn if certain built-in macros are redefined. This
7265 suppresses warnings for redefinition of "__TIMESTAMP__",
7266 "__TIME__", "__DATE__", "__FILE__", and "__BASE_FILE__".
7267
7268 -Wstrict-prototypes (C and Objective-C only)
7269 Warn if a function is declared or defined without specifying the
7270 argument types. (An old-style function definition is permitted
7271 without a warning if preceded by a declaration that specifies the
7272 argument types.)
7273
7274 -Wold-style-declaration (C and Objective-C only)
7275 Warn for obsolescent usages, according to the C Standard, in a
7276 declaration. For example, warn if storage-class specifiers like
7277 "static" are not the first things in a declaration. This warning
7278 is also enabled by -Wextra.
7279
7280 -Wold-style-definition (C and Objective-C only)
7281 Warn if an old-style function definition is used. A warning is
7282 given even if there is a previous prototype. A definition using ()
7283 is not considered an old-style definition in C2X mode, because it
7284 is equivalent to (void) in that case, but is considered an old-
7285 style definition for older standards.
7286
7287 -Wmissing-parameter-type (C and Objective-C only)
7288 A function parameter is declared without a type specifier in
7289 K&R-style functions:
7290
7291 void foo(bar) { }
7292
7293 This warning is also enabled by -Wextra.
7294
7295 -Wmissing-prototypes (C and Objective-C only)
7296 Warn if a global function is defined without a previous prototype
7297 declaration. This warning is issued even if the definition itself
7298 provides a prototype. Use this option to detect global functions
7299 that do not have a matching prototype declaration in a header file.
7300 This option is not valid for C++ because all function declarations
7301 provide prototypes and a non-matching declaration declares an
7302 overload rather than conflict with an earlier declaration. Use
7303 -Wmissing-declarations to detect missing declarations in C++.
7304
7305 -Wmissing-declarations
7306 Warn if a global function is defined without a previous
7307 declaration. Do so even if the definition itself provides a
7308 prototype. Use this option to detect global functions that are not
7309 declared in header files. In C, no warnings are issued for
7310 functions with previous non-prototype declarations; use
7311 -Wmissing-prototypes to detect missing prototypes. In C++, no
7312 warnings are issued for function templates, or for inline
7313 functions, or for functions in anonymous namespaces.
7314
7315 -Wmissing-field-initializers
7316 Warn if a structure's initializer has some fields missing. For
7317 example, the following code causes such a warning, because "x.h" is
7318 implicitly zero:
7319
7320 struct s { int f, g, h; };
7321 struct s x = { 3, 4 };
7322
7323 This option does not warn about designated initializers, so the
7324 following modification does not trigger a warning:
7325
7326 struct s { int f, g, h; };
7327 struct s x = { .f = 3, .g = 4 };
7328
7329 In C this option does not warn about the universal zero initializer
7330 { 0 }:
7331
7332 struct s { int f, g, h; };
7333 struct s x = { 0 };
7334
7335 Likewise, in C++ this option does not warn about the empty { }
7336 initializer, for example:
7337
7338 struct s { int f, g, h; };
7339 s x = { };
7340
7341 This warning is included in -Wextra. To get other -Wextra warnings
7342 without this one, use -Wextra -Wno-missing-field-initializers.
7343
7344 -Wno-missing-requires
7345 By default, the compiler warns about a concept-id appearing as a
7346 C++20 simple-requirement:
7347
7348 bool satisfied = requires { C<T> };
7349
7350 Here satisfied will be true if C<T> is a valid expression, which it
7351 is for all T. Presumably the user meant to write
7352
7353 bool satisfied = requires { requires C<T> };
7354
7355 so satisfied is only true if concept C is satisfied for type T.
7356
7357 This warning can be disabled with -Wno-missing-requires.
7358
7359 -Wno-missing-template-keyword
7360 The member access tokens ., -> and :: must be followed by the
7361 "template" keyword if the parent object is dependent and the member
7362 being named is a template.
7363
7364 template <class X>
7365 void DoStuff (X x)
7366 {
7367 x.template DoSomeOtherStuff<X>(); // Good.
7368 x.DoMoreStuff<X>(); // Warning, x is dependent.
7369 }
7370
7371 In rare cases it is possible to get false positives. To silence
7372 this, wrap the expression in parentheses. For example, the
7373 following is treated as a template, even where m and N are
7374 integers:
7375
7376 void NotATemplate (my_class t)
7377 {
7378 int N = 5;
7379
7380 bool test = t.m < N > (0); // Treated as a template.
7381 test = (t.m < N) > (0); // Same meaning, but not treated as a template.
7382 }
7383
7384 This warning can be disabled with -Wno-missing-template-keyword.
7385
7386 -Wno-multichar
7387 Do not warn if a multicharacter constant ('FOOF') is used. Usually
7388 they indicate a typo in the user's code, as they have
7389 implementation-defined values, and should not be used in portable
7390 code.
7391
7392 -Wnormalized=[none|id|nfc|nfkc]
7393 In ISO C and ISO C++, two identifiers are different if they are
7394 different sequences of characters. However, sometimes when
7395 characters outside the basic ASCII character set are used, you can
7396 have two different character sequences that look the same. To
7397 avoid confusion, the ISO 10646 standard sets out some normalization
7398 rules which when applied ensure that two sequences that look the
7399 same are turned into the same sequence. GCC can warn you if you
7400 are using identifiers that have not been normalized; this option
7401 controls that warning.
7402
7403 There are four levels of warning supported by GCC. The default is
7404 -Wnormalized=nfc, which warns about any identifier that is not in
7405 the ISO 10646 "C" normalized form, NFC. NFC is the recommended
7406 form for most uses. It is equivalent to -Wnormalized.
7407
7408 Unfortunately, there are some characters allowed in identifiers by
7409 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7410 identifiers. That is, there's no way to use these symbols in
7411 portable ISO C or C++ and have all your identifiers in NFC.
7412 -Wnormalized=id suppresses the warning for these characters. It is
7413 hoped that future versions of the standards involved will correct
7414 this, which is why this option is not the default.
7415
7416 You can switch the warning off for all characters by writing
7417 -Wnormalized=none or -Wno-normalized. You should only do this if
7418 you are using some other normalization scheme (like "D"), because
7419 otherwise you can easily create bugs that are literally impossible
7420 to see.
7421
7422 Some characters in ISO 10646 have distinct meanings but look
7423 identical in some fonts or display methodologies, especially once
7424 formatting has been applied. For instance "\u207F", "SUPERSCRIPT
7425 LATIN SMALL LETTER N", displays just like a regular "n" that has
7426 been placed in a superscript. ISO 10646 defines the NFKC
7427 normalization scheme to convert all these into a standard form as
7428 well, and GCC warns if your code is not in NFKC if you use
7429 -Wnormalized=nfkc. This warning is comparable to warning about
7430 every identifier that contains the letter O because it might be
7431 confused with the digit 0, and so is not the default, but may be
7432 useful as a local coding convention if the programming environment
7433 cannot be fixed to display these characters distinctly.
7434
7435 -Wno-attribute-warning
7436 Do not warn about usage of functions declared with "warning"
7437 attribute. By default, this warning is enabled.
7438 -Wno-attribute-warning can be used to disable the warning or
7439 -Wno-error=attribute-warning can be used to disable the error when
7440 compiled with -Werror flag.
7441
7442 -Wno-deprecated
7443 Do not warn about usage of deprecated features.
7444
7445 -Wno-deprecated-declarations
7446 Do not warn about uses of functions, variables, and types marked as
7447 deprecated by using the "deprecated" attribute.
7448
7449 -Wno-overflow
7450 Do not warn about compile-time overflow in constant expressions.
7451
7452 -Wno-odr
7453 Warn about One Definition Rule violations during link-time
7454 optimization. Enabled by default.
7455
7456 -Wopenacc-parallelism
7457 Warn about potentially suboptimal choices related to OpenACC
7458 parallelism.
7459
7460 -Wopenmp-simd
7461 Warn if the vectorizer cost model overrides the OpenMP simd
7462 directive set by user. The -fsimd-cost-model=unlimited option can
7463 be used to relax the cost model.
7464
7465 -Woverride-init (C and Objective-C only)
7466 Warn if an initialized field without side effects is overridden
7467 when using designated initializers.
7468
7469 This warning is included in -Wextra. To get other -Wextra warnings
7470 without this one, use -Wextra -Wno-override-init.
7471
7472 -Wno-override-init-side-effects (C and Objective-C only)
7473 Do not warn if an initialized field with side effects is overridden
7474 when using designated initializers. This warning is enabled by
7475 default.
7476
7477 -Wpacked
7478 Warn if a structure is given the packed attribute, but the packed
7479 attribute has no effect on the layout or size of the structure.
7480 Such structures may be mis-aligned for little benefit. For
7481 instance, in this code, the variable "f.x" in "struct bar" is
7482 misaligned even though "struct bar" does not itself have the packed
7483 attribute:
7484
7485 struct foo {
7486 int x;
7487 char a, b, c, d;
7488 } __attribute__((packed));
7489 struct bar {
7490 char z;
7491 struct foo f;
7492 };
7493
7494 -Wnopacked-bitfield-compat
7495 The 4.1, 4.2 and 4.3 series of GCC ignore the "packed" attribute on
7496 bit-fields of type "char". This was fixed in GCC 4.4 but the
7497 change can lead to differences in the structure layout. GCC
7498 informs you when the offset of such a field has changed in GCC 4.4.
7499 For example there is no longer a 4-bit padding between field "a"
7500 and "b" in this structure:
7501
7502 struct foo
7503 {
7504 char a:4;
7505 char b:8;
7506 } __attribute__ ((packed));
7507
7508 This warning is enabled by default. Use
7509 -Wno-packed-bitfield-compat to disable this warning.
7510
7511 -Wpacked-not-aligned (C, C++, Objective-C and Objective-C++ only)
7512 Warn if a structure field with explicitly specified alignment in a
7513 packed struct or union is misaligned. For example, a warning will
7514 be issued on "struct S", like, "warning: alignment 1 of 'struct S'
7515 is less than 8", in this code:
7516
7517 struct __attribute__ ((aligned (8))) S8 { char a[8]; };
7518 struct __attribute__ ((packed)) S {
7519 struct S8 s8;
7520 };
7521
7522 This warning is enabled by -Wall.
7523
7524 -Wpadded
7525 Warn if padding is included in a structure, either to align an
7526 element of the structure or to align the whole structure.
7527 Sometimes when this happens it is possible to rearrange the fields
7528 of the structure to reduce the padding and so make the structure
7529 smaller.
7530
7531 -Wredundant-decls
7532 Warn if anything is declared more than once in the same scope, even
7533 in cases where multiple declaration is valid and changes nothing.
7534
7535 -Wrestrict
7536 Warn when an object referenced by a "restrict"-qualified parameter
7537 (or, in C++, a "__restrict"-qualified parameter) is aliased by
7538 another argument, or when copies between such objects overlap. For
7539 example, the call to the "strcpy" function below attempts to
7540 truncate the string by replacing its initial characters with the
7541 last four. However, because the call writes the terminating NUL
7542 into "a[4]", the copies overlap and the call is diagnosed.
7543
7544 void foo (void)
7545 {
7546 char a[] = "abcd1234";
7547 strcpy (a, a + 4);
7548 ...
7549 }
7550
7551 The -Wrestrict option detects some instances of simple overlap even
7552 without optimization but works best at -O2 and above. It is
7553 included in -Wall.
7554
7555 -Wnested-externs (C and Objective-C only)
7556 Warn if an "extern" declaration is encountered within a function.
7557
7558 -Winline
7559 Warn if a function that is declared as inline cannot be inlined.
7560 Even with this option, the compiler does not warn about failures to
7561 inline functions declared in system headers.
7562
7563 The compiler uses a variety of heuristics to determine whether or
7564 not to inline a function. For example, the compiler takes into
7565 account the size of the function being inlined and the amount of
7566 inlining that has already been done in the current function.
7567 Therefore, seemingly insignificant changes in the source program
7568 can cause the warnings produced by -Winline to appear or disappear.
7569
7570 -Winterference-size
7571 Warn about use of C++17
7572 "std::hardware_destructive_interference_size" without specifying
7573 its value with --param destructive-interference-size. Also warn
7574 about questionable values for that option.
7575
7576 This variable is intended to be used for controlling class layout,
7577 to avoid false sharing in concurrent code:
7578
7579 struct independent_fields {
7580 alignas(std::hardware_destructive_interference_size) std::atomic<int> one;
7581 alignas(std::hardware_destructive_interference_size) std::atomic<int> two;
7582 };
7583
7584 Here one and two are intended to be far enough apart that stores to
7585 one won't require accesses to the other to reload the cache line.
7586
7587 By default, --param destructive-interference-size and --param
7588 constructive-interference-size are set based on the current -mtune
7589 option, typically to the L1 cache line size for the particular
7590 target CPU, sometimes to a range if tuning for a generic target.
7591 So all translation units that depend on ABI compatibility for the
7592 use of these variables must be compiled with the same -mtune (or
7593 -mcpu).
7594
7595 If ABI stability is important, such as if the use is in a header
7596 for a library, you should probably not use the hardware
7597 interference size variables at all. Alternatively, you can force a
7598 particular value with --param.
7599
7600 If you are confident that your use of the variable does not affect
7601 ABI outside a single build of your project, you can turn off the
7602 warning with -Wno-interference-size.
7603
7604 -Wint-in-bool-context
7605 Warn for suspicious use of integer values where boolean values are
7606 expected, such as conditional expressions (?:) using non-boolean
7607 integer constants in boolean context, like "if (a <= b ? 2 : 3)".
7608 Or left shifting of signed integers in boolean context, like "for
7609 (a = 0; 1 << a; a++);". Likewise for all kinds of multiplications
7610 regardless of the data type. This warning is enabled by -Wall.
7611
7612 -Wno-int-to-pointer-cast
7613 Suppress warnings from casts to pointer type of an integer of a
7614 different size. In C++, casting to a pointer type of smaller size
7615 is an error. Wint-to-pointer-cast is enabled by default.
7616
7617 -Wno-pointer-to-int-cast (C and Objective-C only)
7618 Suppress warnings from casts from a pointer to an integer type of a
7619 different size.
7620
7621 -Winvalid-pch
7622 Warn if a precompiled header is found in the search path but cannot
7623 be used.
7624
7625 -Wlong-long
7626 Warn if "long long" type is used. This is enabled by either
7627 -Wpedantic or -Wtraditional in ISO C90 and C++98 modes. To inhibit
7628 the warning messages, use -Wno-long-long.
7629
7630 -Wvariadic-macros
7631 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7632 alternate syntax is used in ISO C99 mode. This is enabled by
7633 either -Wpedantic or -Wtraditional. To inhibit the warning
7634 messages, use -Wno-variadic-macros.
7635
7636 -Wno-varargs
7637 Do not warn upon questionable usage of the macros used to handle
7638 variable arguments like "va_start". These warnings are enabled by
7639 default.
7640
7641 -Wvector-operation-performance
7642 Warn if vector operation is not implemented via SIMD capabilities
7643 of the architecture. Mainly useful for the performance tuning.
7644 Vector operation can be implemented "piecewise", which means that
7645 the scalar operation is performed on every vector element; "in
7646 parallel", which means that the vector operation is implemented
7647 using scalars of wider type, which normally is more performance
7648 efficient; and "as a single scalar", which means that vector fits
7649 into a scalar type.
7650
7651 -Wvla
7652 Warn if a variable-length array is used in the code. -Wno-vla
7653 prevents the -Wpedantic warning of the variable-length array.
7654
7655 -Wvla-larger-than=byte-size
7656 If this option is used, the compiler warns for declarations of
7657 variable-length arrays whose size is either unbounded, or bounded
7658 by an argument that allows the array size to exceed byte-size
7659 bytes. This is similar to how -Walloca-larger-than=byte-size
7660 works, but with variable-length arrays.
7661
7662 Note that GCC may optimize small variable-length arrays of a known
7663 value into plain arrays, so this warning may not get triggered for
7664 such arrays.
7665
7666 -Wvla-larger-than=PTRDIFF_MAX is enabled by default but is
7667 typically only effective when -ftree-vrp is active (default for -O2
7668 and above).
7669
7670 See also -Walloca-larger-than=byte-size.
7671
7672 -Wno-vla-larger-than
7673 Disable -Wvla-larger-than= warnings. The option is equivalent to
7674 -Wvla-larger-than=SIZE_MAX or larger.
7675
7676 -Wvla-parameter
7677 Warn about redeclarations of functions involving arguments of
7678 Variable Length Array types of inconsistent kinds or forms, and
7679 enable the detection of out-of-bounds accesses to such parameters
7680 by warnings such as -Warray-bounds.
7681
7682 If the first function declaration uses the VLA form the bound
7683 specified in the array is assumed to be the minimum number of
7684 elements expected to be provided in calls to the function and the
7685 maximum number of elements accessed by it. Failing to provide
7686 arguments of sufficient size or accessing more than the maximum
7687 number of elements may be diagnosed.
7688
7689 For example, the warning triggers for the following redeclarations
7690 because the first one allows an array of any size to be passed to
7691 "f" while the second one specifies that the array argument must
7692 have at least "n" elements. In addition, calling "f" with the
7693 associated VLA bound parameter in excess of the actual VLA bound
7694 triggers a warning as well.
7695
7696 void f (int n, int[n]);
7697 void f (int, int[]); // warning: argument 2 previously declared as a VLA
7698
7699 void g (int n)
7700 {
7701 if (n > 4)
7702 return;
7703 int a[n];
7704 f (sizeof a, a); // warning: access to a by f may be out of bounds
7705 ...
7706 }
7707
7708 -Wvla-parameter is included in -Wall. The -Warray-parameter option
7709 triggers warnings for similar problems involving ordinary array
7710 arguments.
7711
7712 -Wvolatile-register-var
7713 Warn if a register variable is declared volatile. The volatile
7714 modifier does not inhibit all optimizations that may eliminate
7715 reads and/or writes to register variables. This warning is enabled
7716 by -Wall.
7717
7718 -Wdisabled-optimization
7719 Warn if a requested optimization pass is disabled. This warning
7720 does not generally indicate that there is anything wrong with your
7721 code; it merely indicates that GCC's optimizers are unable to
7722 handle the code effectively. Often, the problem is that your code
7723 is too big or too complex; GCC refuses to optimize programs when
7724 the optimization itself is likely to take inordinate amounts of
7725 time.
7726
7727 -Wpointer-sign (C and Objective-C only)
7728 Warn for pointer argument passing or assignment with different
7729 signedness. This option is only supported for C and Objective-C.
7730 It is implied by -Wall and by -Wpedantic, which can be disabled
7731 with -Wno-pointer-sign.
7732
7733 -Wstack-protector
7734 This option is only active when -fstack-protector is active. It
7735 warns about functions that are not protected against stack
7736 smashing.
7737
7738 -Woverlength-strings
7739 Warn about string constants that are longer than the "minimum
7740 maximum" length specified in the C standard. Modern compilers
7741 generally allow string constants that are much longer than the
7742 standard's minimum limit, but very portable programs should avoid
7743 using longer strings.
7744
7745 The limit applies after string constant concatenation, and does not
7746 count the trailing NUL. In C90, the limit was 509 characters; in
7747 C99, it was raised to 4095. C++98 does not specify a normative
7748 minimum maximum, so we do not diagnose overlength strings in C++.
7749
7750 This option is implied by -Wpedantic, and can be disabled with
7751 -Wno-overlength-strings.
7752
7753 -Wunsuffixed-float-constants (C and Objective-C only)
7754 Issue a warning for any floating constant that does not have a
7755 suffix. When used together with -Wsystem-headers it warns about
7756 such constants in system header files. This can be useful when
7757 preparing code to use with the "FLOAT_CONST_DECIMAL64" pragma from
7758 the decimal floating-point extension to C99.
7759
7760 -Wno-lto-type-mismatch
7761 During the link-time optimization, do not warn about type
7762 mismatches in global declarations from different compilation units.
7763 Requires -flto to be enabled. Enabled by default.
7764
7765 -Wno-designated-init (C and Objective-C only)
7766 Suppress warnings when a positional initializer is used to
7767 initialize a structure that has been marked with the
7768 "designated_init" attribute.
7769
7770 Options That Control Static Analysis
7771 -fanalyzer
7772 This option enables an static analysis of program flow which looks
7773 for "interesting" interprocedural paths through the code, and
7774 issues warnings for problems found on them.
7775
7776 This analysis is much more expensive than other GCC warnings.
7777
7778 Enabling this option effectively enables the following warnings:
7779
7780 -Wanalyzer-double-fclose -Wanalyzer-double-free
7781 -Wanalyzer-exposure-through-output-file -Wanalyzer-file-leak
7782 -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak
7783 -Wanalyzer-mismatching-deallocation -Wanalyzer-null-argument
7784 -Wanalyzer-null-dereference -Wanalyzer-possible-null-argument
7785 -Wanalyzer-possible-null-dereference
7786 -Wanalyzer-shift-count-negative -Wanalyzer-shift-count-overflow
7787 -Wanalyzer-stale-setjmp-buffer
7788 -Wanalyzer-unsafe-call-within-signal-handler
7789 -Wanalyzer-use-after-free
7790 -Wanalyzer-use-of-pointer-in-stale-stack-frame
7791 -Wanalyzer-use-of-uninitialized-value -Wanalyzer-write-to-const
7792 -Wanalyzer-write-to-string-literal
7793
7794 This option is only available if GCC was configured with analyzer
7795 support enabled.
7796
7797 -Wanalyzer-too-complex
7798 If -fanalyzer is enabled, the analyzer uses various heuristics to
7799 attempt to explore the control flow and data flow in the program,
7800 but these can be defeated by sufficiently complicated code.
7801
7802 By default, the analysis silently stops if the code is too
7803 complicated for the analyzer to fully explore and it reaches an
7804 internal limit. The -Wanalyzer-too-complex option warns if this
7805 occurs.
7806
7807 -Wno-analyzer-double-fclose
7808 This warning requires -fanalyzer, which enables it; use
7809 -Wno-analyzer-double-fclose to disable it.
7810
7811 This diagnostic warns for paths through the code in which a "FILE
7812 *" can have "fclose" called on it more than once.
7813
7814 -Wno-analyzer-double-free
7815 This warning requires -fanalyzer, which enables it; use
7816 -Wno-analyzer-double-free to disable it.
7817
7818 This diagnostic warns for paths through the code in which a pointer
7819 can have a deallocator called on it more than once, either "free",
7820 or a deallocator referenced by attribute "malloc".
7821
7822 -Wno-analyzer-exposure-through-output-file
7823 This warning requires -fanalyzer, which enables it; use
7824 -Wno-analyzer-exposure-through-output-file to disable it.
7825
7826 This diagnostic warns for paths through the code in which a
7827 security-sensitive value is written to an output file (such as
7828 writing a password to a log file).
7829
7830 -Wno-analyzer-file-leak
7831 This warning requires -fanalyzer, which enables it; use
7832 -Wno-analyzer-file-leak to disable it.
7833
7834 This diagnostic warns for paths through the code in which a
7835 "<stdio.h>" "FILE *" stream object is leaked.
7836
7837 -Wno-analyzer-free-of-non-heap
7838 This warning requires -fanalyzer, which enables it; use
7839 -Wno-analyzer-free-of-non-heap to disable it.
7840
7841 This diagnostic warns for paths through the code in which "free" is
7842 called on a non-heap pointer (e.g. an on-stack buffer, or a
7843 global).
7844
7845 -Wno-analyzer-malloc-leak
7846 This warning requires -fanalyzer, which enables it; use
7847 -Wno-analyzer-malloc-leak to disable it.
7848
7849 This diagnostic warns for paths through the code in which a pointer
7850 allocated via an allocator is leaked: either "malloc", or a
7851 function marked with attribute "malloc".
7852
7853 -Wno-analyzer-mismatching-deallocation
7854 This warning requires -fanalyzer, which enables it; use
7855 -Wno-analyzer-mismatching-deallocation to disable it.
7856
7857 This diagnostic warns for paths through the code in which the wrong
7858 deallocation function is called on a pointer value, based on which
7859 function was used to allocate the pointer value. The diagnostic
7860 will warn about mismatches between "free", scalar "delete" and
7861 vector "delete[]", and those marked as allocator/deallocator pairs
7862 using attribute "malloc".
7863
7864 -Wno-analyzer-possible-null-argument
7865 This warning requires -fanalyzer, which enables it; use
7866 -Wno-analyzer-possible-null-argument to disable it.
7867
7868 This diagnostic warns for paths through the code in which a
7869 possibly-NULL value is passed to a function argument marked with
7870 "__attribute__((nonnull))" as requiring a non-NULL value.
7871
7872 -Wno-analyzer-possible-null-dereference
7873 This warning requires -fanalyzer, which enables it; use
7874 -Wno-analyzer-possible-null-dereference to disable it.
7875
7876 This diagnostic warns for paths through the code in which a
7877 possibly-NULL value is dereferenced.
7878
7879 -Wno-analyzer-null-argument
7880 This warning requires -fanalyzer, which enables it; use
7881 -Wno-analyzer-null-argument to disable it.
7882
7883 This diagnostic warns for paths through the code in which a value
7884 known to be NULL is passed to a function argument marked with
7885 "__attribute__((nonnull))" as requiring a non-NULL value.
7886
7887 -Wno-analyzer-null-dereference
7888 This warning requires -fanalyzer, which enables it; use
7889 -Wno-analyzer-null-dereference to disable it.
7890
7891 This diagnostic warns for paths through the code in which a value
7892 known to be NULL is dereferenced.
7893
7894 -Wno-analyzer-shift-count-negative
7895 This warning requires -fanalyzer, which enables it; use
7896 -Wno-analyzer-shift-count-negative to disable it.
7897
7898 This diagnostic warns for paths through the code in which a shift
7899 is attempted with a negative count. It is analogous to the
7900 -Wshift-count-negative diagnostic implemented in the C/C++ front
7901 ends, but is implemented based on analyzing interprocedural paths,
7902 rather than merely parsing the syntax tree. However, the analyzer
7903 does not prioritize detection of such paths, so false negatives are
7904 more likely relative to other warnings.
7905
7906 -Wno-analyzer-shift-count-overflow
7907 This warning requires -fanalyzer, which enables it; use
7908 -Wno-analyzer-shift-count-overflow to disable it.
7909
7910 This diagnostic warns for paths through the code in which a shift
7911 is attempted with a count greater than or equal to the precision of
7912 the operand's type. It is analogous to the -Wshift-count-overflow
7913 diagnostic implemented in the C/C++ front ends, but is implemented
7914 based on analyzing interprocedural paths, rather than merely
7915 parsing the syntax tree. However, the analyzer does not prioritize
7916 detection of such paths, so false negatives are more likely
7917 relative to other warnings.
7918
7919 -Wno-analyzer-stale-setjmp-buffer
7920 This warning requires -fanalyzer, which enables it; use
7921 -Wno-analyzer-stale-setjmp-buffer to disable it.
7922
7923 This diagnostic warns for paths through the code in which "longjmp"
7924 is called to rewind to a "jmp_buf" relating to a "setjmp" call in a
7925 function that has returned.
7926
7927 When "setjmp" is called on a "jmp_buf" to record a rewind location,
7928 it records the stack frame. The stack frame becomes invalid when
7929 the function containing the "setjmp" call returns. Attempting to
7930 rewind to it via "longjmp" would reference a stack frame that no
7931 longer exists, and likely lead to a crash (or worse).
7932
7933 -Wno-analyzer-tainted-allocation-size
7934 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7935 to enable it; use -Wno-analyzer-tainted-allocation-size to disable
7936 it.
7937
7938 This diagnostic warns for paths through the code in which a value
7939 that could be under an attacker's control is used as the size of an
7940 allocation without being sanitized, so that an attacker could
7941 inject an excessively large allocation and potentially cause a
7942 denial of service attack.
7943
7944 See @url{https://cwe.mitre.org/data/definitions/789.html, CWE-789:
7945 Memory Allocation with Excessive Size Value}.
7946
7947 -Wno-analyzer-tainted-array-index
7948 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7949 to enable it; use -Wno-analyzer-tainted-array-index to disable it.
7950
7951 This diagnostic warns for paths through the code in which a value
7952 that could be under an attacker's control is used as the index of
7953 an array access without being sanitized, so that an attacker could
7954 inject an out-of-bounds access.
7955
7956 See @url{https://cwe.mitre.org/data/definitions/129.html, CWE-129:
7957 Improper Validation of Array Index}.
7958
7959 -Wno-analyzer-tainted-divisor
7960 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7961 to enable it; use -Wno-analyzer-tainted-divisor to disable it.
7962
7963 This diagnostic warns for paths through the code in which a value
7964 that could be under an attacker's control is used as the divisor in
7965 a division or modulus operation without being sanitized, so that an
7966 attacker could inject a division-by-zero.
7967
7968 -Wno-analyzer-tainted-offset
7969 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7970 to enable it; use -Wno-analyzer-tainted-offset to disable it.
7971
7972 This diagnostic warns for paths through the code in which a value
7973 that could be under an attacker's control is used as a pointer
7974 offset without being sanitized, so that an attacker could inject an
7975 out-of-bounds access.
7976
7977 See @url{https://cwe.mitre.org/data/definitions/823.html, CWE-823:
7978 Use of Out-of-range Pointer Offset}.
7979
7980 -Wno-analyzer-tainted-size
7981 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7982 to enable it; use -Wno-analyzer-tainted-size to disable it.
7983
7984 This diagnostic warns for paths through the code in which a value
7985 that could be under an attacker's control is used as the size of an
7986 operation such as "memset" without being sanitized, so that an
7987 attacker could inject an out-of-bounds access.
7988
7989 -Wno-analyzer-unsafe-call-within-signal-handler
7990 This warning requires -fanalyzer, which enables it; use
7991 -Wno-analyzer-unsafe-call-within-signal-handler to disable it.
7992
7993 This diagnostic warns for paths through the code in which a
7994 function known to be async-signal-unsafe (such as "fprintf") is
7995 called from a signal handler.
7996
7997 -Wno-analyzer-use-after-free
7998 This warning requires -fanalyzer, which enables it; use
7999 -Wno-analyzer-use-after-free to disable it.
8000
8001 This diagnostic warns for paths through the code in which a pointer
8002 is used after a deallocator is called on it: either "free", or a
8003 deallocator referenced by attribute "malloc".
8004
8005 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
8006 This warning requires -fanalyzer, which enables it; use
8007 -Wno-analyzer-use-of-pointer-in-stale-stack-frame to disable it.
8008
8009 This diagnostic warns for paths through the code in which a pointer
8010 is dereferenced that points to a variable in a stale stack frame.
8011
8012 -Wno-analyzer-write-to-const
8013 This warning requires -fanalyzer, which enables it; use
8014 -Wno-analyzer-write-to-const to disable it.
8015
8016 This diagnostic warns for paths through the code in which the
8017 analyzer detects an attempt to write through a pointer to a "const"
8018 object. However, the analyzer does not prioritize detection of
8019 such paths, so false negatives are more likely relative to other
8020 warnings.
8021
8022 -Wno-analyzer-write-to-string-literal
8023 This warning requires -fanalyzer, which enables it; use
8024 -Wno-analyzer-write-to-string-literal to disable it.
8025
8026 This diagnostic warns for paths through the code in which the
8027 analyzer detects an attempt to write through a pointer to a string
8028 literal. However, the analyzer does not prioritize detection of
8029 such paths, so false negatives are more likely relative to other
8030 warnings.
8031
8032 -Wno-analyzer-use-of-uninitialized-value
8033 This warning requires -fanalyzer, which enables it; use
8034 -Wno-analyzer-use-of-uninitialized-value to disable it.
8035
8036 This diagnostic warns for paths through the code in which an
8037 uninitialized value is used.
8038
8039 Pertinent parameters for controlling the exploration are: --param
8040 analyzer-bb-explosion-factor=value, --param
8041 analyzer-max-enodes-per-program-point=value, --param
8042 analyzer-max-recursion-depth=value, and --param
8043 analyzer-min-snodes-for-call-summary=value.
8044
8045 The following options control the analyzer.
8046
8047 -fanalyzer-call-summaries
8048 Simplify interprocedural analysis by computing the effect of
8049 certain calls, rather than exploring all paths through the function
8050 from callsite to each possible return.
8051
8052 If enabled, call summaries are only used for functions with more
8053 than one call site, and that are sufficiently complicated (as per
8054 --param analyzer-min-snodes-for-call-summary=value).
8055
8056 -fanalyzer-checker=name
8057 Restrict the analyzer to run just the named checker, and enable it.
8058
8059 Some checkers are disabled by default (even with -fanalyzer), such
8060 as the "taint" checker that implements
8061 -Wanalyzer-tainted-array-index, and this option is required to
8062 enable them.
8063
8064 Note: currently, -fanalyzer-checker=taint disables the following
8065 warnings from -fanalyzer:
8066
8067 -Wanalyzer-double-fclose -Wanalyzer-double-free
8068 -Wanalyzer-exposure-through-output-file -Wanalyzer-file-leak
8069 -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak
8070 -Wanalyzer-mismatching-deallocation -Wanalyzer-null-argument
8071 -Wanalyzer-null-dereference -Wanalyzer-possible-null-argument
8072 -Wanalyzer-possible-null-dereference
8073 -Wanalyzer-unsafe-call-within-signal-handler
8074 -Wanalyzer-use-after-free
8075
8076 -fno-analyzer-feasibility
8077 This option is intended for analyzer developers.
8078
8079 By default the analyzer verifies that there is a feasible control
8080 flow path for each diagnostic it emits: that the conditions that
8081 hold are not mutually exclusive. Diagnostics for which no feasible
8082 path can be found are rejected. This filtering can be suppressed
8083 with -fno-analyzer-feasibility, for debugging issues in this code.
8084
8085 -fanalyzer-fine-grained
8086 This option is intended for analyzer developers.
8087
8088 Internally the analyzer builds an "exploded graph" that combines
8089 control flow graphs with data flow information.
8090
8091 By default, an edge in this graph can contain the effects of a run
8092 of multiple statements within a basic block. With
8093 -fanalyzer-fine-grained, each statement gets its own edge.
8094
8095 -fanalyzer-show-duplicate-count
8096 This option is intended for analyzer developers: if multiple
8097 diagnostics have been detected as being duplicates of each other,
8098 it emits a note when reporting the best diagnostic, giving the
8099 number of additional diagnostics that were suppressed by the
8100 deduplication logic.
8101
8102 -fno-analyzer-state-merge
8103 This option is intended for analyzer developers.
8104
8105 By default the analyzer attempts to simplify analysis by merging
8106 sufficiently similar states at each program point as it builds its
8107 "exploded graph". With -fno-analyzer-state-merge this merging can
8108 be suppressed, for debugging state-handling issues.
8109
8110 -fno-analyzer-state-purge
8111 This option is intended for analyzer developers.
8112
8113 By default the analyzer attempts to simplify analysis by purging
8114 aspects of state at a program point that appear to no longer be
8115 relevant e.g. the values of locals that aren't accessed later in
8116 the function and which aren't relevant to leak analysis.
8117
8118 With -fno-analyzer-state-purge this purging of state can be
8119 suppressed, for debugging state-handling issues.
8120
8121 -fanalyzer-transitivity
8122 This option enables transitivity of constraints within the
8123 analyzer.
8124
8125 -fanalyzer-verbose-edges
8126 This option is intended for analyzer developers. It enables more
8127 verbose, lower-level detail in the descriptions of control flow
8128 within diagnostic paths.
8129
8130 -fanalyzer-verbose-state-changes
8131 This option is intended for analyzer developers. It enables more
8132 verbose, lower-level detail in the descriptions of events relating
8133 to state machines within diagnostic paths.
8134
8135 -fanalyzer-verbosity=level
8136 This option controls the complexity of the control flow paths that
8137 are emitted for analyzer diagnostics.
8138
8139 The level can be one of:
8140
8141 0 At this level, interprocedural call and return events are
8142 displayed, along with the most pertinent state-change events
8143 relating to a diagnostic. For example, for a double-"free"
8144 diagnostic, both calls to "free" will be shown.
8145
8146 1 As per the previous level, but also show events for the entry
8147 to each function.
8148
8149 2 As per the previous level, but also show events relating to
8150 control flow that are significant to triggering the issue (e.g.
8151 "true path taken" at a conditional).
8152
8153 This level is the default.
8154
8155 3 As per the previous level, but show all control flow events,
8156 not just significant ones.
8157
8158 4 This level is intended for analyzer developers; it adds various
8159 other events intended for debugging the analyzer.
8160
8161 -fdump-analyzer
8162 Dump internal details about what the analyzer is doing to
8163 file.analyzer.txt. This option is overridden by
8164 -fdump-analyzer-stderr.
8165
8166 -fdump-analyzer-stderr
8167 Dump internal details about what the analyzer is doing to stderr.
8168 This option overrides -fdump-analyzer.
8169
8170 -fdump-analyzer-callgraph
8171 Dump a representation of the call graph suitable for viewing with
8172 GraphViz to file.callgraph.dot.
8173
8174 -fdump-analyzer-exploded-graph
8175 Dump a representation of the "exploded graph" suitable for viewing
8176 with GraphViz to file.eg.dot. Nodes are color-coded based on
8177 state-machine states to emphasize state changes.
8178
8179 -fdump-analyzer-exploded-nodes
8180 Emit diagnostics showing where nodes in the "exploded graph" are in
8181 relation to the program source.
8182
8183 -fdump-analyzer-exploded-nodes-2
8184 Dump a textual representation of the "exploded graph" to
8185 file.eg.txt.
8186
8187 -fdump-analyzer-exploded-nodes-3
8188 Dump a textual representation of the "exploded graph" to one dump
8189 file per node, to file.eg-id.txt. This is typically a large number
8190 of dump files.
8191
8192 -fdump-analyzer-exploded-paths
8193 Dump a textual representation of the "exploded path" for each
8194 diagnostic to file.idx.kind.epath.txt.
8195
8196 -fdump-analyzer-feasibility
8197 Dump internal details about the analyzer's search for feasible
8198 paths. The details are written in a form suitable for viewing with
8199 GraphViz to filenames of the form file.*.fg.dot and file.*.tg.dot.
8200
8201 -fdump-analyzer-json
8202 Dump a compressed JSON representation of analyzer internals to
8203 file.analyzer.json.gz. The precise format is subject to change.
8204
8205 -fdump-analyzer-state-purge
8206 As per -fdump-analyzer-supergraph, dump a representation of the
8207 "supergraph" suitable for viewing with GraphViz, but annotate the
8208 graph with information on what state will be purged at each node.
8209 The graph is written to file.state-purge.dot.
8210
8211 -fdump-analyzer-supergraph
8212 Dump representations of the "supergraph" suitable for viewing with
8213 GraphViz to file.supergraph.dot and to file.supergraph-eg.dot.
8214 These show all of the control flow graphs in the program, with
8215 interprocedural edges for calls and returns. The second dump
8216 contains annotations showing nodes in the "exploded graph" and
8217 diagnostics associated with them.
8218
8219 -fdump-analyzer-untracked
8220 Emit custom warnings with internal details intended for analyzer
8221 developers.
8222
8223 Options for Debugging Your Program
8224 To tell GCC to emit extra information for use by a debugger, in almost
8225 all cases you need only to add -g to your other options. Some debug
8226 formats can co-exist (like DWARF with CTF) when each of them is enabled
8227 explicitly by adding the respective command line option to your other
8228 options.
8229
8230 GCC allows you to use -g with -O. The shortcuts taken by optimized
8231 code may occasionally be surprising: some variables you declared may
8232 not exist at all; flow of control may briefly move where you did not
8233 expect it; some statements may not be executed because they compute
8234 constant results or their values are already at hand; some statements
8235 may execute in different places because they have been moved out of
8236 loops. Nevertheless it is possible to debug optimized output. This
8237 makes it reasonable to use the optimizer for programs that might have
8238 bugs.
8239
8240 If you are not using some other optimization option, consider using -Og
8241 with -g. With no -O option at all, some compiler passes that collect
8242 information useful for debugging do not run at all, so that -Og may
8243 result in a better debugging experience.
8244
8245 -g Produce debugging information in the operating system's native
8246 format (stabs, COFF, XCOFF, or DWARF). GDB can work with this
8247 debugging information.
8248
8249 On most systems that use stabs format, -g enables use of extra
8250 debugging information that only GDB can use; this extra information
8251 makes debugging work better in GDB but probably makes other
8252 debuggers crash or refuse to read the program. If you want to
8253 control for certain whether to generate the extra information, use
8254 -gstabs+, -gstabs, -gxcoff+, -gxcoff, or -gvms (see below).
8255
8256 -ggdb
8257 Produce debugging information for use by GDB. This means to use
8258 the most expressive format available (DWARF, stabs, or the native
8259 format if neither of those are supported), including GDB extensions
8260 if at all possible.
8261
8262 -gdwarf
8263 -gdwarf-version
8264 Produce debugging information in DWARF format (if that is
8265 supported). The value of version may be either 2, 3, 4 or 5; the
8266 default version for most targets is 5 (with the exception of
8267 VxWorks, TPF and Darwin/Mac OS X, which default to version 2, and
8268 AIX, which defaults to version 4).
8269
8270 Note that with DWARF Version 2, some ports require and always use
8271 some non-conflicting DWARF 3 extensions in the unwind tables.
8272
8273 Version 4 may require GDB 7.0 and -fvar-tracking-assignments for
8274 maximum benefit. Version 5 requires GDB 8.0 or higher.
8275
8276 GCC no longer supports DWARF Version 1, which is substantially
8277 different than Version 2 and later. For historical reasons, some
8278 other DWARF-related options such as -fno-dwarf2-cfi-asm) retain a
8279 reference to DWARF Version 2 in their names, but apply to all
8280 currently-supported versions of DWARF.
8281
8282 -gbtf
8283 Request BTF debug information. BTF is the default debugging format
8284 for the eBPF target. On other targets, like x86, BTF debug
8285 information can be generated along with DWARF debug information
8286 when both of the debug formats are enabled explicitly via their
8287 respective command line options.
8288
8289 -gctf
8290 -gctflevel
8291 Request CTF debug information and use level to specify how much CTF
8292 debug information should be produced. If -gctf is specified
8293 without a value for level, the default level of CTF debug
8294 information is 2.
8295
8296 CTF debug information can be generated along with DWARF debug
8297 information when both of the debug formats are enabled explicitly
8298 via their respective command line options.
8299
8300 Level 0 produces no CTF debug information at all. Thus, -gctf0
8301 negates -gctf.
8302
8303 Level 1 produces CTF information for tracebacks only. This
8304 includes callsite information, but does not include type
8305 information.
8306
8307 Level 2 produces type information for entities (functions, data
8308 objects etc.) at file-scope or global-scope only.
8309
8310 -gstabs
8311 Produce debugging information in stabs format (if that is
8312 supported), without GDB extensions. This is the format used by DBX
8313 on most BSD systems. On MIPS, Alpha and System V Release 4 systems
8314 this option produces stabs debugging output that is not understood
8315 by DBX. On System V Release 4 systems this option requires the GNU
8316 assembler.
8317
8318 -gstabs+
8319 Produce debugging information in stabs format (if that is
8320 supported), using GNU extensions understood only by the GNU
8321 debugger (GDB). The use of these extensions is likely to make
8322 other debuggers crash or refuse to read the program.
8323
8324 -gxcoff
8325 Produce debugging information in XCOFF format (if that is
8326 supported). This is the format used by the DBX debugger on IBM
8327 RS/6000 systems.
8328
8329 -gxcoff+
8330 Produce debugging information in XCOFF format (if that is
8331 supported), using GNU extensions understood only by the GNU
8332 debugger (GDB). The use of these extensions is likely to make
8333 other debuggers crash or refuse to read the program, and may cause
8334 assemblers other than the GNU assembler (GAS) to fail with an
8335 error.
8336
8337 -gvms
8338 Produce debugging information in Alpha/VMS debug format (if that is
8339 supported). This is the format used by DEBUG on Alpha/VMS systems.
8340
8341 -glevel
8342 -ggdblevel
8343 -gstabslevel
8344 -gxcofflevel
8345 -gvmslevel
8346 Request debugging information and also use level to specify how
8347 much information. The default level is 2.
8348
8349 Level 0 produces no debug information at all. Thus, -g0 negates
8350 -g.
8351
8352 Level 1 produces minimal information, enough for making backtraces
8353 in parts of the program that you don't plan to debug. This
8354 includes descriptions of functions and external variables, and line
8355 number tables, but no information about local variables.
8356
8357 Level 3 includes extra information, such as all the macro
8358 definitions present in the program. Some debuggers support macro
8359 expansion when you use -g3.
8360
8361 If you use multiple -g options, with or without level numbers, the
8362 last such option is the one that is effective.
8363
8364 -gdwarf does not accept a concatenated debug level, to avoid
8365 confusion with -gdwarf-level. Instead use an additional -glevel
8366 option to change the debug level for DWARF.
8367
8368 -fno-eliminate-unused-debug-symbols
8369 By default, no debug information is produced for symbols that are
8370 not actually used. Use this option if you want debug information
8371 for all symbols.
8372
8373 -femit-class-debug-always
8374 Instead of emitting debugging information for a C++ class in only
8375 one object file, emit it in all object files using the class. This
8376 option should be used only with debuggers that are unable to handle
8377 the way GCC normally emits debugging information for classes
8378 because using this option increases the size of debugging
8379 information by as much as a factor of two.
8380
8381 -fno-merge-debug-strings
8382 Direct the linker to not merge together strings in the debugging
8383 information that are identical in different object files. Merging
8384 is not supported by all assemblers or linkers. Merging decreases
8385 the size of the debug information in the output file at the cost of
8386 increasing link processing time. Merging is enabled by default.
8387
8388 -fdebug-prefix-map=old=new
8389 When compiling files residing in directory old, record debugging
8390 information describing them as if the files resided in directory
8391 new instead. This can be used to replace a build-time path with an
8392 install-time path in the debug info. It can also be used to change
8393 an absolute path to a relative path by using . for new. This can
8394 give more reproducible builds, which are location independent, but
8395 may require an extra command to tell GDB where to find the source
8396 files. See also -ffile-prefix-map.
8397
8398 -fvar-tracking
8399 Run variable tracking pass. It computes where variables are stored
8400 at each position in code. Better debugging information is then
8401 generated (if the debugging information format supports this
8402 information).
8403
8404 It is enabled by default when compiling with optimization (-Os, -O,
8405 -O2, ...), debugging information (-g) and the debug info format
8406 supports it.
8407
8408 -fvar-tracking-assignments
8409 Annotate assignments to user variables early in the compilation and
8410 attempt to carry the annotations over throughout the compilation
8411 all the way to the end, in an attempt to improve debug information
8412 while optimizing. Use of -gdwarf-4 is recommended along with it.
8413
8414 It can be enabled even if var-tracking is disabled, in which case
8415 annotations are created and maintained, but discarded at the end.
8416 By default, this flag is enabled together with -fvar-tracking,
8417 except when selective scheduling is enabled.
8418
8419 -gsplit-dwarf
8420 If DWARF debugging information is enabled, separate as much
8421 debugging information as possible into a separate output file with
8422 the extension .dwo. This option allows the build system to avoid
8423 linking files with debug information. To be useful, this option
8424 requires a debugger capable of reading .dwo files.
8425
8426 -gdwarf32
8427 -gdwarf64
8428 If DWARF debugging information is enabled, the -gdwarf32 selects
8429 the 32-bit DWARF format and the -gdwarf64 selects the 64-bit DWARF
8430 format. The default is target specific, on most targets it is
8431 -gdwarf32 though. The 32-bit DWARF format is smaller, but can't
8432 support more than 2GiB of debug information in any of the DWARF
8433 debug information sections. The 64-bit DWARF format allows larger
8434 debug information and might not be well supported by all consumers
8435 yet.
8436
8437 -gdescribe-dies
8438 Add description attributes to some DWARF DIEs that have no name
8439 attribute, such as artificial variables, external references and
8440 call site parameter DIEs.
8441
8442 -gpubnames
8443 Generate DWARF ".debug_pubnames" and ".debug_pubtypes" sections.
8444
8445 -ggnu-pubnames
8446 Generate ".debug_pubnames" and ".debug_pubtypes" sections in a
8447 format suitable for conversion into a GDB index. This option is
8448 only useful with a linker that can produce GDB index version 7.
8449
8450 -fdebug-types-section
8451 When using DWARF Version 4 or higher, type DIEs can be put into
8452 their own ".debug_types" section instead of making them part of the
8453 ".debug_info" section. It is more efficient to put them in a
8454 separate comdat section since the linker can then remove
8455 duplicates. But not all DWARF consumers support ".debug_types"
8456 sections yet and on some objects ".debug_types" produces larger
8457 instead of smaller debugging information.
8458
8459 -grecord-gcc-switches
8460 -gno-record-gcc-switches
8461 This switch causes the command-line options used to invoke the
8462 compiler that may affect code generation to be appended to the
8463 DW_AT_producer attribute in DWARF debugging information. The
8464 options are concatenated with spaces separating them from each
8465 other and from the compiler version. It is enabled by default.
8466 See also -frecord-gcc-switches for another way of storing compiler
8467 options into the object file.
8468
8469 -gstrict-dwarf
8470 Disallow using extensions of later DWARF standard version than
8471 selected with -gdwarf-version. On most targets using non-
8472 conflicting DWARF extensions from later standard versions is
8473 allowed.
8474
8475 -gno-strict-dwarf
8476 Allow using extensions of later DWARF standard version than
8477 selected with -gdwarf-version.
8478
8479 -gas-loc-support
8480 Inform the compiler that the assembler supports ".loc" directives.
8481 It may then use them for the assembler to generate DWARF2+ line
8482 number tables.
8483
8484 This is generally desirable, because assembler-generated line-
8485 number tables are a lot more compact than those the compiler can
8486 generate itself.
8487
8488 This option will be enabled by default if, at GCC configure time,
8489 the assembler was found to support such directives.
8490
8491 -gno-as-loc-support
8492 Force GCC to generate DWARF2+ line number tables internally, if
8493 DWARF2+ line number tables are to be generated.
8494
8495 -gas-locview-support
8496 Inform the compiler that the assembler supports "view" assignment
8497 and reset assertion checking in ".loc" directives.
8498
8499 This option will be enabled by default if, at GCC configure time,
8500 the assembler was found to support them.
8501
8502 -gno-as-locview-support
8503 Force GCC to assign view numbers internally, if
8504 -gvariable-location-views are explicitly requested.
8505
8506 -gcolumn-info
8507 -gno-column-info
8508 Emit location column information into DWARF debugging information,
8509 rather than just file and line. This option is enabled by default.
8510
8511 -gstatement-frontiers
8512 -gno-statement-frontiers
8513 This option causes GCC to create markers in the internal
8514 representation at the beginning of statements, and to keep them
8515 roughly in place throughout compilation, using them to guide the
8516 output of "is_stmt" markers in the line number table. This is
8517 enabled by default when compiling with optimization (-Os, -O1, -O2,
8518 ...), and outputting DWARF 2 debug information at the normal level.
8519
8520 -gvariable-location-views
8521 -gvariable-location-views=incompat5
8522 -gno-variable-location-views
8523 Augment variable location lists with progressive view numbers
8524 implied from the line number table. This enables debug information
8525 consumers to inspect state at certain points of the program, even
8526 if no instructions associated with the corresponding source
8527 locations are present at that point. If the assembler lacks
8528 support for view numbers in line number tables, this will cause the
8529 compiler to emit the line number table, which generally makes them
8530 somewhat less compact. The augmented line number tables and
8531 location lists are fully backward-compatible, so they can be
8532 consumed by debug information consumers that are not aware of these
8533 augmentations, but they won't derive any benefit from them either.
8534
8535 This is enabled by default when outputting DWARF 2 debug
8536 information at the normal level, as long as there is assembler
8537 support, -fvar-tracking-assignments is enabled and -gstrict-dwarf
8538 is not. When assembler support is not available, this may still be
8539 enabled, but it will force GCC to output internal line number
8540 tables, and if -ginternal-reset-location-views is not enabled, that
8541 will most certainly lead to silently mismatching location views.
8542
8543 There is a proposed representation for view numbers that is not
8544 backward compatible with the location list format introduced in
8545 DWARF 5, that can be enabled with
8546 -gvariable-location-views=incompat5. This option may be removed in
8547 the future, is only provided as a reference implementation of the
8548 proposed representation. Debug information consumers are not
8549 expected to support this extended format, and they would be
8550 rendered unable to decode location lists using it.
8551
8552 -ginternal-reset-location-views
8553 -gno-internal-reset-location-views
8554 Attempt to determine location views that can be omitted from
8555 location view lists. This requires the compiler to have very
8556 accurate insn length estimates, which isn't always the case, and it
8557 may cause incorrect view lists to be generated silently when using
8558 an assembler that does not support location view lists. The GNU
8559 assembler will flag any such error as a "view number mismatch".
8560 This is only enabled on ports that define a reliable estimation
8561 function.
8562
8563 -ginline-points
8564 -gno-inline-points
8565 Generate extended debug information for inlined functions.
8566 Location view tracking markers are inserted at inlined entry
8567 points, so that address and view numbers can be computed and output
8568 in debug information. This can be enabled independently of
8569 location views, in which case the view numbers won't be output, but
8570 it can only be enabled along with statement frontiers, and it is
8571 only enabled by default if location views are enabled.
8572
8573 -gz[=type]
8574 Produce compressed debug sections in DWARF format, if that is
8575 supported. If type is not given, the default type depends on the
8576 capabilities of the assembler and linker used. type may be one of
8577 none (don't compress debug sections), zlib (use zlib compression in
8578 ELF gABI format), or zlib-gnu (use zlib compression in traditional
8579 GNU format). If the linker doesn't support writing compressed
8580 debug sections, the option is rejected. Otherwise, if the
8581 assembler does not support them, -gz is silently ignored when
8582 producing object files.
8583
8584 -femit-struct-debug-baseonly
8585 Emit debug information for struct-like types only when the base
8586 name of the compilation source file matches the base name of file
8587 in which the struct is defined.
8588
8589 This option substantially reduces the size of debugging
8590 information, but at significant potential loss in type information
8591 to the debugger. See -femit-struct-debug-reduced for a less
8592 aggressive option. See -femit-struct-debug-detailed for more
8593 detailed control.
8594
8595 This option works only with DWARF debug output.
8596
8597 -femit-struct-debug-reduced
8598 Emit debug information for struct-like types only when the base
8599 name of the compilation source file matches the base name of file
8600 in which the type is defined, unless the struct is a template or
8601 defined in a system header.
8602
8603 This option significantly reduces the size of debugging
8604 information, with some potential loss in type information to the
8605 debugger. See -femit-struct-debug-baseonly for a more aggressive
8606 option. See -femit-struct-debug-detailed for more detailed
8607 control.
8608
8609 This option works only with DWARF debug output.
8610
8611 -femit-struct-debug-detailed[=spec-list]
8612 Specify the struct-like types for which the compiler generates
8613 debug information. The intent is to reduce duplicate struct debug
8614 information between different object files within the same program.
8615
8616 This option is a detailed version of -femit-struct-debug-reduced
8617 and -femit-struct-debug-baseonly, which serves for most needs.
8618
8619 A specification has the
8620 syntax[dir:|ind:][ord:|gen:](any|sys|base|none)
8621
8622 The optional first word limits the specification to structs that
8623 are used directly (dir:) or used indirectly (ind:). A struct type
8624 is used directly when it is the type of a variable, member.
8625 Indirect uses arise through pointers to structs. That is, when use
8626 of an incomplete struct is valid, the use is indirect. An example
8627 is struct one direct; struct two * indirect;.
8628
8629 The optional second word limits the specification to ordinary
8630 structs (ord:) or generic structs (gen:). Generic structs are a
8631 bit complicated to explain. For C++, these are non-explicit
8632 specializations of template classes, or non-template classes within
8633 the above. Other programming languages have generics, but
8634 -femit-struct-debug-detailed does not yet implement them.
8635
8636 The third word specifies the source files for those structs for
8637 which the compiler should emit debug information. The values none
8638 and any have the normal meaning. The value base means that the
8639 base of name of the file in which the type declaration appears must
8640 match the base of the name of the main compilation file. In
8641 practice, this means that when compiling foo.c, debug information
8642 is generated for types declared in that file and foo.h, but not
8643 other header files. The value sys means those types satisfying
8644 base or declared in system or compiler headers.
8645
8646 You may need to experiment to determine the best settings for your
8647 application.
8648
8649 The default is -femit-struct-debug-detailed=all.
8650
8651 This option works only with DWARF debug output.
8652
8653 -fno-dwarf2-cfi-asm
8654 Emit DWARF unwind info as compiler generated ".eh_frame" section
8655 instead of using GAS ".cfi_*" directives.
8656
8657 -fno-eliminate-unused-debug-types
8658 Normally, when producing DWARF output, GCC avoids producing debug
8659 symbol output for types that are nowhere used in the source file
8660 being compiled. Sometimes it is useful to have GCC emit debugging
8661 information for all types declared in a compilation unit,
8662 regardless of whether or not they are actually used in that
8663 compilation unit, for example if, in the debugger, you want to cast
8664 a value to a type that is not actually used in your program (but is
8665 declared). More often, however, this results in a significant
8666 amount of wasted space.
8667
8668 Options That Control Optimization
8669 These options control various sorts of optimizations.
8670
8671 Without any optimization option, the compiler's goal is to reduce the
8672 cost of compilation and to make debugging produce the expected results.
8673 Statements are independent: if you stop the program with a breakpoint
8674 between statements, you can then assign a new value to any variable or
8675 change the program counter to any other statement in the function and
8676 get exactly the results you expect from the source code.
8677
8678 Turning on optimization flags makes the compiler attempt to improve the
8679 performance and/or code size at the expense of compilation time and
8680 possibly the ability to debug the program.
8681
8682 The compiler performs optimization based on the knowledge it has of the
8683 program. Compiling multiple files at once to a single output file mode
8684 allows the compiler to use information gained from all of the files
8685 when compiling each of them.
8686
8687 Not all optimizations are controlled directly by a flag. Only
8688 optimizations that have a flag are listed in this section.
8689
8690 Most optimizations are completely disabled at -O0 or if an -O level is
8691 not set on the command line, even if individual optimization flags are
8692 specified. Similarly, -Og suppresses many optimization passes.
8693
8694 Depending on the target and how GCC was configured, a slightly
8695 different set of optimizations may be enabled at each -O level than
8696 those listed here. You can invoke GCC with -Q --help=optimizers to
8697 find out the exact set of optimizations that are enabled at each level.
8698
8699 -O
8700 -O1 Optimize. Optimizing compilation takes somewhat more time, and a
8701 lot more memory for a large function.
8702
8703 With -O, the compiler tries to reduce code size and execution time,
8704 without performing any optimizations that take a great deal of
8705 compilation time.
8706
8707 -O turns on the following optimization flags:
8708
8709 -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments
8710 -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch
8711 -fdse -fforward-propagate -fguess-branch-probability
8712 -fif-conversion -fif-conversion2 -finline-functions-called-once
8713 -fipa-modref -fipa-profile -fipa-pure-const -fipa-reference
8714 -fipa-reference-addressable -fmerge-constants
8715 -fmove-loop-invariants -fmove-loop-stores -fomit-frame-pointer
8716 -freorder-blocks -fshrink-wrap -fshrink-wrap-separate
8717 -fsplit-wide-types -fssa-backprop -fssa-phiopt -ftree-bit-ccp
8718 -ftree-ccp -ftree-ch -ftree-coalesce-vars -ftree-copy-prop
8719 -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-forwprop
8720 -ftree-fre -ftree-phiprop -ftree-pta -ftree-scev-cprop -ftree-sink
8721 -ftree-slsr -ftree-sra -ftree-ter -funit-at-a-time
8722
8723 -O2 Optimize even more. GCC performs nearly all supported
8724 optimizations that do not involve a space-speed tradeoff. As
8725 compared to -O, this option increases both compilation time and the
8726 performance of the generated code.
8727
8728 -O2 turns on all optimization flags specified by -O1. It also
8729 turns on the following optimization flags:
8730
8731 -falign-functions -falign-jumps -falign-labels -falign-loops
8732 -fcaller-saves -fcode-hoisting -fcrossjumping -fcse-follow-jumps
8733 -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize
8734 -fdevirtualize-speculatively -fexpensive-optimizations
8735 -ffinite-loops -fgcse -fgcse-lm -fhoist-adjacent-loads
8736 -finline-functions -finline-small-functions -findirect-inlining
8737 -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fipa-vrp
8738 -fisolate-erroneous-paths-dereference -flra-remat
8739 -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining
8740 -fpeephole2 -freorder-blocks-algorithm=stc
8741 -freorder-blocks-and-partition -freorder-functions
8742 -frerun-cse-after-loop -fschedule-insns -fschedule-insns2
8743 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing
8744 -fthread-jumps -ftree-builtin-call-dce -ftree-loop-vectorize
8745 -ftree-pre -ftree-slp-vectorize -ftree-switch-conversion
8746 -ftree-tail-merge -ftree-vrp -fvect-cost-model=very-cheap
8747
8748 Please note the warning under -fgcse about invoking -O2 on programs
8749 that use computed gotos.
8750
8751 -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2
8752 and also turns on the following optimization flags:
8753
8754 -fgcse-after-reload -fipa-cp-clone -floop-interchange
8755 -floop-unroll-and-jam -fpeel-loops -fpredictive-commoning
8756 -fsplit-loops -fsplit-paths -ftree-loop-distribution
8757 -ftree-partial-pre -funswitch-loops -fvect-cost-model=dynamic
8758 -fversion-loops-for-strides
8759
8760 -O0 Reduce compilation time and make debugging produce the expected
8761 results. This is the default.
8762
8763 -Os Optimize for size. -Os enables all -O2 optimizations except those
8764 that often increase code size:
8765
8766 -falign-functions -falign-jumps -falign-labels -falign-loops
8767 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc
8768
8769 It also enables -finline-functions, causes the compiler to tune for
8770 code size rather than execution speed, and performs further
8771 optimizations designed to reduce code size.
8772
8773 -Ofast
8774 Disregard strict standards compliance. -Ofast enables all -O3
8775 optimizations. It also enables optimizations that are not valid
8776 for all standard-compliant programs. It turns on -ffast-math,
8777 -fallow-store-data-races and the Fortran-specific -fstack-arrays,
8778 unless -fmax-stack-var-size is specified, and -fno-protect-parens.
8779 It turns off -fsemantic-interposition.
8780
8781 -Og Optimize debugging experience. -Og should be the optimization
8782 level of choice for the standard edit-compile-debug cycle, offering
8783 a reasonable level of optimization while maintaining fast
8784 compilation and a good debugging experience. It is a better choice
8785 than -O0 for producing debuggable code because some compiler passes
8786 that collect debug information are disabled at -O0.
8787
8788 Like -O0, -Og completely disables a number of optimization passes
8789 so that individual options controlling them have no effect.
8790 Otherwise -Og enables all -O1 optimization flags except for those
8791 that may interfere with debugging:
8792
8793 -fbranch-count-reg -fdelayed-branch -fdse -fif-conversion
8794 -fif-conversion2 -finline-functions-called-once
8795 -fmove-loop-invariants -fmove-loop-stores -fssa-phiopt
8796 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra
8797
8798 -Oz Optimize aggressively for size rather than speed. This may
8799 increase the number of instructions executed if those instructions
8800 require fewer bytes to encode. -Oz behaves similarly to -Os
8801 including enabling most -O2 optimizations.
8802
8803 If you use multiple -O options, with or without level numbers, the last
8804 such option is the one that is effective.
8805
8806 Options of the form -fflag specify machine-independent flags. Most
8807 flags have both positive and negative forms; the negative form of -ffoo
8808 is -fno-foo. In the table below, only one of the forms is listed---the
8809 one you typically use. You can figure out the other form by either
8810 removing no- or adding it.
8811
8812 The following options control specific optimizations. They are either
8813 activated by -O options or are related to ones that are. You can use
8814 the following flags in the rare cases when "fine-tuning" of
8815 optimizations to be performed is desired.
8816
8817 -fno-defer-pop
8818 For machines that must pop arguments after a function call, always
8819 pop the arguments as soon as each function returns. At levels -O1
8820 and higher, -fdefer-pop is the default; this allows the compiler to
8821 let arguments accumulate on the stack for several function calls
8822 and pop them all at once.
8823
8824 -fforward-propagate
8825 Perform a forward propagation pass on RTL. The pass tries to
8826 combine two instructions and checks if the result can be
8827 simplified. If loop unrolling is active, two passes are performed
8828 and the second is scheduled after loop unrolling.
8829
8830 This option is enabled by default at optimization levels -O1, -O2,
8831 -O3, -Os.
8832
8833 -ffp-contract=style
8834 -ffp-contract=off disables floating-point expression contraction.
8835 -ffp-contract=fast enables floating-point expression contraction
8836 such as forming of fused multiply-add operations if the target has
8837 native support for them. -ffp-contract=on enables floating-point
8838 expression contraction if allowed by the language standard. This
8839 is currently not implemented and treated equal to
8840 -ffp-contract=off.
8841
8842 The default is -ffp-contract=fast.
8843
8844 -fomit-frame-pointer
8845 Omit the frame pointer in functions that don't need one. This
8846 avoids the instructions to save, set up and restore the frame
8847 pointer; on many targets it also makes an extra register available.
8848
8849 On some targets this flag has no effect because the standard
8850 calling sequence always uses a frame pointer, so it cannot be
8851 omitted.
8852
8853 Note that -fno-omit-frame-pointer doesn't guarantee the frame
8854 pointer is used in all functions. Several targets always omit the
8855 frame pointer in leaf functions.
8856
8857 Enabled by default at -O1 and higher.
8858
8859 -foptimize-sibling-calls
8860 Optimize sibling and tail recursive calls.
8861
8862 Enabled at levels -O2, -O3, -Os.
8863
8864 -foptimize-strlen
8865 Optimize various standard C string functions (e.g. "strlen",
8866 "strchr" or "strcpy") and their "_FORTIFY_SOURCE" counterparts into
8867 faster alternatives.
8868
8869 Enabled at levels -O2, -O3.
8870
8871 -fno-inline
8872 Do not expand any functions inline apart from those marked with the
8873 "always_inline" attribute. This is the default when not
8874 optimizing.
8875
8876 Single functions can be exempted from inlining by marking them with
8877 the "noinline" attribute.
8878
8879 -finline-small-functions
8880 Integrate functions into their callers when their body is smaller
8881 than expected function call code (so overall size of program gets
8882 smaller). The compiler heuristically decides which functions are
8883 simple enough to be worth integrating in this way. This inlining
8884 applies to all functions, even those not declared inline.
8885
8886 Enabled at levels -O2, -O3, -Os.
8887
8888 -findirect-inlining
8889 Inline also indirect calls that are discovered to be known at
8890 compile time thanks to previous inlining. This option has any
8891 effect only when inlining itself is turned on by the
8892 -finline-functions or -finline-small-functions options.
8893
8894 Enabled at levels -O2, -O3, -Os.
8895
8896 -finline-functions
8897 Consider all functions for inlining, even if they are not declared
8898 inline. The compiler heuristically decides which functions are
8899 worth integrating in this way.
8900
8901 If all calls to a given function are integrated, and the function
8902 is declared "static", then the function is normally not output as
8903 assembler code in its own right.
8904
8905 Enabled at levels -O2, -O3, -Os. Also enabled by -fprofile-use and
8906 -fauto-profile.
8907
8908 -finline-functions-called-once
8909 Consider all "static" functions called once for inlining into their
8910 caller even if they are not marked "inline". If a call to a given
8911 function is integrated, then the function is not output as
8912 assembler code in its own right.
8913
8914 Enabled at levels -O1, -O2, -O3 and -Os, but not -Og.
8915
8916 -fearly-inlining
8917 Inline functions marked by "always_inline" and functions whose body
8918 seems smaller than the function call overhead early before doing
8919 -fprofile-generate instrumentation and real inlining pass. Doing
8920 so makes profiling significantly cheaper and usually inlining
8921 faster on programs having large chains of nested wrapper functions.
8922
8923 Enabled by default.
8924
8925 -fipa-sra
8926 Perform interprocedural scalar replacement of aggregates, removal
8927 of unused parameters and replacement of parameters passed by
8928 reference by parameters passed by value.
8929
8930 Enabled at levels -O2, -O3 and -Os.
8931
8932 -finline-limit=n
8933 By default, GCC limits the size of functions that can be inlined.
8934 This flag allows coarse control of this limit. n is the size of
8935 functions that can be inlined in number of pseudo instructions.
8936
8937 Inlining is actually controlled by a number of parameters, which
8938 may be specified individually by using --param name=value. The
8939 -finline-limit=n option sets some of these parameters as follows:
8940
8941 max-inline-insns-single
8942 is set to n/2.
8943
8944 max-inline-insns-auto
8945 is set to n/2.
8946
8947 See below for a documentation of the individual parameters
8948 controlling inlining and for the defaults of these parameters.
8949
8950 Note: there may be no value to -finline-limit that results in
8951 default behavior.
8952
8953 Note: pseudo instruction represents, in this particular context, an
8954 abstract measurement of function's size. In no way does it
8955 represent a count of assembly instructions and as such its exact
8956 meaning might change from one release to an another.
8957
8958 -fno-keep-inline-dllexport
8959 This is a more fine-grained version of -fkeep-inline-functions,
8960 which applies only to functions that are declared using the
8961 "dllexport" attribute or declspec.
8962
8963 -fkeep-inline-functions
8964 In C, emit "static" functions that are declared "inline" into the
8965 object file, even if the function has been inlined into all of its
8966 callers. This switch does not affect functions using the "extern
8967 inline" extension in GNU C90. In C++, emit any and all inline
8968 functions into the object file.
8969
8970 -fkeep-static-functions
8971 Emit "static" functions into the object file, even if the function
8972 is never used.
8973
8974 -fkeep-static-consts
8975 Emit variables declared "static const" when optimization isn't
8976 turned on, even if the variables aren't referenced.
8977
8978 GCC enables this option by default. If you want to force the
8979 compiler to check if a variable is referenced, regardless of
8980 whether or not optimization is turned on, use the
8981 -fno-keep-static-consts option.
8982
8983 -fmerge-constants
8984 Attempt to merge identical constants (string constants and
8985 floating-point constants) across compilation units.
8986
8987 This option is the default for optimized compilation if the
8988 assembler and linker support it. Use -fno-merge-constants to
8989 inhibit this behavior.
8990
8991 Enabled at levels -O1, -O2, -O3, -Os.
8992
8993 -fmerge-all-constants
8994 Attempt to merge identical constants and identical variables.
8995
8996 This option implies -fmerge-constants. In addition to
8997 -fmerge-constants this considers e.g. even constant initialized
8998 arrays or initialized constant variables with integral or floating-
8999 point types. Languages like C or C++ require each variable,
9000 including multiple instances of the same variable in recursive
9001 calls, to have distinct locations, so using this option results in
9002 non-conforming behavior.
9003
9004 -fmodulo-sched
9005 Perform swing modulo scheduling immediately before the first
9006 scheduling pass. This pass looks at innermost loops and reorders
9007 their instructions by overlapping different iterations.
9008
9009 -fmodulo-sched-allow-regmoves
9010 Perform more aggressive SMS-based modulo scheduling with register
9011 moves allowed. By setting this flag certain anti-dependences edges
9012 are deleted, which triggers the generation of reg-moves based on
9013 the life-range analysis. This option is effective only with
9014 -fmodulo-sched enabled.
9015
9016 -fno-branch-count-reg
9017 Disable the optimization pass that scans for opportunities to use
9018 "decrement and branch" instructions on a count register instead of
9019 instruction sequences that decrement a register, compare it against
9020 zero, and then branch based upon the result. This option is only
9021 meaningful on architectures that support such instructions, which
9022 include x86, PowerPC, IA-64 and S/390. Note that the
9023 -fno-branch-count-reg option doesn't remove the decrement and
9024 branch instructions from the generated instruction stream
9025 introduced by other optimization passes.
9026
9027 The default is -fbranch-count-reg at -O1 and higher, except for
9028 -Og.
9029
9030 -fno-function-cse
9031 Do not put function addresses in registers; make each instruction
9032 that calls a constant function contain the function's address
9033 explicitly.
9034
9035 This option results in less efficient code, but some strange hacks
9036 that alter the assembler output may be confused by the
9037 optimizations performed when this option is not used.
9038
9039 The default is -ffunction-cse
9040
9041 -fno-zero-initialized-in-bss
9042 If the target supports a BSS section, GCC by default puts variables
9043 that are initialized to zero into BSS. This can save space in the
9044 resulting code.
9045
9046 This option turns off this behavior because some programs
9047 explicitly rely on variables going to the data section---e.g., so
9048 that the resulting executable can find the beginning of that
9049 section and/or make assumptions based on that.
9050
9051 The default is -fzero-initialized-in-bss.
9052
9053 -fthread-jumps
9054 Perform optimizations that check to see if a jump branches to a
9055 location where another comparison subsumed by the first is found.
9056 If so, the first branch is redirected to either the destination of
9057 the second branch or a point immediately following it, depending on
9058 whether the condition is known to be true or false.
9059
9060 Enabled at levels -O1, -O2, -O3, -Os.
9061
9062 -fsplit-wide-types
9063 When using a type that occupies multiple registers, such as "long
9064 long" on a 32-bit system, split the registers apart and allocate
9065 them independently. This normally generates better code for those
9066 types, but may make debugging more difficult.
9067
9068 Enabled at levels -O1, -O2, -O3, -Os.
9069
9070 -fsplit-wide-types-early
9071 Fully split wide types early, instead of very late. This option
9072 has no effect unless -fsplit-wide-types is turned on.
9073
9074 This is the default on some targets.
9075
9076 -fcse-follow-jumps
9077 In common subexpression elimination (CSE), scan through jump
9078 instructions when the target of the jump is not reached by any
9079 other path. For example, when CSE encounters an "if" statement
9080 with an "else" clause, CSE follows the jump when the condition
9081 tested is false.
9082
9083 Enabled at levels -O2, -O3, -Os.
9084
9085 -fcse-skip-blocks
9086 This is similar to -fcse-follow-jumps, but causes CSE to follow
9087 jumps that conditionally skip over blocks. When CSE encounters a
9088 simple "if" statement with no else clause, -fcse-skip-blocks causes
9089 CSE to follow the jump around the body of the "if".
9090
9091 Enabled at levels -O2, -O3, -Os.
9092
9093 -frerun-cse-after-loop
9094 Re-run common subexpression elimination after loop optimizations
9095 are performed.
9096
9097 Enabled at levels -O2, -O3, -Os.
9098
9099 -fgcse
9100 Perform a global common subexpression elimination pass. This pass
9101 also performs global constant and copy propagation.
9102
9103 Note: When compiling a program using computed gotos, a GCC
9104 extension, you may get better run-time performance if you disable
9105 the global common subexpression elimination pass by adding
9106 -fno-gcse to the command line.
9107
9108 Enabled at levels -O2, -O3, -Os.
9109
9110 -fgcse-lm
9111 When -fgcse-lm is enabled, global common subexpression elimination
9112 attempts to move loads that are only killed by stores into
9113 themselves. This allows a loop containing a load/store sequence to
9114 be changed to a load outside the loop, and a copy/store within the
9115 loop.
9116
9117 Enabled by default when -fgcse is enabled.
9118
9119 -fgcse-sm
9120 When -fgcse-sm is enabled, a store motion pass is run after global
9121 common subexpression elimination. This pass attempts to move
9122 stores out of loops. When used in conjunction with -fgcse-lm,
9123 loops containing a load/store sequence can be changed to a load
9124 before the loop and a store after the loop.
9125
9126 Not enabled at any optimization level.
9127
9128 -fgcse-las
9129 When -fgcse-las is enabled, the global common subexpression
9130 elimination pass eliminates redundant loads that come after stores
9131 to the same memory location (both partial and full redundancies).
9132
9133 Not enabled at any optimization level.
9134
9135 -fgcse-after-reload
9136 When -fgcse-after-reload is enabled, a redundant load elimination
9137 pass is performed after reload. The purpose of this pass is to
9138 clean up redundant spilling.
9139
9140 Enabled by -O3, -fprofile-use and -fauto-profile.
9141
9142 -faggressive-loop-optimizations
9143 This option tells the loop optimizer to use language constraints to
9144 derive bounds for the number of iterations of a loop. This assumes
9145 that loop code does not invoke undefined behavior by for example
9146 causing signed integer overflows or out-of-bound array accesses.
9147 The bounds for the number of iterations of a loop are used to guide
9148 loop unrolling and peeling and loop exit test optimizations. This
9149 option is enabled by default.
9150
9151 -funconstrained-commons
9152 This option tells the compiler that variables declared in common
9153 blocks (e.g. Fortran) may later be overridden with longer trailing
9154 arrays. This prevents certain optimizations that depend on knowing
9155 the array bounds.
9156
9157 -fcrossjumping
9158 Perform cross-jumping transformation. This transformation unifies
9159 equivalent code and saves code size. The resulting code may or may
9160 not perform better than without cross-jumping.
9161
9162 Enabled at levels -O2, -O3, -Os.
9163
9164 -fauto-inc-dec
9165 Combine increments or decrements of addresses with memory accesses.
9166 This pass is always skipped on architectures that do not have
9167 instructions to support this. Enabled by default at -O1 and higher
9168 on architectures that support this.
9169
9170 -fdce
9171 Perform dead code elimination (DCE) on RTL. Enabled by default at
9172 -O1 and higher.
9173
9174 -fdse
9175 Perform dead store elimination (DSE) on RTL. Enabled by default at
9176 -O1 and higher.
9177
9178 -fif-conversion
9179 Attempt to transform conditional jumps into branch-less
9180 equivalents. This includes use of conditional moves, min, max, set
9181 flags and abs instructions, and some tricks doable by standard
9182 arithmetics. The use of conditional execution on chips where it is
9183 available is controlled by -fif-conversion2.
9184
9185 Enabled at levels -O1, -O2, -O3, -Os, but not with -Og.
9186
9187 -fif-conversion2
9188 Use conditional execution (where available) to transform
9189 conditional jumps into branch-less equivalents.
9190
9191 Enabled at levels -O1, -O2, -O3, -Os, but not with -Og.
9192
9193 -fdeclone-ctor-dtor
9194 The C++ ABI requires multiple entry points for constructors and
9195 destructors: one for a base subobject, one for a complete object,
9196 and one for a virtual destructor that calls operator delete
9197 afterwards. For a hierarchy with virtual bases, the base and
9198 complete variants are clones, which means two copies of the
9199 function. With this option, the base and complete variants are
9200 changed to be thunks that call a common implementation.
9201
9202 Enabled by -Os.
9203
9204 -fdelete-null-pointer-checks
9205 Assume that programs cannot safely dereference null pointers, and
9206 that no code or data element resides at address zero. This option
9207 enables simple constant folding optimizations at all optimization
9208 levels. In addition, other optimization passes in GCC use this
9209 flag to control global dataflow analyses that eliminate useless
9210 checks for null pointers; these assume that a memory access to
9211 address zero always results in a trap, so that if a pointer is
9212 checked after it has already been dereferenced, it cannot be null.
9213
9214 Note however that in some environments this assumption is not true.
9215 Use -fno-delete-null-pointer-checks to disable this optimization
9216 for programs that depend on that behavior.
9217
9218 This option is enabled by default on most targets. On Nios II ELF,
9219 it defaults to off. On AVR, CR16, and MSP430, this option is
9220 completely disabled.
9221
9222 Passes that use the dataflow information are enabled independently
9223 at different optimization levels.
9224
9225 -fdevirtualize
9226 Attempt to convert calls to virtual functions to direct calls.
9227 This is done both within a procedure and interprocedurally as part
9228 of indirect inlining (-findirect-inlining) and interprocedural
9229 constant propagation (-fipa-cp). Enabled at levels -O2, -O3, -Os.
9230
9231 -fdevirtualize-speculatively
9232 Attempt to convert calls to virtual functions to speculative direct
9233 calls. Based on the analysis of the type inheritance graph,
9234 determine for a given call the set of likely targets. If the set is
9235 small, preferably of size 1, change the call into a conditional
9236 deciding between direct and indirect calls. The speculative calls
9237 enable more optimizations, such as inlining. When they seem
9238 useless after further optimization, they are converted back into
9239 original form.
9240
9241 -fdevirtualize-at-ltrans
9242 Stream extra information needed for aggressive devirtualization
9243 when running the link-time optimizer in local transformation mode.
9244 This option enables more devirtualization but significantly
9245 increases the size of streamed data. For this reason it is disabled
9246 by default.
9247
9248 -fexpensive-optimizations
9249 Perform a number of minor optimizations that are relatively
9250 expensive.
9251
9252 Enabled at levels -O2, -O3, -Os.
9253
9254 -free
9255 Attempt to remove redundant extension instructions. This is
9256 especially helpful for the x86-64 architecture, which implicitly
9257 zero-extends in 64-bit registers after writing to their lower
9258 32-bit half.
9259
9260 Enabled for Alpha, AArch64 and x86 at levels -O2, -O3, -Os.
9261
9262 -fno-lifetime-dse
9263 In C++ the value of an object is only affected by changes within
9264 its lifetime: when the constructor begins, the object has an
9265 indeterminate value, and any changes during the lifetime of the
9266 object are dead when the object is destroyed. Normally dead store
9267 elimination will take advantage of this; if your code relies on the
9268 value of the object storage persisting beyond the lifetime of the
9269 object, you can use this flag to disable this optimization. To
9270 preserve stores before the constructor starts (e.g. because your
9271 operator new clears the object storage) but still treat the object
9272 as dead after the destructor, you can use -flifetime-dse=1. The
9273 default behavior can be explicitly selected with -flifetime-dse=2.
9274 -flifetime-dse=0 is equivalent to -fno-lifetime-dse.
9275
9276 -flive-range-shrinkage
9277 Attempt to decrease register pressure through register live range
9278 shrinkage. This is helpful for fast processors with small or
9279 moderate size register sets.
9280
9281 -fira-algorithm=algorithm
9282 Use the specified coloring algorithm for the integrated register
9283 allocator. The algorithm argument can be priority, which specifies
9284 Chow's priority coloring, or CB, which specifies Chaitin-Briggs
9285 coloring. Chaitin-Briggs coloring is not implemented for all
9286 architectures, but for those targets that do support it, it is the
9287 default because it generates better code.
9288
9289 -fira-region=region
9290 Use specified regions for the integrated register allocator. The
9291 region argument should be one of the following:
9292
9293 all Use all loops as register allocation regions. This can give
9294 the best results for machines with a small and/or irregular
9295 register set.
9296
9297 mixed
9298 Use all loops except for loops with small register pressure as
9299 the regions. This value usually gives the best results in most
9300 cases and for most architectures, and is enabled by default
9301 when compiling with optimization for speed (-O, -O2, ...).
9302
9303 one Use all functions as a single region. This typically results
9304 in the smallest code size, and is enabled by default for -Os or
9305 -O0.
9306
9307 -fira-hoist-pressure
9308 Use IRA to evaluate register pressure in the code hoisting pass for
9309 decisions to hoist expressions. This option usually results in
9310 smaller code, but it can slow the compiler down.
9311
9312 This option is enabled at level -Os for all targets.
9313
9314 -fira-loop-pressure
9315 Use IRA to evaluate register pressure in loops for decisions to
9316 move loop invariants. This option usually results in generation of
9317 faster and smaller code on machines with large register files (>=
9318 32 registers), but it can slow the compiler down.
9319
9320 This option is enabled at level -O3 for some targets.
9321
9322 -fno-ira-share-save-slots
9323 Disable sharing of stack slots used for saving call-used hard
9324 registers living through a call. Each hard register gets a
9325 separate stack slot, and as a result function stack frames are
9326 larger.
9327
9328 -fno-ira-share-spill-slots
9329 Disable sharing of stack slots allocated for pseudo-registers.
9330 Each pseudo-register that does not get a hard register gets a
9331 separate stack slot, and as a result function stack frames are
9332 larger.
9333
9334 -flra-remat
9335 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9336 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9337 values if it is profitable.
9338
9339 Enabled at levels -O2, -O3, -Os.
9340
9341 -fdelayed-branch
9342 If supported for the target machine, attempt to reorder
9343 instructions to exploit instruction slots available after delayed
9344 branch instructions.
9345
9346 Enabled at levels -O1, -O2, -O3, -Os, but not at -Og.
9347
9348 -fschedule-insns
9349 If supported for the target machine, attempt to reorder
9350 instructions to eliminate execution stalls due to required data
9351 being unavailable. This helps machines that have slow floating
9352 point or memory load instructions by allowing other instructions to
9353 be issued until the result of the load or floating-point
9354 instruction is required.
9355
9356 Enabled at levels -O2, -O3.
9357
9358 -fschedule-insns2
9359 Similar to -fschedule-insns, but requests an additional pass of
9360 instruction scheduling after register allocation has been done.
9361 This is especially useful on machines with a relatively small
9362 number of registers and where memory load instructions take more
9363 than one cycle.
9364
9365 Enabled at levels -O2, -O3, -Os.
9366
9367 -fno-sched-interblock
9368 Disable instruction scheduling across basic blocks, which is
9369 normally enabled when scheduling before register allocation, i.e.
9370 with -fschedule-insns or at -O2 or higher.
9371
9372 -fno-sched-spec
9373 Disable speculative motion of non-load instructions, which is
9374 normally enabled when scheduling before register allocation, i.e.
9375 with -fschedule-insns or at -O2 or higher.
9376
9377 -fsched-pressure
9378 Enable register pressure sensitive insn scheduling before register
9379 allocation. This only makes sense when scheduling before register
9380 allocation is enabled, i.e. with -fschedule-insns or at -O2 or
9381 higher. Usage of this option can improve the generated code and
9382 decrease its size by preventing register pressure increase above
9383 the number of available hard registers and subsequent spills in
9384 register allocation.
9385
9386 -fsched-spec-load
9387 Allow speculative motion of some load instructions. This only
9388 makes sense when scheduling before register allocation, i.e. with
9389 -fschedule-insns or at -O2 or higher.
9390
9391 -fsched-spec-load-dangerous
9392 Allow speculative motion of more load instructions. This only
9393 makes sense when scheduling before register allocation, i.e. with
9394 -fschedule-insns or at -O2 or higher.
9395
9396 -fsched-stalled-insns
9397 -fsched-stalled-insns=n
9398 Define how many insns (if any) can be moved prematurely from the
9399 queue of stalled insns into the ready list during the second
9400 scheduling pass. -fno-sched-stalled-insns means that no insns are
9401 moved prematurely, -fsched-stalled-insns=0 means there is no limit
9402 on how many queued insns can be moved prematurely.
9403 -fsched-stalled-insns without a value is equivalent to
9404 -fsched-stalled-insns=1.
9405
9406 -fsched-stalled-insns-dep
9407 -fsched-stalled-insns-dep=n
9408 Define how many insn groups (cycles) are examined for a dependency
9409 on a stalled insn that is a candidate for premature removal from
9410 the queue of stalled insns. This has an effect only during the
9411 second scheduling pass, and only if -fsched-stalled-insns is used.
9412 -fno-sched-stalled-insns-dep is equivalent to
9413 -fsched-stalled-insns-dep=0. -fsched-stalled-insns-dep without a
9414 value is equivalent to -fsched-stalled-insns-dep=1.
9415
9416 -fsched2-use-superblocks
9417 When scheduling after register allocation, use superblock
9418 scheduling. This allows motion across basic block boundaries,
9419 resulting in faster schedules. This option is experimental, as not
9420 all machine descriptions used by GCC model the CPU closely enough
9421 to avoid unreliable results from the algorithm.
9422
9423 This only makes sense when scheduling after register allocation,
9424 i.e. with -fschedule-insns2 or at -O2 or higher.
9425
9426 -fsched-group-heuristic
9427 Enable the group heuristic in the scheduler. This heuristic favors
9428 the instruction that belongs to a schedule group. This is enabled
9429 by default when scheduling is enabled, i.e. with -fschedule-insns
9430 or -fschedule-insns2 or at -O2 or higher.
9431
9432 -fsched-critical-path-heuristic
9433 Enable the critical-path heuristic in the scheduler. This
9434 heuristic favors instructions on the critical path. This is
9435 enabled by default when scheduling is enabled, i.e. with
9436 -fschedule-insns or -fschedule-insns2 or at -O2 or higher.
9437
9438 -fsched-spec-insn-heuristic
9439 Enable the speculative instruction heuristic in the scheduler.
9440 This heuristic favors speculative instructions with greater
9441 dependency weakness. This is enabled by default when scheduling is
9442 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
9443 or higher.
9444
9445 -fsched-rank-heuristic
9446 Enable the rank heuristic in the scheduler. This heuristic favors
9447 the instruction belonging to a basic block with greater size or
9448 frequency. This is enabled by default when scheduling is enabled,
9449 i.e. with -fschedule-insns or -fschedule-insns2 or at -O2 or
9450 higher.
9451
9452 -fsched-last-insn-heuristic
9453 Enable the last-instruction heuristic in the scheduler. This
9454 heuristic favors the instruction that is less dependent on the last
9455 instruction scheduled. This is enabled by default when scheduling
9456 is enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at
9457 -O2 or higher.
9458
9459 -fsched-dep-count-heuristic
9460 Enable the dependent-count heuristic in the scheduler. This
9461 heuristic favors the instruction that has more instructions
9462 depending on it. This is enabled by default when scheduling is
9463 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
9464 or higher.
9465
9466 -freschedule-modulo-scheduled-loops
9467 Modulo scheduling is performed before traditional scheduling. If a
9468 loop is modulo scheduled, later scheduling passes may change its
9469 schedule. Use this option to control that behavior.
9470
9471 -fselective-scheduling
9472 Schedule instructions using selective scheduling algorithm.
9473 Selective scheduling runs instead of the first scheduler pass.
9474
9475 -fselective-scheduling2
9476 Schedule instructions using selective scheduling algorithm.
9477 Selective scheduling runs instead of the second scheduler pass.
9478
9479 -fsel-sched-pipelining
9480 Enable software pipelining of innermost loops during selective
9481 scheduling. This option has no effect unless one of
9482 -fselective-scheduling or -fselective-scheduling2 is turned on.
9483
9484 -fsel-sched-pipelining-outer-loops
9485 When pipelining loops during selective scheduling, also pipeline
9486 outer loops. This option has no effect unless
9487 -fsel-sched-pipelining is turned on.
9488
9489 -fsemantic-interposition
9490 Some object formats, like ELF, allow interposing of symbols by the
9491 dynamic linker. This means that for symbols exported from the DSO,
9492 the compiler cannot perform interprocedural propagation, inlining
9493 and other optimizations in anticipation that the function or
9494 variable in question may change. While this feature is useful, for
9495 example, to rewrite memory allocation functions by a debugging
9496 implementation, it is expensive in the terms of code quality. With
9497 -fno-semantic-interposition the compiler assumes that if
9498 interposition happens for functions the overwriting function will
9499 have precisely the same semantics (and side effects). Similarly if
9500 interposition happens for variables, the constructor of the
9501 variable will be the same. The flag has no effect for functions
9502 explicitly declared inline (where it is never allowed for
9503 interposition to change semantics) and for symbols explicitly
9504 declared weak.
9505
9506 -fshrink-wrap
9507 Emit function prologues only before parts of the function that need
9508 it, rather than at the top of the function. This flag is enabled
9509 by default at -O and higher.
9510
9511 -fshrink-wrap-separate
9512 Shrink-wrap separate parts of the prologue and epilogue separately,
9513 so that those parts are only executed when needed. This option is
9514 on by default, but has no effect unless -fshrink-wrap is also
9515 turned on and the target supports this.
9516
9517 -fcaller-saves
9518 Enable allocation of values to registers that are clobbered by
9519 function calls, by emitting extra instructions to save and restore
9520 the registers around such calls. Such allocation is done only when
9521 it seems to result in better code.
9522
9523 This option is always enabled by default on certain machines,
9524 usually those which have no call-preserved registers to use
9525 instead.
9526
9527 Enabled at levels -O2, -O3, -Os.
9528
9529 -fcombine-stack-adjustments
9530 Tracks stack adjustments (pushes and pops) and stack memory
9531 references and then tries to find ways to combine them.
9532
9533 Enabled by default at -O1 and higher.
9534
9535 -fipa-ra
9536 Use caller save registers for allocation if those registers are not
9537 used by any called function. In that case it is not necessary to
9538 save and restore them around calls. This is only possible if
9539 called functions are part of same compilation unit as current
9540 function and they are compiled before it.
9541
9542 Enabled at levels -O2, -O3, -Os, however the option is disabled if
9543 generated code will be instrumented for profiling (-p, or -pg) or
9544 if callee's register usage cannot be known exactly (this happens on
9545 targets that do not expose prologues and epilogues in RTL).
9546
9547 -fconserve-stack
9548 Attempt to minimize stack usage. The compiler attempts to use less
9549 stack space, even if that makes the program slower. This option
9550 implies setting the large-stack-frame parameter to 100 and the
9551 large-stack-frame-growth parameter to 400.
9552
9553 -ftree-reassoc
9554 Perform reassociation on trees. This flag is enabled by default at
9555 -O1 and higher.
9556
9557 -fcode-hoisting
9558 Perform code hoisting. Code hoisting tries to move the evaluation
9559 of expressions executed on all paths to the function exit as early
9560 as possible. This is especially useful as a code size
9561 optimization, but it often helps for code speed as well. This flag
9562 is enabled by default at -O2 and higher.
9563
9564 -ftree-pre
9565 Perform partial redundancy elimination (PRE) on trees. This flag
9566 is enabled by default at -O2 and -O3.
9567
9568 -ftree-partial-pre
9569 Make partial redundancy elimination (PRE) more aggressive. This
9570 flag is enabled by default at -O3.
9571
9572 -ftree-forwprop
9573 Perform forward propagation on trees. This flag is enabled by
9574 default at -O1 and higher.
9575
9576 -ftree-fre
9577 Perform full redundancy elimination (FRE) on trees. The difference
9578 between FRE and PRE is that FRE only considers expressions that are
9579 computed on all paths leading to the redundant computation. This
9580 analysis is faster than PRE, though it exposes fewer redundancies.
9581 This flag is enabled by default at -O1 and higher.
9582
9583 -ftree-phiprop
9584 Perform hoisting of loads from conditional pointers on trees. This
9585 pass is enabled by default at -O1 and higher.
9586
9587 -fhoist-adjacent-loads
9588 Speculatively hoist loads from both branches of an if-then-else if
9589 the loads are from adjacent locations in the same structure and the
9590 target architecture has a conditional move instruction. This flag
9591 is enabled by default at -O2 and higher.
9592
9593 -ftree-copy-prop
9594 Perform copy propagation on trees. This pass eliminates
9595 unnecessary copy operations. This flag is enabled by default at
9596 -O1 and higher.
9597
9598 -fipa-pure-const
9599 Discover which functions are pure or constant. Enabled by default
9600 at -O1 and higher.
9601
9602 -fipa-reference
9603 Discover which static variables do not escape the compilation unit.
9604 Enabled by default at -O1 and higher.
9605
9606 -fipa-reference-addressable
9607 Discover read-only, write-only and non-addressable static
9608 variables. Enabled by default at -O1 and higher.
9609
9610 -fipa-stack-alignment
9611 Reduce stack alignment on call sites if possible. Enabled by
9612 default.
9613
9614 -fipa-pta
9615 Perform interprocedural pointer analysis and interprocedural
9616 modification and reference analysis. This option can cause
9617 excessive memory and compile-time usage on large compilation units.
9618 It is not enabled by default at any optimization level.
9619
9620 -fipa-profile
9621 Perform interprocedural profile propagation. The functions called
9622 only from cold functions are marked as cold. Also functions
9623 executed once (such as "cold", "noreturn", static constructors or
9624 destructors) are identified. Cold functions and loop less parts of
9625 functions executed once are then optimized for size. Enabled by
9626 default at -O1 and higher.
9627
9628 -fipa-modref
9629 Perform interprocedural mod/ref analysis. This optimization
9630 analyzes the side effects of functions (memory locations that are
9631 modified or referenced) and enables better optimization across the
9632 function call boundary. This flag is enabled by default at -O1 and
9633 higher.
9634
9635 -fipa-cp
9636 Perform interprocedural constant propagation. This optimization
9637 analyzes the program to determine when values passed to functions
9638 are constants and then optimizes accordingly. This optimization
9639 can substantially increase performance if the application has
9640 constants passed to functions. This flag is enabled by default at
9641 -O2, -Os and -O3. It is also enabled by -fprofile-use and
9642 -fauto-profile.
9643
9644 -fipa-cp-clone
9645 Perform function cloning to make interprocedural constant
9646 propagation stronger. When enabled, interprocedural constant
9647 propagation performs function cloning when externally visible
9648 function can be called with constant arguments. Because this
9649 optimization can create multiple copies of functions, it may
9650 significantly increase code size (see --param
9651 ipa-cp-unit-growth=value). This flag is enabled by default at -O3.
9652 It is also enabled by -fprofile-use and -fauto-profile.
9653
9654 -fipa-bit-cp
9655 When enabled, perform interprocedural bitwise constant propagation.
9656 This flag is enabled by default at -O2 and by -fprofile-use and
9657 -fauto-profile. It requires that -fipa-cp is enabled.
9658
9659 -fipa-vrp
9660 When enabled, perform interprocedural propagation of value ranges.
9661 This flag is enabled by default at -O2. It requires that -fipa-cp
9662 is enabled.
9663
9664 -fipa-icf
9665 Perform Identical Code Folding for functions and read-only
9666 variables. The optimization reduces code size and may disturb
9667 unwind stacks by replacing a function by equivalent one with a
9668 different name. The optimization works more effectively with link-
9669 time optimization enabled.
9670
9671 Although the behavior is similar to the Gold Linker's ICF
9672 optimization, GCC ICF works on different levels and thus the
9673 optimizations are not same - there are equivalences that are found
9674 only by GCC and equivalences found only by Gold.
9675
9676 This flag is enabled by default at -O2 and -Os.
9677
9678 -flive-patching=level
9679 Control GCC's optimizations to produce output suitable for live-
9680 patching.
9681
9682 If the compiler's optimization uses a function's body or
9683 information extracted from its body to optimize/change another
9684 function, the latter is called an impacted function of the former.
9685 If a function is patched, its impacted functions should be patched
9686 too.
9687
9688 The impacted functions are determined by the compiler's
9689 interprocedural optimizations. For example, a caller is impacted
9690 when inlining a function into its caller, cloning a function and
9691 changing its caller to call this new clone, or extracting a
9692 function's pureness/constness information to optimize its direct or
9693 indirect callers, etc.
9694
9695 Usually, the more IPA optimizations enabled, the larger the number
9696 of impacted functions for each function. In order to control the
9697 number of impacted functions and more easily compute the list of
9698 impacted function, IPA optimizations can be partially enabled at
9699 two different levels.
9700
9701 The level argument should be one of the following:
9702
9703 inline-clone
9704 Only enable inlining and cloning optimizations, which includes
9705 inlining, cloning, interprocedural scalar replacement of
9706 aggregates and partial inlining. As a result, when patching a
9707 function, all its callers and its clones' callers are impacted,
9708 therefore need to be patched as well.
9709
9710 -flive-patching=inline-clone disables the following
9711 optimization flags: -fwhole-program -fipa-pta -fipa-reference
9712 -fipa-ra -fipa-icf -fipa-icf-functions -fipa-icf-variables
9713 -fipa-bit-cp -fipa-vrp -fipa-pure-const
9714 -fipa-reference-addressable -fipa-stack-alignment -fipa-modref
9715
9716 inline-only-static
9717 Only enable inlining of static functions. As a result, when
9718 patching a static function, all its callers are impacted and so
9719 need to be patched as well.
9720
9721 In addition to all the flags that -flive-patching=inline-clone
9722 disables, -flive-patching=inline-only-static disables the
9723 following additional optimization flags: -fipa-cp-clone
9724 -fipa-sra -fpartial-inlining -fipa-cp
9725
9726 When -flive-patching is specified without any value, the default
9727 value is inline-clone.
9728
9729 This flag is disabled by default.
9730
9731 Note that -flive-patching is not supported with link-time
9732 optimization (-flto).
9733
9734 -fisolate-erroneous-paths-dereference
9735 Detect paths that trigger erroneous or undefined behavior due to
9736 dereferencing a null pointer. Isolate those paths from the main
9737 control flow and turn the statement with erroneous or undefined
9738 behavior into a trap. This flag is enabled by default at -O2 and
9739 higher and depends on -fdelete-null-pointer-checks also being
9740 enabled.
9741
9742 -fisolate-erroneous-paths-attribute
9743 Detect paths that trigger erroneous or undefined behavior due to a
9744 null value being used in a way forbidden by a "returns_nonnull" or
9745 "nonnull" attribute. Isolate those paths from the main control
9746 flow and turn the statement with erroneous or undefined behavior
9747 into a trap. This is not currently enabled, but may be enabled by
9748 -O2 in the future.
9749
9750 -ftree-sink
9751 Perform forward store motion on trees. This flag is enabled by
9752 default at -O1 and higher.
9753
9754 -ftree-bit-ccp
9755 Perform sparse conditional bit constant propagation on trees and
9756 propagate pointer alignment information. This pass only operates
9757 on local scalar variables and is enabled by default at -O1 and
9758 higher, except for -Og. It requires that -ftree-ccp is enabled.
9759
9760 -ftree-ccp
9761 Perform sparse conditional constant propagation (CCP) on trees.
9762 This pass only operates on local scalar variables and is enabled by
9763 default at -O1 and higher.
9764
9765 -fssa-backprop
9766 Propagate information about uses of a value up the definition chain
9767 in order to simplify the definitions. For example, this pass
9768 strips sign operations if the sign of a value never matters. The
9769 flag is enabled by default at -O1 and higher.
9770
9771 -fssa-phiopt
9772 Perform pattern matching on SSA PHI nodes to optimize conditional
9773 code. This pass is enabled by default at -O1 and higher, except
9774 for -Og.
9775
9776 -ftree-switch-conversion
9777 Perform conversion of simple initializations in a switch to
9778 initializations from a scalar array. This flag is enabled by
9779 default at -O2 and higher.
9780
9781 -ftree-tail-merge
9782 Look for identical code sequences. When found, replace one with a
9783 jump to the other. This optimization is known as tail merging or
9784 cross jumping. This flag is enabled by default at -O2 and higher.
9785 The compilation time in this pass can be limited using max-tail-
9786 merge-comparisons parameter and max-tail-merge-iterations
9787 parameter.
9788
9789 -ftree-dce
9790 Perform dead code elimination (DCE) on trees. This flag is enabled
9791 by default at -O1 and higher.
9792
9793 -ftree-builtin-call-dce
9794 Perform conditional dead code elimination (DCE) for calls to built-
9795 in functions that may set "errno" but are otherwise free of side
9796 effects. This flag is enabled by default at -O2 and higher if -Os
9797 is not also specified.
9798
9799 -ffinite-loops
9800 Assume that a loop with an exit will eventually take the exit and
9801 not loop indefinitely. This allows the compiler to remove loops
9802 that otherwise have no side-effects, not considering eventual
9803 endless looping as such.
9804
9805 This option is enabled by default at -O2 for C++ with -std=c++11 or
9806 higher.
9807
9808 -ftree-dominator-opts
9809 Perform a variety of simple scalar cleanups (constant/copy
9810 propagation, redundancy elimination, range propagation and
9811 expression simplification) based on a dominator tree traversal.
9812 This also performs jump threading (to reduce jumps to jumps). This
9813 flag is enabled by default at -O1 and higher.
9814
9815 -ftree-dse
9816 Perform dead store elimination (DSE) on trees. A dead store is a
9817 store into a memory location that is later overwritten by another
9818 store without any intervening loads. In this case the earlier
9819 store can be deleted. This flag is enabled by default at -O1 and
9820 higher.
9821
9822 -ftree-ch
9823 Perform loop header copying on trees. This is beneficial since it
9824 increases effectiveness of code motion optimizations. It also
9825 saves one jump. This flag is enabled by default at -O1 and higher.
9826 It is not enabled for -Os, since it usually increases code size.
9827
9828 -ftree-loop-optimize
9829 Perform loop optimizations on trees. This flag is enabled by
9830 default at -O1 and higher.
9831
9832 -ftree-loop-linear
9833 -floop-strip-mine
9834 -floop-block
9835 Perform loop nest optimizations. Same as -floop-nest-optimize. To
9836 use this code transformation, GCC has to be configured with
9837 --with-isl to enable the Graphite loop transformation
9838 infrastructure.
9839
9840 -fgraphite-identity
9841 Enable the identity transformation for graphite. For every SCoP we
9842 generate the polyhedral representation and transform it back to
9843 gimple. Using -fgraphite-identity we can check the costs or
9844 benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation. Some
9845 minimal optimizations are also performed by the code generator isl,
9846 like index splitting and dead code elimination in loops.
9847
9848 -floop-nest-optimize
9849 Enable the isl based loop nest optimizer. This is a generic loop
9850 nest optimizer based on the Pluto optimization algorithms. It
9851 calculates a loop structure optimized for data-locality and
9852 parallelism. This option is experimental.
9853
9854 -floop-parallelize-all
9855 Use the Graphite data dependence analysis to identify loops that
9856 can be parallelized. Parallelize all the loops that can be
9857 analyzed to not contain loop carried dependences without checking
9858 that it is profitable to parallelize the loops.
9859
9860 -ftree-coalesce-vars
9861 While transforming the program out of the SSA representation,
9862 attempt to reduce copying by coalescing versions of different user-
9863 defined variables, instead of just compiler temporaries. This may
9864 severely limit the ability to debug an optimized program compiled
9865 with -fno-var-tracking-assignments. In the negated form, this flag
9866 prevents SSA coalescing of user variables. This option is enabled
9867 by default if optimization is enabled, and it does very little
9868 otherwise.
9869
9870 -ftree-loop-if-convert
9871 Attempt to transform conditional jumps in the innermost loops to
9872 branch-less equivalents. The intent is to remove control-flow from
9873 the innermost loops in order to improve the ability of the
9874 vectorization pass to handle these loops. This is enabled by
9875 default if vectorization is enabled.
9876
9877 -ftree-loop-distribution
9878 Perform loop distribution. This flag can improve cache performance
9879 on big loop bodies and allow further loop optimizations, like
9880 parallelization or vectorization, to take place. For example, the
9881 loop
9882
9883 DO I = 1, N
9884 A(I) = B(I) + C
9885 D(I) = E(I) * F
9886 ENDDO
9887
9888 is transformed to
9889
9890 DO I = 1, N
9891 A(I) = B(I) + C
9892 ENDDO
9893 DO I = 1, N
9894 D(I) = E(I) * F
9895 ENDDO
9896
9897 This flag is enabled by default at -O3. It is also enabled by
9898 -fprofile-use and -fauto-profile.
9899
9900 -ftree-loop-distribute-patterns
9901 Perform loop distribution of patterns that can be code generated
9902 with calls to a library. This flag is enabled by default at -O2
9903 and higher, and by -fprofile-use and -fauto-profile.
9904
9905 This pass distributes the initialization loops and generates a call
9906 to memset zero. For example, the loop
9907
9908 DO I = 1, N
9909 A(I) = 0
9910 B(I) = A(I) + I
9911 ENDDO
9912
9913 is transformed to
9914
9915 DO I = 1, N
9916 A(I) = 0
9917 ENDDO
9918 DO I = 1, N
9919 B(I) = A(I) + I
9920 ENDDO
9921
9922 and the initialization loop is transformed into a call to memset
9923 zero. This flag is enabled by default at -O3. It is also enabled
9924 by -fprofile-use and -fauto-profile.
9925
9926 -floop-interchange
9927 Perform loop interchange outside of graphite. This flag can
9928 improve cache performance on loop nest and allow further loop
9929 optimizations, like vectorization, to take place. For example, the
9930 loop
9931
9932 for (int i = 0; i < N; i++)
9933 for (int j = 0; j < N; j++)
9934 for (int k = 0; k < N; k++)
9935 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9936
9937 is transformed to
9938
9939 for (int i = 0; i < N; i++)
9940 for (int k = 0; k < N; k++)
9941 for (int j = 0; j < N; j++)
9942 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9943
9944 This flag is enabled by default at -O3. It is also enabled by
9945 -fprofile-use and -fauto-profile.
9946
9947 -floop-unroll-and-jam
9948 Apply unroll and jam transformations on feasible loops. In a loop
9949 nest this unrolls the outer loop by some factor and fuses the
9950 resulting multiple inner loops. This flag is enabled by default at
9951 -O3. It is also enabled by -fprofile-use and -fauto-profile.
9952
9953 -ftree-loop-im
9954 Perform loop invariant motion on trees. This pass moves only
9955 invariants that are hard to handle at RTL level (function calls,
9956 operations that expand to nontrivial sequences of insns). With
9957 -funswitch-loops it also moves operands of conditions that are
9958 invariant out of the loop, so that we can use just trivial
9959 invariantness analysis in loop unswitching. The pass also includes
9960 store motion.
9961
9962 -ftree-loop-ivcanon
9963 Create a canonical counter for number of iterations in loops for
9964 which determining number of iterations requires complicated
9965 analysis. Later optimizations then may determine the number
9966 easily. Useful especially in connection with unrolling.
9967
9968 -ftree-scev-cprop
9969 Perform final value replacement. If a variable is modified in a
9970 loop in such a way that its value when exiting the loop can be
9971 determined using only its initial value and the number of loop
9972 iterations, replace uses of the final value by such a computation,
9973 provided it is sufficiently cheap. This reduces data dependencies
9974 and may allow further simplifications. Enabled by default at -O1
9975 and higher.
9976
9977 -fivopts
9978 Perform induction variable optimizations (strength reduction,
9979 induction variable merging and induction variable elimination) on
9980 trees.
9981
9982 -ftree-parallelize-loops=n
9983 Parallelize loops, i.e., split their iteration space to run in n
9984 threads. This is only possible for loops whose iterations are
9985 independent and can be arbitrarily reordered. The optimization is
9986 only profitable on multiprocessor machines, for loops that are CPU-
9987 intensive, rather than constrained e.g. by memory bandwidth. This
9988 option implies -pthread, and thus is only supported on targets that
9989 have support for -pthread.
9990
9991 -ftree-pta
9992 Perform function-local points-to analysis on trees. This flag is
9993 enabled by default at -O1 and higher, except for -Og.
9994
9995 -ftree-sra
9996 Perform scalar replacement of aggregates. This pass replaces
9997 structure references with scalars to prevent committing structures
9998 to memory too early. This flag is enabled by default at -O1 and
9999 higher, except for -Og.
10000
10001 -fstore-merging
10002 Perform merging of narrow stores to consecutive memory addresses.
10003 This pass merges contiguous stores of immediate values narrower
10004 than a word into fewer wider stores to reduce the number of
10005 instructions. This is enabled by default at -O2 and higher as well
10006 as -Os.
10007
10008 -ftree-ter
10009 Perform temporary expression replacement during the SSA->normal
10010 phase. Single use/single def temporaries are replaced at their use
10011 location with their defining expression. This results in non-
10012 GIMPLE code, but gives the expanders much more complex trees to
10013 work on resulting in better RTL generation. This is enabled by
10014 default at -O1 and higher.
10015
10016 -ftree-slsr
10017 Perform straight-line strength reduction on trees. This recognizes
10018 related expressions involving multiplications and replaces them by
10019 less expensive calculations when possible. This is enabled by
10020 default at -O1 and higher.
10021
10022 -ftree-vectorize
10023 Perform vectorization on trees. This flag enables
10024 -ftree-loop-vectorize and -ftree-slp-vectorize if not explicitly
10025 specified.
10026
10027 -ftree-loop-vectorize
10028 Perform loop vectorization on trees. This flag is enabled by
10029 default at -O2 and by -ftree-vectorize, -fprofile-use, and
10030 -fauto-profile.
10031
10032 -ftree-slp-vectorize
10033 Perform basic block vectorization on trees. This flag is enabled by
10034 default at -O2 and by -ftree-vectorize, -fprofile-use, and
10035 -fauto-profile.
10036
10037 -ftrivial-auto-var-init=choice
10038 Initialize automatic variables with either a pattern or with zeroes
10039 to increase the security and predictability of a program by
10040 preventing uninitialized memory disclosure and use. GCC still
10041 considers an automatic variable that doesn't have an explicit
10042 initializer as uninitialized, -Wuninitialized and
10043 -Wanalyzer-use-of-uninitialized-value will still report warning
10044 messages on such automatic variables. With this option, GCC will
10045 also initialize any padding of automatic variables that have
10046 structure or union types to zeroes. However, the current
10047 implementation cannot initialize automatic variables that are
10048 declared between the controlling expression and the first case of a
10049 "switch" statement. Using -Wtrivial-auto-var-init to report all
10050 such cases.
10051
10052 The three values of choice are:
10053
10054 * uninitialized doesn't initialize any automatic variables. This
10055 is C and C++'s default.
10056
10057 * pattern Initialize automatic variables with values which will
10058 likely transform logic bugs into crashes down the line, are
10059 easily recognized in a crash dump and without being values that
10060 programmers can rely on for useful program semantics. The
10061 current value is byte-repeatable pattern with byte "0xFE". The
10062 values used for pattern initialization might be changed in the
10063 future.
10064
10065 * zero Initialize automatic variables with zeroes.
10066
10067 The default is uninitialized.
10068
10069 You can control this behavior for a specific variable by using the
10070 variable attribute "uninitialized".
10071
10072 -fvect-cost-model=model
10073 Alter the cost model used for vectorization. The model argument
10074 should be one of unlimited, dynamic, cheap or very-cheap. With the
10075 unlimited model the vectorized code-path is assumed to be
10076 profitable while with the dynamic model a runtime check guards the
10077 vectorized code-path to enable it only for iteration counts that
10078 will likely execute faster than when executing the original scalar
10079 loop. The cheap model disables vectorization of loops where doing
10080 so would be cost prohibitive for example due to required runtime
10081 checks for data dependence or alignment but otherwise is equal to
10082 the dynamic model. The very-cheap model only allows vectorization
10083 if the vector code would entirely replace the scalar code that is
10084 being vectorized. For example, if each iteration of a vectorized
10085 loop would only be able to handle exactly four iterations of the
10086 scalar loop, the very-cheap model would only allow vectorization if
10087 the scalar iteration count is known to be a multiple of four.
10088
10089 The default cost model depends on other optimization flags and is
10090 either dynamic or cheap.
10091
10092 -fsimd-cost-model=model
10093 Alter the cost model used for vectorization of loops marked with
10094 the OpenMP simd directive. The model argument should be one of
10095 unlimited, dynamic, cheap. All values of model have the same
10096 meaning as described in -fvect-cost-model and by default a cost
10097 model defined with -fvect-cost-model is used.
10098
10099 -ftree-vrp
10100 Perform Value Range Propagation on trees. This is similar to the
10101 constant propagation pass, but instead of values, ranges of values
10102 are propagated. This allows the optimizers to remove unnecessary
10103 range checks like array bound checks and null pointer checks. This
10104 is enabled by default at -O2 and higher. Null pointer check
10105 elimination is only done if -fdelete-null-pointer-checks is
10106 enabled.
10107
10108 -fsplit-paths
10109 Split paths leading to loop backedges. This can improve dead code
10110 elimination and common subexpression elimination. This is enabled
10111 by default at -O3 and above.
10112
10113 -fsplit-ivs-in-unroller
10114 Enables expression of values of induction variables in later
10115 iterations of the unrolled loop using the value in the first
10116 iteration. This breaks long dependency chains, thus improving
10117 efficiency of the scheduling passes.
10118
10119 A combination of -fweb and CSE is often sufficient to obtain the
10120 same effect. However, that is not reliable in cases where the loop
10121 body is more complicated than a single basic block. It also does
10122 not work at all on some architectures due to restrictions in the
10123 CSE pass.
10124
10125 This optimization is enabled by default.
10126
10127 -fvariable-expansion-in-unroller
10128 With this option, the compiler creates multiple copies of some
10129 local variables when unrolling a loop, which can result in superior
10130 code.
10131
10132 This optimization is enabled by default for PowerPC targets, but
10133 disabled by default otherwise.
10134
10135 -fpartial-inlining
10136 Inline parts of functions. This option has any effect only when
10137 inlining itself is turned on by the -finline-functions or
10138 -finline-small-functions options.
10139
10140 Enabled at levels -O2, -O3, -Os.
10141
10142 -fpredictive-commoning
10143 Perform predictive commoning optimization, i.e., reusing
10144 computations (especially memory loads and stores) performed in
10145 previous iterations of loops.
10146
10147 This option is enabled at level -O3. It is also enabled by
10148 -fprofile-use and -fauto-profile.
10149
10150 -fprefetch-loop-arrays
10151 If supported by the target machine, generate instructions to
10152 prefetch memory to improve the performance of loops that access
10153 large arrays.
10154
10155 This option may generate better or worse code; results are highly
10156 dependent on the structure of loops within the source code.
10157
10158 Disabled at level -Os.
10159
10160 -fno-printf-return-value
10161 Do not substitute constants for known return value of formatted
10162 output functions such as "sprintf", "snprintf", "vsprintf", and
10163 "vsnprintf" (but not "printf" of "fprintf"). This transformation
10164 allows GCC to optimize or even eliminate branches based on the
10165 known return value of these functions called with arguments that
10166 are either constant, or whose values are known to be in a range
10167 that makes determining the exact return value possible. For
10168 example, when -fprintf-return-value is in effect, both the branch
10169 and the body of the "if" statement (but not the call to "snprint")
10170 can be optimized away when "i" is a 32-bit or smaller integer
10171 because the return value is guaranteed to be at most 8.
10172
10173 char buf[9];
10174 if (snprintf (buf, "%08x", i) >= sizeof buf)
10175 ...
10176
10177 The -fprintf-return-value option relies on other optimizations and
10178 yields best results with -O2 and above. It works in tandem with
10179 the -Wformat-overflow and -Wformat-truncation options. The
10180 -fprintf-return-value option is enabled by default.
10181
10182 -fno-peephole
10183 -fno-peephole2
10184 Disable any machine-specific peephole optimizations. The
10185 difference between -fno-peephole and -fno-peephole2 is in how they
10186 are implemented in the compiler; some targets use one, some use the
10187 other, a few use both.
10188
10189 -fpeephole is enabled by default. -fpeephole2 enabled at levels
10190 -O2, -O3, -Os.
10191
10192 -fno-guess-branch-probability
10193 Do not guess branch probabilities using heuristics.
10194
10195 GCC uses heuristics to guess branch probabilities if they are not
10196 provided by profiling feedback (-fprofile-arcs). These heuristics
10197 are based on the control flow graph. If some branch probabilities
10198 are specified by "__builtin_expect", then the heuristics are used
10199 to guess branch probabilities for the rest of the control flow
10200 graph, taking the "__builtin_expect" info into account. The
10201 interactions between the heuristics and "__builtin_expect" can be
10202 complex, and in some cases, it may be useful to disable the
10203 heuristics so that the effects of "__builtin_expect" are easier to
10204 understand.
10205
10206 It is also possible to specify expected probability of the
10207 expression with "__builtin_expect_with_probability" built-in
10208 function.
10209
10210 The default is -fguess-branch-probability at levels -O, -O2, -O3,
10211 -Os.
10212
10213 -freorder-blocks
10214 Reorder basic blocks in the compiled function in order to reduce
10215 number of taken branches and improve code locality.
10216
10217 Enabled at levels -O1, -O2, -O3, -Os.
10218
10219 -freorder-blocks-algorithm=algorithm
10220 Use the specified algorithm for basic block reordering. The
10221 algorithm argument can be simple, which does not increase code size
10222 (except sometimes due to secondary effects like alignment), or stc,
10223 the "software trace cache" algorithm, which tries to put all often
10224 executed code together, minimizing the number of branches executed
10225 by making extra copies of code.
10226
10227 The default is simple at levels -O1, -Os, and stc at levels -O2,
10228 -O3.
10229
10230 -freorder-blocks-and-partition
10231 In addition to reordering basic blocks in the compiled function, in
10232 order to reduce number of taken branches, partitions hot and cold
10233 basic blocks into separate sections of the assembly and .o files,
10234 to improve paging and cache locality performance.
10235
10236 This optimization is automatically turned off in the presence of
10237 exception handling or unwind tables (on targets using
10238 setjump/longjump or target specific scheme), for linkonce sections,
10239 for functions with a user-defined section attribute and on any
10240 architecture that does not support named sections. When
10241 -fsplit-stack is used this option is not enabled by default (to
10242 avoid linker errors), but may be enabled explicitly (if using a
10243 working linker).
10244
10245 Enabled for x86 at levels -O2, -O3, -Os.
10246
10247 -freorder-functions
10248 Reorder functions in the object file in order to improve code
10249 locality. This is implemented by using special subsections
10250 ".text.hot" for most frequently executed functions and
10251 ".text.unlikely" for unlikely executed functions. Reordering is
10252 done by the linker so object file format must support named
10253 sections and linker must place them in a reasonable way.
10254
10255 This option isn't effective unless you either provide profile
10256 feedback (see -fprofile-arcs for details) or manually annotate
10257 functions with "hot" or "cold" attributes.
10258
10259 Enabled at levels -O2, -O3, -Os.
10260
10261 -fstrict-aliasing
10262 Allow the compiler to assume the strictest aliasing rules
10263 applicable to the language being compiled. For C (and C++), this
10264 activates optimizations based on the type of expressions. In
10265 particular, an object of one type is assumed never to reside at the
10266 same address as an object of a different type, unless the types are
10267 almost the same. For example, an "unsigned int" can alias an
10268 "int", but not a "void*" or a "double". A character type may alias
10269 any other type.
10270
10271 Pay special attention to code like this:
10272
10273 union a_union {
10274 int i;
10275 double d;
10276 };
10277
10278 int f() {
10279 union a_union t;
10280 t.d = 3.0;
10281 return t.i;
10282 }
10283
10284 The practice of reading from a different union member than the one
10285 most recently written to (called "type-punning") is common. Even
10286 with -fstrict-aliasing, type-punning is allowed, provided the
10287 memory is accessed through the union type. So, the code above
10288 works as expected. However, this code might not:
10289
10290 int f() {
10291 union a_union t;
10292 int* ip;
10293 t.d = 3.0;
10294 ip = &t.i;
10295 return *ip;
10296 }
10297
10298 Similarly, access by taking the address, casting the resulting
10299 pointer and dereferencing the result has undefined behavior, even
10300 if the cast uses a union type, e.g.:
10301
10302 int f() {
10303 double d = 3.0;
10304 return ((union a_union *) &d)->i;
10305 }
10306
10307 The -fstrict-aliasing option is enabled at levels -O2, -O3, -Os.
10308
10309 -fipa-strict-aliasing
10310 Controls whether rules of -fstrict-aliasing are applied across
10311 function boundaries. Note that if multiple functions gets inlined
10312 into a single function the memory accesses are no longer considered
10313 to be crossing a function boundary.
10314
10315 The -fipa-strict-aliasing option is enabled by default and is
10316 effective only in combination with -fstrict-aliasing.
10317
10318 -falign-functions
10319 -falign-functions=n
10320 -falign-functions=n:m
10321 -falign-functions=n:m:n2
10322 -falign-functions=n:m:n2:m2
10323 Align the start of functions to the next power-of-two greater than
10324 or equal to n, skipping up to m-1 bytes. This ensures that at
10325 least the first m bytes of the function can be fetched by the CPU
10326 without crossing an n-byte alignment boundary.
10327
10328 If m is not specified, it defaults to n.
10329
10330 Examples: -falign-functions=32 aligns functions to the next 32-byte
10331 boundary, -falign-functions=24 aligns to the next 32-byte boundary
10332 only if this can be done by skipping 23 bytes or less,
10333 -falign-functions=32:7 aligns to the next 32-byte boundary only if
10334 this can be done by skipping 6 bytes or less.
10335
10336 The second pair of n2:m2 values allows you to specify a secondary
10337 alignment: -falign-functions=64:7:32:3 aligns to the next 64-byte
10338 boundary if this can be done by skipping 6 bytes or less, otherwise
10339 aligns to the next 32-byte boundary if this can be done by skipping
10340 2 bytes or less. If m2 is not specified, it defaults to n2.
10341
10342 Some assemblers only support this flag when n is a power of two; in
10343 that case, it is rounded up.
10344
10345 -fno-align-functions and -falign-functions=1 are equivalent and
10346 mean that functions are not aligned.
10347
10348 If n is not specified or is zero, use a machine-dependent default.
10349 The maximum allowed n option value is 65536.
10350
10351 Enabled at levels -O2, -O3.
10352
10353 -flimit-function-alignment
10354 If this option is enabled, the compiler tries to avoid
10355 unnecessarily overaligning functions. It attempts to instruct the
10356 assembler to align by the amount specified by -falign-functions,
10357 but not to skip more bytes than the size of the function.
10358
10359 -falign-labels
10360 -falign-labels=n
10361 -falign-labels=n:m
10362 -falign-labels=n:m:n2
10363 -falign-labels=n:m:n2:m2
10364 Align all branch targets to a power-of-two boundary.
10365
10366 Parameters of this option are analogous to the -falign-functions
10367 option. -fno-align-labels and -falign-labels=1 are equivalent and
10368 mean that labels are not aligned.
10369
10370 If -falign-loops or -falign-jumps are applicable and are greater
10371 than this value, then their values are used instead.
10372
10373 If n is not specified or is zero, use a machine-dependent default
10374 which is very likely to be 1, meaning no alignment. The maximum
10375 allowed n option value is 65536.
10376
10377 Enabled at levels -O2, -O3.
10378
10379 -falign-loops
10380 -falign-loops=n
10381 -falign-loops=n:m
10382 -falign-loops=n:m:n2
10383 -falign-loops=n:m:n2:m2
10384 Align loops to a power-of-two boundary. If the loops are executed
10385 many times, this makes up for any execution of the dummy padding
10386 instructions.
10387
10388 If -falign-labels is greater than this value, then its value is
10389 used instead.
10390
10391 Parameters of this option are analogous to the -falign-functions
10392 option. -fno-align-loops and -falign-loops=1 are equivalent and
10393 mean that loops are not aligned. The maximum allowed n option
10394 value is 65536.
10395
10396 If n is not specified or is zero, use a machine-dependent default.
10397
10398 Enabled at levels -O2, -O3.
10399
10400 -falign-jumps
10401 -falign-jumps=n
10402 -falign-jumps=n:m
10403 -falign-jumps=n:m:n2
10404 -falign-jumps=n:m:n2:m2
10405 Align branch targets to a power-of-two boundary, for branch targets
10406 where the targets can only be reached by jumping. In this case, no
10407 dummy operations need be executed.
10408
10409 If -falign-labels is greater than this value, then its value is
10410 used instead.
10411
10412 Parameters of this option are analogous to the -falign-functions
10413 option. -fno-align-jumps and -falign-jumps=1 are equivalent and
10414 mean that loops are not aligned.
10415
10416 If n is not specified or is zero, use a machine-dependent default.
10417 The maximum allowed n option value is 65536.
10418
10419 Enabled at levels -O2, -O3.
10420
10421 -fno-allocation-dce
10422 Do not remove unused C++ allocations in dead code elimination.
10423
10424 -fallow-store-data-races
10425 Allow the compiler to perform optimizations that may introduce new
10426 data races on stores, without proving that the variable cannot be
10427 concurrently accessed by other threads. Does not affect
10428 optimization of local data. It is safe to use this option if it is
10429 known that global data will not be accessed by multiple threads.
10430
10431 Examples of optimizations enabled by -fallow-store-data-races
10432 include hoisting or if-conversions that may cause a value that was
10433 already in memory to be re-written with that same value. Such re-
10434 writing is safe in a single threaded context but may be unsafe in a
10435 multi-threaded context. Note that on some processors, if-
10436 conversions may be required in order to enable vectorization.
10437
10438 Enabled at level -Ofast.
10439
10440 -funit-at-a-time
10441 This option is left for compatibility reasons. -funit-at-a-time has
10442 no effect, while -fno-unit-at-a-time implies -fno-toplevel-reorder
10443 and -fno-section-anchors.
10444
10445 Enabled by default.
10446
10447 -fno-toplevel-reorder
10448 Do not reorder top-level functions, variables, and "asm"
10449 statements. Output them in the same order that they appear in the
10450 input file. When this option is used, unreferenced static
10451 variables are not removed. This option is intended to support
10452 existing code that relies on a particular ordering. For new code,
10453 it is better to use attributes when possible.
10454
10455 -ftoplevel-reorder is the default at -O1 and higher, and also at
10456 -O0 if -fsection-anchors is explicitly requested. Additionally
10457 -fno-toplevel-reorder implies -fno-section-anchors.
10458
10459 -fweb
10460 Constructs webs as commonly used for register allocation purposes
10461 and assign each web individual pseudo register. This allows the
10462 register allocation pass to operate on pseudos directly, but also
10463 strengthens several other optimization passes, such as CSE, loop
10464 optimizer and trivial dead code remover. It can, however, make
10465 debugging impossible, since variables no longer stay in a "home
10466 register".
10467
10468 Enabled by default with -funroll-loops.
10469
10470 -fwhole-program
10471 Assume that the current compilation unit represents the whole
10472 program being compiled. All public functions and variables with
10473 the exception of "main" and those merged by attribute
10474 "externally_visible" become static functions and in effect are
10475 optimized more aggressively by interprocedural optimizers.
10476
10477 This option should not be used in combination with -flto. Instead
10478 relying on a linker plugin should provide safer and more precise
10479 information.
10480
10481 -flto[=n]
10482 This option runs the standard link-time optimizer. When invoked
10483 with source code, it generates GIMPLE (one of GCC's internal
10484 representations) and writes it to special ELF sections in the
10485 object file. When the object files are linked together, all the
10486 function bodies are read from these ELF sections and instantiated
10487 as if they had been part of the same translation unit.
10488
10489 To use the link-time optimizer, -flto and optimization options
10490 should be specified at compile time and during the final link. It
10491 is recommended that you compile all the files participating in the
10492 same link with the same options and also specify those options at
10493 link time. For example:
10494
10495 gcc -c -O2 -flto foo.c
10496 gcc -c -O2 -flto bar.c
10497 gcc -o myprog -flto -O2 foo.o bar.o
10498
10499 The first two invocations to GCC save a bytecode representation of
10500 GIMPLE into special ELF sections inside foo.o and bar.o. The final
10501 invocation reads the GIMPLE bytecode from foo.o and bar.o, merges
10502 the two files into a single internal image, and compiles the result
10503 as usual. Since both foo.o and bar.o are merged into a single
10504 image, this causes all the interprocedural analyses and
10505 optimizations in GCC to work across the two files as if they were a
10506 single one. This means, for example, that the inliner is able to
10507 inline functions in bar.o into functions in foo.o and vice-versa.
10508
10509 Another (simpler) way to enable link-time optimization is:
10510
10511 gcc -o myprog -flto -O2 foo.c bar.c
10512
10513 The above generates bytecode for foo.c and bar.c, merges them
10514 together into a single GIMPLE representation and optimizes them as
10515 usual to produce myprog.
10516
10517 The important thing to keep in mind is that to enable link-time
10518 optimizations you need to use the GCC driver to perform the link
10519 step. GCC automatically performs link-time optimization if any of
10520 the objects involved were compiled with the -flto command-line
10521 option. You can always override the automatic decision to do link-
10522 time optimization by passing -fno-lto to the link command.
10523
10524 To make whole program optimization effective, it is necessary to
10525 make certain whole program assumptions. The compiler needs to know
10526 what functions and variables can be accessed by libraries and
10527 runtime outside of the link-time optimized unit. When supported by
10528 the linker, the linker plugin (see -fuse-linker-plugin) passes
10529 information to the compiler about used and externally visible
10530 symbols. When the linker plugin is not available, -fwhole-program
10531 should be used to allow the compiler to make these assumptions,
10532 which leads to more aggressive optimization decisions.
10533
10534 When a file is compiled with -flto without -fuse-linker-plugin, the
10535 generated object file is larger than a regular object file because
10536 it contains GIMPLE bytecodes and the usual final code (see
10537 -ffat-lto-objects). This means that object files with LTO
10538 information can be linked as normal object files; if -fno-lto is
10539 passed to the linker, no interprocedural optimizations are applied.
10540 Note that when -fno-fat-lto-objects is enabled the compile stage is
10541 faster but you cannot perform a regular, non-LTO link on them.
10542
10543 When producing the final binary, GCC only applies link-time
10544 optimizations to those files that contain bytecode. Therefore, you
10545 can mix and match object files and libraries with GIMPLE bytecodes
10546 and final object code. GCC automatically selects which files to
10547 optimize in LTO mode and which files to link without further
10548 processing.
10549
10550 Generally, options specified at link time override those specified
10551 at compile time, although in some cases GCC attempts to infer link-
10552 time options from the settings used to compile the input files.
10553
10554 If you do not specify an optimization level option -O at link time,
10555 then GCC uses the highest optimization level used when compiling
10556 the object files. Note that it is generally ineffective to specify
10557 an optimization level option only at link time and not at compile
10558 time, for two reasons. First, compiling without optimization
10559 suppresses compiler passes that gather information needed for
10560 effective optimization at link time. Second, some early
10561 optimization passes can be performed only at compile time and not
10562 at link time.
10563
10564 There are some code generation flags preserved by GCC when
10565 generating bytecodes, as they need to be used during the final
10566 link. Currently, the following options and their settings are
10567 taken from the first object file that explicitly specifies them:
10568 -fcommon, -fexceptions, -fnon-call-exceptions, -fgnu-tm and all the
10569 -m target flags.
10570
10571 The following options -fPIC, -fpic, -fpie and -fPIE are combined
10572 based on the following scheme:
10573
10574 B<-fPIC> + B<-fpic> = B<-fpic>
10575 B<-fPIC> + B<-fno-pic> = B<-fno-pic>
10576 B<-fpic/-fPIC> + (no option) = (no option)
10577 B<-fPIC> + B<-fPIE> = B<-fPIE>
10578 B<-fpic> + B<-fPIE> = B<-fpie>
10579 B<-fPIC/-fpic> + B<-fpie> = B<-fpie>
10580
10581 Certain ABI-changing flags are required to match in all compilation
10582 units, and trying to override this at link time with a conflicting
10583 value is ignored. This includes options such as
10584 -freg-struct-return and -fpcc-struct-return.
10585
10586 Other options such as -ffp-contract, -fno-strict-overflow, -fwrapv,
10587 -fno-trapv or -fno-strict-aliasing are passed through to the link
10588 stage and merged conservatively for conflicting translation units.
10589 Specifically -fno-strict-overflow, -fwrapv and -fno-trapv take
10590 precedence; and for example -ffp-contract=off takes precedence over
10591 -ffp-contract=fast. You can override them at link time.
10592
10593 Diagnostic options such as -Wstringop-overflow are passed through
10594 to the link stage and their setting matches that of the compile-
10595 step at function granularity. Note that this matters only for
10596 diagnostics emitted during optimization. Note that code transforms
10597 such as inlining can lead to warnings being enabled or disabled for
10598 regions if code not consistent with the setting at compile time.
10599
10600 When you need to pass options to the assembler via -Wa or
10601 -Xassembler make sure to either compile such translation units with
10602 -fno-lto or consistently use the same assembler options on all
10603 translation units. You can alternatively also specify assembler
10604 options at LTO link time.
10605
10606 To enable debug info generation you need to supply -g at compile
10607 time. If any of the input files at link time were built with debug
10608 info generation enabled the link will enable debug info generation
10609 as well. Any elaborate debug info settings like the dwarf level
10610 -gdwarf-5 need to be explicitly repeated at the linker command line
10611 and mixing different settings in different translation units is
10612 discouraged.
10613
10614 If LTO encounters objects with C linkage declared with incompatible
10615 types in separate translation units to be linked together
10616 (undefined behavior according to ISO C99 6.2.7), a non-fatal
10617 diagnostic may be issued. The behavior is still undefined at run
10618 time. Similar diagnostics may be raised for other languages.
10619
10620 Another feature of LTO is that it is possible to apply
10621 interprocedural optimizations on files written in different
10622 languages:
10623
10624 gcc -c -flto foo.c
10625 g++ -c -flto bar.cc
10626 gfortran -c -flto baz.f90
10627 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10628
10629 Notice that the final link is done with g++ to get the C++ runtime
10630 libraries and -lgfortran is added to get the Fortran runtime
10631 libraries. In general, when mixing languages in LTO mode, you
10632 should use the same link command options as when mixing languages
10633 in a regular (non-LTO) compilation.
10634
10635 If object files containing GIMPLE bytecode are stored in a library
10636 archive, say libfoo.a, it is possible to extract and use them in an
10637 LTO link if you are using a linker with plugin support. To create
10638 static libraries suitable for LTO, use gcc-ar and gcc-ranlib
10639 instead of ar and ranlib; to show the symbols of object files with
10640 GIMPLE bytecode, use gcc-nm. Those commands require that ar,
10641 ranlib and nm have been compiled with plugin support. At link
10642 time, use the flag -fuse-linker-plugin to ensure that the library
10643 participates in the LTO optimization process:
10644
10645 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10646
10647 With the linker plugin enabled, the linker extracts the needed
10648 GIMPLE files from libfoo.a and passes them on to the running GCC to
10649 make them part of the aggregated GIMPLE image to be optimized.
10650
10651 If you are not using a linker with plugin support and/or do not
10652 enable the linker plugin, then the objects inside libfoo.a are
10653 extracted and linked as usual, but they do not participate in the
10654 LTO optimization process. In order to make a static library
10655 suitable for both LTO optimization and usual linkage, compile its
10656 object files with -flto -ffat-lto-objects.
10657
10658 Link-time optimizations do not require the presence of the whole
10659 program to operate. If the program does not require any symbols to
10660 be exported, it is possible to combine -flto and -fwhole-program to
10661 allow the interprocedural optimizers to use more aggressive
10662 assumptions which may lead to improved optimization opportunities.
10663 Use of -fwhole-program is not needed when linker plugin is active
10664 (see -fuse-linker-plugin).
10665
10666 The current implementation of LTO makes no attempt to generate
10667 bytecode that is portable between different types of hosts. The
10668 bytecode files are versioned and there is a strict version check,
10669 so bytecode files generated in one version of GCC do not work with
10670 an older or newer version of GCC.
10671
10672 Link-time optimization does not work well with generation of
10673 debugging information on systems other than those using a
10674 combination of ELF and DWARF.
10675
10676 If you specify the optional n, the optimization and code generation
10677 done at link time is executed in parallel using n parallel jobs by
10678 utilizing an installed make program. The environment variable MAKE
10679 may be used to override the program used.
10680
10681 You can also specify -flto=jobserver to use GNU make's job server
10682 mode to determine the number of parallel jobs. This is useful when
10683 the Makefile calling GCC is already executing in parallel. You
10684 must prepend a + to the command recipe in the parent Makefile for
10685 this to work. This option likely only works if MAKE is GNU make.
10686 Even without the option value, GCC tries to automatically detect a
10687 running GNU make's job server.
10688
10689 Use -flto=auto to use GNU make's job server, if available, or
10690 otherwise fall back to autodetection of the number of CPU threads
10691 present in your system.
10692
10693 -flto-partition=alg
10694 Specify the partitioning algorithm used by the link-time optimizer.
10695 The value is either 1to1 to specify a partitioning mirroring the
10696 original source files or balanced to specify partitioning into
10697 equally sized chunks (whenever possible) or max to create new
10698 partition for every symbol where possible. Specifying none as an
10699 algorithm disables partitioning and streaming completely. The
10700 default value is balanced. While 1to1 can be used as an workaround
10701 for various code ordering issues, the max partitioning is intended
10702 for internal testing only. The value one specifies that exactly
10703 one partition should be used while the value none bypasses
10704 partitioning and executes the link-time optimization step directly
10705 from the WPA phase.
10706
10707 -flto-compression-level=n
10708 This option specifies the level of compression used for
10709 intermediate language written to LTO object files, and is only
10710 meaningful in conjunction with LTO mode (-flto). GCC currently
10711 supports two LTO compression algorithms. For zstd, valid values are
10712 0 (no compression) to 19 (maximum compression), while zlib supports
10713 values from 0 to 9. Values outside this range are clamped to
10714 either minimum or maximum of the supported values. If the option
10715 is not given, a default balanced compression setting is used.
10716
10717 -fuse-linker-plugin
10718 Enables the use of a linker plugin during link-time optimization.
10719 This option relies on plugin support in the linker, which is
10720 available in gold or in GNU ld 2.21 or newer.
10721
10722 This option enables the extraction of object files with GIMPLE
10723 bytecode out of library archives. This improves the quality of
10724 optimization by exposing more code to the link-time optimizer.
10725 This information specifies what symbols can be accessed externally
10726 (by non-LTO object or during dynamic linking). Resulting code
10727 quality improvements on binaries (and shared libraries that use
10728 hidden visibility) are similar to -fwhole-program. See -flto for a
10729 description of the effect of this flag and how to use it.
10730
10731 This option is enabled by default when LTO support in GCC is
10732 enabled and GCC was configured for use with a linker supporting
10733 plugins (GNU ld 2.21 or newer or gold).
10734
10735 -ffat-lto-objects
10736 Fat LTO objects are object files that contain both the intermediate
10737 language and the object code. This makes them usable for both LTO
10738 linking and normal linking. This option is effective only when
10739 compiling with -flto and is ignored at link time.
10740
10741 -fno-fat-lto-objects improves compilation time over plain LTO, but
10742 requires the complete toolchain to be aware of LTO. It requires a
10743 linker with linker plugin support for basic functionality.
10744 Additionally, nm, ar and ranlib need to support linker plugins to
10745 allow a full-featured build environment (capable of building static
10746 libraries etc). GCC provides the gcc-ar, gcc-nm, gcc-ranlib
10747 wrappers to pass the right options to these tools. With non fat LTO
10748 makefiles need to be modified to use them.
10749
10750 Note that modern binutils provide plugin auto-load mechanism.
10751 Installing the linker plugin into $libdir/bfd-plugins has the same
10752 effect as usage of the command wrappers (gcc-ar, gcc-nm and gcc-
10753 ranlib).
10754
10755 The default is -fno-fat-lto-objects on targets with linker plugin
10756 support.
10757
10758 -fcompare-elim
10759 After register allocation and post-register allocation instruction
10760 splitting, identify arithmetic instructions that compute processor
10761 flags similar to a comparison operation based on that arithmetic.
10762 If possible, eliminate the explicit comparison operation.
10763
10764 This pass only applies to certain targets that cannot explicitly
10765 represent the comparison operation before register allocation is
10766 complete.
10767
10768 Enabled at levels -O1, -O2, -O3, -Os.
10769
10770 -fcprop-registers
10771 After register allocation and post-register allocation instruction
10772 splitting, perform a copy-propagation pass to try to reduce
10773 scheduling dependencies and occasionally eliminate the copy.
10774
10775 Enabled at levels -O1, -O2, -O3, -Os.
10776
10777 -fprofile-correction
10778 Profiles collected using an instrumented binary for multi-threaded
10779 programs may be inconsistent due to missed counter updates. When
10780 this option is specified, GCC uses heuristics to correct or smooth
10781 out such inconsistencies. By default, GCC emits an error message
10782 when an inconsistent profile is detected.
10783
10784 This option is enabled by -fauto-profile.
10785
10786 -fprofile-partial-training
10787 With "-fprofile-use" all portions of programs not executed during
10788 train run are optimized agressively for size rather than speed. In
10789 some cases it is not practical to train all possible hot paths in
10790 the program. (For example, program may contain functions specific
10791 for a given hardware and trianing may not cover all hardware
10792 configurations program is run on.) With
10793 "-fprofile-partial-training" profile feedback will be ignored for
10794 all functions not executed during the train run leading them to be
10795 optimized as if they were compiled without profile feedback. This
10796 leads to better performance when train run is not representative
10797 but also leads to significantly bigger code.
10798
10799 -fprofile-use
10800 -fprofile-use=path
10801 Enable profile feedback-directed optimizations, and the following
10802 optimizations, many of which are generally profitable only with
10803 profile feedback available:
10804
10805 -fbranch-probabilities -fprofile-values -funroll-loops
10806 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
10807 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
10808 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
10809 -ftree-slp-vectorize -fvect-cost-model=dynamic
10810 -ftree-loop-distribute-patterns -fprofile-reorder-functions
10811
10812 Before you can use this option, you must first generate profiling
10813 information.
10814
10815 By default, GCC emits an error message if the feedback profiles do
10816 not match the source code. This error can be turned into a warning
10817 by using -Wno-error=coverage-mismatch. Note this may result in
10818 poorly optimized code. Additionally, by default, GCC also emits a
10819 warning message if the feedback profiles do not exist (see
10820 -Wmissing-profile).
10821
10822 If path is specified, GCC looks at the path to find the profile
10823 feedback data files. See -fprofile-dir.
10824
10825 -fauto-profile
10826 -fauto-profile=path
10827 Enable sampling-based feedback-directed optimizations, and the
10828 following optimizations, many of which are generally profitable
10829 only with profile feedback available:
10830
10831 -fbranch-probabilities -fprofile-values -funroll-loops
10832 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
10833 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
10834 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
10835 -ftree-slp-vectorize -fvect-cost-model=dynamic
10836 -ftree-loop-distribute-patterns -fprofile-correction
10837
10838 path is the name of a file containing AutoFDO profile information.
10839 If omitted, it defaults to fbdata.afdo in the current directory.
10840
10841 Producing an AutoFDO profile data file requires running your
10842 program with the perf utility on a supported GNU/Linux target
10843 system. For more information, see <https://perf.wiki.kernel.org/>.
10844
10845 E.g.
10846
10847 perf record -e br_inst_retired:near_taken -b -o perf.data \
10848 -- your_program
10849
10850 Then use the create_gcov tool to convert the raw profile data to a
10851 format that can be used by GCC. You must also supply the
10852 unstripped binary for your program to this tool. See
10853 <https://github.com/google/autofdo>.
10854
10855 E.g.
10856
10857 create_gcov --binary=your_program.unstripped --profile=perf.data \
10858 --gcov=profile.afdo
10859
10860 The following options control compiler behavior regarding floating-
10861 point arithmetic. These options trade off between speed and
10862 correctness. All must be specifically enabled.
10863
10864 -ffloat-store
10865 Do not store floating-point variables in registers, and inhibit
10866 other options that might change whether a floating-point value is
10867 taken from a register or memory.
10868
10869 This option prevents undesirable excess precision on machines such
10870 as the 68000 where the floating registers (of the 68881) keep more
10871 precision than a "double" is supposed to have. Similarly for the
10872 x86 architecture. For most programs, the excess precision does
10873 only good, but a few programs rely on the precise definition of
10874 IEEE floating point. Use -ffloat-store for such programs, after
10875 modifying them to store all pertinent intermediate computations
10876 into variables.
10877
10878 -fexcess-precision=style
10879 This option allows further control over excess precision on
10880 machines where floating-point operations occur in a format with
10881 more precision or range than the IEEE standard and interchange
10882 floating-point types. By default, -fexcess-precision=fast is in
10883 effect; this means that operations may be carried out in a wider
10884 precision than the types specified in the source if that would
10885 result in faster code, and it is unpredictable when rounding to the
10886 types specified in the source code takes place. When compiling C,
10887 if -fexcess-precision=standard is specified then excess precision
10888 follows the rules specified in ISO C99; in particular, both casts
10889 and assignments cause values to be rounded to their semantic types
10890 (whereas -ffloat-store only affects assignments). This option is
10891 enabled by default for C if a strict conformance option such as
10892 -std=c99 is used. -ffast-math enables -fexcess-precision=fast by
10893 default regardless of whether a strict conformance option is used.
10894
10895 -fexcess-precision=standard is not implemented for languages other
10896 than C. On the x86, it has no effect if -mfpmath=sse or
10897 -mfpmath=sse+387 is specified; in the former case, IEEE semantics
10898 apply without excess precision, and in the latter, rounding is
10899 unpredictable.
10900
10901 -ffast-math
10902 Sets the options -fno-math-errno, -funsafe-math-optimizations,
10903 -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans,
10904 -fcx-limited-range and -fexcess-precision=fast.
10905
10906 This option causes the preprocessor macro "__FAST_MATH__" to be
10907 defined.
10908
10909 This option is not turned on by any -O option besides -Ofast since
10910 it can result in incorrect output for programs that depend on an
10911 exact implementation of IEEE or ISO rules/specifications for math
10912 functions. It may, however, yield faster code for programs that do
10913 not require the guarantees of these specifications.
10914
10915 -fno-math-errno
10916 Do not set "errno" after calling math functions that are executed
10917 with a single instruction, e.g., "sqrt". A program that relies on
10918 IEEE exceptions for math error handling may want to use this flag
10919 for speed while maintaining IEEE arithmetic compatibility.
10920
10921 This option is not turned on by any -O option since it can result
10922 in incorrect output for programs that depend on an exact
10923 implementation of IEEE or ISO rules/specifications for math
10924 functions. It may, however, yield faster code for programs that do
10925 not require the guarantees of these specifications.
10926
10927 The default is -fmath-errno.
10928
10929 On Darwin systems, the math library never sets "errno". There is
10930 therefore no reason for the compiler to consider the possibility
10931 that it might, and -fno-math-errno is the default.
10932
10933 -funsafe-math-optimizations
10934 Allow optimizations for floating-point arithmetic that (a) assume
10935 that arguments and results are valid and (b) may violate IEEE or
10936 ANSI standards. When used at link time, it may include libraries
10937 or startup files that change the default FPU control word or other
10938 similar optimizations.
10939
10940 This option is not turned on by any -O option since it can result
10941 in incorrect output for programs that depend on an exact
10942 implementation of IEEE or ISO rules/specifications for math
10943 functions. It may, however, yield faster code for programs that do
10944 not require the guarantees of these specifications. Enables
10945 -fno-signed-zeros, -fno-trapping-math, -fassociative-math and
10946 -freciprocal-math.
10947
10948 The default is -fno-unsafe-math-optimizations.
10949
10950 -fassociative-math
10951 Allow re-association of operands in series of floating-point
10952 operations. This violates the ISO C and C++ language standard by
10953 possibly changing computation result. NOTE: re-ordering may change
10954 the sign of zero as well as ignore NaNs and inhibit or create
10955 underflow or overflow (and thus cannot be used on code that relies
10956 on rounding behavior like "(x + 2**52) - 2**52". May also reorder
10957 floating-point comparisons and thus may not be used when ordered
10958 comparisons are required. This option requires that both
10959 -fno-signed-zeros and -fno-trapping-math be in effect. Moreover,
10960 it doesn't make much sense with -frounding-math. For Fortran the
10961 option is automatically enabled when both -fno-signed-zeros and
10962 -fno-trapping-math are in effect.
10963
10964 The default is -fno-associative-math.
10965
10966 -freciprocal-math
10967 Allow the reciprocal of a value to be used instead of dividing by
10968 the value if this enables optimizations. For example "x / y" can
10969 be replaced with "x * (1/y)", which is useful if "(1/y)" is subject
10970 to common subexpression elimination. Note that this loses
10971 precision and increases the number of flops operating on the value.
10972
10973 The default is -fno-reciprocal-math.
10974
10975 -ffinite-math-only
10976 Allow optimizations for floating-point arithmetic that assume that
10977 arguments and results are not NaNs or +-Infs.
10978
10979 This option is not turned on by any -O option since it can result
10980 in incorrect output for programs that depend on an exact
10981 implementation of IEEE or ISO rules/specifications for math
10982 functions. It may, however, yield faster code for programs that do
10983 not require the guarantees of these specifications.
10984
10985 The default is -fno-finite-math-only.
10986
10987 -fno-signed-zeros
10988 Allow optimizations for floating-point arithmetic that ignore the
10989 signedness of zero. IEEE arithmetic specifies the behavior of
10990 distinct +0.0 and -0.0 values, which then prohibits simplification
10991 of expressions such as x+0.0 or 0.0*x (even with
10992 -ffinite-math-only). This option implies that the sign of a zero
10993 result isn't significant.
10994
10995 The default is -fsigned-zeros.
10996
10997 -fno-trapping-math
10998 Compile code assuming that floating-point operations cannot
10999 generate user-visible traps. These traps include division by zero,
11000 overflow, underflow, inexact result and invalid operation. This
11001 option requires that -fno-signaling-nans be in effect. Setting
11002 this option may allow faster code if one relies on "non-stop" IEEE
11003 arithmetic, for example.
11004
11005 This option should never be turned on by any -O option since it can
11006 result in incorrect output for programs that depend on an exact
11007 implementation of IEEE or ISO rules/specifications for math
11008 functions.
11009
11010 The default is -ftrapping-math.
11011
11012 -frounding-math
11013 Disable transformations and optimizations that assume default
11014 floating-point rounding behavior. This is round-to-zero for all
11015 floating point to integer conversions, and round-to-nearest for all
11016 other arithmetic truncations. This option should be specified for
11017 programs that change the FP rounding mode dynamically, or that may
11018 be executed with a non-default rounding mode. This option disables
11019 constant folding of floating-point expressions at compile time
11020 (which may be affected by rounding mode) and arithmetic
11021 transformations that are unsafe in the presence of sign-dependent
11022 rounding modes.
11023
11024 The default is -fno-rounding-math.
11025
11026 This option is experimental and does not currently guarantee to
11027 disable all GCC optimizations that are affected by rounding mode.
11028 Future versions of GCC may provide finer control of this setting
11029 using C99's "FENV_ACCESS" pragma. This command-line option will be
11030 used to specify the default state for "FENV_ACCESS".
11031
11032 -fsignaling-nans
11033 Compile code assuming that IEEE signaling NaNs may generate user-
11034 visible traps during floating-point operations. Setting this
11035 option disables optimizations that may change the number of
11036 exceptions visible with signaling NaNs. This option implies
11037 -ftrapping-math.
11038
11039 This option causes the preprocessor macro "__SUPPORT_SNAN__" to be
11040 defined.
11041
11042 The default is -fno-signaling-nans.
11043
11044 This option is experimental and does not currently guarantee to
11045 disable all GCC optimizations that affect signaling NaN behavior.
11046
11047 -fno-fp-int-builtin-inexact
11048 Do not allow the built-in functions "ceil", "floor", "round" and
11049 "trunc", and their "float" and "long double" variants, to generate
11050 code that raises the "inexact" floating-point exception for
11051 noninteger arguments. ISO C99 and C11 allow these functions to
11052 raise the "inexact" exception, but ISO/IEC TS 18661-1:2014, the C
11053 bindings to IEEE 754-2008, as integrated into ISO C2X, does not
11054 allow these functions to do so.
11055
11056 The default is -ffp-int-builtin-inexact, allowing the exception to
11057 be raised, unless C2X or a later C standard is selected. This
11058 option does nothing unless -ftrapping-math is in effect.
11059
11060 Even if -fno-fp-int-builtin-inexact is used, if the functions
11061 generate a call to a library function then the "inexact" exception
11062 may be raised if the library implementation does not follow TS
11063 18661.
11064
11065 -fsingle-precision-constant
11066 Treat floating-point constants as single precision instead of
11067 implicitly converting them to double-precision constants.
11068
11069 -fcx-limited-range
11070 When enabled, this option states that a range reduction step is not
11071 needed when performing complex division. Also, there is no
11072 checking whether the result of a complex multiplication or division
11073 is "NaN + I*NaN", with an attempt to rescue the situation in that
11074 case. The default is -fno-cx-limited-range, but is enabled by
11075 -ffast-math.
11076
11077 This option controls the default setting of the ISO C99
11078 "CX_LIMITED_RANGE" pragma. Nevertheless, the option applies to all
11079 languages.
11080
11081 -fcx-fortran-rules
11082 Complex multiplication and division follow Fortran rules. Range
11083 reduction is done as part of complex division, but there is no
11084 checking whether the result of a complex multiplication or division
11085 is "NaN + I*NaN", with an attempt to rescue the situation in that
11086 case.
11087
11088 The default is -fno-cx-fortran-rules.
11089
11090 The following options control optimizations that may improve
11091 performance, but are not enabled by any -O options. This section
11092 includes experimental options that may produce broken code.
11093
11094 -fbranch-probabilities
11095 After running a program compiled with -fprofile-arcs, you can
11096 compile it a second time using -fbranch-probabilities, to improve
11097 optimizations based on the number of times each branch was taken.
11098 When a program compiled with -fprofile-arcs exits, it saves arc
11099 execution counts to a file called sourcename.gcda for each source
11100 file. The information in this data file is very dependent on the
11101 structure of the generated code, so you must use the same source
11102 code and the same optimization options for both compilations. See
11103 details about the file naming in -fprofile-arcs.
11104
11105 With -fbranch-probabilities, GCC puts a REG_BR_PROB note on each
11106 JUMP_INSN and CALL_INSN. These can be used to improve
11107 optimization. Currently, they are only used in one place: in
11108 reorg.cc, instead of guessing which path a branch is most likely to
11109 take, the REG_BR_PROB values are used to exactly determine which
11110 path is taken more often.
11111
11112 Enabled by -fprofile-use and -fauto-profile.
11113
11114 -fprofile-values
11115 If combined with -fprofile-arcs, it adds code so that some data
11116 about values of expressions in the program is gathered.
11117
11118 With -fbranch-probabilities, it reads back the data gathered from
11119 profiling values of expressions for usage in optimizations.
11120
11121 Enabled by -fprofile-generate, -fprofile-use, and -fauto-profile.
11122
11123 -fprofile-reorder-functions
11124 Function reordering based on profile instrumentation collects first
11125 time of execution of a function and orders these functions in
11126 ascending order.
11127
11128 Enabled with -fprofile-use.
11129
11130 -fvpt
11131 If combined with -fprofile-arcs, this option instructs the compiler
11132 to add code to gather information about values of expressions.
11133
11134 With -fbranch-probabilities, it reads back the data gathered and
11135 actually performs the optimizations based on them. Currently the
11136 optimizations include specialization of division operations using
11137 the knowledge about the value of the denominator.
11138
11139 Enabled with -fprofile-use and -fauto-profile.
11140
11141 -frename-registers
11142 Attempt to avoid false dependencies in scheduled code by making use
11143 of registers left over after register allocation. This
11144 optimization most benefits processors with lots of registers.
11145 Depending on the debug information format adopted by the target,
11146 however, it can make debugging impossible, since variables no
11147 longer stay in a "home register".
11148
11149 Enabled by default with -funroll-loops.
11150
11151 -fschedule-fusion
11152 Performs a target dependent pass over the instruction stream to
11153 schedule instructions of same type together because target machine
11154 can execute them more efficiently if they are adjacent to each
11155 other in the instruction flow.
11156
11157 Enabled at levels -O2, -O3, -Os.
11158
11159 -ftracer
11160 Perform tail duplication to enlarge superblock size. This
11161 transformation simplifies the control flow of the function allowing
11162 other optimizations to do a better job.
11163
11164 Enabled by -fprofile-use and -fauto-profile.
11165
11166 -funroll-loops
11167 Unroll loops whose number of iterations can be determined at
11168 compile time or upon entry to the loop. -funroll-loops implies
11169 -frerun-cse-after-loop, -fweb and -frename-registers. It also
11170 turns on complete loop peeling (i.e. complete removal of loops with
11171 a small constant number of iterations). This option makes code
11172 larger, and may or may not make it run faster.
11173
11174 Enabled by -fprofile-use and -fauto-profile.
11175
11176 -funroll-all-loops
11177 Unroll all loops, even if their number of iterations is uncertain
11178 when the loop is entered. This usually makes programs run more
11179 slowly. -funroll-all-loops implies the same options as
11180 -funroll-loops.
11181
11182 -fpeel-loops
11183 Peels loops for which there is enough information that they do not
11184 roll much (from profile feedback or static analysis). It also
11185 turns on complete loop peeling (i.e. complete removal of loops with
11186 small constant number of iterations).
11187
11188 Enabled by -O3, -fprofile-use, and -fauto-profile.
11189
11190 -fmove-loop-invariants
11191 Enables the loop invariant motion pass in the RTL loop optimizer.
11192 Enabled at level -O1 and higher, except for -Og.
11193
11194 -fmove-loop-stores
11195 Enables the loop store motion pass in the GIMPLE loop optimizer.
11196 This moves invariant stores to after the end of the loop in
11197 exchange for carrying the stored value in a register across the
11198 iteration. Note for this option to have an effect -ftree-loop-im
11199 has to be enabled as well. Enabled at level -O1 and higher, except
11200 for -Og.
11201
11202 -fsplit-loops
11203 Split a loop into two if it contains a condition that's always true
11204 for one side of the iteration space and false for the other.
11205
11206 Enabled by -fprofile-use and -fauto-profile.
11207
11208 -funswitch-loops
11209 Move branches with loop invariant conditions out of the loop, with
11210 duplicates of the loop on both branches (modified according to
11211 result of the condition).
11212
11213 Enabled by -fprofile-use and -fauto-profile.
11214
11215 -fversion-loops-for-strides
11216 If a loop iterates over an array with a variable stride, create
11217 another version of the loop that assumes the stride is always one.
11218 For example:
11219
11220 for (int i = 0; i < n; ++i)
11221 x[i * stride] = ...;
11222
11223 becomes:
11224
11225 if (stride == 1)
11226 for (int i = 0; i < n; ++i)
11227 x[i] = ...;
11228 else
11229 for (int i = 0; i < n; ++i)
11230 x[i * stride] = ...;
11231
11232 This is particularly useful for assumed-shape arrays in Fortran
11233 where (for example) it allows better vectorization assuming
11234 contiguous accesses. This flag is enabled by default at -O3. It
11235 is also enabled by -fprofile-use and -fauto-profile.
11236
11237 -ffunction-sections
11238 -fdata-sections
11239 Place each function or data item into its own section in the output
11240 file if the target supports arbitrary sections. The name of the
11241 function or the name of the data item determines the section's name
11242 in the output file.
11243
11244 Use these options on systems where the linker can perform
11245 optimizations to improve locality of reference in the instruction
11246 space. Most systems using the ELF object format have linkers with
11247 such optimizations. On AIX, the linker rearranges sections
11248 (CSECTs) based on the call graph. The performance impact varies.
11249
11250 Together with a linker garbage collection (linker --gc-sections
11251 option) these options may lead to smaller statically-linked
11252 executables (after stripping).
11253
11254 On ELF/DWARF systems these options do not degenerate the quality of
11255 the debug information. There could be issues with other object
11256 files/debug info formats.
11257
11258 Only use these options when there are significant benefits from
11259 doing so. When you specify these options, the assembler and linker
11260 create larger object and executable files and are also slower.
11261 These options affect code generation. They prevent optimizations
11262 by the compiler and assembler using relative locations inside a
11263 translation unit since the locations are unknown until link time.
11264 An example of such an optimization is relaxing calls to short call
11265 instructions.
11266
11267 -fstdarg-opt
11268 Optimize the prologue of variadic argument functions with respect
11269 to usage of those arguments.
11270
11271 -fsection-anchors
11272 Try to reduce the number of symbolic address calculations by using
11273 shared "anchor" symbols to address nearby objects. This
11274 transformation can help to reduce the number of GOT entries and GOT
11275 accesses on some targets.
11276
11277 For example, the implementation of the following function "foo":
11278
11279 static int a, b, c;
11280 int foo (void) { return a + b + c; }
11281
11282 usually calculates the addresses of all three variables, but if you
11283 compile it with -fsection-anchors, it accesses the variables from a
11284 common anchor point instead. The effect is similar to the
11285 following pseudocode (which isn't valid C):
11286
11287 int foo (void)
11288 {
11289 register int *xr = &x;
11290 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11291 }
11292
11293 Not all targets support this option.
11294
11295 -fzero-call-used-regs=choice
11296 Zero call-used registers at function return to increase program
11297 security by either mitigating Return-Oriented Programming (ROP)
11298 attacks or preventing information leakage through registers.
11299
11300 The possible values of choice are the same as for the
11301 "zero_call_used_regs" attribute. The default is skip.
11302
11303 You can control this behavior for a specific function by using the
11304 function attribute "zero_call_used_regs".
11305
11306 --param name=value
11307 In some places, GCC uses various constants to control the amount of
11308 optimization that is done. For example, GCC does not inline
11309 functions that contain more than a certain number of instructions.
11310 You can control some of these constants on the command line using
11311 the --param option.
11312
11313 The names of specific parameters, and the meaning of the values,
11314 are tied to the internals of the compiler, and are subject to
11315 change without notice in future releases.
11316
11317 In order to get minimal, maximal and default value of a parameter,
11318 one can use --help=param -Q options.
11319
11320 In each case, the value is an integer. The following choices of
11321 name are recognized for all targets:
11322
11323 predictable-branch-outcome
11324 When branch is predicted to be taken with probability lower
11325 than this threshold (in percent), then it is considered well
11326 predictable.
11327
11328 max-rtl-if-conversion-insns
11329 RTL if-conversion tries to remove conditional branches around a
11330 block and replace them with conditionally executed
11331 instructions. This parameter gives the maximum number of
11332 instructions in a block which should be considered for if-
11333 conversion. The compiler will also use other heuristics to
11334 decide whether if-conversion is likely to be profitable.
11335
11336 max-rtl-if-conversion-predictable-cost
11337 RTL if-conversion will try to remove conditional branches
11338 around a block and replace them with conditionally executed
11339 instructions. These parameters give the maximum permissible
11340 cost for the sequence that would be generated by if-conversion
11341 depending on whether the branch is statically determined to be
11342 predictable or not. The units for this parameter are the same
11343 as those for the GCC internal seq_cost metric. The compiler
11344 will try to provide a reasonable default for this parameter
11345 using the BRANCH_COST target macro.
11346
11347 max-crossjump-edges
11348 The maximum number of incoming edges to consider for cross-
11349 jumping. The algorithm used by -fcrossjumping is O(N^2) in the
11350 number of edges incoming to each block. Increasing values mean
11351 more aggressive optimization, making the compilation time
11352 increase with probably small improvement in executable size.
11353
11354 min-crossjump-insns
11355 The minimum number of instructions that must be matched at the
11356 end of two blocks before cross-jumping is performed on them.
11357 This value is ignored in the case where all instructions in the
11358 block being cross-jumped from are matched.
11359
11360 max-grow-copy-bb-insns
11361 The maximum code size expansion factor when copying basic
11362 blocks instead of jumping. The expansion is relative to a jump
11363 instruction.
11364
11365 max-goto-duplication-insns
11366 The maximum number of instructions to duplicate to a block that
11367 jumps to a computed goto. To avoid O(N^2) behavior in a number
11368 of passes, GCC factors computed gotos early in the compilation
11369 process, and unfactors them as late as possible. Only computed
11370 jumps at the end of a basic blocks with no more than max-goto-
11371 duplication-insns are unfactored.
11372
11373 max-delay-slot-insn-search
11374 The maximum number of instructions to consider when looking for
11375 an instruction to fill a delay slot. If more than this
11376 arbitrary number of instructions are searched, the time savings
11377 from filling the delay slot are minimal, so stop searching.
11378 Increasing values mean more aggressive optimization, making the
11379 compilation time increase with probably small improvement in
11380 execution time.
11381
11382 max-delay-slot-live-search
11383 When trying to fill delay slots, the maximum number of
11384 instructions to consider when searching for a block with valid
11385 live register information. Increasing this arbitrarily chosen
11386 value means more aggressive optimization, increasing the
11387 compilation time. This parameter should be removed when the
11388 delay slot code is rewritten to maintain the control-flow
11389 graph.
11390
11391 max-gcse-memory
11392 The approximate maximum amount of memory in "kB" that can be
11393 allocated in order to perform the global common subexpression
11394 elimination optimization. If more memory than specified is
11395 required, the optimization is not done.
11396
11397 max-gcse-insertion-ratio
11398 If the ratio of expression insertions to deletions is larger
11399 than this value for any expression, then RTL PRE inserts or
11400 removes the expression and thus leaves partially redundant
11401 computations in the instruction stream.
11402
11403 max-pending-list-length
11404 The maximum number of pending dependencies scheduling allows
11405 before flushing the current state and starting over. Large
11406 functions with few branches or calls can create excessively
11407 large lists which needlessly consume memory and resources.
11408
11409 max-modulo-backtrack-attempts
11410 The maximum number of backtrack attempts the scheduler should
11411 make when modulo scheduling a loop. Larger values can
11412 exponentially increase compilation time.
11413
11414 max-inline-functions-called-once-loop-depth
11415 Maximal loop depth of a call considered by inline heuristics
11416 that tries to inline all functions called once.
11417
11418 max-inline-functions-called-once-insns
11419 Maximal estimated size of functions produced while inlining
11420 functions called once.
11421
11422 max-inline-insns-single
11423 Several parameters control the tree inliner used in GCC. This
11424 number sets the maximum number of instructions (counted in
11425 GCC's internal representation) in a single function that the
11426 tree inliner considers for inlining. This only affects
11427 functions declared inline and methods implemented in a class
11428 declaration (C++).
11429
11430 max-inline-insns-auto
11431 When you use -finline-functions (included in -O3), a lot of
11432 functions that would otherwise not be considered for inlining
11433 by the compiler are investigated. To those functions, a
11434 different (more restrictive) limit compared to functions
11435 declared inline can be applied (--param max-inline-insns-auto).
11436
11437 max-inline-insns-small
11438 This is bound applied to calls which are considered relevant
11439 with -finline-small-functions.
11440
11441 max-inline-insns-size
11442 This is bound applied to calls which are optimized for size.
11443 Small growth may be desirable to anticipate optimization
11444 oppurtunities exposed by inlining.
11445
11446 uninlined-function-insns
11447 Number of instructions accounted by inliner for function
11448 overhead such as function prologue and epilogue.
11449
11450 uninlined-function-time
11451 Extra time accounted by inliner for function overhead such as
11452 time needed to execute function prologue and epilogue.
11453
11454 inline-heuristics-hint-percent
11455 The scale (in percents) applied to inline-insns-single,
11456 inline-insns-single-O2, inline-insns-auto when inline
11457 heuristics hints that inlining is very profitable (will enable
11458 later optimizations).
11459
11460 uninlined-thunk-insns
11461 uninlined-thunk-time
11462 Same as --param uninlined-function-insns and --param uninlined-
11463 function-time but applied to function thunks.
11464
11465 inline-min-speedup
11466 When estimated performance improvement of caller + callee
11467 runtime exceeds this threshold (in percent), the function can
11468 be inlined regardless of the limit on --param max-inline-insns-
11469 single and --param max-inline-insns-auto.
11470
11471 large-function-insns
11472 The limit specifying really large functions. For functions
11473 larger than this limit after inlining, inlining is constrained
11474 by --param large-function-growth. This parameter is useful
11475 primarily to avoid extreme compilation time caused by non-
11476 linear algorithms used by the back end.
11477
11478 large-function-growth
11479 Specifies maximal growth of large function caused by inlining
11480 in percents. For example, parameter value 100 limits large
11481 function growth to 2.0 times the original size.
11482
11483 large-unit-insns
11484 The limit specifying large translation unit. Growth caused by
11485 inlining of units larger than this limit is limited by --param
11486 inline-unit-growth. For small units this might be too tight.
11487 For example, consider a unit consisting of function A that is
11488 inline and B that just calls A three times. If B is small
11489 relative to A, the growth of unit is 300\% and yet such
11490 inlining is very sane. For very large units consisting of
11491 small inlineable functions, however, the overall unit growth
11492 limit is needed to avoid exponential explosion of code size.
11493 Thus for smaller units, the size is increased to --param large-
11494 unit-insns before applying --param inline-unit-growth.
11495
11496 lazy-modules
11497 Maximum number of concurrently open C++ module files when lazy
11498 loading.
11499
11500 inline-unit-growth
11501 Specifies maximal overall growth of the compilation unit caused
11502 by inlining. For example, parameter value 20 limits unit
11503 growth to 1.2 times the original size. Cold functions (either
11504 marked cold via an attribute or by profile feedback) are not
11505 accounted into the unit size.
11506
11507 ipa-cp-unit-growth
11508 Specifies maximal overall growth of the compilation unit caused
11509 by interprocedural constant propagation. For example,
11510 parameter value 10 limits unit growth to 1.1 times the original
11511 size.
11512
11513 ipa-cp-large-unit-insns
11514 The size of translation unit that IPA-CP pass considers large.
11515
11516 large-stack-frame
11517 The limit specifying large stack frames. While inlining the
11518 algorithm is trying to not grow past this limit too much.
11519
11520 large-stack-frame-growth
11521 Specifies maximal growth of large stack frames caused by
11522 inlining in percents. For example, parameter value 1000 limits
11523 large stack frame growth to 11 times the original size.
11524
11525 max-inline-insns-recursive
11526 max-inline-insns-recursive-auto
11527 Specifies the maximum number of instructions an out-of-line
11528 copy of a self-recursive inline function can grow into by
11529 performing recursive inlining.
11530
11531 --param max-inline-insns-recursive applies to functions
11532 declared inline. For functions not declared inline, recursive
11533 inlining happens only when -finline-functions (included in -O3)
11534 is enabled; --param max-inline-insns-recursive-auto applies
11535 instead.
11536
11537 max-inline-recursive-depth
11538 max-inline-recursive-depth-auto
11539 Specifies the maximum recursion depth used for recursive
11540 inlining.
11541
11542 --param max-inline-recursive-depth applies to functions
11543 declared inline. For functions not declared inline, recursive
11544 inlining happens only when -finline-functions (included in -O3)
11545 is enabled; --param max-inline-recursive-depth-auto applies
11546 instead.
11547
11548 min-inline-recursive-probability
11549 Recursive inlining is profitable only for function having deep
11550 recursion in average and can hurt for function having little
11551 recursion depth by increasing the prologue size or complexity
11552 of function body to other optimizers.
11553
11554 When profile feedback is available (see -fprofile-generate) the
11555 actual recursion depth can be guessed from the probability that
11556 function recurses via a given call expression. This parameter
11557 limits inlining only to call expressions whose probability
11558 exceeds the given threshold (in percents).
11559
11560 early-inlining-insns
11561 Specify growth that the early inliner can make. In effect it
11562 increases the amount of inlining for code having a large
11563 abstraction penalty.
11564
11565 max-early-inliner-iterations
11566 Limit of iterations of the early inliner. This basically
11567 bounds the number of nested indirect calls the early inliner
11568 can resolve. Deeper chains are still handled by late inlining.
11569
11570 comdat-sharing-probability
11571 Probability (in percent) that C++ inline function with comdat
11572 visibility are shared across multiple compilation units.
11573
11574 modref-max-bases
11575 modref-max-refs
11576 modref-max-accesses
11577 Specifies the maximal number of base pointers, references and
11578 accesses stored for a single function by mod/ref analysis.
11579
11580 modref-max-tests
11581 Specifies the maxmal number of tests alias oracle can perform
11582 to disambiguate memory locations using the mod/ref information.
11583 This parameter ought to be bigger than --param modref-max-bases
11584 and --param modref-max-refs.
11585
11586 modref-max-depth
11587 Specifies the maximum depth of DFS walk used by modref escape
11588 analysis. Setting to 0 disables the analysis completely.
11589
11590 modref-max-escape-points
11591 Specifies the maximum number of escape points tracked by modref
11592 per SSA-name.
11593
11594 modref-max-adjustments
11595 Specifies the maximum number the access range is enlarged
11596 during modref dataflow analysis.
11597
11598 profile-func-internal-id
11599 A parameter to control whether to use function internal id in
11600 profile database lookup. If the value is 0, the compiler uses
11601 an id that is based on function assembler name and filename,
11602 which makes old profile data more tolerant to source changes
11603 such as function reordering etc.
11604
11605 min-vect-loop-bound
11606 The minimum number of iterations under which loops are not
11607 vectorized when -ftree-vectorize is used. The number of
11608 iterations after vectorization needs to be greater than the
11609 value specified by this option to allow vectorization.
11610
11611 gcse-cost-distance-ratio
11612 Scaling factor in calculation of maximum distance an expression
11613 can be moved by GCSE optimizations. This is currently
11614 supported only in the code hoisting pass. The bigger the
11615 ratio, the more aggressive code hoisting is with simple
11616 expressions, i.e., the expressions that have cost less than
11617 gcse-unrestricted-cost. Specifying 0 disables hoisting of
11618 simple expressions.
11619
11620 gcse-unrestricted-cost
11621 Cost, roughly measured as the cost of a single typical machine
11622 instruction, at which GCSE optimizations do not constrain the
11623 distance an expression can travel. This is currently supported
11624 only in the code hoisting pass. The lesser the cost, the more
11625 aggressive code hoisting is. Specifying 0 allows all
11626 expressions to travel unrestricted distances.
11627
11628 max-hoist-depth
11629 The depth of search in the dominator tree for expressions to
11630 hoist. This is used to avoid quadratic behavior in hoisting
11631 algorithm. The value of 0 does not limit on the search, but
11632 may slow down compilation of huge functions.
11633
11634 max-tail-merge-comparisons
11635 The maximum amount of similar bbs to compare a bb with. This
11636 is used to avoid quadratic behavior in tree tail merging.
11637
11638 max-tail-merge-iterations
11639 The maximum amount of iterations of the pass over the function.
11640 This is used to limit compilation time in tree tail merging.
11641
11642 store-merging-allow-unaligned
11643 Allow the store merging pass to introduce unaligned stores if
11644 it is legal to do so.
11645
11646 max-stores-to-merge
11647 The maximum number of stores to attempt to merge into wider
11648 stores in the store merging pass.
11649
11650 max-store-chains-to-track
11651 The maximum number of store chains to track at the same time in
11652 the attempt to merge them into wider stores in the store
11653 merging pass.
11654
11655 max-stores-to-track
11656 The maximum number of stores to track at the same time in the
11657 attemt to to merge them into wider stores in the store merging
11658 pass.
11659
11660 max-unrolled-insns
11661 The maximum number of instructions that a loop may have to be
11662 unrolled. If a loop is unrolled, this parameter also
11663 determines how many times the loop code is unrolled.
11664
11665 max-average-unrolled-insns
11666 The maximum number of instructions biased by probabilities of
11667 their execution that a loop may have to be unrolled. If a loop
11668 is unrolled, this parameter also determines how many times the
11669 loop code is unrolled.
11670
11671 max-unroll-times
11672 The maximum number of unrollings of a single loop.
11673
11674 max-peeled-insns
11675 The maximum number of instructions that a loop may have to be
11676 peeled. If a loop is peeled, this parameter also determines
11677 how many times the loop code is peeled.
11678
11679 max-peel-times
11680 The maximum number of peelings of a single loop.
11681
11682 max-peel-branches
11683 The maximum number of branches on the hot path through the
11684 peeled sequence.
11685
11686 max-completely-peeled-insns
11687 The maximum number of insns of a completely peeled loop.
11688
11689 max-completely-peel-times
11690 The maximum number of iterations of a loop to be suitable for
11691 complete peeling.
11692
11693 max-completely-peel-loop-nest-depth
11694 The maximum depth of a loop nest suitable for complete peeling.
11695
11696 max-unswitch-insns
11697 The maximum number of insns of an unswitched loop.
11698
11699 max-unswitch-level
11700 The maximum number of branches unswitched in a single loop.
11701
11702 lim-expensive
11703 The minimum cost of an expensive expression in the loop
11704 invariant motion.
11705
11706 min-loop-cond-split-prob
11707 When FDO profile information is available, min-loop-cond-split-
11708 prob specifies minimum threshold for probability of semi-
11709 invariant condition statement to trigger loop split.
11710
11711 iv-consider-all-candidates-bound
11712 Bound on number of candidates for induction variables, below
11713 which all candidates are considered for each use in induction
11714 variable optimizations. If there are more candidates than
11715 this, only the most relevant ones are considered to avoid
11716 quadratic time complexity.
11717
11718 iv-max-considered-uses
11719 The induction variable optimizations give up on loops that
11720 contain more induction variable uses.
11721
11722 iv-always-prune-cand-set-bound
11723 If the number of candidates in the set is smaller than this
11724 value, always try to remove unnecessary ivs from the set when
11725 adding a new one.
11726
11727 avg-loop-niter
11728 Average number of iterations of a loop.
11729
11730 dse-max-object-size
11731 Maximum size (in bytes) of objects tracked bytewise by dead
11732 store elimination. Larger values may result in larger
11733 compilation times.
11734
11735 dse-max-alias-queries-per-store
11736 Maximum number of queries into the alias oracle per store.
11737 Larger values result in larger compilation times and may result
11738 in more removed dead stores.
11739
11740 scev-max-expr-size
11741 Bound on size of expressions used in the scalar evolutions
11742 analyzer. Large expressions slow the analyzer.
11743
11744 scev-max-expr-complexity
11745 Bound on the complexity of the expressions in the scalar
11746 evolutions analyzer. Complex expressions slow the analyzer.
11747
11748 max-tree-if-conversion-phi-args
11749 Maximum number of arguments in a PHI supported by TREE if
11750 conversion unless the loop is marked with simd pragma.
11751
11752 vect-max-version-for-alignment-checks
11753 The maximum number of run-time checks that can be performed
11754 when doing loop versioning for alignment in the vectorizer.
11755
11756 vect-max-version-for-alias-checks
11757 The maximum number of run-time checks that can be performed
11758 when doing loop versioning for alias in the vectorizer.
11759
11760 vect-max-peeling-for-alignment
11761 The maximum number of loop peels to enhance access alignment
11762 for vectorizer. Value -1 means no limit.
11763
11764 max-iterations-to-track
11765 The maximum number of iterations of a loop the brute-force
11766 algorithm for analysis of the number of iterations of the loop
11767 tries to evaluate.
11768
11769 hot-bb-count-fraction
11770 The denominator n of fraction 1/n of the maximal execution
11771 count of a basic block in the entire program that a basic block
11772 needs to at least have in order to be considered hot. The
11773 default is 10000, which means that a basic block is considered
11774 hot if its execution count is greater than 1/10000 of the
11775 maximal execution count. 0 means that it is never considered
11776 hot. Used in non-LTO mode.
11777
11778 hot-bb-count-ws-permille
11779 The number of most executed permilles, ranging from 0 to 1000,
11780 of the profiled execution of the entire program to which the
11781 execution count of a basic block must be part of in order to be
11782 considered hot. The default is 990, which means that a basic
11783 block is considered hot if its execution count contributes to
11784 the upper 990 permilles, or 99.0%, of the profiled execution of
11785 the entire program. 0 means that it is never considered hot.
11786 Used in LTO mode.
11787
11788 hot-bb-frequency-fraction
11789 The denominator n of fraction 1/n of the execution frequency of
11790 the entry block of a function that a basic block of this
11791 function needs to at least have in order to be considered hot.
11792 The default is 1000, which means that a basic block is
11793 considered hot in a function if it is executed more frequently
11794 than 1/1000 of the frequency of the entry block of the
11795 function. 0 means that it is never considered hot.
11796
11797 unlikely-bb-count-fraction
11798 The denominator n of fraction 1/n of the number of profiled
11799 runs of the entire program below which the execution count of a
11800 basic block must be in order for the basic block to be
11801 considered unlikely executed. The default is 20, which means
11802 that a basic block is considered unlikely executed if it is
11803 executed in fewer than 1/20, or 5%, of the runs of the program.
11804 0 means that it is always considered unlikely executed.
11805
11806 max-predicted-iterations
11807 The maximum number of loop iterations we predict statically.
11808 This is useful in cases where a function contains a single loop
11809 with known bound and another loop with unknown bound. The
11810 known number of iterations is predicted correctly, while the
11811 unknown number of iterations average to roughly 10. This means
11812 that the loop without bounds appears artificially cold relative
11813 to the other one.
11814
11815 builtin-expect-probability
11816 Control the probability of the expression having the specified
11817 value. This parameter takes a percentage (i.e. 0 ... 100) as
11818 input.
11819
11820 builtin-string-cmp-inline-length
11821 The maximum length of a constant string for a builtin string
11822 cmp call eligible for inlining.
11823
11824 align-threshold
11825 Select fraction of the maximal frequency of executions of a
11826 basic block in a function to align the basic block.
11827
11828 align-loop-iterations
11829 A loop expected to iterate at least the selected number of
11830 iterations is aligned.
11831
11832 tracer-dynamic-coverage
11833 tracer-dynamic-coverage-feedback
11834 This value is used to limit superblock formation once the given
11835 percentage of executed instructions is covered. This limits
11836 unnecessary code size expansion.
11837
11838 The tracer-dynamic-coverage-feedback parameter is used only
11839 when profile feedback is available. The real profiles (as
11840 opposed to statically estimated ones) are much less balanced
11841 allowing the threshold to be larger value.
11842
11843 tracer-max-code-growth
11844 Stop tail duplication once code growth has reached given
11845 percentage. This is a rather artificial limit, as most of the
11846 duplicates are eliminated later in cross jumping, so it may be
11847 set to much higher values than is the desired code growth.
11848
11849 tracer-min-branch-ratio
11850 Stop reverse growth when the reverse probability of best edge
11851 is less than this threshold (in percent).
11852
11853 tracer-min-branch-probability
11854 tracer-min-branch-probability-feedback
11855 Stop forward growth if the best edge has probability lower than
11856 this threshold.
11857
11858 Similarly to tracer-dynamic-coverage two parameters are
11859 provided. tracer-min-branch-probability-feedback is used for
11860 compilation with profile feedback and tracer-min-branch-
11861 probability compilation without. The value for compilation
11862 with profile feedback needs to be more conservative (higher) in
11863 order to make tracer effective.
11864
11865 stack-clash-protection-guard-size
11866 Specify the size of the operating system provided stack guard
11867 as 2 raised to num bytes. Higher values may reduce the number
11868 of explicit probes, but a value larger than the operating
11869 system provided guard will leave code vulnerable to stack clash
11870 style attacks.
11871
11872 stack-clash-protection-probe-interval
11873 Stack clash protection involves probing stack space as it is
11874 allocated. This param controls the maximum distance between
11875 probes into the stack as 2 raised to num bytes. Higher values
11876 may reduce the number of explicit probes, but a value larger
11877 than the operating system provided guard will leave code
11878 vulnerable to stack clash style attacks.
11879
11880 max-cse-path-length
11881 The maximum number of basic blocks on path that CSE considers.
11882
11883 max-cse-insns
11884 The maximum number of instructions CSE processes before
11885 flushing.
11886
11887 ggc-min-expand
11888 GCC uses a garbage collector to manage its own memory
11889 allocation. This parameter specifies the minimum percentage by
11890 which the garbage collector's heap should be allowed to expand
11891 between collections. Tuning this may improve compilation
11892 speed; it has no effect on code generation.
11893
11894 The default is 30% + 70% * (RAM/1GB) with an upper bound of
11895 100% when RAM >= 1GB. If "getrlimit" is available, the notion
11896 of "RAM" is the smallest of actual RAM and "RLIMIT_DATA" or
11897 "RLIMIT_AS". If GCC is not able to calculate RAM on a
11898 particular platform, the lower bound of 30% is used. Setting
11899 this parameter and ggc-min-heapsize to zero causes a full
11900 collection to occur at every opportunity. This is extremely
11901 slow, but can be useful for debugging.
11902
11903 ggc-min-heapsize
11904 Minimum size of the garbage collector's heap before it begins
11905 bothering to collect garbage. The first collection occurs
11906 after the heap expands by ggc-min-expand% beyond ggc-min-
11907 heapsize. Again, tuning this may improve compilation speed,
11908 and has no effect on code generation.
11909
11910 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit
11911 that tries to ensure that RLIMIT_DATA or RLIMIT_AS are not
11912 exceeded, but with a lower bound of 4096 (four megabytes) and
11913 an upper bound of 131072 (128 megabytes). If GCC is not able
11914 to calculate RAM on a particular platform, the lower bound is
11915 used. Setting this parameter very large effectively disables
11916 garbage collection. Setting this parameter and ggc-min-expand
11917 to zero causes a full collection to occur at every opportunity.
11918
11919 max-reload-search-insns
11920 The maximum number of instruction reload should look backward
11921 for equivalent register. Increasing values mean more
11922 aggressive optimization, making the compilation time increase
11923 with probably slightly better performance.
11924
11925 max-cselib-memory-locations
11926 The maximum number of memory locations cselib should take into
11927 account. Increasing values mean more aggressive optimization,
11928 making the compilation time increase with probably slightly
11929 better performance.
11930
11931 max-sched-ready-insns
11932 The maximum number of instructions ready to be issued the
11933 scheduler should consider at any given time during the first
11934 scheduling pass. Increasing values mean more thorough
11935 searches, making the compilation time increase with probably
11936 little benefit.
11937
11938 max-sched-region-blocks
11939 The maximum number of blocks in a region to be considered for
11940 interblock scheduling.
11941
11942 max-pipeline-region-blocks
11943 The maximum number of blocks in a region to be considered for
11944 pipelining in the selective scheduler.
11945
11946 max-sched-region-insns
11947 The maximum number of insns in a region to be considered for
11948 interblock scheduling.
11949
11950 max-pipeline-region-insns
11951 The maximum number of insns in a region to be considered for
11952 pipelining in the selective scheduler.
11953
11954 min-spec-prob
11955 The minimum probability (in percents) of reaching a source
11956 block for interblock speculative scheduling.
11957
11958 max-sched-extend-regions-iters
11959 The maximum number of iterations through CFG to extend regions.
11960 A value of 0 disables region extensions.
11961
11962 max-sched-insn-conflict-delay
11963 The maximum conflict delay for an insn to be considered for
11964 speculative motion.
11965
11966 sched-spec-prob-cutoff
11967 The minimal probability of speculation success (in percents),
11968 so that speculative insns are scheduled.
11969
11970 sched-state-edge-prob-cutoff
11971 The minimum probability an edge must have for the scheduler to
11972 save its state across it.
11973
11974 sched-mem-true-dep-cost
11975 Minimal distance (in CPU cycles) between store and load
11976 targeting same memory locations.
11977
11978 selsched-max-lookahead
11979 The maximum size of the lookahead window of selective
11980 scheduling. It is a depth of search for available
11981 instructions.
11982
11983 selsched-max-sched-times
11984 The maximum number of times that an instruction is scheduled
11985 during selective scheduling. This is the limit on the number
11986 of iterations through which the instruction may be pipelined.
11987
11988 selsched-insns-to-rename
11989 The maximum number of best instructions in the ready list that
11990 are considered for renaming in the selective scheduler.
11991
11992 sms-min-sc
11993 The minimum value of stage count that swing modulo scheduler
11994 generates.
11995
11996 max-last-value-rtl
11997 The maximum size measured as number of RTLs that can be
11998 recorded in an expression in combiner for a pseudo register as
11999 last known value of that register.
12000
12001 max-combine-insns
12002 The maximum number of instructions the RTL combiner tries to
12003 combine.
12004
12005 integer-share-limit
12006 Small integer constants can use a shared data structure,
12007 reducing the compiler's memory usage and increasing its speed.
12008 This sets the maximum value of a shared integer constant.
12009
12010 ssp-buffer-size
12011 The minimum size of buffers (i.e. arrays) that receive stack
12012 smashing protection when -fstack-protector is used.
12013
12014 min-size-for-stack-sharing
12015 The minimum size of variables taking part in stack slot sharing
12016 when not optimizing.
12017
12018 max-jump-thread-duplication-stmts
12019 Maximum number of statements allowed in a block that needs to
12020 be duplicated when threading jumps.
12021
12022 max-fields-for-field-sensitive
12023 Maximum number of fields in a structure treated in a field
12024 sensitive manner during pointer analysis.
12025
12026 prefetch-latency
12027 Estimate on average number of instructions that are executed
12028 before prefetch finishes. The distance prefetched ahead is
12029 proportional to this constant. Increasing this number may also
12030 lead to less streams being prefetched (see simultaneous-
12031 prefetches).
12032
12033 simultaneous-prefetches
12034 Maximum number of prefetches that can run at the same time.
12035
12036 l1-cache-line-size
12037 The size of cache line in L1 data cache, in bytes.
12038
12039 l1-cache-size
12040 The size of L1 data cache, in kilobytes.
12041
12042 l2-cache-size
12043 The size of L2 data cache, in kilobytes.
12044
12045 prefetch-dynamic-strides
12046 Whether the loop array prefetch pass should issue software
12047 prefetch hints for strides that are non-constant. In some
12048 cases this may be beneficial, though the fact the stride is
12049 non-constant may make it hard to predict when there is clear
12050 benefit to issuing these hints.
12051
12052 Set to 1 if the prefetch hints should be issued for non-
12053 constant strides. Set to 0 if prefetch hints should be issued
12054 only for strides that are known to be constant and below
12055 prefetch-minimum-stride.
12056
12057 prefetch-minimum-stride
12058 Minimum constant stride, in bytes, to start using prefetch
12059 hints for. If the stride is less than this threshold, prefetch
12060 hints will not be issued.
12061
12062 This setting is useful for processors that have hardware
12063 prefetchers, in which case there may be conflicts between the
12064 hardware prefetchers and the software prefetchers. If the
12065 hardware prefetchers have a maximum stride they can handle, it
12066 should be used here to improve the use of software prefetchers.
12067
12068 A value of -1 means we don't have a threshold and therefore
12069 prefetch hints can be issued for any constant stride.
12070
12071 This setting is only useful for strides that are known and
12072 constant.
12073
12074 destructive-interference-size
12075 constructive-interference-size
12076 The values for the C++17 variables
12077 "std::hardware_destructive_interference_size" and
12078 "std::hardware_constructive_interference_size". The
12079 destructive interference size is the minimum recommended offset
12080 between two independent concurrently-accessed objects; the
12081 constructive interference size is the maximum recommended size
12082 of contiguous memory accessed together. Typically both will be
12083 the size of an L1 cache line for the target, in bytes. For a
12084 generic target covering a range of L1 cache line sizes,
12085 typically the constructive interference size will be the small
12086 end of the range and the destructive size will be the large
12087 end.
12088
12089 The destructive interference size is intended to be used for
12090 layout, and thus has ABI impact. The default value is not
12091 expected to be stable, and on some targets varies with -mtune,
12092 so use of this variable in a context where ABI stability is
12093 important, such as the public interface of a library, is
12094 strongly discouraged; if it is used in that context, users can
12095 stabilize the value using this option.
12096
12097 The constructive interference size is less sensitive, as it is
12098 typically only used in a static_assert to make sure that a type
12099 fits within a cache line.
12100
12101 See also -Winterference-size.
12102
12103 loop-interchange-max-num-stmts
12104 The maximum number of stmts in a loop to be interchanged.
12105
12106 loop-interchange-stride-ratio
12107 The minimum ratio between stride of two loops for interchange
12108 to be profitable.
12109
12110 min-insn-to-prefetch-ratio
12111 The minimum ratio between the number of instructions and the
12112 number of prefetches to enable prefetching in a loop.
12113
12114 prefetch-min-insn-to-mem-ratio
12115 The minimum ratio between the number of instructions and the
12116 number of memory references to enable prefetching in a loop.
12117
12118 use-canonical-types
12119 Whether the compiler should use the "canonical" type system.
12120 Should always be 1, which uses a more efficient internal
12121 mechanism for comparing types in C++ and Objective-C++.
12122 However, if bugs in the canonical type system are causing
12123 compilation failures, set this value to 0 to disable canonical
12124 types.
12125
12126 switch-conversion-max-branch-ratio
12127 Switch initialization conversion refuses to create arrays that
12128 are bigger than switch-conversion-max-branch-ratio times the
12129 number of branches in the switch.
12130
12131 max-partial-antic-length
12132 Maximum length of the partial antic set computed during the
12133 tree partial redundancy elimination optimization (-ftree-pre)
12134 when optimizing at -O3 and above. For some sorts of source
12135 code the enhanced partial redundancy elimination optimization
12136 can run away, consuming all of the memory available on the host
12137 machine. This parameter sets a limit on the length of the sets
12138 that are computed, which prevents the runaway behavior.
12139 Setting a value of 0 for this parameter allows an unlimited set
12140 length.
12141
12142 rpo-vn-max-loop-depth
12143 Maximum loop depth that is value-numbered optimistically. When
12144 the limit hits the innermost rpo-vn-max-loop-depth loops and
12145 the outermost loop in the loop nest are value-numbered
12146 optimistically and the remaining ones not.
12147
12148 sccvn-max-alias-queries-per-access
12149 Maximum number of alias-oracle queries we perform when looking
12150 for redundancies for loads and stores. If this limit is hit
12151 the search is aborted and the load or store is not considered
12152 redundant. The number of queries is algorithmically limited to
12153 the number of stores on all paths from the load to the function
12154 entry.
12155
12156 ira-max-loops-num
12157 IRA uses regional register allocation by default. If a
12158 function contains more loops than the number given by this
12159 parameter, only at most the given number of the most
12160 frequently-executed loops form regions for regional register
12161 allocation.
12162
12163 ira-max-conflict-table-size
12164 Although IRA uses a sophisticated algorithm to compress the
12165 conflict table, the table can still require excessive amounts
12166 of memory for huge functions. If the conflict table for a
12167 function could be more than the size in MB given by this
12168 parameter, the register allocator instead uses a faster,
12169 simpler, and lower-quality algorithm that does not require
12170 building a pseudo-register conflict table.
12171
12172 ira-loop-reserved-regs
12173 IRA can be used to evaluate more accurate register pressure in
12174 loops for decisions to move loop invariants (see -O3). The
12175 number of available registers reserved for some other purposes
12176 is given by this parameter. Default of the parameter is the
12177 best found from numerous experiments.
12178
12179 ira-consider-dup-in-all-alts
12180 Make IRA to consider matching constraint (duplicated operand
12181 number) heavily in all available alternatives for preferred
12182 register class. If it is set as zero, it means IRA only
12183 respects the matching constraint when it's in the only
12184 available alternative with an appropriate register class.
12185 Otherwise, it means IRA will check all available alternatives
12186 for preferred register class even if it has found some choice
12187 with an appropriate register class and respect the found
12188 qualified matching constraint.
12189
12190 lra-inheritance-ebb-probability-cutoff
12191 LRA tries to reuse values reloaded in registers in subsequent
12192 insns. This optimization is called inheritance. EBB is used
12193 as a region to do this optimization. The parameter defines a
12194 minimal fall-through edge probability in percentage used to add
12195 BB to inheritance EBB in LRA. The default value was chosen
12196 from numerous runs of SPEC2000 on x86-64.
12197
12198 loop-invariant-max-bbs-in-loop
12199 Loop invariant motion can be very expensive, both in
12200 compilation time and in amount of needed compile-time memory,
12201 with very large loops. Loops with more basic blocks than this
12202 parameter won't have loop invariant motion optimization
12203 performed on them.
12204
12205 loop-max-datarefs-for-datadeps
12206 Building data dependencies is expensive for very large loops.
12207 This parameter limits the number of data references in loops
12208 that are considered for data dependence analysis. These large
12209 loops are no handled by the optimizations using loop data
12210 dependencies.
12211
12212 max-vartrack-size
12213 Sets a maximum number of hash table slots to use during
12214 variable tracking dataflow analysis of any function. If this
12215 limit is exceeded with variable tracking at assignments
12216 enabled, analysis for that function is retried without it,
12217 after removing all debug insns from the function. If the limit
12218 is exceeded even without debug insns, var tracking analysis is
12219 completely disabled for the function. Setting the parameter to
12220 zero makes it unlimited.
12221
12222 max-vartrack-expr-depth
12223 Sets a maximum number of recursion levels when attempting to
12224 map variable names or debug temporaries to value expressions.
12225 This trades compilation time for more complete debug
12226 information. If this is set too low, value expressions that
12227 are available and could be represented in debug information may
12228 end up not being used; setting this higher may enable the
12229 compiler to find more complex debug expressions, but compile
12230 time and memory use may grow.
12231
12232 max-debug-marker-count
12233 Sets a threshold on the number of debug markers (e.g. begin
12234 stmt markers) to avoid complexity explosion at inlining or
12235 expanding to RTL. If a function has more such gimple stmts
12236 than the set limit, such stmts will be dropped from the inlined
12237 copy of a function, and from its RTL expansion.
12238
12239 min-nondebug-insn-uid
12240 Use uids starting at this parameter for nondebug insns. The
12241 range below the parameter is reserved exclusively for debug
12242 insns created by -fvar-tracking-assignments, but debug insns
12243 may get (non-overlapping) uids above it if the reserved range
12244 is exhausted.
12245
12246 ipa-sra-ptr-growth-factor
12247 IPA-SRA replaces a pointer to an aggregate with one or more new
12248 parameters only when their cumulative size is less or equal to
12249 ipa-sra-ptr-growth-factor times the size of the original
12250 pointer parameter.
12251
12252 ipa-sra-max-replacements
12253 Maximum pieces of an aggregate that IPA-SRA tracks. As a
12254 consequence, it is also the maximum number of replacements of a
12255 formal parameter.
12256
12257 sra-max-scalarization-size-Ospeed
12258 sra-max-scalarization-size-Osize
12259 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA)
12260 aim to replace scalar parts of aggregates with uses of
12261 independent scalar variables. These parameters control the
12262 maximum size, in storage units, of aggregate which is
12263 considered for replacement when compiling for speed (sra-max-
12264 scalarization-size-Ospeed) or size (sra-max-scalarization-size-
12265 Osize) respectively.
12266
12267 sra-max-propagations
12268 The maximum number of artificial accesses that Scalar
12269 Replacement of Aggregates (SRA) will track, per one local
12270 variable, in order to facilitate copy propagation.
12271
12272 tm-max-aggregate-size
12273 When making copies of thread-local variables in a transaction,
12274 this parameter specifies the size in bytes after which
12275 variables are saved with the logging functions as opposed to
12276 save/restore code sequence pairs. This option only applies
12277 when using -fgnu-tm.
12278
12279 graphite-max-nb-scop-params
12280 To avoid exponential effects in the Graphite loop transforms,
12281 the number of parameters in a Static Control Part (SCoP) is
12282 bounded. A value of zero can be used to lift the bound. A
12283 variable whose value is unknown at compilation time and defined
12284 outside a SCoP is a parameter of the SCoP.
12285
12286 loop-block-tile-size
12287 Loop blocking or strip mining transforms, enabled with
12288 -floop-block or -floop-strip-mine, strip mine each loop in the
12289 loop nest by a given number of iterations. The strip length
12290 can be changed using the loop-block-tile-size parameter.
12291
12292 ipa-jump-function-lookups
12293 Specifies number of statements visited during jump function
12294 offset discovery.
12295
12296 ipa-cp-value-list-size
12297 IPA-CP attempts to track all possible values and types passed
12298 to a function's parameter in order to propagate them and
12299 perform devirtualization. ipa-cp-value-list-size is the
12300 maximum number of values and types it stores per one formal
12301 parameter of a function.
12302
12303 ipa-cp-eval-threshold
12304 IPA-CP calculates its own score of cloning profitability
12305 heuristics and performs those cloning opportunities with scores
12306 that exceed ipa-cp-eval-threshold.
12307
12308 ipa-cp-max-recursive-depth
12309 Maximum depth of recursive cloning for self-recursive function.
12310
12311 ipa-cp-min-recursive-probability
12312 Recursive cloning only when the probability of call being
12313 executed exceeds the parameter.
12314
12315 ipa-cp-profile-count-base
12316 When using -fprofile-use option, IPA-CP will consider the
12317 measured execution count of a call graph edge at this
12318 percentage position in their histogram as the basis for its
12319 heuristics calculation.
12320
12321 ipa-cp-recursive-freq-factor
12322 The number of times interprocedural copy propagation expects
12323 recursive functions to call themselves.
12324
12325 ipa-cp-recursion-penalty
12326 Percentage penalty the recursive functions will receive when
12327 they are evaluated for cloning.
12328
12329 ipa-cp-single-call-penalty
12330 Percentage penalty functions containing a single call to
12331 another function will receive when they are evaluated for
12332 cloning.
12333
12334 ipa-max-agg-items
12335 IPA-CP is also capable to propagate a number of scalar values
12336 passed in an aggregate. ipa-max-agg-items controls the maximum
12337 number of such values per one parameter.
12338
12339 ipa-cp-loop-hint-bonus
12340 When IPA-CP determines that a cloning candidate would make the
12341 number of iterations of a loop known, it adds a bonus of ipa-
12342 cp-loop-hint-bonus to the profitability score of the candidate.
12343
12344 ipa-max-loop-predicates
12345 The maximum number of different predicates IPA will use to
12346 describe when loops in a function have known properties.
12347
12348 ipa-max-aa-steps
12349 During its analysis of function bodies, IPA-CP employs alias
12350 analysis in order to track values pointed to by function
12351 parameters. In order not spend too much time analyzing huge
12352 functions, it gives up and consider all memory clobbered after
12353 examining ipa-max-aa-steps statements modifying memory.
12354
12355 ipa-max-switch-predicate-bounds
12356 Maximal number of boundary endpoints of case ranges of switch
12357 statement. For switch exceeding this limit, IPA-CP will not
12358 construct cloning cost predicate, which is used to estimate
12359 cloning benefit, for default case of the switch statement.
12360
12361 ipa-max-param-expr-ops
12362 IPA-CP will analyze conditional statement that references some
12363 function parameter to estimate benefit for cloning upon certain
12364 constant value. But if number of operations in a parameter
12365 expression exceeds ipa-max-param-expr-ops, the expression is
12366 treated as complicated one, and is not handled by IPA analysis.
12367
12368 lto-partitions
12369 Specify desired number of partitions produced during WHOPR
12370 compilation. The number of partitions should exceed the number
12371 of CPUs used for compilation.
12372
12373 lto-min-partition
12374 Size of minimal partition for WHOPR (in estimated
12375 instructions). This prevents expenses of splitting very small
12376 programs into too many partitions.
12377
12378 lto-max-partition
12379 Size of max partition for WHOPR (in estimated instructions).
12380 to provide an upper bound for individual size of partition.
12381 Meant to be used only with balanced partitioning.
12382
12383 lto-max-streaming-parallelism
12384 Maximal number of parallel processes used for LTO streaming.
12385
12386 cxx-max-namespaces-for-diagnostic-help
12387 The maximum number of namespaces to consult for suggestions
12388 when C++ name lookup fails for an identifier.
12389
12390 sink-frequency-threshold
12391 The maximum relative execution frequency (in percents) of the
12392 target block relative to a statement's original block to allow
12393 statement sinking of a statement. Larger numbers result in
12394 more aggressive statement sinking. A small positive adjustment
12395 is applied for statements with memory operands as those are
12396 even more profitable so sink.
12397
12398 max-stores-to-sink
12399 The maximum number of conditional store pairs that can be sunk.
12400 Set to 0 if either vectorization (-ftree-vectorize) or if-
12401 conversion (-ftree-loop-if-convert) is disabled.
12402
12403 case-values-threshold
12404 The smallest number of different values for which it is best to
12405 use a jump-table instead of a tree of conditional branches. If
12406 the value is 0, use the default for the machine.
12407
12408 jump-table-max-growth-ratio-for-size
12409 The maximum code size growth ratio when expanding into a jump
12410 table (in percent). The parameter is used when optimizing for
12411 size.
12412
12413 jump-table-max-growth-ratio-for-speed
12414 The maximum code size growth ratio when expanding into a jump
12415 table (in percent). The parameter is used when optimizing for
12416 speed.
12417
12418 tree-reassoc-width
12419 Set the maximum number of instructions executed in parallel in
12420 reassociated tree. This parameter overrides target dependent
12421 heuristics used by default if has non zero value.
12422
12423 sched-pressure-algorithm
12424 Choose between the two available implementations of
12425 -fsched-pressure. Algorithm 1 is the original implementation
12426 and is the more likely to prevent instructions from being
12427 reordered. Algorithm 2 was designed to be a compromise between
12428 the relatively conservative approach taken by algorithm 1 and
12429 the rather aggressive approach taken by the default scheduler.
12430 It relies more heavily on having a regular register file and
12431 accurate register pressure classes. See haifa-sched.cc in the
12432 GCC sources for more details.
12433
12434 The default choice depends on the target.
12435
12436 max-slsr-cand-scan
12437 Set the maximum number of existing candidates that are
12438 considered when seeking a basis for a new straight-line
12439 strength reduction candidate.
12440
12441 asan-globals
12442 Enable buffer overflow detection for global objects. This kind
12443 of protection is enabled by default if you are using
12444 -fsanitize=address option. To disable global objects
12445 protection use --param asan-globals=0.
12446
12447 asan-stack
12448 Enable buffer overflow detection for stack objects. This kind
12449 of protection is enabled by default when using
12450 -fsanitize=address. To disable stack protection use --param
12451 asan-stack=0 option.
12452
12453 asan-instrument-reads
12454 Enable buffer overflow detection for memory reads. This kind
12455 of protection is enabled by default when using
12456 -fsanitize=address. To disable memory reads protection use
12457 --param asan-instrument-reads=0.
12458
12459 asan-instrument-writes
12460 Enable buffer overflow detection for memory writes. This kind
12461 of protection is enabled by default when using
12462 -fsanitize=address. To disable memory writes protection use
12463 --param asan-instrument-writes=0 option.
12464
12465 asan-memintrin
12466 Enable detection for built-in functions. This kind of
12467 protection is enabled by default when using -fsanitize=address.
12468 To disable built-in functions protection use --param
12469 asan-memintrin=0.
12470
12471 asan-use-after-return
12472 Enable detection of use-after-return. This kind of protection
12473 is enabled by default when using the -fsanitize=address option.
12474 To disable it use --param asan-use-after-return=0.
12475
12476 Note: By default the check is disabled at run time. To enable
12477 it, add "detect_stack_use_after_return=1" to the environment
12478 variable ASAN_OPTIONS.
12479
12480 asan-instrumentation-with-call-threshold
12481 If number of memory accesses in function being instrumented is
12482 greater or equal to this number, use callbacks instead of
12483 inline checks. E.g. to disable inline code use --param
12484 asan-instrumentation-with-call-threshold=0.
12485
12486 hwasan-instrument-stack
12487 Enable hwasan instrumentation of statically sized stack-
12488 allocated variables. This kind of instrumentation is enabled
12489 by default when using -fsanitize=hwaddress and disabled by
12490 default when using -fsanitize=kernel-hwaddress. To disable
12491 stack instrumentation use --param hwasan-instrument-stack=0,
12492 and to enable it use --param hwasan-instrument-stack=1.
12493
12494 hwasan-random-frame-tag
12495 When using stack instrumentation, decide tags for stack
12496 variables using a deterministic sequence beginning at a random
12497 tag for each frame. With this parameter unset tags are chosen
12498 using the same sequence but beginning from 1. This is enabled
12499 by default for -fsanitize=hwaddress and unavailable for
12500 -fsanitize=kernel-hwaddress. To disable it use --param
12501 hwasan-random-frame-tag=0.
12502
12503 hwasan-instrument-allocas
12504 Enable hwasan instrumentation of dynamically sized stack-
12505 allocated variables. This kind of instrumentation is enabled
12506 by default when using -fsanitize=hwaddress and disabled by
12507 default when using -fsanitize=kernel-hwaddress. To disable
12508 instrumentation of such variables use --param
12509 hwasan-instrument-allocas=0, and to enable it use --param
12510 hwasan-instrument-allocas=1.
12511
12512 hwasan-instrument-reads
12513 Enable hwasan checks on memory reads. Instrumentation of reads
12514 is enabled by default for both -fsanitize=hwaddress and
12515 -fsanitize=kernel-hwaddress. To disable checking memory reads
12516 use --param hwasan-instrument-reads=0.
12517
12518 hwasan-instrument-writes
12519 Enable hwasan checks on memory writes. Instrumentation of
12520 writes is enabled by default for both -fsanitize=hwaddress and
12521 -fsanitize=kernel-hwaddress. To disable checking memory writes
12522 use --param hwasan-instrument-writes=0.
12523
12524 hwasan-instrument-mem-intrinsics
12525 Enable hwasan instrumentation of builtin functions.
12526 Instrumentation of these builtin functions is enabled by
12527 default for both -fsanitize=hwaddress and
12528 -fsanitize=kernel-hwaddress. To disable instrumentation of
12529 builtin functions use --param
12530 hwasan-instrument-mem-intrinsics=0.
12531
12532 use-after-scope-direct-emission-threshold
12533 If the size of a local variable in bytes is smaller or equal to
12534 this number, directly poison (or unpoison) shadow memory
12535 instead of using run-time callbacks.
12536
12537 tsan-distinguish-volatile
12538 Emit special instrumentation for accesses to volatiles.
12539
12540 tsan-instrument-func-entry-exit
12541 Emit instrumentation calls to __tsan_func_entry() and
12542 __tsan_func_exit().
12543
12544 max-fsm-thread-path-insns
12545 Maximum number of instructions to copy when duplicating blocks
12546 on a finite state automaton jump thread path.
12547
12548 max-fsm-thread-length
12549 Maximum number of basic blocks on a jump thread path.
12550
12551 threader-debug
12552 threader-debug=[none|all] Enables verbose dumping of the
12553 threader solver.
12554
12555 parloops-chunk-size
12556 Chunk size of omp schedule for loops parallelized by parloops.
12557
12558 parloops-schedule
12559 Schedule type of omp schedule for loops parallelized by
12560 parloops (static, dynamic, guided, auto, runtime).
12561
12562 parloops-min-per-thread
12563 The minimum number of iterations per thread of an innermost
12564 parallelized loop for which the parallelized variant is
12565 preferred over the single threaded one. Note that for a
12566 parallelized loop nest the minimum number of iterations of the
12567 outermost loop per thread is two.
12568
12569 max-ssa-name-query-depth
12570 Maximum depth of recursion when querying properties of SSA
12571 names in things like fold routines. One level of recursion
12572 corresponds to following a use-def chain.
12573
12574 max-speculative-devirt-maydefs
12575 The maximum number of may-defs we analyze when looking for a
12576 must-def specifying the dynamic type of an object that invokes
12577 a virtual call we may be able to devirtualize speculatively.
12578
12579 max-vrp-switch-assertions
12580 The maximum number of assertions to add along the default edge
12581 of a switch statement during VRP.
12582
12583 evrp-sparse-threshold
12584 Maximum number of basic blocks before EVRP uses a sparse cache.
12585
12586 evrp-mode
12587 Specifies the mode Early VRP should operate in.
12588
12589 vrp1-mode
12590 Specifies the mode VRP pass 1 should operate in.
12591
12592 vrp2-mode
12593 Specifies the mode VRP pass 2 should operate in.
12594
12595 ranger-debug
12596 Specifies the type of debug output to be issued for ranges.
12597
12598 evrp-switch-limit
12599 Specifies the maximum number of switch cases before EVRP
12600 ignores a switch.
12601
12602 unroll-jam-min-percent
12603 The minimum percentage of memory references that must be
12604 optimized away for the unroll-and-jam transformation to be
12605 considered profitable.
12606
12607 unroll-jam-max-unroll
12608 The maximum number of times the outer loop should be unrolled
12609 by the unroll-and-jam transformation.
12610
12611 max-rtl-if-conversion-unpredictable-cost
12612 Maximum permissible cost for the sequence that would be
12613 generated by the RTL if-conversion pass for a branch that is
12614 considered unpredictable.
12615
12616 max-variable-expansions-in-unroller
12617 If -fvariable-expansion-in-unroller is used, the maximum number
12618 of times that an individual variable will be expanded during
12619 loop unrolling.
12620
12621 partial-inlining-entry-probability
12622 Maximum probability of the entry BB of split region (in percent
12623 relative to entry BB of the function) to make partial inlining
12624 happen.
12625
12626 max-tracked-strlens
12627 Maximum number of strings for which strlen optimization pass
12628 will track string lengths.
12629
12630 gcse-after-reload-partial-fraction
12631 The threshold ratio for performing partial redundancy
12632 elimination after reload.
12633
12634 gcse-after-reload-critical-fraction
12635 The threshold ratio of critical edges execution count that
12636 permit performing redundancy elimination after reload.
12637
12638 max-loop-header-insns
12639 The maximum number of insns in loop header duplicated by the
12640 copy loop headers pass.
12641
12642 vect-epilogues-nomask
12643 Enable loop epilogue vectorization using smaller vector size.
12644
12645 vect-partial-vector-usage
12646 Controls when the loop vectorizer considers using partial
12647 vector loads and stores as an alternative to falling back to
12648 scalar code. 0 stops the vectorizer from ever using partial
12649 vector loads and stores. 1 allows partial vector loads and
12650 stores if vectorization removes the need for the code to
12651 iterate. 2 allows partial vector loads and stores in all
12652 loops. The parameter only has an effect on targets that
12653 support partial vector loads and stores.
12654
12655 vect-inner-loop-cost-factor
12656 The maximum factor which the loop vectorizer applies to the
12657 cost of statements in an inner loop relative to the loop being
12658 vectorized. The factor applied is the maximum of the estimated
12659 number of iterations of the inner loop and this parameter. The
12660 default value of this parameter is 50.
12661
12662 vect-induction-float
12663 Enable loop vectorization of floating point inductions.
12664
12665 avoid-fma-max-bits
12666 Maximum number of bits for which we avoid creating FMAs.
12667
12668 sms-loop-average-count-threshold
12669 A threshold on the average loop count considered by the swing
12670 modulo scheduler.
12671
12672 sms-dfa-history
12673 The number of cycles the swing modulo scheduler considers when
12674 checking conflicts using DFA.
12675
12676 graphite-allow-codegen-errors
12677 Whether codegen errors should be ICEs when -fchecking.
12678
12679 sms-max-ii-factor
12680 A factor for tuning the upper bound that swing modulo scheduler
12681 uses for scheduling a loop.
12682
12683 lra-max-considered-reload-pseudos
12684 The max number of reload pseudos which are considered during
12685 spilling a non-reload pseudo.
12686
12687 max-pow-sqrt-depth
12688 Maximum depth of sqrt chains to use when synthesizing
12689 exponentiation by a real constant.
12690
12691 max-dse-active-local-stores
12692 Maximum number of active local stores in RTL dead store
12693 elimination.
12694
12695 asan-instrument-allocas
12696 Enable asan allocas/VLAs protection.
12697
12698 max-iterations-computation-cost
12699 Bound on the cost of an expression to compute the number of
12700 iterations.
12701
12702 max-isl-operations
12703 Maximum number of isl operations, 0 means unlimited.
12704
12705 graphite-max-arrays-per-scop
12706 Maximum number of arrays per scop.
12707
12708 max-vartrack-reverse-op-size
12709 Max. size of loc list for which reverse ops should be added.
12710
12711 fsm-scale-path-stmts
12712 Scale factor to apply to the number of statements in a
12713 threading path when comparing to the number of (scaled) blocks.
12714
12715 uninit-control-dep-attempts
12716 Maximum number of nested calls to search for control
12717 dependencies during uninitialized variable analysis.
12718
12719 fsm-scale-path-blocks
12720 Scale factor to apply to the number of blocks in a threading
12721 path when comparing to the number of (scaled) statements.
12722
12723 sched-autopref-queue-depth
12724 Hardware autoprefetcher scheduler model control flag. Number
12725 of lookahead cycles the model looks into; at ' ' only enable
12726 instruction sorting heuristic.
12727
12728 loop-versioning-max-inner-insns
12729 The maximum number of instructions that an inner loop can have
12730 before the loop versioning pass considers it too big to copy.
12731
12732 loop-versioning-max-outer-insns
12733 The maximum number of instructions that an outer loop can have
12734 before the loop versioning pass considers it too big to copy,
12735 discounting any instructions in inner loops that directly
12736 benefit from versioning.
12737
12738 ssa-name-def-chain-limit
12739 The maximum number of SSA_NAME assignments to follow in
12740 determining a property of a variable such as its value. This
12741 limits the number of iterations or recursive calls GCC performs
12742 when optimizing certain statements or when determining their
12743 validity prior to issuing diagnostics.
12744
12745 store-merging-max-size
12746 Maximum size of a single store merging region in bytes.
12747
12748 hash-table-verification-limit
12749 The number of elements for which hash table verification is
12750 done for each searched element.
12751
12752 max-find-base-term-values
12753 Maximum number of VALUEs handled during a single find_base_term
12754 call.
12755
12756 analyzer-max-enodes-per-program-point
12757 The maximum number of exploded nodes per program point within
12758 the analyzer, before terminating analysis of that point.
12759
12760 analyzer-max-constraints
12761 The maximum number of constraints per state.
12762
12763 analyzer-min-snodes-for-call-summary
12764 The minimum number of supernodes within a function for the
12765 analyzer to consider summarizing its effects at call sites.
12766
12767 analyzer-max-enodes-for-full-dump
12768 The maximum depth of exploded nodes that should appear in a dot
12769 dump before switching to a less verbose format.
12770
12771 analyzer-max-recursion-depth
12772 The maximum number of times a callsite can appear in a call
12773 stack within the analyzer, before terminating analysis of a
12774 call that would recurse deeper.
12775
12776 analyzer-max-svalue-depth
12777 The maximum depth of a symbolic value, before approximating the
12778 value as unknown.
12779
12780 analyzer-max-infeasible-edges
12781 The maximum number of infeasible edges to reject before
12782 declaring a diagnostic as infeasible.
12783
12784 gimple-fe-computed-hot-bb-threshold
12785 The number of executions of a basic block which is considered
12786 hot. The parameter is used only in GIMPLE FE.
12787
12788 analyzer-bb-explosion-factor
12789 The maximum number of 'after supernode' exploded nodes within
12790 the analyzer per supernode, before terminating analysis.
12791
12792 ranger-logical-depth
12793 Maximum depth of logical expression evaluation ranger will look
12794 through when evaluating outgoing edge ranges.
12795
12796 relation-block-limit
12797 Maximum number of relations the oracle will register in a basic
12798 block.
12799
12800 min-pagesize
12801 Minimum page size for warning purposes.
12802
12803 openacc-kernels
12804 Specify mode of OpenACC `kernels' constructs handling. With
12805 --param=openacc-kernels=decompose, OpenACC `kernels' constructs
12806 are decomposed into parts, a sequence of compute constructs,
12807 each then handled individually. This is work in progress.
12808 With --param=openacc-kernels=parloops, OpenACC `kernels'
12809 constructs are handled by the parloops pass, en bloc. This is
12810 the current default.
12811
12812 openacc-privatization
12813 Specify mode of OpenACC privatization diagnostics for
12814 -fopt-info-omp-note and applicable -fdump-tree-*-details. With
12815 --param=openacc-privatization=quiet, don't diagnose. This is
12816 the current default. With --param=openacc-privatization=noisy,
12817 do diagnose.
12818
12819 The following choices of name are available on AArch64 targets:
12820
12821 aarch64-sve-compare-costs
12822 When vectorizing for SVE, consider using "unpacked" vectors for
12823 smaller elements and use the cost model to pick the cheapest
12824 approach. Also use the cost model to choose between SVE and
12825 Advanced SIMD vectorization.
12826
12827 Using unpacked vectors includes storing smaller elements in
12828 larger containers and accessing elements with extending loads
12829 and truncating stores.
12830
12831 aarch64-float-recp-precision
12832 The number of Newton iterations for calculating the reciprocal
12833 for float type. The precision of division is proportional to
12834 this param when division approximation is enabled. The default
12835 value is 1.
12836
12837 aarch64-double-recp-precision
12838 The number of Newton iterations for calculating the reciprocal
12839 for double type. The precision of division is propotional to
12840 this param when division approximation is enabled. The default
12841 value is 2.
12842
12843 aarch64-autovec-preference
12844 Force an ISA selection strategy for auto-vectorization.
12845 Accepts values from 0 to 4, inclusive.
12846
12847 0 Use the default heuristics.
12848
12849 1 Use only Advanced SIMD for auto-vectorization.
12850
12851 2 Use only SVE for auto-vectorization.
12852
12853 3 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when
12854 the costs are deemed equal.
12855
12856 4 Use both Advanced SIMD and SVE. Prefer SVE when the costs
12857 are deemed equal.
12858
12859 The default value is 0.
12860
12861 aarch64-loop-vect-issue-rate-niters
12862 The tuning for some AArch64 CPUs tries to take both latencies
12863 and issue rates into account when deciding whether a loop
12864 should be vectorized using SVE, vectorized using Advanced SIMD,
12865 or not vectorized at all. If this parameter is set to n, GCC
12866 will not use this heuristic for loops that are known to execute
12867 in fewer than n Advanced SIMD iterations.
12868
12869 aarch64-vect-unroll-limit
12870 The vectorizer will use available tuning information to
12871 determine whether it would be beneficial to unroll the main
12872 vectorized loop and by how much. This parameter set's the
12873 upper bound of how much the vectorizer will unroll the main
12874 loop. The default value is four.
12875
12876 The following choices of name are available on i386 and x86_64
12877 targets:
12878
12879 x86-stlf-window-ninsns
12880 Instructions number above which STFL stall penalty can be
12881 compensated.
12882
12883 Program Instrumentation Options
12884 GCC supports a number of command-line options that control adding run-
12885 time instrumentation to the code it normally generates. For example,
12886 one purpose of instrumentation is collect profiling statistics for use
12887 in finding program hot spots, code coverage analysis, or profile-guided
12888 optimizations. Another class of program instrumentation is adding run-
12889 time checking to detect programming errors like invalid pointer
12890 dereferences or out-of-bounds array accesses, as well as deliberately
12891 hostile attacks such as stack smashing or C++ vtable hijacking. There
12892 is also a general hook which can be used to implement other forms of
12893 tracing or function-level instrumentation for debug or program analysis
12894 purposes.
12895
12896 -p
12897 -pg Generate extra code to write profile information suitable for the
12898 analysis program prof (for -p) or gprof (for -pg). You must use
12899 this option when compiling the source files you want data about,
12900 and you must also use it when linking.
12901
12902 You can use the function attribute "no_instrument_function" to
12903 suppress profiling of individual functions when compiling with
12904 these options.
12905
12906 -fprofile-arcs
12907 Add code so that program flow arcs are instrumented. During
12908 execution the program records how many times each branch and call
12909 is executed and how many times it is taken or returns. On targets
12910 that support constructors with priority support, profiling properly
12911 handles constructors, destructors and C++ constructors (and
12912 destructors) of classes which are used as a type of a global
12913 variable.
12914
12915 When the compiled program exits it saves this data to a file called
12916 auxname.gcda for each source file. The data may be used for
12917 profile-directed optimizations (-fbranch-probabilities), or for
12918 test coverage analysis (-ftest-coverage). Each object file's
12919 auxname is generated from the name of the output file, if
12920 explicitly specified and it is not the final executable, otherwise
12921 it is the basename of the source file. In both cases any suffix is
12922 removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda
12923 for output file specified as -o dir/foo.o).
12924
12925 Note that if a command line directly links source files, the
12926 corresponding .gcda files will be prefixed with the unsuffixed name
12927 of the output file. E.g. "gcc a.c b.c -o binary" would generate
12928 binary-a.gcda and binary-b.gcda files.
12929
12930 --coverage
12931 This option is used to compile and link code instrumented for
12932 coverage analysis. The option is a synonym for -fprofile-arcs
12933 -ftest-coverage (when compiling) and -lgcov (when linking). See
12934 the documentation for those options for more details.
12935
12936 * Compile the source files with -fprofile-arcs plus optimization
12937 and code generation options. For test coverage analysis, use
12938 the additional -ftest-coverage option. You do not need to
12939 profile every source file in a program.
12940
12941 * Compile the source files additionally with -fprofile-abs-path
12942 to create absolute path names in the .gcno files. This allows
12943 gcov to find the correct sources in projects where compilations
12944 occur with different working directories.
12945
12946 * Link your object files with -lgcov or -fprofile-arcs (the
12947 latter implies the former).
12948
12949 * Run the program on a representative workload to generate the
12950 arc profile information. This may be repeated any number of
12951 times. You can run concurrent instances of your program, and
12952 provided that the file system supports locking, the data files
12953 will be correctly updated. Unless a strict ISO C dialect
12954 option is in effect, "fork" calls are detected and correctly
12955 handled without double counting.
12956
12957 Moreover, an object file can be recompiled multiple times and
12958 the corresponding .gcda file merges as long as the source file
12959 and the compiler options are unchanged.
12960
12961 * For profile-directed optimizations, compile the source files
12962 again with the same optimization and code generation options
12963 plus -fbranch-probabilities.
12964
12965 * For test coverage analysis, use gcov to produce human readable
12966 information from the .gcno and .gcda files. Refer to the gcov
12967 documentation for further information.
12968
12969 With -fprofile-arcs, for each function of your program GCC creates
12970 a program flow graph, then finds a spanning tree for the graph.
12971 Only arcs that are not on the spanning tree have to be
12972 instrumented: the compiler adds code to count the number of times
12973 that these arcs are executed. When an arc is the only exit or only
12974 entrance to a block, the instrumentation code can be added to the
12975 block; otherwise, a new basic block must be created to hold the
12976 instrumentation code.
12977
12978 -ftest-coverage
12979 Produce a notes file that the gcov code-coverage utility can use to
12980 show program coverage. Each source file's note file is called
12981 auxname.gcno. Refer to the -fprofile-arcs option above for a
12982 description of auxname and instructions on how to generate test
12983 coverage data. Coverage data matches the source files more closely
12984 if you do not optimize.
12985
12986 -fprofile-abs-path
12987 Automatically convert relative source file names to absolute path
12988 names in the .gcno files. This allows gcov to find the correct
12989 sources in projects where compilations occur with different working
12990 directories.
12991
12992 -fprofile-dir=path
12993 Set the directory to search for the profile data files in to path.
12994 This option affects only the profile data generated by
12995 -fprofile-generate, -ftest-coverage, -fprofile-arcs and used by
12996 -fprofile-use and -fbranch-probabilities and its related options.
12997 Both absolute and relative paths can be used. By default, GCC uses
12998 the current directory as path, thus the profile data file appears
12999 in the same directory as the object file. In order to prevent the
13000 file name clashing, if the object file name is not an absolute
13001 path, we mangle the absolute path of the sourcename.gcda file and
13002 use it as the file name of a .gcda file. See details about the
13003 file naming in -fprofile-arcs. See similar option -fprofile-note.
13004
13005 When an executable is run in a massive parallel environment, it is
13006 recommended to save profile to different folders. That can be done
13007 with variables in path that are exported during run-time:
13008
13009 %p process ID.
13010
13011 %q{VAR}
13012 value of environment variable VAR
13013
13014 -fprofile-generate
13015 -fprofile-generate=path
13016 Enable options usually used for instrumenting application to
13017 produce profile useful for later recompilation with profile
13018 feedback based optimization. You must use -fprofile-generate both
13019 when compiling and when linking your program.
13020
13021 The following options are enabled: -fprofile-arcs,
13022 -fprofile-values, -finline-functions, and -fipa-bit-cp.
13023
13024 If path is specified, GCC looks at the path to find the profile
13025 feedback data files. See -fprofile-dir.
13026
13027 To optimize the program based on the collected profile information,
13028 use -fprofile-use.
13029
13030 -fprofile-info-section
13031 -fprofile-info-section=name
13032 Register the profile information in the specified section instead
13033 of using a constructor/destructor. The section name is name if it
13034 is specified, otherwise the section name defaults to ".gcov_info".
13035 A pointer to the profile information generated by -fprofile-arcs is
13036 placed in the specified section for each translation unit. This
13037 option disables the profile information registration through a
13038 constructor and it disables the profile information processing
13039 through a destructor. This option is not intended to be used in
13040 hosted environments such as GNU/Linux. It targets free-standing
13041 environments (for example embedded systems) with limited resources
13042 which do not support constructors/destructors or the C library file
13043 I/O.
13044
13045 The linker could collect the input sections in a continuous memory
13046 block and define start and end symbols. A GNU linker script
13047 example which defines a linker output section follows:
13048
13049 .gcov_info :
13050 {
13051 PROVIDE (__gcov_info_start = .);
13052 KEEP (*(.gcov_info))
13053 PROVIDE (__gcov_info_end = .);
13054 }
13055
13056 The program could dump the profiling information registered in this
13057 linker set for example like this:
13058
13059 #include <gcov.h>
13060 #include <stdio.h>
13061 #include <stdlib.h>
13062
13063 extern const struct gcov_info *__gcov_info_start[];
13064 extern const struct gcov_info *__gcov_info_end[];
13065
13066 static void
13067 filename (const char *f, void *arg)
13068 {
13069 puts (f);
13070 }
13071
13072 static void
13073 dump (const void *d, unsigned n, void *arg)
13074 {
13075 const unsigned char *c = d;
13076
13077 for (unsigned i = 0; i < n; ++i)
13078 printf ("%02x", c[i]);
13079 }
13080
13081 static void *
13082 allocate (unsigned length, void *arg)
13083 {
13084 return malloc (length);
13085 }
13086
13087 static void
13088 dump_gcov_info (void)
13089 {
13090 const struct gcov_info **info = __gcov_info_start;
13091 const struct gcov_info **end = __gcov_info_end;
13092
13093 /* Obfuscate variable to prevent compiler optimizations. */
13094 __asm__ ("" : "+r" (info));
13095
13096 while (info != end)
13097 {
13098 void *arg = NULL;
13099 __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
13100 putchar ('\n');
13101 ++info;
13102 }
13103 }
13104
13105 int
13106 main()
13107 {
13108 dump_gcov_info();
13109 return 0;
13110 }
13111
13112 -fprofile-note=path
13113 If path is specified, GCC saves .gcno file into path location. If
13114 you combine the option with multiple source files, the .gcno file
13115 will be overwritten.
13116
13117 -fprofile-prefix-path=path
13118 This option can be used in combination with
13119 profile-generate=profile_dir and profile-use=profile_dir to inform
13120 GCC where is the base directory of built source tree. By default
13121 profile_dir will contain files with mangled absolute paths of all
13122 object files in the built project. This is not desirable when
13123 directory used to build the instrumented binary differs from the
13124 directory used to build the binary optimized with profile feedback
13125 because the profile data will not be found during the optimized
13126 build. In such setups -fprofile-prefix-path=path with path
13127 pointing to the base directory of the build can be used to strip
13128 the irrelevant part of the path and keep all file names relative to
13129 the main build directory.
13130
13131 -fprofile-prefix-map=old=new
13132 When compiling files residing in directory old, record profiling
13133 information (with --coverage) describing them as if the files
13134 resided in directory new instead. See also -ffile-prefix-map.
13135
13136 -fprofile-update=method
13137 Alter the update method for an application instrumented for profile
13138 feedback based optimization. The method argument should be one of
13139 single, atomic or prefer-atomic. The first one is useful for
13140 single-threaded applications, while the second one prevents profile
13141 corruption by emitting thread-safe code.
13142
13143 Warning: When an application does not properly join all threads (or
13144 creates an detached thread), a profile file can be still corrupted.
13145
13146 Using prefer-atomic would be transformed either to atomic, when
13147 supported by a target, or to single otherwise. The GCC driver
13148 automatically selects prefer-atomic when -pthread is present in the
13149 command line.
13150
13151 -fprofile-filter-files=regex
13152 Instrument only functions from files whose name matches any of the
13153 regular expressions (separated by semi-colons).
13154
13155 For example, -fprofile-filter-files=main\.c;module.*\.c will
13156 instrument only main.c and all C files starting with 'module'.
13157
13158 -fprofile-exclude-files=regex
13159 Instrument only functions from files whose name does not match any
13160 of the regular expressions (separated by semi-colons).
13161
13162 For example, -fprofile-exclude-files=/usr/.* will prevent
13163 instrumentation of all files that are located in the /usr/ folder.
13164
13165 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
13166 Control level of reproducibility of profile gathered by
13167 "-fprofile-generate". This makes it possible to rebuild program
13168 with same outcome which is useful, for example, for distribution
13169 packages.
13170
13171 With -fprofile-reproducible=serial the profile gathered by
13172 -fprofile-generate is reproducible provided the trained program
13173 behaves the same at each invocation of the train run, it is not
13174 multi-threaded and profile data streaming is always done in the
13175 same order. Note that profile streaming happens at the end of
13176 program run but also before "fork" function is invoked.
13177
13178 Note that it is quite common that execution counts of some part of
13179 programs depends, for example, on length of temporary file names or
13180 memory space randomization (that may affect hash-table collision
13181 rate). Such non-reproducible part of programs may be annotated by
13182 "no_instrument_function" function attribute. gcov-dump with -l can
13183 be used to dump gathered data and verify that they are indeed
13184 reproducible.
13185
13186 With -fprofile-reproducible=parallel-runs collected profile stays
13187 reproducible regardless the order of streaming of the data into
13188 gcda files. This setting makes it possible to run multiple
13189 instances of instrumented program in parallel (such as with "make
13190 -j"). This reduces quality of gathered data, in particular of
13191 indirect call profiling.
13192
13193 -fsanitize=address
13194 Enable AddressSanitizer, a fast memory error detector. Memory
13195 access instructions are instrumented to detect out-of-bounds and
13196 use-after-free bugs. The option enables
13197 -fsanitize-address-use-after-scope. See
13198 <https://github.com/google/sanitizers/wiki/AddressSanitizer> for
13199 more details. The run-time behavior can be influenced using the
13200 ASAN_OPTIONS environment variable. When set to "help=1", the
13201 available options are shown at startup of the instrumented program.
13202 See
13203 <https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags>
13204 for a list of supported options. The option cannot be combined
13205 with -fsanitize=thread or -fsanitize=hwaddress. Note that the only
13206 target -fsanitize=hwaddress is currently supported on is AArch64.
13207
13208 -fsanitize=kernel-address
13209 Enable AddressSanitizer for Linux kernel. See
13210 <https://github.com/google/kasan> for more details.
13211
13212 -fsanitize=hwaddress
13213 Enable Hardware-assisted AddressSanitizer, which uses a hardware
13214 ability to ignore the top byte of a pointer to allow the detection
13215 of memory errors with a low memory overhead. Memory access
13216 instructions are instrumented to detect out-of-bounds and use-
13217 after-free bugs. The option enables
13218 -fsanitize-address-use-after-scope. See
13219 <https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html>
13220 for more details. The run-time behavior can be influenced using
13221 the HWASAN_OPTIONS environment variable. When set to "help=1", the
13222 available options are shown at startup of the instrumented program.
13223 The option cannot be combined with -fsanitize=thread or
13224 -fsanitize=address, and is currently only available on AArch64.
13225
13226 -fsanitize=kernel-hwaddress
13227 Enable Hardware-assisted AddressSanitizer for compilation of the
13228 Linux kernel. Similar to -fsanitize=kernel-address but using an
13229 alternate instrumentation method, and similar to
13230 -fsanitize=hwaddress but with instrumentation differences necessary
13231 for compiling the Linux kernel. These differences are to avoid
13232 hwasan library initialization calls and to account for the stack
13233 pointer having a different value in its top byte.
13234
13235 Note: This option has different defaults to the
13236 -fsanitize=hwaddress. Instrumenting the stack and alloca calls are
13237 not on by default but are still possible by specifying the command-
13238 line options --param hwasan-instrument-stack=1 and --param
13239 hwasan-instrument-allocas=1 respectively. Using a random frame tag
13240 is not implemented for kernel instrumentation.
13241
13242 -fsanitize=pointer-compare
13243 Instrument comparison operation (<, <=, >, >=) with pointer
13244 operands. The option must be combined with either
13245 -fsanitize=kernel-address or -fsanitize=address The option cannot
13246 be combined with -fsanitize=thread. Note: By default the check is
13247 disabled at run time. To enable it, add
13248 "detect_invalid_pointer_pairs=2" to the environment variable
13249 ASAN_OPTIONS. Using "detect_invalid_pointer_pairs=1" detects
13250 invalid operation only when both pointers are non-null.
13251
13252 -fsanitize=pointer-subtract
13253 Instrument subtraction with pointer operands. The option must be
13254 combined with either -fsanitize=kernel-address or
13255 -fsanitize=address The option cannot be combined with
13256 -fsanitize=thread. Note: By default the check is disabled at run
13257 time. To enable it, add "detect_invalid_pointer_pairs=2" to the
13258 environment variable ASAN_OPTIONS. Using
13259 "detect_invalid_pointer_pairs=1" detects invalid operation only
13260 when both pointers are non-null.
13261
13262 -fsanitize=shadow-call-stack
13263 Enable ShadowCallStack, a security enhancement mechanism used to
13264 protect programs against return address overwrites (e.g. stack
13265 buffer overflows.) It works by saving a function's return address
13266 to a separately allocated shadow call stack in the function
13267 prologue and restoring the return address from the shadow call
13268 stack in the function epilogue. Instrumentation only occurs in
13269 functions that need to save the return address to the stack.
13270
13271 Currently it only supports the aarch64 platform. It is
13272 specifically designed for linux kernels that enable the
13273 CONFIG_SHADOW_CALL_STACK option. For the user space programs,
13274 runtime support is not currently provided in libc and libgcc.
13275 Users who want to use this feature in user space need to provide
13276 their own support for the runtime. It should be noted that this
13277 may cause the ABI rules to be broken.
13278
13279 On aarch64, the instrumentation makes use of the platform register
13280 "x18". This generally means that any code that may run on the same
13281 thread as code compiled with ShadowCallStack must be compiled with
13282 the flag -ffixed-x18, otherwise functions compiled without
13283 -ffixed-x18 might clobber "x18" and so corrupt the shadow stack
13284 pointer.
13285
13286 Also, because there is no userspace runtime support, code compiled
13287 with ShadowCallStack cannot use exception handling. Use
13288 -fno-exceptions to turn off exceptions.
13289
13290 See <https://clang.llvm.org/docs/ShadowCallStack.html> for more
13291 details.
13292
13293 -fsanitize=thread
13294 Enable ThreadSanitizer, a fast data race detector. Memory access
13295 instructions are instrumented to detect data race bugs. See
13296 <https://github.com/google/sanitizers/wiki#threadsanitizer> for
13297 more details. The run-time behavior can be influenced using the
13298 TSAN_OPTIONS environment variable; see
13299 <https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags>
13300 for a list of supported options. The option cannot be combined
13301 with -fsanitize=address, -fsanitize=leak.
13302
13303 Note that sanitized atomic builtins cannot throw exceptions when
13304 operating on invalid memory addresses with non-call exceptions
13305 (-fnon-call-exceptions).
13306
13307 -fsanitize=leak
13308 Enable LeakSanitizer, a memory leak detector. This option only
13309 matters for linking of executables and the executable is linked
13310 against a library that overrides "malloc" and other allocator
13311 functions. See
13312 <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
13313 for more details. The run-time behavior can be influenced using
13314 the LSAN_OPTIONS environment variable. The option cannot be
13315 combined with -fsanitize=thread.
13316
13317 -fsanitize=undefined
13318 Enable UndefinedBehaviorSanitizer, a fast undefined behavior
13319 detector. Various computations are instrumented to detect
13320 undefined behavior at runtime. See
13321 <https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html> for
13322 more details. The run-time behavior can be influenced using the
13323 UBSAN_OPTIONS environment variable. Current suboptions are:
13324
13325 -fsanitize=shift
13326 This option enables checking that the result of a shift
13327 operation is not undefined. Note that what exactly is
13328 considered undefined differs slightly between C and C++, as
13329 well as between ISO C90 and C99, etc. This option has two
13330 suboptions, -fsanitize=shift-base and
13331 -fsanitize=shift-exponent.
13332
13333 -fsanitize=shift-exponent
13334 This option enables checking that the second argument of a
13335 shift operation is not negative and is smaller than the
13336 precision of the promoted first argument.
13337
13338 -fsanitize=shift-base
13339 If the second argument of a shift operation is within range,
13340 check that the result of a shift operation is not undefined.
13341 Note that what exactly is considered undefined differs slightly
13342 between C and C++, as well as between ISO C90 and C99, etc.
13343
13344 -fsanitize=integer-divide-by-zero
13345 Detect integer division by zero.
13346
13347 -fsanitize=unreachable
13348 With this option, the compiler turns the
13349 "__builtin_unreachable" call into a diagnostics message call
13350 instead. When reaching the "__builtin_unreachable" call, the
13351 behavior is undefined.
13352
13353 -fsanitize=vla-bound
13354 This option instructs the compiler to check that the size of a
13355 variable length array is positive.
13356
13357 -fsanitize=null
13358 This option enables pointer checking. Particularly, the
13359 application built with this option turned on will issue an
13360 error message when it tries to dereference a NULL pointer, or
13361 if a reference (possibly an rvalue reference) is bound to a
13362 NULL pointer, or if a method is invoked on an object pointed by
13363 a NULL pointer.
13364
13365 -fsanitize=return
13366 This option enables return statement checking. Programs built
13367 with this option turned on will issue an error message when the
13368 end of a non-void function is reached without actually
13369 returning a value. This option works in C++ only.
13370
13371 -fsanitize=signed-integer-overflow
13372 This option enables signed integer overflow checking. We check
13373 that the result of "+", "*", and both unary and binary "-" does
13374 not overflow in the signed arithmetics. This also detects
13375 "INT_MIN / -1" signed division. Note, integer promotion rules
13376 must be taken into account. That is, the following is not an
13377 overflow:
13378
13379 signed char a = SCHAR_MAX;
13380 a++;
13381
13382 -fsanitize=bounds
13383 This option enables instrumentation of array bounds. Various
13384 out of bounds accesses are detected. Flexible array members,
13385 flexible array member-like arrays, and initializers of
13386 variables with static storage are not instrumented.
13387
13388 -fsanitize=bounds-strict
13389 This option enables strict instrumentation of array bounds.
13390 Most out of bounds accesses are detected, including flexible
13391 array members and flexible array member-like arrays.
13392 Initializers of variables with static storage are not
13393 instrumented.
13394
13395 -fsanitize=alignment
13396 This option enables checking of alignment of pointers when they
13397 are dereferenced, or when a reference is bound to
13398 insufficiently aligned target, or when a method or constructor
13399 is invoked on insufficiently aligned object.
13400
13401 -fsanitize=object-size
13402 This option enables instrumentation of memory references using
13403 the "__builtin_object_size" function. Various out of bounds
13404 pointer accesses are detected.
13405
13406 -fsanitize=float-divide-by-zero
13407 Detect floating-point division by zero. Unlike other similar
13408 options, -fsanitize=float-divide-by-zero is not enabled by
13409 -fsanitize=undefined, since floating-point division by zero can
13410 be a legitimate way of obtaining infinities and NaNs.
13411
13412 -fsanitize=float-cast-overflow
13413 This option enables floating-point type to integer conversion
13414 checking. We check that the result of the conversion does not
13415 overflow. Unlike other similar options,
13416 -fsanitize=float-cast-overflow is not enabled by
13417 -fsanitize=undefined. This option does not work well with
13418 "FE_INVALID" exceptions enabled.
13419
13420 -fsanitize=nonnull-attribute
13421 This option enables instrumentation of calls, checking whether
13422 null values are not passed to arguments marked as requiring a
13423 non-null value by the "nonnull" function attribute.
13424
13425 -fsanitize=returns-nonnull-attribute
13426 This option enables instrumentation of return statements in
13427 functions marked with "returns_nonnull" function attribute, to
13428 detect returning of null values from such functions.
13429
13430 -fsanitize=bool
13431 This option enables instrumentation of loads from bool. If a
13432 value other than 0/1 is loaded, a run-time error is issued.
13433
13434 -fsanitize=enum
13435 This option enables instrumentation of loads from an enum type.
13436 If a value outside the range of values for the enum type is
13437 loaded, a run-time error is issued.
13438
13439 -fsanitize=vptr
13440 This option enables instrumentation of C++ member function
13441 calls, member accesses and some conversions between pointers to
13442 base and derived classes, to verify the referenced object has
13443 the correct dynamic type.
13444
13445 -fsanitize=pointer-overflow
13446 This option enables instrumentation of pointer arithmetics. If
13447 the pointer arithmetics overflows, a run-time error is issued.
13448
13449 -fsanitize=builtin
13450 This option enables instrumentation of arguments to selected
13451 builtin functions. If an invalid value is passed to such
13452 arguments, a run-time error is issued. E.g. passing 0 as the
13453 argument to "__builtin_ctz" or "__builtin_clz" invokes
13454 undefined behavior and is diagnosed by this option.
13455
13456 While -ftrapv causes traps for signed overflows to be emitted,
13457 -fsanitize=undefined gives a diagnostic message. This currently
13458 works only for the C family of languages.
13459
13460 -fno-sanitize=all
13461 This option disables all previously enabled sanitizers.
13462 -fsanitize=all is not allowed, as some sanitizers cannot be used
13463 together.
13464
13465 -fasan-shadow-offset=number
13466 This option forces GCC to use custom shadow offset in
13467 AddressSanitizer checks. It is useful for experimenting with
13468 different shadow memory layouts in Kernel AddressSanitizer.
13469
13470 -fsanitize-sections=s1,s2,...
13471 Sanitize global variables in selected user-defined sections. si
13472 may contain wildcards.
13473
13474 -fsanitize-recover[=opts]
13475 -fsanitize-recover= controls error recovery mode for sanitizers
13476 mentioned in comma-separated list of opts. Enabling this option
13477 for a sanitizer component causes it to attempt to continue running
13478 the program as if no error happened. This means multiple runtime
13479 errors can be reported in a single program run, and the exit code
13480 of the program may indicate success even when errors have been
13481 reported. The -fno-sanitize-recover= option can be used to alter
13482 this behavior: only the first detected error is reported and
13483 program then exits with a non-zero exit code.
13484
13485 Currently this feature only works for -fsanitize=undefined (and its
13486 suboptions except for -fsanitize=unreachable and
13487 -fsanitize=return), -fsanitize=float-cast-overflow,
13488 -fsanitize=float-divide-by-zero, -fsanitize=bounds-strict,
13489 -fsanitize=kernel-address and -fsanitize=address. For these
13490 sanitizers error recovery is turned on by default, except
13491 -fsanitize=address, for which this feature is experimental.
13492 -fsanitize-recover=all and -fno-sanitize-recover=all is also
13493 accepted, the former enables recovery for all sanitizers that
13494 support it, the latter disables recovery for all sanitizers that
13495 support it.
13496
13497 Even if a recovery mode is turned on the compiler side, it needs to
13498 be also enabled on the runtime library side, otherwise the failures
13499 are still fatal. The runtime library defaults to "halt_on_error=0"
13500 for ThreadSanitizer and UndefinedBehaviorSanitizer, while default
13501 value for AddressSanitizer is "halt_on_error=1". This can be
13502 overridden through setting the "halt_on_error" flag in the
13503 corresponding environment variable.
13504
13505 Syntax without an explicit opts parameter is deprecated. It is
13506 equivalent to specifying an opts list of:
13507
13508 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
13509
13510 -fsanitize-address-use-after-scope
13511 Enable sanitization of local variables to detect use-after-scope
13512 bugs. The option sets -fstack-reuse to none.
13513
13514 -fsanitize-undefined-trap-on-error
13515 The -fsanitize-undefined-trap-on-error option instructs the
13516 compiler to report undefined behavior using "__builtin_trap" rather
13517 than a "libubsan" library routine. The advantage of this is that
13518 the "libubsan" library is not needed and is not linked in, so this
13519 is usable even in freestanding environments.
13520
13521 -fsanitize-coverage=trace-pc
13522 Enable coverage-guided fuzzing code instrumentation. Inserts a
13523 call to "__sanitizer_cov_trace_pc" into every basic block.
13524
13525 -fsanitize-coverage=trace-cmp
13526 Enable dataflow guided fuzzing code instrumentation. Inserts a
13527 call to "__sanitizer_cov_trace_cmp1", "__sanitizer_cov_trace_cmp2",
13528 "__sanitizer_cov_trace_cmp4" or "__sanitizer_cov_trace_cmp8" for
13529 integral comparison with both operands variable or
13530 "__sanitizer_cov_trace_const_cmp1",
13531 "__sanitizer_cov_trace_const_cmp2",
13532 "__sanitizer_cov_trace_const_cmp4" or
13533 "__sanitizer_cov_trace_const_cmp8" for integral comparison with one
13534 operand constant, "__sanitizer_cov_trace_cmpf" or
13535 "__sanitizer_cov_trace_cmpd" for float or double comparisons and
13536 "__sanitizer_cov_trace_switch" for switch statements.
13537
13538 -fcf-protection=[full|branch|return|none|check]
13539 Enable code instrumentation of control-flow transfers to increase
13540 program security by checking that target addresses of control-flow
13541 transfer instructions (such as indirect function call, function
13542 return, indirect jump) are valid. This prevents diverting the flow
13543 of control to an unexpected target. This is intended to protect
13544 against such threats as Return-oriented Programming (ROP), and
13545 similarly call/jmp-oriented programming (COP/JOP).
13546
13547 The value "branch" tells the compiler to implement checking of
13548 validity of control-flow transfer at the point of indirect branch
13549 instructions, i.e. call/jmp instructions. The value "return"
13550 implements checking of validity at the point of returning from a
13551 function. The value "full" is an alias for specifying both
13552 "branch" and "return". The value "none" turns off instrumentation.
13553
13554 The value "check" is used for the final link with link-time
13555 optimization (LTO). An error is issued if LTO object files are
13556 compiled with different -fcf-protection values. The value "check"
13557 is ignored at the compile time.
13558
13559 The macro "__CET__" is defined when -fcf-protection is used. The
13560 first bit of "__CET__" is set to 1 for the value "branch" and the
13561 second bit of "__CET__" is set to 1 for the "return".
13562
13563 You can also use the "nocf_check" attribute to identify which
13564 functions and calls should be skipped from instrumentation.
13565
13566 Currently the x86 GNU/Linux target provides an implementation based
13567 on Intel Control-flow Enforcement Technology (CET) which works for
13568 i686 processor or newer.
13569
13570 -fharden-compares
13571 For every logical test that survives gimple optimizations and is
13572 not the condition in a conditional branch (for example, conditions
13573 tested for conditional moves, or to store in boolean variables),
13574 emit extra code to compute and verify the reversed condition, and
13575 to call "__builtin_trap" if the results do not match. Use with
13576 -fharden-conditional-branches to cover all conditionals.
13577
13578 -fharden-conditional-branches
13579 For every non-vectorized conditional branch that survives gimple
13580 optimizations, emit extra code to compute and verify the reversed
13581 condition, and to call "__builtin_trap" if the result is
13582 unexpected. Use with -fharden-compares to cover all conditionals.
13583
13584 -fstack-protector
13585 Emit extra code to check for buffer overflows, such as stack
13586 smashing attacks. This is done by adding a guard variable to
13587 functions with vulnerable objects. This includes functions that
13588 call "alloca", and functions with buffers larger than or equal to 8
13589 bytes. The guards are initialized when a function is entered and
13590 then checked when the function exits. If a guard check fails, an
13591 error message is printed and the program exits. Only variables
13592 that are actually allocated on the stack are considered, optimized
13593 away variables or variables allocated in registers don't count.
13594
13595 -fstack-protector-all
13596 Like -fstack-protector except that all functions are protected.
13597
13598 -fstack-protector-strong
13599 Like -fstack-protector but includes additional functions to be
13600 protected --- those that have local array definitions, or have
13601 references to local frame addresses. Only variables that are
13602 actually allocated on the stack are considered, optimized away
13603 variables or variables allocated in registers don't count.
13604
13605 -fstack-protector-explicit
13606 Like -fstack-protector but only protects those functions which have
13607 the "stack_protect" attribute.
13608
13609 -fstack-check
13610 Generate code to verify that you do not go beyond the boundary of
13611 the stack. You should specify this flag if you are running in an
13612 environment with multiple threads, but you only rarely need to
13613 specify it in a single-threaded environment since stack overflow is
13614 automatically detected on nearly all systems if there is only one
13615 stack.
13616
13617 Note that this switch does not actually cause checking to be done;
13618 the operating system or the language runtime must do that. The
13619 switch causes generation of code to ensure that they see the stack
13620 being extended.
13621
13622 You can additionally specify a string parameter: no means no
13623 checking, generic means force the use of old-style checking,
13624 specific means use the best checking method and is equivalent to
13625 bare -fstack-check.
13626
13627 Old-style checking is a generic mechanism that requires no specific
13628 target support in the compiler but comes with the following
13629 drawbacks:
13630
13631 1. Modified allocation strategy for large objects: they are always
13632 allocated dynamically if their size exceeds a fixed threshold.
13633 Note this may change the semantics of some code.
13634
13635 2. Fixed limit on the size of the static frame of functions: when
13636 it is topped by a particular function, stack checking is not
13637 reliable and a warning is issued by the compiler.
13638
13639 3. Inefficiency: because of both the modified allocation strategy
13640 and the generic implementation, code performance is hampered.
13641
13642 Note that old-style stack checking is also the fallback method for
13643 specific if no target support has been added in the compiler.
13644
13645 -fstack-check= is designed for Ada's needs to detect infinite
13646 recursion and stack overflows. specific is an excellent choice
13647 when compiling Ada code. It is not generally sufficient to protect
13648 against stack-clash attacks. To protect against those you want
13649 -fstack-clash-protection.
13650
13651 -fstack-clash-protection
13652 Generate code to prevent stack clash style attacks. When this
13653 option is enabled, the compiler will only allocate one page of
13654 stack space at a time and each page is accessed immediately after
13655 allocation. Thus, it prevents allocations from jumping over any
13656 stack guard page provided by the operating system.
13657
13658 Most targets do not fully support stack clash protection. However,
13659 on those targets -fstack-clash-protection will protect dynamic
13660 stack allocations. -fstack-clash-protection may also provide
13661 limited protection for static stack allocations if the target
13662 supports -fstack-check=specific.
13663
13664 -fstack-limit-register=reg
13665 -fstack-limit-symbol=sym
13666 -fno-stack-limit
13667 Generate code to ensure that the stack does not grow beyond a
13668 certain value, either the value of a register or the address of a
13669 symbol. If a larger stack is required, a signal is raised at run
13670 time. For most targets, the signal is raised before the stack
13671 overruns the boundary, so it is possible to catch the signal
13672 without taking special precautions.
13673
13674 For instance, if the stack starts at absolute address 0x80000000
13675 and grows downwards, you can use the flags
13676 -fstack-limit-symbol=__stack_limit and
13677 -Wl,--defsym,__stack_limit=0x7ffe0000 to enforce a stack limit of
13678 128KB. Note that this may only work with the GNU linker.
13679
13680 You can locally override stack limit checking by using the
13681 "no_stack_limit" function attribute.
13682
13683 -fsplit-stack
13684 Generate code to automatically split the stack before it overflows.
13685 The resulting program has a discontiguous stack which can only
13686 overflow if the program is unable to allocate any more memory.
13687 This is most useful when running threaded programs, as it is no
13688 longer necessary to calculate a good stack size to use for each
13689 thread. This is currently only implemented for the x86 targets
13690 running GNU/Linux.
13691
13692 When code compiled with -fsplit-stack calls code compiled without
13693 -fsplit-stack, there may not be much stack space available for the
13694 latter code to run. If compiling all code, including library code,
13695 with -fsplit-stack is not an option, then the linker can fix up
13696 these calls so that the code compiled without -fsplit-stack always
13697 has a large stack. Support for this is implemented in the gold
13698 linker in GNU binutils release 2.21 and later.
13699
13700 -fvtable-verify=[std|preinit|none]
13701 This option is only available when compiling C++ code. It turns on
13702 (or off, if using -fvtable-verify=none) the security feature that
13703 verifies at run time, for every virtual call, that the vtable
13704 pointer through which the call is made is valid for the type of the
13705 object, and has not been corrupted or overwritten. If an invalid
13706 vtable pointer is detected at run time, an error is reported and
13707 execution of the program is immediately halted.
13708
13709 This option causes run-time data structures to be built at program
13710 startup, which are used for verifying the vtable pointers. The
13711 options std and preinit control the timing of when these data
13712 structures are built. In both cases the data structures are built
13713 before execution reaches "main". Using -fvtable-verify=std causes
13714 the data structures to be built after shared libraries have been
13715 loaded and initialized. -fvtable-verify=preinit causes them to be
13716 built before shared libraries have been loaded and initialized.
13717
13718 If this option appears multiple times in the command line with
13719 different values specified, none takes highest priority over both
13720 std and preinit; preinit takes priority over std.
13721
13722 -fvtv-debug
13723 When used in conjunction with -fvtable-verify=std or
13724 -fvtable-verify=preinit, causes debug versions of the runtime
13725 functions for the vtable verification feature to be called. This
13726 flag also causes the compiler to log information about which vtable
13727 pointers it finds for each class. This information is written to a
13728 file named vtv_set_ptr_data.log in the directory named by the
13729 environment variable VTV_LOGS_DIR if that is defined or the current
13730 working directory otherwise.
13731
13732 Note: This feature appends data to the log file. If you want a
13733 fresh log file, be sure to delete any existing one.
13734
13735 -fvtv-counts
13736 This is a debugging flag. When used in conjunction with
13737 -fvtable-verify=std or -fvtable-verify=preinit, this causes the
13738 compiler to keep track of the total number of virtual calls it
13739 encounters and the number of verifications it inserts. It also
13740 counts the number of calls to certain run-time library functions
13741 that it inserts and logs this information for each compilation
13742 unit. The compiler writes this information to a file named
13743 vtv_count_data.log in the directory named by the environment
13744 variable VTV_LOGS_DIR if that is defined or the current working
13745 directory otherwise. It also counts the size of the vtable pointer
13746 sets for each class, and writes this information to
13747 vtv_class_set_sizes.log in the same directory.
13748
13749 Note: This feature appends data to the log files. To get fresh
13750 log files, be sure to delete any existing ones.
13751
13752 -finstrument-functions
13753 Generate instrumentation calls for entry and exit to functions.
13754 Just after function entry and just before function exit, the
13755 following profiling functions are called with the address of the
13756 current function and its call site. (On some platforms,
13757 "__builtin_return_address" does not work beyond the current
13758 function, so the call site information may not be available to the
13759 profiling functions otherwise.)
13760
13761 void __cyg_profile_func_enter (void *this_fn,
13762 void *call_site);
13763 void __cyg_profile_func_exit (void *this_fn,
13764 void *call_site);
13765
13766 The first argument is the address of the start of the current
13767 function, which may be looked up exactly in the symbol table.
13768
13769 This instrumentation is also done for functions expanded inline in
13770 other functions. The profiling calls indicate where, conceptually,
13771 the inline function is entered and exited. This means that
13772 addressable versions of such functions must be available. If all
13773 your uses of a function are expanded inline, this may mean an
13774 additional expansion of code size. If you use "extern inline" in
13775 your C code, an addressable version of such functions must be
13776 provided. (This is normally the case anyway, but if you get lucky
13777 and the optimizer always expands the functions inline, you might
13778 have gotten away without providing static copies.)
13779
13780 A function may be given the attribute "no_instrument_function", in
13781 which case this instrumentation is not done. This can be used, for
13782 example, for the profiling functions listed above, high-priority
13783 interrupt routines, and any functions from which the profiling
13784 functions cannot safely be called (perhaps signal handlers, if the
13785 profiling routines generate output or allocate memory).
13786
13787 -finstrument-functions-exclude-file-list=file,file,...
13788 Set the list of functions that are excluded from instrumentation
13789 (see the description of -finstrument-functions). If the file that
13790 contains a function definition matches with one of file, then that
13791 function is not instrumented. The match is done on substrings: if
13792 the file parameter is a substring of the file name, it is
13793 considered to be a match.
13794
13795 For example:
13796
13797 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13798
13799 excludes any inline function defined in files whose pathnames
13800 contain /bits/stl or include/sys.
13801
13802 If, for some reason, you want to include letter , in one of sym,
13803 write ,. For example,
13804 -finstrument-functions-exclude-file-list=',,tmp' (note the single
13805 quote surrounding the option).
13806
13807 -finstrument-functions-exclude-function-list=sym,sym,...
13808 This is similar to -finstrument-functions-exclude-file-list, but
13809 this option sets the list of function names to be excluded from
13810 instrumentation. The function name to be matched is its user-
13811 visible name, such as "vector<int> blah(const vector<int> &)", not
13812 the internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The
13813 match is done on substrings: if the sym parameter is a substring of
13814 the function name, it is considered to be a match. For C99 and C++
13815 extended identifiers, the function name must be given in UTF-8, not
13816 using universal character names.
13817
13818 -fpatchable-function-entry=N[,M]
13819 Generate N NOPs right at the beginning of each function, with the
13820 function entry point before the Mth NOP. If M is omitted, it
13821 defaults to 0 so the function entry points to the address just at
13822 the first NOP. The NOP instructions reserve extra space which can
13823 be used to patch in any desired instrumentation at run time,
13824 provided that the code segment is writable. The amount of space is
13825 controllable indirectly via the number of NOPs; the NOP instruction
13826 used corresponds to the instruction emitted by the internal GCC
13827 back-end interface "gen_nop". This behavior is target-specific and
13828 may also depend on the architecture variant and/or other
13829 compilation options.
13830
13831 For run-time identification, the starting addresses of these areas,
13832 which correspond to their respective function entries minus M, are
13833 additionally collected in the "__patchable_function_entries"
13834 section of the resulting binary.
13835
13836 Note that the value of "__attribute__ ((patchable_function_entry
13837 (N,M)))" takes precedence over command-line option
13838 -fpatchable-function-entry=N,M. This can be used to increase the
13839 area size or to remove it completely on a single function. If
13840 "N=0", no pad location is recorded.
13841
13842 The NOP instructions are inserted at---and maybe before, depending
13843 on M---the function entry address, even before the prologue.
13844
13845 The maximum value of N and M is 65535.
13846
13847 Options Controlling the Preprocessor
13848 These options control the C preprocessor, which is run on each C source
13849 file before actual compilation.
13850
13851 If you use the -E option, nothing is done except preprocessing. Some
13852 of these options make sense only together with -E because they cause
13853 the preprocessor output to be unsuitable for actual compilation.
13854
13855 In addition to the options listed here, there are a number of options
13856 to control search paths for include files documented in Directory
13857 Options. Options to control preprocessor diagnostics are listed in
13858 Warning Options.
13859
13860 -D name
13861 Predefine name as a macro, with definition 1.
13862
13863 -D name=definition
13864 The contents of definition are tokenized and processed as if they
13865 appeared during translation phase three in a #define directive. In
13866 particular, the definition is truncated by embedded newline
13867 characters.
13868
13869 If you are invoking the preprocessor from a shell or shell-like
13870 program you may need to use the shell's quoting syntax to protect
13871 characters such as spaces that have a meaning in the shell syntax.
13872
13873 If you wish to define a function-like macro on the command line,
13874 write its argument list with surrounding parentheses before the
13875 equals sign (if any). Parentheses are meaningful to most shells,
13876 so you should quote the option. With sh and csh,
13877 -D'name(args...)=definition' works.
13878
13879 -D and -U options are processed in the order they are given on the
13880 command line. All -imacros file and -include file options are
13881 processed after all -D and -U options.
13882
13883 -U name
13884 Cancel any previous definition of name, either built in or provided
13885 with a -D option.
13886
13887 -include file
13888 Process file as if "#include "file"" appeared as the first line of
13889 the primary source file. However, the first directory searched for
13890 file is the preprocessor's working directory instead of the
13891 directory containing the main source file. If not found there, it
13892 is searched for in the remainder of the "#include "..."" search
13893 chain as normal.
13894
13895 If multiple -include options are given, the files are included in
13896 the order they appear on the command line.
13897
13898 -imacros file
13899 Exactly like -include, except that any output produced by scanning
13900 file is thrown away. Macros it defines remain defined. This
13901 allows you to acquire all the macros from a header without also
13902 processing its declarations.
13903
13904 All files specified by -imacros are processed before all files
13905 specified by -include.
13906
13907 -undef
13908 Do not predefine any system-specific or GCC-specific macros. The
13909 standard predefined macros remain defined.
13910
13911 -pthread
13912 Define additional macros required for using the POSIX threads
13913 library. You should use this option consistently for both
13914 compilation and linking. This option is supported on GNU/Linux
13915 targets, most other Unix derivatives, and also on x86 Cygwin and
13916 MinGW targets.
13917
13918 -M Instead of outputting the result of preprocessing, output a rule
13919 suitable for make describing the dependencies of the main source
13920 file. The preprocessor outputs one make rule containing the object
13921 file name for that source file, a colon, and the names of all the
13922 included files, including those coming from -include or -imacros
13923 command-line options.
13924
13925 Unless specified explicitly (with -MT or -MQ), the object file name
13926 consists of the name of the source file with any suffix replaced
13927 with object file suffix and with any leading directory parts
13928 removed. If there are many included files then the rule is split
13929 into several lines using \-newline. The rule has no commands.
13930
13931 This option does not suppress the preprocessor's debug output, such
13932 as -dM. To avoid mixing such debug output with the dependency
13933 rules you should explicitly specify the dependency output file with
13934 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
13935 Debug output is still sent to the regular output stream as normal.
13936
13937 Passing -M to the driver implies -E, and suppresses warnings with
13938 an implicit -w.
13939
13940 -MM Like -M but do not mention header files that are found in system
13941 header directories, nor header files that are included, directly or
13942 indirectly, from such a header.
13943
13944 This implies that the choice of angle brackets or double quotes in
13945 an #include directive does not in itself determine whether that
13946 header appears in -MM dependency output.
13947
13948 -MF file
13949 When used with -M or -MM, specifies a file to write the
13950 dependencies to. If no -MF switch is given the preprocessor sends
13951 the rules to the same place it would send preprocessed output.
13952
13953 When used with the driver options -MD or -MMD, -MF overrides the
13954 default dependency output file.
13955
13956 If file is -, then the dependencies are written to stdout.
13957
13958 -MG In conjunction with an option such as -M requesting dependency
13959 generation, -MG assumes missing header files are generated files
13960 and adds them to the dependency list without raising an error. The
13961 dependency filename is taken directly from the "#include" directive
13962 without prepending any path. -MG also suppresses preprocessed
13963 output, as a missing header file renders this useless.
13964
13965 This feature is used in automatic updating of makefiles.
13966
13967 -Mno-modules
13968 Disable dependency generation for compiled module interfaces.
13969
13970 -MP This option instructs CPP to add a phony target for each dependency
13971 other than the main file, causing each to depend on nothing. These
13972 dummy rules work around errors make gives if you remove header
13973 files without updating the Makefile to match.
13974
13975 This is typical output:
13976
13977 test.o: test.c test.h
13978
13979 test.h:
13980
13981 -MT target
13982 Change the target of the rule emitted by dependency generation. By
13983 default CPP takes the name of the main input file, deletes any
13984 directory components and any file suffix such as .c, and appends
13985 the platform's usual object suffix. The result is the target.
13986
13987 An -MT option sets the target to be exactly the string you specify.
13988 If you want multiple targets, you can specify them as a single
13989 argument to -MT, or use multiple -MT options.
13990
13991 For example, -MT '$(objpfx)foo.o' might give
13992
13993 $(objpfx)foo.o: foo.c
13994
13995 -MQ target
13996 Same as -MT, but it quotes any characters which are special to
13997 Make. -MQ '$(objpfx)foo.o' gives
13998
13999 $$(objpfx)foo.o: foo.c
14000
14001 The default target is automatically quoted, as if it were given
14002 with -MQ.
14003
14004 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
14005 The driver determines file based on whether an -o option is given.
14006 If it is, the driver uses its argument but with a suffix of .d,
14007 otherwise it takes the name of the input file, removes any
14008 directory components and suffix, and applies a .d suffix.
14009
14010 If -MD is used in conjunction with -E, any -o switch is understood
14011 to specify the dependency output file, but if used without -E, each
14012 -o is understood to specify a target object file.
14013
14014 Since -E is not implied, -MD can be used to generate a dependency
14015 output file as a side effect of the compilation process.
14016
14017 -MMD
14018 Like -MD except mention only user header files, not system header
14019 files.
14020
14021 -fpreprocessed
14022 Indicate to the preprocessor that the input file has already been
14023 preprocessed. This suppresses things like macro expansion,
14024 trigraph conversion, escaped newline splicing, and processing of
14025 most directives. The preprocessor still recognizes and removes
14026 comments, so that you can pass a file preprocessed with -C to the
14027 compiler without problems. In this mode the integrated
14028 preprocessor is little more than a tokenizer for the front ends.
14029
14030 -fpreprocessed is implicit if the input file has one of the
14031 extensions .i, .ii or .mi. These are the extensions that GCC uses
14032 for preprocessed files created by -save-temps.
14033
14034 -fdirectives-only
14035 When preprocessing, handle directives, but do not expand macros.
14036
14037 The option's behavior depends on the -E and -fpreprocessed options.
14038
14039 With -E, preprocessing is limited to the handling of directives
14040 such as "#define", "#ifdef", and "#error". Other preprocessor
14041 operations, such as macro expansion and trigraph conversion are not
14042 performed. In addition, the -dD option is implicitly enabled.
14043
14044 With -fpreprocessed, predefinition of command line and most builtin
14045 macros is disabled. Macros such as "__LINE__", which are
14046 contextually dependent, are handled normally. This enables
14047 compilation of files previously preprocessed with "-E
14048 -fdirectives-only".
14049
14050 With both -E and -fpreprocessed, the rules for -fpreprocessed take
14051 precedence. This enables full preprocessing of files previously
14052 preprocessed with "-E -fdirectives-only".
14053
14054 -fdollars-in-identifiers
14055 Accept $ in identifiers.
14056
14057 -fextended-identifiers
14058 Accept universal character names and extended characters in
14059 identifiers. This option is enabled by default for C99 (and later
14060 C standard versions) and C++.
14061
14062 -fno-canonical-system-headers
14063 When preprocessing, do not shorten system header paths with
14064 canonicalization.
14065
14066 -fmax-include-depth=depth
14067 Set the maximum depth of the nested #include. The default is 200.
14068
14069 -ftabstop=width
14070 Set the distance between tab stops. This helps the preprocessor
14071 report correct column numbers in warnings or errors, even if tabs
14072 appear on the line. If the value is less than 1 or greater than
14073 100, the option is ignored. The default is 8.
14074
14075 -ftrack-macro-expansion[=level]
14076 Track locations of tokens across macro expansions. This allows the
14077 compiler to emit diagnostic about the current macro expansion stack
14078 when a compilation error occurs in a macro expansion. Using this
14079 option makes the preprocessor and the compiler consume more memory.
14080 The level parameter can be used to choose the level of precision of
14081 token location tracking thus decreasing the memory consumption if
14082 necessary. Value 0 of level de-activates this option. Value 1
14083 tracks tokens locations in a degraded mode for the sake of minimal
14084 memory overhead. In this mode all tokens resulting from the
14085 expansion of an argument of a function-like macro have the same
14086 location. Value 2 tracks tokens locations completely. This value is
14087 the most memory hungry. When this option is given no argument, the
14088 default parameter value is 2.
14089
14090 Note that "-ftrack-macro-expansion=2" is activated by default.
14091
14092 -fmacro-prefix-map=old=new
14093 When preprocessing files residing in directory old, expand the
14094 "__FILE__" and "__BASE_FILE__" macros as if the files resided in
14095 directory new instead. This can be used to change an absolute path
14096 to a relative path by using . for new which can result in more
14097 reproducible builds that are location independent. This option
14098 also affects "__builtin_FILE()" during compilation. See also
14099 -ffile-prefix-map.
14100
14101 -fexec-charset=charset
14102 Set the execution character set, used for string and character
14103 constants. The default is UTF-8. charset can be any encoding
14104 supported by the system's "iconv" library routine.
14105
14106 -fwide-exec-charset=charset
14107 Set the wide execution character set, used for wide string and
14108 character constants. The default is UTF-32 or UTF-16, whichever
14109 corresponds to the width of "wchar_t". As with -fexec-charset,
14110 charset can be any encoding supported by the system's "iconv"
14111 library routine; however, you will have problems with encodings
14112 that do not fit exactly in "wchar_t".
14113
14114 -finput-charset=charset
14115 Set the input character set, used for translation from the
14116 character set of the input file to the source character set used by
14117 GCC. If the locale does not specify, or GCC cannot get this
14118 information from the locale, the default is UTF-8. This can be
14119 overridden by either the locale or this command-line option.
14120 Currently the command-line option takes precedence if there's a
14121 conflict. charset can be any encoding supported by the system's
14122 "iconv" library routine.
14123
14124 -fpch-deps
14125 When using precompiled headers, this flag causes the dependency-
14126 output flags to also list the files from the precompiled header's
14127 dependencies. If not specified, only the precompiled header are
14128 listed and not the files that were used to create it, because those
14129 files are not consulted when a precompiled header is used.
14130
14131 -fpch-preprocess
14132 This option allows use of a precompiled header together with -E.
14133 It inserts a special "#pragma", "#pragma GCC pch_preprocess
14134 "filename"" in the output to mark the place where the precompiled
14135 header was found, and its filename. When -fpreprocessed is in use,
14136 GCC recognizes this "#pragma" and loads the PCH.
14137
14138 This option is off by default, because the resulting preprocessed
14139 output is only really suitable as input to GCC. It is switched on
14140 by -save-temps.
14141
14142 You should not write this "#pragma" in your own code, but it is
14143 safe to edit the filename if the PCH file is available in a
14144 different location. The filename may be absolute or it may be
14145 relative to GCC's current directory.
14146
14147 -fworking-directory
14148 Enable generation of linemarkers in the preprocessor output that
14149 let the compiler know the current working directory at the time of
14150 preprocessing. When this option is enabled, the preprocessor
14151 emits, after the initial linemarker, a second linemarker with the
14152 current working directory followed by two slashes. GCC uses this
14153 directory, when it's present in the preprocessed input, as the
14154 directory emitted as the current working directory in some
14155 debugging information formats. This option is implicitly enabled
14156 if debugging information is enabled, but this can be inhibited with
14157 the negated form -fno-working-directory. If the -P flag is present
14158 in the command line, this option has no effect, since no "#line"
14159 directives are emitted whatsoever.
14160
14161 -A predicate=answer
14162 Make an assertion with the predicate predicate and answer answer.
14163 This form is preferred to the older form -A predicate(answer),
14164 which is still supported, because it does not use shell special
14165 characters.
14166
14167 -A -predicate=answer
14168 Cancel an assertion with the predicate predicate and answer answer.
14169
14170 -C Do not discard comments. All comments are passed through to the
14171 output file, except for comments in processed directives, which are
14172 deleted along with the directive.
14173
14174 You should be prepared for side effects when using -C; it causes
14175 the preprocessor to treat comments as tokens in their own right.
14176 For example, comments appearing at the start of what would be a
14177 directive line have the effect of turning that line into an
14178 ordinary source line, since the first token on the line is no
14179 longer a #.
14180
14181 -CC Do not discard comments, including during macro expansion. This is
14182 like -C, except that comments contained within macros are also
14183 passed through to the output file where the macro is expanded.
14184
14185 In addition to the side effects of the -C option, the -CC option
14186 causes all C++-style comments inside a macro to be converted to
14187 C-style comments. This is to prevent later use of that macro from
14188 inadvertently commenting out the remainder of the source line.
14189
14190 The -CC option is generally used to support lint comments.
14191
14192 -P Inhibit generation of linemarkers in the output from the
14193 preprocessor. This might be useful when running the preprocessor
14194 on something that is not C code, and will be sent to a program
14195 which might be confused by the linemarkers.
14196
14197 -traditional
14198 -traditional-cpp
14199 Try to imitate the behavior of pre-standard C preprocessors, as
14200 opposed to ISO C preprocessors. See the GNU CPP manual for
14201 details.
14202
14203 Note that GCC does not otherwise attempt to emulate a pre-standard
14204 C compiler, and these options are only supported with the -E
14205 switch, or when invoking CPP explicitly.
14206
14207 -trigraphs
14208 Support ISO C trigraphs. These are three-character sequences, all
14209 starting with ??, that are defined by ISO C to stand for single
14210 characters. For example, ??/ stands for \, so '??/n' is a
14211 character constant for a newline.
14212
14213 The nine trigraphs and their replacements are
14214
14215 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
14216 Replacement: [ ] { } # \ ^ | ~
14217
14218 By default, GCC ignores trigraphs, but in standard-conforming modes
14219 it converts them. See the -std and -ansi options.
14220
14221 -remap
14222 Enable special code to work around file systems which only permit
14223 very short file names, such as MS-DOS.
14224
14225 -H Print the name of each header file used, in addition to other
14226 normal activities. Each name is indented to show how deep in the
14227 #include stack it is. Precompiled header files are also printed,
14228 even if they are found to be invalid; an invalid precompiled header
14229 file is printed with ...x and a valid one with ...! .
14230
14231 -dletters
14232 Says to make debugging dumps during compilation as specified by
14233 letters. The flags documented here are those relevant to the
14234 preprocessor. Other letters are interpreted by the compiler
14235 proper, or reserved for future versions of GCC, and so are silently
14236 ignored. If you specify letters whose behavior conflicts, the
14237 result is undefined.
14238
14239 -dM Instead of the normal output, generate a list of #define
14240 directives for all the macros defined during the execution of
14241 the preprocessor, including predefined macros. This gives you
14242 a way of finding out what is predefined in your version of the
14243 preprocessor. Assuming you have no file foo.h, the command
14244
14245 touch foo.h; cpp -dM foo.h
14246
14247 shows all the predefined macros.
14248
14249 If you use -dM without the -E option, -dM is interpreted as a
14250 synonym for -fdump-rtl-mach.
14251
14252 -dD Like -dM except in two respects: it does not include the
14253 predefined macros, and it outputs both the #define directives
14254 and the result of preprocessing. Both kinds of output go to
14255 the standard output file.
14256
14257 -dN Like -dD, but emit only the macro names, not their expansions.
14258
14259 -dI Output #include directives in addition to the result of
14260 preprocessing.
14261
14262 -dU Like -dD except that only macros that are expanded, or whose
14263 definedness is tested in preprocessor directives, are output;
14264 the output is delayed until the use or test of the macro; and
14265 #undef directives are also output for macros tested but
14266 undefined at the time.
14267
14268 -fdebug-cpp
14269 This option is only useful for debugging GCC. When used from CPP
14270 or with -E, it dumps debugging information about location maps.
14271 Every token in the output is preceded by the dump of the map its
14272 location belongs to.
14273
14274 When used from GCC without -E, this option has no effect.
14275
14276 -Wp,option
14277 You can use -Wp,option to bypass the compiler driver and pass
14278 option directly through to the preprocessor. If option contains
14279 commas, it is split into multiple options at the commas. However,
14280 many options are modified, translated or interpreted by the
14281 compiler driver before being passed to the preprocessor, and -Wp
14282 forcibly bypasses this phase. The preprocessor's direct interface
14283 is undocumented and subject to change, so whenever possible you
14284 should avoid using -Wp and let the driver handle the options
14285 instead.
14286
14287 -Xpreprocessor option
14288 Pass option as an option to the preprocessor. You can use this to
14289 supply system-specific preprocessor options that GCC does not
14290 recognize.
14291
14292 If you want to pass an option that takes an argument, you must use
14293 -Xpreprocessor twice, once for the option and once for the
14294 argument.
14295
14296 -no-integrated-cpp
14297 Perform preprocessing as a separate pass before compilation. By
14298 default, GCC performs preprocessing as an integrated part of input
14299 tokenization and parsing. If this option is provided, the
14300 appropriate language front end (cc1, cc1plus, or cc1obj for C, C++,
14301 and Objective-C, respectively) is instead invoked twice, once for
14302 preprocessing only and once for actual compilation of the
14303 preprocessed input. This option may be useful in conjunction with
14304 the -B or -wrapper options to specify an alternate preprocessor or
14305 perform additional processing of the program source between normal
14306 preprocessing and compilation.
14307
14308 -flarge-source-files
14309 Adjust GCC to expect large source files, at the expense of slower
14310 compilation and higher memory usage.
14311
14312 Specifically, GCC normally tracks both column numbers and line
14313 numbers within source files and it normally prints both of these
14314 numbers in diagnostics. However, once it has processed a certain
14315 number of source lines, it stops tracking column numbers and only
14316 tracks line numbers. This means that diagnostics for later lines
14317 do not include column numbers. It also means that options like
14318 -Wmisleading-indentation cease to work at that point, although the
14319 compiler prints a note if this happens. Passing
14320 -flarge-source-files significantly increases the number of source
14321 lines that GCC can process before it stops tracking columns.
14322
14323 Passing Options to the Assembler
14324 You can pass options to the assembler.
14325
14326 -Wa,option
14327 Pass option as an option to the assembler. If option contains
14328 commas, it is split into multiple options at the commas.
14329
14330 -Xassembler option
14331 Pass option as an option to the assembler. You can use this to
14332 supply system-specific assembler options that GCC does not
14333 recognize.
14334
14335 If you want to pass an option that takes an argument, you must use
14336 -Xassembler twice, once for the option and once for the argument.
14337
14338 Options for Linking
14339 These options come into play when the compiler links object files into
14340 an executable output file. They are meaningless if the compiler is not
14341 doing a link step.
14342
14343 object-file-name
14344 A file name that does not end in a special recognized suffix is
14345 considered to name an object file or library. (Object files are
14346 distinguished from libraries by the linker according to the file
14347 contents.) If linking is done, these object files are used as
14348 input to the linker.
14349
14350 -c
14351 -S
14352 -E If any of these options is used, then the linker is not run, and
14353 object file names should not be used as arguments.
14354
14355 -flinker-output=type
14356 This option controls code generation of the link-time optimizer.
14357 By default the linker output is automatically determined by the
14358 linker plugin. For debugging the compiler and if incremental
14359 linking with a non-LTO object file is desired, it may be useful to
14360 control the type manually.
14361
14362 If type is exec, code generation produces a static binary. In this
14363 case -fpic and -fpie are both disabled.
14364
14365 If type is dyn, code generation produces a shared library. In this
14366 case -fpic or -fPIC is preserved, but not enabled automatically.
14367 This allows to build shared libraries without position-independent
14368 code on architectures where this is possible, i.e. on x86.
14369
14370 If type is pie, code generation produces an -fpie executable. This
14371 results in similar optimizations as exec except that -fpie is not
14372 disabled if specified at compilation time.
14373
14374 If type is rel, the compiler assumes that incremental linking is
14375 done. The sections containing intermediate code for link-time
14376 optimization are merged, pre-optimized, and output to the resulting
14377 object file. In addition, if -ffat-lto-objects is specified, binary
14378 code is produced for future non-LTO linking. The object file
14379 produced by incremental linking is smaller than a static library
14380 produced from the same object files. At link time the result of
14381 incremental linking also loads faster than a static library
14382 assuming that the majority of objects in the library are used.
14383
14384 Finally nolto-rel configures the compiler for incremental linking
14385 where code generation is forced, a final binary is produced, and
14386 the intermediate code for later link-time optimization is stripped.
14387 When multiple object files are linked together the resulting code
14388 is better optimized than with link-time optimizations disabled (for
14389 example, cross-module inlining happens), but most of benefits of
14390 whole program optimizations are lost.
14391
14392 During the incremental link (by -r) the linker plugin defaults to
14393 rel. With current interfaces to GNU Binutils it is however not
14394 possible to incrementally link LTO objects and non-LTO objects into
14395 a single mixed object file. If any of object files in incremental
14396 link cannot be used for link-time optimization, the linker plugin
14397 issues a warning and uses nolto-rel. To maintain whole program
14398 optimization, it is recommended to link such objects into static
14399 library instead. Alternatively it is possible to use H.J. Lu's
14400 binutils with support for mixed objects.
14401
14402 -fuse-ld=bfd
14403 Use the bfd linker instead of the default linker.
14404
14405 -fuse-ld=gold
14406 Use the gold linker instead of the default linker.
14407
14408 -fuse-ld=lld
14409 Use the LLVM lld linker instead of the default linker.
14410
14411 -fuse-ld=mold
14412 Use the Modern Linker (mold) instead of the default linker.
14413
14414 -llibrary
14415 -l library
14416 Search the library named library when linking. (The second
14417 alternative with the library as a separate argument is only for
14418 POSIX compliance and is not recommended.)
14419
14420 The -l option is passed directly to the linker by GCC. Refer to
14421 your linker documentation for exact details. The general
14422 description below applies to the GNU linker.
14423
14424 The linker searches a standard list of directories for the library.
14425 The directories searched include several standard system
14426 directories plus any that you specify with -L.
14427
14428 Static libraries are archives of object files, and have file names
14429 like liblibrary.a. Some targets also support shared libraries,
14430 which typically have names like liblibrary.so. If both static and
14431 shared libraries are found, the linker gives preference to linking
14432 with the shared library unless the -static option is used.
14433
14434 It makes a difference where in the command you write this option;
14435 the linker searches and processes libraries and object files in the
14436 order they are specified. Thus, foo.o -lz bar.o searches library z
14437 after file foo.o but before bar.o. If bar.o refers to functions in
14438 z, those functions may not be loaded.
14439
14440 -lobjc
14441 You need this special case of the -l option in order to link an
14442 Objective-C or Objective-C++ program.
14443
14444 -nostartfiles
14445 Do not use the standard system startup files when linking. The
14446 standard system libraries are used normally, unless -nostdlib,
14447 -nolibc, or -nodefaultlibs is used.
14448
14449 -nodefaultlibs
14450 Do not use the standard system libraries when linking. Only the
14451 libraries you specify are passed to the linker, and options
14452 specifying linkage of the system libraries, such as -static-libgcc
14453 or -shared-libgcc, are ignored. The standard startup files are
14454 used normally, unless -nostartfiles is used.
14455
14456 The compiler may generate calls to "memcmp", "memset", "memcpy" and
14457 "memmove". These entries are usually resolved by entries in libc.
14458 These entry points should be supplied through some other mechanism
14459 when this option is specified.
14460
14461 -nolibc
14462 Do not use the C library or system libraries tightly coupled with
14463 it when linking. Still link with the startup files, libgcc or
14464 toolchain provided language support libraries such as libgnat,
14465 libgfortran or libstdc++ unless options preventing their inclusion
14466 are used as well. This typically removes -lc from the link command
14467 line, as well as system libraries that normally go with it and
14468 become meaningless when absence of a C library is assumed, for
14469 example -lpthread or -lm in some configurations. This is intended
14470 for bare-board targets when there is indeed no C library available.
14471
14472 -nostdlib
14473 Do not use the standard system startup files or libraries when
14474 linking. No startup files and only the libraries you specify are
14475 passed to the linker, and options specifying linkage of the system
14476 libraries, such as -static-libgcc or -shared-libgcc, are ignored.
14477
14478 The compiler may generate calls to "memcmp", "memset", "memcpy" and
14479 "memmove". These entries are usually resolved by entries in libc.
14480 These entry points should be supplied through some other mechanism
14481 when this option is specified.
14482
14483 One of the standard libraries bypassed by -nostdlib and
14484 -nodefaultlibs is libgcc.a, a library of internal subroutines which
14485 GCC uses to overcome shortcomings of particular machines, or
14486 special needs for some languages.
14487
14488 In most cases, you need libgcc.a even when you want to avoid other
14489 standard libraries. In other words, when you specify -nostdlib or
14490 -nodefaultlibs you should usually specify -lgcc as well. This
14491 ensures that you have no unresolved references to internal GCC
14492 library subroutines. (An example of such an internal subroutine is
14493 "__main", used to ensure C++ constructors are called.)
14494
14495 -e entry
14496 --entry=entry
14497 Specify that the program entry point is entry. The argument is
14498 interpreted by the linker; the GNU linker accepts either a symbol
14499 name or an address.
14500
14501 -pie
14502 Produce a dynamically linked position independent executable on
14503 targets that support it. For predictable results, you must also
14504 specify the same set of options used for compilation (-fpie, -fPIE,
14505 or model suboptions) when you specify this linker option.
14506
14507 -no-pie
14508 Don't produce a dynamically linked position independent executable.
14509
14510 -static-pie
14511 Produce a static position independent executable on targets that
14512 support it. A static position independent executable is similar to
14513 a static executable, but can be loaded at any address without a
14514 dynamic linker. For predictable results, you must also specify the
14515 same set of options used for compilation (-fpie, -fPIE, or model
14516 suboptions) when you specify this linker option.
14517
14518 -pthread
14519 Link with the POSIX threads library. This option is supported on
14520 GNU/Linux targets, most other Unix derivatives, and also on x86
14521 Cygwin and MinGW targets. On some targets this option also sets
14522 flags for the preprocessor, so it should be used consistently for
14523 both compilation and linking.
14524
14525 -r Produce a relocatable object as output. This is also known as
14526 partial linking.
14527
14528 -rdynamic
14529 Pass the flag -export-dynamic to the ELF linker, on targets that
14530 support it. This instructs the linker to add all symbols, not only
14531 used ones, to the dynamic symbol table. This option is needed for
14532 some uses of "dlopen" or to allow obtaining backtraces from within
14533 a program.
14534
14535 -s Remove all symbol table and relocation information from the
14536 executable.
14537
14538 -static
14539 On systems that support dynamic linking, this overrides -pie and
14540 prevents linking with the shared libraries. On other systems, this
14541 option has no effect.
14542
14543 -shared
14544 Produce a shared object which can then be linked with other objects
14545 to form an executable. Not all systems support this option. For
14546 predictable results, you must also specify the same set of options
14547 used for compilation (-fpic, -fPIC, or model suboptions) when you
14548 specify this linker option.[1]
14549
14550 -shared-libgcc
14551 -static-libgcc
14552 On systems that provide libgcc as a shared library, these options
14553 force the use of either the shared or static version, respectively.
14554 If no shared version of libgcc was built when the compiler was
14555 configured, these options have no effect.
14556
14557 There are several situations in which an application should use the
14558 shared libgcc instead of the static version. The most common of
14559 these is when the application wishes to throw and catch exceptions
14560 across different shared libraries. In that case, each of the
14561 libraries as well as the application itself should use the shared
14562 libgcc.
14563
14564 Therefore, the G++ driver automatically adds -shared-libgcc
14565 whenever you build a shared library or a main executable, because
14566 C++ programs typically use exceptions, so this is the right thing
14567 to do.
14568
14569 If, instead, you use the GCC driver to create shared libraries, you
14570 may find that they are not always linked with the shared libgcc.
14571 If GCC finds, at its configuration time, that you have a non-GNU
14572 linker or a GNU linker that does not support option --eh-frame-hdr,
14573 it links the shared version of libgcc into shared libraries by
14574 default. Otherwise, it takes advantage of the linker and optimizes
14575 away the linking with the shared version of libgcc, linking with
14576 the static version of libgcc by default. This allows exceptions to
14577 propagate through such shared libraries, without incurring
14578 relocation costs at library load time.
14579
14580 However, if a library or main executable is supposed to throw or
14581 catch exceptions, you must link it using the G++ driver, or using
14582 the option -shared-libgcc, such that it is linked with the shared
14583 libgcc.
14584
14585 -static-libasan
14586 When the -fsanitize=address option is used to link a program, the
14587 GCC driver automatically links against libasan. If libasan is
14588 available as a shared library, and the -static option is not used,
14589 then this links against the shared version of libasan. The
14590 -static-libasan option directs the GCC driver to link libasan
14591 statically, without necessarily linking other libraries statically.
14592
14593 -static-libtsan
14594 When the -fsanitize=thread option is used to link a program, the
14595 GCC driver automatically links against libtsan. If libtsan is
14596 available as a shared library, and the -static option is not used,
14597 then this links against the shared version of libtsan. The
14598 -static-libtsan option directs the GCC driver to link libtsan
14599 statically, without necessarily linking other libraries statically.
14600
14601 -static-liblsan
14602 When the -fsanitize=leak option is used to link a program, the GCC
14603 driver automatically links against liblsan. If liblsan is
14604 available as a shared library, and the -static option is not used,
14605 then this links against the shared version of liblsan. The
14606 -static-liblsan option directs the GCC driver to link liblsan
14607 statically, without necessarily linking other libraries statically.
14608
14609 -static-libubsan
14610 When the -fsanitize=undefined option is used to link a program, the
14611 GCC driver automatically links against libubsan. If libubsan is
14612 available as a shared library, and the -static option is not used,
14613 then this links against the shared version of libubsan. The
14614 -static-libubsan option directs the GCC driver to link libubsan
14615 statically, without necessarily linking other libraries statically.
14616
14617 -static-libstdc++
14618 When the g++ program is used to link a C++ program, it normally
14619 automatically links against libstdc++. If libstdc++ is available
14620 as a shared library, and the -static option is not used, then this
14621 links against the shared version of libstdc++. That is normally
14622 fine. However, it is sometimes useful to freeze the version of
14623 libstdc++ used by the program without going all the way to a fully
14624 static link. The -static-libstdc++ option directs the g++ driver
14625 to link libstdc++ statically, without necessarily linking other
14626 libraries statically.
14627
14628 -symbolic
14629 Bind references to global symbols when building a shared object.
14630 Warn about any unresolved references (unless overridden by the link
14631 editor option -Xlinker -z -Xlinker defs). Only a few systems
14632 support this option.
14633
14634 -T script
14635 Use script as the linker script. This option is supported by most
14636 systems using the GNU linker. On some targets, such as bare-board
14637 targets without an operating system, the -T option may be required
14638 when linking to avoid references to undefined symbols.
14639
14640 -Xlinker option
14641 Pass option as an option to the linker. You can use this to supply
14642 system-specific linker options that GCC does not recognize.
14643
14644 If you want to pass an option that takes a separate argument, you
14645 must use -Xlinker twice, once for the option and once for the
14646 argument. For example, to pass -assert definitions, you must write
14647 -Xlinker -assert -Xlinker definitions. It does not work to write
14648 -Xlinker "-assert definitions", because this passes the entire
14649 string as a single argument, which is not what the linker expects.
14650
14651 When using the GNU linker, it is usually more convenient to pass
14652 arguments to linker options using the option=value syntax than as
14653 separate arguments. For example, you can specify -Xlinker
14654 -Map=output.map rather than -Xlinker -Map -Xlinker output.map.
14655 Other linkers may not support this syntax for command-line options.
14656
14657 -Wl,option
14658 Pass option as an option to the linker. If option contains commas,
14659 it is split into multiple options at the commas. You can use this
14660 syntax to pass an argument to the option. For example,
14661 -Wl,-Map,output.map passes -Map output.map to the linker. When
14662 using the GNU linker, you can also get the same effect with
14663 -Wl,-Map=output.map.
14664
14665 -u symbol
14666 Pretend the symbol symbol is undefined, to force linking of library
14667 modules to define it. You can use -u multiple times with different
14668 symbols to force loading of additional library modules.
14669
14670 -z keyword
14671 -z is passed directly on to the linker along with the keyword
14672 keyword. See the section in the documentation of your linker for
14673 permitted values and their meanings.
14674
14675 Options for Directory Search
14676 These options specify directories to search for header files, for
14677 libraries and for parts of the compiler:
14678
14679 -I dir
14680 -iquote dir
14681 -isystem dir
14682 -idirafter dir
14683 Add the directory dir to the list of directories to be searched for
14684 header files during preprocessing. If dir begins with = or
14685 $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix;
14686 see --sysroot and -isysroot.
14687
14688 Directories specified with -iquote apply only to the quote form of
14689 the directive, "#include "file"". Directories specified with -I,
14690 -isystem, or -idirafter apply to lookup for both the
14691 "#include "file"" and "#include <file>" directives.
14692
14693 You can specify any number or combination of these options on the
14694 command line to search for header files in several directories.
14695 The lookup order is as follows:
14696
14697 1. For the quote form of the include directive, the directory of
14698 the current file is searched first.
14699
14700 2. For the quote form of the include directive, the directories
14701 specified by -iquote options are searched in left-to-right
14702 order, as they appear on the command line.
14703
14704 3. Directories specified with -I options are scanned in left-to-
14705 right order.
14706
14707 4. Directories specified with -isystem options are scanned in
14708 left-to-right order.
14709
14710 5. Standard system directories are scanned.
14711
14712 6. Directories specified with -idirafter options are scanned in
14713 left-to-right order.
14714
14715 You can use -I to override a system header file, substituting your
14716 own version, since these directories are searched before the
14717 standard system header file directories. However, you should not
14718 use this option to add directories that contain vendor-supplied
14719 system header files; use -isystem for that.
14720
14721 The -isystem and -idirafter options also mark the directory as a
14722 system directory, so that it gets the same special treatment that
14723 is applied to the standard system directories.
14724
14725 If a standard system include directory, or a directory specified
14726 with -isystem, is also specified with -I, the -I option is ignored.
14727 The directory is still searched but as a system directory at its
14728 normal position in the system include chain. This is to ensure
14729 that GCC's procedure to fix buggy system headers and the ordering
14730 for the "#include_next" directive are not inadvertently changed.
14731 If you really need to change the search order for system
14732 directories, use the -nostdinc and/or -isystem options.
14733
14734 -I- Split the include path. This option has been deprecated. Please
14735 use -iquote instead for -I directories before the -I- and remove
14736 the -I- option.
14737
14738 Any directories specified with -I options before -I- are searched
14739 only for headers requested with "#include "file""; they are not
14740 searched for "#include <file>". If additional directories are
14741 specified with -I options after the -I-, those directories are
14742 searched for all #include directives.
14743
14744 In addition, -I- inhibits the use of the directory of the current
14745 file directory as the first search directory for "#include "file"".
14746 There is no way to override this effect of -I-.
14747
14748 -iprefix prefix
14749 Specify prefix as the prefix for subsequent -iwithprefix options.
14750 If the prefix represents a directory, you should include the final
14751 /.
14752
14753 -iwithprefix dir
14754 -iwithprefixbefore dir
14755 Append dir to the prefix specified previously with -iprefix, and
14756 add the resulting directory to the include search path.
14757 -iwithprefixbefore puts it in the same place -I would; -iwithprefix
14758 puts it where -idirafter would.
14759
14760 -isysroot dir
14761 This option is like the --sysroot option, but applies only to
14762 header files (except for Darwin targets, where it applies to both
14763 header files and libraries). See the --sysroot option for more
14764 information.
14765
14766 -imultilib dir
14767 Use dir as a subdirectory of the directory containing target-
14768 specific C++ headers.
14769
14770 -nostdinc
14771 Do not search the standard system directories for header files.
14772 Only the directories explicitly specified with -I, -iquote,
14773 -isystem, and/or -idirafter options (and the directory of the
14774 current file, if appropriate) are searched.
14775
14776 -nostdinc++
14777 Do not search for header files in the C++-specific standard
14778 directories, but do still search the other standard directories.
14779 (This option is used when building the C++ library.)
14780
14781 -iplugindir=dir
14782 Set the directory to search for plugins that are passed by
14783 -fplugin=name instead of -fplugin=path/name.so. This option is not
14784 meant to be used by the user, but only passed by the driver.
14785
14786 -Ldir
14787 Add directory dir to the list of directories to be searched for -l.
14788
14789 -Bprefix
14790 This option specifies where to find the executables, libraries,
14791 include files, and data files of the compiler itself.
14792
14793 The compiler driver program runs one or more of the subprograms
14794 cpp, cc1, as and ld. It tries prefix as a prefix for each program
14795 it tries to run, both with and without machine/version/ for the
14796 corresponding target machine and compiler version.
14797
14798 For each subprogram to be run, the compiler driver first tries the
14799 -B prefix, if any. If that name is not found, or if -B is not
14800 specified, the driver tries two standard prefixes, /usr/lib/gcc/
14801 and /usr/local/lib/gcc/. If neither of those results in a file
14802 name that is found, the unmodified program name is searched for
14803 using the directories specified in your PATH environment variable.
14804
14805 The compiler checks to see if the path provided by -B refers to a
14806 directory, and if necessary it adds a directory separator character
14807 at the end of the path.
14808
14809 -B prefixes that effectively specify directory names also apply to
14810 libraries in the linker, because the compiler translates these
14811 options into -L options for the linker. They also apply to include
14812 files in the preprocessor, because the compiler translates these
14813 options into -isystem options for the preprocessor. In this case,
14814 the compiler appends include to the prefix.
14815
14816 The runtime support file libgcc.a can also be searched for using
14817 the -B prefix, if needed. If it is not found there, the two
14818 standard prefixes above are tried, and that is all. The file is
14819 left out of the link if it is not found by those means.
14820
14821 Another way to specify a prefix much like the -B prefix is to use
14822 the environment variable GCC_EXEC_PREFIX.
14823
14824 As a special kludge, if the path provided by -B is [dir/]stageN/,
14825 where N is a number in the range 0 to 9, then it is replaced by
14826 [dir/]include. This is to help with boot-strapping the compiler.
14827
14828 -no-canonical-prefixes
14829 Do not expand any symbolic links, resolve references to /../ or
14830 /./, or make the path absolute when generating a relative prefix.
14831
14832 --sysroot=dir
14833 Use dir as the logical root directory for headers and libraries.
14834 For example, if the compiler normally searches for headers in
14835 /usr/include and libraries in /usr/lib, it instead searches
14836 dir/usr/include and dir/usr/lib.
14837
14838 If you use both this option and the -isysroot option, then the
14839 --sysroot option applies to libraries, but the -isysroot option
14840 applies to header files.
14841
14842 The GNU linker (beginning with version 2.16) has the necessary
14843 support for this option. If your linker does not support this
14844 option, the header file aspect of --sysroot still works, but the
14845 library aspect does not.
14846
14847 --no-sysroot-suffix
14848 For some targets, a suffix is added to the root directory specified
14849 with --sysroot, depending on the other options used, so that
14850 headers may for example be found in dir/suffix/usr/include instead
14851 of dir/usr/include. This option disables the addition of such a
14852 suffix.
14853
14854 Options for Code Generation Conventions
14855 These machine-independent options control the interface conventions
14856 used in code generation.
14857
14858 Most of them have both positive and negative forms; the negative form
14859 of -ffoo is -fno-foo. In the table below, only one of the forms is
14860 listed---the one that is not the default. You can figure out the other
14861 form by either removing no- or adding it.
14862
14863 -fstack-reuse=reuse-level
14864 This option controls stack space reuse for user declared local/auto
14865 variables and compiler generated temporaries. reuse_level can be
14866 all, named_vars, or none. all enables stack reuse for all local
14867 variables and temporaries, named_vars enables the reuse only for
14868 user defined local variables with names, and none disables stack
14869 reuse completely. The default value is all. The option is needed
14870 when the program extends the lifetime of a scoped local variable or
14871 a compiler generated temporary beyond the end point defined by the
14872 language. When a lifetime of a variable ends, and if the variable
14873 lives in memory, the optimizing compiler has the freedom to reuse
14874 its stack space with other temporaries or scoped local variables
14875 whose live range does not overlap with it. Legacy code extending
14876 local lifetime is likely to break with the stack reuse
14877 optimization.
14878
14879 For example,
14880
14881 int *p;
14882 {
14883 int local1;
14884
14885 p = &local1;
14886 local1 = 10;
14887 ....
14888 }
14889 {
14890 int local2;
14891 local2 = 20;
14892 ...
14893 }
14894
14895 if (*p == 10) // out of scope use of local1
14896 {
14897
14898 }
14899
14900 Another example:
14901
14902 struct A
14903 {
14904 A(int k) : i(k), j(k) { }
14905 int i;
14906 int j;
14907 };
14908
14909 A *ap;
14910
14911 void foo(const A& ar)
14912 {
14913 ap = &ar;
14914 }
14915
14916 void bar()
14917 {
14918 foo(A(10)); // temp object's lifetime ends when foo returns
14919
14920 {
14921 A a(20);
14922 ....
14923 }
14924 ap->i+= 10; // ap references out of scope temp whose space
14925 // is reused with a. What is the value of ap->i?
14926 }
14927
14928 The lifetime of a compiler generated temporary is well defined by
14929 the C++ standard. When a lifetime of a temporary ends, and if the
14930 temporary lives in memory, the optimizing compiler has the freedom
14931 to reuse its stack space with other temporaries or scoped local
14932 variables whose live range does not overlap with it. However some
14933 of the legacy code relies on the behavior of older compilers in
14934 which temporaries' stack space is not reused, the aggressive stack
14935 reuse can lead to runtime errors. This option is used to control
14936 the temporary stack reuse optimization.
14937
14938 -ftrapv
14939 This option generates traps for signed overflow on addition,
14940 subtraction, multiplication operations. The options -ftrapv and
14941 -fwrapv override each other, so using -ftrapv -fwrapv on the
14942 command-line results in -fwrapv being effective. Note that only
14943 active options override, so using -ftrapv -fwrapv -fno-wrapv on the
14944 command-line results in -ftrapv being effective.
14945
14946 -fwrapv
14947 This option instructs the compiler to assume that signed arithmetic
14948 overflow of addition, subtraction and multiplication wraps around
14949 using twos-complement representation. This flag enables some
14950 optimizations and disables others. The options -ftrapv and -fwrapv
14951 override each other, so using -ftrapv -fwrapv on the command-line
14952 results in -fwrapv being effective. Note that only active options
14953 override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
14954 results in -ftrapv being effective.
14955
14956 -fwrapv-pointer
14957 This option instructs the compiler to assume that pointer
14958 arithmetic overflow on addition and subtraction wraps around using
14959 twos-complement representation. This flag disables some
14960 optimizations which assume pointer overflow is invalid.
14961
14962 -fstrict-overflow
14963 This option implies -fno-wrapv -fno-wrapv-pointer and when negated
14964 implies -fwrapv -fwrapv-pointer.
14965
14966 -fexceptions
14967 Enable exception handling. Generates extra code needed to
14968 propagate exceptions. For some targets, this implies GCC generates
14969 frame unwind information for all functions, which can produce
14970 significant data size overhead, although it does not affect
14971 execution. If you do not specify this option, GCC enables it by
14972 default for languages like C++ that normally require exception
14973 handling, and disables it for languages like C that do not normally
14974 require it. However, you may need to enable this option when
14975 compiling C code that needs to interoperate properly with exception
14976 handlers written in C++. You may also wish to disable this option
14977 if you are compiling older C++ programs that don't use exception
14978 handling.
14979
14980 -fnon-call-exceptions
14981 Generate code that allows trapping instructions to throw
14982 exceptions. Note that this requires platform-specific runtime
14983 support that does not exist everywhere. Moreover, it only allows
14984 trapping instructions to throw exceptions, i.e. memory references
14985 or floating-point instructions. It does not allow exceptions to be
14986 thrown from arbitrary signal handlers such as "SIGALRM". This
14987 enables -fexceptions.
14988
14989 -fdelete-dead-exceptions
14990 Consider that instructions that may throw exceptions but don't
14991 otherwise contribute to the execution of the program can be
14992 optimized away. This does not affect calls to functions except
14993 those with the "pure" or "const" attributes. This option is
14994 enabled by default for the Ada and C++ compilers, as permitted by
14995 the language specifications. Optimization passes that cause dead
14996 exceptions to be removed are enabled independently at different
14997 optimization levels.
14998
14999 -funwind-tables
15000 Similar to -fexceptions, except that it just generates any needed
15001 static data, but does not affect the generated code in any other
15002 way. You normally do not need to enable this option; instead, a
15003 language processor that needs this handling enables it on your
15004 behalf.
15005
15006 -fasynchronous-unwind-tables
15007 Generate unwind table in DWARF format, if supported by target
15008 machine. The table is exact at each instruction boundary, so it
15009 can be used for stack unwinding from asynchronous events (such as
15010 debugger or garbage collector).
15011
15012 -fno-gnu-unique
15013 On systems with recent GNU assembler and C library, the C++
15014 compiler uses the "STB_GNU_UNIQUE" binding to make sure that
15015 definitions of template static data members and static local
15016 variables in inline functions are unique even in the presence of
15017 "RTLD_LOCAL"; this is necessary to avoid problems with a library
15018 used by two different "RTLD_LOCAL" plugins depending on a
15019 definition in one of them and therefore disagreeing with the other
15020 one about the binding of the symbol. But this causes "dlclose" to
15021 be ignored for affected DSOs; if your program relies on
15022 reinitialization of a DSO via "dlclose" and "dlopen", you can use
15023 -fno-gnu-unique.
15024
15025 -fpcc-struct-return
15026 Return "short" "struct" and "union" values in memory like longer
15027 ones, rather than in registers. This convention is less efficient,
15028 but it has the advantage of allowing intercallability between GCC-
15029 compiled files and files compiled with other compilers,
15030 particularly the Portable C Compiler (pcc).
15031
15032 The precise convention for returning structures in memory depends
15033 on the target configuration macros.
15034
15035 Short structures and unions are those whose size and alignment
15036 match that of some integer type.
15037
15038 Warning: code compiled with the -fpcc-struct-return switch is not
15039 binary compatible with code compiled with the -freg-struct-return
15040 switch. Use it to conform to a non-default application binary
15041 interface.
15042
15043 -freg-struct-return
15044 Return "struct" and "union" values in registers when possible.
15045 This is more efficient for small structures than
15046 -fpcc-struct-return.
15047
15048 If you specify neither -fpcc-struct-return nor -freg-struct-return,
15049 GCC defaults to whichever convention is standard for the target.
15050 If there is no standard convention, GCC defaults to
15051 -fpcc-struct-return, except on targets where GCC is the principal
15052 compiler. In those cases, we can choose the standard, and we chose
15053 the more efficient register return alternative.
15054
15055 Warning: code compiled with the -freg-struct-return switch is not
15056 binary compatible with code compiled with the -fpcc-struct-return
15057 switch. Use it to conform to a non-default application binary
15058 interface.
15059
15060 -fshort-enums
15061 Allocate to an "enum" type only as many bytes as it needs for the
15062 declared range of possible values. Specifically, the "enum" type
15063 is equivalent to the smallest integer type that has enough room.
15064
15065 Warning: the -fshort-enums switch causes GCC to generate code that
15066 is not binary compatible with code generated without that switch.
15067 Use it to conform to a non-default application binary interface.
15068
15069 -fshort-wchar
15070 Override the underlying type for "wchar_t" to be "short unsigned
15071 int" instead of the default for the target. This option is useful
15072 for building programs to run under WINE.
15073
15074 Warning: the -fshort-wchar switch causes GCC to generate code that
15075 is not binary compatible with code generated without that switch.
15076 Use it to conform to a non-default application binary interface.
15077
15078 -fcommon
15079 In C code, this option controls the placement of global variables
15080 defined without an initializer, known as tentative definitions in
15081 the C standard. Tentative definitions are distinct from
15082 declarations of a variable with the "extern" keyword, which do not
15083 allocate storage.
15084
15085 The default is -fno-common, which specifies that the compiler
15086 places uninitialized global variables in the BSS section of the
15087 object file. This inhibits the merging of tentative definitions by
15088 the linker so you get a multiple-definition error if the same
15089 variable is accidentally defined in more than one compilation unit.
15090
15091 The -fcommon places uninitialized global variables in a common
15092 block. This allows the linker to resolve all tentative definitions
15093 of the same variable in different compilation units to the same
15094 object, or to a non-tentative definition. This behavior is
15095 inconsistent with C++, and on many targets implies a speed and code
15096 size penalty on global variable references. It is mainly useful to
15097 enable legacy code to link without errors.
15098
15099 -fno-ident
15100 Ignore the "#ident" directive.
15101
15102 -finhibit-size-directive
15103 Don't output a ".size" assembler directive, or anything else that
15104 would cause trouble if the function is split in the middle, and the
15105 two halves are placed at locations far apart in memory. This
15106 option is used when compiling crtstuff.c; you should not need to
15107 use it for anything else.
15108
15109 -fverbose-asm
15110 Put extra commentary information in the generated assembly code to
15111 make it more readable. This option is generally only of use to
15112 those who actually need to read the generated assembly code
15113 (perhaps while debugging the compiler itself).
15114
15115 -fno-verbose-asm, the default, causes the extra information to be
15116 omitted and is useful when comparing two assembler files.
15117
15118 The added comments include:
15119
15120 * information on the compiler version and command-line options,
15121
15122 * the source code lines associated with the assembly
15123 instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE,
15124
15125 * hints on which high-level expressions correspond to the various
15126 assembly instruction operands.
15127
15128 For example, given this C source file:
15129
15130 int test (int n)
15131 {
15132 int i;
15133 int total = 0;
15134
15135 for (i = 0; i < n; i++)
15136 total += i * i;
15137
15138 return total;
15139 }
15140
15141 compiling to (x86_64) assembly via -S and emitting the result
15142 direct to stdout via -o -
15143
15144 gcc -S test.c -fverbose-asm -Os -o -
15145
15146 gives output similar to this:
15147
15148 .file "test.c"
15149 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
15150 [...snip...]
15151 # options passed:
15152 [...snip...]
15153
15154 .text
15155 .globl test
15156 .type test, @function
15157 test:
15158 .LFB0:
15159 .cfi_startproc
15160 # test.c:4: int total = 0;
15161 xorl %eax, %eax # <retval>
15162 # test.c:6: for (i = 0; i < n; i++)
15163 xorl %edx, %edx # i
15164 .L2:
15165 # test.c:6: for (i = 0; i < n; i++)
15166 cmpl %edi, %edx # n, i
15167 jge .L5 #,
15168 # test.c:7: total += i * i;
15169 movl %edx, %ecx # i, tmp92
15170 imull %edx, %ecx # i, tmp92
15171 # test.c:6: for (i = 0; i < n; i++)
15172 incl %edx # i
15173 # test.c:7: total += i * i;
15174 addl %ecx, %eax # tmp92, <retval>
15175 jmp .L2 #
15176 .L5:
15177 # test.c:10: }
15178 ret
15179 .cfi_endproc
15180 .LFE0:
15181 .size test, .-test
15182 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
15183 .section .note.GNU-stack,"",@progbits
15184
15185 The comments are intended for humans rather than machines and hence
15186 the precise format of the comments is subject to change.
15187
15188 -frecord-gcc-switches
15189 This switch causes the command line used to invoke the compiler to
15190 be recorded into the object file that is being created. This
15191 switch is only implemented on some targets and the exact format of
15192 the recording is target and binary file format dependent, but it
15193 usually takes the form of a section containing ASCII text. This
15194 switch is related to the -fverbose-asm switch, but that switch only
15195 records information in the assembler output file as comments, so it
15196 never reaches the object file. See also -grecord-gcc-switches for
15197 another way of storing compiler options into the object file.
15198
15199 -fpic
15200 Generate position-independent code (PIC) suitable for use in a
15201 shared library, if supported for the target machine. Such code
15202 accesses all constant addresses through a global offset table
15203 (GOT). The dynamic loader resolves the GOT entries when the
15204 program starts (the dynamic loader is not part of GCC; it is part
15205 of the operating system). If the GOT size for the linked
15206 executable exceeds a machine-specific maximum size, you get an
15207 error message from the linker indicating that -fpic does not work;
15208 in that case, recompile with -fPIC instead. (These maximums are 8k
15209 on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The
15210 x86 has no such limit.)
15211
15212 Position-independent code requires special support, and therefore
15213 works only on certain machines. For the x86, GCC supports PIC for
15214 System V but not for the Sun 386i. Code generated for the IBM
15215 RS/6000 is always position-independent.
15216
15217 When this flag is set, the macros "__pic__" and "__PIC__" are
15218 defined to 1.
15219
15220 -fPIC
15221 If supported for the target machine, emit position-independent
15222 code, suitable for dynamic linking and avoiding any limit on the
15223 size of the global offset table. This option makes a difference on
15224 AArch64, m68k, PowerPC and SPARC.
15225
15226 Position-independent code requires special support, and therefore
15227 works only on certain machines.
15228
15229 When this flag is set, the macros "__pic__" and "__PIC__" are
15230 defined to 2.
15231
15232 -fpie
15233 -fPIE
15234 These options are similar to -fpic and -fPIC, but the generated
15235 position-independent code can be only linked into executables.
15236 Usually these options are used to compile code that will be linked
15237 using the -pie GCC option.
15238
15239 -fpie and -fPIE both define the macros "__pie__" and "__PIE__".
15240 The macros have the value 1 for -fpie and 2 for -fPIE.
15241
15242 -fno-plt
15243 Do not use the PLT for external function calls in position-
15244 independent code. Instead, load the callee address at call sites
15245 from the GOT and branch to it. This leads to more efficient code
15246 by eliminating PLT stubs and exposing GOT loads to optimizations.
15247 On architectures such as 32-bit x86 where PLT stubs expect the GOT
15248 pointer in a specific register, this gives more register allocation
15249 freedom to the compiler. Lazy binding requires use of the PLT;
15250 with -fno-plt all external symbols are resolved at load time.
15251
15252 Alternatively, the function attribute "noplt" can be used to avoid
15253 calls through the PLT for specific external functions.
15254
15255 In position-dependent code, a few targets also convert calls to
15256 functions that are marked to not use the PLT to use the GOT
15257 instead.
15258
15259 -fno-jump-tables
15260 Do not use jump tables for switch statements even where it would be
15261 more efficient than other code generation strategies. This option
15262 is of use in conjunction with -fpic or -fPIC for building code that
15263 forms part of a dynamic linker and cannot reference the address of
15264 a jump table. On some targets, jump tables do not require a GOT
15265 and this option is not needed.
15266
15267 -fno-bit-tests
15268 Do not use bit tests for switch statements even where it would be
15269 more efficient than other code generation strategies.
15270
15271 -ffixed-reg
15272 Treat the register named reg as a fixed register; generated code
15273 should never refer to it (except perhaps as a stack pointer, frame
15274 pointer or in some other fixed role).
15275
15276 reg must be the name of a register. The register names accepted
15277 are machine-specific and are defined in the "REGISTER_NAMES" macro
15278 in the machine description macro file.
15279
15280 This flag does not have a negative form, because it specifies a
15281 three-way choice.
15282
15283 -fcall-used-reg
15284 Treat the register named reg as an allocable register that is
15285 clobbered by function calls. It may be allocated for temporaries
15286 or variables that do not live across a call. Functions compiled
15287 this way do not save and restore the register reg.
15288
15289 It is an error to use this flag with the frame pointer or stack
15290 pointer. Use of this flag for other registers that have fixed
15291 pervasive roles in the machine's execution model produces
15292 disastrous results.
15293
15294 This flag does not have a negative form, because it specifies a
15295 three-way choice.
15296
15297 -fcall-saved-reg
15298 Treat the register named reg as an allocable register saved by
15299 functions. It may be allocated even for temporaries or variables
15300 that live across a call. Functions compiled this way save and
15301 restore the register reg if they use it.
15302
15303 It is an error to use this flag with the frame pointer or stack
15304 pointer. Use of this flag for other registers that have fixed
15305 pervasive roles in the machine's execution model produces
15306 disastrous results.
15307
15308 A different sort of disaster results from the use of this flag for
15309 a register in which function values may be returned.
15310
15311 This flag does not have a negative form, because it specifies a
15312 three-way choice.
15313
15314 -fpack-struct[=n]
15315 Without a value specified, pack all structure members together
15316 without holes. When a value is specified (which must be a small
15317 power of two), pack structure members according to this value,
15318 representing the maximum alignment (that is, objects with default
15319 alignment requirements larger than this are output potentially
15320 unaligned at the next fitting location.
15321
15322 Warning: the -fpack-struct switch causes GCC to generate code that
15323 is not binary compatible with code generated without that switch.
15324 Additionally, it makes the code suboptimal. Use it to conform to a
15325 non-default application binary interface.
15326
15327 -fleading-underscore
15328 This option and its counterpart, -fno-leading-underscore, forcibly
15329 change the way C symbols are represented in the object file. One
15330 use is to help link with legacy assembly code.
15331
15332 Warning: the -fleading-underscore switch causes GCC to generate
15333 code that is not binary compatible with code generated without that
15334 switch. Use it to conform to a non-default application binary
15335 interface. Not all targets provide complete support for this
15336 switch.
15337
15338 -ftls-model=model
15339 Alter the thread-local storage model to be used. The model
15340 argument should be one of global-dynamic, local-dynamic, initial-
15341 exec or local-exec. Note that the choice is subject to
15342 optimization: the compiler may use a more efficient model for
15343 symbols not visible outside of the translation unit, or if -fpic is
15344 not given on the command line.
15345
15346 The default without -fpic is initial-exec; with -fpic the default
15347 is global-dynamic.
15348
15349 -ftrampolines
15350 For targets that normally need trampolines for nested functions,
15351 always generate them instead of using descriptors. Otherwise, for
15352 targets that do not need them, like for example HP-PA or IA-64, do
15353 nothing.
15354
15355 A trampoline is a small piece of code that is created at run time
15356 on the stack when the address of a nested function is taken, and is
15357 used to call the nested function indirectly. Therefore, it
15358 requires the stack to be made executable in order for the program
15359 to work properly.
15360
15361 -fno-trampolines is enabled by default on a language by language
15362 basis to let the compiler avoid generating them, if it computes
15363 that this is safe, and replace them with descriptors. Descriptors
15364 are made up of data only, but the generated code must be prepared
15365 to deal with them. As of this writing, -fno-trampolines is enabled
15366 by default only for Ada.
15367
15368 Moreover, code compiled with -ftrampolines and code compiled with
15369 -fno-trampolines are not binary compatible if nested functions are
15370 present. This option must therefore be used on a program-wide
15371 basis and be manipulated with extreme care.
15372
15373 For languages other than Ada, the "-ftrampolines" and
15374 "-fno-trampolines" options currently have no effect, and
15375 trampolines are always generated on platforms that need them for
15376 nested functions.
15377
15378 -fvisibility=[default|internal|hidden|protected]
15379 Set the default ELF image symbol visibility to the specified
15380 option---all symbols are marked with this unless overridden within
15381 the code. Using this feature can very substantially improve
15382 linking and load times of shared object libraries, produce more
15383 optimized code, provide near-perfect API export and prevent symbol
15384 clashes. It is strongly recommended that you use this in any
15385 shared objects you distribute.
15386
15387 Despite the nomenclature, default always means public; i.e.,
15388 available to be linked against from outside the shared object.
15389 protected and internal are pretty useless in real-world usage so
15390 the only other commonly used option is hidden. The default if
15391 -fvisibility isn't specified is default, i.e., make every symbol
15392 public.
15393
15394 A good explanation of the benefits offered by ensuring ELF symbols
15395 have the correct visibility is given by "How To Write Shared
15396 Libraries" by Ulrich Drepper (which can be found at
15397 <https://www.akkadia.org/drepper/>)---however a superior solution
15398 made possible by this option to marking things hidden when the
15399 default is public is to make the default hidden and mark things
15400 public. This is the norm with DLLs on Windows and with
15401 -fvisibility=hidden and "__attribute__ ((visibility("default")))"
15402 instead of "__declspec(dllexport)" you get almost identical
15403 semantics with identical syntax. This is a great boon to those
15404 working with cross-platform projects.
15405
15406 For those adding visibility support to existing code, you may find
15407 "#pragma GCC visibility" of use. This works by you enclosing the
15408 declarations you wish to set visibility for with (for example)
15409 "#pragma GCC visibility push(hidden)" and "#pragma GCC visibility
15410 pop". Bear in mind that symbol visibility should be viewed as part
15411 of the API interface contract and thus all new code should always
15412 specify visibility when it is not the default; i.e., declarations
15413 only for use within the local DSO should always be marked
15414 explicitly as hidden as so to avoid PLT indirection
15415 overheads---making this abundantly clear also aids readability and
15416 self-documentation of the code. Note that due to ISO C++
15417 specification requirements, "operator new" and "operator delete"
15418 must always be of default visibility.
15419
15420 Be aware that headers from outside your project, in particular
15421 system headers and headers from any other library you use, may not
15422 be expecting to be compiled with visibility other than the default.
15423 You may need to explicitly say "#pragma GCC visibility
15424 push(default)" before including any such headers.
15425
15426 "extern" declarations are not affected by -fvisibility, so a lot of
15427 code can be recompiled with -fvisibility=hidden with no
15428 modifications. However, this means that calls to "extern"
15429 functions with no explicit visibility use the PLT, so it is more
15430 effective to use "__attribute ((visibility))" and/or "#pragma GCC
15431 visibility" to tell the compiler which "extern" declarations should
15432 be treated as hidden.
15433
15434 Note that -fvisibility does affect C++ vague linkage entities. This
15435 means that, for instance, an exception class that is be thrown
15436 between DSOs must be explicitly marked with default visibility so
15437 that the type_info nodes are unified between the DSOs.
15438
15439 An overview of these techniques, their benefits and how to use them
15440 is at <https://gcc.gnu.org/wiki/Visibility>.
15441
15442 -fstrict-volatile-bitfields
15443 This option should be used if accesses to volatile bit-fields (or
15444 other structure fields, although the compiler usually honors those
15445 types anyway) should use a single access of the width of the
15446 field's type, aligned to a natural alignment if possible. For
15447 example, targets with memory-mapped peripheral registers might
15448 require all such accesses to be 16 bits wide; with this flag you
15449 can declare all peripheral bit-fields as "unsigned short" (assuming
15450 short is 16 bits on these targets) to force GCC to use 16-bit
15451 accesses instead of, perhaps, a more efficient 32-bit access.
15452
15453 If this option is disabled, the compiler uses the most efficient
15454 instruction. In the previous example, that might be a 32-bit load
15455 instruction, even though that accesses bytes that do not contain
15456 any portion of the bit-field, or memory-mapped registers unrelated
15457 to the one being updated.
15458
15459 In some cases, such as when the "packed" attribute is applied to a
15460 structure field, it may not be possible to access the field with a
15461 single read or write that is correctly aligned for the target
15462 machine. In this case GCC falls back to generating multiple
15463 accesses rather than code that will fault or truncate the result at
15464 run time.
15465
15466 Note: Due to restrictions of the C/C++11 memory model, write
15467 accesses are not allowed to touch non bit-field members. It is
15468 therefore recommended to define all bits of the field's type as
15469 bit-field members.
15470
15471 The default value of this option is determined by the application
15472 binary interface for the target processor.
15473
15474 -fsync-libcalls
15475 This option controls whether any out-of-line instance of the
15476 "__sync" family of functions may be used to implement the C++11
15477 "__atomic" family of functions.
15478
15479 The default value of this option is enabled, thus the only useful
15480 form of the option is -fno-sync-libcalls. This option is used in
15481 the implementation of the libatomic runtime library.
15482
15483 GCC Developer Options
15484 This section describes command-line options that are primarily of
15485 interest to GCC developers, including options to support compiler
15486 testing and investigation of compiler bugs and compile-time performance
15487 problems. This includes options that produce debug dumps at various
15488 points in the compilation; that print statistics such as memory use and
15489 execution time; and that print information about GCC's configuration,
15490 such as where it searches for libraries. You should rarely need to use
15491 any of these options for ordinary compilation and linking tasks.
15492
15493 Many developer options that cause GCC to dump output to a file take an
15494 optional =filename suffix. You can specify stdout or - to dump to
15495 standard output, and stderr for standard error.
15496
15497 If =filename is omitted, a default dump file name is constructed by
15498 concatenating the base dump file name, a pass number, phase letter, and
15499 pass name. The base dump file name is the name of output file produced
15500 by the compiler if explicitly specified and not an executable;
15501 otherwise it is the source file name. The pass number is determined by
15502 the order passes are registered with the compiler's pass manager. This
15503 is generally the same as the order of execution, but passes registered
15504 by plugins, target-specific passes, or passes that are otherwise
15505 registered late are numbered higher than the pass named final, even if
15506 they are executed earlier. The phase letter is one of i (inter-
15507 procedural analysis), l (language-specific), r (RTL), or t (tree). The
15508 files are created in the directory of the output file.
15509
15510 -fcallgraph-info
15511 -fcallgraph-info=MARKERS
15512 Makes the compiler output callgraph information for the program, on
15513 a per-object-file basis. The information is generated in the
15514 common VCG format. It can be decorated with additional, per-node
15515 and/or per-edge information, if a list of comma-separated markers
15516 is additionally specified. When the "su" marker is specified, the
15517 callgraph is decorated with stack usage information; it is
15518 equivalent to -fstack-usage. When the "da" marker is specified,
15519 the callgraph is decorated with information about dynamically
15520 allocated objects.
15521
15522 When compiling with -flto, no callgraph information is output along
15523 with the object file. At LTO link time, -fcallgraph-info may
15524 generate multiple callgraph information files next to intermediate
15525 LTO output files.
15526
15527 -dletters
15528 -fdump-rtl-pass
15529 -fdump-rtl-pass=filename
15530 Says to make debugging dumps during compilation at times specified
15531 by letters. This is used for debugging the RTL-based passes of the
15532 compiler.
15533
15534 Some -dletters switches have different meaning when -E is used for
15535 preprocessing.
15536
15537 Debug dumps can be enabled with a -fdump-rtl switch or some -d
15538 option letters. Here are the possible letters for use in pass and
15539 letters, and their meanings:
15540
15541 -fdump-rtl-alignments
15542 Dump after branch alignments have been computed.
15543
15544 -fdump-rtl-asmcons
15545 Dump after fixing rtl statements that have unsatisfied in/out
15546 constraints.
15547
15548 -fdump-rtl-auto_inc_dec
15549 Dump after auto-inc-dec discovery. This pass is only run on
15550 architectures that have auto inc or auto dec instructions.
15551
15552 -fdump-rtl-barriers
15553 Dump after cleaning up the barrier instructions.
15554
15555 -fdump-rtl-bbpart
15556 Dump after partitioning hot and cold basic blocks.
15557
15558 -fdump-rtl-bbro
15559 Dump after block reordering.
15560
15561 -fdump-rtl-btl1
15562 -fdump-rtl-btl2
15563 -fdump-rtl-btl1 and -fdump-rtl-btl2 enable dumping after the
15564 two branch target load optimization passes.
15565
15566 -fdump-rtl-bypass
15567 Dump after jump bypassing and control flow optimizations.
15568
15569 -fdump-rtl-combine
15570 Dump after the RTL instruction combination pass.
15571
15572 -fdump-rtl-compgotos
15573 Dump after duplicating the computed gotos.
15574
15575 -fdump-rtl-ce1
15576 -fdump-rtl-ce2
15577 -fdump-rtl-ce3
15578 -fdump-rtl-ce1, -fdump-rtl-ce2, and -fdump-rtl-ce3 enable
15579 dumping after the three if conversion passes.
15580
15581 -fdump-rtl-cprop_hardreg
15582 Dump after hard register copy propagation.
15583
15584 -fdump-rtl-csa
15585 Dump after combining stack adjustments.
15586
15587 -fdump-rtl-cse1
15588 -fdump-rtl-cse2
15589 -fdump-rtl-cse1 and -fdump-rtl-cse2 enable dumping after the
15590 two common subexpression elimination passes.
15591
15592 -fdump-rtl-dce
15593 Dump after the standalone dead code elimination passes.
15594
15595 -fdump-rtl-dbr
15596 Dump after delayed branch scheduling.
15597
15598 -fdump-rtl-dce1
15599 -fdump-rtl-dce2
15600 -fdump-rtl-dce1 and -fdump-rtl-dce2 enable dumping after the
15601 two dead store elimination passes.
15602
15603 -fdump-rtl-eh
15604 Dump after finalization of EH handling code.
15605
15606 -fdump-rtl-eh_ranges
15607 Dump after conversion of EH handling range regions.
15608
15609 -fdump-rtl-expand
15610 Dump after RTL generation.
15611
15612 -fdump-rtl-fwprop1
15613 -fdump-rtl-fwprop2
15614 -fdump-rtl-fwprop1 and -fdump-rtl-fwprop2 enable dumping after
15615 the two forward propagation passes.
15616
15617 -fdump-rtl-gcse1
15618 -fdump-rtl-gcse2
15619 -fdump-rtl-gcse1 and -fdump-rtl-gcse2 enable dumping after
15620 global common subexpression elimination.
15621
15622 -fdump-rtl-init-regs
15623 Dump after the initialization of the registers.
15624
15625 -fdump-rtl-initvals
15626 Dump after the computation of the initial value sets.
15627
15628 -fdump-rtl-into_cfglayout
15629 Dump after converting to cfglayout mode.
15630
15631 -fdump-rtl-ira
15632 Dump after iterated register allocation.
15633
15634 -fdump-rtl-jump
15635 Dump after the second jump optimization.
15636
15637 -fdump-rtl-loop2
15638 -fdump-rtl-loop2 enables dumping after the rtl loop
15639 optimization passes.
15640
15641 -fdump-rtl-mach
15642 Dump after performing the machine dependent reorganization
15643 pass, if that pass exists.
15644
15645 -fdump-rtl-mode_sw
15646 Dump after removing redundant mode switches.
15647
15648 -fdump-rtl-rnreg
15649 Dump after register renumbering.
15650
15651 -fdump-rtl-outof_cfglayout
15652 Dump after converting from cfglayout mode.
15653
15654 -fdump-rtl-peephole2
15655 Dump after the peephole pass.
15656
15657 -fdump-rtl-postreload
15658 Dump after post-reload optimizations.
15659
15660 -fdump-rtl-pro_and_epilogue
15661 Dump after generating the function prologues and epilogues.
15662
15663 -fdump-rtl-sched1
15664 -fdump-rtl-sched2
15665 -fdump-rtl-sched1 and -fdump-rtl-sched2 enable dumping after
15666 the basic block scheduling passes.
15667
15668 -fdump-rtl-ree
15669 Dump after sign/zero extension elimination.
15670
15671 -fdump-rtl-seqabstr
15672 Dump after common sequence discovery.
15673
15674 -fdump-rtl-shorten
15675 Dump after shortening branches.
15676
15677 -fdump-rtl-sibling
15678 Dump after sibling call optimizations.
15679
15680 -fdump-rtl-split1
15681 -fdump-rtl-split2
15682 -fdump-rtl-split3
15683 -fdump-rtl-split4
15684 -fdump-rtl-split5
15685 These options enable dumping after five rounds of instruction
15686 splitting.
15687
15688 -fdump-rtl-sms
15689 Dump after modulo scheduling. This pass is only run on some
15690 architectures.
15691
15692 -fdump-rtl-stack
15693 Dump after conversion from GCC's "flat register file" registers
15694 to the x87's stack-like registers. This pass is only run on
15695 x86 variants.
15696
15697 -fdump-rtl-subreg1
15698 -fdump-rtl-subreg2
15699 -fdump-rtl-subreg1 and -fdump-rtl-subreg2 enable dumping after
15700 the two subreg expansion passes.
15701
15702 -fdump-rtl-unshare
15703 Dump after all rtl has been unshared.
15704
15705 -fdump-rtl-vartrack
15706 Dump after variable tracking.
15707
15708 -fdump-rtl-vregs
15709 Dump after converting virtual registers to hard registers.
15710
15711 -fdump-rtl-web
15712 Dump after live range splitting.
15713
15714 -fdump-rtl-regclass
15715 -fdump-rtl-subregs_of_mode_init
15716 -fdump-rtl-subregs_of_mode_finish
15717 -fdump-rtl-dfinit
15718 -fdump-rtl-dfinish
15719 These dumps are defined but always produce empty files.
15720
15721 -da
15722 -fdump-rtl-all
15723 Produce all the dumps listed above.
15724
15725 -dA Annotate the assembler output with miscellaneous debugging
15726 information.
15727
15728 -dD Dump all macro definitions, at the end of preprocessing, in
15729 addition to normal output.
15730
15731 -dH Produce a core dump whenever an error occurs.
15732
15733 -dp Annotate the assembler output with a comment indicating which
15734 pattern and alternative is used. The length and cost of each
15735 instruction are also printed.
15736
15737 -dP Dump the RTL in the assembler output as a comment before each
15738 instruction. Also turns on -dp annotation.
15739
15740 -dx Just generate RTL for a function instead of compiling it.
15741 Usually used with -fdump-rtl-expand.
15742
15743 -fdump-debug
15744 Dump debugging information generated during the debug generation
15745 phase.
15746
15747 -fdump-earlydebug
15748 Dump debugging information generated during the early debug
15749 generation phase.
15750
15751 -fdump-noaddr
15752 When doing debugging dumps, suppress address output. This makes it
15753 more feasible to use diff on debugging dumps for compiler
15754 invocations with different compiler binaries and/or different text
15755 / bss / data / heap / stack / dso start locations.
15756
15757 -freport-bug
15758 Collect and dump debug information into a temporary file if an
15759 internal compiler error (ICE) occurs.
15760
15761 -fdump-unnumbered
15762 When doing debugging dumps, suppress instruction numbers and
15763 address output. This makes it more feasible to use diff on
15764 debugging dumps for compiler invocations with different options, in
15765 particular with and without -g.
15766
15767 -fdump-unnumbered-links
15768 When doing debugging dumps (see -d option above), suppress
15769 instruction numbers for the links to the previous and next
15770 instructions in a sequence.
15771
15772 -fdump-ipa-switch
15773 -fdump-ipa-switch-options
15774 Control the dumping at various stages of inter-procedural analysis
15775 language tree to a file. The file name is generated by appending a
15776 switch specific suffix to the source file name, and the file is
15777 created in the same directory as the output file. The following
15778 dumps are possible:
15779
15780 all Enables all inter-procedural analysis dumps.
15781
15782 cgraph
15783 Dumps information about call-graph optimization, unused
15784 function removal, and inlining decisions.
15785
15786 inline
15787 Dump after function inlining.
15788
15789 Additionally, the options -optimized, -missed, -note, and -all can
15790 be provided, with the same meaning as for -fopt-info, defaulting to
15791 -optimized.
15792
15793 For example, -fdump-ipa-inline-optimized-missed will emit
15794 information on callsites that were inlined, along with callsites
15795 that were not inlined.
15796
15797 By default, the dump will contain messages about successful
15798 optimizations (equivalent to -optimized) together with low-level
15799 details about the analysis.
15800
15801 -fdump-lang
15802 Dump language-specific information. The file name is made by
15803 appending .lang to the source file name.
15804
15805 -fdump-lang-all
15806 -fdump-lang-switch
15807 -fdump-lang-switch-options
15808 -fdump-lang-switch-options=filename
15809 Control the dumping of language-specific information. The options
15810 and filename portions behave as described in the -fdump-tree
15811 option. The following switch values are accepted:
15812
15813 all Enable all language-specific dumps.
15814
15815 class
15816 Dump class hierarchy information. Virtual table information is
15817 emitted unless 'slim' is specified. This option is applicable
15818 to C++ only.
15819
15820 module
15821 Dump module information. Options lineno (locations), graph
15822 (reachability), blocks (clusters), uid (serialization), alias
15823 (mergeable), asmname (Elrond), eh (mapper) & vops (macros) may
15824 provide additional information. This option is applicable to
15825 C++ only.
15826
15827 raw Dump the raw internal tree data. This option is applicable to
15828 C++ only.
15829
15830 -fdump-passes
15831 Print on stderr the list of optimization passes that are turned on
15832 and off by the current command-line options.
15833
15834 -fdump-statistics-option
15835 Enable and control dumping of pass statistics in a separate file.
15836 The file name is generated by appending a suffix ending in
15837 .statistics to the source file name, and the file is created in the
15838 same directory as the output file. If the -option form is used,
15839 -stats causes counters to be summed over the whole compilation unit
15840 while -details dumps every event as the passes generate them. The
15841 default with no option is to sum counters for each function
15842 compiled.
15843
15844 -fdump-tree-all
15845 -fdump-tree-switch
15846 -fdump-tree-switch-options
15847 -fdump-tree-switch-options=filename
15848 Control the dumping at various stages of processing the
15849 intermediate language tree to a file. If the -options form is
15850 used, options is a list of - separated options which control the
15851 details of the dump. Not all options are applicable to all dumps;
15852 those that are not meaningful are ignored. The following options
15853 are available
15854
15855 address
15856 Print the address of each node. Usually this is not meaningful
15857 as it changes according to the environment and source file.
15858 Its primary use is for tying up a dump file with a debug
15859 environment.
15860
15861 asmname
15862 If "DECL_ASSEMBLER_NAME" has been set for a given decl, use
15863 that in the dump instead of "DECL_NAME". Its primary use is
15864 ease of use working backward from mangled names in the assembly
15865 file.
15866
15867 slim
15868 When dumping front-end intermediate representations, inhibit
15869 dumping of members of a scope or body of a function merely
15870 because that scope has been reached. Only dump such items when
15871 they are directly reachable by some other path.
15872
15873 When dumping pretty-printed trees, this option inhibits dumping
15874 the bodies of control structures.
15875
15876 When dumping RTL, print the RTL in slim (condensed) form
15877 instead of the default LISP-like representation.
15878
15879 raw Print a raw representation of the tree. By default, trees are
15880 pretty-printed into a C-like representation.
15881
15882 details
15883 Enable more detailed dumps (not honored by every dump option).
15884 Also include information from the optimization passes.
15885
15886 stats
15887 Enable dumping various statistics about the pass (not honored
15888 by every dump option).
15889
15890 blocks
15891 Enable showing basic block boundaries (disabled in raw dumps).
15892
15893 graph
15894 For each of the other indicated dump files (-fdump-rtl-pass),
15895 dump a representation of the control flow graph suitable for
15896 viewing with GraphViz to file.passid.pass.dot. Each function
15897 in the file is pretty-printed as a subgraph, so that GraphViz
15898 can render them all in a single plot.
15899
15900 This option currently only works for RTL dumps, and the RTL is
15901 always dumped in slim form.
15902
15903 vops
15904 Enable showing virtual operands for every statement.
15905
15906 lineno
15907 Enable showing line numbers for statements.
15908
15909 uid Enable showing the unique ID ("DECL_UID") for each variable.
15910
15911 verbose
15912 Enable showing the tree dump for each statement.
15913
15914 eh Enable showing the EH region number holding each statement.
15915
15916 scev
15917 Enable showing scalar evolution analysis details.
15918
15919 optimized
15920 Enable showing optimization information (only available in
15921 certain passes).
15922
15923 missed
15924 Enable showing missed optimization information (only available
15925 in certain passes).
15926
15927 note
15928 Enable other detailed optimization information (only available
15929 in certain passes).
15930
15931 all Turn on all options, except raw, slim, verbose and lineno.
15932
15933 optall
15934 Turn on all optimization options, i.e., optimized, missed, and
15935 note.
15936
15937 To determine what tree dumps are available or find the dump for a
15938 pass of interest follow the steps below.
15939
15940 1. Invoke GCC with -fdump-passes and in the stderr output look for
15941 a code that corresponds to the pass you are interested in. For
15942 example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2"
15943 correspond to the three Value Range Propagation passes. The
15944 number at the end distinguishes distinct invocations of the
15945 same pass.
15946
15947 2. To enable the creation of the dump file, append the pass code
15948 to the -fdump- option prefix and invoke GCC with it. For
15949 example, to enable the dump from the Early Value Range
15950 Propagation pass, invoke GCC with the -fdump-tree-evrp option.
15951 Optionally, you may specify the name of the dump file. If you
15952 don't specify one, GCC creates as described below.
15953
15954 3. Find the pass dump in a file whose name is composed of three
15955 components separated by a period: the name of the source file
15956 GCC was invoked to compile, a numeric suffix indicating the
15957 pass number followed by the letter t for tree passes (and the
15958 letter r for RTL passes), and finally the pass code. For
15959 example, the Early VRP pass dump might be in a file named
15960 myfile.c.038t.evrp in the current working directory. Note that
15961 the numeric codes are not stable and may change from one
15962 version of GCC to another.
15963
15964 -fopt-info
15965 -fopt-info-options
15966 -fopt-info-options=filename
15967 Controls optimization dumps from various optimization passes. If
15968 the -options form is used, options is a list of - separated option
15969 keywords to select the dump details and optimizations.
15970
15971 The options can be divided into three groups:
15972
15973 1. options describing what kinds of messages should be emitted,
15974
15975 2. options describing the verbosity of the dump, and
15976
15977 3. options describing which optimizations should be included.
15978
15979 The options from each group can be freely mixed as they are non-
15980 overlapping. However, in case of any conflicts, the later options
15981 override the earlier options on the command line.
15982
15983 The following options control which kinds of messages should be
15984 emitted:
15985
15986 optimized
15987 Print information when an optimization is successfully applied.
15988 It is up to a pass to decide which information is relevant. For
15989 example, the vectorizer passes print the source location of
15990 loops which are successfully vectorized.
15991
15992 missed
15993 Print information about missed optimizations. Individual passes
15994 control which information to include in the output.
15995
15996 note
15997 Print verbose information about optimizations, such as certain
15998 transformations, more detailed messages about decisions etc.
15999
16000 all Print detailed optimization information. This includes
16001 optimized, missed, and note.
16002
16003 The following option controls the dump verbosity:
16004
16005 internals
16006 By default, only "high-level" messages are emitted. This option
16007 enables additional, more detailed, messages, which are likely
16008 to only be of interest to GCC developers.
16009
16010 One or more of the following option keywords can be used to
16011 describe a group of optimizations:
16012
16013 ipa Enable dumps from all interprocedural optimizations.
16014
16015 loop
16016 Enable dumps from all loop optimizations.
16017
16018 inline
16019 Enable dumps from all inlining optimizations.
16020
16021 omp Enable dumps from all OMP (Offloading and Multi Processing)
16022 optimizations.
16023
16024 vec Enable dumps from all vectorization optimizations.
16025
16026 optall
16027 Enable dumps from all optimizations. This is a superset of the
16028 optimization groups listed above.
16029
16030 If options is omitted, it defaults to optimized-optall, which means
16031 to dump messages about successful optimizations from all the
16032 passes, omitting messages that are treated as "internals".
16033
16034 If the filename is provided, then the dumps from all the applicable
16035 optimizations are concatenated into the filename. Otherwise the
16036 dump is output onto stderr. Though multiple -fopt-info options are
16037 accepted, only one of them can include a filename. If other
16038 filenames are provided then all but the first such option are
16039 ignored.
16040
16041 Note that the output filename is overwritten in case of multiple
16042 translation units. If a combined output from multiple translation
16043 units is desired, stderr should be used instead.
16044
16045 In the following example, the optimization info is output to
16046 stderr:
16047
16048 gcc -O3 -fopt-info
16049
16050 This example:
16051
16052 gcc -O3 -fopt-info-missed=missed.all
16053
16054 outputs missed optimization report from all the passes into
16055 missed.all, and this one:
16056
16057 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
16058
16059 prints information about missed optimization opportunities from
16060 vectorization passes on stderr. Note that -fopt-info-vec-missed is
16061 equivalent to -fopt-info-missed-vec. The order of the optimization
16062 group names and message types listed after -fopt-info does not
16063 matter.
16064
16065 As another example,
16066
16067 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
16068
16069 outputs information about missed optimizations as well as optimized
16070 locations from all the inlining passes into inline.txt.
16071
16072 Finally, consider:
16073
16074 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
16075
16076 Here the two output filenames vec.miss and loop.opt are in conflict
16077 since only one output file is allowed. In this case, only the first
16078 option takes effect and the subsequent options are ignored. Thus
16079 only vec.miss is produced which contains dumps from the vectorizer
16080 about missed opportunities.
16081
16082 -fsave-optimization-record
16083 Write a SRCFILE.opt-record.json.gz file detailing what
16084 optimizations were performed, for those optimizations that support
16085 -fopt-info.
16086
16087 This option is experimental and the format of the data within the
16088 compressed JSON file is subject to change.
16089
16090 It is roughly equivalent to a machine-readable version of
16091 -fopt-info-all, as a collection of messages with source file, line
16092 number and column number, with the following additional data for
16093 each message:
16094
16095 * the execution count of the code being optimized, along with
16096 metadata about whether this was from actual profile data, or
16097 just an estimate, allowing consumers to prioritize messages by
16098 code hotness,
16099
16100 * the function name of the code being optimized, where
16101 applicable,
16102
16103 * the "inlining chain" for the code being optimized, so that when
16104 a function is inlined into several different places (which
16105 might themselves be inlined), the reader can distinguish
16106 between the copies,
16107
16108 * objects identifying those parts of the message that refer to
16109 expressions, statements or symbol-table nodes, which of these
16110 categories they are, and, when available, their source code
16111 location,
16112
16113 * the GCC pass that emitted the message, and
16114
16115 * the location in GCC's own code from which the message was
16116 emitted
16117
16118 Additionally, some messages are logically nested within other
16119 messages, reflecting implementation details of the optimization
16120 passes.
16121
16122 -fsched-verbose=n
16123 On targets that use instruction scheduling, this option controls
16124 the amount of debugging output the scheduler prints to the dump
16125 files.
16126
16127 For n greater than zero, -fsched-verbose outputs the same
16128 information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n
16129 greater than one, it also output basic block probabilities,
16130 detailed ready list information and unit/insn info. For n greater
16131 than two, it includes RTL at abort point, control-flow and regions
16132 info. And for n over four, -fsched-verbose also includes
16133 dependence info.
16134
16135 -fenable-kind-pass
16136 -fdisable-kind-pass=range-list
16137 This is a set of options that are used to explicitly disable/enable
16138 optimization passes. These options are intended for use for
16139 debugging GCC. Compiler users should use regular options for
16140 enabling/disabling passes instead.
16141
16142 -fdisable-ipa-pass
16143 Disable IPA pass pass. pass is the pass name. If the same pass
16144 is statically invoked in the compiler multiple times, the pass
16145 name should be appended with a sequential number starting from
16146 1.
16147
16148 -fdisable-rtl-pass
16149 -fdisable-rtl-pass=range-list
16150 Disable RTL pass pass. pass is the pass name. If the same
16151 pass is statically invoked in the compiler multiple times, the
16152 pass name should be appended with a sequential number starting
16153 from 1. range-list is a comma-separated list of function
16154 ranges or assembler names. Each range is a number pair
16155 separated by a colon. The range is inclusive in both ends. If
16156 the range is trivial, the number pair can be simplified as a
16157 single number. If the function's call graph node's uid falls
16158 within one of the specified ranges, the pass is disabled for
16159 that function. The uid is shown in the function header of a
16160 dump file, and the pass names can be dumped by using option
16161 -fdump-passes.
16162
16163 -fdisable-tree-pass
16164 -fdisable-tree-pass=range-list
16165 Disable tree pass pass. See -fdisable-rtl for the description
16166 of option arguments.
16167
16168 -fenable-ipa-pass
16169 Enable IPA pass pass. pass is the pass name. If the same pass
16170 is statically invoked in the compiler multiple times, the pass
16171 name should be appended with a sequential number starting from
16172 1.
16173
16174 -fenable-rtl-pass
16175 -fenable-rtl-pass=range-list
16176 Enable RTL pass pass. See -fdisable-rtl for option argument
16177 description and examples.
16178
16179 -fenable-tree-pass
16180 -fenable-tree-pass=range-list
16181 Enable tree pass pass. See -fdisable-rtl for the description
16182 of option arguments.
16183
16184 Here are some examples showing uses of these options.
16185
16186 # disable ccp1 for all functions
16187 -fdisable-tree-ccp1
16188 # disable complete unroll for function whose cgraph node uid is 1
16189 -fenable-tree-cunroll=1
16190 # disable gcse2 for functions at the following ranges [1,1],
16191 # [300,400], and [400,1000]
16192 # disable gcse2 for functions foo and foo2
16193 -fdisable-rtl-gcse2=foo,foo2
16194 # disable early inlining
16195 -fdisable-tree-einline
16196 # disable ipa inlining
16197 -fdisable-ipa-inline
16198 # enable tree full unroll
16199 -fenable-tree-unroll
16200
16201 -fchecking
16202 -fchecking=n
16203 Enable internal consistency checking. The default depends on the
16204 compiler configuration. -fchecking=2 enables further internal
16205 consistency checking that might affect code generation.
16206
16207 -frandom-seed=string
16208 This option provides a seed that GCC uses in place of random
16209 numbers in generating certain symbol names that have to be
16210 different in every compiled file. It is also used to place unique
16211 stamps in coverage data files and the object files that produce
16212 them. You can use the -frandom-seed option to produce reproducibly
16213 identical object files.
16214
16215 The string can either be a number (decimal, octal or hex) or an
16216 arbitrary string (in which case it's converted to a number by
16217 computing CRC32).
16218
16219 The string should be different for every file you compile.
16220
16221 -save-temps
16222 Store the usual "temporary" intermediate files permanently; name
16223 them as auxiliary output files, as specified described under
16224 -dumpbase and -dumpdir.
16225
16226 When used in combination with the -x command-line option,
16227 -save-temps is sensible enough to avoid overwriting an input source
16228 file with the same extension as an intermediate file. The
16229 corresponding intermediate file may be obtained by renaming the
16230 source file before using -save-temps.
16231
16232 -save-temps=cwd
16233 Equivalent to -save-temps -dumpdir ./.
16234
16235 -save-temps=obj
16236 Equivalent to -save-temps -dumpdir outdir/, where outdir/ is the
16237 directory of the output file specified after the -o option,
16238 including any directory separators. If the -o option is not used,
16239 the -save-temps=obj switch behaves like -save-temps=cwd.
16240
16241 -time[=file]
16242 Report the CPU time taken by each subprocess in the compilation
16243 sequence. For C source files, this is the compiler proper and
16244 assembler (plus the linker if linking is done).
16245
16246 Without the specification of an output file, the output looks like
16247 this:
16248
16249 # cc1 0.12 0.01
16250 # as 0.00 0.01
16251
16252 The first number on each line is the "user time", that is time
16253 spent executing the program itself. The second number is "system
16254 time", time spent executing operating system routines on behalf of
16255 the program. Both numbers are in seconds.
16256
16257 With the specification of an output file, the output is appended to
16258 the named file, and it looks like this:
16259
16260 0.12 0.01 cc1 <options>
16261 0.00 0.01 as <options>
16262
16263 The "user time" and the "system time" are moved before the program
16264 name, and the options passed to the program are displayed, so that
16265 one can later tell what file was being compiled, and with which
16266 options.
16267
16268 -fdump-final-insns[=file]
16269 Dump the final internal representation (RTL) to file. If the
16270 optional argument is omitted (or if file is "."), the name of the
16271 dump file is determined by appending ".gkd" to the dump base name,
16272 see -dumpbase.
16273
16274 -fcompare-debug[=opts]
16275 If no error occurs during compilation, run the compiler a second
16276 time, adding opts and -fcompare-debug-second to the arguments
16277 passed to the second compilation. Dump the final internal
16278 representation in both compilations, and print an error if they
16279 differ.
16280
16281 If the equal sign is omitted, the default -gtoggle is used.
16282
16283 The environment variable GCC_COMPARE_DEBUG, if defined, non-empty
16284 and nonzero, implicitly enables -fcompare-debug. If
16285 GCC_COMPARE_DEBUG is defined to a string starting with a dash, then
16286 it is used for opts, otherwise the default -gtoggle is used.
16287
16288 -fcompare-debug=, with the equal sign but without opts, is
16289 equivalent to -fno-compare-debug, which disables the dumping of the
16290 final representation and the second compilation, preventing even
16291 GCC_COMPARE_DEBUG from taking effect.
16292
16293 To verify full coverage during -fcompare-debug testing, set
16294 GCC_COMPARE_DEBUG to say -fcompare-debug-not-overridden, which GCC
16295 rejects as an invalid option in any actual compilation (rather than
16296 preprocessing, assembly or linking). To get just a warning,
16297 setting GCC_COMPARE_DEBUG to -w%n-fcompare-debug not overridden
16298 will do.
16299
16300 -fcompare-debug-second
16301 This option is implicitly passed to the compiler for the second
16302 compilation requested by -fcompare-debug, along with options to
16303 silence warnings, and omitting other options that would cause the
16304 compiler to produce output to files or to standard output as a side
16305 effect. Dump files and preserved temporary files are renamed so as
16306 to contain the ".gk" additional extension during the second
16307 compilation, to avoid overwriting those generated by the first.
16308
16309 When this option is passed to the compiler driver, it causes the
16310 first compilation to be skipped, which makes it useful for little
16311 other than debugging the compiler proper.
16312
16313 -gtoggle
16314 Turn off generation of debug info, if leaving out this option
16315 generates it, or turn it on at level 2 otherwise. The position of
16316 this argument in the command line does not matter; it takes effect
16317 after all other options are processed, and it does so only once, no
16318 matter how many times it is given. This is mainly intended to be
16319 used with -fcompare-debug.
16320
16321 -fvar-tracking-assignments-toggle
16322 Toggle -fvar-tracking-assignments, in the same way that -gtoggle
16323 toggles -g.
16324
16325 -Q Makes the compiler print out each function name as it is compiled,
16326 and print some statistics about each pass when it finishes.
16327
16328 -ftime-report
16329 Makes the compiler print some statistics about the time consumed by
16330 each pass when it finishes.
16331
16332 -ftime-report-details
16333 Record the time consumed by infrastructure parts separately for
16334 each pass.
16335
16336 -fira-verbose=n
16337 Control the verbosity of the dump file for the integrated register
16338 allocator. The default value is 5. If the value n is greater or
16339 equal to 10, the dump output is sent to stderr using the same
16340 format as n minus 10.
16341
16342 -flto-report
16343 Prints a report with internal details on the workings of the link-
16344 time optimizer. The contents of this report vary from version to
16345 version. It is meant to be useful to GCC developers when
16346 processing object files in LTO mode (via -flto).
16347
16348 Disabled by default.
16349
16350 -flto-report-wpa
16351 Like -flto-report, but only print for the WPA phase of link-time
16352 optimization.
16353
16354 -fmem-report
16355 Makes the compiler print some statistics about permanent memory
16356 allocation when it finishes.
16357
16358 -fmem-report-wpa
16359 Makes the compiler print some statistics about permanent memory
16360 allocation for the WPA phase only.
16361
16362 -fpre-ipa-mem-report
16363 -fpost-ipa-mem-report
16364 Makes the compiler print some statistics about permanent memory
16365 allocation before or after interprocedural optimization.
16366
16367 -fprofile-report
16368 Makes the compiler print some statistics about consistency of the
16369 (estimated) profile and effect of individual passes.
16370
16371 -fstack-usage
16372 Makes the compiler output stack usage information for the program,
16373 on a per-function basis. The filename for the dump is made by
16374 appending .su to the auxname. auxname is generated from the name
16375 of the output file, if explicitly specified and it is not an
16376 executable, otherwise it is the basename of the source file. An
16377 entry is made up of three fields:
16378
16379 * The name of the function.
16380
16381 * A number of bytes.
16382
16383 * One or more qualifiers: "static", "dynamic", "bounded".
16384
16385 The qualifier "static" means that the function manipulates the
16386 stack statically: a fixed number of bytes are allocated for the
16387 frame on function entry and released on function exit; no stack
16388 adjustments are otherwise made in the function. The second field
16389 is this fixed number of bytes.
16390
16391 The qualifier "dynamic" means that the function manipulates the
16392 stack dynamically: in addition to the static allocation described
16393 above, stack adjustments are made in the body of the function, for
16394 example to push/pop arguments around function calls. If the
16395 qualifier "bounded" is also present, the amount of these
16396 adjustments is bounded at compile time and the second field is an
16397 upper bound of the total amount of stack used by the function. If
16398 it is not present, the amount of these adjustments is not bounded
16399 at compile time and the second field only represents the bounded
16400 part.
16401
16402 -fstats
16403 Emit statistics about front-end processing at the end of the
16404 compilation. This option is supported only by the C++ front end,
16405 and the information is generally only useful to the G++ development
16406 team.
16407
16408 -fdbg-cnt-list
16409 Print the name and the counter upper bound for all debug counters.
16410
16411 -fdbg-cnt=counter-value-list
16412 Set the internal debug counter lower and upper bound. counter-
16413 value-list is a comma-separated list of
16414 name:lower_bound1-upper_bound1 [:lower_bound2-upper_bound2...]
16415 tuples which sets the name of the counter and list of closed
16416 intervals. The lower_bound is optional and is zero initialized if
16417 not set. For example, with -fdbg-cnt=dce:2-4:10-11,tail_call:10,
16418 "dbg_cnt(dce)" returns true only for second, third, fourth, tenth
16419 and eleventh invocation. For "dbg_cnt(tail_call)" true is returned
16420 for first 10 invocations.
16421
16422 -print-file-name=library
16423 Print the full absolute name of the library file library that would
16424 be used when linking---and don't do anything else. With this
16425 option, GCC does not compile or link anything; it just prints the
16426 file name.
16427
16428 -print-multi-directory
16429 Print the directory name corresponding to the multilib selected by
16430 any other switches present in the command line. This directory is
16431 supposed to exist in GCC_EXEC_PREFIX.
16432
16433 -print-multi-lib
16434 Print the mapping from multilib directory names to compiler
16435 switches that enable them. The directory name is separated from
16436 the switches by ;, and each switch starts with an @ instead of the
16437 -, without spaces between multiple switches. This is supposed to
16438 ease shell processing.
16439
16440 -print-multi-os-directory
16441 Print the path to OS libraries for the selected multilib, relative
16442 to some lib subdirectory. If OS libraries are present in the lib
16443 subdirectory and no multilibs are used, this is usually just ., if
16444 OS libraries are present in libsuffix sibling directories this
16445 prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are
16446 present in lib/subdir subdirectories it prints e.g. amd64, sparcv9
16447 or ev6.
16448
16449 -print-multiarch
16450 Print the path to OS libraries for the selected multiarch, relative
16451 to some lib subdirectory.
16452
16453 -print-prog-name=program
16454 Like -print-file-name, but searches for a program such as cpp.
16455
16456 -print-libgcc-file-name
16457 Same as -print-file-name=libgcc.a.
16458
16459 This is useful when you use -nostdlib or -nodefaultlibs but you do
16460 want to link with libgcc.a. You can do:
16461
16462 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
16463
16464 -print-search-dirs
16465 Print the name of the configured installation directory and a list
16466 of program and library directories gcc searches---and don't do
16467 anything else.
16468
16469 This is useful when gcc prints the error message installation
16470 problem, cannot exec cpp0: No such file or directory. To resolve
16471 this you either need to put cpp0 and the other compiler components
16472 where gcc expects to find them, or you can set the environment
16473 variable GCC_EXEC_PREFIX to the directory where you installed them.
16474 Don't forget the trailing /.
16475
16476 -print-sysroot
16477 Print the target sysroot directory that is used during compilation.
16478 This is the target sysroot specified either at configure time or
16479 using the --sysroot option, possibly with an extra suffix that
16480 depends on compilation options. If no target sysroot is specified,
16481 the option prints nothing.
16482
16483 -print-sysroot-headers-suffix
16484 Print the suffix added to the target sysroot when searching for
16485 headers, or give an error if the compiler is not configured with
16486 such a suffix---and don't do anything else.
16487
16488 -dumpmachine
16489 Print the compiler's target machine (for example,
16490 i686-pc-linux-gnu)---and don't do anything else.
16491
16492 -dumpversion
16493 Print the compiler version (for example, 3.0, 6.3.0 or 7)---and
16494 don't do anything else. This is the compiler version used in
16495 filesystem paths and specs. Depending on how the compiler has been
16496 configured it can be just a single number (major version), two
16497 numbers separated by a dot (major and minor version) or three
16498 numbers separated by dots (major, minor and patchlevel version).
16499
16500 -dumpfullversion
16501 Print the full compiler version---and don't do anything else. The
16502 output is always three numbers separated by dots, major, minor and
16503 patchlevel version.
16504
16505 -dumpspecs
16506 Print the compiler's built-in specs---and don't do anything else.
16507 (This is used when GCC itself is being built.)
16508
16509 Machine-Dependent Options
16510 Each target machine supported by GCC can have its own options---for
16511 example, to allow you to compile for a particular processor variant or
16512 ABI, or to control optimizations specific to that machine. By
16513 convention, the names of machine-specific options start with -m.
16514
16515 Some configurations of the compiler also support additional target-
16516 specific options, usually for compatibility with other compilers on the
16517 same platform.
16518
16519 AArch64 Options
16520 These options are defined for AArch64 implementations:
16521
16522 -mabi=name
16523 Generate code for the specified data model. Permissible values are
16524 ilp32 for SysV-like data model where int, long int and pointers are
16525 32 bits, and lp64 for SysV-like data model where int is 32 bits,
16526 but long int and pointers are 64 bits.
16527
16528 The default depends on the specific target configuration. Note
16529 that the LP64 and ILP32 ABIs are not link-compatible; you must
16530 compile your entire program with the same ABI, and link with a
16531 compatible set of libraries.
16532
16533 -mbig-endian
16534 Generate big-endian code. This is the default when GCC is
16535 configured for an aarch64_be-*-* target.
16536
16537 -mgeneral-regs-only
16538 Generate code which uses only the general-purpose registers. This
16539 will prevent the compiler from using floating-point and Advanced
16540 SIMD registers but will not impose any restrictions on the
16541 assembler.
16542
16543 -mlittle-endian
16544 Generate little-endian code. This is the default when GCC is
16545 configured for an aarch64-*-* but not an aarch64_be-*-* target.
16546
16547 -mcmodel=tiny
16548 Generate code for the tiny code model. The program and its
16549 statically defined symbols must be within 1MB of each other.
16550 Programs can be statically or dynamically linked.
16551
16552 -mcmodel=small
16553 Generate code for the small code model. The program and its
16554 statically defined symbols must be within 4GB of each other.
16555 Programs can be statically or dynamically linked. This is the
16556 default code model.
16557
16558 -mcmodel=large
16559 Generate code for the large code model. This makes no assumptions
16560 about addresses and sizes of sections. Programs can be statically
16561 linked only. The -mcmodel=large option is incompatible with
16562 -mabi=ilp32, -fpic and -fPIC.
16563
16564 -mstrict-align
16565 -mno-strict-align
16566 Avoid or allow generating memory accesses that may not be aligned
16567 on a natural object boundary as described in the architecture
16568 specification.
16569
16570 -momit-leaf-frame-pointer
16571 -mno-omit-leaf-frame-pointer
16572 Omit or keep the frame pointer in leaf functions. The former
16573 behavior is the default.
16574
16575 -mstack-protector-guard=guard
16576 -mstack-protector-guard-reg=reg
16577 -mstack-protector-guard-offset=offset
16578 Generate stack protection code using canary at guard. Supported
16579 locations are global for a global canary or sysreg for a canary in
16580 an appropriate system register.
16581
16582 With the latter choice the options -mstack-protector-guard-reg=reg
16583 and -mstack-protector-guard-offset=offset furthermore specify which
16584 system register to use as base register for reading the canary, and
16585 from what offset from that base register. There is no default
16586 register or offset as this is entirely for use within the Linux
16587 kernel.
16588
16589 -mtls-dialect=desc
16590 Use TLS descriptors as the thread-local storage mechanism for
16591 dynamic accesses of TLS variables. This is the default.
16592
16593 -mtls-dialect=traditional
16594 Use traditional TLS as the thread-local storage mechanism for
16595 dynamic accesses of TLS variables.
16596
16597 -mtls-size=size
16598 Specify bit size of immediate TLS offsets. Valid values are 12,
16599 24, 32, 48. This option requires binutils 2.26 or newer.
16600
16601 -mfix-cortex-a53-835769
16602 -mno-fix-cortex-a53-835769
16603 Enable or disable the workaround for the ARM Cortex-A53 erratum
16604 number 835769. This involves inserting a NOP instruction between
16605 memory instructions and 64-bit integer multiply-accumulate
16606 instructions.
16607
16608 -mfix-cortex-a53-843419
16609 -mno-fix-cortex-a53-843419
16610 Enable or disable the workaround for the ARM Cortex-A53 erratum
16611 number 843419. This erratum workaround is made at link time and
16612 this will only pass the corresponding flag to the linker.
16613
16614 -mlow-precision-recip-sqrt
16615 -mno-low-precision-recip-sqrt
16616 Enable or disable the reciprocal square root approximation. This
16617 option only has an effect if -ffast-math or
16618 -funsafe-math-optimizations is used as well. Enabling this reduces
16619 precision of reciprocal square root results to about 16 bits for
16620 single precision and to 32 bits for double precision.
16621
16622 -mlow-precision-sqrt
16623 -mno-low-precision-sqrt
16624 Enable or disable the square root approximation. This option only
16625 has an effect if -ffast-math or -funsafe-math-optimizations is used
16626 as well. Enabling this reduces precision of square root results to
16627 about 16 bits for single precision and to 32 bits for double
16628 precision. If enabled, it implies -mlow-precision-recip-sqrt.
16629
16630 -mlow-precision-div
16631 -mno-low-precision-div
16632 Enable or disable the division approximation. This option only has
16633 an effect if -ffast-math or -funsafe-math-optimizations is used as
16634 well. Enabling this reduces precision of division results to about
16635 16 bits for single precision and to 32 bits for double precision.
16636
16637 -mtrack-speculation
16638 -mno-track-speculation
16639 Enable or disable generation of additional code to track
16640 speculative execution through conditional branches. The tracking
16641 state can then be used by the compiler when expanding calls to
16642 "__builtin_speculation_safe_copy" to permit a more efficient code
16643 sequence to be generated.
16644
16645 -moutline-atomics
16646 -mno-outline-atomics
16647 Enable or disable calls to out-of-line helpers to implement atomic
16648 operations. These helpers will, at runtime, determine if the LSE
16649 instructions from ARMv8.1-A can be used; if not, they will use the
16650 load/store-exclusive instructions that are present in the base
16651 ARMv8.0 ISA.
16652
16653 This option is only applicable when compiling for the base ARMv8.0
16654 instruction set. If using a later revision, e.g. -march=armv8.1-a
16655 or -march=armv8-a+lse, the ARMv8.1-Atomics instructions will be
16656 used directly. The same applies when using -mcpu= when the
16657 selected cpu supports the lse feature. This option is on by
16658 default.
16659
16660 -march=name
16661 Specify the name of the target architecture and, optionally, one or
16662 more feature modifiers. This option has the form
16663 -march=arch{+[no]feature}*.
16664
16665 The table below summarizes the permissible values for arch and the
16666 features that they enable by default:
16667
16668 arch value : Architecture : Includes by default
16669 armv8-a : Armv8-A : +fp, +simd
16670 armv8.1-a : Armv8.1-A : armv8-a, +crc, +lse, +rdma
16671 armv8.2-a : Armv8.2-A : armv8.1-a
16672 armv8.3-a : Armv8.3-A : armv8.2-a, +pauth
16673 armv8.4-a : Armv8.4-A : armv8.3-a, +flagm, +fp16fml, +dotprod
16674 armv8.5-a : Armv8.5-A : armv8.4-a, +sb, +ssbs, +predres
16675 armv8.6-a : Armv8.6-A : armv8.5-a, +bf16, +i8mm
16676 armv8.7-a : Armv8.7-A : armv8.6-a, +ls64
16677 armv8.8-a : Armv8.8-a : armv8.7-a, +mops
16678 armv9-a : Armv9-A : armv8.5-a, +sve, +sve2
16679 armv8-r : Armv8-R : armv8-r
16680
16681 The value native is available on native AArch64 GNU/Linux and
16682 causes the compiler to pick the architecture of the host system.
16683 This option has no effect if the compiler is unable to recognize
16684 the architecture of the host system,
16685
16686 The permissible values for feature are listed in the sub-section on
16687 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
16688 Where conflicting feature modifiers are specified, the right-most
16689 feature is used.
16690
16691 GCC uses name to determine what kind of instructions it can emit
16692 when generating assembly code. If -march is specified without
16693 either of -mtune or -mcpu also being specified, the code is tuned
16694 to perform well across a range of target processors implementing
16695 the target architecture.
16696
16697 -mtune=name
16698 Specify the name of the target processor for which GCC should tune
16699 the performance of the code. Permissible values for this option
16700 are: generic, cortex-a35, cortex-a53, cortex-a55, cortex-a57,
16701 cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae,
16702 cortex-a77, cortex-a65, cortex-a65ae, cortex-a34, cortex-a78,
16703 cortex-a78ae, cortex-a78c, ares, exynos-m1, emag, falkor,
16704 neoverse-512tvb, neoverse-e1, neoverse-n1, neoverse-n2,
16705 neoverse-v1, qdf24xx, saphira, phecda, xgene1, vulcan, octeontx,
16706 octeontx81, octeontx83, octeontx2, octeontx2t98, octeontx2t96
16707 octeontx2t93, octeontx2f95, octeontx2f95n, octeontx2f95mm, a64fx,
16708 thunderx, thunderxt88, thunderxt88p1, thunderxt81, tsv110,
16709 thunderxt83, thunderx2t99, thunderx3t110, zeus,
16710 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
16711 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
16712 cortex-a75.cortex-a55, cortex-a76.cortex-a55, cortex-r82,
16713 cortex-x1, cortex-x2, cortex-a510, cortex-a710, ampere1, native.
16714
16715 The values cortex-a57.cortex-a53, cortex-a72.cortex-a53,
16716 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
16717 cortex-a75.cortex-a55, cortex-a76.cortex-a55 specify that GCC
16718 should tune for a big.LITTLE system.
16719
16720 The value neoverse-512tvb specifies that GCC should tune for
16721 Neoverse cores that (a) implement SVE and (b) have a total vector
16722 bandwidth of 512 bits per cycle. In other words, the option tells
16723 GCC to tune for Neoverse cores that can execute 4 128-bit Advanced
16724 SIMD arithmetic instructions a cycle and that can execute an
16725 equivalent number of SVE arithmetic instructions per cycle (2 for
16726 256-bit SVE, 4 for 128-bit SVE). This is more general than tuning
16727 for a specific core like Neoverse V1 but is more specific than the
16728 default tuning described below.
16729
16730 Additionally on native AArch64 GNU/Linux systems the value native
16731 tunes performance to the host system. This option has no effect if
16732 the compiler is unable to recognize the processor of the host
16733 system.
16734
16735 Where none of -mtune=, -mcpu= or -march= are specified, the code is
16736 tuned to perform well across a range of target processors.
16737
16738 This option cannot be suffixed by feature modifiers.
16739
16740 -mcpu=name
16741 Specify the name of the target processor, optionally suffixed by
16742 one or more feature modifiers. This option has the form
16743 -mcpu=cpu{+[no]feature}*, where the permissible values for cpu are
16744 the same as those available for -mtune. The permissible values for
16745 feature are documented in the sub-section on
16746 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
16747 Where conflicting feature modifiers are specified, the right-most
16748 feature is used.
16749
16750 GCC uses name to determine what kind of instructions it can emit
16751 when generating assembly code (as if by -march) and to determine
16752 the target processor for which to tune for performance (as if by
16753 -mtune). Where this option is used in conjunction with -march or
16754 -mtune, those options take precedence over the appropriate part of
16755 this option.
16756
16757 -mcpu=neoverse-512tvb is special in that it does not refer to a
16758 specific core, but instead refers to all Neoverse cores that (a)
16759 implement SVE and (b) have a total vector bandwidth of 512 bits a
16760 cycle. Unless overridden by -march, -mcpu=neoverse-512tvb
16761 generates code that can run on a Neoverse V1 core, since Neoverse
16762 V1 is the first Neoverse core with these properties. Unless
16763 overridden by -mtune, -mcpu=neoverse-512tvb tunes code in the same
16764 way as for -mtune=neoverse-512tvb.
16765
16766 -moverride=string
16767 Override tuning decisions made by the back-end in response to a
16768 -mtune= switch. The syntax, semantics, and accepted values for
16769 string in this option are not guaranteed to be consistent across
16770 releases.
16771
16772 This option is only intended to be useful when developing GCC.
16773
16774 -mverbose-cost-dump
16775 Enable verbose cost model dumping in the debug dump files. This
16776 option is provided for use in debugging the compiler.
16777
16778 -mpc-relative-literal-loads
16779 -mno-pc-relative-literal-loads
16780 Enable or disable PC-relative literal loads. With this option
16781 literal pools are accessed using a single instruction and emitted
16782 after each function. This limits the maximum size of functions to
16783 1MB. This is enabled by default for -mcmodel=tiny.
16784
16785 -msign-return-address=scope
16786 Select the function scope on which return address signing will be
16787 applied. Permissible values are none, which disables return
16788 address signing, non-leaf, which enables pointer signing for
16789 functions which are not leaf functions, and all, which enables
16790 pointer signing for all functions. The default value is none. This
16791 option has been deprecated by -mbranch-protection.
16792
16793 -mbranch-protection=none|standard|pac-ret[+leaf+b-key]|bti
16794 Select the branch protection features to use. none is the default
16795 and turns off all types of branch protection. standard turns on
16796 all types of branch protection features. If a feature has
16797 additional tuning options, then standard sets it to its standard
16798 level. pac-ret[+leaf] turns on return address signing to its
16799 standard level: signing functions that save the return address to
16800 memory (non-leaf functions will practically always do this) using
16801 the a-key. The optional argument leaf can be used to extend the
16802 signing to include leaf functions. The optional argument b-key can
16803 be used to sign the functions with the B-key instead of the A-key.
16804 bti turns on branch target identification mechanism.
16805
16806 -mharden-sls=opts
16807 Enable compiler hardening against straight line speculation (SLS).
16808 opts is a comma-separated list of the following options:
16809
16810 retbr
16811 blr
16812
16813 In addition, -mharden-sls=all enables all SLS hardening while
16814 -mharden-sls=none disables all SLS hardening.
16815
16816 -msve-vector-bits=bits
16817 Specify the number of bits in an SVE vector register. This option
16818 only has an effect when SVE is enabled.
16819
16820 GCC supports two forms of SVE code generation: "vector-length
16821 agnostic" output that works with any size of vector register and
16822 "vector-length specific" output that allows GCC to make assumptions
16823 about the vector length when it is useful for optimization reasons.
16824 The possible values of bits are: scalable, 128, 256, 512, 1024 and
16825 2048. Specifying scalable selects vector-length agnostic output.
16826 At present -msve-vector-bits=128 also generates vector-length
16827 agnostic output for big-endian targets. All other values generate
16828 vector-length specific code. The behavior of these values may
16829 change in future releases and no value except scalable should be
16830 relied on for producing code that is portable across different
16831 hardware SVE vector lengths.
16832
16833 The default is -msve-vector-bits=scalable, which produces vector-
16834 length agnostic code.
16835
16836 -march and -mcpu Feature Modifiers
16837
16838 Feature modifiers used with -march and -mcpu can be any of the
16839 following and their inverses nofeature:
16840
16841 crc Enable CRC extension. This is on by default for -march=armv8.1-a.
16842
16843 crypto
16844 Enable Crypto extension. This also enables Advanced SIMD and
16845 floating-point instructions.
16846
16847 fp Enable floating-point instructions. This is on by default for all
16848 possible values for options -march and -mcpu.
16849
16850 simd
16851 Enable Advanced SIMD instructions. This also enables floating-
16852 point instructions. This is on by default for all possible values
16853 for options -march and -mcpu.
16854
16855 sve Enable Scalable Vector Extension instructions. This also enables
16856 Advanced SIMD and floating-point instructions.
16857
16858 lse Enable Large System Extension instructions. This is on by default
16859 for -march=armv8.1-a.
16860
16861 rdma
16862 Enable Round Double Multiply Accumulate instructions. This is on
16863 by default for -march=armv8.1-a.
16864
16865 fp16
16866 Enable FP16 extension. This also enables floating-point
16867 instructions.
16868
16869 fp16fml
16870 Enable FP16 fmla extension. This also enables FP16 extensions and
16871 floating-point instructions. This option is enabled by default for
16872 -march=armv8.4-a. Use of this option with architectures prior to
16873 Armv8.2-A is not supported.
16874
16875 rcpc
16876 Enable the RcPc extension. This does not change code generation
16877 from GCC, but is passed on to the assembler, enabling inline asm
16878 statements to use instructions from the RcPc extension.
16879
16880 dotprod
16881 Enable the Dot Product extension. This also enables Advanced SIMD
16882 instructions.
16883
16884 aes Enable the Armv8-a aes and pmull crypto extension. This also
16885 enables Advanced SIMD instructions.
16886
16887 sha2
16888 Enable the Armv8-a sha2 crypto extension. This also enables
16889 Advanced SIMD instructions.
16890
16891 sha3
16892 Enable the sha512 and sha3 crypto extension. This also enables
16893 Advanced SIMD instructions. Use of this option with architectures
16894 prior to Armv8.2-A is not supported.
16895
16896 sm4 Enable the sm3 and sm4 crypto extension. This also enables
16897 Advanced SIMD instructions. Use of this option with architectures
16898 prior to Armv8.2-A is not supported.
16899
16900 profile
16901 Enable the Statistical Profiling extension. This option is only to
16902 enable the extension at the assembler level and does not affect
16903 code generation.
16904
16905 rng Enable the Armv8.5-a Random Number instructions. This option is
16906 only to enable the extension at the assembler level and does not
16907 affect code generation.
16908
16909 memtag
16910 Enable the Armv8.5-a Memory Tagging Extensions. Use of this option
16911 with architectures prior to Armv8.5-A is not supported.
16912
16913 sb Enable the Armv8-a Speculation Barrier instruction. This option is
16914 only to enable the extension at the assembler level and does not
16915 affect code generation. This option is enabled by default for
16916 -march=armv8.5-a.
16917
16918 ssbs
16919 Enable the Armv8-a Speculative Store Bypass Safe instruction. This
16920 option is only to enable the extension at the assembler level and
16921 does not affect code generation. This option is enabled by default
16922 for -march=armv8.5-a.
16923
16924 predres
16925 Enable the Armv8-a Execution and Data Prediction Restriction
16926 instructions. This option is only to enable the extension at the
16927 assembler level and does not affect code generation. This option
16928 is enabled by default for -march=armv8.5-a.
16929
16930 sve2
16931 Enable the Armv8-a Scalable Vector Extension 2. This also enables
16932 SVE instructions.
16933
16934 sve2-bitperm
16935 Enable SVE2 bitperm instructions. This also enables SVE2
16936 instructions.
16937
16938 sve2-sm4
16939 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16940
16941 sve2-aes
16942 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16943
16944 sve2-sha3
16945 Enable SVE2 sha3 instructions. This also enables SVE2
16946 instructions.
16947
16948 tme Enable the Transactional Memory Extension.
16949
16950 i8mm
16951 Enable 8-bit Integer Matrix Multiply instructions. This also
16952 enables Advanced SIMD and floating-point instructions. This option
16953 is enabled by default for -march=armv8.6-a. Use of this option
16954 with architectures prior to Armv8.2-A is not supported.
16955
16956 f32mm
16957 Enable 32-bit Floating point Matrix Multiply instructions. This
16958 also enables SVE instructions. Use of this option with
16959 architectures prior to Armv8.2-A is not supported.
16960
16961 f64mm
16962 Enable 64-bit Floating point Matrix Multiply instructions. This
16963 also enables SVE instructions. Use of this option with
16964 architectures prior to Armv8.2-A is not supported.
16965
16966 bf16
16967 Enable brain half-precision floating-point instructions. This also
16968 enables Advanced SIMD and floating-point instructions. This option
16969 is enabled by default for -march=armv8.6-a. Use of this option
16970 with architectures prior to Armv8.2-A is not supported.
16971
16972 ls64
16973 Enable the 64-byte atomic load and store instructions for
16974 accelerators. This option is enabled by default for
16975 -march=armv8.7-a.
16976
16977 mops
16978 Enable the instructions to accelerate memory operations like
16979 "memcpy", "memmove", "memset". This option is enabled by default
16980 for -march=armv8.8-a
16981
16982 flagm
16983 Enable the Flag Manipulation instructions Extension.
16984
16985 pauth
16986 Enable the Pointer Authentication Extension.
16987
16988 Feature crypto implies aes, sha2, and simd, which implies fp.
16989 Conversely, nofp implies nosimd, which implies nocrypto, noaes and
16990 nosha2.
16991
16992 Adapteva Epiphany Options
16993 These -m options are defined for Adapteva Epiphany:
16994
16995 -mhalf-reg-file
16996 Don't allocate any register in the range "r32"..."r63". That
16997 allows code to run on hardware variants that lack these registers.
16998
16999 -mprefer-short-insn-regs
17000 Preferentially allocate registers that allow short instruction
17001 generation. This can result in increased instruction count, so
17002 this may either reduce or increase overall code size.
17003
17004 -mbranch-cost=num
17005 Set the cost of branches to roughly num "simple" instructions.
17006 This cost is only a heuristic and is not guaranteed to produce
17007 consistent results across releases.
17008
17009 -mcmove
17010 Enable the generation of conditional moves.
17011
17012 -mnops=num
17013 Emit num NOPs before every other generated instruction.
17014
17015 -mno-soft-cmpsf
17016 For single-precision floating-point comparisons, emit an "fsub"
17017 instruction and test the flags. This is faster than a software
17018 comparison, but can get incorrect results in the presence of NaNs,
17019 or when two different small numbers are compared such that their
17020 difference is calculated as zero. The default is -msoft-cmpsf,
17021 which uses slower, but IEEE-compliant, software comparisons.
17022
17023 -mstack-offset=num
17024 Set the offset between the top of the stack and the stack pointer.
17025 E.g., a value of 8 means that the eight bytes in the range
17026 "sp+0...sp+7" can be used by leaf functions without stack
17027 allocation. Values other than 8 or 16 are untested and unlikely to
17028 work. Note also that this option changes the ABI; compiling a
17029 program with a different stack offset than the libraries have been
17030 compiled with generally does not work. This option can be useful
17031 if you want to evaluate if a different stack offset would give you
17032 better code, but to actually use a different stack offset to build
17033 working programs, it is recommended to configure the toolchain with
17034 the appropriate --with-stack-offset=num option.
17035
17036 -mno-round-nearest
17037 Make the scheduler assume that the rounding mode has been set to
17038 truncating. The default is -mround-nearest.
17039
17040 -mlong-calls
17041 If not otherwise specified by an attribute, assume all calls might
17042 be beyond the offset range of the "b" / "bl" instructions, and
17043 therefore load the function address into a register before
17044 performing a (otherwise direct) call. This is the default.
17045
17046 -mshort-calls
17047 If not otherwise specified by an attribute, assume all direct calls
17048 are in the range of the "b" / "bl" instructions, so use these
17049 instructions for direct calls. The default is -mlong-calls.
17050
17051 -msmall16
17052 Assume addresses can be loaded as 16-bit unsigned values. This
17053 does not apply to function addresses for which -mlong-calls
17054 semantics are in effect.
17055
17056 -mfp-mode=mode
17057 Set the prevailing mode of the floating-point unit. This
17058 determines the floating-point mode that is provided and expected at
17059 function call and return time. Making this mode match the mode you
17060 predominantly need at function start can make your programs smaller
17061 and faster by avoiding unnecessary mode switches.
17062
17063 mode can be set to one the following values:
17064
17065 caller
17066 Any mode at function entry is valid, and retained or restored
17067 when the function returns, and when it calls other functions.
17068 This mode is useful for compiling libraries or other
17069 compilation units you might want to incorporate into different
17070 programs with different prevailing FPU modes, and the
17071 convenience of being able to use a single object file outweighs
17072 the size and speed overhead for any extra mode switching that
17073 might be needed, compared with what would be needed with a more
17074 specific choice of prevailing FPU mode.
17075
17076 truncate
17077 This is the mode used for floating-point calculations with
17078 truncating (i.e. round towards zero) rounding mode. That
17079 includes conversion from floating point to integer.
17080
17081 round-nearest
17082 This is the mode used for floating-point calculations with
17083 round-to-nearest-or-even rounding mode.
17084
17085 int This is the mode used to perform integer calculations in the
17086 FPU, e.g. integer multiply, or integer multiply-and-
17087 accumulate.
17088
17089 The default is -mfp-mode=caller
17090
17091 -mno-split-lohi
17092 -mno-postinc
17093 -mno-postmodify
17094 Code generation tweaks that disable, respectively, splitting of
17095 32-bit loads, generation of post-increment addresses, and
17096 generation of post-modify addresses. The defaults are msplit-lohi,
17097 -mpost-inc, and -mpost-modify.
17098
17099 -mnovect-double
17100 Change the preferred SIMD mode to SImode. The default is
17101 -mvect-double, which uses DImode as preferred SIMD mode.
17102
17103 -max-vect-align=num
17104 The maximum alignment for SIMD vector mode types. num may be 4 or
17105 8. The default is 8. Note that this is an ABI change, even though
17106 many library function interfaces are unaffected if they don't use
17107 SIMD vector modes in places that affect size and/or alignment of
17108 relevant types.
17109
17110 -msplit-vecmove-early
17111 Split vector moves into single word moves before reload. In theory
17112 this can give better register allocation, but so far the reverse
17113 seems to be generally the case.
17114
17115 -m1reg-reg
17116 Specify a register to hold the constant -1, which makes loading
17117 small negative constants and certain bitmasks faster. Allowable
17118 values for reg are r43 and r63, which specify use of that register
17119 as a fixed register, and none, which means that no register is used
17120 for this purpose. The default is -m1reg-none.
17121
17122 AMD GCN Options
17123 These options are defined specifically for the AMD GCN port.
17124
17125 -march=gpu
17126 -mtune=gpu
17127 Set architecture type or tuning for gpu. Supported values for gpu
17128 are
17129
17130 fiji
17131 Compile for GCN3 Fiji devices (gfx803).
17132
17133 gfx900
17134 Compile for GCN5 Vega 10 devices (gfx900).
17135
17136 gfx906
17137 Compile for GCN5 Vega 20 devices (gfx906).
17138
17139 -msram-ecc=on
17140 -msram-ecc=off
17141 -msram-ecc=any
17142 Compile binaries suitable for devices with the SRAM-ECC feature
17143 enabled, disabled, or either mode. This feature can be enabled
17144 per-process on some devices. The compiled code must match the
17145 device mode. The default is any, for devices that support it.
17146
17147 -mstack-size=bytes
17148 Specify how many bytes of stack space will be requested for each
17149 GPU thread (wave-front). Beware that there may be many threads and
17150 limited memory available. The size of the stack allocation may
17151 also have an impact on run-time performance. The default is 32KB
17152 when using OpenACC or OpenMP, and 1MB otherwise.
17153
17154 -mxnack
17155 Compile binaries suitable for devices with the XNACK feature
17156 enabled. Some devices always require XNACK and some allow the user
17157 to configure XNACK. The compiled code must match the device mode.
17158 The default is -mno-xnack. At present this option is a placeholder
17159 for support that is not yet implemented.
17160
17161 ARC Options
17162 The following options control the architecture variant for which code
17163 is being compiled:
17164
17165 -mbarrel-shifter
17166 Generate instructions supported by barrel shifter. This is the
17167 default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
17168
17169 -mjli-always
17170 Force to call a function using jli_s instruction. This option is
17171 valid only for ARCv2 architecture.
17172
17173 -mcpu=cpu
17174 Set architecture type, register usage, and instruction scheduling
17175 parameters for cpu. There are also shortcut alias options
17176 available for backward compatibility and convenience. Supported
17177 values for cpu are
17178
17179 arc600
17180 Compile for ARC600. Aliases: -mA6, -mARC600.
17181
17182 arc601
17183 Compile for ARC601. Alias: -mARC601.
17184
17185 arc700
17186 Compile for ARC700. Aliases: -mA7, -mARC700. This is the
17187 default when configured with --with-cpu=arc700.
17188
17189 arcem
17190 Compile for ARC EM.
17191
17192 archs
17193 Compile for ARC HS.
17194
17195 em Compile for ARC EM CPU with no hardware extensions.
17196
17197 em4 Compile for ARC EM4 CPU.
17198
17199 em4_dmips
17200 Compile for ARC EM4 DMIPS CPU.
17201
17202 em4_fpus
17203 Compile for ARC EM4 DMIPS CPU with the single-precision
17204 floating-point extension.
17205
17206 em4_fpuda
17207 Compile for ARC EM4 DMIPS CPU with single-precision floating-
17208 point and double assist instructions.
17209
17210 hs Compile for ARC HS CPU with no hardware extensions except the
17211 atomic instructions.
17212
17213 hs34
17214 Compile for ARC HS34 CPU.
17215
17216 hs38
17217 Compile for ARC HS38 CPU.
17218
17219 hs38_linux
17220 Compile for ARC HS38 CPU with all hardware extensions on.
17221
17222 arc600_norm
17223 Compile for ARC 600 CPU with "norm" instructions enabled.
17224
17225 arc600_mul32x16
17226 Compile for ARC 600 CPU with "norm" and 32x16-bit multiply
17227 instructions enabled.
17228
17229 arc600_mul64
17230 Compile for ARC 600 CPU with "norm" and "mul64"-family
17231 instructions enabled.
17232
17233 arc601_norm
17234 Compile for ARC 601 CPU with "norm" instructions enabled.
17235
17236 arc601_mul32x16
17237 Compile for ARC 601 CPU with "norm" and 32x16-bit multiply
17238 instructions enabled.
17239
17240 arc601_mul64
17241 Compile for ARC 601 CPU with "norm" and "mul64"-family
17242 instructions enabled.
17243
17244 nps400
17245 Compile for ARC 700 on NPS400 chip.
17246
17247 em_mini
17248 Compile for ARC EM minimalist configuration featuring reduced
17249 register set.
17250
17251 -mdpfp
17252 -mdpfp-compact
17253 Generate double-precision FPX instructions, tuned for the compact
17254 implementation.
17255
17256 -mdpfp-fast
17257 Generate double-precision FPX instructions, tuned for the fast
17258 implementation.
17259
17260 -mno-dpfp-lrsr
17261 Disable "lr" and "sr" instructions from using FPX extension aux
17262 registers.
17263
17264 -mea
17265 Generate extended arithmetic instructions. Currently only "divaw",
17266 "adds", "subs", and "sat16" are supported. Only valid for
17267 -mcpu=ARC700.
17268
17269 -mno-mpy
17270 Do not generate "mpy"-family instructions for ARC700. This option
17271 is deprecated.
17272
17273 -mmul32x16
17274 Generate 32x16-bit multiply and multiply-accumulate instructions.
17275
17276 -mmul64
17277 Generate "mul64" and "mulu64" instructions. Only valid for
17278 -mcpu=ARC600.
17279
17280 -mnorm
17281 Generate "norm" instructions. This is the default if -mcpu=ARC700
17282 is in effect.
17283
17284 -mspfp
17285 -mspfp-compact
17286 Generate single-precision FPX instructions, tuned for the compact
17287 implementation.
17288
17289 -mspfp-fast
17290 Generate single-precision FPX instructions, tuned for the fast
17291 implementation.
17292
17293 -msimd
17294 Enable generation of ARC SIMD instructions via target-specific
17295 builtins. Only valid for -mcpu=ARC700.
17296
17297 -msoft-float
17298 This option ignored; it is provided for compatibility purposes
17299 only. Software floating-point code is emitted by default, and this
17300 default can overridden by FPX options; -mspfp, -mspfp-compact, or
17301 -mspfp-fast for single precision, and -mdpfp, -mdpfp-compact, or
17302 -mdpfp-fast for double precision.
17303
17304 -mswap
17305 Generate "swap" instructions.
17306
17307 -matomic
17308 This enables use of the locked load/store conditional extension to
17309 implement atomic memory built-in functions. Not available for ARC
17310 6xx or ARC EM cores.
17311
17312 -mdiv-rem
17313 Enable "div" and "rem" instructions for ARCv2 cores.
17314
17315 -mcode-density
17316 Enable code density instructions for ARC EM. This option is on by
17317 default for ARC HS.
17318
17319 -mll64
17320 Enable double load/store operations for ARC HS cores.
17321
17322 -mtp-regno=regno
17323 Specify thread pointer register number.
17324
17325 -mmpy-option=multo
17326 Compile ARCv2 code with a multiplier design option. You can
17327 specify the option using either a string or numeric value for
17328 multo. wlh1 is the default value. The recognized values are:
17329
17330 0
17331 none
17332 No multiplier available.
17333
17334 1
17335 w 16x16 multiplier, fully pipelined. The following instructions
17336 are enabled: "mpyw" and "mpyuw".
17337
17338 2
17339 wlh1
17340 32x32 multiplier, fully pipelined (1 stage). The following
17341 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17342 "mpymu", and "mpy_s".
17343
17344 3
17345 wlh2
17346 32x32 multiplier, fully pipelined (2 stages). The following
17347 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17348 "mpymu", and "mpy_s".
17349
17350 4
17351 wlh3
17352 Two 16x16 multipliers, blocking, sequential. The following
17353 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17354 "mpymu", and "mpy_s".
17355
17356 5
17357 wlh4
17358 One 16x16 multiplier, blocking, sequential. The following
17359 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17360 "mpymu", and "mpy_s".
17361
17362 6
17363 wlh5
17364 One 32x4 multiplier, blocking, sequential. The following
17365 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17366 "mpymu", and "mpy_s".
17367
17368 7
17369 plus_dmpy
17370 ARC HS SIMD support.
17371
17372 8
17373 plus_macd
17374 ARC HS SIMD support.
17375
17376 9
17377 plus_qmacw
17378 ARC HS SIMD support.
17379
17380 This option is only available for ARCv2 cores.
17381
17382 -mfpu=fpu
17383 Enables support for specific floating-point hardware extensions for
17384 ARCv2 cores. Supported values for fpu are:
17385
17386 fpus
17387 Enables support for single-precision floating-point hardware
17388 extensions.
17389
17390 fpud
17391 Enables support for double-precision floating-point hardware
17392 extensions. The single-precision floating-point extension is
17393 also enabled. Not available for ARC EM.
17394
17395 fpuda
17396 Enables support for double-precision floating-point hardware
17397 extensions using double-precision assist instructions. The
17398 single-precision floating-point extension is also enabled.
17399 This option is only available for ARC EM.
17400
17401 fpuda_div
17402 Enables support for double-precision floating-point hardware
17403 extensions using double-precision assist instructions. The
17404 single-precision floating-point, square-root, and divide
17405 extensions are also enabled. This option is only available for
17406 ARC EM.
17407
17408 fpuda_fma
17409 Enables support for double-precision floating-point hardware
17410 extensions using double-precision assist instructions. The
17411 single-precision floating-point and fused multiply and add
17412 hardware extensions are also enabled. This option is only
17413 available for ARC EM.
17414
17415 fpuda_all
17416 Enables support for double-precision floating-point hardware
17417 extensions using double-precision assist instructions. All
17418 single-precision floating-point hardware extensions are also
17419 enabled. This option is only available for ARC EM.
17420
17421 fpus_div
17422 Enables support for single-precision floating-point, square-
17423 root and divide hardware extensions.
17424
17425 fpud_div
17426 Enables support for double-precision floating-point, square-
17427 root and divide hardware extensions. This option includes
17428 option fpus_div. Not available for ARC EM.
17429
17430 fpus_fma
17431 Enables support for single-precision floating-point and fused
17432 multiply and add hardware extensions.
17433
17434 fpud_fma
17435 Enables support for double-precision floating-point and fused
17436 multiply and add hardware extensions. This option includes
17437 option fpus_fma. Not available for ARC EM.
17438
17439 fpus_all
17440 Enables support for all single-precision floating-point
17441 hardware extensions.
17442
17443 fpud_all
17444 Enables support for all single- and double-precision floating-
17445 point hardware extensions. Not available for ARC EM.
17446
17447 -mirq-ctrl-saved=register-range, blink, lp_count
17448 Specifies general-purposes registers that the processor
17449 automatically saves/restores on interrupt entry and exit.
17450 register-range is specified as two registers separated by a dash.
17451 The register range always starts with "r0", the upper limit is "fp"
17452 register. blink and lp_count are optional. This option is only
17453 valid for ARC EM and ARC HS cores.
17454
17455 -mrgf-banked-regs=number
17456 Specifies the number of registers replicated in second register
17457 bank on entry to fast interrupt. Fast interrupts are interrupts
17458 with the highest priority level P0. These interrupts save only PC
17459 and STATUS32 registers to avoid memory transactions during
17460 interrupt entry and exit sequences. Use this option when you are
17461 using fast interrupts in an ARC V2 family processor. Permitted
17462 values are 4, 8, 16, and 32.
17463
17464 -mlpc-width=width
17465 Specify the width of the "lp_count" register. Valid values for
17466 width are 8, 16, 20, 24, 28 and 32 bits. The default width is
17467 fixed to 32 bits. If the width is less than 32, the compiler does
17468 not attempt to transform loops in your program to use the zero-
17469 delay loop mechanism unless it is known that the "lp_count"
17470 register can hold the required loop-counter value. Depending on
17471 the width specified, the compiler and run-time library might
17472 continue to use the loop mechanism for various needs. This option
17473 defines macro "__ARC_LPC_WIDTH__" with the value of width.
17474
17475 -mrf16
17476 This option instructs the compiler to generate code for a 16-entry
17477 register file. This option defines the "__ARC_RF16__" preprocessor
17478 macro.
17479
17480 -mbranch-index
17481 Enable use of "bi" or "bih" instructions to implement jump tables.
17482
17483 The following options are passed through to the assembler, and also
17484 define preprocessor macro symbols.
17485
17486 -mdsp-packa
17487 Passed down to the assembler to enable the DSP Pack A extensions.
17488 Also sets the preprocessor symbol "__Xdsp_packa". This option is
17489 deprecated.
17490
17491 -mdvbf
17492 Passed down to the assembler to enable the dual Viterbi butterfly
17493 extension. Also sets the preprocessor symbol "__Xdvbf". This
17494 option is deprecated.
17495
17496 -mlock
17497 Passed down to the assembler to enable the locked load/store
17498 conditional extension. Also sets the preprocessor symbol
17499 "__Xlock".
17500
17501 -mmac-d16
17502 Passed down to the assembler. Also sets the preprocessor symbol
17503 "__Xxmac_d16". This option is deprecated.
17504
17505 -mmac-24
17506 Passed down to the assembler. Also sets the preprocessor symbol
17507 "__Xxmac_24". This option is deprecated.
17508
17509 -mrtsc
17510 Passed down to the assembler to enable the 64-bit time-stamp
17511 counter extension instruction. Also sets the preprocessor symbol
17512 "__Xrtsc". This option is deprecated.
17513
17514 -mswape
17515 Passed down to the assembler to enable the swap byte ordering
17516 extension instruction. Also sets the preprocessor symbol
17517 "__Xswape".
17518
17519 -mtelephony
17520 Passed down to the assembler to enable dual- and single-operand
17521 instructions for telephony. Also sets the preprocessor symbol
17522 "__Xtelephony". This option is deprecated.
17523
17524 -mxy
17525 Passed down to the assembler to enable the XY memory extension.
17526 Also sets the preprocessor symbol "__Xxy".
17527
17528 The following options control how the assembly code is annotated:
17529
17530 -misize
17531 Annotate assembler instructions with estimated addresses.
17532
17533 -mannotate-align
17534 Explain what alignment considerations lead to the decision to make
17535 an instruction short or long.
17536
17537 The following options are passed through to the linker:
17538
17539 -marclinux
17540 Passed through to the linker, to specify use of the "arclinux"
17541 emulation. This option is enabled by default in tool chains built
17542 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
17543 profiling is not requested.
17544
17545 -marclinux_prof
17546 Passed through to the linker, to specify use of the "arclinux_prof"
17547 emulation. This option is enabled by default in tool chains built
17548 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
17549 profiling is requested.
17550
17551 The following options control the semantics of generated code:
17552
17553 -mlong-calls
17554 Generate calls as register indirect calls, thus providing access to
17555 the full 32-bit address range.
17556
17557 -mmedium-calls
17558 Don't use less than 25-bit addressing range for calls, which is the
17559 offset available for an unconditional branch-and-link instruction.
17560 Conditional execution of function calls is suppressed, to allow use
17561 of the 25-bit range, rather than the 21-bit range with conditional
17562 branch-and-link. This is the default for tool chains built for
17563 "arc-linux-uclibc" and "arceb-linux-uclibc" targets.
17564
17565 -G num
17566 Put definitions of externally-visible data in a small data section
17567 if that data is no bigger than num bytes. The default value of num
17568 is 4 for any ARC configuration, or 8 when we have double load/store
17569 operations.
17570
17571 -mno-sdata
17572 Do not generate sdata references. This is the default for tool
17573 chains built for "arc-linux-uclibc" and "arceb-linux-uclibc"
17574 targets.
17575
17576 -mvolatile-cache
17577 Use ordinarily cached memory accesses for volatile references.
17578 This is the default.
17579
17580 -mno-volatile-cache
17581 Enable cache bypass for volatile references.
17582
17583 The following options fine tune code generation:
17584
17585 -malign-call
17586 Does nothing. Preserved for backward compatibility.
17587
17588 -mauto-modify-reg
17589 Enable the use of pre/post modify with register displacement.
17590
17591 -mbbit-peephole
17592 Enable bbit peephole2.
17593
17594 -mno-brcc
17595 This option disables a target-specific pass in arc_reorg to
17596 generate compare-and-branch ("brcc") instructions. It has no
17597 effect on generation of these instructions driven by the combiner
17598 pass.
17599
17600 -mcase-vector-pcrel
17601 Use PC-relative switch case tables to enable case table shortening.
17602 This is the default for -Os.
17603
17604 -mcompact-casesi
17605 Enable compact "casesi" pattern. This is the default for -Os, and
17606 only available for ARCv1 cores. This option is deprecated.
17607
17608 -mno-cond-exec
17609 Disable the ARCompact-specific pass to generate conditional
17610 execution instructions.
17611
17612 Due to delay slot scheduling and interactions between operand
17613 numbers, literal sizes, instruction lengths, and the support for
17614 conditional execution, the target-independent pass to generate
17615 conditional execution is often lacking, so the ARC port has kept a
17616 special pass around that tries to find more conditional execution
17617 generation opportunities after register allocation, branch
17618 shortening, and delay slot scheduling have been done. This pass
17619 generally, but not always, improves performance and code size, at
17620 the cost of extra compilation time, which is why there is an option
17621 to switch it off. If you have a problem with call instructions
17622 exceeding their allowable offset range because they are
17623 conditionalized, you should consider using -mmedium-calls instead.
17624
17625 -mearly-cbranchsi
17626 Enable pre-reload use of the "cbranchsi" pattern.
17627
17628 -mexpand-adddi
17629 Expand "adddi3" and "subdi3" at RTL generation time into "add.f",
17630 "adc" etc. This option is deprecated.
17631
17632 -mindexed-loads
17633 Enable the use of indexed loads. This can be problematic because
17634 some optimizers then assume that indexed stores exist, which is not
17635 the case.
17636
17637 -mlra
17638 Enable Local Register Allocation. This is still experimental for
17639 ARC, so by default the compiler uses standard reload (i.e.
17640 -mno-lra).
17641
17642 -mlra-priority-none
17643 Don't indicate any priority for target registers.
17644
17645 -mlra-priority-compact
17646 Indicate target register priority for r0..r3 / r12..r15.
17647
17648 -mlra-priority-noncompact
17649 Reduce target register priority for r0..r3 / r12..r15.
17650
17651 -mmillicode
17652 When optimizing for size (using -Os), prologues and epilogues that
17653 have to save or restore a large number of registers are often
17654 shortened by using call to a special function in libgcc; this is
17655 referred to as a millicode call. As these calls can pose
17656 performance issues, and/or cause linking issues when linking in a
17657 nonstandard way, this option is provided to turn on or off
17658 millicode call generation.
17659
17660 -mcode-density-frame
17661 This option enable the compiler to emit "enter" and "leave"
17662 instructions. These instructions are only valid for CPUs with
17663 code-density feature.
17664
17665 -mmixed-code
17666 Does nothing. Preserved for backward compatibility.
17667
17668 -mq-class
17669 Ths option is deprecated. Enable q instruction alternatives. This
17670 is the default for -Os.
17671
17672 -mRcq
17673 Enable Rcq constraint handling. Most short code generation depends
17674 on this. This is the default.
17675
17676 -mRcw
17677 Enable Rcw constraint handling. Most ccfsm condexec mostly depends
17678 on this. This is the default.
17679
17680 -msize-level=level
17681 Fine-tune size optimization with regards to instruction lengths and
17682 alignment. The recognized values for level are:
17683
17684 0 No size optimization. This level is deprecated and treated
17685 like 1.
17686
17687 1 Short instructions are used opportunistically.
17688
17689 2 In addition, alignment of loops and of code after barriers are
17690 dropped.
17691
17692 3 In addition, optional data alignment is dropped, and the option
17693 Os is enabled.
17694
17695 This defaults to 3 when -Os is in effect. Otherwise, the behavior
17696 when this is not set is equivalent to level 1.
17697
17698 -mtune=cpu
17699 Set instruction scheduling parameters for cpu, overriding any
17700 implied by -mcpu=.
17701
17702 Supported values for cpu are
17703
17704 ARC600
17705 Tune for ARC600 CPU.
17706
17707 ARC601
17708 Tune for ARC601 CPU.
17709
17710 ARC700
17711 Tune for ARC700 CPU with standard multiplier block.
17712
17713 ARC700-xmac
17714 Tune for ARC700 CPU with XMAC block.
17715
17716 ARC725D
17717 Tune for ARC725D CPU.
17718
17719 ARC750D
17720 Tune for ARC750D CPU.
17721
17722 -mmultcost=num
17723 Cost to assume for a multiply instruction, with 4 being equal to a
17724 normal instruction.
17725
17726 -munalign-prob-threshold=probability
17727 Does nothing. Preserved for backward compatibility.
17728
17729 The following options are maintained for backward compatibility, but
17730 are now deprecated and will be removed in a future release:
17731
17732 -margonaut
17733 Obsolete FPX.
17734
17735 -mbig-endian
17736 -EB Compile code for big-endian targets. Use of these options is now
17737 deprecated. Big-endian code is supported by configuring GCC to
17738 build "arceb-elf32" and "arceb-linux-uclibc" targets, for which big
17739 endian is the default.
17740
17741 -mlittle-endian
17742 -EL Compile code for little-endian targets. Use of these options is
17743 now deprecated. Little-endian code is supported by configuring GCC
17744 to build "arc-elf32" and "arc-linux-uclibc" targets, for which
17745 little endian is the default.
17746
17747 -mbarrel_shifter
17748 Replaced by -mbarrel-shifter.
17749
17750 -mdpfp_compact
17751 Replaced by -mdpfp-compact.
17752
17753 -mdpfp_fast
17754 Replaced by -mdpfp-fast.
17755
17756 -mdsp_packa
17757 Replaced by -mdsp-packa.
17758
17759 -mEA
17760 Replaced by -mea.
17761
17762 -mmac_24
17763 Replaced by -mmac-24.
17764
17765 -mmac_d16
17766 Replaced by -mmac-d16.
17767
17768 -mspfp_compact
17769 Replaced by -mspfp-compact.
17770
17771 -mspfp_fast
17772 Replaced by -mspfp-fast.
17773
17774 -mtune=cpu
17775 Values arc600, arc601, arc700 and arc700-xmac for cpu are replaced
17776 by ARC600, ARC601, ARC700 and ARC700-xmac respectively.
17777
17778 -multcost=num
17779 Replaced by -mmultcost.
17780
17781 ARM Options
17782 These -m options are defined for the ARM port:
17783
17784 -mabi=name
17785 Generate code for the specified ABI. Permissible values are: apcs-
17786 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
17787
17788 -mapcs-frame
17789 Generate a stack frame that is compliant with the ARM Procedure
17790 Call Standard for all functions, even if this is not strictly
17791 necessary for correct execution of the code. Specifying
17792 -fomit-frame-pointer with this option causes the stack frames not
17793 to be generated for leaf functions. The default is
17794 -mno-apcs-frame. This option is deprecated.
17795
17796 -mapcs
17797 This is a synonym for -mapcs-frame and is deprecated.
17798
17799 -mthumb-interwork
17800 Generate code that supports calling between the ARM and Thumb
17801 instruction sets. Without this option, on pre-v5 architectures,
17802 the two instruction sets cannot be reliably used inside one
17803 program. The default is -mno-thumb-interwork, since slightly
17804 larger code is generated when -mthumb-interwork is specified. In
17805 AAPCS configurations this option is meaningless.
17806
17807 -mno-sched-prolog
17808 Prevent the reordering of instructions in the function prologue, or
17809 the merging of those instruction with the instructions in the
17810 function's body. This means that all functions start with a
17811 recognizable set of instructions (or in fact one of a choice from a
17812 small set of different function prologues), and this information
17813 can be used to locate the start of functions inside an executable
17814 piece of code. The default is -msched-prolog.
17815
17816 -mfloat-abi=name
17817 Specifies which floating-point ABI to use. Permissible values are:
17818 soft, softfp and hard.
17819
17820 Specifying soft causes GCC to generate output containing library
17821 calls for floating-point operations. softfp allows the generation
17822 of code using hardware floating-point instructions, but still uses
17823 the soft-float calling conventions. hard allows generation of
17824 floating-point instructions and uses FPU-specific calling
17825 conventions.
17826
17827 The default depends on the specific target configuration. Note
17828 that the hard-float and soft-float ABIs are not link-compatible;
17829 you must compile your entire program with the same ABI, and link
17830 with a compatible set of libraries.
17831
17832 -mgeneral-regs-only
17833 Generate code which uses only the general-purpose registers. This
17834 will prevent the compiler from using floating-point and Advanced
17835 SIMD registers but will not impose any restrictions on the
17836 assembler.
17837
17838 -mlittle-endian
17839 Generate code for a processor running in little-endian mode. This
17840 is the default for all standard configurations.
17841
17842 -mbig-endian
17843 Generate code for a processor running in big-endian mode; the
17844 default is to compile code for a little-endian processor.
17845
17846 -mbe8
17847 -mbe32
17848 When linking a big-endian image select between BE8 and BE32
17849 formats. The option has no effect for little-endian images and is
17850 ignored. The default is dependent on the selected target
17851 architecture. For ARMv6 and later architectures the default is
17852 BE8, for older architectures the default is BE32. BE32 format has
17853 been deprecated by ARM.
17854
17855 -march=name[+extension...]
17856 This specifies the name of the target ARM architecture. GCC uses
17857 this name to determine what kind of instructions it can emit when
17858 generating assembly code. This option can be used in conjunction
17859 with or instead of the -mcpu= option.
17860
17861 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
17862 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
17863 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
17864 armv8.6-a, armv9-a, armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m,
17865 armv7e-m, armv8-m.base, armv8-m.main, armv8.1-m.main, armv9-a,
17866 iwmmxt and iwmmxt2.
17867
17868 Additionally, the following architectures, which lack support for
17869 the Thumb execution state, are recognized but support is
17870 deprecated: armv4.
17871
17872 Many of the architectures support extensions. These can be added
17873 by appending +extension to the architecture name. Extension
17874 options are processed in order and capabilities accumulate. An
17875 extension will also enable any necessary base extensions upon which
17876 it depends. For example, the +crypto extension will always enable
17877 the +simd extension. The exception to the additive construction is
17878 for extensions that are prefixed with +no...: these extensions
17879 disable the specified option and any other extensions that may
17880 depend on the presence of that extension.
17881
17882 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
17883 writing -march=armv7-a+vfpv4 since the +simd option is entirely
17884 disabled by the +nofp option that follows it.
17885
17886 Most extension names are generically named, but have an effect that
17887 is dependent upon the architecture to which it is applied. For
17888 example, the +simd option can be applied to both armv7-a and
17889 armv8-a architectures, but will enable the original ARMv7-A
17890 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
17891 for armv8-a.
17892
17893 The table below lists the supported extensions for each
17894 architecture. Architectures not mentioned do not support any
17895 extensions.
17896
17897 armv5te
17898 armv6
17899 armv6j
17900 armv6k
17901 armv6kz
17902 armv6t2
17903 armv6z
17904 armv6zk
17905 +fp The VFPv2 floating-point instructions. The extension
17906 +vfpv2 can be used as an alias for this extension.
17907
17908 +nofp
17909 Disable the floating-point instructions.
17910
17911 armv7
17912 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
17913 architectures.
17914
17915 +fp The VFPv3 floating-point instructions, with 16 double-
17916 precision registers. The extension +vfpv3-d16 can be used
17917 as an alias for this extension. Note that floating-point
17918 is not supported by the base ARMv7-M architecture, but is
17919 compatible with both the ARMv7-A and ARMv7-R architectures.
17920
17921 +nofp
17922 Disable the floating-point instructions.
17923
17924 armv7-a
17925 +mp The multiprocessing extension.
17926
17927 +sec
17928 The security extension.
17929
17930 +fp The VFPv3 floating-point instructions, with 16 double-
17931 precision registers. The extension +vfpv3-d16 can be used
17932 as an alias for this extension.
17933
17934 +simd
17935 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17936 instructions. The extensions +neon and +neon-vfpv3 can be
17937 used as aliases for this extension.
17938
17939 +vfpv3
17940 The VFPv3 floating-point instructions, with 32 double-
17941 precision registers.
17942
17943 +vfpv3-d16-fp16
17944 The VFPv3 floating-point instructions, with 16 double-
17945 precision registers and the half-precision floating-point
17946 conversion operations.
17947
17948 +vfpv3-fp16
17949 The VFPv3 floating-point instructions, with 32 double-
17950 precision registers and the half-precision floating-point
17951 conversion operations.
17952
17953 +vfpv4-d16
17954 The VFPv4 floating-point instructions, with 16 double-
17955 precision registers.
17956
17957 +vfpv4
17958 The VFPv4 floating-point instructions, with 32 double-
17959 precision registers.
17960
17961 +neon-fp16
17962 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17963 instructions, with the half-precision floating-point
17964 conversion operations.
17965
17966 +neon-vfpv4
17967 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17968 instructions.
17969
17970 +nosimd
17971 Disable the Advanced SIMD instructions (does not disable
17972 floating point).
17973
17974 +nofp
17975 Disable the floating-point and Advanced SIMD instructions.
17976
17977 armv7ve
17978 The extended version of the ARMv7-A architecture with support
17979 for virtualization.
17980
17981 +fp The VFPv4 floating-point instructions, with 16 double-
17982 precision registers. The extension +vfpv4-d16 can be used
17983 as an alias for this extension.
17984
17985 +simd
17986 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17987 instructions. The extension +neon-vfpv4 can be used as an
17988 alias for this extension.
17989
17990 +vfpv3-d16
17991 The VFPv3 floating-point instructions, with 16 double-
17992 precision registers.
17993
17994 +vfpv3
17995 The VFPv3 floating-point instructions, with 32 double-
17996 precision registers.
17997
17998 +vfpv3-d16-fp16
17999 The VFPv3 floating-point instructions, with 16 double-
18000 precision registers and the half-precision floating-point
18001 conversion operations.
18002
18003 +vfpv3-fp16
18004 The VFPv3 floating-point instructions, with 32 double-
18005 precision registers and the half-precision floating-point
18006 conversion operations.
18007
18008 +vfpv4-d16
18009 The VFPv4 floating-point instructions, with 16 double-
18010 precision registers.
18011
18012 +vfpv4
18013 The VFPv4 floating-point instructions, with 32 double-
18014 precision registers.
18015
18016 +neon
18017 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
18018 instructions. The extension +neon-vfpv3 can be used as an
18019 alias for this extension.
18020
18021 +neon-fp16
18022 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
18023 instructions, with the half-precision floating-point
18024 conversion operations.
18025
18026 +nosimd
18027 Disable the Advanced SIMD instructions (does not disable
18028 floating point).
18029
18030 +nofp
18031 Disable the floating-point and Advanced SIMD instructions.
18032
18033 armv8-a
18034 +crc
18035 The Cyclic Redundancy Check (CRC) instructions.
18036
18037 +simd
18038 The ARMv8-A Advanced SIMD and floating-point instructions.
18039
18040 +crypto
18041 The cryptographic instructions.
18042
18043 +nocrypto
18044 Disable the cryptographic instructions.
18045
18046 +nofp
18047 Disable the floating-point, Advanced SIMD and cryptographic
18048 instructions.
18049
18050 +sb Speculation Barrier Instruction.
18051
18052 +predres
18053 Execution and Data Prediction Restriction Instructions.
18054
18055 armv8.1-a
18056 +simd
18057 The ARMv8.1-A Advanced SIMD and floating-point
18058 instructions.
18059
18060 +crypto
18061 The cryptographic instructions. This also enables the
18062 Advanced SIMD and floating-point instructions.
18063
18064 +nocrypto
18065 Disable the cryptographic instructions.
18066
18067 +nofp
18068 Disable the floating-point, Advanced SIMD and cryptographic
18069 instructions.
18070
18071 +sb Speculation Barrier Instruction.
18072
18073 +predres
18074 Execution and Data Prediction Restriction Instructions.
18075
18076 armv8.2-a
18077 armv8.3-a
18078 +fp16
18079 The half-precision floating-point data processing
18080 instructions. This also enables the Advanced SIMD and
18081 floating-point instructions.
18082
18083 +fp16fml
18084 The half-precision floating-point fmla extension. This
18085 also enables the half-precision floating-point extension
18086 and Advanced SIMD and floating-point instructions.
18087
18088 +simd
18089 The ARMv8.1-A Advanced SIMD and floating-point
18090 instructions.
18091
18092 +crypto
18093 The cryptographic instructions. This also enables the
18094 Advanced SIMD and floating-point instructions.
18095
18096 +dotprod
18097 Enable the Dot Product extension. This also enables
18098 Advanced SIMD instructions.
18099
18100 +nocrypto
18101 Disable the cryptographic extension.
18102
18103 +nofp
18104 Disable the floating-point, Advanced SIMD and cryptographic
18105 instructions.
18106
18107 +sb Speculation Barrier Instruction.
18108
18109 +predres
18110 Execution and Data Prediction Restriction Instructions.
18111
18112 +i8mm
18113 8-bit Integer Matrix Multiply instructions. This also
18114 enables Advanced SIMD and floating-point instructions.
18115
18116 +bf16
18117 Brain half-precision floating-point instructions. This
18118 also enables Advanced SIMD and floating-point instructions.
18119
18120 armv8.4-a
18121 +fp16
18122 The half-precision floating-point data processing
18123 instructions. This also enables the Advanced SIMD and
18124 floating-point instructions as well as the Dot Product
18125 extension and the half-precision floating-point fmla
18126 extension.
18127
18128 +simd
18129 The ARMv8.3-A Advanced SIMD and floating-point instructions
18130 as well as the Dot Product extension.
18131
18132 +crypto
18133 The cryptographic instructions. This also enables the
18134 Advanced SIMD and floating-point instructions as well as
18135 the Dot Product extension.
18136
18137 +nocrypto
18138 Disable the cryptographic extension.
18139
18140 +nofp
18141 Disable the floating-point, Advanced SIMD and cryptographic
18142 instructions.
18143
18144 +sb Speculation Barrier Instruction.
18145
18146 +predres
18147 Execution and Data Prediction Restriction Instructions.
18148
18149 +i8mm
18150 8-bit Integer Matrix Multiply instructions. This also
18151 enables Advanced SIMD and floating-point instructions.
18152
18153 +bf16
18154 Brain half-precision floating-point instructions. This
18155 also enables Advanced SIMD and floating-point instructions.
18156
18157 armv8.5-a
18158 +fp16
18159 The half-precision floating-point data processing
18160 instructions. This also enables the Advanced SIMD and
18161 floating-point instructions as well as the Dot Product
18162 extension and the half-precision floating-point fmla
18163 extension.
18164
18165 +simd
18166 The ARMv8.3-A Advanced SIMD and floating-point instructions
18167 as well as the Dot Product extension.
18168
18169 +crypto
18170 The cryptographic instructions. This also enables the
18171 Advanced SIMD and floating-point instructions as well as
18172 the Dot Product extension.
18173
18174 +nocrypto
18175 Disable the cryptographic extension.
18176
18177 +nofp
18178 Disable the floating-point, Advanced SIMD and cryptographic
18179 instructions.
18180
18181 +i8mm
18182 8-bit Integer Matrix Multiply instructions. This also
18183 enables Advanced SIMD and floating-point instructions.
18184
18185 +bf16
18186 Brain half-precision floating-point instructions. This
18187 also enables Advanced SIMD and floating-point instructions.
18188
18189 armv8.6-a
18190 +fp16
18191 The half-precision floating-point data processing
18192 instructions. This also enables the Advanced SIMD and
18193 floating-point instructions as well as the Dot Product
18194 extension and the half-precision floating-point fmla
18195 extension.
18196
18197 +simd
18198 The ARMv8.3-A Advanced SIMD and floating-point instructions
18199 as well as the Dot Product extension.
18200
18201 +crypto
18202 The cryptographic instructions. This also enables the
18203 Advanced SIMD and floating-point instructions as well as
18204 the Dot Product extension.
18205
18206 +nocrypto
18207 Disable the cryptographic extension.
18208
18209 +nofp
18210 Disable the floating-point, Advanced SIMD and cryptographic
18211 instructions.
18212
18213 +i8mm
18214 8-bit Integer Matrix Multiply instructions. This also
18215 enables Advanced SIMD and floating-point instructions.
18216
18217 +bf16
18218 Brain half-precision floating-point instructions. This
18219 also enables Advanced SIMD and floating-point instructions.
18220
18221 armv7-r
18222 +fp.sp
18223 The single-precision VFPv3 floating-point instructions.
18224 The extension +vfpv3xd can be used as an alias for this
18225 extension.
18226
18227 +fp The VFPv3 floating-point instructions with 16 double-
18228 precision registers. The extension +vfpv3-d16 can be used
18229 as an alias for this extension.
18230
18231 +vfpv3xd-d16-fp16
18232 The single-precision VFPv3 floating-point instructions with
18233 16 double-precision registers and the half-precision
18234 floating-point conversion operations.
18235
18236 +vfpv3-d16-fp16
18237 The VFPv3 floating-point instructions with 16 double-
18238 precision registers and the half-precision floating-point
18239 conversion operations.
18240
18241 +nofp
18242 Disable the floating-point extension.
18243
18244 +idiv
18245 The ARM-state integer division instructions.
18246
18247 +noidiv
18248 Disable the ARM-state integer division extension.
18249
18250 armv7e-m
18251 +fp The single-precision VFPv4 floating-point instructions.
18252
18253 +fpv5
18254 The single-precision FPv5 floating-point instructions.
18255
18256 +fp.dp
18257 The single- and double-precision FPv5 floating-point
18258 instructions.
18259
18260 +nofp
18261 Disable the floating-point extensions.
18262
18263 armv8.1-m.main
18264 +dsp
18265 The DSP instructions.
18266
18267 +mve
18268 The M-Profile Vector Extension (MVE) integer instructions.
18269
18270 +mve.fp
18271 The M-Profile Vector Extension (MVE) integer and single
18272 precision floating-point instructions.
18273
18274 +fp The single-precision floating-point instructions.
18275
18276 +fp.dp
18277 The single- and double-precision floating-point
18278 instructions.
18279
18280 +nofp
18281 Disable the floating-point extension.
18282
18283 +cdecp0, +cdecp1, ... , +cdecp7
18284 Enable the Custom Datapath Extension (CDE) on selected
18285 coprocessors according to the numbers given in the options
18286 in the range 0 to 7.
18287
18288 armv8-m.main
18289 +dsp
18290 The DSP instructions.
18291
18292 +nodsp
18293 Disable the DSP extension.
18294
18295 +fp The single-precision floating-point instructions.
18296
18297 +fp.dp
18298 The single- and double-precision floating-point
18299 instructions.
18300
18301 +nofp
18302 Disable the floating-point extension.
18303
18304 +cdecp0, +cdecp1, ... , +cdecp7
18305 Enable the Custom Datapath Extension (CDE) on selected
18306 coprocessors according to the numbers given in the options
18307 in the range 0 to 7.
18308
18309 armv8-r
18310 +crc
18311 The Cyclic Redundancy Check (CRC) instructions.
18312
18313 +fp.sp
18314 The single-precision FPv5 floating-point instructions.
18315
18316 +simd
18317 The ARMv8-A Advanced SIMD and floating-point instructions.
18318
18319 +crypto
18320 The cryptographic instructions.
18321
18322 +nocrypto
18323 Disable the cryptographic instructions.
18324
18325 +nofp
18326 Disable the floating-point, Advanced SIMD and cryptographic
18327 instructions.
18328
18329 -march=native causes the compiler to auto-detect the architecture
18330 of the build computer. At present, this feature is only supported
18331 on GNU/Linux, and not all architectures are recognized. If the
18332 auto-detect is unsuccessful the option has no effect.
18333
18334 -mtune=name
18335 This option specifies the name of the target ARM processor for
18336 which GCC should tune the performance of the code. For some ARM
18337 implementations better performance can be obtained by using this
18338 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
18339 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
18340 strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t, arm922t,
18341 arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t, arm9tdmi,
18342 arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e, arm1022e,
18343 arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp, arm1156t2-s,
18344 arm1156t2f-s, arm1176jz-s, arm1176jzf-s, generic-armv7-a,
18345 cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
18346 cortex-a17, cortex-a32, cortex-a35, cortex-a53, cortex-a55,
18347 cortex-a57, cortex-a72, cortex-a73, cortex-a75, cortex-a76,
18348 cortex-a76ae, cortex-a77, cortex-a78, cortex-a78ae, cortex-a78c,
18349 cortex-a710, ares, cortex-r4, cortex-r4f, cortex-r5, cortex-r7,
18350 cortex-r8, cortex-r52, cortex-r52plus, cortex-m0, cortex-m0plus,
18351 cortex-m1, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33,
18352 cortex-m35p, cortex-m55, cortex-x1, cortex-m1.small-multiply,
18353 cortex-m0.small-multiply, cortex-m0plus.small-multiply, exynos-m1,
18354 marvell-pj4, neoverse-n1, neoverse-n2, neoverse-v1, xscale, iwmmxt,
18355 iwmmxt2, ep9312, fa526, fa626, fa606te, fa626te, fmp626, fa726te,
18356 xgene1.
18357
18358 Additionally, this option can specify that GCC should tune the
18359 performance of the code for a big.LITTLE system. Permissible names
18360 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
18361 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
18362 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
18363 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
18364
18365 -mtune=generic-arch specifies that GCC should tune the performance
18366 for a blend of processors within architecture arch. The aim is to
18367 generate code that run well on the current most popular processors,
18368 balancing between optimizations that benefit some CPUs in the
18369 range, and avoiding performance pitfalls of other CPUs. The
18370 effects of this option may change in future GCC versions as CPU
18371 models come and go.
18372
18373 -mtune permits the same extension options as -mcpu, but the
18374 extension options do not affect the tuning of the generated code.
18375
18376 -mtune=native causes the compiler to auto-detect the CPU of the
18377 build computer. At present, this feature is only supported on
18378 GNU/Linux, and not all architectures are recognized. If the auto-
18379 detect is unsuccessful the option has no effect.
18380
18381 -mcpu=name[+extension...]
18382 This specifies the name of the target ARM processor. GCC uses this
18383 name to derive the name of the target ARM architecture (as if
18384 specified by -march) and the ARM processor type for which to tune
18385 for performance (as if specified by -mtune). Where this option is
18386 used in conjunction with -march or -mtune, those options take
18387 precedence over the appropriate part of this option.
18388
18389 Many of the supported CPUs implement optional architectural
18390 extensions. Where this is so the architectural extensions are
18391 normally enabled by default. If implementations that lack the
18392 extension exist, then the extension syntax can be used to disable
18393 those extensions that have been omitted. For floating-point and
18394 Advanced SIMD (Neon) instructions, the settings of the options
18395 -mfloat-abi and -mfpu must also be considered: floating-point and
18396 Advanced SIMD instructions will only be used if -mfloat-abi is not
18397 set to soft; and any setting of -mfpu other than auto will override
18398 the available floating-point and SIMD extension instructions.
18399
18400 For example, cortex-a9 can be found in three major configurations:
18401 integer only, with just a floating-point unit or with floating-
18402 point and Advanced SIMD. The default is to enable all the
18403 instructions, but the extensions +nosimd and +nofp can be used to
18404 disable just the SIMD or both the SIMD and floating-point
18405 instructions respectively.
18406
18407 Permissible names for this option are the same as those for -mtune.
18408
18409 The following extension options are common to the listed CPUs:
18410
18411 +nodsp
18412 Disable the DSP instructions on cortex-m33, cortex-m35p.
18413
18414 +nofp
18415 Disables the floating-point instructions on arm9e, arm946e-s,
18416 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
18417 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
18418 cortex-m7, cortex-m33 and cortex-m35p. Disables the floating-
18419 point and SIMD instructions on generic-armv7-a, cortex-a5,
18420 cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
18421 cortex-a17, cortex-a15.cortex-a7, cortex-a17.cortex-a7,
18422 cortex-a32, cortex-a35, cortex-a53 and cortex-a55.
18423
18424 +nofp.dp
18425 Disables the double-precision component of the floating-point
18426 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52,
18427 cortex-r52plus and cortex-m7.
18428
18429 +nosimd
18430 Disables the SIMD (but not floating-point) instructions on
18431 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
18432
18433 +crypto
18434 Enables the cryptographic instructions on cortex-a32,
18435 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
18436 cortex-a73, cortex-a75, exynos-m1, xgene1,
18437 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
18438 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
18439 cortex-a75.cortex-a55.
18440
18441 Additionally the generic-armv7-a pseudo target defaults to VFPv3
18442 with 16 double-precision registers. It supports the following
18443 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
18444 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
18445 neon-vfpv4. The meanings are the same as for the extensions to
18446 -march=armv7-a.
18447
18448 -mcpu=generic-arch is also permissible, and is equivalent to
18449 -march=arch -mtune=generic-arch. See -mtune for more information.
18450
18451 -mcpu=native causes the compiler to auto-detect the CPU of the
18452 build computer. At present, this feature is only supported on
18453 GNU/Linux, and not all architectures are recognized. If the auto-
18454 detect is unsuccessful the option has no effect.
18455
18456 -mfpu=name
18457 This specifies what floating-point hardware (or hardware emulation)
18458 is available on the target. Permissible names are: auto, vfpv2,
18459 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
18460 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
18461 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
18462 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
18463 and vfp is an alias for vfpv2.
18464
18465 The setting auto is the default and is special. It causes the
18466 compiler to select the floating-point and Advanced SIMD
18467 instructions based on the settings of -mcpu and -march.
18468
18469 If the selected floating-point hardware includes the NEON extension
18470 (e.g. -mfpu=neon), note that floating-point operations are not
18471 generated by GCC's auto-vectorization pass unless
18472 -funsafe-math-optimizations is also specified. This is because
18473 NEON hardware does not fully implement the IEEE 754 standard for
18474 floating-point arithmetic (in particular denormal values are
18475 treated as zero), so the use of NEON instructions may lead to a
18476 loss of precision.
18477
18478 You can also set the fpu name at function level by using the
18479 "target("fpu=")" function attributes or pragmas.
18480
18481 -mfp16-format=name
18482 Specify the format of the "__fp16" half-precision floating-point
18483 type. Permissible names are none, ieee, and alternative; the
18484 default is none, in which case the "__fp16" type is not defined.
18485
18486 -mstructure-size-boundary=n
18487 The sizes of all structures and unions are rounded up to a multiple
18488 of the number of bits set by this option. Permissible values are
18489 8, 32 and 64. The default value varies for different toolchains.
18490 For the COFF targeted toolchain the default value is 8. A value of
18491 64 is only allowed if the underlying ABI supports it.
18492
18493 Specifying a larger number can produce faster, more efficient code,
18494 but can also increase the size of the program. Different values
18495 are potentially incompatible. Code compiled with one value cannot
18496 necessarily expect to work with code or libraries compiled with
18497 another value, if they exchange information using structures or
18498 unions.
18499
18500 This option is deprecated.
18501
18502 -mabort-on-noreturn
18503 Generate a call to the function "abort" at the end of a "noreturn"
18504 function. It is executed if the function tries to return.
18505
18506 -mlong-calls
18507 -mno-long-calls
18508 Tells the compiler to perform function calls by first loading the
18509 address of the function into a register and then performing a
18510 subroutine call on this register. This switch is needed if the
18511 target function lies outside of the 64-megabyte addressing range of
18512 the offset-based version of subroutine call instruction.
18513
18514 Even if this switch is enabled, not all function calls are turned
18515 into long calls. The heuristic is that static functions, functions
18516 that have the "short_call" attribute, functions that are inside the
18517 scope of a "#pragma no_long_calls" directive, and functions whose
18518 definitions have already been compiled within the current
18519 compilation unit are not turned into long calls. The exceptions to
18520 this rule are that weak function definitions, functions with the
18521 "long_call" attribute or the "section" attribute, and functions
18522 that are within the scope of a "#pragma long_calls" directive are
18523 always turned into long calls.
18524
18525 This feature is not enabled by default. Specifying -mno-long-calls
18526 restores the default behavior, as does placing the function calls
18527 within the scope of a "#pragma long_calls_off" directive. Note
18528 these switches have no effect on how the compiler generates code to
18529 handle function calls via function pointers.
18530
18531 -msingle-pic-base
18532 Treat the register used for PIC addressing as read-only, rather
18533 than loading it in the prologue for each function. The runtime
18534 system is responsible for initializing this register with an
18535 appropriate value before execution begins.
18536
18537 -mpic-register=reg
18538 Specify the register to be used for PIC addressing. For standard
18539 PIC base case, the default is any suitable register determined by
18540 compiler. For single PIC base case, the default is R9 if target is
18541 EABI based or stack-checking is enabled, otherwise the default is
18542 R10.
18543
18544 -mpic-data-is-text-relative
18545 Assume that the displacement between the text and data segments is
18546 fixed at static link time. This permits using PC-relative
18547 addressing operations to access data known to be in the data
18548 segment. For non-VxWorks RTP targets, this option is enabled by
18549 default. When disabled on such targets, it will enable
18550 -msingle-pic-base by default.
18551
18552 -mpoke-function-name
18553 Write the name of each function into the text section, directly
18554 preceding the function prologue. The generated code is similar to
18555 this:
18556
18557 t0
18558 .ascii "arm_poke_function_name", 0
18559 .align
18560 t1
18561 .word 0xff000000 + (t1 - t0)
18562 arm_poke_function_name
18563 mov ip, sp
18564 stmfd sp!, {fp, ip, lr, pc}
18565 sub fp, ip, #4
18566
18567 When performing a stack backtrace, code can inspect the value of
18568 "pc" stored at "fp + 0". If the trace function then looks at
18569 location "pc - 12" and the top 8 bits are set, then we know that
18570 there is a function name embedded immediately preceding this
18571 location and has length "((pc[-3]) & 0xff000000)".
18572
18573 -mthumb
18574 -marm
18575 Select between generating code that executes in ARM and Thumb
18576 states. The default for most configurations is to generate code
18577 that executes in ARM state, but the default can be changed by
18578 configuring GCC with the --with-mode=state configure option.
18579
18580 You can also override the ARM and Thumb mode for each function by
18581 using the "target("thumb")" and "target("arm")" function attributes
18582 or pragmas.
18583
18584 -mflip-thumb
18585 Switch ARM/Thumb modes on alternating functions. This option is
18586 provided for regression testing of mixed Thumb/ARM code generation,
18587 and is not intended for ordinary use in compiling code.
18588
18589 -mtpcs-frame
18590 Generate a stack frame that is compliant with the Thumb Procedure
18591 Call Standard for all non-leaf functions. (A leaf function is one
18592 that does not call any other functions.) The default is
18593 -mno-tpcs-frame.
18594
18595 -mtpcs-leaf-frame
18596 Generate a stack frame that is compliant with the Thumb Procedure
18597 Call Standard for all leaf functions. (A leaf function is one that
18598 does not call any other functions.) The default is
18599 -mno-apcs-leaf-frame.
18600
18601 -mcallee-super-interworking
18602 Gives all externally visible functions in the file being compiled
18603 an ARM instruction set header which switches to Thumb mode before
18604 executing the rest of the function. This allows these functions to
18605 be called from non-interworking code. This option is not valid in
18606 AAPCS configurations because interworking is enabled by default.
18607
18608 -mcaller-super-interworking
18609 Allows calls via function pointers (including virtual functions) to
18610 execute correctly regardless of whether the target code has been
18611 compiled for interworking or not. There is a small overhead in the
18612 cost of executing a function pointer if this option is enabled.
18613 This option is not valid in AAPCS configurations because
18614 interworking is enabled by default.
18615
18616 -mtp=name
18617 Specify the access model for the thread local storage pointer. The
18618 valid models are soft, which generates calls to "__aeabi_read_tp",
18619 cp15, which fetches the thread pointer from "cp15" directly
18620 (supported in the arm6k architecture), and auto, which uses the
18621 best available method for the selected processor. The default
18622 setting is auto.
18623
18624 -mtls-dialect=dialect
18625 Specify the dialect to use for accessing thread local storage. Two
18626 dialects are supported---gnu and gnu2. The gnu dialect selects the
18627 original GNU scheme for supporting local and global dynamic TLS
18628 models. The gnu2 dialect selects the GNU descriptor scheme, which
18629 provides better performance for shared libraries. The GNU
18630 descriptor scheme is compatible with the original scheme, but does
18631 require new assembler, linker and library support. Initial and
18632 local exec TLS models are unaffected by this option and always use
18633 the original scheme.
18634
18635 -mword-relocations
18636 Only generate absolute relocations on word-sized values (i.e.
18637 R_ARM_ABS32). This is enabled by default on targets (uClinux,
18638 SymbianOS) where the runtime loader imposes this restriction, and
18639 when -fpic or -fPIC is specified. This option conflicts with
18640 -mslow-flash-data.
18641
18642 -mfix-cortex-m3-ldrd
18643 Some Cortex-M3 cores can cause data corruption when "ldrd"
18644 instructions with overlapping destination and base registers are
18645 used. This option avoids generating these instructions. This
18646 option is enabled by default when -mcpu=cortex-m3 is specified.
18647
18648 -mfix-cortex-a57-aes-1742098
18649 -mno-fix-cortex-a57-aes-1742098
18650 -mfix-cortex-a72-aes-1655431
18651 -mno-fix-cortex-a72-aes-1655431
18652 Enable (disable) mitigation for an erratum on Cortex-A57 and
18653 Cortex-A72 that affects the AES cryptographic instructions. This
18654 option is enabled by default when either -mcpu=cortex-a57 or
18655 -mcpu=cortex-a72 is specified.
18656
18657 -munaligned-access
18658 -mno-unaligned-access
18659 Enables (or disables) reading and writing of 16- and 32- bit values
18660 from addresses that are not 16- or 32- bit aligned. By default
18661 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
18662 ARMv8-M Baseline architectures, and enabled for all other
18663 architectures. If unaligned access is not enabled then words in
18664 packed data structures are accessed a byte at a time.
18665
18666 The ARM attribute "Tag_CPU_unaligned_access" is set in the
18667 generated object file to either true or false, depending upon the
18668 setting of this option. If unaligned access is enabled then the
18669 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
18670
18671 -mneon-for-64bits
18672 This option is deprecated and has no effect.
18673
18674 -mslow-flash-data
18675 Assume loading data from flash is slower than fetching instruction.
18676 Therefore literal load is minimized for better performance. This
18677 option is only supported when compiling for ARMv7 M-profile and off
18678 by default. It conflicts with -mword-relocations.
18679
18680 -masm-syntax-unified
18681 Assume inline assembler is using unified asm syntax. The default
18682 is currently off which implies divided syntax. This option has no
18683 impact on Thumb2. However, this may change in future releases of
18684 GCC. Divided syntax should be considered deprecated.
18685
18686 -mrestrict-it
18687 Restricts generation of IT blocks to conform to the rules of
18688 ARMv8-A. IT blocks can only contain a single 16-bit instruction
18689 from a select set of instructions. This option is on by default for
18690 ARMv8-A Thumb mode.
18691
18692 -mprint-tune-info
18693 Print CPU tuning information as comment in assembler file. This is
18694 an option used only for regression testing of the compiler and not
18695 intended for ordinary use in compiling code. This option is
18696 disabled by default.
18697
18698 -mverbose-cost-dump
18699 Enable verbose cost model dumping in the debug dump files. This
18700 option is provided for use in debugging the compiler.
18701
18702 -mpure-code
18703 Do not allow constant data to be placed in code sections.
18704 Additionally, when compiling for ELF object format give all text
18705 sections the ELF processor-specific section attribute
18706 "SHF_ARM_PURECODE". This option is only available when generating
18707 non-pic code for M-profile targets.
18708
18709 -mcmse
18710 Generate secure code as per the "ARMv8-M Security Extensions:
18711 Requirements on Development Tools Engineering Specification", which
18712 can be found on
18713 <https://developer.arm.com/documentation/ecm0359818/latest/>.
18714
18715 -mfix-cmse-cve-2021-35465
18716 Mitigate against a potential security issue with the "VLLDM"
18717 instruction in some M-profile devices when using CMSE
18718 (CVE-2021-365465). This option is enabled by default when the
18719 option -mcpu= is used with "cortex-m33", "cortex-m35p" or
18720 "cortex-m55". The option -mno-fix-cmse-cve-2021-35465 can be used
18721 to disable the mitigation.
18722
18723 -mstack-protector-guard=guard
18724 -mstack-protector-guard-offset=offset
18725 Generate stack protection code using canary at guard. Supported
18726 locations are global for a global canary or tls for a canary
18727 accessible via the TLS register. The option
18728 -mstack-protector-guard-offset= is for use with
18729 -fstack-protector-guard=tls and not for use in user-land code.
18730
18731 -mfdpic
18732 -mno-fdpic
18733 Select the FDPIC ABI, which uses 64-bit function descriptors to
18734 represent pointers to functions. When the compiler is configured
18735 for "arm-*-uclinuxfdpiceabi" targets, this option is on by default
18736 and implies -fPIE if none of the PIC/PIE-related options is
18737 provided. On other targets, it only enables the FDPIC-specific
18738 code generation features, and the user should explicitly provide
18739 the PIC/PIE-related options as needed.
18740
18741 Note that static linking is not supported because it would still
18742 involve the dynamic linker when the program self-relocates. If
18743 such behavior is acceptable, use -static and -Wl,-dynamic-linker
18744 options.
18745
18746 The opposite -mno-fdpic option is useful (and required) to build
18747 the Linux kernel using the same ("arm-*-uclinuxfdpiceabi")
18748 toolchain as the one used to build the userland programs.
18749
18750 AVR Options
18751 These options are defined for AVR implementations:
18752
18753 -mmcu=mcu
18754 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18755
18756 The default for this option is avr2.
18757
18758 GCC supports the following AVR devices and ISAs:
18759
18760 "avr2"
18761 "Classic" devices with up to 8 KiB of program memory. mcu =
18762 "attiny22", "attiny26", "at90s2313", "at90s2323", "at90s2333",
18763 "at90s2343", "at90s4414", "at90s4433", "at90s4434",
18764 "at90c8534", "at90s8515", "at90s8535".
18765
18766 "avr25"
18767 "Classic" devices with up to 8 KiB of program memory and with
18768 the "MOVW" instruction. mcu = "attiny13", "attiny13a",
18769 "attiny24", "attiny24a", "attiny25", "attiny261", "attiny261a",
18770 "attiny2313", "attiny2313a", "attiny43u", "attiny44",
18771 "attiny44a", "attiny45", "attiny48", "attiny441", "attiny461",
18772 "attiny461a", "attiny4313", "attiny84", "attiny84a",
18773 "attiny85", "attiny87", "attiny88", "attiny828", "attiny841",
18774 "attiny861", "attiny861a", "ata5272", "ata6616c", "at86rf401".
18775
18776 "avr3"
18777 "Classic" devices with 16 KiB up to 64 KiB of program memory.
18778 mcu = "at76c711", "at43usb355".
18779
18780 "avr31"
18781 "Classic" devices with 128 KiB of program memory. mcu =
18782 "atmega103", "at43usb320".
18783
18784 "avr35"
18785 "Classic" devices with 16 KiB up to 64 KiB of program memory
18786 and with the "MOVW" instruction. mcu = "attiny167",
18787 "attiny1634", "atmega8u2", "atmega16u2", "atmega32u2",
18788 "ata5505", "ata6617c", "ata664251", "at90usb82", "at90usb162".
18789
18790 "avr4"
18791 "Enhanced" devices with up to 8 KiB of program memory. mcu =
18792 "atmega48", "atmega48a", "atmega48p", "atmega48pa",
18793 "atmega48pb", "atmega8", "atmega8a", "atmega8hva", "atmega88",
18794 "atmega88a", "atmega88p", "atmega88pa", "atmega88pb",
18795 "atmega8515", "atmega8535", "ata6285", "ata6286", "ata6289",
18796 "ata6612c", "at90pwm1", "at90pwm2", "at90pwm2b", "at90pwm3",
18797 "at90pwm3b", "at90pwm81".
18798
18799 "avr5"
18800 "Enhanced" devices with 16 KiB up to 64 KiB of program memory.
18801 mcu = "atmega16", "atmega16a", "atmega16hva", "atmega16hva2",
18802 "atmega16hvb", "atmega16hvbrevb", "atmega16m1", "atmega16u4",
18803 "atmega161", "atmega162", "atmega163", "atmega164a",
18804 "atmega164p", "atmega164pa", "atmega165", "atmega165a",
18805 "atmega165p", "atmega165pa", "atmega168", "atmega168a",
18806 "atmega168p", "atmega168pa", "atmega168pb", "atmega169",
18807 "atmega169a", "atmega169p", "atmega169pa", "atmega32",
18808 "atmega32a", "atmega32c1", "atmega32hvb", "atmega32hvbrevb",
18809 "atmega32m1", "atmega32u4", "atmega32u6", "atmega323",
18810 "atmega324a", "atmega324p", "atmega324pa", "atmega324pb",
18811 "atmega325", "atmega325a", "atmega325p", "atmega325pa",
18812 "atmega328", "atmega328p", "atmega328pb", "atmega329",
18813 "atmega329a", "atmega329p", "atmega329pa", "atmega3250",
18814 "atmega3250a", "atmega3250p", "atmega3250pa", "atmega3290",
18815 "atmega3290a", "atmega3290p", "atmega3290pa", "atmega406",
18816 "atmega64", "atmega64a", "atmega64c1", "atmega64hve",
18817 "atmega64hve2", "atmega64m1", "atmega64rfr2", "atmega640",
18818 "atmega644", "atmega644a", "atmega644p", "atmega644pa",
18819 "atmega644rfr2", "atmega645", "atmega645a", "atmega645p",
18820 "atmega649", "atmega649a", "atmega649p", "atmega6450",
18821 "atmega6450a", "atmega6450p", "atmega6490", "atmega6490a",
18822 "atmega6490p", "ata5795", "ata5790", "ata5790n", "ata5791",
18823 "ata6613c", "ata6614q", "ata5782", "ata5831", "ata8210",
18824 "ata8510", "ata5702m322", "at90pwm161", "at90pwm216",
18825 "at90pwm316", "at90can32", "at90can64", "at90scr100",
18826 "at90usb646", "at90usb647", "at94k", "m3000".
18827
18828 "avr51"
18829 "Enhanced" devices with 128 KiB of program memory. mcu =
18830 "atmega128", "atmega128a", "atmega128rfa1", "atmega128rfr2",
18831 "atmega1280", "atmega1281", "atmega1284", "atmega1284p",
18832 "atmega1284rfr2", "at90can128", "at90usb1286", "at90usb1287".
18833
18834 "avr6"
18835 "Enhanced" devices with 3-byte PC, i.e. with more than 128 KiB
18836 of program memory. mcu = "atmega256rfr2", "atmega2560",
18837 "atmega2561", "atmega2564rfr2".
18838
18839 "avrxmega2"
18840 "XMEGA" devices with more than 8 KiB and up to 64 KiB of
18841 program memory. mcu = "atxmega8e5", "atxmega16a4",
18842 "atxmega16a4u", "atxmega16c4", "atxmega16d4", "atxmega16e5",
18843 "atxmega32a4", "atxmega32a4u", "atxmega32c3", "atxmega32c4",
18844 "atxmega32d3", "atxmega32d4", "atxmega32e5".
18845
18846 "avrxmega3"
18847 "XMEGA" devices with up to 64 KiB of combined program memory
18848 and RAM, and with program memory visible in the RAM address
18849 space. mcu = "attiny202", "attiny204", "attiny212",
18850 "attiny214", "attiny402", "attiny404", "attiny406",
18851 "attiny412", "attiny414", "attiny416", "attiny417",
18852 "attiny804", "attiny806", "attiny807", "attiny814",
18853 "attiny816", "attiny817", "attiny1604", "attiny1606",
18854 "attiny1607", "attiny1614", "attiny1616", "attiny1617",
18855 "attiny3214", "attiny3216", "attiny3217", "atmega808",
18856 "atmega809", "atmega1608", "atmega1609", "atmega3208",
18857 "atmega3209", "atmega4808", "atmega4809".
18858
18859 "avrxmega4"
18860 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
18861 program memory. mcu = "atxmega64a3", "atxmega64a3u",
18862 "atxmega64a4u", "atxmega64b1", "atxmega64b3", "atxmega64c3",
18863 "atxmega64d3", "atxmega64d4".
18864
18865 "avrxmega5"
18866 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
18867 program memory and more than 64 KiB of RAM. mcu =
18868 "atxmega64a1", "atxmega64a1u".
18869
18870 "avrxmega6"
18871 "XMEGA" devices with more than 128 KiB of program memory. mcu
18872 = "atxmega128a3", "atxmega128a3u", "atxmega128b1",
18873 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
18874 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
18875 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
18876 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
18877 "atxmega256d3", "atxmega384c3", "atxmega384d3".
18878
18879 "avrxmega7"
18880 "XMEGA" devices with more than 128 KiB of program memory and
18881 more than 64 KiB of RAM. mcu = "atxmega128a1",
18882 "atxmega128a1u", "atxmega128a4u".
18883
18884 "avrtiny"
18885 "TINY" Tiny core devices with 512 B up to 4 KiB of program
18886 memory. mcu = "attiny4", "attiny5", "attiny9", "attiny10",
18887 "attiny20", "attiny40".
18888
18889 "avr1"
18890 This ISA is implemented by the minimal AVR core and supported
18891 for assembler only. mcu = "attiny11", "attiny12", "attiny15",
18892 "attiny28", "at90s1200".
18893
18894 -mabsdata
18895 Assume that all data in static storage can be accessed by LDS / STS
18896 instructions. This option has only an effect on reduced Tiny
18897 devices like ATtiny40. See also the "absdata" AVR Variable
18898 Attributes,variable attribute.
18899
18900 -maccumulate-args
18901 Accumulate outgoing function arguments and acquire/release the
18902 needed stack space for outgoing function arguments once in function
18903 prologue/epilogue. Without this option, outgoing arguments are
18904 pushed before calling a function and popped afterwards.
18905
18906 Popping the arguments after the function call can be expensive on
18907 AVR so that accumulating the stack space might lead to smaller
18908 executables because arguments need not be removed from the stack
18909 after such a function call.
18910
18911 This option can lead to reduced code size for functions that
18912 perform several calls to functions that get their arguments on the
18913 stack like calls to printf-like functions.
18914
18915 -mbranch-cost=cost
18916 Set the branch costs for conditional branch instructions to cost.
18917 Reasonable values for cost are small, non-negative integers. The
18918 default branch cost is 0.
18919
18920 -mcall-prologues
18921 Functions prologues/epilogues are expanded as calls to appropriate
18922 subroutines. Code size is smaller.
18923
18924 -mdouble=bits
18925 -mlong-double=bits
18926 Set the size (in bits) of the "double" or "long double" type,
18927 respectively. Possible values for bits are 32 and 64. Whether or
18928 not a specific value for bits is allowed depends on the
18929 "--with-double=" and "--with-long-double=" configure options
18930 ("https://gcc.gnu.org/install/configure.html#avr"), and the same
18931 applies for the default values of the options.
18932
18933 -mgas-isr-prologues
18934 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
18935 instruction supported by GNU Binutils. If this option is on, the
18936 feature can still be disabled for individual ISRs by means of the
18937 AVR Function Attributes,,"no_gccisr" function attribute. This
18938 feature is activated per default if optimization is on (but not
18939 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
18940 PR21683 ("https://sourceware.org/PR21683").
18941
18942 -mint8
18943 Assume "int" to be 8-bit integer. This affects the sizes of all
18944 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
18945 and "long long" is 4 bytes. Please note that this option does not
18946 conform to the C standards, but it results in smaller code size.
18947
18948 -mmain-is-OS_task
18949 Do not save registers in "main". The effect is the same like
18950 attaching attribute AVR Function Attributes,,"OS_task" to "main".
18951 It is activated per default if optimization is on.
18952
18953 -mn-flash=num
18954 Assume that the flash memory has a size of num times 64 KiB.
18955
18956 -mno-interrupts
18957 Generated code is not compatible with hardware interrupts. Code
18958 size is smaller.
18959
18960 -mrelax
18961 Try to replace "CALL" resp. "JMP" instruction by the shorter
18962 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
18963 just adds the --mlink-relax option to the assembler's command line
18964 and the --relax option to the linker's command line.
18965
18966 Jump relaxing is performed by the linker because jump offsets are
18967 not known before code is located. Therefore, the assembler code
18968 generated by the compiler is the same, but the instructions in the
18969 executable may differ from instructions in the assembler code.
18970
18971 Relaxing must be turned on if linker stubs are needed, see the
18972 section on "EIND" and linker stubs below.
18973
18974 -mrmw
18975 Assume that the device supports the Read-Modify-Write instructions
18976 "XCH", "LAC", "LAS" and "LAT".
18977
18978 -mshort-calls
18979 Assume that "RJMP" and "RCALL" can target the whole program memory.
18980
18981 This option is used internally for multilib selection. It is not
18982 an optimization option, and you don't need to set it by hand.
18983
18984 -msp8
18985 Treat the stack pointer register as an 8-bit register, i.e. assume
18986 the high byte of the stack pointer is zero. In general, you don't
18987 need to set this option by hand.
18988
18989 This option is used internally by the compiler to select and build
18990 multilibs for architectures "avr2" and "avr25". These
18991 architectures mix devices with and without "SPH". For any setting
18992 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
18993 removes this option from the compiler proper's command line,
18994 because the compiler then knows if the device or architecture has
18995 an 8-bit stack pointer and thus no "SPH" register or not.
18996
18997 -mstrict-X
18998 Use address register "X" in a way proposed by the hardware. This
18999 means that "X" is only used in indirect, post-increment or pre-
19000 decrement addressing.
19001
19002 Without this option, the "X" register may be used in the same way
19003 as "Y" or "Z" which then is emulated by additional instructions.
19004 For example, loading a value with "X+const" addressing with a small
19005 non-negative "const < 64" to a register Rn is performed as
19006
19007 adiw r26, const ; X += const
19008 ld <Rn>, X ; <Rn> = *X
19009 sbiw r26, const ; X -= const
19010
19011 -mtiny-stack
19012 Only change the lower 8 bits of the stack pointer.
19013
19014 -mfract-convert-truncate
19015 Allow to use truncation instead of rounding towards zero for
19016 fractional fixed-point types.
19017
19018 -nodevicelib
19019 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
19020
19021 -nodevicespecs
19022 Don't add -specs=device-specs/specs-mcu to the compiler driver's
19023 command line. The user takes responsibility for supplying the sub-
19024 processes like compiler proper, assembler and linker with
19025 appropriate command line options. This means that the user has to
19026 supply her private device specs file by means of -specs=path-to-
19027 specs-file. There is no more need for option -mmcu=mcu.
19028
19029 This option can also serve as a replacement for the older way of
19030 specifying custom device-specs files that needed -B some-path to
19031 point to a directory which contains a folder named "device-specs"
19032 which contains a specs file named "specs-mcu", where mcu was
19033 specified by -mmcu=mcu.
19034
19035 -Waddr-space-convert
19036 Warn about conversions between address spaces in the case where the
19037 resulting address space is not contained in the incoming address
19038 space.
19039
19040 -Wmisspelled-isr
19041 Warn if the ISR is misspelled, i.e. without __vector prefix.
19042 Enabled by default.
19043
19044 "EIND" and Devices with More Than 128 Ki Bytes of Flash
19045
19046 Pointers in the implementation are 16 bits wide. The address of a
19047 function or label is represented as word address so that indirect jumps
19048 and calls can target any code address in the range of 64 Ki words.
19049
19050 In order to facilitate indirect jump on devices with more than 128 Ki
19051 bytes of program memory space, there is a special function register
19052 called "EIND" that serves as most significant part of the target
19053 address when "EICALL" or "EIJMP" instructions are used.
19054
19055 Indirect jumps and calls on these devices are handled as follows by the
19056 compiler and are subject to some limitations:
19057
19058 * The compiler never sets "EIND".
19059
19060 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
19061 instructions or might read "EIND" directly in order to emulate an
19062 indirect call/jump by means of a "RET" instruction.
19063
19064 * The compiler assumes that "EIND" never changes during the startup
19065 code or during the application. In particular, "EIND" is not
19066 saved/restored in function or interrupt service routine
19067 prologue/epilogue.
19068
19069 * For indirect calls to functions and computed goto, the linker
19070 generates stubs. Stubs are jump pads sometimes also called
19071 trampolines. Thus, the indirect call/jump jumps to such a stub.
19072 The stub contains a direct jump to the desired address.
19073
19074 * Linker relaxation must be turned on so that the linker generates
19075 the stubs correctly in all situations. See the compiler option
19076 -mrelax and the linker option --relax. There are corner cases
19077 where the linker is supposed to generate stubs but aborts without
19078 relaxation and without a helpful error message.
19079
19080 * The default linker script is arranged for code with "EIND = 0". If
19081 code is supposed to work for a setup with "EIND != 0", a custom
19082 linker script has to be used in order to place the sections whose
19083 name start with ".trampolines" into the segment where "EIND" points
19084 to.
19085
19086 * The startup code from libgcc never sets "EIND". Notice that
19087 startup code is a blend of code from libgcc and AVR-LibC. For the
19088 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
19089 ("http://nongnu.org/avr-libc/user-manual/").
19090
19091 * It is legitimate for user-specific startup code to set up "EIND"
19092 early, for example by means of initialization code located in
19093 section ".init3". Such code runs prior to general startup code that
19094 initializes RAM and calls constructors, but after the bit of
19095 startup code from AVR-LibC that sets "EIND" to the segment where
19096 the vector table is located.
19097
19098 #include <avr/io.h>
19099
19100 static void
19101 __attribute__((section(".init3"),naked,used,no_instrument_function))
19102 init3_set_eind (void)
19103 {
19104 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
19105 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
19106 }
19107
19108 The "__trampolines_start" symbol is defined in the linker script.
19109
19110 * Stubs are generated automatically by the linker if the following
19111 two conditions are met:
19112
19113 -<The address of a label is taken by means of the "gs" modifier>
19114 (short for generate stubs) like so:
19115
19116 LDI r24, lo8(gs(<func>))
19117 LDI r25, hi8(gs(<func>))
19118
19119 -<The final location of that label is in a code segment>
19120 outside the segment where the stubs are located.
19121
19122 * The compiler emits such "gs" modifiers for code labels in the
19123 following situations:
19124
19125 -<Taking address of a function or code label.>
19126 -<Computed goto.>
19127 -<If prologue-save function is used, see -mcall-prologues>
19128 command-line option.
19129
19130 -<Switch/case dispatch tables. If you do not want such dispatch>
19131 tables you can specify the -fno-jump-tables command-line
19132 option.
19133
19134 -<C and C++ constructors/destructors called during
19135 startup/shutdown.>
19136 -<If the tools hit a "gs()" modifier explained above.>
19137 * Jumping to non-symbolic addresses like so is not supported:
19138
19139 int main (void)
19140 {
19141 /* Call function at word address 0x2 */
19142 return ((int(*)(void)) 0x2)();
19143 }
19144
19145 Instead, a stub has to be set up, i.e. the function has to be
19146 called through a symbol ("func_4" in the example):
19147
19148 int main (void)
19149 {
19150 extern int func_4 (void);
19151
19152 /* Call function at byte address 0x4 */
19153 return func_4();
19154 }
19155
19156 and the application be linked with -Wl,--defsym,func_4=0x4.
19157 Alternatively, "func_4" can be defined in the linker script.
19158
19159 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
19160 Registers
19161
19162 Some AVR devices support memories larger than the 64 KiB range that can
19163 be accessed with 16-bit pointers. To access memory locations outside
19164 this 64 KiB range, the content of a "RAMP" register is used as high
19165 part of the address: The "X", "Y", "Z" address register is concatenated
19166 with the "RAMPX", "RAMPY", "RAMPZ" special function register,
19167 respectively, to get a wide address. Similarly, "RAMPD" is used
19168 together with direct addressing.
19169
19170 * The startup code initializes the "RAMP" special function registers
19171 with zero.
19172
19173 * If a AVR Named Address Spaces,named address space other than
19174 generic or "__flash" is used, then "RAMPZ" is set as needed before
19175 the operation.
19176
19177 * If the device supports RAM larger than 64 KiB and the compiler
19178 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
19179 reset to zero after the operation.
19180
19181 * If the device comes with a specific "RAMP" register, the ISR
19182 prologue/epilogue saves/restores that SFR and initializes it with
19183 zero in case the ISR code might (implicitly) use it.
19184
19185 * RAM larger than 64 KiB is not supported by GCC for AVR targets. If
19186 you use inline assembler to read from locations outside the 16-bit
19187 address range and change one of the "RAMP" registers, you must
19188 reset it to zero after the access.
19189
19190 AVR Built-in Macros
19191
19192 GCC defines several built-in macros so that the user code can test for
19193 the presence or absence of features. Almost any of the following
19194 built-in macros are deduced from device capabilities and thus triggered
19195 by the -mmcu= command-line option.
19196
19197 For even more AVR-specific built-in macros see AVR Named Address Spaces
19198 and AVR Built-in Functions.
19199
19200 "__AVR_ARCH__"
19201 Build-in macro that resolves to a decimal number that identifies
19202 the architecture and depends on the -mmcu=mcu option. Possible
19203 values are:
19204
19205 2, 25, 3, 31, 35, 4, 5, 51, 6
19206
19207 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
19208 "avr51", "avr6",
19209
19210 respectively and
19211
19212 100, 102, 103, 104, 105, 106, 107
19213
19214 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
19215 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
19216 specifies a device, this built-in macro is set accordingly. For
19217 example, with -mmcu=atmega8 the macro is defined to 4.
19218
19219 "__AVR_Device__"
19220 Setting -mmcu=device defines this built-in macro which reflects the
19221 device's name. For example, -mmcu=atmega8 defines the built-in
19222 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
19223 "__AVR_ATtiny261A__", etc.
19224
19225 The built-in macros' names follow the scheme "__AVR_Device__" where
19226 Device is the device name as from the AVR user manual. The
19227 difference between Device in the built-in macro and device in
19228 -mmcu=device is that the latter is always lowercase.
19229
19230 If device is not a device but only a core architecture like avr51,
19231 this macro is not defined.
19232
19233 "__AVR_DEVICE_NAME__"
19234 Setting -mmcu=device defines this built-in macro to the device's
19235 name. For example, with -mmcu=atmega8 the macro is defined to
19236 "atmega8".
19237
19238 If device is not a device but only a core architecture like avr51,
19239 this macro is not defined.
19240
19241 "__AVR_XMEGA__"
19242 The device / architecture belongs to the XMEGA family of devices.
19243
19244 "__AVR_HAVE_ELPM__"
19245 The device has the "ELPM" instruction.
19246
19247 "__AVR_HAVE_ELPMX__"
19248 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
19249
19250 "__AVR_HAVE_MOVW__"
19251 The device has the "MOVW" instruction to perform 16-bit register-
19252 register moves.
19253
19254 "__AVR_HAVE_LPMX__"
19255 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
19256
19257 "__AVR_HAVE_MUL__"
19258 The device has a hardware multiplier.
19259
19260 "__AVR_HAVE_JMP_CALL__"
19261 The device has the "JMP" and "CALL" instructions. This is the case
19262 for devices with more than 8 KiB of program memory.
19263
19264 "__AVR_HAVE_EIJMP_EICALL__"
19265 "__AVR_3_BYTE_PC__"
19266 The device has the "EIJMP" and "EICALL" instructions. This is the
19267 case for devices with more than 128 KiB of program memory. This
19268 also means that the program counter (PC) is 3 bytes wide.
19269
19270 "__AVR_2_BYTE_PC__"
19271 The program counter (PC) is 2 bytes wide. This is the case for
19272 devices with up to 128 KiB of program memory.
19273
19274 "__AVR_HAVE_8BIT_SP__"
19275 "__AVR_HAVE_16BIT_SP__"
19276 The stack pointer (SP) register is treated as 8-bit respectively
19277 16-bit register by the compiler. The definition of these macros is
19278 affected by -mtiny-stack.
19279
19280 "__AVR_HAVE_SPH__"
19281 "__AVR_SP8__"
19282 The device has the SPH (high part of stack pointer) special
19283 function register or has an 8-bit stack pointer, respectively. The
19284 definition of these macros is affected by -mmcu= and in the cases
19285 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
19286
19287 "__AVR_HAVE_RAMPD__"
19288 "__AVR_HAVE_RAMPX__"
19289 "__AVR_HAVE_RAMPY__"
19290 "__AVR_HAVE_RAMPZ__"
19291 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
19292 function register, respectively.
19293
19294 "__NO_INTERRUPTS__"
19295 This macro reflects the -mno-interrupts command-line option.
19296
19297 "__AVR_ERRATA_SKIP__"
19298 "__AVR_ERRATA_SKIP_JMP_CALL__"
19299 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
19300 instructions because of a hardware erratum. Skip instructions are
19301 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
19302 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
19303
19304 "__AVR_ISA_RMW__"
19305 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
19306 LAT).
19307
19308 "__AVR_SFR_OFFSET__=offset"
19309 Instructions that can address I/O special function registers
19310 directly like "IN", "OUT", "SBI", etc. may use a different address
19311 as if addressed by an instruction to access RAM like "LD" or "STS".
19312 This offset depends on the device architecture and has to be
19313 subtracted from the RAM address in order to get the respective I/O
19314 address.
19315
19316 "__AVR_SHORT_CALLS__"
19317 The -mshort-calls command line option is set.
19318
19319 "__AVR_PM_BASE_ADDRESS__=addr"
19320 Some devices support reading from flash memory by means of "LD*"
19321 instructions. The flash memory is seen in the data address space
19322 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
19323 defined, this feature is not available. If defined, the address
19324 space is linear and there is no need to put ".rodata" into RAM.
19325 This is handled by the default linker description file, and is
19326 currently available for "avrtiny" and "avrxmega3". Even more
19327 convenient, there is no need to use address spaces like "__flash"
19328 or features like attribute "progmem" and "pgm_read_*".
19329
19330 "__WITH_AVRLIBC__"
19331 The compiler is configured to be used together with AVR-Libc. See
19332 the --with-avrlibc configure option.
19333
19334 "__HAVE_DOUBLE_MULTILIB__"
19335 Defined if -mdouble= acts as a multilib option.
19336
19337 "__HAVE_DOUBLE32__"
19338 "__HAVE_DOUBLE64__"
19339 Defined if the compiler supports 32-bit double resp. 64-bit double.
19340 The actual layout is specified by option -mdouble=.
19341
19342 "__DEFAULT_DOUBLE__"
19343 The size in bits of "double" if -mdouble= is not set. To test the
19344 layout of "double" in a program, use the built-in macro
19345 "__SIZEOF_DOUBLE__".
19346
19347 "__HAVE_LONG_DOUBLE32__"
19348 "__HAVE_LONG_DOUBLE64__"
19349 "__HAVE_LONG_DOUBLE_MULTILIB__"
19350 "__DEFAULT_LONG_DOUBLE__"
19351 Same as above, but for "long double" instead of "double".
19352
19353 "__WITH_DOUBLE_COMPARISON__"
19354 Reflects the "--with-double-comparison={tristate|bool|libf7}"
19355 configure option ("https://gcc.gnu.org/install/configure.html#avr")
19356 and is defined to 2 or 3.
19357
19358 "__WITH_LIBF7_LIBGCC__"
19359 "__WITH_LIBF7_MATH__"
19360 "__WITH_LIBF7_MATH_SYMBOLS__"
19361 Reflects the "--with-libf7={libgcc|math|math-symbols}"
19362 configure option
19363 ("https://gcc.gnu.org/install/configure.html#avr").
19364
19365 Blackfin Options
19366 -mcpu=cpu[-sirevision]
19367 Specifies the name of the target Blackfin processor. Currently,
19368 cpu can be one of bf512, bf514, bf516, bf518, bf522, bf523, bf524,
19369 bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf536, bf537,
19370 bf538, bf539, bf542, bf544, bf547, bf548, bf549, bf542m, bf544m,
19371 bf547m, bf548m, bf549m, bf561, bf592.
19372
19373 The optional sirevision specifies the silicon revision of the
19374 target Blackfin processor. Any workarounds available for the
19375 targeted silicon revision are enabled. If sirevision is none, no
19376 workarounds are enabled. If sirevision is any, all workarounds for
19377 the targeted processor are enabled. The "__SILICON_REVISION__"
19378 macro is defined to two hexadecimal digits representing the major
19379 and minor numbers in the silicon revision. If sirevision is none,
19380 the "__SILICON_REVISION__" is not defined. If sirevision is any,
19381 the "__SILICON_REVISION__" is defined to be 0xffff. If this
19382 optional sirevision is not used, GCC assumes the latest known
19383 silicon revision of the targeted Blackfin processor.
19384
19385 GCC defines a preprocessor macro for the specified cpu. For the
19386 bfin-elf toolchain, this option causes the hardware BSP provided by
19387 libgloss to be linked in if -msim is not given.
19388
19389 Without this option, bf532 is used as the processor by default.
19390
19391 Note that support for bf561 is incomplete. For bf561, only the
19392 preprocessor macro is defined.
19393
19394 -msim
19395 Specifies that the program will be run on the simulator. This
19396 causes the simulator BSP provided by libgloss to be linked in.
19397 This option has effect only for bfin-elf toolchain. Certain other
19398 options, such as -mid-shared-library and -mfdpic, imply -msim.
19399
19400 -momit-leaf-frame-pointer
19401 Don't keep the frame pointer in a register for leaf functions.
19402 This avoids the instructions to save, set up and restore frame
19403 pointers and makes an extra register available in leaf functions.
19404
19405 -mspecld-anomaly
19406 When enabled, the compiler ensures that the generated code does not
19407 contain speculative loads after jump instructions. If this option
19408 is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
19409
19410 -mno-specld-anomaly
19411 Don't generate extra code to prevent speculative loads from
19412 occurring.
19413
19414 -mcsync-anomaly
19415 When enabled, the compiler ensures that the generated code does not
19416 contain CSYNC or SSYNC instructions too soon after conditional
19417 branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS"
19418 is defined.
19419
19420 -mno-csync-anomaly
19421 Don't generate extra code to prevent CSYNC or SSYNC instructions
19422 from occurring too soon after a conditional branch.
19423
19424 -mlow64k
19425 When enabled, the compiler is free to take advantage of the
19426 knowledge that the entire program fits into the low 64k of memory.
19427
19428 -mno-low64k
19429 Assume that the program is arbitrarily large. This is the default.
19430
19431 -mstack-check-l1
19432 Do stack checking using information placed into L1 scratchpad
19433 memory by the uClinux kernel.
19434
19435 -mid-shared-library
19436 Generate code that supports shared libraries via the library ID
19437 method. This allows for execute in place and shared libraries in
19438 an environment without virtual memory management. This option
19439 implies -fPIC. With a bfin-elf target, this option implies -msim.
19440
19441 -mno-id-shared-library
19442 Generate code that doesn't assume ID-based shared libraries are
19443 being used. This is the default.
19444
19445 -mleaf-id-shared-library
19446 Generate code that supports shared libraries via the library ID
19447 method, but assumes that this library or executable won't link
19448 against any other ID shared libraries. That allows the compiler to
19449 use faster code for jumps and calls.
19450
19451 -mno-leaf-id-shared-library
19452 Do not assume that the code being compiled won't link against any
19453 ID shared libraries. Slower code is generated for jump and call
19454 insns.
19455
19456 -mshared-library-id=n
19457 Specifies the identification number of the ID-based shared library
19458 being compiled. Specifying a value of 0 generates more compact
19459 code; specifying other values forces the allocation of that number
19460 to the current library but is no more space- or time-efficient than
19461 omitting this option.
19462
19463 -msep-data
19464 Generate code that allows the data segment to be located in a
19465 different area of memory from the text segment. This allows for
19466 execute in place in an environment without virtual memory
19467 management by eliminating relocations against the text section.
19468
19469 -mno-sep-data
19470 Generate code that assumes that the data segment follows the text
19471 segment. This is the default.
19472
19473 -mlong-calls
19474 -mno-long-calls
19475 Tells the compiler to perform function calls by first loading the
19476 address of the function into a register and then performing a
19477 subroutine call on this register. This switch is needed if the
19478 target function lies outside of the 24-bit addressing range of the
19479 offset-based version of subroutine call instruction.
19480
19481 This feature is not enabled by default. Specifying -mno-long-calls
19482 restores the default behavior. Note these switches have no effect
19483 on how the compiler generates code to handle function calls via
19484 function pointers.
19485
19486 -mfast-fp
19487 Link with the fast floating-point library. This library relaxes
19488 some of the IEEE floating-point standard's rules for checking
19489 inputs against Not-a-Number (NAN), in the interest of performance.
19490
19491 -minline-plt
19492 Enable inlining of PLT entries in function calls to functions that
19493 are not known to bind locally. It has no effect without -mfdpic.
19494
19495 -mmulticore
19496 Build a standalone application for multicore Blackfin processors.
19497 This option causes proper start files and link scripts supporting
19498 multicore to be used, and defines the macro "__BFIN_MULTICORE". It
19499 can only be used with -mcpu=bf561[-sirevision].
19500
19501 This option can be used with -mcorea or -mcoreb, which selects the
19502 one-application-per-core programming model. Without -mcorea or
19503 -mcoreb, the single-application/dual-core programming model is
19504 used. In this model, the main function of Core B should be named as
19505 "coreb_main".
19506
19507 If this option is not used, the single-core application programming
19508 model is used.
19509
19510 -mcorea
19511 Build a standalone application for Core A of BF561 when using the
19512 one-application-per-core programming model. Proper start files and
19513 link scripts are used to support Core A, and the macro
19514 "__BFIN_COREA" is defined. This option can only be used in
19515 conjunction with -mmulticore.
19516
19517 -mcoreb
19518 Build a standalone application for Core B of BF561 when using the
19519 one-application-per-core programming model. Proper start files and
19520 link scripts are used to support Core B, and the macro
19521 "__BFIN_COREB" is defined. When this option is used, "coreb_main"
19522 should be used instead of "main". This option can only be used in
19523 conjunction with -mmulticore.
19524
19525 -msdram
19526 Build a standalone application for SDRAM. Proper start files and
19527 link scripts are used to put the application into SDRAM, and the
19528 macro "__BFIN_SDRAM" is defined. The loader should initialize
19529 SDRAM before loading the application.
19530
19531 -micplb
19532 Assume that ICPLBs are enabled at run time. This has an effect on
19533 certain anomaly workarounds. For Linux targets, the default is to
19534 assume ICPLBs are enabled; for standalone applications the default
19535 is off.
19536
19537 C6X Options
19538 -march=name
19539 This specifies the name of the target architecture. GCC uses this
19540 name to determine what kind of instructions it can emit when
19541 generating assembly code. Permissible names are: c62x, c64x,
19542 c64x+, c67x, c67x+, c674x.
19543
19544 -mbig-endian
19545 Generate code for a big-endian target.
19546
19547 -mlittle-endian
19548 Generate code for a little-endian target. This is the default.
19549
19550 -msim
19551 Choose startup files and linker script suitable for the simulator.
19552
19553 -msdata=default
19554 Put small global and static data in the ".neardata" section, which
19555 is pointed to by register "B14". Put small uninitialized global
19556 and static data in the ".bss" section, which is adjacent to the
19557 ".neardata" section. Put small read-only data into the ".rodata"
19558 section. The corresponding sections used for large pieces of data
19559 are ".fardata", ".far" and ".const".
19560
19561 -msdata=all
19562 Put all data, not just small objects, into the sections reserved
19563 for small data, and use addressing relative to the "B14" register
19564 to access them.
19565
19566 -msdata=none
19567 Make no use of the sections reserved for small data, and use
19568 absolute addresses to access all data. Put all initialized global
19569 and static data in the ".fardata" section, and all uninitialized
19570 data in the ".far" section. Put all constant data into the
19571 ".const" section.
19572
19573 CRIS Options
19574 These options are defined specifically for the CRIS ports.
19575
19576 -march=architecture-type
19577 -mcpu=architecture-type
19578 Generate code for the specified architecture. The choices for
19579 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
19580 ETRAX 100, and ETRAX 100 LX. Default is v0.
19581
19582 -mtune=architecture-type
19583 Tune to architecture-type everything applicable about the generated
19584 code, except for the ABI and the set of available instructions.
19585 The choices for architecture-type are the same as for
19586 -march=architecture-type.
19587
19588 -mmax-stack-frame=n
19589 Warn when the stack frame of a function exceeds n bytes.
19590
19591 -metrax4
19592 -metrax100
19593 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
19594 -march=v8 respectively.
19595
19596 -mmul-bug-workaround
19597 -mno-mul-bug-workaround
19598 Work around a bug in the "muls" and "mulu" instructions for CPU
19599 models where it applies. This option is disabled by default.
19600
19601 -mpdebug
19602 Enable CRIS-specific verbose debug-related information in the
19603 assembly code. This option also has the effect of turning off the
19604 #NO_APP formatted-code indicator to the assembler at the beginning
19605 of the assembly file.
19606
19607 -mcc-init
19608 Do not use condition-code results from previous instruction; always
19609 emit compare and test instructions before use of condition codes.
19610
19611 -mno-side-effects
19612 Do not emit instructions with side effects in addressing modes
19613 other than post-increment.
19614
19615 -mstack-align
19616 -mno-stack-align
19617 -mdata-align
19618 -mno-data-align
19619 -mconst-align
19620 -mno-const-align
19621 These options (no- options) arrange (eliminate arrangements) for
19622 the stack frame, individual data and constants to be aligned for
19623 the maximum single data access size for the chosen CPU model. The
19624 default is to arrange for 32-bit alignment. ABI details such as
19625 structure layout are not affected by these options.
19626
19627 -m32-bit
19628 -m16-bit
19629 -m8-bit
19630 Similar to the stack- data- and const-align options above, these
19631 options arrange for stack frame, writable data and constants to all
19632 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
19633 alignment.
19634
19635 -mno-prologue-epilogue
19636 -mprologue-epilogue
19637 With -mno-prologue-epilogue, the normal function prologue and
19638 epilogue which set up the stack frame are omitted and no return
19639 instructions or return sequences are generated in the code. Use
19640 this option only together with visual inspection of the compiled
19641 code: no warnings or errors are generated when call-saved registers
19642 must be saved, or storage for local variables needs to be
19643 allocated.
19644
19645 -melf
19646 Legacy no-op option.
19647
19648 -sim
19649 This option arranges to link with input-output functions from a
19650 simulator library. Code, initialized data and zero-initialized
19651 data are allocated consecutively.
19652
19653 -sim2
19654 Like -sim, but pass linker options to locate initialized data at
19655 0x40000000 and zero-initialized data at 0x80000000.
19656
19657 CR16 Options
19658 These options are defined specifically for the CR16 ports.
19659
19660 -mmac
19661 Enable the use of multiply-accumulate instructions. Disabled by
19662 default.
19663
19664 -mcr16cplus
19665 -mcr16c
19666 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
19667 is default.
19668
19669 -msim
19670 Links the library libsim.a which is in compatible with simulator.
19671 Applicable to ELF compiler only.
19672
19673 -mint32
19674 Choose integer type as 32-bit wide.
19675
19676 -mbit-ops
19677 Generates "sbit"/"cbit" instructions for bit manipulations.
19678
19679 -mdata-model=model
19680 Choose a data model. The choices for model are near, far or medium.
19681 medium is default. However, far is not valid with -mcr16c, as the
19682 CR16C architecture does not support the far data model.
19683
19684 C-SKY Options
19685 GCC supports these options when compiling for C-SKY V2 processors.
19686
19687 -march=arch
19688 Specify the C-SKY target architecture. Valid values for arch are:
19689 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
19690
19691 -mcpu=cpu
19692 Specify the C-SKY target processor. Valid values for cpu are:
19693 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
19694 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
19695 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
19696 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
19697 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
19698 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
19699 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
19700 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
19701 ck810tv, ck810ft, and ck810ftv.
19702
19703 -mbig-endian
19704 -EB
19705 -mlittle-endian
19706 -EL Select big- or little-endian code. The default is little-endian.
19707
19708 -mfloat-abi=name
19709 Specifies which floating-point ABI to use. Permissible values are:
19710 soft, softfp and hard.
19711
19712 Specifying soft causes GCC to generate output containing library
19713 calls for floating-point operations. softfp allows the generation
19714 of code using hardware floating-point instructions, but still uses
19715 the soft-float calling conventions. hard allows generation of
19716 floating-point instructions and uses FPU-specific calling
19717 conventions.
19718
19719 The default depends on the specific target configuration. Note
19720 that the hard-float and soft-float ABIs are not link-compatible;
19721 you must compile your entire program with the same ABI, and link
19722 with a compatible set of libraries.
19723
19724 -mhard-float
19725 -msoft-float
19726 Select hardware or software floating-point implementations. The
19727 default is soft float.
19728
19729 -mdouble-float
19730 -mno-double-float
19731 When -mhard-float is in effect, enable generation of double-
19732 precision float instructions. This is the default except when
19733 compiling for CK803.
19734
19735 -mfdivdu
19736 -mno-fdivdu
19737 When -mhard-float is in effect, enable generation of "frecipd",
19738 "fsqrtd", and "fdivd" instructions. This is the default except
19739 when compiling for CK803.
19740
19741 -mfpu=fpu
19742 Select the floating-point processor. This option can only be used
19743 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
19744 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
19745 and fpv2_divd (-mdouble-float -mdivdu).
19746
19747 -melrw
19748 -mno-elrw
19749 Enable the extended "lrw" instruction. This option defaults to on
19750 for CK801 and off otherwise.
19751
19752 -mistack
19753 -mno-istack
19754 Enable interrupt stack instructions; the default is off.
19755
19756 The -mistack option is required to handle the "interrupt" and "isr"
19757 function attributes.
19758
19759 -mmp
19760 Enable multiprocessor instructions; the default is off.
19761
19762 -mcp
19763 Enable coprocessor instructions; the default is off.
19764
19765 -mcache
19766 Enable coprocessor instructions; the default is off.
19767
19768 -msecurity
19769 Enable C-SKY security instructions; the default is off.
19770
19771 -mtrust
19772 Enable C-SKY trust instructions; the default is off.
19773
19774 -mdsp
19775 -medsp
19776 -mvdsp
19777 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
19778 respectively. All of these options default to off.
19779
19780 -mdiv
19781 -mno-div
19782 Generate divide instructions. Default is off.
19783
19784 -msmart
19785 -mno-smart
19786 Generate code for Smart Mode, using only registers numbered 0-7 to
19787 allow use of 16-bit instructions. This option is ignored for CK801
19788 where this is the required behavior, and it defaults to on for
19789 CK802. For other targets, the default is off.
19790
19791 -mhigh-registers
19792 -mno-high-registers
19793 Generate code using the high registers numbered 16-31. This option
19794 is not supported on CK801, CK802, or CK803, and is enabled by
19795 default for other processors.
19796
19797 -manchor
19798 -mno-anchor
19799 Generate code using global anchor symbol addresses.
19800
19801 -mpushpop
19802 -mno-pushpop
19803 Generate code using "push" and "pop" instructions. This option
19804 defaults to on.
19805
19806 -mmultiple-stld
19807 -mstm
19808 -mno-multiple-stld
19809 -mno-stm
19810 Generate code using "stm" and "ldm" instructions. This option
19811 isn't supported on CK801 but is enabled by default on other
19812 processors.
19813
19814 -mconstpool
19815 -mno-constpool
19816 Create constant pools in the compiler instead of deferring it to
19817 the assembler. This option is the default and required for correct
19818 code generation on CK801 and CK802, and is optional on other
19819 processors.
19820
19821 -mstack-size
19822 -mno-stack-size
19823 Emit ".stack_size" directives for each function in the assembly
19824 output. This option defaults to off.
19825
19826 -mccrt
19827 -mno-ccrt
19828 Generate code for the C-SKY compiler runtime instead of libgcc.
19829 This option defaults to off.
19830
19831 -mbranch-cost=n
19832 Set the branch costs to roughly "n" instructions. The default is
19833 1.
19834
19835 -msched-prolog
19836 -mno-sched-prolog
19837 Permit scheduling of function prologue and epilogue sequences.
19838 Using this option can result in code that is not compliant with the
19839 C-SKY V2 ABI prologue requirements and that cannot be debugged or
19840 backtraced. It is disabled by default.
19841
19842 -msim
19843 Links the library libsemi.a which is in compatible with simulator.
19844 Applicable to ELF compiler only.
19845
19846 Darwin Options
19847 These options are defined for all architectures running the Darwin
19848 operating system.
19849
19850 FSF GCC on Darwin does not create "fat" object files; it creates an
19851 object file for the single architecture that GCC was built to target.
19852 Apple's GCC on Darwin does create "fat" files if multiple -arch options
19853 are used; it does so by running the compiler or linker multiple times
19854 and joining the results together with lipo.
19855
19856 The subtype of the file created (like ppc7400 or ppc970 or i686) is
19857 determined by the flags that specify the ISA that GCC is targeting,
19858 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
19859 override this.
19860
19861 The Darwin tools vary in their behavior when presented with an ISA
19862 mismatch. The assembler, as, only permits instructions to be used that
19863 are valid for the subtype of the file it is generating, so you cannot
19864 put 64-bit instructions in a ppc750 object file. The linker for shared
19865 libraries, /usr/bin/libtool, fails and prints an error if asked to
19866 create a shared library with a less restrictive subtype than its input
19867 files (for instance, trying to put a ppc970 object file in a ppc7400
19868 library). The linker for executables, ld, quietly gives the executable
19869 the most restrictive subtype of any of its input files.
19870
19871 -Fdir
19872 Add the framework directory dir to the head of the list of
19873 directories to be searched for header files. These directories are
19874 interleaved with those specified by -I options and are scanned in a
19875 left-to-right order.
19876
19877 A framework directory is a directory with frameworks in it. A
19878 framework is a directory with a Headers and/or PrivateHeaders
19879 directory contained directly in it that ends in .framework. The
19880 name of a framework is the name of this directory excluding the
19881 .framework. Headers associated with the framework are found in one
19882 of those two directories, with Headers being searched first. A
19883 subframework is a framework directory that is in a framework's
19884 Frameworks directory. Includes of subframework headers can only
19885 appear in a header of a framework that contains the subframework,
19886 or in a sibling subframework header. Two subframeworks are
19887 siblings if they occur in the same framework. A subframework
19888 should not have the same name as a framework; a warning is issued
19889 if this is violated. Currently a subframework cannot have
19890 subframeworks; in the future, the mechanism may be extended to
19891 support this. The standard frameworks can be found in
19892 /System/Library/Frameworks and /Library/Frameworks. An example
19893 include looks like "#include <Framework/header.h>", where Framework
19894 denotes the name of the framework and header.h is found in the
19895 PrivateHeaders or Headers directory.
19896
19897 -iframeworkdir
19898 Like -F except the directory is a treated as a system directory.
19899 The main difference between this -iframework and -F is that with
19900 -iframework the compiler does not warn about constructs contained
19901 within header files found via dir. This option is valid only for
19902 the C family of languages.
19903
19904 -gused
19905 Emit debugging information for symbols that are used. For stabs
19906 debugging format, this enables -feliminate-unused-debug-symbols.
19907 This is by default ON.
19908
19909 -gfull
19910 Emit debugging information for all symbols and types.
19911
19912 -mmacosx-version-min=version
19913 The earliest version of MacOS X that this executable will run on is
19914 version. Typical values of version include 10.1, 10.2, and 10.3.9.
19915
19916 If the compiler was built to use the system's headers by default,
19917 then the default for this option is the system version on which the
19918 compiler is running, otherwise the default is to make choices that
19919 are compatible with as many systems and code bases as possible.
19920
19921 -mkernel
19922 Enable kernel development mode. The -mkernel option sets -static,
19923 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
19924 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
19925 where applicable. This mode also sets -mno-altivec, -msoft-float,
19926 -fno-builtin and -mlong-branch for PowerPC targets.
19927
19928 -mone-byte-bool
19929 Override the defaults for "bool" so that "sizeof(bool)==1". By
19930 default "sizeof(bool)" is 4 when compiling for Darwin/PowerPC and 1
19931 when compiling for Darwin/x86, so this option has no effect on x86.
19932
19933 Warning: The -mone-byte-bool switch causes GCC to generate code
19934 that is not binary compatible with code generated without that
19935 switch. Using this switch may require recompiling all other
19936 modules in a program, including system libraries. Use this switch
19937 to conform to a non-default data model.
19938
19939 -mfix-and-continue
19940 -ffix-and-continue
19941 -findirect-data
19942 Generate code suitable for fast turnaround development, such as to
19943 allow GDB to dynamically load .o files into already-running
19944 programs. -findirect-data and -ffix-and-continue are provided for
19945 backwards compatibility.
19946
19947 -all_load
19948 Loads all members of static archive libraries. See man ld(1) for
19949 more information.
19950
19951 -arch_errors_fatal
19952 Cause the errors having to do with files that have the wrong
19953 architecture to be fatal.
19954
19955 -bind_at_load
19956 Causes the output file to be marked such that the dynamic linker
19957 will bind all undefined references when the file is loaded or
19958 launched.
19959
19960 -bundle
19961 Produce a Mach-o bundle format file. See man ld(1) for more
19962 information.
19963
19964 -bundle_loader executable
19965 This option specifies the executable that will load the build
19966 output file being linked. See man ld(1) for more information.
19967
19968 -dynamiclib
19969 When passed this option, GCC produces a dynamic library instead of
19970 an executable when linking, using the Darwin libtool command.
19971
19972 -force_cpusubtype_ALL
19973 This causes GCC's output file to have the ALL subtype, instead of
19974 one controlled by the -mcpu or -march option.
19975
19976 -allowable_client client_name
19977 -client_name
19978 -compatibility_version
19979 -current_version
19980 -dead_strip
19981 -dependency-file
19982 -dylib_file
19983 -dylinker_install_name
19984 -dynamic
19985 -exported_symbols_list
19986 -filelist
19987 -flat_namespace
19988 -force_flat_namespace
19989 -headerpad_max_install_names
19990 -image_base
19991 -init
19992 -install_name
19993 -keep_private_externs
19994 -multi_module
19995 -multiply_defined
19996 -multiply_defined_unused
19997 -noall_load
19998 -no_dead_strip_inits_and_terms
19999 -nofixprebinding
20000 -nomultidefs
20001 -noprebind
20002 -noseglinkedit
20003 -pagezero_size
20004 -prebind
20005 -prebind_all_twolevel_modules
20006 -private_bundle
20007 -read_only_relocs
20008 -sectalign
20009 -sectobjectsymbols
20010 -whyload
20011 -seg1addr
20012 -sectcreate
20013 -sectobjectsymbols
20014 -sectorder
20015 -segaddr
20016 -segs_read_only_addr
20017 -segs_read_write_addr
20018 -seg_addr_table
20019 -seg_addr_table_filename
20020 -seglinkedit
20021 -segprot
20022 -segs_read_only_addr
20023 -segs_read_write_addr
20024 -single_module
20025 -static
20026 -sub_library
20027 -sub_umbrella
20028 -twolevel_namespace
20029 -umbrella
20030 -undefined
20031 -unexported_symbols_list
20032 -weak_reference_mismatches
20033 -whatsloaded
20034 These options are passed to the Darwin linker. The Darwin linker
20035 man page describes them in detail.
20036
20037 DEC Alpha Options
20038 These -m options are defined for the DEC Alpha implementations:
20039
20040 -mno-soft-float
20041 -msoft-float
20042 Use (do not use) the hardware floating-point instructions for
20043 floating-point operations. When -msoft-float is specified,
20044 functions in libgcc.a are used to perform floating-point
20045 operations. Unless they are replaced by routines that emulate the
20046 floating-point operations, or compiled in such a way as to call
20047 such emulations routines, these routines issue floating-point
20048 operations. If you are compiling for an Alpha without floating-
20049 point operations, you must ensure that the library is built so as
20050 not to call them.
20051
20052 Note that Alpha implementations without floating-point operations
20053 are required to have floating-point registers.
20054
20055 -mfp-reg
20056 -mno-fp-regs
20057 Generate code that uses (does not use) the floating-point register
20058 set. -mno-fp-regs implies -msoft-float. If the floating-point
20059 register set is not used, floating-point operands are passed in
20060 integer registers as if they were integers and floating-point
20061 results are passed in $0 instead of $f0. This is a non-standard
20062 calling sequence, so any function with a floating-point argument or
20063 return value called by code compiled with -mno-fp-regs must also be
20064 compiled with that option.
20065
20066 A typical use of this option is building a kernel that does not
20067 use, and hence need not save and restore, any floating-point
20068 registers.
20069
20070 -mieee
20071 The Alpha architecture implements floating-point hardware optimized
20072 for maximum performance. It is mostly compliant with the IEEE
20073 floating-point standard. However, for full compliance, software
20074 assistance is required. This option generates code fully IEEE-
20075 compliant code except that the inexact-flag is not maintained (see
20076 below). If this option is turned on, the preprocessor macro
20077 "_IEEE_FP" is defined during compilation. The resulting code is
20078 less efficient but is able to correctly support denormalized
20079 numbers and exceptional IEEE values such as not-a-number and
20080 plus/minus infinity. Other Alpha compilers call this option
20081 -ieee_with_no_inexact.
20082
20083 -mieee-with-inexact
20084 This is like -mieee except the generated code also maintains the
20085 IEEE inexact-flag. Turning on this option causes the generated
20086 code to implement fully-compliant IEEE math. In addition to
20087 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
20088 On some Alpha implementations the resulting code may execute
20089 significantly slower than the code generated by default. Since
20090 there is very little code that depends on the inexact-flag, you
20091 should normally not specify this option. Other Alpha compilers
20092 call this option -ieee_with_inexact.
20093
20094 -mfp-trap-mode=trap-mode
20095 This option controls what floating-point related traps are enabled.
20096 Other Alpha compilers call this option -fptm trap-mode. The trap
20097 mode can be set to one of four values:
20098
20099 n This is the default (normal) setting. The only traps that are
20100 enabled are the ones that cannot be disabled in software (e.g.,
20101 division by zero trap).
20102
20103 u In addition to the traps enabled by n, underflow traps are
20104 enabled as well.
20105
20106 su Like u, but the instructions are marked to be safe for software
20107 completion (see Alpha architecture manual for details).
20108
20109 sui Like su, but inexact traps are enabled as well.
20110
20111 -mfp-rounding-mode=rounding-mode
20112 Selects the IEEE rounding mode. Other Alpha compilers call this
20113 option -fprm rounding-mode. The rounding-mode can be one of:
20114
20115 n Normal IEEE rounding mode. Floating-point numbers are rounded
20116 towards the nearest machine number or towards the even machine
20117 number in case of a tie.
20118
20119 m Round towards minus infinity.
20120
20121 c Chopped rounding mode. Floating-point numbers are rounded
20122 towards zero.
20123
20124 d Dynamic rounding mode. A field in the floating-point control
20125 register (fpcr, see Alpha architecture reference manual)
20126 controls the rounding mode in effect. The C library
20127 initializes this register for rounding towards plus infinity.
20128 Thus, unless your program modifies the fpcr, d corresponds to
20129 round towards plus infinity.
20130
20131 -mtrap-precision=trap-precision
20132 In the Alpha architecture, floating-point traps are imprecise.
20133 This means without software assistance it is impossible to recover
20134 from a floating trap and program execution normally needs to be
20135 terminated. GCC can generate code that can assist operating system
20136 trap handlers in determining the exact location that caused a
20137 floating-point trap. Depending on the requirements of an
20138 application, different levels of precisions can be selected:
20139
20140 p Program precision. This option is the default and means a trap
20141 handler can only identify which program caused a floating-point
20142 exception.
20143
20144 f Function precision. The trap handler can determine the
20145 function that caused a floating-point exception.
20146
20147 i Instruction precision. The trap handler can determine the
20148 exact instruction that caused a floating-point exception.
20149
20150 Other Alpha compilers provide the equivalent options called
20151 -scope_safe and -resumption_safe.
20152
20153 -mieee-conformant
20154 This option marks the generated code as IEEE conformant. You must
20155 not use this option unless you also specify -mtrap-precision=i and
20156 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
20157 to emit the line .eflag 48 in the function prologue of the
20158 generated assembly file.
20159
20160 -mbuild-constants
20161 Normally GCC examines a 32- or 64-bit integer constant to see if it
20162 can construct it from smaller constants in two or three
20163 instructions. If it cannot, it outputs the constant as a literal
20164 and generates code to load it from the data segment at run time.
20165
20166 Use this option to require GCC to construct all integer constants
20167 using code, even if it takes more instructions (the maximum is
20168 six).
20169
20170 You typically use this option to build a shared library dynamic
20171 loader. Itself a shared library, it must relocate itself in memory
20172 before it can find the variables and constants in its own data
20173 segment.
20174
20175 -mbwx
20176 -mno-bwx
20177 -mcix
20178 -mno-cix
20179 -mfix
20180 -mno-fix
20181 -mmax
20182 -mno-max
20183 Indicate whether GCC should generate code to use the optional BWX,
20184 CIX, FIX and MAX instruction sets. The default is to use the
20185 instruction sets supported by the CPU type specified via -mcpu=
20186 option or that of the CPU on which GCC was built if none is
20187 specified.
20188
20189 -mfloat-vax
20190 -mfloat-ieee
20191 Generate code that uses (does not use) VAX F and G floating-point
20192 arithmetic instead of IEEE single and double precision.
20193
20194 -mexplicit-relocs
20195 -mno-explicit-relocs
20196 Older Alpha assemblers provided no way to generate symbol
20197 relocations except via assembler macros. Use of these macros does
20198 not allow optimal instruction scheduling. GNU binutils as of
20199 version 2.12 supports a new syntax that allows the compiler to
20200 explicitly mark which relocations should apply to which
20201 instructions. This option is mostly useful for debugging, as GCC
20202 detects the capabilities of the assembler when it is built and sets
20203 the default accordingly.
20204
20205 -msmall-data
20206 -mlarge-data
20207 When -mexplicit-relocs is in effect, static data is accessed via
20208 gp-relative relocations. When -msmall-data is used, objects 8
20209 bytes long or smaller are placed in a small data area (the ".sdata"
20210 and ".sbss" sections) and are accessed via 16-bit relocations off
20211 of the $gp register. This limits the size of the small data area
20212 to 64KB, but allows the variables to be directly accessed via a
20213 single instruction.
20214
20215 The default is -mlarge-data. With this option the data area is
20216 limited to just below 2GB. Programs that require more than 2GB of
20217 data must use "malloc" or "mmap" to allocate the data in the heap
20218 instead of in the program's data segment.
20219
20220 When generating code for shared libraries, -fpic implies
20221 -msmall-data and -fPIC implies -mlarge-data.
20222
20223 -msmall-text
20224 -mlarge-text
20225 When -msmall-text is used, the compiler assumes that the code of
20226 the entire program (or shared library) fits in 4MB, and is thus
20227 reachable with a branch instruction. When -msmall-data is used,
20228 the compiler can assume that all local symbols share the same $gp
20229 value, and thus reduce the number of instructions required for a
20230 function call from 4 to 1.
20231
20232 The default is -mlarge-text.
20233
20234 -mcpu=cpu_type
20235 Set the instruction set and instruction scheduling parameters for
20236 machine type cpu_type. You can specify either the EV style name or
20237 the corresponding chip number. GCC supports scheduling parameters
20238 for the EV4, EV5 and EV6 family of processors and chooses the
20239 default values for the instruction set from the processor you
20240 specify. If you do not specify a processor type, GCC defaults to
20241 the processor on which the compiler was built.
20242
20243 Supported values for cpu_type are
20244
20245 ev4
20246 ev45
20247 21064
20248 Schedules as an EV4 and has no instruction set extensions.
20249
20250 ev5
20251 21164
20252 Schedules as an EV5 and has no instruction set extensions.
20253
20254 ev56
20255 21164a
20256 Schedules as an EV5 and supports the BWX extension.
20257
20258 pca56
20259 21164pc
20260 21164PC
20261 Schedules as an EV5 and supports the BWX and MAX extensions.
20262
20263 ev6
20264 21264
20265 Schedules as an EV6 and supports the BWX, FIX, and MAX
20266 extensions.
20267
20268 ev67
20269 21264a
20270 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
20271 extensions.
20272
20273 Native toolchains also support the value native, which selects the
20274 best architecture option for the host processor. -mcpu=native has
20275 no effect if GCC does not recognize the processor.
20276
20277 -mtune=cpu_type
20278 Set only the instruction scheduling parameters for machine type
20279 cpu_type. The instruction set is not changed.
20280
20281 Native toolchains also support the value native, which selects the
20282 best architecture option for the host processor. -mtune=native has
20283 no effect if GCC does not recognize the processor.
20284
20285 -mmemory-latency=time
20286 Sets the latency the scheduler should assume for typical memory
20287 references as seen by the application. This number is highly
20288 dependent on the memory access patterns used by the application and
20289 the size of the external cache on the machine.
20290
20291 Valid options for time are
20292
20293 number
20294 A decimal number representing clock cycles.
20295
20296 L1
20297 L2
20298 L3
20299 main
20300 The compiler contains estimates of the number of clock cycles
20301 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
20302 (also called Dcache, Scache, and Bcache), as well as to main
20303 memory. Note that L3 is only valid for EV5.
20304
20305 eBPF Options
20306 -mframe-limit=bytes
20307 This specifies the hard limit for frame sizes, in bytes.
20308 Currently, the value that can be specified should be less than or
20309 equal to 32767. Defaults to whatever limit is imposed by the
20310 version of the Linux kernel targeted.
20311
20312 -mkernel=version
20313 This specifies the minimum version of the kernel that will run the
20314 compiled program. GCC uses this version to determine which
20315 instructions to use, what kernel helpers to allow, etc. Currently,
20316 version can be one of 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8,
20317 4.9, 4.10, 4.11, 4.12, 4.13, 4.14, 4.15, 4.16, 4.17, 4.18, 4.19,
20318 4.20, 5.0, 5.1, 5.2, latest and native.
20319
20320 -mbig-endian
20321 Generate code for a big-endian target.
20322
20323 -mlittle-endian
20324 Generate code for a little-endian target. This is the default.
20325
20326 -mjmpext
20327 Enable generation of extra conditional-branch instructions.
20328 Enabled for CPU v2 and above.
20329
20330 -mjmp32
20331 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
20332
20333 -malu32
20334 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
20335
20336 -mcpu=version
20337 This specifies which version of the eBPF ISA to target. Newer
20338 versions may not be supported by all kernels. The default is v3.
20339
20340 Supported values for version are:
20341
20342 v1 The first stable eBPF ISA with no special features or
20343 extensions.
20344
20345 v2 Supports the jump extensions, as in -mjmpext.
20346
20347 v3 All features of v2, plus:
20348
20349 -<32-bit jump operations, as in -mjmp32>
20350 -<32-bit ALU operations, as in -malu32>
20351 -mco-re
20352 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires
20353 and is implied by -gbtf.
20354
20355 -mno-co-re
20356 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-
20357 RE support is enabled by default when generating BTF debug
20358 information for the BPF target.
20359
20360 -mxbpf
20361 Generate code for an expanded version of BPF, which relaxes some of
20362 the restrictions imposed by the BPF architecture:
20363
20364 -<Save and restore callee-saved registers at function entry and>
20365 exit, respectively.
20366
20367 FR30 Options
20368 These options are defined specifically for the FR30 port.
20369
20370 -msmall-model
20371 Use the small address space model. This can produce smaller code,
20372 but it does assume that all symbolic values and addresses fit into
20373 a 20-bit range.
20374
20375 -mno-lsim
20376 Assume that runtime support has been provided and so there is no
20377 need to include the simulator library (libsim.a) on the linker
20378 command line.
20379
20380 FT32 Options
20381 These options are defined specifically for the FT32 port.
20382
20383 -msim
20384 Specifies that the program will be run on the simulator. This
20385 causes an alternate runtime startup and library to be linked. You
20386 must not use this option when generating programs that will run on
20387 real hardware; you must provide your own runtime library for
20388 whatever I/O functions are needed.
20389
20390 -mlra
20391 Enable Local Register Allocation. This is still experimental for
20392 FT32, so by default the compiler uses standard reload.
20393
20394 -mnodiv
20395 Do not use div and mod instructions.
20396
20397 -mft32b
20398 Enable use of the extended instructions of the FT32B processor.
20399
20400 -mcompress
20401 Compress all code using the Ft32B code compression scheme.
20402
20403 -mnopm
20404 Do not generate code that reads program memory.
20405
20406 FRV Options
20407 -mgpr-32
20408 Only use the first 32 general-purpose registers.
20409
20410 -mgpr-64
20411 Use all 64 general-purpose registers.
20412
20413 -mfpr-32
20414 Use only the first 32 floating-point registers.
20415
20416 -mfpr-64
20417 Use all 64 floating-point registers.
20418
20419 -mhard-float
20420 Use hardware instructions for floating-point operations.
20421
20422 -msoft-float
20423 Use library routines for floating-point operations.
20424
20425 -malloc-cc
20426 Dynamically allocate condition code registers.
20427
20428 -mfixed-cc
20429 Do not try to dynamically allocate condition code registers, only
20430 use "icc0" and "fcc0".
20431
20432 -mdword
20433 Change ABI to use double word insns.
20434
20435 -mno-dword
20436 Do not use double word instructions.
20437
20438 -mdouble
20439 Use floating-point double instructions.
20440
20441 -mno-double
20442 Do not use floating-point double instructions.
20443
20444 -mmedia
20445 Use media instructions.
20446
20447 -mno-media
20448 Do not use media instructions.
20449
20450 -mmuladd
20451 Use multiply and add/subtract instructions.
20452
20453 -mno-muladd
20454 Do not use multiply and add/subtract instructions.
20455
20456 -mfdpic
20457 Select the FDPIC ABI, which uses function descriptors to represent
20458 pointers to functions. Without any PIC/PIE-related options, it
20459 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
20460 small data are within a 12-bit range from the GOT base address;
20461 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
20462 bfin-elf target, this option implies -msim.
20463
20464 -minline-plt
20465 Enable inlining of PLT entries in function calls to functions that
20466 are not known to bind locally. It has no effect without -mfdpic.
20467 It's enabled by default if optimizing for speed and compiling for
20468 shared libraries (i.e., -fPIC or -fpic), or when an optimization
20469 option such as -O3 or above is present in the command line.
20470
20471 -mTLS
20472 Assume a large TLS segment when generating thread-local code.
20473
20474 -mtls
20475 Do not assume a large TLS segment when generating thread-local
20476 code.
20477
20478 -mgprel-ro
20479 Enable the use of "GPREL" relocations in the FDPIC ABI for data
20480 that is known to be in read-only sections. It's enabled by
20481 default, except for -fpic or -fpie: even though it may help make
20482 the global offset table smaller, it trades 1 instruction for 4.
20483 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
20484 may be shared by multiple symbols, and it avoids the need for a GOT
20485 entry for the referenced symbol, so it's more likely to be a win.
20486 If it is not, -mno-gprel-ro can be used to disable it.
20487
20488 -multilib-library-pic
20489 Link with the (library, not FD) pic libraries. It's implied by
20490 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
20491 should never have to use it explicitly.
20492
20493 -mlinked-fp
20494 Follow the EABI requirement of always creating a frame pointer
20495 whenever a stack frame is allocated. This option is enabled by
20496 default and can be disabled with -mno-linked-fp.
20497
20498 -mlong-calls
20499 Use indirect addressing to call functions outside the current
20500 compilation unit. This allows the functions to be placed anywhere
20501 within the 32-bit address space.
20502
20503 -malign-labels
20504 Try to align labels to an 8-byte boundary by inserting NOPs into
20505 the previous packet. This option only has an effect when VLIW
20506 packing is enabled. It doesn't create new packets; it merely adds
20507 NOPs to existing ones.
20508
20509 -mlibrary-pic
20510 Generate position-independent EABI code.
20511
20512 -macc-4
20513 Use only the first four media accumulator registers.
20514
20515 -macc-8
20516 Use all eight media accumulator registers.
20517
20518 -mpack
20519 Pack VLIW instructions.
20520
20521 -mno-pack
20522 Do not pack VLIW instructions.
20523
20524 -mno-eflags
20525 Do not mark ABI switches in e_flags.
20526
20527 -mcond-move
20528 Enable the use of conditional-move instructions (default).
20529
20530 This switch is mainly for debugging the compiler and will likely be
20531 removed in a future version.
20532
20533 -mno-cond-move
20534 Disable the use of conditional-move instructions.
20535
20536 This switch is mainly for debugging the compiler and will likely be
20537 removed in a future version.
20538
20539 -mscc
20540 Enable the use of conditional set instructions (default).
20541
20542 This switch is mainly for debugging the compiler and will likely be
20543 removed in a future version.
20544
20545 -mno-scc
20546 Disable the use of conditional set instructions.
20547
20548 This switch is mainly for debugging the compiler and will likely be
20549 removed in a future version.
20550
20551 -mcond-exec
20552 Enable the use of conditional execution (default).
20553
20554 This switch is mainly for debugging the compiler and will likely be
20555 removed in a future version.
20556
20557 -mno-cond-exec
20558 Disable the use of conditional execution.
20559
20560 This switch is mainly for debugging the compiler and will likely be
20561 removed in a future version.
20562
20563 -mvliw-branch
20564 Run a pass to pack branches into VLIW instructions (default).
20565
20566 This switch is mainly for debugging the compiler and will likely be
20567 removed in a future version.
20568
20569 -mno-vliw-branch
20570 Do not run a pass to pack branches into VLIW instructions.
20571
20572 This switch is mainly for debugging the compiler and will likely be
20573 removed in a future version.
20574
20575 -mmulti-cond-exec
20576 Enable optimization of "&&" and "||" in conditional execution
20577 (default).
20578
20579 This switch is mainly for debugging the compiler and will likely be
20580 removed in a future version.
20581
20582 -mno-multi-cond-exec
20583 Disable optimization of "&&" and "||" in conditional execution.
20584
20585 This switch is mainly for debugging the compiler and will likely be
20586 removed in a future version.
20587
20588 -mnested-cond-exec
20589 Enable nested conditional execution optimizations (default).
20590
20591 This switch is mainly for debugging the compiler and will likely be
20592 removed in a future version.
20593
20594 -mno-nested-cond-exec
20595 Disable nested conditional execution optimizations.
20596
20597 This switch is mainly for debugging the compiler and will likely be
20598 removed in a future version.
20599
20600 -moptimize-membar
20601 This switch removes redundant "membar" instructions from the
20602 compiler-generated code. It is enabled by default.
20603
20604 -mno-optimize-membar
20605 This switch disables the automatic removal of redundant "membar"
20606 instructions from the generated code.
20607
20608 -mtomcat-stats
20609 Cause gas to print out tomcat statistics.
20610
20611 -mcpu=cpu
20612 Select the processor type for which to generate code. Possible
20613 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
20614 and simple.
20615
20616 GNU/Linux Options
20617 These -m options are defined for GNU/Linux targets:
20618
20619 -mglibc
20620 Use the GNU C library. This is the default except on
20621 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
20622 targets.
20623
20624 -muclibc
20625 Use uClibc C library. This is the default on *-*-linux-*uclibc*
20626 targets.
20627
20628 -mmusl
20629 Use the musl C library. This is the default on *-*-linux-*musl*
20630 targets.
20631
20632 -mbionic
20633 Use Bionic C library. This is the default on *-*-linux-*android*
20634 targets.
20635
20636 -mandroid
20637 Compile code compatible with Android platform. This is the default
20638 on *-*-linux-*android* targets.
20639
20640 When compiling, this option enables -mbionic, -fPIC,
20641 -fno-exceptions and -fno-rtti by default. When linking, this
20642 option makes the GCC driver pass Android-specific options to the
20643 linker. Finally, this option causes the preprocessor macro
20644 "__ANDROID__" to be defined.
20645
20646 -tno-android-cc
20647 Disable compilation effects of -mandroid, i.e., do not enable
20648 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
20649
20650 -tno-android-ld
20651 Disable linking effects of -mandroid, i.e., pass standard Linux
20652 linking options to the linker.
20653
20654 H8/300 Options
20655 These -m options are defined for the H8/300 implementations:
20656
20657 -mrelax
20658 Shorten some address references at link time, when possible; uses
20659 the linker option -relax.
20660
20661 -mh Generate code for the H8/300H.
20662
20663 -ms Generate code for the H8S.
20664
20665 -mn Generate code for the H8S and H8/300H in the normal mode. This
20666 switch must be used either with -mh or -ms.
20667
20668 -ms2600
20669 Generate code for the H8S/2600. This switch must be used with -ms.
20670
20671 -mexr
20672 Extended registers are stored on stack before execution of function
20673 with monitor attribute. Default option is -mexr. This option is
20674 valid only for H8S targets.
20675
20676 -mno-exr
20677 Extended registers are not stored on stack before execution of
20678 function with monitor attribute. Default option is -mno-exr. This
20679 option is valid only for H8S targets.
20680
20681 -mint32
20682 Make "int" data 32 bits by default.
20683
20684 -malign-300
20685 On the H8/300H and H8S, use the same alignment rules as for the
20686 H8/300. The default for the H8/300H and H8S is to align longs and
20687 floats on 4-byte boundaries. -malign-300 causes them to be aligned
20688 on 2-byte boundaries. This option has no effect on the H8/300.
20689
20690 HPPA Options
20691 These -m options are defined for the HPPA family of computers:
20692
20693 -march=architecture-type
20694 Generate code for the specified architecture. The choices for
20695 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
20696 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
20697 system to determine the proper architecture option for your
20698 machine. Code compiled for lower numbered architectures runs on
20699 higher numbered architectures, but not the other way around.
20700
20701 -mpa-risc-1-0
20702 -mpa-risc-1-1
20703 -mpa-risc-2-0
20704 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
20705
20706 -mcaller-copies
20707 The caller copies function arguments passed by hidden reference.
20708 This option should be used with care as it is not compatible with
20709 the default 32-bit runtime. However, only aggregates larger than
20710 eight bytes are passed by hidden reference and the option provides
20711 better compatibility with OpenMP.
20712
20713 -mjump-in-delay
20714 This option is ignored and provided for compatibility purposes
20715 only.
20716
20717 -mdisable-fpregs
20718 Prevent floating-point registers from being used in any manner.
20719 This is necessary for compiling kernels that perform lazy context
20720 switching of floating-point registers. If you use this option and
20721 attempt to perform floating-point operations, the compiler aborts.
20722
20723 -mdisable-indexing
20724 Prevent the compiler from using indexing address modes. This
20725 avoids some rather obscure problems when compiling MIG generated
20726 code under MACH.
20727
20728 -mno-space-regs
20729 Generate code that assumes the target has no space registers. This
20730 allows GCC to generate faster indirect calls and use unscaled index
20731 address modes.
20732
20733 Such code is suitable for level 0 PA systems and kernels.
20734
20735 -mfast-indirect-calls
20736 Generate code that assumes calls never cross space boundaries.
20737 This allows GCC to emit code that performs faster indirect calls.
20738
20739 This option does not work in the presence of shared libraries or
20740 nested functions.
20741
20742 -mfixed-range=register-range
20743 Generate code treating the given register range as fixed registers.
20744 A fixed register is one that the register allocator cannot use.
20745 This is useful when compiling kernel code. A register range is
20746 specified as two registers separated by a dash. Multiple register
20747 ranges can be specified separated by a comma.
20748
20749 -mlong-load-store
20750 Generate 3-instruction load and store sequences as sometimes
20751 required by the HP-UX 10 linker. This is equivalent to the +k
20752 option to the HP compilers.
20753
20754 -mportable-runtime
20755 Use the portable calling conventions proposed by HP for ELF
20756 systems.
20757
20758 -mgas
20759 Enable the use of assembler directives only GAS understands.
20760
20761 -mschedule=cpu-type
20762 Schedule code according to the constraints for the machine type
20763 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
20764 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
20765 to determine the proper scheduling option for your machine. The
20766 default scheduling is 8000.
20767
20768 -mlinker-opt
20769 Enable the optimization pass in the HP-UX linker. Note this makes
20770 symbolic debugging impossible. It also triggers a bug in the HP-UX
20771 8 and HP-UX 9 linkers in which they give bogus error messages when
20772 linking some programs.
20773
20774 -msoft-float
20775 Generate output containing library calls for floating point.
20776 Warning: the requisite libraries are not available for all HPPA
20777 targets. Normally the facilities of the machine's usual C compiler
20778 are used, but this cannot be done directly in cross-compilation.
20779 You must make your own arrangements to provide suitable library
20780 functions for cross-compilation.
20781
20782 -msoft-float changes the calling convention in the output file;
20783 therefore, it is only useful if you compile all of a program with
20784 this option. In particular, you need to compile libgcc.a, the
20785 library that comes with GCC, with -msoft-float in order for this to
20786 work.
20787
20788 -msio
20789 Generate the predefine, "_SIO", for server IO. The default is
20790 -mwsio. This generates the predefines, "__hp9000s700",
20791 "__hp9000s700__" and "_WSIO", for workstation IO. These options
20792 are available under HP-UX and HI-UX.
20793
20794 -mgnu-ld
20795 Use options specific to GNU ld. This passes -shared to ld when
20796 building a shared library. It is the default when GCC is
20797 configured, explicitly or implicitly, with the GNU linker. This
20798 option does not affect which ld is called; it only changes what
20799 parameters are passed to that ld. The ld that is called is
20800 determined by the --with-ld configure option, GCC's program search
20801 path, and finally by the user's PATH. The linker used by GCC can
20802 be printed using which `gcc -print-prog-name=ld`. This option is
20803 only available on the 64-bit HP-UX GCC, i.e. configured with
20804 hppa*64*-*-hpux*.
20805
20806 -mhp-ld
20807 Use options specific to HP ld. This passes -b to ld when building
20808 a shared library and passes +Accept TypeMismatch to ld on all
20809 links. It is the default when GCC is configured, explicitly or
20810 implicitly, with the HP linker. This option does not affect which
20811 ld is called; it only changes what parameters are passed to that
20812 ld. The ld that is called is determined by the --with-ld configure
20813 option, GCC's program search path, and finally by the user's PATH.
20814 The linker used by GCC can be printed using which `gcc
20815 -print-prog-name=ld`. This option is only available on the 64-bit
20816 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
20817
20818 -mlong-calls
20819 Generate code that uses long call sequences. This ensures that a
20820 call is always able to reach linker generated stubs. The default
20821 is to generate long calls only when the distance from the call site
20822 to the beginning of the function or translation unit, as the case
20823 may be, exceeds a predefined limit set by the branch type being
20824 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
20825 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
20826 always limited at 240,000 bytes.
20827
20828 Distances are measured from the beginning of functions when using
20829 the -ffunction-sections option, or when using the -mgas and
20830 -mno-portable-runtime options together under HP-UX with the SOM
20831 linker.
20832
20833 It is normally not desirable to use this option as it degrades
20834 performance. However, it may be useful in large applications,
20835 particularly when partial linking is used to build the application.
20836
20837 The types of long calls used depends on the capabilities of the
20838 assembler and linker, and the type of code being generated. The
20839 impact on systems that support long absolute calls, and long pic
20840 symbol-difference or pc-relative calls should be relatively small.
20841 However, an indirect call is used on 32-bit ELF systems in pic code
20842 and it is quite long.
20843
20844 -munix=unix-std
20845 Generate compiler predefines and select a startfile for the
20846 specified UNIX standard. The choices for unix-std are 93, 95 and
20847 98. 93 is supported on all HP-UX versions. 95 is available on HP-
20848 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
20849 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
20850 11.00, and 98 for HP-UX 11.11 and later.
20851
20852 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
20853 -munix=95 provides additional predefines for "XOPEN_UNIX" and
20854 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
20855 provides additional predefines for "_XOPEN_UNIX",
20856 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
20857 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
20858
20859 It is important to note that this option changes the interfaces for
20860 various library routines. It also affects the operational behavior
20861 of the C library. Thus, extreme care is needed in using this
20862 option.
20863
20864 Library code that is intended to operate with more than one UNIX
20865 standard must test, set and restore the variable
20866 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
20867 provide this capability.
20868
20869 -nolibdld
20870 Suppress the generation of link options to search libdld.sl when
20871 the -static option is specified on HP-UX 10 and later.
20872
20873 -static
20874 The HP-UX implementation of setlocale in libc has a dependency on
20875 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20876 when the -static option is specified, special link options are
20877 needed to resolve this dependency.
20878
20879 On HP-UX 10 and later, the GCC driver adds the necessary options to
20880 link with libdld.sl when the -static option is specified. This
20881 causes the resulting binary to be dynamic. On the 64-bit port, the
20882 linkers generate dynamic binaries by default in any case. The
20883 -nolibdld option can be used to prevent the GCC driver from adding
20884 these link options.
20885
20886 -threads
20887 Add support for multithreading with the dce thread library under
20888 HP-UX. This option sets flags for both the preprocessor and
20889 linker.
20890
20891 IA-64 Options
20892 These are the -m options defined for the Intel IA-64 architecture.
20893
20894 -mbig-endian
20895 Generate code for a big-endian target. This is the default for HP-
20896 UX.
20897
20898 -mlittle-endian
20899 Generate code for a little-endian target. This is the default for
20900 AIX5 and GNU/Linux.
20901
20902 -mgnu-as
20903 -mno-gnu-as
20904 Generate (or don't) code for the GNU assembler. This is the
20905 default.
20906
20907 -mgnu-ld
20908 -mno-gnu-ld
20909 Generate (or don't) code for the GNU linker. This is the default.
20910
20911 -mno-pic
20912 Generate code that does not use a global pointer register. The
20913 result is not position independent code, and violates the IA-64
20914 ABI.
20915
20916 -mvolatile-asm-stop
20917 -mno-volatile-asm-stop
20918 Generate (or don't) a stop bit immediately before and after
20919 volatile asm statements.
20920
20921 -mregister-names
20922 -mno-register-names
20923 Generate (or don't) in, loc, and out register names for the stacked
20924 registers. This may make assembler output more readable.
20925
20926 -mno-sdata
20927 -msdata
20928 Disable (or enable) optimizations that use the small data section.
20929 This may be useful for working around optimizer bugs.
20930
20931 -mconstant-gp
20932 Generate code that uses a single constant global pointer value.
20933 This is useful when compiling kernel code.
20934
20935 -mauto-pic
20936 Generate code that is self-relocatable. This implies
20937 -mconstant-gp. This is useful when compiling firmware code.
20938
20939 -minline-float-divide-min-latency
20940 Generate code for inline divides of floating-point values using the
20941 minimum latency algorithm.
20942
20943 -minline-float-divide-max-throughput
20944 Generate code for inline divides of floating-point values using the
20945 maximum throughput algorithm.
20946
20947 -mno-inline-float-divide
20948 Do not generate inline code for divides of floating-point values.
20949
20950 -minline-int-divide-min-latency
20951 Generate code for inline divides of integer values using the
20952 minimum latency algorithm.
20953
20954 -minline-int-divide-max-throughput
20955 Generate code for inline divides of integer values using the
20956 maximum throughput algorithm.
20957
20958 -mno-inline-int-divide
20959 Do not generate inline code for divides of integer values.
20960
20961 -minline-sqrt-min-latency
20962 Generate code for inline square roots using the minimum latency
20963 algorithm.
20964
20965 -minline-sqrt-max-throughput
20966 Generate code for inline square roots using the maximum throughput
20967 algorithm.
20968
20969 -mno-inline-sqrt
20970 Do not generate inline code for "sqrt".
20971
20972 -mfused-madd
20973 -mno-fused-madd
20974 Do (don't) generate code that uses the fused multiply/add or
20975 multiply/subtract instructions. The default is to use these
20976 instructions.
20977
20978 -mno-dwarf2-asm
20979 -mdwarf2-asm
20980 Don't (or do) generate assembler code for the DWARF line number
20981 debugging info. This may be useful when not using the GNU
20982 assembler.
20983
20984 -mearly-stop-bits
20985 -mno-early-stop-bits
20986 Allow stop bits to be placed earlier than immediately preceding the
20987 instruction that triggered the stop bit. This can improve
20988 instruction scheduling, but does not always do so.
20989
20990 -mfixed-range=register-range
20991 Generate code treating the given register range as fixed registers.
20992 A fixed register is one that the register allocator cannot use.
20993 This is useful when compiling kernel code. A register range is
20994 specified as two registers separated by a dash. Multiple register
20995 ranges can be specified separated by a comma.
20996
20997 -mtls-size=tls-size
20998 Specify bit size of immediate TLS offsets. Valid values are 14,
20999 22, and 64.
21000
21001 -mtune=cpu-type
21002 Tune the instruction scheduling for a particular CPU, Valid values
21003 are itanium, itanium1, merced, itanium2, and mckinley.
21004
21005 -milp32
21006 -mlp64
21007 Generate code for a 32-bit or 64-bit environment. The 32-bit
21008 environment sets int, long and pointer to 32 bits. The 64-bit
21009 environment sets int to 32 bits and long and pointer to 64 bits.
21010 These are HP-UX specific flags.
21011
21012 -mno-sched-br-data-spec
21013 -msched-br-data-spec
21014 (Dis/En)able data speculative scheduling before reload. This
21015 results in generation of "ld.a" instructions and the corresponding
21016 check instructions ("ld.c" / "chk.a"). The default setting is
21017 disabled.
21018
21019 -msched-ar-data-spec
21020 -mno-sched-ar-data-spec
21021 (En/Dis)able data speculative scheduling after reload. This
21022 results in generation of "ld.a" instructions and the corresponding
21023 check instructions ("ld.c" / "chk.a"). The default setting is
21024 enabled.
21025
21026 -mno-sched-control-spec
21027 -msched-control-spec
21028 (Dis/En)able control speculative scheduling. This feature is
21029 available only during region scheduling (i.e. before reload). This
21030 results in generation of the "ld.s" instructions and the
21031 corresponding check instructions "chk.s". The default setting is
21032 disabled.
21033
21034 -msched-br-in-data-spec
21035 -mno-sched-br-in-data-spec
21036 (En/Dis)able speculative scheduling of the instructions that are
21037 dependent on the data speculative loads before reload. This is
21038 effective only with -msched-br-data-spec enabled. The default
21039 setting is enabled.
21040
21041 -msched-ar-in-data-spec
21042 -mno-sched-ar-in-data-spec
21043 (En/Dis)able speculative scheduling of the instructions that are
21044 dependent on the data speculative loads after reload. This is
21045 effective only with -msched-ar-data-spec enabled. The default
21046 setting is enabled.
21047
21048 -msched-in-control-spec
21049 -mno-sched-in-control-spec
21050 (En/Dis)able speculative scheduling of the instructions that are
21051 dependent on the control speculative loads. This is effective only
21052 with -msched-control-spec enabled. The default setting is enabled.
21053
21054 -mno-sched-prefer-non-data-spec-insns
21055 -msched-prefer-non-data-spec-insns
21056 If enabled, data-speculative instructions are chosen for schedule
21057 only if there are no other choices at the moment. This makes the
21058 use of the data speculation much more conservative. The default
21059 setting is disabled.
21060
21061 -mno-sched-prefer-non-control-spec-insns
21062 -msched-prefer-non-control-spec-insns
21063 If enabled, control-speculative instructions are chosen for
21064 schedule only if there are no other choices at the moment. This
21065 makes the use of the control speculation much more conservative.
21066 The default setting is disabled.
21067
21068 -mno-sched-count-spec-in-critical-path
21069 -msched-count-spec-in-critical-path
21070 If enabled, speculative dependencies are considered during
21071 computation of the instructions priorities. This makes the use of
21072 the speculation a bit more conservative. The default setting is
21073 disabled.
21074
21075 -msched-spec-ldc
21076 Use a simple data speculation check. This option is on by default.
21077
21078 -msched-control-spec-ldc
21079 Use a simple check for control speculation. This option is on by
21080 default.
21081
21082 -msched-stop-bits-after-every-cycle
21083 Place a stop bit after every cycle when scheduling. This option is
21084 on by default.
21085
21086 -msched-fp-mem-deps-zero-cost
21087 Assume that floating-point stores and loads are not likely to cause
21088 a conflict when placed into the same instruction group. This
21089 option is disabled by default.
21090
21091 -msel-sched-dont-check-control-spec
21092 Generate checks for control speculation in selective scheduling.
21093 This flag is disabled by default.
21094
21095 -msched-max-memory-insns=max-insns
21096 Limit on the number of memory insns per instruction group, giving
21097 lower priority to subsequent memory insns attempting to schedule in
21098 the same instruction group. Frequently useful to prevent cache bank
21099 conflicts. The default value is 1.
21100
21101 -msched-max-memory-insns-hard-limit
21102 Makes the limit specified by msched-max-memory-insns a hard limit,
21103 disallowing more than that number in an instruction group.
21104 Otherwise, the limit is "soft", meaning that non-memory operations
21105 are preferred when the limit is reached, but memory operations may
21106 still be scheduled.
21107
21108 LM32 Options
21109 These -m options are defined for the LatticeMico32 architecture:
21110
21111 -mbarrel-shift-enabled
21112 Enable barrel-shift instructions.
21113
21114 -mdivide-enabled
21115 Enable divide and modulus instructions.
21116
21117 -mmultiply-enabled
21118 Enable multiply instructions.
21119
21120 -msign-extend-enabled
21121 Enable sign extend instructions.
21122
21123 -muser-enabled
21124 Enable user-defined instructions.
21125
21126 LoongArch Options
21127 These command-line options are defined for LoongArch targets:
21128
21129 -march=cpu-type
21130 Generate instructions for the machine type cpu-type. In contrast
21131 to -mtune=cpu-type, which merely tunes the generated code for the
21132 specified cpu-type, -march=cpu-type allows GCC to generate code
21133 that may not run at all on processors other than the one indicated.
21134 Specifying -march=cpu-type implies -mtune=cpu-type, except where
21135 noted otherwise.
21136
21137 The choices for cpu-type are:
21138
21139 native
21140 This selects the CPU to generate code for at compilation time
21141 by determining the processor type of the compiling machine.
21142 Using -march=native enables all instruction subsets supported
21143 by the local machine (hence the result might not run on
21144 different machines). Using -mtune=native produces code
21145 optimized for the local machine under the constraints of the
21146 selected instruction set.
21147
21148 loongarch64
21149 A generic CPU with 64-bit extensions.
21150
21151 la464
21152 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
21153
21154 -mtune=cpu-type
21155 Optimize the output for the given processor, specified by
21156 microarchitecture name.
21157
21158 -mabi=base-abi-type
21159 Generate code for the specified calling convention. base-abi-type
21160 can be one of:
21161
21162 lp64d
21163 Uses 64-bit general purpose registers and 32/64-bit floating-
21164 point registers for parameter passing. Data model is LP64,
21165 where int is 32 bits, while long int and pointers are 64 bits.
21166
21167 lp64f
21168 Uses 64-bit general purpose registers and 32-bit floating-point
21169 registers for parameter passing. Data model is LP64, where int
21170 is 32 bits, while long int and pointers are 64 bits.
21171
21172 lp64s
21173 Uses 64-bit general purpose registers and no floating-point
21174 registers for parameter passing. Data model is LP64, where int
21175 is 32 bits, while long int and pointers are 64 bits.
21176
21177 -mfpu=fpu-type
21178 Generate code for the specified FPU type, which can be one of:
21179
21180 64 Allow the use of hardware floating-point instructions for
21181 32-bit and 64-bit operations.
21182
21183 32 Allow the use of hardware floating-point instructions for
21184 32-bit operations.
21185
21186 none
21187 0 Prevent the use of hardware floating-point instructions.
21188
21189 -msoft-float
21190 Force -mfpu=none and prevents the use of floating-point registers
21191 for parameter passing. This option may change the target ABI.
21192
21193 -msingle-float
21194 Force -mfpu=32 and allow the use of 32-bit floating-point registers
21195 for parameter passing. This option may change the target ABI.
21196
21197 -mdouble-float
21198 Force -mfpu=64 and allow the use of 32/64-bit floating-point
21199 registers for parameter passing. This option may change the target
21200 ABI.
21201
21202 -mbranch-cost=n
21203 Set the cost of branches to roughly n instructions.
21204
21205 -mcheck-zero-division
21206 -mno-check-zero-divison
21207 Trap (do not trap) on integer division by zero. The default is
21208 -mcheck-zero-division.
21209
21210 -mcond-move-int
21211 -mno-cond-move-int
21212 Conditional moves for integral data in general-purpose registers
21213 are enabled (disabled). The default is -mcond-move-int.
21214
21215 -mcond-move-float
21216 -mno-cond-move-float
21217 Conditional moves for floating-point registers are enabled
21218 (disabled). The default is -mcond-move-float.
21219
21220 -mmemcpy
21221 -mno-memcpy
21222 Force (do not force) the use of "memcpy" for non-trivial block
21223 moves. The default is -mno-memcpy, which allows GCC to inline most
21224 constant-sized copies. Setting optimization level to -Os also
21225 forces the use of "memcpy", but -mno-memcpy may override this
21226 behavior if explicitly specified, regardless of the order these
21227 options on the command line.
21228
21229 -mstrict-align
21230 -mno-strict-align
21231 Avoid or allow generating memory accesses that may not be aligned
21232 on a natural object boundary as described in the architecture
21233 specification. The default is -mno-strict-align.
21234
21235 -msmall-data-limit=number
21236 Put global and static data smaller than number bytes into a special
21237 section (on some targets). The default value is 0.
21238
21239 -mmax-inline-memcpy-size=n
21240 Inline all block moves (such as calls to "memcpy" or structure
21241 copies) less than or equal to n bytes. The default value of n is
21242 1024.
21243
21244 -mcmodel=code-model
21245 Set the code model to one of:
21246
21247 tiny-static
21248 * local symbol and global strong symbol: The data section
21249 must be within +/-2MiB addressing space. The text section
21250 must be within +/-128MiB addressing space.
21251
21252 * global weak symbol: The got table must be within +/-2GiB
21253 addressing space.
21254
21255 tiny
21256 * local symbol: The data section must be within +/-2MiB
21257 addressing space. The text section must be within
21258 +/-128MiB addressing space.
21259
21260 * global symbol: The got table must be within +/-2GiB
21261 addressing space.
21262
21263 normal
21264 * local symbol: The data section must be within +/-2GiB
21265 addressing space. The text section must be within
21266 +/-128MiB addressing space.
21267
21268 * global symbol: The got table must be within +/-2GiB
21269 addressing space.
21270
21271 large
21272 * local symbol: The data section must be within +/-2GiB
21273 addressing space. The text section must be within
21274 +/-128GiB addressing space.
21275
21276 * global symbol: The got table must be within +/-2GiB
21277 addressing space.
21278
21279 extreme(Not implemented yet)
21280 * local symbol: The data and text section must be within
21281 +/-8EiB addressing space.
21282
21283 * global symbol: The data got table must be within +/-8EiB
21284 addressing space.
21285
21286 The default code model is "normal".
21287
21288 M32C Options
21289 -mcpu=name
21290 Select the CPU for which code is generated. name may be one of r8c
21291 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
21292 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
21293
21294 -msim
21295 Specifies that the program will be run on the simulator. This
21296 causes an alternate runtime library to be linked in which supports,
21297 for example, file I/O. You must not use this option when
21298 generating programs that will run on real hardware; you must
21299 provide your own runtime library for whatever I/O functions are
21300 needed.
21301
21302 -memregs=number
21303 Specifies the number of memory-based pseudo-registers GCC uses
21304 during code generation. These pseudo-registers are used like real
21305 registers, so there is a tradeoff between GCC's ability to fit the
21306 code into available registers, and the performance penalty of using
21307 memory instead of registers. Note that all modules in a program
21308 must be compiled with the same value for this option. Because of
21309 that, you must not use this option with GCC's default runtime
21310 libraries.
21311
21312 M32R/D Options
21313 These -m options are defined for Renesas M32R/D architectures:
21314
21315 -m32r2
21316 Generate code for the M32R/2.
21317
21318 -m32rx
21319 Generate code for the M32R/X.
21320
21321 -m32r
21322 Generate code for the M32R. This is the default.
21323
21324 -mmodel=small
21325 Assume all objects live in the lower 16MB of memory (so that their
21326 addresses can be loaded with the "ld24" instruction), and assume
21327 all subroutines are reachable with the "bl" instruction. This is
21328 the default.
21329
21330 The addressability of a particular object can be set with the
21331 "model" attribute.
21332
21333 -mmodel=medium
21334 Assume objects may be anywhere in the 32-bit address space (the
21335 compiler generates "seth/add3" instructions to load their
21336 addresses), and assume all subroutines are reachable with the "bl"
21337 instruction.
21338
21339 -mmodel=large
21340 Assume objects may be anywhere in the 32-bit address space (the
21341 compiler generates "seth/add3" instructions to load their
21342 addresses), and assume subroutines may not be reachable with the
21343 "bl" instruction (the compiler generates the much slower
21344 "seth/add3/jl" instruction sequence).
21345
21346 -msdata=none
21347 Disable use of the small data area. Variables are put into one of
21348 ".data", ".bss", or ".rodata" (unless the "section" attribute has
21349 been specified). This is the default.
21350
21351 The small data area consists of sections ".sdata" and ".sbss".
21352 Objects may be explicitly put in the small data area with the
21353 "section" attribute using one of these sections.
21354
21355 -msdata=sdata
21356 Put small global and static data in the small data area, but do not
21357 generate special code to reference them.
21358
21359 -msdata=use
21360 Put small global and static data in the small data area, and
21361 generate special instructions to reference them.
21362
21363 -G num
21364 Put global and static objects less than or equal to num bytes into
21365 the small data or BSS sections instead of the normal data or BSS
21366 sections. The default value of num is 8. The -msdata option must
21367 be set to one of sdata or use for this option to have any effect.
21368
21369 All modules should be compiled with the same -G num value.
21370 Compiling with different values of num may or may not work; if it
21371 doesn't the linker gives an error message---incorrect code is not
21372 generated.
21373
21374 -mdebug
21375 Makes the M32R-specific code in the compiler display some
21376 statistics that might help in debugging programs.
21377
21378 -malign-loops
21379 Align all loops to a 32-byte boundary.
21380
21381 -mno-align-loops
21382 Do not enforce a 32-byte alignment for loops. This is the default.
21383
21384 -missue-rate=number
21385 Issue number instructions per cycle. number can only be 1 or 2.
21386
21387 -mbranch-cost=number
21388 number can only be 1 or 2. If it is 1 then branches are preferred
21389 over conditional code, if it is 2, then the opposite applies.
21390
21391 -mflush-trap=number
21392 Specifies the trap number to use to flush the cache. The default
21393 is 12. Valid numbers are between 0 and 15 inclusive.
21394
21395 -mno-flush-trap
21396 Specifies that the cache cannot be flushed by using a trap.
21397
21398 -mflush-func=name
21399 Specifies the name of the operating system function to call to
21400 flush the cache. The default is _flush_cache, but a function call
21401 is only used if a trap is not available.
21402
21403 -mno-flush-func
21404 Indicates that there is no OS function for flushing the cache.
21405
21406 M680x0 Options
21407 These are the -m options defined for M680x0 and ColdFire processors.
21408 The default settings depend on which architecture was selected when the
21409 compiler was configured; the defaults for the most common choices are
21410 given below.
21411
21412 -march=arch
21413 Generate code for a specific M680x0 or ColdFire instruction set
21414 architecture. Permissible values of arch for M680x0 architectures
21415 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
21416 architectures are selected according to Freescale's ISA
21417 classification and the permissible values are: isaa, isaaplus, isab
21418 and isac.
21419
21420 GCC defines a macro "__mcfarch__" whenever it is generating code
21421 for a ColdFire target. The arch in this macro is one of the -march
21422 arguments given above.
21423
21424 When used together, -march and -mtune select code that runs on a
21425 family of similar processors but that is optimized for a particular
21426 microarchitecture.
21427
21428 -mcpu=cpu
21429 Generate code for a specific M680x0 or ColdFire processor. The
21430 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
21431 68332 and cpu32. The ColdFire cpus are given by the table below,
21432 which also classifies the CPUs into families:
21433
21434 Family : -mcpu arguments
21435 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
21436 5206 : 5202 5204 5206
21437 5206e : 5206e
21438 5208 : 5207 5208
21439 5211a : 5210a 5211a
21440 5213 : 5211 5212 5213
21441 5216 : 5214 5216
21442 52235 : 52230 52231 52232 52233 52234 52235
21443 5225 : 5224 5225
21444 52259 : 52252 52254 52255 52256 52258 52259
21445 5235 : 5232 5233 5234 5235 523x
21446 5249 : 5249
21447 5250 : 5250
21448 5271 : 5270 5271
21449 5272 : 5272
21450 5275 : 5274 5275
21451 5282 : 5280 5281 5282 528x
21452 53017 : 53011 53012 53013 53014 53015 53016 53017
21453 5307 : 5307
21454 5329 : 5327 5328 5329 532x
21455 5373 : 5372 5373 537x
21456 5407 : 5407
21457 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
21458 5485
21459
21460 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
21461 Other combinations of -mcpu and -march are rejected.
21462
21463 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
21464 selected. It also defines "__mcf_family_family", where the value
21465 of family is given by the table above.
21466
21467 -mtune=tune
21468 Tune the code for a particular microarchitecture within the
21469 constraints set by -march and -mcpu. The M680x0 microarchitectures
21470 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
21471 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
21472
21473 You can also use -mtune=68020-40 for code that needs to run
21474 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
21475 is similar but includes 68060 targets as well. These two options
21476 select the same tuning decisions as -m68020-40 and -m68020-60
21477 respectively.
21478
21479 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
21480 680x0 architecture arch. It also defines "mcarch" unless either
21481 -ansi or a non-GNU -std option is used. If GCC is tuning for a
21482 range of architectures, as selected by -mtune=68020-40 or
21483 -mtune=68020-60, it defines the macros for every architecture in
21484 the range.
21485
21486 GCC also defines the macro "__muarch__" when tuning for ColdFire
21487 microarchitecture uarch, where uarch is one of the arguments given
21488 above.
21489
21490 -m68000
21491 -mc68000
21492 Generate output for a 68000. This is the default when the compiler
21493 is configured for 68000-based systems. It is equivalent to
21494 -march=68000.
21495
21496 Use this option for microcontrollers with a 68000 or EC000 core,
21497 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21498
21499 -m68010
21500 Generate output for a 68010. This is the default when the compiler
21501 is configured for 68010-based systems. It is equivalent to
21502 -march=68010.
21503
21504 -m68020
21505 -mc68020
21506 Generate output for a 68020. This is the default when the compiler
21507 is configured for 68020-based systems. It is equivalent to
21508 -march=68020.
21509
21510 -m68030
21511 Generate output for a 68030. This is the default when the compiler
21512 is configured for 68030-based systems. It is equivalent to
21513 -march=68030.
21514
21515 -m68040
21516 Generate output for a 68040. This is the default when the compiler
21517 is configured for 68040-based systems. It is equivalent to
21518 -march=68040.
21519
21520 This option inhibits the use of 68881/68882 instructions that have
21521 to be emulated by software on the 68040. Use this option if your
21522 68040 does not have code to emulate those instructions.
21523
21524 -m68060
21525 Generate output for a 68060. This is the default when the compiler
21526 is configured for 68060-based systems. It is equivalent to
21527 -march=68060.
21528
21529 This option inhibits the use of 68020 and 68881/68882 instructions
21530 that have to be emulated by software on the 68060. Use this option
21531 if your 68060 does not have code to emulate those instructions.
21532
21533 -mcpu32
21534 Generate output for a CPU32. This is the default when the compiler
21535 is configured for CPU32-based systems. It is equivalent to
21536 -march=cpu32.
21537
21538 Use this option for microcontrollers with a CPU32 or CPU32+ core,
21539 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
21540 68341, 68349 and 68360.
21541
21542 -m5200
21543 Generate output for a 520X ColdFire CPU. This is the default when
21544 the compiler is configured for 520X-based systems. It is
21545 equivalent to -mcpu=5206, and is now deprecated in favor of that
21546 option.
21547
21548 Use this option for microcontroller with a 5200 core, including the
21549 MCF5202, MCF5203, MCF5204 and MCF5206.
21550
21551 -m5206e
21552 Generate output for a 5206e ColdFire CPU. The option is now
21553 deprecated in favor of the equivalent -mcpu=5206e.
21554
21555 -m528x
21556 Generate output for a member of the ColdFire 528X family. The
21557 option is now deprecated in favor of the equivalent -mcpu=528x.
21558
21559 -m5307
21560 Generate output for a ColdFire 5307 CPU. The option is now
21561 deprecated in favor of the equivalent -mcpu=5307.
21562
21563 -m5407
21564 Generate output for a ColdFire 5407 CPU. The option is now
21565 deprecated in favor of the equivalent -mcpu=5407.
21566
21567 -mcfv4e
21568 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
21569 This includes use of hardware floating-point instructions. The
21570 option is equivalent to -mcpu=547x, and is now deprecated in favor
21571 of that option.
21572
21573 -m68020-40
21574 Generate output for a 68040, without using any of the new
21575 instructions. This results in code that can run relatively
21576 efficiently on either a 68020/68881 or a 68030 or a 68040. The
21577 generated code does use the 68881 instructions that are emulated on
21578 the 68040.
21579
21580 The option is equivalent to -march=68020 -mtune=68020-40.
21581
21582 -m68020-60
21583 Generate output for a 68060, without using any of the new
21584 instructions. This results in code that can run relatively
21585 efficiently on either a 68020/68881 or a 68030 or a 68040. The
21586 generated code does use the 68881 instructions that are emulated on
21587 the 68060.
21588
21589 The option is equivalent to -march=68020 -mtune=68020-60.
21590
21591 -mhard-float
21592 -m68881
21593 Generate floating-point instructions. This is the default for
21594 68020 and above, and for ColdFire devices that have an FPU. It
21595 defines the macro "__HAVE_68881__" on M680x0 targets and
21596 "__mcffpu__" on ColdFire targets.
21597
21598 -msoft-float
21599 Do not generate floating-point instructions; use library calls
21600 instead. This is the default for 68000, 68010, and 68832 targets.
21601 It is also the default for ColdFire devices that have no FPU.
21602
21603 -mdiv
21604 -mno-div
21605 Generate (do not generate) ColdFire hardware divide and remainder
21606 instructions. If -march is used without -mcpu, the default is "on"
21607 for ColdFire architectures and "off" for M680x0 architectures.
21608 Otherwise, the default is taken from the target CPU (either the
21609 default CPU, or the one specified by -mcpu). For example, the
21610 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
21611
21612 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
21613
21614 -mshort
21615 Consider type "int" to be 16 bits wide, like "short int".
21616 Additionally, parameters passed on the stack are also aligned to a
21617 16-bit boundary even on targets whose API mandates promotion to
21618 32-bit.
21619
21620 -mno-short
21621 Do not consider type "int" to be 16 bits wide. This is the
21622 default.
21623
21624 -mnobitfield
21625 -mno-bitfield
21626 Do not use the bit-field instructions. The -m68000, -mcpu32 and
21627 -m5200 options imply -mnobitfield.
21628
21629 -mbitfield
21630 Do use the bit-field instructions. The -m68020 option implies
21631 -mbitfield. This is the default if you use a configuration
21632 designed for a 68020.
21633
21634 -mrtd
21635 Use a different function-calling convention, in which functions
21636 that take a fixed number of arguments return with the "rtd"
21637 instruction, which pops their arguments while returning. This
21638 saves one instruction in the caller since there is no need to pop
21639 the arguments there.
21640
21641 This calling convention is incompatible with the one normally used
21642 on Unix, so you cannot use it if you need to call libraries
21643 compiled with the Unix compiler.
21644
21645 Also, you must provide function prototypes for all functions that
21646 take variable numbers of arguments (including "printf"); otherwise
21647 incorrect code is generated for calls to those functions.
21648
21649 In addition, seriously incorrect code results if you call a
21650 function with too many arguments. (Normally, extra arguments are
21651 harmlessly ignored.)
21652
21653 The "rtd" instruction is supported by the 68010, 68020, 68030,
21654 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21655
21656 The default is -mno-rtd.
21657
21658 -malign-int
21659 -mno-align-int
21660 Control whether GCC aligns "int", "long", "long long", "float",
21661 "double", and "long double" variables on a 32-bit boundary
21662 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
21663 variables on 32-bit boundaries produces code that runs somewhat
21664 faster on processors with 32-bit busses at the expense of more
21665 memory.
21666
21667 Warning: if you use the -malign-int switch, GCC aligns structures
21668 containing the above types differently than most published
21669 application binary interface specifications for the m68k.
21670
21671 Use the pc-relative addressing mode of the 68000 directly, instead
21672 of using a global offset table. At present, this option implies
21673 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
21674 -fPIC is not presently supported with -mpcrel, though this could be
21675 supported for 68020 and higher processors.
21676
21677 -mno-strict-align
21678 -mstrict-align
21679 Do not (do) assume that unaligned memory references are handled by
21680 the system.
21681
21682 -msep-data
21683 Generate code that allows the data segment to be located in a
21684 different area of memory from the text segment. This allows for
21685 execute-in-place in an environment without virtual memory
21686 management. This option implies -fPIC.
21687
21688 -mno-sep-data
21689 Generate code that assumes that the data segment follows the text
21690 segment. This is the default.
21691
21692 -mid-shared-library
21693 Generate code that supports shared libraries via the library ID
21694 method. This allows for execute-in-place and shared libraries in
21695 an environment without virtual memory management. This option
21696 implies -fPIC.
21697
21698 -mno-id-shared-library
21699 Generate code that doesn't assume ID-based shared libraries are
21700 being used. This is the default.
21701
21702 -mshared-library-id=n
21703 Specifies the identification number of the ID-based shared library
21704 being compiled. Specifying a value of 0 generates more compact
21705 code; specifying other values forces the allocation of that number
21706 to the current library, but is no more space- or time-efficient
21707 than omitting this option.
21708
21709 -mxgot
21710 -mno-xgot
21711 When generating position-independent code for ColdFire, generate
21712 code that works if the GOT has more than 8192 entries. This code
21713 is larger and slower than code generated without this option. On
21714 M680x0 processors, this option is not needed; -fPIC suffices.
21715
21716 GCC normally uses a single instruction to load values from the GOT.
21717 While this is relatively efficient, it only works if the GOT is
21718 smaller than about 64k. Anything larger causes the linker to
21719 report an error such as:
21720
21721 relocation truncated to fit: R_68K_GOT16O foobar
21722
21723 If this happens, you should recompile your code with -mxgot. It
21724 should then work with very large GOTs. However, code generated
21725 with -mxgot is less efficient, since it takes 4 instructions to
21726 fetch the value of a global symbol.
21727
21728 Note that some linkers, including newer versions of the GNU linker,
21729 can create multiple GOTs and sort GOT entries. If you have such a
21730 linker, you should only need to use -mxgot when compiling a single
21731 object file that accesses more than 8192 GOT entries. Very few do.
21732
21733 These options have no effect unless GCC is generating position-
21734 independent code.
21735
21736 -mlong-jump-table-offsets
21737 Use 32-bit offsets in "switch" tables. The default is to use
21738 16-bit offsets.
21739
21740 MCore Options
21741 These are the -m options defined for the Motorola M*Core processors.
21742
21743 -mhardlit
21744 -mno-hardlit
21745 Inline constants into the code stream if it can be done in two
21746 instructions or less.
21747
21748 -mdiv
21749 -mno-div
21750 Use the divide instruction. (Enabled by default).
21751
21752 -mrelax-immediate
21753 -mno-relax-immediate
21754 Allow arbitrary-sized immediates in bit operations.
21755
21756 -mwide-bitfields
21757 -mno-wide-bitfields
21758 Always treat bit-fields as "int"-sized.
21759
21760 -m4byte-functions
21761 -mno-4byte-functions
21762 Force all functions to be aligned to a 4-byte boundary.
21763
21764 -mcallgraph-data
21765 -mno-callgraph-data
21766 Emit callgraph information.
21767
21768 -mslow-bytes
21769 -mno-slow-bytes
21770 Prefer word access when reading byte quantities.
21771
21772 -mlittle-endian
21773 -mbig-endian
21774 Generate code for a little-endian target.
21775
21776 -m210
21777 -m340
21778 Generate code for the 210 processor.
21779
21780 -mno-lsim
21781 Assume that runtime support has been provided and so omit the
21782 simulator library (libsim.a) from the linker command line.
21783
21784 -mstack-increment=size
21785 Set the maximum amount for a single stack increment operation.
21786 Large values can increase the speed of programs that contain
21787 functions that need a large amount of stack space, but they can
21788 also trigger a segmentation fault if the stack is extended too
21789 much. The default value is 0x1000.
21790
21791 MeP Options
21792 -mabsdiff
21793 Enables the "abs" instruction, which is the absolute difference
21794 between two registers.
21795
21796 -mall-opts
21797 Enables all the optional instructions---average, multiply, divide,
21798 bit operations, leading zero, absolute difference, min/max, clip,
21799 and saturation.
21800
21801 -maverage
21802 Enables the "ave" instruction, which computes the average of two
21803 registers.
21804
21805 -mbased=n
21806 Variables of size n bytes or smaller are placed in the ".based"
21807 section by default. Based variables use the $tp register as a base
21808 register, and there is a 128-byte limit to the ".based" section.
21809
21810 -mbitops
21811 Enables the bit operation instructions---bit test ("btstm"), set
21812 ("bsetm"), clear ("bclrm"), invert ("bnotm"), and test-and-set
21813 ("tas").
21814
21815 -mc=name
21816 Selects which section constant data is placed in. name may be
21817 tiny, near, or far.
21818
21819 -mclip
21820 Enables the "clip" instruction. Note that -mclip is not useful
21821 unless you also provide -mminmax.
21822
21823 -mconfig=name
21824 Selects one of the built-in core configurations. Each MeP chip has
21825 one or more modules in it; each module has a core CPU and a variety
21826 of coprocessors, optional instructions, and peripherals. The
21827 "MeP-Integrator" tool, not part of GCC, provides these
21828 configurations through this option; using this option is the same
21829 as using all the corresponding command-line options. The default
21830 configuration is default.
21831
21832 -mcop
21833 Enables the coprocessor instructions. By default, this is a 32-bit
21834 coprocessor. Note that the coprocessor is normally enabled via the
21835 -mconfig= option.
21836
21837 -mcop32
21838 Enables the 32-bit coprocessor's instructions.
21839
21840 -mcop64
21841 Enables the 64-bit coprocessor's instructions.
21842
21843 -mivc2
21844 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21845
21846 -mdc
21847 Causes constant variables to be placed in the ".near" section.
21848
21849 -mdiv
21850 Enables the "div" and "divu" instructions.
21851
21852 -meb
21853 Generate big-endian code.
21854
21855 -mel
21856 Generate little-endian code.
21857
21858 -mio-volatile
21859 Tells the compiler that any variable marked with the "io" attribute
21860 is to be considered volatile.
21861
21862 -ml Causes variables to be assigned to the ".far" section by default.
21863
21864 -mleadz
21865 Enables the "leadz" (leading zero) instruction.
21866
21867 -mm Causes variables to be assigned to the ".near" section by default.
21868
21869 -mminmax
21870 Enables the "min" and "max" instructions.
21871
21872 -mmult
21873 Enables the multiplication and multiply-accumulate instructions.
21874
21875 -mno-opts
21876 Disables all the optional instructions enabled by -mall-opts.
21877
21878 -mrepeat
21879 Enables the "repeat" and "erepeat" instructions, used for low-
21880 overhead looping.
21881
21882 -ms Causes all variables to default to the ".tiny" section. Note that
21883 there is a 65536-byte limit to this section. Accesses to these
21884 variables use the %gp base register.
21885
21886 -msatur
21887 Enables the saturation instructions. Note that the compiler does
21888 not currently generate these itself, but this option is included
21889 for compatibility with other tools, like "as".
21890
21891 -msdram
21892 Link the SDRAM-based runtime instead of the default ROM-based
21893 runtime.
21894
21895 -msim
21896 Link the simulator run-time libraries.
21897
21898 -msimnovec
21899 Link the simulator runtime libraries, excluding built-in support
21900 for reset and exception vectors and tables.
21901
21902 -mtf
21903 Causes all functions to default to the ".far" section. Without
21904 this option, functions default to the ".near" section.
21905
21906 -mtiny=n
21907 Variables that are n bytes or smaller are allocated to the ".tiny"
21908 section. These variables use the $gp base register. The default
21909 for this option is 4, but note that there's a 65536-byte limit to
21910 the ".tiny" section.
21911
21912 MicroBlaze Options
21913 -msoft-float
21914 Use software emulation for floating point (default).
21915
21916 -mhard-float
21917 Use hardware floating-point instructions.
21918
21919 -mmemcpy
21920 Do not optimize block moves, use "memcpy".
21921
21922 -mno-clearbss
21923 This option is deprecated. Use -fno-zero-initialized-in-bss
21924 instead.
21925
21926 -mcpu=cpu-type
21927 Use features of, and schedule code for, the given CPU. Supported
21928 values are in the format vX.YY.Z, where X is a major version, YY is
21929 the minor version, and Z is compatibility code. Example values are
21930 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
21931
21932 -mxl-soft-mul
21933 Use software multiply emulation (default).
21934
21935 -mxl-soft-div
21936 Use software emulation for divides (default).
21937
21938 -mxl-barrel-shift
21939 Use the hardware barrel shifter.
21940
21941 -mxl-pattern-compare
21942 Use pattern compare instructions.
21943
21944 -msmall-divides
21945 Use table lookup optimization for small signed integer divisions.
21946
21947 -mxl-stack-check
21948 This option is deprecated. Use -fstack-check instead.
21949
21950 -mxl-gp-opt
21951 Use GP-relative ".sdata"/".sbss" sections.
21952
21953 -mxl-multiply-high
21954 Use multiply high instructions for high part of 32x32 multiply.
21955
21956 -mxl-float-convert
21957 Use hardware floating-point conversion instructions.
21958
21959 -mxl-float-sqrt
21960 Use hardware floating-point square root instruction.
21961
21962 -mbig-endian
21963 Generate code for a big-endian target.
21964
21965 -mlittle-endian
21966 Generate code for a little-endian target.
21967
21968 -mxl-reorder
21969 Use reorder instructions (swap and byte reversed load/store).
21970
21971 -mxl-mode-app-model
21972 Select application model app-model. Valid models are
21973
21974 executable
21975 normal executable (default), uses startup code crt0.o.
21976
21977 xmdstub
21978 for use with Xilinx Microprocessor Debugger (XMD) based
21979 software intrusive debug agent called xmdstub. This uses
21980 startup file crt1.o and sets the start address of the program
21981 to 0x800.
21982
21983 bootstrap
21984 for applications that are loaded using a bootloader. This
21985 model uses startup file crt2.o which does not contain a
21986 processor reset vector handler. This is suitable for
21987 transferring control on a processor reset to the bootloader
21988 rather than the application.
21989
21990 novectors
21991 for applications that do not require any of the MicroBlaze
21992 vectors. This option may be useful for applications running
21993 within a monitoring application. This model uses crt3.o as a
21994 startup file.
21995
21996 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
21997 model.
21998
21999 -mpic-data-is-text-relative
22000 Assume that the displacement between the text and data segments is
22001 fixed at static link time. This allows data to be referenced by
22002 offset from start of text address instead of GOT since PC-relative
22003 addressing is not supported.
22004
22005 MIPS Options
22006 -EB Generate big-endian code.
22007
22008 -EL Generate little-endian code. This is the default for mips*el-*-*
22009 configurations.
22010
22011 -march=arch
22012 Generate code that runs on arch, which can be the name of a generic
22013 MIPS ISA, or the name of a particular processor. The ISA names
22014 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
22015 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
22016 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
22017 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
22018 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
22019 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
22020 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
22021 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
22022 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
22023 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
22024 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
22025 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
22026 and xlp. The special value from-abi selects the most compatible
22027 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
22028 and mips3 for 64-bit ABIs).
22029
22030 The native Linux/GNU toolchain also supports the value native,
22031 which selects the best architecture option for the host processor.
22032 -march=native has no effect if GCC does not recognize the
22033 processor.
22034
22035 In processor names, a final 000 can be abbreviated as k (for
22036 example, -march=r2k). Prefixes are optional, and vr may be written
22037 r.
22038
22039 Names of the form nf2_1 refer to processors with FPUs clocked at
22040 half the rate of the core, names of the form nf1_1 refer to
22041 processors with FPUs clocked at the same rate as the core, and
22042 names of the form nf3_2 refer to processors with FPUs clocked a
22043 ratio of 3:2 with respect to the core. For compatibility reasons,
22044 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
22045 as synonyms for nf1_1.
22046
22047 GCC defines two macros based on the value of this option. The
22048 first is "_MIPS_ARCH", which gives the name of target architecture,
22049 as a string. The second has the form "_MIPS_ARCH_foo", where foo
22050 is the capitalized value of "_MIPS_ARCH". For example,
22051 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
22052 "_MIPS_ARCH_R2000".
22053
22054 Note that the "_MIPS_ARCH" macro uses the processor names given
22055 above. In other words, it has the full prefix and does not
22056 abbreviate 000 as k. In the case of from-abi, the macro names the
22057 resolved architecture (either "mips1" or "mips3"). It names the
22058 default architecture when no -march option is given.
22059
22060 -mtune=arch
22061 Optimize for arch. Among other things, this option controls the
22062 way instructions are scheduled, and the perceived cost of
22063 arithmetic operations. The list of arch values is the same as for
22064 -march.
22065
22066 When this option is not used, GCC optimizes for the processor
22067 specified by -march. By using -march and -mtune together, it is
22068 possible to generate code that runs on a family of processors, but
22069 optimize the code for one particular member of that family.
22070
22071 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
22072 work in the same way as the -march ones described above.
22073
22074 -mips1
22075 Equivalent to -march=mips1.
22076
22077 -mips2
22078 Equivalent to -march=mips2.
22079
22080 -mips3
22081 Equivalent to -march=mips3.
22082
22083 -mips4
22084 Equivalent to -march=mips4.
22085
22086 -mips32
22087 Equivalent to -march=mips32.
22088
22089 -mips32r3
22090 Equivalent to -march=mips32r3.
22091
22092 -mips32r5
22093 Equivalent to -march=mips32r5.
22094
22095 -mips32r6
22096 Equivalent to -march=mips32r6.
22097
22098 -mips64
22099 Equivalent to -march=mips64.
22100
22101 -mips64r2
22102 Equivalent to -march=mips64r2.
22103
22104 -mips64r3
22105 Equivalent to -march=mips64r3.
22106
22107 -mips64r5
22108 Equivalent to -march=mips64r5.
22109
22110 -mips64r6
22111 Equivalent to -march=mips64r6.
22112
22113 -mips16
22114 -mno-mips16
22115 Generate (do not generate) MIPS16 code. If GCC is targeting a
22116 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
22117
22118 MIPS16 code generation can also be controlled on a per-function
22119 basis by means of "mips16" and "nomips16" attributes.
22120
22121 -mflip-mips16
22122 Generate MIPS16 code on alternating functions. This option is
22123 provided for regression testing of mixed MIPS16/non-MIPS16 code
22124 generation, and is not intended for ordinary use in compiling user
22125 code.
22126
22127 -minterlink-compressed
22128 -mno-interlink-compressed
22129 Require (do not require) that code using the standard
22130 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
22131 microMIPS code, and vice versa.
22132
22133 For example, code using the standard ISA encoding cannot jump
22134 directly to MIPS16 or microMIPS code; it must either use a call or
22135 an indirect jump. -minterlink-compressed therefore disables direct
22136 jumps unless GCC knows that the target of the jump is not
22137 compressed.
22138
22139 -minterlink-mips16
22140 -mno-interlink-mips16
22141 Aliases of -minterlink-compressed and -mno-interlink-compressed.
22142 These options predate the microMIPS ASE and are retained for
22143 backwards compatibility.
22144
22145 -mabi=32
22146 -mabi=o64
22147 -mabi=n32
22148 -mabi=64
22149 -mabi=eabi
22150 Generate code for the given ABI.
22151
22152 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
22153 generates 64-bit code when you select a 64-bit architecture, but
22154 you can use -mgp32 to get 32-bit code instead.
22155
22156 For information about the O64 ABI, see
22157 <https://gcc.gnu.org/projects/mipso64-abi.html>.
22158
22159 GCC supports a variant of the o32 ABI in which floating-point
22160 registers are 64 rather than 32 bits wide. You can select this
22161 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
22162 and "mfhc1" instructions and is therefore only supported for
22163 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
22164
22165 The register assignments for arguments and return values remain the
22166 same, but each scalar value is passed in a single 64-bit register
22167 rather than a pair of 32-bit registers. For example, scalar
22168 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
22169 The set of call-saved registers also remains the same in that the
22170 even-numbered double-precision registers are saved.
22171
22172 Two additional variants of the o32 ABI are supported to enable a
22173 transition from 32-bit to 64-bit registers. These are FPXX
22174 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
22175 mandates that all code must execute correctly when run using 32-bit
22176 or 64-bit registers. The code can be interlinked with either FP32
22177 or FP64, but not both. The FP64A extension is similar to the FP64
22178 extension but forbids the use of odd-numbered single-precision
22179 registers. This can be used in conjunction with the "FRE" mode of
22180 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
22181 interlink and run in the same process without changing FPU modes.
22182
22183 -mabicalls
22184 -mno-abicalls
22185 Generate (do not generate) code that is suitable for SVR4-style
22186 dynamic objects. -mabicalls is the default for SVR4-based systems.
22187
22188 -mshared
22189 -mno-shared
22190 Generate (do not generate) code that is fully position-independent,
22191 and that can therefore be linked into shared libraries. This
22192 option only affects -mabicalls.
22193
22194 All -mabicalls code has traditionally been position-independent,
22195 regardless of options like -fPIC and -fpic. However, as an
22196 extension, the GNU toolchain allows executables to use absolute
22197 accesses for locally-binding symbols. It can also use shorter GP
22198 initialization sequences and generate direct calls to locally-
22199 defined functions. This mode is selected by -mno-shared.
22200
22201 -mno-shared depends on binutils 2.16 or higher and generates
22202 objects that can only be linked by the GNU linker. However, the
22203 option does not affect the ABI of the final executable; it only
22204 affects the ABI of relocatable objects. Using -mno-shared
22205 generally makes executables both smaller and quicker.
22206
22207 -mshared is the default.
22208
22209 -mplt
22210 -mno-plt
22211 Assume (do not assume) that the static and dynamic linkers support
22212 PLTs and copy relocations. This option only affects -mno-shared
22213 -mabicalls. For the n64 ABI, this option has no effect without
22214 -msym32.
22215
22216 You can make -mplt the default by configuring GCC with
22217 --with-mips-plt. The default is -mno-plt otherwise.
22218
22219 -mxgot
22220 -mno-xgot
22221 Lift (do not lift) the usual restrictions on the size of the global
22222 offset table.
22223
22224 GCC normally uses a single instruction to load values from the GOT.
22225 While this is relatively efficient, it only works if the GOT is
22226 smaller than about 64k. Anything larger causes the linker to
22227 report an error such as:
22228
22229 relocation truncated to fit: R_MIPS_GOT16 foobar
22230
22231 If this happens, you should recompile your code with -mxgot. This
22232 works with very large GOTs, although the code is also less
22233 efficient, since it takes three instructions to fetch the value of
22234 a global symbol.
22235
22236 Note that some linkers can create multiple GOTs. If you have such
22237 a linker, you should only need to use -mxgot when a single object
22238 file accesses more than 64k's worth of GOT entries. Very few do.
22239
22240 These options have no effect unless GCC is generating position
22241 independent code.
22242
22243 -mgp32
22244 Assume that general-purpose registers are 32 bits wide.
22245
22246 -mgp64
22247 Assume that general-purpose registers are 64 bits wide.
22248
22249 -mfp32
22250 Assume that floating-point registers are 32 bits wide.
22251
22252 -mfp64
22253 Assume that floating-point registers are 64 bits wide.
22254
22255 -mfpxx
22256 Do not assume the width of floating-point registers.
22257
22258 -mhard-float
22259 Use floating-point coprocessor instructions.
22260
22261 -msoft-float
22262 Do not use floating-point coprocessor instructions. Implement
22263 floating-point calculations using library calls instead.
22264
22265 -mno-float
22266 Equivalent to -msoft-float, but additionally asserts that the
22267 program being compiled does not perform any floating-point
22268 operations. This option is presently supported only by some bare-
22269 metal MIPS configurations, where it may select a special set of
22270 libraries that lack all floating-point support (including, for
22271 example, the floating-point "printf" formats). If code compiled
22272 with -mno-float accidentally contains floating-point operations, it
22273 is likely to suffer a link-time or run-time failure.
22274
22275 -msingle-float
22276 Assume that the floating-point coprocessor only supports single-
22277 precision operations.
22278
22279 -mdouble-float
22280 Assume that the floating-point coprocessor supports double-
22281 precision operations. This is the default.
22282
22283 -modd-spreg
22284 -mno-odd-spreg
22285 Enable the use of odd-numbered single-precision floating-point
22286 registers for the o32 ABI. This is the default for processors that
22287 are known to support these registers. When using the o32 FPXX ABI,
22288 -mno-odd-spreg is set by default.
22289
22290 -mabs=2008
22291 -mabs=legacy
22292 These options control the treatment of the special not-a-number
22293 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
22294 machine instructions.
22295
22296 By default or when -mabs=legacy is used the legacy treatment is
22297 selected. In this case these instructions are considered
22298 arithmetic and avoided where correct operation is required and the
22299 input operand might be a NaN. A longer sequence of instructions
22300 that manipulate the sign bit of floating-point datum manually is
22301 used instead unless the -ffinite-math-only option has also been
22302 specified.
22303
22304 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
22305 case these instructions are considered non-arithmetic and therefore
22306 operating correctly in all cases, including in particular where the
22307 input operand is a NaN. These instructions are therefore always
22308 used for the respective operations.
22309
22310 -mnan=2008
22311 -mnan=legacy
22312 These options control the encoding of the special not-a-number
22313 (NaN) IEEE 754 floating-point data.
22314
22315 The -mnan=legacy option selects the legacy encoding. In this case
22316 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22317 significand field being 0, whereas signaling NaNs (sNaNs) are
22318 denoted by the first bit of their trailing significand field being
22319 1.
22320
22321 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
22322 case qNaNs are denoted by the first bit of their trailing
22323 significand field being 1, whereas sNaNs are denoted by the first
22324 bit of their trailing significand field being 0.
22325
22326 The default is -mnan=legacy unless GCC has been configured with
22327 --with-nan=2008.
22328
22329 -mllsc
22330 -mno-llsc
22331 Use (do not use) ll, sc, and sync instructions to implement atomic
22332 memory built-in functions. When neither option is specified, GCC
22333 uses the instructions if the target architecture supports them.
22334
22335 -mllsc is useful if the runtime environment can emulate the
22336 instructions and -mno-llsc can be useful when compiling for
22337 nonstandard ISAs. You can make either option the default by
22338 configuring GCC with --with-llsc and --without-llsc respectively.
22339 --with-llsc is the default for some configurations; see the
22340 installation documentation for details.
22341
22342 -mdsp
22343 -mno-dsp
22344 Use (do not use) revision 1 of the MIPS DSP ASE.
22345 This option defines the preprocessor macro "__mips_dsp". It also
22346 defines "__mips_dsp_rev" to 1.
22347
22348 -mdspr2
22349 -mno-dspr2
22350 Use (do not use) revision 2 of the MIPS DSP ASE.
22351 This option defines the preprocessor macros "__mips_dsp" and
22352 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
22353
22354 -msmartmips
22355 -mno-smartmips
22356 Use (do not use) the MIPS SmartMIPS ASE.
22357
22358 -mpaired-single
22359 -mno-paired-single
22360 Use (do not use) paired-single floating-point instructions.
22361 This option requires hardware floating-point support to be
22362 enabled.
22363
22364 -mdmx
22365 -mno-mdmx
22366 Use (do not use) MIPS Digital Media Extension instructions. This
22367 option can only be used when generating 64-bit code and requires
22368 hardware floating-point support to be enabled.
22369
22370 -mips3d
22371 -mno-mips3d
22372 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
22373 -mpaired-single.
22374
22375 -mmicromips
22376 -mno-micromips
22377 Generate (do not generate) microMIPS code.
22378
22379 MicroMIPS code generation can also be controlled on a per-function
22380 basis by means of "micromips" and "nomicromips" attributes.
22381
22382 -mmt
22383 -mno-mt
22384 Use (do not use) MT Multithreading instructions.
22385
22386 -mmcu
22387 -mno-mcu
22388 Use (do not use) the MIPS MCU ASE instructions.
22389
22390 -meva
22391 -mno-eva
22392 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22393
22394 -mvirt
22395 -mno-virt
22396 Use (do not use) the MIPS Virtualization (VZ) instructions.
22397
22398 -mxpa
22399 -mno-xpa
22400 Use (do not use) the MIPS eXtended Physical Address (XPA)
22401 instructions.
22402
22403 -mcrc
22404 -mno-crc
22405 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
22406 instructions.
22407
22408 -mginv
22409 -mno-ginv
22410 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22411
22412 -mloongson-mmi
22413 -mno-loongson-mmi
22414 Use (do not use) the MIPS Loongson MultiMedia extensions
22415 Instructions (MMI).
22416
22417 -mloongson-ext
22418 -mno-loongson-ext
22419 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22420
22421 -mloongson-ext2
22422 -mno-loongson-ext2
22423 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
22424 instructions.
22425
22426 -mlong64
22427 Force "long" types to be 64 bits wide. See -mlong32 for an
22428 explanation of the default and the way that the pointer size is
22429 determined.
22430
22431 -mlong32
22432 Force "long", "int", and pointer types to be 32 bits wide.
22433
22434 The default size of "int"s, "long"s and pointers depends on the
22435 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
22436 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
22437 "long"s. Pointers are the same size as "long"s, or the same size
22438 as integer registers, whichever is smaller.
22439
22440 -msym32
22441 -mno-sym32
22442 Assume (do not assume) that all symbols have 32-bit values,
22443 regardless of the selected ABI. This option is useful in
22444 combination with -mabi=64 and -mno-abicalls because it allows GCC
22445 to generate shorter and faster references to symbolic addresses.
22446
22447 -G num
22448 Put definitions of externally-visible data in a small data section
22449 if that data is no bigger than num bytes. GCC can then generate
22450 more efficient accesses to the data; see -mgpopt for details.
22451
22452 The default -G option depends on the configuration.
22453
22454 -mlocal-sdata
22455 -mno-local-sdata
22456 Extend (do not extend) the -G behavior to local data too, such as
22457 to static variables in C. -mlocal-sdata is the default for all
22458 configurations.
22459
22460 If the linker complains that an application is using too much small
22461 data, you might want to try rebuilding the less performance-
22462 critical parts with -mno-local-sdata. You might also want to build
22463 large libraries with -mno-local-sdata, so that the libraries leave
22464 more room for the main program.
22465
22466 -mextern-sdata
22467 -mno-extern-sdata
22468 Assume (do not assume) that externally-defined data is in a small
22469 data section if the size of that data is within the -G limit.
22470 -mextern-sdata is the default for all configurations.
22471
22472 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
22473 Mod references a variable Var that is no bigger than num bytes, you
22474 must make sure that Var is placed in a small data section. If Var
22475 is defined by another module, you must either compile that module
22476 with a high-enough -G setting or attach a "section" attribute to
22477 Var's definition. If Var is common, you must link the application
22478 with a high-enough -G setting.
22479
22480 The easiest way of satisfying these restrictions is to compile and
22481 link every module with the same -G option. However, you may wish
22482 to build a library that supports several different small data
22483 limits. You can do this by compiling the library with the highest
22484 supported -G setting and additionally using -mno-extern-sdata to
22485 stop the library from making assumptions about externally-defined
22486 data.
22487
22488 -mgpopt
22489 -mno-gpopt
22490 Use (do not use) GP-relative accesses for symbols that are known to
22491 be in a small data section; see -G, -mlocal-sdata and
22492 -mextern-sdata. -mgpopt is the default for all configurations.
22493
22494 -mno-gpopt is useful for cases where the $gp register might not
22495 hold the value of "_gp". For example, if the code is part of a
22496 library that might be used in a boot monitor, programs that call
22497 boot monitor routines pass an unknown value in $gp. (In such
22498 situations, the boot monitor itself is usually compiled with -G0.)
22499
22500 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
22501
22502 -membedded-data
22503 -mno-embedded-data
22504 Allocate variables to the read-only data section first if possible,
22505 then next in the small data section if possible, otherwise in data.
22506 This gives slightly slower code than the default, but reduces the
22507 amount of RAM required when executing, and thus may be preferred
22508 for some embedded systems.
22509
22510 -muninit-const-in-rodata
22511 -mno-uninit-const-in-rodata
22512 Put uninitialized "const" variables in the read-only data section.
22513 This option is only meaningful in conjunction with -membedded-data.
22514
22515 -mcode-readable=setting
22516 Specify whether GCC may generate code that reads from executable
22517 sections. There are three possible settings:
22518
22519 -mcode-readable=yes
22520 Instructions may freely access executable sections. This is
22521 the default setting.
22522
22523 -mcode-readable=pcrel
22524 MIPS16 PC-relative load instructions can access executable
22525 sections, but other instructions must not do so. This option
22526 is useful on 4KSc and 4KSd processors when the code TLBs have
22527 the Read Inhibit bit set. It is also useful on processors that
22528 can be configured to have a dual instruction/data SRAM
22529 interface and that, like the M4K, automatically redirect PC-
22530 relative loads to the instruction RAM.
22531
22532 -mcode-readable=no
22533 Instructions must not access executable sections. This option
22534 can be useful on targets that are configured to have a dual
22535 instruction/data SRAM interface but that (unlike the M4K) do
22536 not automatically redirect PC-relative loads to the instruction
22537 RAM.
22538
22539 -msplit-addresses
22540 -mno-split-addresses
22541 Enable (disable) use of the "%hi()" and "%lo()" assembler
22542 relocation operators. This option has been superseded by
22543 -mexplicit-relocs but is retained for backwards compatibility.
22544
22545 -mexplicit-relocs
22546 -mno-explicit-relocs
22547 Use (do not use) assembler relocation operators when dealing with
22548 symbolic addresses. The alternative, selected by
22549 -mno-explicit-relocs, is to use assembler macros instead.
22550
22551 -mexplicit-relocs is the default if GCC was configured to use an
22552 assembler that supports relocation operators.
22553
22554 -mcheck-zero-division
22555 -mno-check-zero-division
22556 Trap (do not trap) on integer division by zero.
22557
22558 The default is -mcheck-zero-division.
22559
22560 -mdivide-traps
22561 -mdivide-breaks
22562 MIPS systems check for division by zero by generating either a
22563 conditional trap or a break instruction. Using traps results in
22564 smaller code, but is only supported on MIPS II and later. Also,
22565 some versions of the Linux kernel have a bug that prevents trap
22566 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
22567 to allow conditional traps on architectures that support them and
22568 -mdivide-breaks to force the use of breaks.
22569
22570 The default is usually -mdivide-traps, but this can be overridden
22571 at configure time using --with-divide=breaks. Divide-by-zero
22572 checks can be completely disabled using -mno-check-zero-division.
22573
22574 -mload-store-pairs
22575 -mno-load-store-pairs
22576 Enable (disable) an optimization that pairs consecutive load or
22577 store instructions to enable load/store bonding. This option is
22578 enabled by default but only takes effect when the selected
22579 architecture is known to support bonding.
22580
22581 -munaligned-access
22582 -mno-unaligned-access
22583 Enable (disable) direct unaligned access for MIPS Release 6.
22584 MIPSr6 requires load/store unaligned-access support, by hardware or
22585 trap&emulate. So -mno-unaligned-access may be needed by kernel.
22586
22587 -mmemcpy
22588 -mno-memcpy
22589 Force (do not force) the use of "memcpy" for non-trivial block
22590 moves. The default is -mno-memcpy, which allows GCC to inline most
22591 constant-sized copies.
22592
22593 -mlong-calls
22594 -mno-long-calls
22595 Disable (do not disable) use of the "jal" instruction. Calling
22596 functions using "jal" is more efficient but requires the caller and
22597 callee to be in the same 256 megabyte segment.
22598
22599 This option has no effect on abicalls code. The default is
22600 -mno-long-calls.
22601
22602 -mmad
22603 -mno-mad
22604 Enable (disable) use of the "mad", "madu" and "mul" instructions,
22605 as provided by the R4650 ISA.
22606
22607 -mimadd
22608 -mno-imadd
22609 Enable (disable) use of the "madd" and "msub" integer instructions.
22610 The default is -mimadd on architectures that support "madd" and
22611 "msub" except for the 74k architecture where it was found to
22612 generate slower code.
22613
22614 -mfused-madd
22615 -mno-fused-madd
22616 Enable (disable) use of the floating-point multiply-accumulate
22617 instructions, when they are available. The default is
22618 -mfused-madd.
22619
22620 On the R8000 CPU when multiply-accumulate instructions are used,
22621 the intermediate product is calculated to infinite precision and is
22622 not subject to the FCSR Flush to Zero bit. This may be undesirable
22623 in some circumstances. On other processors the result is
22624 numerically identical to the equivalent computation using separate
22625 multiply, add, subtract and negate instructions.
22626
22627 -nocpp
22628 Tell the MIPS assembler to not run its preprocessor over user
22629 assembler files (with a .s suffix) when assembling them.
22630
22631 -mfix-24k
22632 -mno-fix-24k
22633 Work around the 24K E48 (lost data on stores during refill) errata.
22634 The workarounds are implemented by the assembler rather than by
22635 GCC.
22636
22637 -mfix-r4000
22638 -mno-fix-r4000
22639 Work around certain R4000 CPU errata:
22640
22641 - A double-word or a variable shift may give an incorrect result
22642 if executed immediately after starting an integer division.
22643
22644 - A double-word or a variable shift may give an incorrect result
22645 if executed while an integer multiplication is in progress.
22646
22647 - An integer division may give an incorrect result if started in
22648 a delay slot of a taken branch or a jump.
22649
22650 -mfix-r4400
22651 -mno-fix-r4400
22652 Work around certain R4400 CPU errata:
22653
22654 - A double-word or a variable shift may give an incorrect result
22655 if executed immediately after starting an integer division.
22656
22657 -mfix-r10000
22658 -mno-fix-r10000
22659 Work around certain R10000 errata:
22660
22661 - "ll"/"sc" sequences may not behave atomically on revisions
22662 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22663
22664 This option can only be used if the target architecture supports
22665 branch-likely instructions. -mfix-r10000 is the default when
22666 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
22667
22668 -mfix-r5900
22669 -mno-fix-r5900
22670 Do not attempt to schedule the preceding instruction into the delay
22671 slot of a branch instruction placed at the end of a short loop of
22672 six instructions or fewer and always schedule a "nop" instruction
22673 there instead. The short loop bug under certain conditions causes
22674 loops to execute only once or twice, due to a hardware bug in the
22675 R5900 chip. The workaround is implemented by the assembler rather
22676 than by GCC.
22677
22678 -mfix-rm7000
22679 -mno-fix-rm7000
22680 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
22681 are implemented by the assembler rather than by GCC.
22682
22683 -mfix-vr4120
22684 -mno-fix-vr4120
22685 Work around certain VR4120 errata:
22686
22687 - "dmultu" does not always produce the correct result.
22688
22689 - "div" and "ddiv" do not always produce the correct result if
22690 one of the operands is negative.
22691
22692 The workarounds for the division errata rely on special functions
22693 in libgcc.a. At present, these functions are only provided by the
22694 "mips64vr*-elf" configurations.
22695
22696 Other VR4120 errata require a NOP to be inserted between certain
22697 pairs of instructions. These errata are handled by the assembler,
22698 not by GCC itself.
22699
22700 -mfix-vr4130
22701 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
22702 implemented by the assembler rather than by GCC, although GCC
22703 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
22704 "dmacc" and "dmacchi" instructions are available instead.
22705
22706 -mfix-sb1
22707 -mno-fix-sb1
22708 Work around certain SB-1 CPU core errata. (This flag currently
22709 works around the SB-1 revision 2 "F1" and "F2" floating-point
22710 errata.)
22711
22712 -mr10k-cache-barrier=setting
22713 Specify whether GCC should insert cache barriers to avoid the side
22714 effects of speculation on R10K processors.
22715
22716 In common with many processors, the R10K tries to predict the
22717 outcome of a conditional branch and speculatively executes
22718 instructions from the "taken" branch. It later aborts these
22719 instructions if the predicted outcome is wrong. However, on the
22720 R10K, even aborted instructions can have side effects.
22721
22722 This problem only affects kernel stores and, depending on the
22723 system, kernel loads. As an example, a speculatively-executed
22724 store may load the target memory into cache and mark the cache line
22725 as dirty, even if the store itself is later aborted. If a DMA
22726 operation writes to the same area of memory before the "dirty" line
22727 is flushed, the cached data overwrites the DMA-ed data. See the
22728 R10K processor manual for a full description, including other
22729 potential problems.
22730
22731 One workaround is to insert cache barrier instructions before every
22732 memory access that might be speculatively executed and that might
22733 have side effects even if aborted. -mr10k-cache-barrier=setting
22734 controls GCC's implementation of this workaround. It assumes that
22735 aborted accesses to any byte in the following regions does not have
22736 side effects:
22737
22738 1. the memory occupied by the current function's stack frame;
22739
22740 2. the memory occupied by an incoming stack argument;
22741
22742 3. the memory occupied by an object with a link-time-constant
22743 address.
22744
22745 It is the kernel's responsibility to ensure that speculative
22746 accesses to these regions are indeed safe.
22747
22748 If the input program contains a function declaration such as:
22749
22750 void foo (void);
22751
22752 then the implementation of "foo" must allow "j foo" and "jal foo"
22753 to be executed speculatively. GCC honors this restriction for
22754 functions it compiles itself. It expects non-GCC functions (such
22755 as hand-written assembly code) to do the same.
22756
22757 The option has three forms:
22758
22759 -mr10k-cache-barrier=load-store
22760 Insert a cache barrier before a load or store that might be
22761 speculatively executed and that might have side effects even if
22762 aborted.
22763
22764 -mr10k-cache-barrier=store
22765 Insert a cache barrier before a store that might be
22766 speculatively executed and that might have side effects even if
22767 aborted.
22768
22769 -mr10k-cache-barrier=none
22770 Disable the insertion of cache barriers. This is the default
22771 setting.
22772
22773 -mflush-func=func
22774 -mno-flush-func
22775 Specifies the function to call to flush the I and D caches, or to
22776 not call any such function. If called, the function must take the
22777 same arguments as the common "_flush_func", that is, the address of
22778 the memory range for which the cache is being flushed, the size of
22779 the memory range, and the number 3 (to flush both caches). The
22780 default depends on the target GCC was configured for, but commonly
22781 is either "_flush_func" or "__cpu_flush".
22782
22783 mbranch-cost=num
22784 Set the cost of branches to roughly num "simple" instructions.
22785 This cost is only a heuristic and is not guaranteed to produce
22786 consistent results across releases. A zero cost redundantly
22787 selects the default, which is based on the -mtune setting.
22788
22789 -mbranch-likely
22790 -mno-branch-likely
22791 Enable or disable use of Branch Likely instructions, regardless of
22792 the default for the selected architecture. By default, Branch
22793 Likely instructions may be generated if they are supported by the
22794 selected architecture. An exception is for the MIPS32 and MIPS64
22795 architectures and processors that implement those architectures;
22796 for those, Branch Likely instructions are not be generated by
22797 default because the MIPS32 and MIPS64 architectures specifically
22798 deprecate their use.
22799
22800 -mcompact-branches=never
22801 -mcompact-branches=optimal
22802 -mcompact-branches=always
22803 These options control which form of branches will be generated.
22804 The default is -mcompact-branches=optimal.
22805
22806 The -mcompact-branches=never option ensures that compact branch
22807 instructions will never be generated.
22808
22809 The -mcompact-branches=always option ensures that a compact branch
22810 instruction will be generated if available. If a compact branch
22811 instruction is not available, a delay slot form of the branch will
22812 be used instead.
22813
22814 This option is supported from MIPS Release 6 onwards.
22815
22816 The -mcompact-branches=optimal option will cause a delay slot
22817 branch to be used if one is available in the current ISA and the
22818 delay slot is successfully filled. If the delay slot is not
22819 filled, a compact branch will be chosen if one is available.
22820
22821 -mfp-exceptions
22822 -mno-fp-exceptions
22823 Specifies whether FP exceptions are enabled. This affects how FP
22824 instructions are scheduled for some processors. The default is
22825 that FP exceptions are enabled.
22826
22827 For instance, on the SB-1, if FP exceptions are disabled, and we
22828 are emitting 64-bit code, then we can use both FP pipes.
22829 Otherwise, we can only use one FP pipe.
22830
22831 -mvr4130-align
22832 -mno-vr4130-align
22833 The VR4130 pipeline is two-way superscalar, but can only issue two
22834 instructions together if the first one is 8-byte aligned. When
22835 this option is enabled, GCC aligns pairs of instructions that it
22836 thinks should execute in parallel.
22837
22838 This option only has an effect when optimizing for the VR4130. It
22839 normally makes code faster, but at the expense of making it bigger.
22840 It is enabled by default at optimization level -O3.
22841
22842 -msynci
22843 -mno-synci
22844 Enable (disable) generation of "synci" instructions on
22845 architectures that support it. The "synci" instructions (if
22846 enabled) are generated when "__builtin___clear_cache" is compiled.
22847
22848 This option defaults to -mno-synci, but the default can be
22849 overridden by configuring GCC with --with-synci.
22850
22851 When compiling code for single processor systems, it is generally
22852 safe to use "synci". However, on many multi-core (SMP) systems, it
22853 does not invalidate the instruction caches on all cores and may
22854 lead to undefined behavior.
22855
22856 -mrelax-pic-calls
22857 -mno-relax-pic-calls
22858 Try to turn PIC calls that are normally dispatched via register $25
22859 into direct calls. This is only possible if the linker can resolve
22860 the destination at link time and if the destination is within range
22861 for a direct call.
22862
22863 -mrelax-pic-calls is the default if GCC was configured to use an
22864 assembler and a linker that support the ".reloc" assembly directive
22865 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
22866 this optimization can be performed by the assembler and the linker
22867 alone without help from the compiler.
22868
22869 -mmcount-ra-address
22870 -mno-mcount-ra-address
22871 Emit (do not emit) code that allows "_mcount" to modify the calling
22872 function's return address. When enabled, this option extends the
22873 usual "_mcount" interface with a new ra-address parameter, which
22874 has type "intptr_t *" and is passed in register $12. "_mcount" can
22875 then modify the return address by doing both of the following:
22876
22877 * Returning the new address in register $31.
22878
22879 * Storing the new address in "*ra-address", if ra-address is
22880 nonnull.
22881
22882 The default is -mno-mcount-ra-address.
22883
22884 -mframe-header-opt
22885 -mno-frame-header-opt
22886 Enable (disable) frame header optimization in the o32 ABI. When
22887 using the o32 ABI, calling functions will allocate 16 bytes on the
22888 stack for the called function to write out register arguments.
22889 When enabled, this optimization will suppress the allocation of the
22890 frame header if it can be determined that it is unused.
22891
22892 This optimization is off by default at all optimization levels.
22893
22894 -mlxc1-sxc1
22895 -mno-lxc1-sxc1
22896 When applicable, enable (disable) the generation of "lwxc1",
22897 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
22898
22899 -mmadd4
22900 -mno-madd4
22901 When applicable, enable (disable) the generation of 4-operand
22902 "madd.s", "madd.d" and related instructions. Enabled by default.
22903
22904 MMIX Options
22905 These options are defined for the MMIX:
22906
22907 -mlibfuncs
22908 -mno-libfuncs
22909 Specify that intrinsic library functions are being compiled,
22910 passing all values in registers, no matter the size.
22911
22912 -mepsilon
22913 -mno-epsilon
22914 Generate floating-point comparison instructions that compare with
22915 respect to the "rE" epsilon register.
22916
22917 -mabi=mmixware
22918 -mabi=gnu
22919 Generate code that passes function parameters and return values
22920 that (in the called function) are seen as registers $0 and up, as
22921 opposed to the GNU ABI which uses global registers $231 and up.
22922
22923 -mzero-extend
22924 -mno-zero-extend
22925 When reading data from memory in sizes shorter than 64 bits, use
22926 (do not use) zero-extending load instructions by default, rather
22927 than sign-extending ones.
22928
22929 -mknuthdiv
22930 -mno-knuthdiv
22931 Make the result of a division yielding a remainder have the same
22932 sign as the divisor. With the default, -mno-knuthdiv, the sign of
22933 the remainder follows the sign of the dividend. Both methods are
22934 arithmetically valid, the latter being almost exclusively used.
22935
22936 -mtoplevel-symbols
22937 -mno-toplevel-symbols
22938 Prepend (do not prepend) a : to all global symbols, so the assembly
22939 code can be used with the "PREFIX" assembly directive.
22940
22941 -melf
22942 Generate an executable in the ELF format, rather than the default
22943 mmo format used by the mmix simulator.
22944
22945 -mbranch-predict
22946 -mno-branch-predict
22947 Use (do not use) the probable-branch instructions, when static
22948 branch prediction indicates a probable branch.
22949
22950 -mbase-addresses
22951 -mno-base-addresses
22952 Generate (do not generate) code that uses base addresses. Using a
22953 base address automatically generates a request (handled by the
22954 assembler and the linker) for a constant to be set up in a global
22955 register. The register is used for one or more base address
22956 requests within the range 0 to 255 from the value held in the
22957 register. The generally leads to short and fast code, but the
22958 number of different data items that can be addressed is limited.
22959 This means that a program that uses lots of static data may require
22960 -mno-base-addresses.
22961
22962 -msingle-exit
22963 -mno-single-exit
22964 Force (do not force) generated code to have a single exit point in
22965 each function.
22966
22967 MN10300 Options
22968 These -m options are defined for Matsushita MN10300 architectures:
22969
22970 -mmult-bug
22971 Generate code to avoid bugs in the multiply instructions for the
22972 MN10300 processors. This is the default.
22973
22974 -mno-mult-bug
22975 Do not generate code to avoid bugs in the multiply instructions for
22976 the MN10300 processors.
22977
22978 -mam33
22979 Generate code using features specific to the AM33 processor.
22980
22981 -mno-am33
22982 Do not generate code using features specific to the AM33 processor.
22983 This is the default.
22984
22985 -mam33-2
22986 Generate code using features specific to the AM33/2.0 processor.
22987
22988 -mam34
22989 Generate code using features specific to the AM34 processor.
22990
22991 -mtune=cpu-type
22992 Use the timing characteristics of the indicated CPU type when
22993 scheduling instructions. This does not change the targeted
22994 processor type. The CPU type must be one of mn10300, am33, am33-2
22995 or am34.
22996
22997 -mreturn-pointer-on-d0
22998 When generating a function that returns a pointer, return the
22999 pointer in both "a0" and "d0". Otherwise, the pointer is returned
23000 only in "a0", and attempts to call such functions without a
23001 prototype result in errors. Note that this option is on by
23002 default; use -mno-return-pointer-on-d0 to disable it.
23003
23004 -mno-crt0
23005 Do not link in the C run-time initialization object file.
23006
23007 -mrelax
23008 Indicate to the linker that it should perform a relaxation
23009 optimization pass to shorten branches, calls and absolute memory
23010 addresses. This option only has an effect when used on the command
23011 line for the final link step.
23012
23013 This option makes symbolic debugging impossible.
23014
23015 -mliw
23016 Allow the compiler to generate Long Instruction Word instructions
23017 if the target is the AM33 or later. This is the default. This
23018 option defines the preprocessor macro "__LIW__".
23019
23020 -mno-liw
23021 Do not allow the compiler to generate Long Instruction Word
23022 instructions. This option defines the preprocessor macro
23023 "__NO_LIW__".
23024
23025 -msetlb
23026 Allow the compiler to generate the SETLB and Lcc instructions if
23027 the target is the AM33 or later. This is the default. This option
23028 defines the preprocessor macro "__SETLB__".
23029
23030 -mno-setlb
23031 Do not allow the compiler to generate SETLB or Lcc instructions.
23032 This option defines the preprocessor macro "__NO_SETLB__".
23033
23034 Moxie Options
23035 -meb
23036 Generate big-endian code. This is the default for moxie-*-*
23037 configurations.
23038
23039 -mel
23040 Generate little-endian code.
23041
23042 -mmul.x
23043 Generate mul.x and umul.x instructions. This is the default for
23044 moxiebox-*-* configurations.
23045
23046 -mno-crt0
23047 Do not link in the C run-time initialization object file.
23048
23049 MSP430 Options
23050 These options are defined for the MSP430:
23051
23052 -masm-hex
23053 Force assembly output to always use hex constants. Normally such
23054 constants are signed decimals, but this option is available for
23055 testsuite and/or aesthetic purposes.
23056
23057 -mmcu=
23058 Select the MCU to target. This is used to create a C preprocessor
23059 symbol based upon the MCU name, converted to upper case and pre-
23060 and post-fixed with __. This in turn is used by the msp430.h
23061 header file to select an MCU-specific supplementary header file.
23062
23063 The option also sets the ISA to use. If the MCU name is one that
23064 is known to only support the 430 ISA then that is selected,
23065 otherwise the 430X ISA is selected. A generic MCU name of msp430
23066 can also be used to select the 430 ISA. Similarly the generic
23067 msp430x MCU name selects the 430X ISA.
23068
23069 In addition an MCU-specific linker script is added to the linker
23070 command line. The script's name is the name of the MCU with .ld
23071 appended. Thus specifying -mmcu=xxx on the gcc command line
23072 defines the C preprocessor symbol "__XXX__" and cause the linker to
23073 search for a script called xxx.ld.
23074
23075 The ISA and hardware multiply supported for the different MCUs is
23076 hard-coded into GCC. However, an external devices.csv file can be
23077 used to extend device support beyond those that have been hard-
23078 coded.
23079
23080 GCC searches for the devices.csv file using the following methods
23081 in the given precedence order, where the first method takes
23082 precendence over the second which takes precedence over the third.
23083
23084 Include path specified with "-I" and "-L"
23085 devices.csv will be searched for in each of the directories
23086 specified by include paths and linker library search paths.
23087
23088 Path specified by the environment variable MSP430_GCC_INCLUDE_DIR
23089 Define the value of the global environment variable
23090 MSP430_GCC_INCLUDE_DIR to the full path to the directory
23091 containing devices.csv, and GCC will search this directory for
23092 devices.csv. If devices.csv is found, this directory will also
23093 be registered as an include path, and linker library path.
23094 Header files and linker scripts in this directory can therefore
23095 be used without manually specifying "-I" and "-L" on the
23096 command line.
23097
23098 The msp430-elf{,bare}/include/devices directory
23099 Finally, GCC will examine msp430-elf{,bare}/include/devices
23100 from the toolchain root directory. This directory does not
23101 exist in a default installation, but if the user has created it
23102 and copied devices.csv there, then the MCU data will be read.
23103 As above, this directory will also be registered as an include
23104 path, and linker library path.
23105
23106 If none of the above search methods find devices.csv, then the
23107 hard-coded MCU data is used.
23108
23109 -mwarn-mcu
23110 -mno-warn-mcu
23111 This option enables or disables warnings about conflicts between
23112 the MCU name specified by the -mmcu option and the ISA set by the
23113 -mcpu option and/or the hardware multiply support set by the
23114 -mhwmult option. It also toggles warnings about unrecognized MCU
23115 names. This option is on by default.
23116
23117 -mcpu=
23118 Specifies the ISA to use. Accepted values are msp430, msp430x and
23119 msp430xv2. This option is deprecated. The -mmcu= option should be
23120 used to select the ISA.
23121
23122 -msim
23123 Link to the simulator runtime libraries and linker script.
23124 Overrides any scripts that would be selected by the -mmcu= option.
23125
23126 -mlarge
23127 Use large-model addressing (20-bit pointers, 20-bit "size_t").
23128
23129 -msmall
23130 Use small-model addressing (16-bit pointers, 16-bit "size_t").
23131
23132 -mrelax
23133 This option is passed to the assembler and linker, and allows the
23134 linker to perform certain optimizations that cannot be done until
23135 the final link.
23136
23137 mhwmult=
23138 Describes the type of hardware multiply supported by the target.
23139 Accepted values are none for no hardware multiply, 16bit for the
23140 original 16-bit-only multiply supported by early MCUs. 32bit for
23141 the 16/32-bit multiply supported by later MCUs and f5series for the
23142 16/32-bit multiply supported by F5-series MCUs. A value of auto
23143 can also be given. This tells GCC to deduce the hardware multiply
23144 support based upon the MCU name provided by the -mmcu option. If
23145 no -mmcu option is specified or if the MCU name is not recognized
23146 then no hardware multiply support is assumed. "auto" is the
23147 default setting.
23148
23149 Hardware multiplies are normally performed by calling a library
23150 routine. This saves space in the generated code. When compiling
23151 at -O3 or higher however the hardware multiplier is invoked inline.
23152 This makes for bigger, but faster code.
23153
23154 The hardware multiply routines disable interrupts whilst running
23155 and restore the previous interrupt state when they finish. This
23156 makes them safe to use inside interrupt handlers as well as in
23157 normal code.
23158
23159 -minrt
23160 Enable the use of a minimum runtime environment - no static
23161 initializers or constructors. This is intended for memory-
23162 constrained devices. The compiler includes special symbols in some
23163 objects that tell the linker and runtime which code fragments are
23164 required.
23165
23166 -mtiny-printf
23167 Enable reduced code size "printf" and "puts" library functions.
23168 The tiny implementations of these functions are not reentrant, so
23169 must be used with caution in multi-threaded applications.
23170
23171 Support for streams has been removed and the string to be printed
23172 will always be sent to stdout via the "write" syscall. The string
23173 is not buffered before it is sent to write.
23174
23175 This option requires Newlib Nano IO, so GCC must be configured with
23176 --enable-newlib-nano-formatted-io.
23177
23178 -mmax-inline-shift=
23179 This option takes an integer between 0 and 64 inclusive, and sets
23180 the maximum number of inline shift instructions which should be
23181 emitted to perform a shift operation by a constant amount. When
23182 this value needs to be exceeded, an mspabi helper function is used
23183 instead. The default value is 4.
23184
23185 This only affects cases where a shift by multiple positions cannot
23186 be completed with a single instruction (e.g. all shifts >1 on the
23187 430 ISA).
23188
23189 Shifts of a 32-bit value are at least twice as costly, so the value
23190 passed for this option is divided by 2 and the resulting value used
23191 instead.
23192
23193 -mcode-region=
23194 -mdata-region=
23195 These options tell the compiler where to place functions and data
23196 that do not have one of the "lower", "upper", "either" or "section"
23197 attributes. Possible values are "lower", "upper", "either" or
23198 "any". The first three behave like the corresponding attribute.
23199 The fourth possible value - "any" - is the default. It leaves
23200 placement entirely up to the linker script and how it assigns the
23201 standard sections (".text", ".data", etc) to the memory regions.
23202
23203 -msilicon-errata=
23204 This option passes on a request to assembler to enable the fixes
23205 for the named silicon errata.
23206
23207 -msilicon-errata-warn=
23208 This option passes on a request to the assembler to enable warning
23209 messages when a silicon errata might need to be applied.
23210
23211 -mwarn-devices-csv
23212 -mno-warn-devices-csv
23213 Warn if devices.csv is not found or there are problem parsing it
23214 (default: on).
23215
23216 NDS32 Options
23217 These options are defined for NDS32 implementations:
23218
23219 -mbig-endian
23220 Generate code in big-endian mode.
23221
23222 -mlittle-endian
23223 Generate code in little-endian mode.
23224
23225 -mreduced-regs
23226 Use reduced-set registers for register allocation.
23227
23228 -mfull-regs
23229 Use full-set registers for register allocation.
23230
23231 -mcmov
23232 Generate conditional move instructions.
23233
23234 -mno-cmov
23235 Do not generate conditional move instructions.
23236
23237 -mext-perf
23238 Generate performance extension instructions.
23239
23240 -mno-ext-perf
23241 Do not generate performance extension instructions.
23242
23243 -mext-perf2
23244 Generate performance extension 2 instructions.
23245
23246 -mno-ext-perf2
23247 Do not generate performance extension 2 instructions.
23248
23249 -mext-string
23250 Generate string extension instructions.
23251
23252 -mno-ext-string
23253 Do not generate string extension instructions.
23254
23255 -mv3push
23256 Generate v3 push25/pop25 instructions.
23257
23258 -mno-v3push
23259 Do not generate v3 push25/pop25 instructions.
23260
23261 -m16-bit
23262 Generate 16-bit instructions.
23263
23264 -mno-16-bit
23265 Do not generate 16-bit instructions.
23266
23267 -misr-vector-size=num
23268 Specify the size of each interrupt vector, which must be 4 or 16.
23269
23270 -mcache-block-size=num
23271 Specify the size of each cache block, which must be a power of 2
23272 between 4 and 512.
23273
23274 -march=arch
23275 Specify the name of the target architecture.
23276
23277 -mcmodel=code-model
23278 Set the code model to one of
23279
23280 small
23281 All the data and read-only data segments must be within 512KB
23282 addressing space. The text segment must be within 16MB
23283 addressing space.
23284
23285 medium
23286 The data segment must be within 512KB while the read-only data
23287 segment can be within 4GB addressing space. The text segment
23288 should be still within 16MB addressing space.
23289
23290 large
23291 All the text and data segments can be within 4GB addressing
23292 space.
23293
23294 -mctor-dtor
23295 Enable constructor/destructor feature.
23296
23297 -mrelax
23298 Guide linker to relax instructions.
23299
23300 Nios II Options
23301 These are the options defined for the Altera Nios II processor.
23302
23303 -G num
23304 Put global and static objects less than or equal to num bytes into
23305 the small data or BSS sections instead of the normal data or BSS
23306 sections. The default value of num is 8.
23307
23308 -mgpopt=option
23309 -mgpopt
23310 -mno-gpopt
23311 Generate (do not generate) GP-relative accesses. The following
23312 option names are recognized:
23313
23314 none
23315 Do not generate GP-relative accesses.
23316
23317 local
23318 Generate GP-relative accesses for small data objects that are
23319 not external, weak, or uninitialized common symbols. Also use
23320 GP-relative addressing for objects that have been explicitly
23321 placed in a small data section via a "section" attribute.
23322
23323 global
23324 As for local, but also generate GP-relative accesses for small
23325 data objects that are external, weak, or common. If you use
23326 this option, you must ensure that all parts of your program
23327 (including libraries) are compiled with the same -G setting.
23328
23329 data
23330 Generate GP-relative accesses for all data objects in the
23331 program. If you use this option, the entire data and BSS
23332 segments of your program must fit in 64K of memory and you must
23333 use an appropriate linker script to allocate them within the
23334 addressable range of the global pointer.
23335
23336 all Generate GP-relative addresses for function pointers as well as
23337 data pointers. If you use this option, the entire text, data,
23338 and BSS segments of your program must fit in 64K of memory and
23339 you must use an appropriate linker script to allocate them
23340 within the addressable range of the global pointer.
23341
23342 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
23343 equivalent to -mgpopt=none.
23344
23345 The default is -mgpopt except when -fpic or -fPIC is specified to
23346 generate position-independent code. Note that the Nios II ABI does
23347 not permit GP-relative accesses from shared libraries.
23348
23349 You may need to specify -mno-gpopt explicitly when building
23350 programs that include large amounts of small data, including large
23351 GOT data sections. In this case, the 16-bit offset for GP-relative
23352 addressing may not be large enough to allow access to the entire
23353 small data section.
23354
23355 -mgprel-sec=regexp
23356 This option specifies additional section names that can be accessed
23357 via GP-relative addressing. It is most useful in conjunction with
23358 "section" attributes on variable declarations and a custom linker
23359 script. The regexp is a POSIX Extended Regular Expression.
23360
23361 This option does not affect the behavior of the -G option, and the
23362 specified sections are in addition to the standard ".sdata" and
23363 ".sbss" small-data sections that are recognized by -mgpopt.
23364
23365 -mr0rel-sec=regexp
23366 This option specifies names of sections that can be accessed via a
23367 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
23368 32-bit address space. It is most useful in conjunction with
23369 "section" attributes on variable declarations and a custom linker
23370 script. The regexp is a POSIX Extended Regular Expression.
23371
23372 In contrast to the use of GP-relative addressing for small data,
23373 zero-based addressing is never generated by default and there are
23374 no conventional section names used in standard linker scripts for
23375 sections in the low or high areas of memory.
23376
23377 -mel
23378 -meb
23379 Generate little-endian (default) or big-endian (experimental) code,
23380 respectively.
23381
23382 -march=arch
23383 This specifies the name of the target Nios II architecture. GCC
23384 uses this name to determine what kind of instructions it can emit
23385 when generating assembly code. Permissible names are: r1, r2.
23386
23387 The preprocessor macro "__nios2_arch__" is available to programs,
23388 with value 1 or 2, indicating the targeted ISA level.
23389
23390 -mbypass-cache
23391 -mno-bypass-cache
23392 Force all load and store instructions to always bypass cache by
23393 using I/O variants of the instructions. The default is not to
23394 bypass the cache.
23395
23396 -mno-cache-volatile
23397 -mcache-volatile
23398 Volatile memory access bypass the cache using the I/O variants of
23399 the load and store instructions. The default is not to bypass the
23400 cache.
23401
23402 -mno-fast-sw-div
23403 -mfast-sw-div
23404 Do not use table-based fast divide for small numbers. The default
23405 is to use the fast divide at -O3 and above.
23406
23407 -mno-hw-mul
23408 -mhw-mul
23409 -mno-hw-mulx
23410 -mhw-mulx
23411 -mno-hw-div
23412 -mhw-div
23413 Enable or disable emitting "mul", "mulx" and "div" family of
23414 instructions by the compiler. The default is to emit "mul" and not
23415 emit "div" and "mulx".
23416
23417 -mbmx
23418 -mno-bmx
23419 -mcdx
23420 -mno-cdx
23421 Enable or disable generation of Nios II R2 BMX (bit manipulation)
23422 and CDX (code density) instructions. Enabling these instructions
23423 also requires -march=r2. Since these instructions are optional
23424 extensions to the R2 architecture, the default is not to emit them.
23425
23426 -mcustom-insn=N
23427 -mno-custom-insn
23428 Each -mcustom-insn=N option enables use of a custom instruction
23429 with encoding N when generating code that uses insn. For example,
23430 -mcustom-fadds=253 generates custom instruction 253 for single-
23431 precision floating-point add operations instead of the default
23432 behavior of using a library call.
23433
23434 The following values of insn are supported. Except as otherwise
23435 noted, floating-point operations are expected to be implemented
23436 with normal IEEE 754 semantics and correspond directly to the C
23437 operators or the equivalent GCC built-in functions.
23438
23439 Single-precision floating point:
23440
23441 fadds, fsubs, fdivs, fmuls
23442 Binary arithmetic operations.
23443
23444 fnegs
23445 Unary negation.
23446
23447 fabss
23448 Unary absolute value.
23449
23450 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
23451 Comparison operations.
23452
23453 fmins, fmaxs
23454 Floating-point minimum and maximum. These instructions are
23455 only generated if -ffinite-math-only is specified.
23456
23457 fsqrts
23458 Unary square root operation.
23459
23460 fcoss, fsins, ftans, fatans, fexps, flogs
23461 Floating-point trigonometric and exponential functions. These
23462 instructions are only generated if -funsafe-math-optimizations
23463 is also specified.
23464
23465 Double-precision floating point:
23466
23467 faddd, fsubd, fdivd, fmuld
23468 Binary arithmetic operations.
23469
23470 fnegd
23471 Unary negation.
23472
23473 fabsd
23474 Unary absolute value.
23475
23476 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
23477 Comparison operations.
23478
23479 fmind, fmaxd
23480 Double-precision minimum and maximum. These instructions are
23481 only generated if -ffinite-math-only is specified.
23482
23483 fsqrtd
23484 Unary square root operation.
23485
23486 fcosd, fsind, ftand, fatand, fexpd, flogd
23487 Double-precision trigonometric and exponential functions.
23488 These instructions are only generated if
23489 -funsafe-math-optimizations is also specified.
23490
23491 Conversions:
23492
23493 fextsd
23494 Conversion from single precision to double precision.
23495
23496 ftruncds
23497 Conversion from double precision to single precision.
23498
23499 fixsi, fixsu, fixdi, fixdu
23500 Conversion from floating point to signed or unsigned integer
23501 types, with truncation towards zero.
23502
23503 round
23504 Conversion from single-precision floating point to signed
23505 integer, rounding to the nearest integer and ties away from
23506 zero. This corresponds to the "__builtin_lroundf" function
23507 when -fno-math-errno is used.
23508
23509 floatis, floatus, floatid, floatud
23510 Conversion from signed or unsigned integer types to floating-
23511 point types.
23512
23513 In addition, all of the following transfer instructions for
23514 internal registers X and Y must be provided to use any of the
23515 double-precision floating-point instructions. Custom instructions
23516 taking two double-precision source operands expect the first
23517 operand in the 64-bit register X. The other operand (or only
23518 operand of a unary operation) is given to the custom arithmetic
23519 instruction with the least significant half in source register src1
23520 and the most significant half in src2. A custom instruction that
23521 returns a double-precision result returns the most significant 32
23522 bits in the destination register and the other half in 32-bit
23523 register Y. GCC automatically generates the necessary code
23524 sequences to write register X and/or read register Y when double-
23525 precision floating-point instructions are used.
23526
23527 fwrx
23528 Write src1 into the least significant half of X and src2 into
23529 the most significant half of X.
23530
23531 fwry
23532 Write src1 into Y.
23533
23534 frdxhi, frdxlo
23535 Read the most or least (respectively) significant half of X and
23536 store it in dest.
23537
23538 frdy
23539 Read the value of Y and store it into dest.
23540
23541 Note that you can gain more local control over generation of Nios
23542 II custom instructions by using the "target("custom-insn=N")" and
23543 "target("no-custom-insn")" function attributes or pragmas.
23544
23545 -mcustom-fpu-cfg=name
23546 This option enables a predefined, named set of custom instruction
23547 encodings (see -mcustom-insn above). Currently, the following sets
23548 are defined:
23549
23550 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
23551 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
23552
23553 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
23554 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
23555 -fsingle-precision-constant
23556
23557 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
23558 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
23559 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
23560 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
23561 -mcustom-fdivs=255 -fsingle-precision-constant
23562
23563 -mcustom-fpu-cfg=fph2 is equivalent to: -mcustom-fabss=224
23564 -mcustom-fnegs=225 -mcustom-fcmpnes=226 -mcustom-fcmpeqs=227
23565 -mcustom-fcmpges=228 -mcustom-fcmpgts=229 -mcustom-fcmples=230
23566 -mcustom-fcmplts=231 -mcustom-fmaxs=232 -mcustom-fmins=233
23567 -mcustom-round=248 -mcustom-fixsi=249 -mcustom-floatis=250
23568 -mcustom-fsqrts=251 -mcustom-fmuls=252 -mcustom-fadds=253
23569 -mcustom-fsubs=254 -mcustom-fdivs=255
23570
23571 Custom instruction assignments given by individual -mcustom-insn=
23572 options override those given by -mcustom-fpu-cfg=, regardless of
23573 the order of the options on the command line.
23574
23575 Note that you can gain more local control over selection of a FPU
23576 configuration by using the "target("custom-fpu-cfg=name")" function
23577 attribute or pragma.
23578
23579 The name fph2 is an abbreviation for Nios II Floating Point
23580 Hardware 2 Component. Please note that the custom instructions
23581 enabled by -mcustom-fmins=233 and -mcustom-fmaxs=234 are only
23582 generated if -ffinite-math-only is specified. The custom
23583 instruction enabled by -mcustom-round=248 is only generated if
23584 -fno-math-errno is specified. In contrast to the other
23585 configurations, -fsingle-precision-constant is not set.
23586
23587 These additional -m options are available for the Altera Nios II ELF
23588 (bare-metal) target:
23589
23590 -mhal
23591 Link with HAL BSP. This suppresses linking with the GCC-provided C
23592 runtime startup and termination code, and is typically used in
23593 conjunction with -msys-crt0= to specify the location of the
23594 alternate startup code provided by the HAL BSP.
23595
23596 -msmallc
23597 Link with a limited version of the C library, -lsmallc, rather than
23598 Newlib.
23599
23600 -msys-crt0=startfile
23601 startfile is the file name of the startfile (crt0) to use when
23602 linking. This option is only useful in conjunction with -mhal.
23603
23604 -msys-lib=systemlib
23605 systemlib is the library name of the library that provides low-
23606 level system calls required by the C library, e.g. "read" and
23607 "write". This option is typically used to link with a library
23608 provided by a HAL BSP.
23609
23610 Nvidia PTX Options
23611 These options are defined for Nvidia PTX:
23612
23613 -m64
23614 Ignored, but preserved for backward compatibility. Only 64-bit ABI
23615 is supported.
23616
23617 -march=architecture-string
23618 Generate code for the specified PTX ISA target architecture (e.g.
23619 sm_35). Valid architecture strings are sm_30, sm_35, sm_53, sm_70,
23620 sm_75 and sm_80. The default target architecture is sm_30.
23621
23622 This option sets the value of the preprocessor macro "__PTX_SM__";
23623 for instance, for sm_35, it has the value 350.
23624
23625 -misa=architecture-string
23626 Alias of -march=.
23627
23628 -march-map=architecture-string
23629 Select the closest available -march= value that is not more
23630 capable. For instance, for -march-map=sm_50 select -march=sm_35,
23631 and for -march-map=sm_53 select -march=sm_53.
23632
23633 -mptx=version-string
23634 Generate code for the specified PTX ISA version (e.g. 7.0). Valid
23635 version strings include 3.1, 6.0, 6.3, and 7.0. The default PTX
23636 ISA version is 6.0, unless a higher version is required for
23637 specified PTX ISA target architecture via option -march=.
23638
23639 This option sets the values of the preprocessor macros
23640 "__PTX_ISA_VERSION_MAJOR__" and "__PTX_ISA_VERSION_MINOR__"; for
23641 instance, for 3.1 the macros have the values 3 and 1, respectively.
23642
23643 -mmainkernel
23644 Link in code for a __main kernel. This is for stand-alone instead
23645 of offloading execution.
23646
23647 -moptimize
23648 Apply partitioned execution optimizations. This is the default
23649 when any level of optimization is selected.
23650
23651 -msoft-stack
23652 Generate code that does not use ".local" memory directly for stack
23653 storage. Instead, a per-warp stack pointer is maintained
23654 explicitly. This enables variable-length stack allocation (with
23655 variable-length arrays or "alloca"), and when global memory is used
23656 for underlying storage, makes it possible to access automatic
23657 variables from other threads, or with atomic instructions. This
23658 code generation variant is used for OpenMP offloading, but the
23659 option is exposed on its own for the purpose of testing the
23660 compiler; to generate code suitable for linking into programs using
23661 OpenMP offloading, use option -mgomp.
23662
23663 -muniform-simt
23664 Switch to code generation variant that allows to execute all
23665 threads in each warp, while maintaining memory state and side
23666 effects as if only one thread in each warp was active outside of
23667 OpenMP SIMD regions. All atomic operations and calls to runtime
23668 (malloc, free, vprintf) are conditionally executed (iff current
23669 lane index equals the master lane index), and the register being
23670 assigned is copied via a shuffle instruction from the master lane.
23671 Outside of SIMD regions lane 0 is the master; inside, each thread
23672 sees itself as the master. Shared memory array "int __nvptx_uni[]"
23673 stores all-zeros or all-ones bitmasks for each warp, indicating
23674 current mode (0 outside of SIMD regions). Each thread can bitwise-
23675 and the bitmask at position "tid.y" with current lane index to
23676 compute the master lane index.
23677
23678 -mgomp
23679 Generate code for use in OpenMP offloading: enables -msoft-stack
23680 and -muniform-simt options, and selects corresponding multilib
23681 variant.
23682
23683 OpenRISC Options
23684 These options are defined for OpenRISC:
23685
23686 -mboard=name
23687 Configure a board specific runtime. This will be passed to the
23688 linker for newlib board library linking. The default is "or1ksim".
23689
23690 -mnewlib
23691 This option is ignored; it is for compatibility purposes only.
23692 This used to select linker and preprocessor options for use with
23693 newlib.
23694
23695 -msoft-div
23696 -mhard-div
23697 Select software or hardware divide ("l.div", "l.divu")
23698 instructions. This default is hardware divide.
23699
23700 -msoft-mul
23701 -mhard-mul
23702 Select software or hardware multiply ("l.mul", "l.muli")
23703 instructions. This default is hardware multiply.
23704
23705 -msoft-float
23706 -mhard-float
23707 Select software or hardware for floating point operations. The
23708 default is software.
23709
23710 -mdouble-float
23711 When -mhard-float is selected, enables generation of double-
23712 precision floating point instructions. By default functions from
23713 libgcc are used to perform double-precision floating point
23714 operations.
23715
23716 -munordered-float
23717 When -mhard-float is selected, enables generation of unordered
23718 floating point compare and set flag ("lf.sfun*") instructions. By
23719 default functions from libgcc are used to perform unordered
23720 floating point compare and set flag operations.
23721
23722 -mcmov
23723 Enable generation of conditional move ("l.cmov") instructions. By
23724 default the equivalent will be generated using set and branch.
23725
23726 -mror
23727 Enable generation of rotate right ("l.ror") instructions. By
23728 default functions from libgcc are used to perform rotate right
23729 operations.
23730
23731 -mrori
23732 Enable generation of rotate right with immediate ("l.rori")
23733 instructions. By default functions from libgcc are used to perform
23734 rotate right with immediate operations.
23735
23736 -msext
23737 Enable generation of sign extension ("l.ext*") instructions. By
23738 default memory loads are used to perform sign extension.
23739
23740 -msfimm
23741 Enable generation of compare and set flag with immediate ("l.sf*i")
23742 instructions. By default extra instructions will be generated to
23743 store the immediate to a register first.
23744
23745 -mshftimm
23746 Enable generation of shift with immediate ("l.srai", "l.srli",
23747 "l.slli") instructions. By default extra instructions will be
23748 generated to store the immediate to a register first.
23749
23750 -mcmodel=small
23751 Generate OpenRISC code for the small model: The GOT is limited to
23752 64k. This is the default model.
23753
23754 -mcmodel=large
23755 Generate OpenRISC code for the large model: The GOT may grow up to
23756 4G in size.
23757
23758 PDP-11 Options
23759 These options are defined for the PDP-11:
23760
23761 -mfpu
23762 Use hardware FPP floating point. This is the default. (FIS
23763 floating point on the PDP-11/40 is not supported.) Implies -m45.
23764
23765 -msoft-float
23766 Do not use hardware floating point.
23767
23768 -mac0
23769 Return floating-point results in ac0 (fr0 in Unix assembler
23770 syntax).
23771
23772 -mno-ac0
23773 Return floating-point results in memory. This is the default.
23774
23775 -m40
23776 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23777
23778 -m45
23779 Generate code for a PDP-11/45. This is the default.
23780
23781 -m10
23782 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23783
23784 -mint16
23785 -mno-int32
23786 Use 16-bit "int". This is the default.
23787
23788 -mint32
23789 -mno-int16
23790 Use 32-bit "int".
23791
23792 -msplit
23793 Target has split instruction and data space. Implies -m45.
23794
23795 -munix-asm
23796 Use Unix assembler syntax.
23797
23798 -mdec-asm
23799 Use DEC assembler syntax.
23800
23801 -mgnu-asm
23802 Use GNU assembler syntax. This is the default.
23803
23804 -mlra
23805 Use the new LRA register allocator. By default, the old "reload"
23806 allocator is used.
23807
23808 picoChip Options
23809 These -m options are defined for picoChip implementations:
23810
23811 -mae=ae_type
23812 Set the instruction set, register set, and instruction scheduling
23813 parameters for array element type ae_type. Supported values for
23814 ae_type are ANY, MUL, and MAC.
23815
23816 -mae=ANY selects a completely generic AE type. Code generated with
23817 this option runs on any of the other AE types. The code is not as
23818 efficient as it would be if compiled for a specific AE type, and
23819 some types of operation (e.g., multiplication) do not work properly
23820 on all types of AE.
23821
23822 -mae=MUL selects a MUL AE type. This is the most useful AE type
23823 for compiled code, and is the default.
23824
23825 -mae=MAC selects a DSP-style MAC AE. Code compiled with this
23826 option may suffer from poor performance of byte (char)
23827 manipulation, since the DSP AE does not provide hardware support
23828 for byte load/stores.
23829
23830 -msymbol-as-address
23831 Enable the compiler to directly use a symbol name as an address in
23832 a load/store instruction, without first loading it into a register.
23833 Typically, the use of this option generates larger programs, which
23834 run faster than when the option isn't used. However, the results
23835 vary from program to program, so it is left as a user option,
23836 rather than being permanently enabled.
23837
23838 -mno-inefficient-warnings
23839 Disables warnings about the generation of inefficient code. These
23840 warnings can be generated, for example, when compiling code that
23841 performs byte-level memory operations on the MAC AE type. The MAC
23842 AE has no hardware support for byte-level memory operations, so all
23843 byte load/stores must be synthesized from word load/store
23844 operations. This is inefficient and a warning is generated to
23845 indicate that you should rewrite the code to avoid byte operations,
23846 or to target an AE type that has the necessary hardware support.
23847 This option disables these warnings.
23848
23849 PowerPC Options
23850 These are listed under
23851
23852 PRU Options
23853 These command-line options are defined for PRU target:
23854
23855 -minrt
23856 Link with a minimum runtime environment, with no support for static
23857 initializers and constructors. Using this option can significantly
23858 reduce the size of the final ELF binary. Beware that the compiler
23859 could still generate code with static initializers and
23860 constructors. It is up to the programmer to ensure that the source
23861 program will not use those features.
23862
23863 -mmcu=mcu
23864 Specify the PRU MCU variant to use. Check Newlib for the exact
23865 list of supported MCUs.
23866
23867 -mno-relax
23868 Make GCC pass the --no-relax command-line option to the linker
23869 instead of the --relax option.
23870
23871 -mloop
23872 Allow (or do not allow) GCC to use the LOOP instruction.
23873
23874 -mabi=variant
23875 Specify the ABI variant to output code for. -mabi=ti selects the
23876 unmodified TI ABI while -mabi=gnu selects a GNU variant that copes
23877 more naturally with certain GCC assumptions. These are the
23878 differences:
23879
23880 Function Pointer Size
23881 TI ABI specifies that function (code) pointers are 16-bit,
23882 whereas GNU supports only 32-bit data and code pointers.
23883
23884 Optional Return Value Pointer
23885 Function return values larger than 64 bits are passed by using
23886 a hidden pointer as the first argument of the function. TI
23887 ABI, though, mandates that the pointer can be NULL in case the
23888 caller is not using the returned value. GNU always passes and
23889 expects a valid return value pointer.
23890
23891 The current -mabi=ti implementation simply raises a compile error
23892 when any of the above code constructs is detected. As a
23893 consequence the standard C library cannot be built and it is
23894 omitted when linking with -mabi=ti.
23895
23896 Relaxation is a GNU feature and for safety reasons is disabled when
23897 using -mabi=ti. The TI toolchain does not emit relocations for
23898 QBBx instructions, so the GNU linker cannot adjust them when
23899 shortening adjacent LDI32 pseudo instructions.
23900
23901 RISC-V Options
23902 These command-line options are defined for RISC-V targets:
23903
23904 -mbranch-cost=n
23905 Set the cost of branches to roughly n instructions.
23906
23907 -mplt
23908 -mno-plt
23909 When generating PIC code, do or don't allow the use of PLTs.
23910 Ignored for non-PIC. The default is -mplt.
23911
23912 -mabi=ABI-string
23913 Specify integer and floating-point calling convention. ABI-string
23914 contains two parts: the size of integer types and the registers
23915 used for floating-point types. For example -march=rv64ifd
23916 -mabi=lp64d means that long and pointers are 64-bit (implicitly
23917 defining int to be 32-bit), and that floating-point values up to 64
23918 bits wide are passed in F registers. Contrast this with
23919 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
23920 generate code that uses the F and D extensions but only allows
23921 floating-point values up to 32 bits long to be passed in registers;
23922 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
23923 will be passed in registers.
23924
23925 The default for this argument is system dependent, users who want a
23926 specific calling convention should specify one explicitly. The
23927 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
23928 and lp64d. Some calling conventions are impossible to implement on
23929 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
23930 because the ABI requires 64-bit values be passed in F registers,
23931 but F registers are only 32 bits wide. There is also the ilp32e
23932 ABI that can only be used with the rv32e architecture. This ABI is
23933 not well specified at present, and is subject to change.
23934
23935 -mfdiv
23936 -mno-fdiv
23937 Do or don't use hardware floating-point divide and square root
23938 instructions. This requires the F or D extensions for floating-
23939 point registers. The default is to use them if the specified
23940 architecture has these instructions.
23941
23942 -mdiv
23943 -mno-div
23944 Do or don't use hardware instructions for integer division. This
23945 requires the M extension. The default is to use them if the
23946 specified architecture has these instructions.
23947
23948 -misa-spec=ISA-spec-string
23949 Specify the version of the RISC-V Unprivileged (formerly User-
23950 Level) ISA specification to produce code conforming to. The
23951 possibilities for ISA-spec-string are:
23952
23953 2.2 Produce code conforming to version 2.2.
23954
23955 20190608
23956 Produce code conforming to version 20190608.
23957
23958 20191213
23959 Produce code conforming to version 20191213.
23960
23961 The default is -misa-spec=20191213 unless GCC has been configured
23962 with --with-isa-spec= specifying a different default version.
23963
23964 -march=ISA-string
23965 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
23966 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
23967
23968 When -march= is not specified, use the setting from -mcpu.
23969
23970 If both -march and -mcpu= are not specified, the default for this
23971 argument is system dependent, users who want a specific
23972 architecture extensions should specify one explicitly.
23973
23974 -mcpu=processor-string
23975 Use architecture of and optimize the output for the given
23976 processor, specified by particular CPU name. Permissible values
23977 for this option are: sifive-e20, sifive-e21, sifive-e24,
23978 sifive-e31, sifive-e34, sifive-e76, sifive-s21, sifive-s51,
23979 sifive-s54, sifive-s76, sifive-u54, and sifive-u74.
23980
23981 -mtune=processor-string
23982 Optimize the output for the given processor, specified by
23983 microarchitecture or particular CPU name. Permissible values for
23984 this option are: rocket, sifive-3-series, sifive-5-series,
23985 sifive-7-series, size, and all valid options for -mcpu=.
23986
23987 When -mtune= is not specified, use the setting from -mcpu, the
23988 default is rocket if both are not specified.
23989
23990 The size choice is not intended for use by end-users. This is used
23991 when -Os is specified. It overrides the instruction cost info
23992 provided by -mtune=, but does not override the pipeline info. This
23993 helps reduce code size while still giving good performance.
23994
23995 -mpreferred-stack-boundary=num
23996 Attempt to keep the stack boundary aligned to a 2 raised to num
23997 byte boundary. If -mpreferred-stack-boundary is not specified, the
23998 default is 4 (16 bytes or 128-bits).
23999
24000 Warning: If you use this switch, then you must build all modules
24001 with the same value, including any libraries. This includes the
24002 system libraries and startup modules.
24003
24004 -msmall-data-limit=n
24005 Put global and static data smaller than n bytes into a special
24006 section (on some targets).
24007
24008 -msave-restore
24009 -mno-save-restore
24010 Do or don't use smaller but slower prologue and epilogue code that
24011 uses library function calls. The default is to use fast inline
24012 prologues and epilogues.
24013
24014 -mshorten-memrefs
24015 -mno-shorten-memrefs
24016 Do or do not attempt to make more use of compressed load/store
24017 instructions by replacing a load/store of 'base register + large
24018 offset' with a new load/store of 'new base + small offset'. If the
24019 new base gets stored in a compressed register, then the new
24020 load/store can be compressed. Currently targets 32-bit integer
24021 load/stores only.
24022
24023 -mstrict-align
24024 -mno-strict-align
24025 Do not or do generate unaligned memory accesses. The default is
24026 set depending on whether the processor we are optimizing for
24027 supports fast unaligned access or not.
24028
24029 -mcmodel=medlow
24030 Generate code for the medium-low code model. The program and its
24031 statically defined symbols must lie within a single 2 GiB address
24032 range and must lie between absolute addresses -2 GiB and +2 GiB.
24033 Programs can be statically or dynamically linked. This is the
24034 default code model.
24035
24036 -mcmodel=medany
24037 Generate code for the medium-any code model. The program and its
24038 statically defined symbols must be within any single 2 GiB address
24039 range. Programs can be statically or dynamically linked.
24040
24041 The code generated by the medium-any code model is position-
24042 independent, but is not guaranteed to function correctly when
24043 linked into position-independent executables or libraries.
24044
24045 -mexplicit-relocs
24046 -mno-exlicit-relocs
24047 Use or do not use assembler relocation operators when dealing with
24048 symbolic addresses. The alternative is to use assembler macros
24049 instead, which may limit optimization.
24050
24051 -mrelax
24052 -mno-relax
24053 Take advantage of linker relaxations to reduce the number of
24054 instructions required to materialize symbol addresses. The default
24055 is to take advantage of linker relaxations.
24056
24057 -memit-attribute
24058 -mno-emit-attribute
24059 Emit (do not emit) RISC-V attribute to record extra information
24060 into ELF objects. This feature requires at least binutils 2.32.
24061
24062 -malign-data=type
24063 Control how GCC aligns variables and constants of array, structure,
24064 or union types. Supported values for type are xlen which uses x
24065 register width as the alignment value, and natural which uses
24066 natural alignment. xlen is the default.
24067
24068 -mbig-endian
24069 Generate big-endian code. This is the default when GCC is
24070 configured for a riscv64be-*-* or riscv32be-*-* target.
24071
24072 -mlittle-endian
24073 Generate little-endian code. This is the default when GCC is
24074 configured for a riscv64-*-* or riscv32-*-* but not a riscv64be-*-*
24075 or riscv32be-*-* target.
24076
24077 -mstack-protector-guard=guard
24078 -mstack-protector-guard-reg=reg
24079 -mstack-protector-guard-offset=offset
24080 Generate stack protection code using canary at guard. Supported
24081 locations are global for a global canary or tls for per-thread
24082 canary in the TLS block.
24083
24084 With the latter choice the options -mstack-protector-guard-reg=reg
24085 and -mstack-protector-guard-offset=offset furthermore specify which
24086 register to use as base register for reading the canary, and from
24087 what offset from that base register. There is no default register
24088 or offset as this is entirely for use within the Linux kernel.
24089
24090 RL78 Options
24091 -msim
24092 Links in additional target libraries to support operation within a
24093 simulator.
24094
24095 -mmul=none
24096 -mmul=g10
24097 -mmul=g13
24098 -mmul=g14
24099 -mmul=rl78
24100 Specifies the type of hardware multiplication and division support
24101 to be used. The simplest is "none", which uses software for both
24102 multiplication and division. This is the default. The "g13" value
24103 is for the hardware multiply/divide peripheral found on the
24104 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
24105 multiplication and division instructions supported by the RL78/G14
24106 (S3 core) parts. The value "rl78" is an alias for "g14" and the
24107 value "mg10" is an alias for "none".
24108
24109 In addition a C preprocessor macro is defined, based upon the
24110 setting of this option. Possible values are: "__RL78_MUL_NONE__",
24111 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
24112
24113 -mcpu=g10
24114 -mcpu=g13
24115 -mcpu=g14
24116 -mcpu=rl78
24117 Specifies the RL78 core to target. The default is the G14 core,
24118 also known as an S3 core or just RL78. The G13 or S2 core does not
24119 have multiply or divide instructions, instead it uses a hardware
24120 peripheral for these operations. The G10 or S1 core does not have
24121 register banks, so it uses a different calling convention.
24122
24123 If this option is set it also selects the type of hardware multiply
24124 support to use, unless this is overridden by an explicit -mmul=none
24125 option on the command line. Thus specifying -mcpu=g13 enables the
24126 use of the G13 hardware multiply peripheral and specifying
24127 -mcpu=g10 disables the use of hardware multiplications altogether.
24128
24129 Note, although the RL78/G14 core is the default target, specifying
24130 -mcpu=g14 or -mcpu=rl78 on the command line does change the
24131 behavior of the toolchain since it also enables G14 hardware
24132 multiply support. If these options are not specified on the
24133 command line then software multiplication routines will be used
24134 even though the code targets the RL78 core. This is for backwards
24135 compatibility with older toolchains which did not have hardware
24136 multiply and divide support.
24137
24138 In addition a C preprocessor macro is defined, based upon the
24139 setting of this option. Possible values are: "__RL78_G10__",
24140 "__RL78_G13__" or "__RL78_G14__".
24141
24142 -mg10
24143 -mg13
24144 -mg14
24145 -mrl78
24146 These are aliases for the corresponding -mcpu= option. They are
24147 provided for backwards compatibility.
24148
24149 -mallregs
24150 Allow the compiler to use all of the available registers. By
24151 default registers "r24..r31" are reserved for use in interrupt
24152 handlers. With this option enabled these registers can be used in
24153 ordinary functions as well.
24154
24155 -m64bit-doubles
24156 -m32bit-doubles
24157 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
24158 (-m32bit-doubles) in size. The default is -m32bit-doubles.
24159
24160 -msave-mduc-in-interrupts
24161 -mno-save-mduc-in-interrupts
24162 Specifies that interrupt handler functions should preserve the MDUC
24163 registers. This is only necessary if normal code might use the
24164 MDUC registers, for example because it performs multiplication and
24165 division operations. The default is to ignore the MDUC registers
24166 as this makes the interrupt handlers faster. The target option
24167 -mg13 needs to be passed for this to work as this feature is only
24168 available on the G13 target (S2 core). The MDUC registers will
24169 only be saved if the interrupt handler performs a multiplication or
24170 division operation or it calls another function.
24171
24172 IBM RS/6000 and PowerPC Options
24173 These -m options are defined for the IBM RS/6000 and PowerPC:
24174
24175 -mpowerpc-gpopt
24176 -mno-powerpc-gpopt
24177 -mpowerpc-gfxopt
24178 -mno-powerpc-gfxopt
24179 -mpowerpc64
24180 -mno-powerpc64
24181 -mmfcrf
24182 -mno-mfcrf
24183 -mpopcntb
24184 -mno-popcntb
24185 -mpopcntd
24186 -mno-popcntd
24187 -mfprnd
24188 -mno-fprnd
24189 -mcmpb
24190 -mno-cmpb
24191 -mhard-dfp
24192 -mno-hard-dfp
24193 You use these options to specify which instructions are available
24194 on the processor you are using. The default value of these options
24195 is determined when configuring GCC. Specifying the -mcpu=cpu_type
24196 overrides the specification of these options. We recommend you use
24197 the -mcpu=cpu_type option rather than the options listed above.
24198
24199 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
24200 architecture instructions in the General Purpose group, including
24201 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
24202 to use the optional PowerPC architecture instructions in the
24203 Graphics group, including floating-point select.
24204
24205 The -mmfcrf option allows GCC to generate the move from condition
24206 register field instruction implemented on the POWER4 processor and
24207 other processors that support the PowerPC V2.01 architecture. The
24208 -mpopcntb option allows GCC to generate the popcount and double-
24209 precision FP reciprocal estimate instruction implemented on the
24210 POWER5 processor and other processors that support the PowerPC
24211 V2.02 architecture. The -mpopcntd option allows GCC to generate
24212 the popcount instruction implemented on the POWER7 processor and
24213 other processors that support the PowerPC V2.06 architecture. The
24214 -mfprnd option allows GCC to generate the FP round to integer
24215 instructions implemented on the POWER5+ processor and other
24216 processors that support the PowerPC V2.03 architecture. The -mcmpb
24217 option allows GCC to generate the compare bytes instruction
24218 implemented on the POWER6 processor and other processors that
24219 support the PowerPC V2.05 architecture. The -mhard-dfp option
24220 allows GCC to generate the decimal floating-point instructions
24221 implemented on some POWER processors.
24222
24223 The -mpowerpc64 option allows GCC to generate the additional 64-bit
24224 instructions that are found in the full PowerPC64 architecture and
24225 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24226 -mno-powerpc64.
24227
24228 -mcpu=cpu_type
24229 Set architecture type, register usage, and instruction scheduling
24230 parameters for machine type cpu_type. Supported values for
24231 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
24232 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
24233 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
24234 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
24235 power4, power5, power5+, power6, power6x, power7, power8, power9,
24236 power10, powerpc, powerpc64, powerpc64le, rs64, and native.
24237
24238 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
24239 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
24240 64-bit little endian PowerPC architecture machine types, with an
24241 appropriate, generic processor model assumed for scheduling
24242 purposes.
24243
24244 Specifying native as cpu type detects and selects the architecture
24245 option that corresponds to the host processor of the system
24246 performing the compilation. -mcpu=native has no effect if GCC does
24247 not recognize the processor.
24248
24249 The other options specify a specific processor. Code generated
24250 under those options runs best on that processor, and may not run at
24251 all on others.
24252
24253 The -mcpu options automatically enable or disable the following
24254 options:
24255
24256 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
24257 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
24258 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
24259 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
24260 -mfloat128-hardware -mprefixed -mpcrel -mmma -mrop-protect
24261
24262 The particular options set for any particular CPU varies between
24263 compiler versions, depending on what setting seems to produce
24264 optimal code for that CPU; it doesn't necessarily reflect the
24265 actual hardware's capabilities. If you wish to set an individual
24266 option to a particular value, you may specify it after the -mcpu
24267 option, like -mcpu=970 -mno-altivec.
24268
24269 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
24270 disabled by the -mcpu option at present because AIX does not have
24271 full support for these options. You may still enable or disable
24272 them individually if you're sure it'll work in your environment.
24273
24274 -mtune=cpu_type
24275 Set the instruction scheduling parameters for machine type
24276 cpu_type, but do not set the architecture type or register usage,
24277 as -mcpu=cpu_type does. The same values for cpu_type are used for
24278 -mtune as for -mcpu. If both are specified, the code generated
24279 uses the architecture and registers set by -mcpu, but the
24280 scheduling parameters set by -mtune.
24281
24282 -mcmodel=small
24283 Generate PowerPC64 code for the small model: The TOC is limited to
24284 64k.
24285
24286 -mcmodel=medium
24287 Generate PowerPC64 code for the medium model: The TOC and other
24288 static data may be up to a total of 4G in size. This is the
24289 default for 64-bit Linux.
24290
24291 -mcmodel=large
24292 Generate PowerPC64 code for the large model: The TOC may be up to
24293 4G in size. Other data and code is only limited by the 64-bit
24294 address space.
24295
24296 -maltivec
24297 -mno-altivec
24298 Generate code that uses (does not use) AltiVec instructions, and
24299 also enable the use of built-in functions that allow more direct
24300 access to the AltiVec instruction set. You may also need to set
24301 -mabi=altivec to adjust the current ABI with AltiVec ABI
24302 enhancements.
24303
24304 When -maltivec is used, the element order for AltiVec intrinsics
24305 such as "vec_splat", "vec_extract", and "vec_insert" match array
24306 element order corresponding to the endianness of the target. That
24307 is, element zero identifies the leftmost element in a vector
24308 register when targeting a big-endian platform, and identifies the
24309 rightmost element in a vector register when targeting a little-
24310 endian platform.
24311
24312 -mvrsave
24313 -mno-vrsave
24314 Generate VRSAVE instructions when generating AltiVec code.
24315
24316 -msecure-plt
24317 Generate code that allows ld and ld.so to build executables and
24318 shared libraries with non-executable ".plt" and ".got" sections.
24319 This is a PowerPC 32-bit SYSV ABI option.
24320
24321 -mbss-plt
24322 Generate code that uses a BSS ".plt" section that ld.so fills in,
24323 and requires ".plt" and ".got" sections that are both writable and
24324 executable. This is a PowerPC 32-bit SYSV ABI option.
24325
24326 -misel
24327 -mno-isel
24328 This switch enables or disables the generation of ISEL
24329 instructions.
24330
24331 -mvsx
24332 -mno-vsx
24333 Generate code that uses (does not use) vector/scalar (VSX)
24334 instructions, and also enable the use of built-in functions that
24335 allow more direct access to the VSX instruction set.
24336
24337 -mcrypto
24338 -mno-crypto
24339 Enable the use (disable) of the built-in functions that allow
24340 direct access to the cryptographic instructions that were added in
24341 version 2.07 of the PowerPC ISA.
24342
24343 -mhtm
24344 -mno-htm
24345 Enable (disable) the use of the built-in functions that allow
24346 direct access to the Hardware Transactional Memory (HTM)
24347 instructions that were added in version 2.07 of the PowerPC ISA.
24348
24349 -mpower8-fusion
24350 -mno-power8-fusion
24351 Generate code that keeps (does not keeps) some integer operations
24352 adjacent so that the instructions can be fused together on power8
24353 and later processors.
24354
24355 -mpower8-vector
24356 -mno-power8-vector
24357 Generate code that uses (does not use) the vector and scalar
24358 instructions that were added in version 2.07 of the PowerPC ISA.
24359 Also enable the use of built-in functions that allow more direct
24360 access to the vector instructions.
24361
24362 -mquad-memory
24363 -mno-quad-memory
24364 Generate code that uses (does not use) the non-atomic quad word
24365 memory instructions. The -mquad-memory option requires use of
24366 64-bit mode.
24367
24368 -mquad-memory-atomic
24369 -mno-quad-memory-atomic
24370 Generate code that uses (does not use) the atomic quad word memory
24371 instructions. The -mquad-memory-atomic option requires use of
24372 64-bit mode.
24373
24374 -mfloat128
24375 -mno-float128
24376 Enable/disable the __float128 keyword for IEEE 128-bit floating
24377 point and use either software emulation for IEEE 128-bit floating
24378 point or hardware instructions.
24379
24380 The VSX instruction set (-mvsx) must be enabled to use the IEEE
24381 128-bit floating point support. The IEEE 128-bit floating point is
24382 only supported on Linux.
24383
24384 The default for -mfloat128 is enabled on PowerPC Linux systems
24385 using the VSX instruction set, and disabled on other systems.
24386
24387 If you use the ISA 3.0 instruction set (-mpower9-vector or
24388 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
24389 support will also enable the generation of ISA 3.0 IEEE 128-bit
24390 floating point instructions. Otherwise, if you do not specify to
24391 generate ISA 3.0 instructions or you are targeting a 32-bit big
24392 endian system, IEEE 128-bit floating point will be done with
24393 software emulation.
24394
24395 -mfloat128-hardware
24396 -mno-float128-hardware
24397 Enable/disable using ISA 3.0 hardware instructions to support the
24398 __float128 data type.
24399
24400 The default for -mfloat128-hardware is enabled on PowerPC Linux
24401 systems using the ISA 3.0 instruction set, and disabled on other
24402 systems.
24403
24404 -m32
24405 -m64
24406 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24407 targets (including GNU/Linux). The 32-bit environment sets int,
24408 long and pointer to 32 bits and generates code that runs on any
24409 PowerPC variant. The 64-bit environment sets int to 32 bits and
24410 long and pointer to 64 bits, and generates code for PowerPC64, as
24411 for -mpowerpc64.
24412
24413 -mfull-toc
24414 -mno-fp-in-toc
24415 -mno-sum-in-toc
24416 -mminimal-toc
24417 Modify generation of the TOC (Table Of Contents), which is created
24418 for every executable file. The -mfull-toc option is selected by
24419 default. In that case, GCC allocates at least one TOC entry for
24420 each unique non-automatic variable reference in your program. GCC
24421 also places floating-point constants in the TOC. However, only
24422 16,384 entries are available in the TOC.
24423
24424 If you receive a linker error message that saying you have
24425 overflowed the available TOC space, you can reduce the amount of
24426 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
24427 -mno-fp-in-toc prevents GCC from putting floating-point constants
24428 in the TOC and -mno-sum-in-toc forces GCC to generate code to
24429 calculate the sum of an address and a constant at run time instead
24430 of putting that sum into the TOC. You may specify one or both of
24431 these options. Each causes GCC to produce very slightly slower and
24432 larger code at the expense of conserving TOC space.
24433
24434 If you still run out of space in the TOC even when you specify both
24435 of these options, specify -mminimal-toc instead. This option
24436 causes GCC to make only one TOC entry for every file. When you
24437 specify this option, GCC produces code that is slower and larger
24438 but which uses extremely little TOC space. You may wish to use
24439 this option only on files that contain less frequently-executed
24440 code.
24441
24442 -maix64
24443 -maix32
24444 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
24445 64-bit "long" type, and the infrastructure needed to support them.
24446 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
24447 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
24448
24449 -mxl-compat
24450 -mno-xl-compat
24451 Produce code that conforms more closely to IBM XL compiler
24452 semantics when using AIX-compatible ABI. Pass floating-point
24453 arguments to prototyped functions beyond the register save area
24454 (RSA) on the stack in addition to argument FPRs. Do not assume
24455 that most significant double in 128-bit long double value is
24456 properly rounded when comparing values and converting to double.
24457 Use XL symbol names for long double support routines.
24458
24459 The AIX calling convention was extended but not initially
24460 documented to handle an obscure K&R C case of calling a function
24461 that takes the address of its arguments with fewer arguments than
24462 declared. IBM XL compilers access floating-point arguments that do
24463 not fit in the RSA from the stack when a subroutine is compiled
24464 without optimization. Because always storing floating-point
24465 arguments on the stack is inefficient and rarely needed, this
24466 option is not enabled by default and only is necessary when calling
24467 subroutines compiled by IBM XL compilers without optimization.
24468
24469 -mpe
24470 Support IBM RS/6000 SP Parallel Environment (PE). Link an
24471 application written to use message passing with special startup
24472 code to enable the application to run. The system must have PE
24473 installed in the standard location (/usr/lpp/ppe.poe/), or the
24474 specs file must be overridden with the -specs= option to specify
24475 the appropriate directory location. The Parallel Environment does
24476 not support threads, so the -mpe option and the -pthread option are
24477 incompatible.
24478
24479 -malign-natural
24480 -malign-power
24481 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24482 -malign-natural overrides the ABI-defined alignment of larger
24483 types, such as floating-point doubles, on their natural size-based
24484 boundary. The option -malign-power instructs GCC to follow the
24485 ABI-specified alignment rules. GCC defaults to the standard
24486 alignment defined in the ABI.
24487
24488 On 64-bit Darwin, natural alignment is the default, and
24489 -malign-power is not supported.
24490
24491 -msoft-float
24492 -mhard-float
24493 Generate code that does not use (uses) the floating-point register
24494 set. Software floating-point emulation is provided if you use the
24495 -msoft-float option, and pass the option to GCC when linking.
24496
24497 -mmultiple
24498 -mno-multiple
24499 Generate code that uses (does not use) the load multiple word
24500 instructions and the store multiple word instructions. These
24501 instructions are generated by default on POWER systems, and not
24502 generated on PowerPC systems. Do not use -mmultiple on little-
24503 endian PowerPC systems, since those instructions do not work when
24504 the processor is in little-endian mode. The exceptions are PPC740
24505 and PPC750 which permit these instructions in little-endian mode.
24506
24507 -mupdate
24508 -mno-update
24509 Generate code that uses (does not use) the load or store
24510 instructions that update the base register to the address of the
24511 calculated memory location. These instructions are generated by
24512 default. If you use -mno-update, there is a small window between
24513 the time that the stack pointer is updated and the address of the
24514 previous frame is stored, which means code that walks the stack
24515 frame across interrupts or signals may get corrupted data.
24516
24517 -mavoid-indexed-addresses
24518 -mno-avoid-indexed-addresses
24519 Generate code that tries to avoid (not avoid) the use of indexed
24520 load or store instructions. These instructions can incur a
24521 performance penalty on Power6 processors in certain situations,
24522 such as when stepping through large arrays that cross a 16M
24523 boundary. This option is enabled by default when targeting Power6
24524 and disabled otherwise.
24525
24526 -mfused-madd
24527 -mno-fused-madd
24528 Generate code that uses (does not use) the floating-point multiply
24529 and accumulate instructions. These instructions are generated by
24530 default if hardware floating point is used. The machine-dependent
24531 -mfused-madd option is now mapped to the machine-independent
24532 -ffp-contract=fast option, and -mno-fused-madd is mapped to
24533 -ffp-contract=off.
24534
24535 -mmulhw
24536 -mno-mulhw
24537 Generate code that uses (does not use) the half-word multiply and
24538 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
24539 processors. These instructions are generated by default when
24540 targeting those processors.
24541
24542 -mdlmzb
24543 -mno-dlmzb
24544 Generate code that uses (does not use) the string-search dlmzb
24545 instruction on the IBM 405, 440, 464 and 476 processors. This
24546 instruction is generated by default when targeting those
24547 processors.
24548
24549 -mno-bit-align
24550 -mbit-align
24551 On System V.4 and embedded PowerPC systems do not (do) force
24552 structures and unions that contain bit-fields to be aligned to the
24553 base type of the bit-field.
24554
24555 For example, by default a structure containing nothing but 8
24556 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
24557 and has a size of 4 bytes. By using -mno-bit-align, the structure
24558 is aligned to a 1-byte boundary and is 1 byte in size.
24559
24560 -mno-strict-align
24561 -mstrict-align
24562 On System V.4 and embedded PowerPC systems do not (do) assume that
24563 unaligned memory references are handled by the system.
24564
24565 -mrelocatable
24566 -mno-relocatable
24567 Generate code that allows (does not allow) a static executable to
24568 be relocated to a different address at run time. A simple embedded
24569 PowerPC system loader should relocate the entire contents of
24570 ".got2" and 4-byte locations listed in the ".fixup" section, a
24571 table of 32-bit addresses generated by this option. For this to
24572 work, all objects linked together must be compiled with
24573 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
24574 stack to an 8-byte boundary.
24575
24576 -mrelocatable-lib
24577 -mno-relocatable-lib
24578 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
24579 to allow static executables to be relocated at run time, but
24580 -mrelocatable-lib does not use the smaller stack alignment of
24581 -mrelocatable. Objects compiled with -mrelocatable-lib may be
24582 linked with objects compiled with any combination of the
24583 -mrelocatable options.
24584
24585 -mno-toc
24586 -mtoc
24587 On System V.4 and embedded PowerPC systems do not (do) assume that
24588 register 2 contains a pointer to a global area pointing to the
24589 addresses used in the program.
24590
24591 -mlittle
24592 -mlittle-endian
24593 On System V.4 and embedded PowerPC systems compile code for the
24594 processor in little-endian mode. The -mlittle-endian option is the
24595 same as -mlittle.
24596
24597 -mbig
24598 -mbig-endian
24599 On System V.4 and embedded PowerPC systems compile code for the
24600 processor in big-endian mode. The -mbig-endian option is the same
24601 as -mbig.
24602
24603 -mdynamic-no-pic
24604 On Darwin and Mac OS X systems, compile code so that it is not
24605 relocatable, but that its external references are relocatable. The
24606 resulting code is suitable for applications, but not shared
24607 libraries.
24608
24609 -msingle-pic-base
24610 Treat the register used for PIC addressing as read-only, rather
24611 than loading it in the prologue for each function. The runtime
24612 system is responsible for initializing this register with an
24613 appropriate value before execution begins.
24614
24615 -mprioritize-restricted-insns=priority
24616 This option controls the priority that is assigned to dispatch-slot
24617 restricted instructions during the second scheduling pass. The
24618 argument priority takes the value 0, 1, or 2 to assign no, highest,
24619 or second-highest (respectively) priority to dispatch-slot
24620 restricted instructions.
24621
24622 -msched-costly-dep=dependence_type
24623 This option controls which dependences are considered costly by the
24624 target during instruction scheduling. The argument dependence_type
24625 takes one of the following values:
24626
24627 no No dependence is costly.
24628
24629 all All dependences are costly.
24630
24631 true_store_to_load
24632 A true dependence from store to load is costly.
24633
24634 store_to_load
24635 Any dependence from store to load is costly.
24636
24637 number
24638 Any dependence for which the latency is greater than or equal
24639 to number is costly.
24640
24641 -minsert-sched-nops=scheme
24642 This option controls which NOP insertion scheme is used during the
24643 second scheduling pass. The argument scheme takes one of the
24644 following values:
24645
24646 no Don't insert NOPs.
24647
24648 pad Pad with NOPs any dispatch group that has vacant issue slots,
24649 according to the scheduler's grouping.
24650
24651 regroup_exact
24652 Insert NOPs to force costly dependent insns into separate
24653 groups. Insert exactly as many NOPs as needed to force an insn
24654 to a new group, according to the estimated processor grouping.
24655
24656 number
24657 Insert NOPs to force costly dependent insns into separate
24658 groups. Insert number NOPs to force an insn to a new group.
24659
24660 -mcall-sysv
24661 On System V.4 and embedded PowerPC systems compile code using
24662 calling conventions that adhere to the March 1995 draft of the
24663 System V Application Binary Interface, PowerPC processor
24664 supplement. This is the default unless you configured GCC using
24665 powerpc-*-eabiaix.
24666
24667 -mcall-sysv-eabi
24668 -mcall-eabi
24669 Specify both -mcall-sysv and -meabi options.
24670
24671 -mcall-sysv-noeabi
24672 Specify both -mcall-sysv and -mno-eabi options.
24673
24674 -mcall-aixdesc
24675 On System V.4 and embedded PowerPC systems compile code for the AIX
24676 operating system.
24677
24678 -mcall-linux
24679 On System V.4 and embedded PowerPC systems compile code for the
24680 Linux-based GNU system.
24681
24682 -mcall-freebsd
24683 On System V.4 and embedded PowerPC systems compile code for the
24684 FreeBSD operating system.
24685
24686 -mcall-netbsd
24687 On System V.4 and embedded PowerPC systems compile code for the
24688 NetBSD operating system.
24689
24690 -mcall-openbsd
24691 On System V.4 and embedded PowerPC systems compile code for the
24692 OpenBSD operating system.
24693
24694 -mtraceback=traceback_type
24695 Select the type of traceback table. Valid values for traceback_type
24696 are full, part, and no.
24697
24698 -maix-struct-return
24699 Return all structures in memory (as specified by the AIX ABI).
24700
24701 -msvr4-struct-return
24702 Return structures smaller than 8 bytes in registers (as specified
24703 by the SVR4 ABI).
24704
24705 -mabi=abi-type
24706 Extend the current ABI with a particular extension, or remove such
24707 extension. Valid values are: altivec, no-altivec, ibmlongdouble,
24708 ieeelongdouble, elfv1, elfv2, and for AIX: vec-extabi, vec-default.
24709
24710 -mabi=ibmlongdouble
24711 Change the current ABI to use IBM extended-precision long double.
24712 This is not likely to work if your system defaults to using IEEE
24713 extended-precision long double. If you change the long double type
24714 from IEEE extended-precision, the compiler will issue a warning
24715 unless you use the -Wno-psabi option. Requires -mlong-double-128
24716 to be enabled.
24717
24718 -mabi=ieeelongdouble
24719 Change the current ABI to use IEEE extended-precision long double.
24720 This is not likely to work if your system defaults to using IBM
24721 extended-precision long double. If you change the long double type
24722 from IBM extended-precision, the compiler will issue a warning
24723 unless you use the -Wno-psabi option. Requires -mlong-double-128
24724 to be enabled.
24725
24726 -mabi=elfv1
24727 Change the current ABI to use the ELFv1 ABI. This is the default
24728 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
24729 ABI requires special system support and is likely to fail in
24730 spectacular ways.
24731
24732 -mabi=elfv2
24733 Change the current ABI to use the ELFv2 ABI. This is the default
24734 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
24735 ABI requires special system support and is likely to fail in
24736 spectacular ways.
24737
24738 -mgnu-attribute
24739 -mno-gnu-attribute
24740 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24741 .gnu.attributes section that specify ABI variations in function
24742 parameters or return values.
24743
24744 -mprototype
24745 -mno-prototype
24746 On System V.4 and embedded PowerPC systems assume that all calls to
24747 variable argument functions are properly prototyped. Otherwise,
24748 the compiler must insert an instruction before every non-prototyped
24749 call to set or clear bit 6 of the condition code register ("CR") to
24750 indicate whether floating-point values are passed in the floating-
24751 point registers in case the function takes variable arguments.
24752 With -mprototype, only calls to prototyped variable argument
24753 functions set or clear the bit.
24754
24755 -msim
24756 On embedded PowerPC systems, assume that the startup module is
24757 called sim-crt0.o and that the standard C libraries are libsim.a
24758 and libc.a. This is the default for powerpc-*-eabisim
24759 configurations.
24760
24761 -mmvme
24762 On embedded PowerPC systems, assume that the startup module is
24763 called crt0.o and the standard C libraries are libmvme.a and
24764 libc.a.
24765
24766 -mads
24767 On embedded PowerPC systems, assume that the startup module is
24768 called crt0.o and the standard C libraries are libads.a and libc.a.
24769
24770 -myellowknife
24771 On embedded PowerPC systems, assume that the startup module is
24772 called crt0.o and the standard C libraries are libyk.a and libc.a.
24773
24774 -mvxworks
24775 On System V.4 and embedded PowerPC systems, specify that you are
24776 compiling for a VxWorks system.
24777
24778 -memb
24779 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
24780 header to indicate that eabi extended relocations are used.
24781
24782 -meabi
24783 -mno-eabi
24784 On System V.4 and embedded PowerPC systems do (do not) adhere to
24785 the Embedded Applications Binary Interface (EABI), which is a set
24786 of modifications to the System V.4 specifications. Selecting
24787 -meabi means that the stack is aligned to an 8-byte boundary, a
24788 function "__eabi" is called from "main" to set up the EABI
24789 environment, and the -msdata option can use both "r2" and "r13" to
24790 point to two separate small data areas. Selecting -mno-eabi means
24791 that the stack is aligned to a 16-byte boundary, no EABI
24792 initialization function is called from "main", and the -msdata
24793 option only uses "r13" to point to a single small data area. The
24794 -meabi option is on by default if you configured GCC using one of
24795 the powerpc*-*-eabi* options.
24796
24797 -msdata=eabi
24798 On System V.4 and embedded PowerPC systems, put small initialized
24799 "const" global and static data in the ".sdata2" section, which is
24800 pointed to by register "r2". Put small initialized non-"const"
24801 global and static data in the ".sdata" section, which is pointed to
24802 by register "r13". Put small uninitialized global and static data
24803 in the ".sbss" section, which is adjacent to the ".sdata" section.
24804 The -msdata=eabi option is incompatible with the -mrelocatable
24805 option. The -msdata=eabi option also sets the -memb option.
24806
24807 -msdata=sysv
24808 On System V.4 and embedded PowerPC systems, put small global and
24809 static data in the ".sdata" section, which is pointed to by
24810 register "r13". Put small uninitialized global and static data in
24811 the ".sbss" section, which is adjacent to the ".sdata" section.
24812 The -msdata=sysv option is incompatible with the -mrelocatable
24813 option.
24814
24815 -msdata=default
24816 -msdata
24817 On System V.4 and embedded PowerPC systems, if -meabi is used,
24818 compile code the same as -msdata=eabi, otherwise compile code the
24819 same as -msdata=sysv.
24820
24821 -msdata=data
24822 On System V.4 and embedded PowerPC systems, put small global data
24823 in the ".sdata" section. Put small uninitialized global data in
24824 the ".sbss" section. Do not use register "r13" to address small
24825 data however. This is the default behavior unless other -msdata
24826 options are used.
24827
24828 -msdata=none
24829 -mno-sdata
24830 On embedded PowerPC systems, put all initialized global and static
24831 data in the ".data" section, and all uninitialized data in the
24832 ".bss" section.
24833
24834 -mreadonly-in-sdata
24835 Put read-only objects in the ".sdata" section as well. This is the
24836 default.
24837
24838 -mblock-move-inline-limit=num
24839 Inline all block moves (such as calls to "memcpy" or structure
24840 copies) less than or equal to num bytes. The minimum value for num
24841 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
24842 default value is target-specific.
24843
24844 -mblock-compare-inline-limit=num
24845 Generate non-looping inline code for all block compares (such as
24846 calls to "memcmp" or structure compares) less than or equal to num
24847 bytes. If num is 0, all inline expansion (non-loop and loop) of
24848 block compare is disabled. The default value is target-specific.
24849
24850 -mblock-compare-inline-loop-limit=num
24851 Generate an inline expansion using loop code for all block compares
24852 that are less than or equal to num bytes, but greater than the
24853 limit for non-loop inline block compare expansion. If the block
24854 length is not constant, at most num bytes will be compared before
24855 "memcmp" is called to compare the remainder of the block. The
24856 default value is target-specific.
24857
24858 -mstring-compare-inline-limit=num
24859 Compare at most num string bytes with inline code. If the
24860 difference or end of string is not found at the end of the inline
24861 compare a call to "strcmp" or "strncmp" will take care of the rest
24862 of the comparison. The default is 64 bytes.
24863
24864 -G num
24865 On embedded PowerPC systems, put global and static items less than
24866 or equal to num bytes into the small data or BSS sections instead
24867 of the normal data or BSS section. By default, num is 8. The -G
24868 num switch is also passed to the linker. All modules should be
24869 compiled with the same -G num value.
24870
24871 -mregnames
24872 -mno-regnames
24873 On System V.4 and embedded PowerPC systems do (do not) emit
24874 register names in the assembly language output using symbolic
24875 forms.
24876
24877 -mlongcall
24878 -mno-longcall
24879 By default assume that all calls are far away so that a longer and
24880 more expensive calling sequence is required. This is required for
24881 calls farther than 32 megabytes (33,554,432 bytes) from the current
24882 location. A short call is generated if the compiler knows the call
24883 cannot be that far away. This setting can be overridden by the
24884 "shortcall" function attribute, or by "#pragma longcall(0)".
24885
24886 Some linkers are capable of detecting out-of-range calls and
24887 generating glue code on the fly. On these systems, long calls are
24888 unnecessary and generate slower code. As of this writing, the AIX
24889 linker can do this, as can the GNU linker for PowerPC/64. It is
24890 planned to add this feature to the GNU linker for 32-bit PowerPC
24891 systems as well.
24892
24893 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
24894 linkers, GCC can generate long calls using an inline PLT call
24895 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
24896 ELFv1 (big-endian) do not support inline PLT calls.
24897
24898 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
24899 L42", plus a branch island (glue code). The two target addresses
24900 represent the callee and the branch island. The Darwin/PPC linker
24901 prefers the first address and generates a "bl callee" if the PPC
24902 "bl" instruction reaches the callee directly; otherwise, the linker
24903 generates "bl L42" to call the branch island. The branch island is
24904 appended to the body of the calling function; it computes the full
24905 32-bit address of the callee and jumps to it.
24906
24907 On Mach-O (Darwin) systems, this option directs the compiler emit
24908 to the glue for every direct call, and the Darwin linker decides
24909 whether to use or discard it.
24910
24911 In the future, GCC may ignore all longcall specifications when the
24912 linker is known to generate glue.
24913
24914 -mpltseq
24915 -mno-pltseq
24916 Implement (do not implement) -fno-plt and long calls using an
24917 inline PLT call sequence that supports lazy linking and long calls
24918 to functions in dlopen'd shared libraries. Inline PLT calls are
24919 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
24920 newer GNU linkers, and are enabled by default if the support is
24921 detected when configuring GCC, and, in the case of 32-bit PowerPC,
24922 if GCC is configured with --enable-secureplt. -mpltseq code and
24923 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
24924 together.
24925
24926 -mtls-markers
24927 -mno-tls-markers
24928 Mark (do not mark) calls to "__tls_get_addr" with a relocation
24929 specifying the function argument. The relocation allows the linker
24930 to reliably associate function call with argument setup
24931 instructions for TLS optimization, which in turn allows GCC to
24932 better schedule the sequence.
24933
24934 -mrecip
24935 -mno-recip
24936 This option enables use of the reciprocal estimate and reciprocal
24937 square root estimate instructions with additional Newton-Raphson
24938 steps to increase precision instead of doing a divide or square
24939 root and divide for floating-point arguments. You should use the
24940 -ffast-math option when using -mrecip (or at least
24941 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
24942 and -fno-trapping-math). Note that while the throughput of the
24943 sequence is generally higher than the throughput of the non-
24944 reciprocal instruction, the precision of the sequence can be
24945 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
24946 0.99999994) for reciprocal square roots.
24947
24948 -mrecip=opt
24949 This option controls which reciprocal estimate instructions may be
24950 used. opt is a comma-separated list of options, which may be
24951 preceded by a "!" to invert the option:
24952
24953 all Enable all estimate instructions.
24954
24955 default
24956 Enable the default instructions, equivalent to -mrecip.
24957
24958 none
24959 Disable all estimate instructions, equivalent to -mno-recip.
24960
24961 div Enable the reciprocal approximation instructions for both
24962 single and double precision.
24963
24964 divf
24965 Enable the single-precision reciprocal approximation
24966 instructions.
24967
24968 divd
24969 Enable the double-precision reciprocal approximation
24970 instructions.
24971
24972 rsqrt
24973 Enable the reciprocal square root approximation instructions
24974 for both single and double precision.
24975
24976 rsqrtf
24977 Enable the single-precision reciprocal square root
24978 approximation instructions.
24979
24980 rsqrtd
24981 Enable the double-precision reciprocal square root
24982 approximation instructions.
24983
24984 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
24985 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
24986 "XVRSQRTEDP" instructions which handle the double-precision
24987 reciprocal square root calculations.
24988
24989 -mrecip-precision
24990 -mno-recip-precision
24991 Assume (do not assume) that the reciprocal estimate instructions
24992 provide higher-precision estimates than is mandated by the PowerPC
24993 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
24994 automatically selects -mrecip-precision. The double-precision
24995 square root estimate instructions are not generated by default on
24996 low-precision machines, since they do not provide an estimate that
24997 converges after three steps.
24998
24999 -mveclibabi=type
25000 Specifies the ABI type to use for vectorizing intrinsics using an
25001 external library. The only type supported at present is mass,
25002 which specifies to use IBM's Mathematical Acceleration Subsystem
25003 (MASS) libraries for vectorizing intrinsics using external
25004 libraries. GCC currently emits calls to "acosd2", "acosf4",
25005 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
25006 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
25007 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
25008 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
25009 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
25010 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
25011 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
25012 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
25013 "tanhf4" when generating code for power7. Both -ftree-vectorize
25014 and -funsafe-math-optimizations must also be enabled. The MASS
25015 libraries must be specified at link time.
25016
25017 -mfriz
25018 -mno-friz
25019 Generate (do not generate) the "friz" instruction when the
25020 -funsafe-math-optimizations option is used to optimize rounding of
25021 floating-point values to 64-bit integer and back to floating point.
25022 The "friz" instruction does not return the same value if the
25023 floating-point number is too large to fit in an integer.
25024
25025 -mpointers-to-nested-functions
25026 -mno-pointers-to-nested-functions
25027 Generate (do not generate) code to load up the static chain
25028 register ("r11") when calling through a pointer on AIX and 64-bit
25029 Linux systems where a function pointer points to a 3-word
25030 descriptor giving the function address, TOC value to be loaded in
25031 register "r2", and static chain value to be loaded in register
25032 "r11". The -mpointers-to-nested-functions is on by default. You
25033 cannot call through pointers to nested functions or pointers to
25034 functions compiled in other languages that use the static chain if
25035 you use -mno-pointers-to-nested-functions.
25036
25037 -msave-toc-indirect
25038 -mno-save-toc-indirect
25039 Generate (do not generate) code to save the TOC value in the
25040 reserved stack location in the function prologue if the function
25041 calls through a pointer on AIX and 64-bit Linux systems. If the
25042 TOC value is not saved in the prologue, it is saved just before the
25043 call through the pointer. The -mno-save-toc-indirect option is the
25044 default.
25045
25046 -mcompat-align-parm
25047 -mno-compat-align-parm
25048 Generate (do not generate) code to pass structure parameters with a
25049 maximum alignment of 64 bits, for compatibility with older versions
25050 of GCC.
25051
25052 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25053 structure parameter on a 128-bit boundary when that structure
25054 contained a member requiring 128-bit alignment. This is corrected
25055 in more recent versions of GCC. This option may be used to
25056 generate code that is compatible with functions compiled with older
25057 versions of GCC.
25058
25059 The -mno-compat-align-parm option is the default.
25060
25061 -mstack-protector-guard=guard
25062 -mstack-protector-guard-reg=reg
25063 -mstack-protector-guard-offset=offset
25064 -mstack-protector-guard-symbol=symbol
25065 Generate stack protection code using canary at guard. Supported
25066 locations are global for global canary or tls for per-thread canary
25067 in the TLS block (the default with GNU libc version 2.4 or later).
25068
25069 With the latter choice the options -mstack-protector-guard-reg=reg
25070 and -mstack-protector-guard-offset=offset furthermore specify which
25071 register to use as base register for reading the canary, and from
25072 what offset from that base register. The default for those is as
25073 specified in the relevant ABI.
25074 -mstack-protector-guard-symbol=symbol overrides the offset with a
25075 symbol reference to a canary in the TLS block.
25076
25077 -mpcrel
25078 -mno-pcrel
25079 Generate (do not generate) pc-relative addressing. The -mpcrel
25080 option requires that the medium code model (-mcmodel=medium) and
25081 prefixed addressing (-mprefixed) options are enabled.
25082
25083 -mprefixed
25084 -mno-prefixed
25085 Generate (do not generate) addressing modes using prefixed load and
25086 store instructions. The -mprefixed option requires that the option
25087 -mcpu=power10 (or later) is enabled.
25088
25089 -mmma
25090 -mno-mma
25091 Generate (do not generate) the MMA instructions. The -mma option
25092 requires that the option -mcpu=power10 (or later) is enabled.
25093
25094 -mrop-protect
25095 -mno-rop-protect
25096 Generate (do not generate) ROP protection instructions when the
25097 target processor supports them. Currently this option disables the
25098 shrink-wrap optimization (-fshrink-wrap).
25099
25100 -mprivileged
25101 -mno-privileged
25102 Generate (do not generate) code that will run in privileged state.
25103
25104 -mblock-ops-unaligned-vsx
25105 -mno-block-ops-unaligned-vsx
25106 Generate (do not generate) unaligned vsx loads and stores for
25107 inline expansion of "memcpy" and "memmove".
25108
25109 RX Options
25110 These command-line options are defined for RX targets:
25111
25112 -m64bit-doubles
25113 -m32bit-doubles
25114 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
25115 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
25116 RX floating-point hardware only works on 32-bit values, which is
25117 why the default is -m32bit-doubles.
25118
25119 -fpu
25120 -nofpu
25121 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
25122 hardware. The default is enabled for the RX600 series and disabled
25123 for the RX200 series.
25124
25125 Floating-point instructions are only generated for 32-bit floating-
25126 point values, however, so the FPU hardware is not used for doubles
25127 if the -m64bit-doubles option is used.
25128
25129 Note If the -fpu option is enabled then -funsafe-math-optimizations
25130 is also enabled automatically. This is because the RX FPU
25131 instructions are themselves unsafe.
25132
25133 -mcpu=name
25134 Selects the type of RX CPU to be targeted. Currently three types
25135 are supported, the generic RX600 and RX200 series hardware and the
25136 specific RX610 CPU. The default is RX600.
25137
25138 The only difference between RX600 and RX610 is that the RX610 does
25139 not support the "MVTIPL" instruction.
25140
25141 The RX200 series does not have a hardware floating-point unit and
25142 so -nofpu is enabled by default when this type is selected.
25143
25144 -mbig-endian-data
25145 -mlittle-endian-data
25146 Store data (but not code) in the big-endian format. The default is
25147 -mlittle-endian-data, i.e. to store data in the little-endian
25148 format.
25149
25150 -msmall-data-limit=N
25151 Specifies the maximum size in bytes of global and static variables
25152 which can be placed into the small data area. Using the small data
25153 area can lead to smaller and faster code, but the size of area is
25154 limited and it is up to the programmer to ensure that the area does
25155 not overflow. Also when the small data area is used one of the
25156 RX's registers (usually "r13") is reserved for use pointing to this
25157 area, so it is no longer available for use by the compiler. This
25158 could result in slower and/or larger code if variables are pushed
25159 onto the stack instead of being held in this register.
25160
25161 Note, common variables (variables that have not been initialized)
25162 and constants are not placed into the small data area as they are
25163 assigned to other sections in the output executable.
25164
25165 The default value is zero, which disables this feature. Note, this
25166 feature is not enabled by default with higher optimization levels
25167 (-O2 etc) because of the potentially detrimental effects of
25168 reserving a register. It is up to the programmer to experiment and
25169 discover whether this feature is of benefit to their program. See
25170 the description of the -mpid option for a description of how the
25171 actual register to hold the small data area pointer is chosen.
25172
25173 -msim
25174 -mno-sim
25175 Use the simulator runtime. The default is to use the libgloss
25176 board-specific runtime.
25177
25178 -mas100-syntax
25179 -mno-as100-syntax
25180 When generating assembler output use a syntax that is compatible
25181 with Renesas's AS100 assembler. This syntax can also be handled by
25182 the GAS assembler, but it has some restrictions so it is not
25183 generated by default.
25184
25185 -mmax-constant-size=N
25186 Specifies the maximum size, in bytes, of a constant that can be
25187 used as an operand in a RX instruction. Although the RX
25188 instruction set does allow constants of up to 4 bytes in length to
25189 be used in instructions, a longer value equates to a longer
25190 instruction. Thus in some circumstances it can be beneficial to
25191 restrict the size of constants that are used in instructions.
25192 Constants that are too big are instead placed into a constant pool
25193 and referenced via register indirection.
25194
25195 The value N can be between 0 and 4. A value of 0 (the default) or
25196 4 means that constants of any size are allowed.
25197
25198 -mrelax
25199 Enable linker relaxation. Linker relaxation is a process whereby
25200 the linker attempts to reduce the size of a program by finding
25201 shorter versions of various instructions. Disabled by default.
25202
25203 -mint-register=N
25204 Specify the number of registers to reserve for fast interrupt
25205 handler functions. The value N can be between 0 and 4. A value of
25206 1 means that register "r13" is reserved for the exclusive use of
25207 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
25208 value of 3 reserves "r13", "r12" and "r11", and a value of 4
25209 reserves "r13" through "r10". A value of 0, the default, does not
25210 reserve any registers.
25211
25212 -msave-acc-in-interrupts
25213 Specifies that interrupt handler functions should preserve the
25214 accumulator register. This is only necessary if normal code might
25215 use the accumulator register, for example because it performs
25216 64-bit multiplications. The default is to ignore the accumulator
25217 as this makes the interrupt handlers faster.
25218
25219 -mpid
25220 -mno-pid
25221 Enables the generation of position independent data. When enabled
25222 any access to constant data is done via an offset from a base
25223 address held in a register. This allows the location of constant
25224 data to be determined at run time without requiring the executable
25225 to be relocated, which is a benefit to embedded applications with
25226 tight memory constraints. Data that can be modified is not
25227 affected by this option.
25228
25229 Note, using this feature reserves a register, usually "r13", for
25230 the constant data base address. This can result in slower and/or
25231 larger code, especially in complicated functions.
25232
25233 The actual register chosen to hold the constant data base address
25234 depends upon whether the -msmall-data-limit and/or the
25235 -mint-register command-line options are enabled. Starting with
25236 register "r13" and proceeding downwards, registers are allocated
25237 first to satisfy the requirements of -mint-register, then -mpid and
25238 finally -msmall-data-limit. Thus it is possible for the small data
25239 area register to be "r8" if both -mint-register=4 and -mpid are
25240 specified on the command line.
25241
25242 By default this feature is not enabled. The default can be
25243 restored via the -mno-pid command-line option.
25244
25245 -mno-warn-multiple-fast-interrupts
25246 -mwarn-multiple-fast-interrupts
25247 Prevents GCC from issuing a warning message if it finds more than
25248 one fast interrupt handler when it is compiling a file. The
25249 default is to issue a warning for each extra fast interrupt handler
25250 found, as the RX only supports one such interrupt.
25251
25252 -mallow-string-insns
25253 -mno-allow-string-insns
25254 Enables or disables the use of the string manipulation instructions
25255 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
25256 "RMPA" instruction. These instructions may prefetch data, which is
25257 not safe to do if accessing an I/O register. (See section 12.2.7
25258 of the RX62N Group User's Manual for more information).
25259
25260 The default is to allow these instructions, but it is not possible
25261 for GCC to reliably detect all circumstances where a string
25262 instruction might be used to access an I/O register, so their use
25263 cannot be disabled automatically. Instead it is reliant upon the
25264 programmer to use the -mno-allow-string-insns option if their
25265 program accesses I/O space.
25266
25267 When the instructions are enabled GCC defines the C preprocessor
25268 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
25269 "__RX_DISALLOW_STRING_INSNS__".
25270
25271 -mjsr
25272 -mno-jsr
25273 Use only (or not only) "JSR" instructions to access functions.
25274 This option can be used when code size exceeds the range of "BSR"
25275 instructions. Note that -mno-jsr does not mean to not use "JSR"
25276 but instead means that any type of branch may be used.
25277
25278 Note: The generic GCC command-line option -ffixed-reg has special
25279 significance to the RX port when used with the "interrupt" function
25280 attribute. This attribute indicates a function intended to process
25281 fast interrupts. GCC ensures that it only uses the registers "r10",
25282 "r11", "r12" and/or "r13" and only provided that the normal use of the
25283 corresponding registers have been restricted via the -ffixed-reg or
25284 -mint-register command-line options.
25285
25286 S/390 and zSeries Options
25287 These are the -m options defined for the S/390 and zSeries
25288 architecture.
25289
25290 -mhard-float
25291 -msoft-float
25292 Use (do not use) the hardware floating-point instructions and
25293 registers for floating-point operations. When -msoft-float is
25294 specified, functions in libgcc.a are used to perform floating-point
25295 operations. When -mhard-float is specified, the compiler generates
25296 IEEE floating-point instructions. This is the default.
25297
25298 -mhard-dfp
25299 -mno-hard-dfp
25300 Use (do not use) the hardware decimal-floating-point instructions
25301 for decimal-floating-point operations. When -mno-hard-dfp is
25302 specified, functions in libgcc.a are used to perform decimal-
25303 floating-point operations. When -mhard-dfp is specified, the
25304 compiler generates decimal-floating-point hardware instructions.
25305 This is the default for -march=z9-ec or higher.
25306
25307 -mlong-double-64
25308 -mlong-double-128
25309 These switches control the size of "long double" type. A size of 64
25310 bits makes the "long double" type equivalent to the "double" type.
25311 This is the default.
25312
25313 -mbackchain
25314 -mno-backchain
25315 Store (do not store) the address of the caller's frame as backchain
25316 pointer into the callee's stack frame. A backchain may be needed
25317 to allow debugging using tools that do not understand DWARF call
25318 frame information. When -mno-packed-stack is in effect, the
25319 backchain pointer is stored at the bottom of the stack frame; when
25320 -mpacked-stack is in effect, the backchain is placed into the
25321 topmost word of the 96/160 byte register save area.
25322
25323 In general, code compiled with -mbackchain is call-compatible with
25324 code compiled with -mno-backchain; however, use of the backchain
25325 for debugging purposes usually requires that the whole binary is
25326 built with -mbackchain. Note that the combination of -mbackchain,
25327 -mpacked-stack and -mhard-float is not supported. In order to
25328 build a linux kernel use -msoft-float.
25329
25330 The default is to not maintain the backchain.
25331
25332 -mpacked-stack
25333 -mno-packed-stack
25334 Use (do not use) the packed stack layout. When -mno-packed-stack
25335 is specified, the compiler uses the all fields of the 96/160 byte
25336 register save area only for their default purpose; unused fields
25337 still take up stack space. When -mpacked-stack is specified,
25338 register save slots are densely packed at the top of the register
25339 save area; unused space is reused for other purposes, allowing for
25340 more efficient use of the available stack space. However, when
25341 -mbackchain is also in effect, the topmost word of the save area is
25342 always used to store the backchain, and the return address register
25343 is always saved two words below the backchain.
25344
25345 As long as the stack frame backchain is not used, code generated
25346 with -mpacked-stack is call-compatible with code generated with
25347 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
25348 S/390 or zSeries generated code that uses the stack frame backchain
25349 at run time, not just for debugging purposes. Such code is not
25350 call-compatible with code compiled with -mpacked-stack. Also, note
25351 that the combination of -mbackchain, -mpacked-stack and
25352 -mhard-float is not supported. In order to build a linux kernel
25353 use -msoft-float.
25354
25355 The default is to not use the packed stack layout.
25356
25357 -msmall-exec
25358 -mno-small-exec
25359 Generate (or do not generate) code using the "bras" instruction to
25360 do subroutine calls. This only works reliably if the total
25361 executable size does not exceed 64k. The default is to use the
25362 "basr" instruction instead, which does not have this limitation.
25363
25364 -m64
25365 -m31
25366 When -m31 is specified, generate code compliant to the GNU/Linux
25367 for S/390 ABI. When -m64 is specified, generate code compliant to
25368 the GNU/Linux for zSeries ABI. This allows GCC in particular to
25369 generate 64-bit instructions. For the s390 targets, the default is
25370 -m31, while the s390x targets default to -m64.
25371
25372 -mzarch
25373 -mesa
25374 When -mzarch is specified, generate code using the instructions
25375 available on z/Architecture. When -mesa is specified, generate
25376 code using the instructions available on ESA/390. Note that -mesa
25377 is not possible with -m64. When generating code compliant to the
25378 GNU/Linux for S/390 ABI, the default is -mesa. When generating
25379 code compliant to the GNU/Linux for zSeries ABI, the default is
25380 -mzarch.
25381
25382 -mhtm
25383 -mno-htm
25384 The -mhtm option enables a set of builtins making use of
25385 instructions available with the transactional execution facility
25386 introduced with the IBM zEnterprise EC12 machine generation S/390
25387 System z Built-in Functions. -mhtm is enabled by default when
25388 using -march=zEC12.
25389
25390 -mvx
25391 -mno-vx
25392 When -mvx is specified, generate code using the instructions
25393 available with the vector extension facility introduced with the
25394 IBM z13 machine generation. This option changes the ABI for some
25395 vector type values with regard to alignment and calling
25396 conventions. In case vector type values are being used in an ABI-
25397 relevant context a GAS .gnu_attribute command will be added to mark
25398 the resulting binary with the ABI used. -mvx is enabled by default
25399 when using -march=z13.
25400
25401 -mzvector
25402 -mno-zvector
25403 The -mzvector option enables vector language extensions and
25404 builtins using instructions available with the vector extension
25405 facility introduced with the IBM z13 machine generation. This
25406 option adds support for vector to be used as a keyword to define
25407 vector type variables and arguments. vector is only available when
25408 GNU extensions are enabled. It will not be expanded when
25409 requesting strict standard compliance e.g. with -std=c99. In
25410 addition to the GCC low-level builtins -mzvector enables a set of
25411 builtins added for compatibility with AltiVec-style implementations
25412 like Power and Cell. In order to make use of these builtins the
25413 header file vecintrin.h needs to be included. -mzvector is
25414 disabled by default.
25415
25416 -mmvcle
25417 -mno-mvcle
25418 Generate (or do not generate) code using the "mvcle" instruction to
25419 perform block moves. When -mno-mvcle is specified, use a "mvc"
25420 loop instead. This is the default unless optimizing for size.
25421
25422 -mdebug
25423 -mno-debug
25424 Print (or do not print) additional debug information when
25425 compiling. The default is to not print debug information.
25426
25427 -march=cpu-type
25428 Generate code that runs on cpu-type, which is the name of a system
25429 representing a certain processor type. Possible values for cpu-
25430 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
25431 z196/arch9, zEC12, z13/arch11, z14/arch12, z15/arch13, z16/arch14,
25432 and native.
25433
25434 The default is -march=z900.
25435
25436 Specifying native as cpu type can be used to select the best
25437 architecture option for the host processor. -march=native has no
25438 effect if GCC does not recognize the processor.
25439
25440 -mtune=cpu-type
25441 Tune to cpu-type everything applicable about the generated code,
25442 except for the ABI and the set of available instructions. The list
25443 of cpu-type values is the same as for -march. The default is the
25444 value used for -march.
25445
25446 -mtpf-trace
25447 -mno-tpf-trace
25448 Generate code that adds (does not add) in TPF OS specific branches
25449 to trace routines in the operating system. This option is off by
25450 default, even when compiling for the TPF OS.
25451
25452 -mtpf-trace-skip
25453 -mno-tpf-trace-skip
25454 Generate code that changes (does not change) the default branch
25455 targets enabled by -mtpf-trace to point to specialized trace
25456 routines providing the ability of selectively skipping function
25457 trace entries for the TPF OS. This option is off by default, even
25458 when compiling for the TPF OS and specifying -mtpf-trace.
25459
25460 -mfused-madd
25461 -mno-fused-madd
25462 Generate code that uses (does not use) the floating-point multiply
25463 and accumulate instructions. These instructions are generated by
25464 default if hardware floating point is used.
25465
25466 -mwarn-framesize=framesize
25467 Emit a warning if the current function exceeds the given frame
25468 size. Because this is a compile-time check it doesn't need to be a
25469 real problem when the program runs. It is intended to identify
25470 functions that most probably cause a stack overflow. It is useful
25471 to be used in an environment with limited stack size e.g. the linux
25472 kernel.
25473
25474 -mwarn-dynamicstack
25475 Emit a warning if the function calls "alloca" or uses dynamically-
25476 sized arrays. This is generally a bad idea with a limited stack
25477 size.
25478
25479 -mstack-guard=stack-guard
25480 -mstack-size=stack-size
25481 If these options are provided the S/390 back end emits additional
25482 instructions in the function prologue that trigger a trap if the
25483 stack size is stack-guard bytes above the stack-size (remember that
25484 the stack on S/390 grows downward). If the stack-guard option is
25485 omitted the smallest power of 2 larger than the frame size of the
25486 compiled function is chosen. These options are intended to be used
25487 to help debugging stack overflow problems. The additionally
25488 emitted code causes only little overhead and hence can also be used
25489 in production-like systems without greater performance degradation.
25490 The given values have to be exact powers of 2 and stack-size has to
25491 be greater than stack-guard without exceeding 64k. In order to be
25492 efficient the extra code makes the assumption that the stack starts
25493 at an address aligned to the value given by stack-size. The stack-
25494 guard option can only be used in conjunction with stack-size.
25495
25496 -mhotpatch=pre-halfwords,post-halfwords
25497 If the hotpatch option is enabled, a "hot-patching" function
25498 prologue is generated for all functions in the compilation unit.
25499 The funtion label is prepended with the given number of two-byte
25500 NOP instructions (pre-halfwords, maximum 1000000). After the
25501 label, 2 * post-halfwords bytes are appended, using the largest NOP
25502 like instructions the architecture allows (maximum 1000000).
25503
25504 If both arguments are zero, hotpatching is disabled.
25505
25506 This option can be overridden for individual functions with the
25507 "hotpatch" attribute.
25508
25509 Score Options
25510 These options are defined for Score implementations:
25511
25512 -meb
25513 Compile code for big-endian mode. This is the default.
25514
25515 -mel
25516 Compile code for little-endian mode.
25517
25518 -mnhwloop
25519 Disable generation of "bcnz" instructions.
25520
25521 -muls
25522 Enable generation of unaligned load and store instructions.
25523
25524 -mmac
25525 Enable the use of multiply-accumulate instructions. Disabled by
25526 default.
25527
25528 -mscore5
25529 Specify the SCORE5 as the target architecture.
25530
25531 -mscore5u
25532 Specify the SCORE5U of the target architecture.
25533
25534 -mscore7
25535 Specify the SCORE7 as the target architecture. This is the default.
25536
25537 -mscore7d
25538 Specify the SCORE7D as the target architecture.
25539
25540 SH Options
25541 These -m options are defined for the SH implementations:
25542
25543 -m1 Generate code for the SH1.
25544
25545 -m2 Generate code for the SH2.
25546
25547 -m2e
25548 Generate code for the SH2e.
25549
25550 -m2a-nofpu
25551 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
25552 way that the floating-point unit is not used.
25553
25554 -m2a-single-only
25555 Generate code for the SH2a-FPU, in such a way that no double-
25556 precision floating-point operations are used.
25557
25558 -m2a-single
25559 Generate code for the SH2a-FPU assuming the floating-point unit is
25560 in single-precision mode by default.
25561
25562 -m2a
25563 Generate code for the SH2a-FPU assuming the floating-point unit is
25564 in double-precision mode by default.
25565
25566 -m3 Generate code for the SH3.
25567
25568 -m3e
25569 Generate code for the SH3e.
25570
25571 -m4-nofpu
25572 Generate code for the SH4 without a floating-point unit.
25573
25574 -m4-single-only
25575 Generate code for the SH4 with a floating-point unit that only
25576 supports single-precision arithmetic.
25577
25578 -m4-single
25579 Generate code for the SH4 assuming the floating-point unit is in
25580 single-precision mode by default.
25581
25582 -m4 Generate code for the SH4.
25583
25584 -m4-100
25585 Generate code for SH4-100.
25586
25587 -m4-100-nofpu
25588 Generate code for SH4-100 in such a way that the floating-point
25589 unit is not used.
25590
25591 -m4-100-single
25592 Generate code for SH4-100 assuming the floating-point unit is in
25593 single-precision mode by default.
25594
25595 -m4-100-single-only
25596 Generate code for SH4-100 in such a way that no double-precision
25597 floating-point operations are used.
25598
25599 -m4-200
25600 Generate code for SH4-200.
25601
25602 -m4-200-nofpu
25603 Generate code for SH4-200 without in such a way that the floating-
25604 point unit is not used.
25605
25606 -m4-200-single
25607 Generate code for SH4-200 assuming the floating-point unit is in
25608 single-precision mode by default.
25609
25610 -m4-200-single-only
25611 Generate code for SH4-200 in such a way that no double-precision
25612 floating-point operations are used.
25613
25614 -m4-300
25615 Generate code for SH4-300.
25616
25617 -m4-300-nofpu
25618 Generate code for SH4-300 without in such a way that the floating-
25619 point unit is not used.
25620
25621 -m4-300-single
25622 Generate code for SH4-300 in such a way that no double-precision
25623 floating-point operations are used.
25624
25625 -m4-300-single-only
25626 Generate code for SH4-300 in such a way that no double-precision
25627 floating-point operations are used.
25628
25629 -m4-340
25630 Generate code for SH4-340 (no MMU, no FPU).
25631
25632 -m4-500
25633 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
25634 assembler.
25635
25636 -m4a-nofpu
25637 Generate code for the SH4al-dsp, or for a SH4a in such a way that
25638 the floating-point unit is not used.
25639
25640 -m4a-single-only
25641 Generate code for the SH4a, in such a way that no double-precision
25642 floating-point operations are used.
25643
25644 -m4a-single
25645 Generate code for the SH4a assuming the floating-point unit is in
25646 single-precision mode by default.
25647
25648 -m4a
25649 Generate code for the SH4a.
25650
25651 -m4al
25652 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
25653 assembler. GCC doesn't generate any DSP instructions at the
25654 moment.
25655
25656 -mb Compile code for the processor in big-endian mode.
25657
25658 -ml Compile code for the processor in little-endian mode.
25659
25660 -mdalign
25661 Align doubles at 64-bit boundaries. Note that this changes the
25662 calling conventions, and thus some functions from the standard C
25663 library do not work unless you recompile it first with -mdalign.
25664
25665 -mrelax
25666 Shorten some address references at link time, when possible; uses
25667 the linker option -relax.
25668
25669 -mbigtable
25670 Use 32-bit offsets in "switch" tables. The default is to use
25671 16-bit offsets.
25672
25673 -mbitops
25674 Enable the use of bit manipulation instructions on SH2A.
25675
25676 -mfmovd
25677 Enable the use of the instruction "fmovd". Check -mdalign for
25678 alignment constraints.
25679
25680 -mrenesas
25681 Comply with the calling conventions defined by Renesas.
25682
25683 -mno-renesas
25684 Comply with the calling conventions defined for GCC before the
25685 Renesas conventions were available. This option is the default for
25686 all targets of the SH toolchain.
25687
25688 -mnomacsave
25689 Mark the "MAC" register as call-clobbered, even if -mrenesas is
25690 given.
25691
25692 -mieee
25693 -mno-ieee
25694 Control the IEEE compliance of floating-point comparisons, which
25695 affects the handling of cases where the result of a comparison is
25696 unordered. By default -mieee is implicitly enabled. If
25697 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
25698 results in faster floating-point greater-equal and less-equal
25699 comparisons. The implicit settings can be overridden by specifying
25700 either -mieee or -mno-ieee.
25701
25702 -minline-ic_invalidate
25703 Inline code to invalidate instruction cache entries after setting
25704 up nested function trampolines. This option has no effect if
25705 -musermode is in effect and the selected code generation option
25706 (e.g. -m4) does not allow the use of the "icbi" instruction. If
25707 the selected code generation option does not allow the use of the
25708 "icbi" instruction, and -musermode is not in effect, the inlined
25709 code manipulates the instruction cache address array directly with
25710 an associative write. This not only requires privileged mode at
25711 run time, but it also fails if the cache line had been mapped via
25712 the TLB and has become unmapped.
25713
25714 -misize
25715 Dump instruction size and location in the assembly code.
25716
25717 -mpadstruct
25718 This option is deprecated. It pads structures to multiple of 4
25719 bytes, which is incompatible with the SH ABI.
25720
25721 -matomic-model=model
25722 Sets the model of atomic operations and additional parameters as a
25723 comma separated list. For details on the atomic built-in functions
25724 see __atomic Builtins. The following models and parameters are
25725 supported:
25726
25727 none
25728 Disable compiler generated atomic sequences and emit library
25729 calls for atomic operations. This is the default if the target
25730 is not "sh*-*-linux*".
25731
25732 soft-gusa
25733 Generate GNU/Linux compatible gUSA software atomic sequences
25734 for the atomic built-in functions. The generated atomic
25735 sequences require additional support from the
25736 interrupt/exception handling code of the system and are only
25737 suitable for SH3* and SH4* single-core systems. This option is
25738 enabled by default when the target is "sh*-*-linux*" and SH3*
25739 or SH4*. When the target is SH4A, this option also partially
25740 utilizes the hardware atomic instructions "movli.l" and
25741 "movco.l" to create more efficient code, unless strict is
25742 specified.
25743
25744 soft-tcb
25745 Generate software atomic sequences that use a variable in the
25746 thread control block. This is a variation of the gUSA
25747 sequences which can also be used on SH1* and SH2* targets. The
25748 generated atomic sequences require additional support from the
25749 interrupt/exception handling code of the system and are only
25750 suitable for single-core systems. When using this model, the
25751 gbr-offset= parameter has to be specified as well.
25752
25753 soft-imask
25754 Generate software atomic sequences that temporarily disable
25755 interrupts by setting "SR.IMASK = 1111". This model works only
25756 when the program runs in privileged mode and is only suitable
25757 for single-core systems. Additional support from the
25758 interrupt/exception handling code of the system is not
25759 required. This model is enabled by default when the target is
25760 "sh*-*-linux*" and SH1* or SH2*.
25761
25762 hard-llcs
25763 Generate hardware atomic sequences using the "movli.l" and
25764 "movco.l" instructions only. This is only available on SH4A
25765 and is suitable for multi-core systems. Since the hardware
25766 instructions support only 32 bit atomic variables access to 8
25767 or 16 bit variables is emulated with 32 bit accesses. Code
25768 compiled with this option is also compatible with other
25769 software atomic model interrupt/exception handling systems if
25770 executed on an SH4A system. Additional support from the
25771 interrupt/exception handling code of the system is not required
25772 for this model.
25773
25774 gbr-offset=
25775 This parameter specifies the offset in bytes of the variable in
25776 the thread control block structure that should be used by the
25777 generated atomic sequences when the soft-tcb model has been
25778 selected. For other models this parameter is ignored. The
25779 specified value must be an integer multiple of four and in the
25780 range 0-1020.
25781
25782 strict
25783 This parameter prevents mixed usage of multiple atomic models,
25784 even if they are compatible, and makes the compiler generate
25785 atomic sequences of the specified model only.
25786
25787 -mtas
25788 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
25789 that depending on the particular hardware and software
25790 configuration this can degrade overall performance due to the
25791 operand cache line flushes that are implied by the "tas.b"
25792 instruction. On multi-core SH4A processors the "tas.b" instruction
25793 must be used with caution since it can result in data corruption
25794 for certain cache configurations.
25795
25796 -mprefergot
25797 When generating position-independent code, emit function calls
25798 using the Global Offset Table instead of the Procedure Linkage
25799 Table.
25800
25801 -musermode
25802 -mno-usermode
25803 Don't allow (allow) the compiler generating privileged mode code.
25804 Specifying -musermode also implies -mno-inline-ic_invalidate if the
25805 inlined code would not work in user mode. -musermode is the
25806 default when the target is "sh*-*-linux*". If the target is SH1*
25807 or SH2* -musermode has no effect, since there is no user mode.
25808
25809 -multcost=number
25810 Set the cost to assume for a multiply insn.
25811
25812 -mdiv=strategy
25813 Set the division strategy to be used for integer division
25814 operations. strategy can be one of:
25815
25816 call-div1
25817 Calls a library function that uses the single-step division
25818 instruction "div1" to perform the operation. Division by zero
25819 calculates an unspecified result and does not trap. This is
25820 the default except for SH4, SH2A and SHcompact.
25821
25822 call-fp
25823 Calls a library function that performs the operation in double
25824 precision floating point. Division by zero causes a floating-
25825 point exception. This is the default for SHcompact with FPU.
25826 Specifying this for targets that do not have a double precision
25827 FPU defaults to "call-div1".
25828
25829 call-table
25830 Calls a library function that uses a lookup table for small
25831 divisors and the "div1" instruction with case distinction for
25832 larger divisors. Division by zero calculates an unspecified
25833 result and does not trap. This is the default for SH4.
25834 Specifying this for targets that do not have dynamic shift
25835 instructions defaults to "call-div1".
25836
25837 When a division strategy has not been specified the default
25838 strategy is selected based on the current target. For SH2A the
25839 default strategy is to use the "divs" and "divu" instructions
25840 instead of library function calls.
25841
25842 -maccumulate-outgoing-args
25843 Reserve space once for outgoing arguments in the function prologue
25844 rather than around each call. Generally beneficial for performance
25845 and size. Also needed for unwinding to avoid changing the stack
25846 frame around conditional code.
25847
25848 -mdivsi3_libfunc=name
25849 Set the name of the library function used for 32-bit signed
25850 division to name. This only affects the name used in the call
25851 division strategies, and the compiler still expects the same sets
25852 of input/output/clobbered registers as if this option were not
25853 present.
25854
25855 -mfixed-range=register-range
25856 Generate code treating the given register range as fixed registers.
25857 A fixed register is one that the register allocator cannot use.
25858 This is useful when compiling kernel code. A register range is
25859 specified as two registers separated by a dash. Multiple register
25860 ranges can be specified separated by a comma.
25861
25862 -mbranch-cost=num
25863 Assume num to be the cost for a branch instruction. Higher numbers
25864 make the compiler try to generate more branch-free code if
25865 possible. If not specified the value is selected depending on the
25866 processor type that is being compiled for.
25867
25868 -mzdcbranch
25869 -mno-zdcbranch
25870 Assume (do not assume) that zero displacement conditional branch
25871 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
25872 the compiler prefers zero displacement branch code sequences. This
25873 is enabled by default when generating code for SH4 and SH4A. It
25874 can be explicitly disabled by specifying -mno-zdcbranch.
25875
25876 -mcbranch-force-delay-slot
25877 Force the usage of delay slots for conditional branches, which
25878 stuffs the delay slot with a "nop" if a suitable instruction cannot
25879 be found. By default this option is disabled. It can be enabled
25880 to work around hardware bugs as found in the original SH7055.
25881
25882 -mfused-madd
25883 -mno-fused-madd
25884 Generate code that uses (does not use) the floating-point multiply
25885 and accumulate instructions. These instructions are generated by
25886 default if hardware floating point is used. The machine-dependent
25887 -mfused-madd option is now mapped to the machine-independent
25888 -ffp-contract=fast option, and -mno-fused-madd is mapped to
25889 -ffp-contract=off.
25890
25891 -mfsca
25892 -mno-fsca
25893 Allow or disallow the compiler to emit the "fsca" instruction for
25894 sine and cosine approximations. The option -mfsca must be used in
25895 combination with -funsafe-math-optimizations. It is enabled by
25896 default when generating code for SH4A. Using -mno-fsca disables
25897 sine and cosine approximations even if -funsafe-math-optimizations
25898 is in effect.
25899
25900 -mfsrra
25901 -mno-fsrra
25902 Allow or disallow the compiler to emit the "fsrra" instruction for
25903 reciprocal square root approximations. The option -mfsrra must be
25904 used in combination with -funsafe-math-optimizations and
25905 -ffinite-math-only. It is enabled by default when generating code
25906 for SH4A. Using -mno-fsrra disables reciprocal square root
25907 approximations even if -funsafe-math-optimizations and
25908 -ffinite-math-only are in effect.
25909
25910 -mpretend-cmove
25911 Prefer zero-displacement conditional branches for conditional move
25912 instruction patterns. This can result in faster code on the SH4
25913 processor.
25914
25915 -mfdpic
25916 Generate code using the FDPIC ABI.
25917
25918 Solaris 2 Options
25919 These -m options are supported on Solaris 2:
25920
25921 -mclear-hwcap
25922 -mclear-hwcap tells the compiler to remove the hardware
25923 capabilities generated by the Solaris assembler. This is only
25924 necessary when object files use ISA extensions not supported by the
25925 current machine, but check at runtime whether or not to use them.
25926
25927 -mimpure-text
25928 -mimpure-text, used in addition to -shared, tells the compiler to
25929 not pass -z text to the linker when linking a shared object. Using
25930 this option, you can link position-dependent code into a shared
25931 object.
25932
25933 -mimpure-text suppresses the "relocations remain against
25934 allocatable but non-writable sections" linker error message.
25935 However, the necessary relocations trigger copy-on-write, and the
25936 shared object is not actually shared across processes. Instead of
25937 using -mimpure-text, you should compile all source code with -fpic
25938 or -fPIC.
25939
25940 These switches are supported in addition to the above on Solaris 2:
25941
25942 -pthreads
25943 This is a synonym for -pthread.
25944
25945 SPARC Options
25946 These -m options are supported on the SPARC:
25947
25948 -mno-app-regs
25949 -mapp-regs
25950 Specify -mapp-regs to generate output using the global registers 2
25951 through 4, which the SPARC SVR4 ABI reserves for applications.
25952 Like the global register 1, each global register 2 through 4 is
25953 then treated as an allocable register that is clobbered by function
25954 calls. This is the default.
25955
25956 To be fully SVR4 ABI-compliant at the cost of some performance
25957 loss, specify -mno-app-regs. You should compile libraries and
25958 system software with this option.
25959
25960 -mflat
25961 -mno-flat
25962 With -mflat, the compiler does not generate save/restore
25963 instructions and uses a "flat" or single register window model.
25964 This model is compatible with the regular register window model.
25965 The local registers and the input registers (0--5) are still
25966 treated as "call-saved" registers and are saved on the stack as
25967 needed.
25968
25969 With -mno-flat (the default), the compiler generates save/restore
25970 instructions (except for leaf functions). This is the normal
25971 operating mode.
25972
25973 -mfpu
25974 -mhard-float
25975 Generate output containing floating-point instructions. This is
25976 the default.
25977
25978 -mno-fpu
25979 -msoft-float
25980 Generate output containing library calls for floating point.
25981 Warning: the requisite libraries are not available for all SPARC
25982 targets. Normally the facilities of the machine's usual C compiler
25983 are used, but this cannot be done directly in cross-compilation.
25984 You must make your own arrangements to provide suitable library
25985 functions for cross-compilation. The embedded targets sparc-*-aout
25986 and sparclite-*-* do provide software floating-point support.
25987
25988 -msoft-float changes the calling convention in the output file;
25989 therefore, it is only useful if you compile all of a program with
25990 this option. In particular, you need to compile libgcc.a, the
25991 library that comes with GCC, with -msoft-float in order for this to
25992 work.
25993
25994 -mhard-quad-float
25995 Generate output containing quad-word (long double) floating-point
25996 instructions.
25997
25998 -msoft-quad-float
25999 Generate output containing library calls for quad-word (long
26000 double) floating-point instructions. The functions called are
26001 those specified in the SPARC ABI. This is the default.
26002
26003 As of this writing, there are no SPARC implementations that have
26004 hardware support for the quad-word floating-point instructions.
26005 They all invoke a trap handler for one of these instructions, and
26006 then the trap handler emulates the effect of the instruction.
26007 Because of the trap handler overhead, this is much slower than
26008 calling the ABI library routines. Thus the -msoft-quad-float
26009 option is the default.
26010
26011 -mno-unaligned-doubles
26012 -munaligned-doubles
26013 Assume that doubles have 8-byte alignment. This is the default.
26014
26015 With -munaligned-doubles, GCC assumes that doubles have 8-byte
26016 alignment only if they are contained in another type, or if they
26017 have an absolute address. Otherwise, it assumes they have 4-byte
26018 alignment. Specifying this option avoids some rare compatibility
26019 problems with code generated by other compilers. It is not the
26020 default because it results in a performance loss, especially for
26021 floating-point code.
26022
26023 -muser-mode
26024 -mno-user-mode
26025 Do not generate code that can only run in supervisor mode. This is
26026 relevant only for the "casa" instruction emitted for the LEON3
26027 processor. This is the default.
26028
26029 -mfaster-structs
26030 -mno-faster-structs
26031 With -mfaster-structs, the compiler assumes that structures should
26032 have 8-byte alignment. This enables the use of pairs of "ldd" and
26033 "std" instructions for copies in structure assignment, in place of
26034 twice as many "ld" and "st" pairs. However, the use of this
26035 changed alignment directly violates the SPARC ABI. Thus, it's
26036 intended only for use on targets where the developer acknowledges
26037 that their resulting code is not directly in line with the rules of
26038 the ABI.
26039
26040 -mstd-struct-return
26041 -mno-std-struct-return
26042 With -mstd-struct-return, the compiler generates checking code in
26043 functions returning structures or unions to detect size mismatches
26044 between the two sides of function calls, as per the 32-bit ABI.
26045
26046 The default is -mno-std-struct-return. This option has no effect
26047 in 64-bit mode.
26048
26049 -mlra
26050 -mno-lra
26051 Enable Local Register Allocation. This is the default for SPARC
26052 since GCC 7 so -mno-lra needs to be passed to get old Reload.
26053
26054 -mcpu=cpu_type
26055 Set the instruction set, register set, and instruction scheduling
26056 parameters for machine type cpu_type. Supported values for
26057 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
26058 leon3v7, leon5, sparclite, f930, f934, sparclite86x, sparclet,
26059 tsc701, v9, ultrasparc, ultrasparc3, niagara, niagara2, niagara3,
26060 niagara4, niagara7 and m8.
26061
26062 Native Solaris and GNU/Linux toolchains also support the value
26063 native, which selects the best architecture option for the host
26064 processor. -mcpu=native has no effect if GCC does not recognize
26065 the processor.
26066
26067 Default instruction scheduling parameters are used for values that
26068 select an architecture and not an implementation. These are v7,
26069 v8, sparclite, sparclet, v9.
26070
26071 Here is a list of each supported architecture and their supported
26072 implementations.
26073
26074 v7 cypress, leon3v7
26075
26076 v8 supersparc, hypersparc, leon, leon3, leon5
26077
26078 sparclite
26079 f930, f934, sparclite86x
26080
26081 sparclet
26082 tsc701
26083
26084 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26085 niagara7, m8
26086
26087 By default (unless configured otherwise), GCC generates code for
26088 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
26089 compiler additionally optimizes it for the Cypress CY7C602 chip, as
26090 used in the SPARCStation/SPARCServer 3xx series. This is also
26091 appropriate for the older SPARCStation 1, 2, IPX etc.
26092
26093 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
26094 architecture. The only difference from V7 code is that the
26095 compiler emits the integer multiply and integer divide instructions
26096 which exist in SPARC-V8 but not in SPARC-V7. With
26097 -mcpu=supersparc, the compiler additionally optimizes it for the
26098 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
26099 series.
26100
26101 With -mcpu=sparclite, GCC generates code for the SPARClite variant
26102 of the SPARC architecture. This adds the integer multiply, integer
26103 divide step and scan ("ffs") instructions which exist in SPARClite
26104 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
26105 optimizes it for the Fujitsu MB86930 chip, which is the original
26106 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
26107 optimizes it for the Fujitsu MB86934 chip, which is the more recent
26108 SPARClite with FPU.
26109
26110 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
26111 the SPARC architecture. This adds the integer multiply,
26112 multiply/accumulate, integer divide step and scan ("ffs")
26113 instructions which exist in SPARClet but not in SPARC-V7. With
26114 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
26115 SPARClet chip.
26116
26117 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
26118 architecture. This adds 64-bit integer and floating-point move
26119 instructions, 3 additional floating-point condition code registers
26120 and conditional move instructions. With -mcpu=ultrasparc, the
26121 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
26122 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
26123 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26124 -mcpu=niagara, the compiler additionally optimizes it for Sun
26125 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
26126 additionally optimizes it for Sun UltraSPARC T2 chips. With
26127 -mcpu=niagara3, the compiler additionally optimizes it for Sun
26128 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
26129 additionally optimizes it for Sun UltraSPARC T4 chips. With
26130 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
26131 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
26132 it for Oracle M8 chips.
26133
26134 -mtune=cpu_type
26135 Set the instruction scheduling parameters for machine type
26136 cpu_type, but do not set the instruction set or register set that
26137 the option -mcpu=cpu_type does.
26138
26139 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
26140 but the only useful values are those that select a particular CPU
26141 implementation. Those are cypress, supersparc, hypersparc, leon,
26142 leon3, leon3v7, leon5, f930, f934, sparclite86x, tsc701,
26143 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26144 niagara7 and m8. With native Solaris and GNU/Linux toolchains,
26145 native can also be used.
26146
26147 -mv8plus
26148 -mno-v8plus
26149 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
26150 difference from the V8 ABI is that the global and out registers are
26151 considered 64 bits wide. This is enabled by default on Solaris in
26152 32-bit mode for all SPARC-V9 processors.
26153
26154 -mvis
26155 -mno-vis
26156 With -mvis, GCC generates code that takes advantage of the
26157 UltraSPARC Visual Instruction Set extensions. The default is
26158 -mno-vis.
26159
26160 -mvis2
26161 -mno-vis2
26162 With -mvis2, GCC generates code that takes advantage of version 2.0
26163 of the UltraSPARC Visual Instruction Set extensions. The default
26164 is -mvis2 when targeting a cpu that supports such instructions,
26165 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
26166
26167 -mvis3
26168 -mno-vis3
26169 With -mvis3, GCC generates code that takes advantage of version 3.0
26170 of the UltraSPARC Visual Instruction Set extensions. The default
26171 is -mvis3 when targeting a cpu that supports such instructions,
26172 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
26173 -mvis.
26174
26175 -mvis4
26176 -mno-vis4
26177 With -mvis4, GCC generates code that takes advantage of version 4.0
26178 of the UltraSPARC Visual Instruction Set extensions. The default
26179 is -mvis4 when targeting a cpu that supports such instructions,
26180 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
26181 -mvis2 and -mvis.
26182
26183 -mvis4b
26184 -mno-vis4b
26185 With -mvis4b, GCC generates code that takes advantage of version
26186 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
26187 additional VIS instructions introduced in the Oracle SPARC
26188 Architecture 2017. The default is -mvis4b when targeting a cpu
26189 that supports such instructions, such as m8 and later. Setting
26190 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
26191
26192 -mcbcond
26193 -mno-cbcond
26194 With -mcbcond, GCC generates code that takes advantage of the
26195 UltraSPARC Compare-and-Branch-on-Condition instructions. The
26196 default is -mcbcond when targeting a CPU that supports such
26197 instructions, such as Niagara-4 and later.
26198
26199 -mfmaf
26200 -mno-fmaf
26201 With -mfmaf, GCC generates code that takes advantage of the
26202 UltraSPARC Fused Multiply-Add Floating-point instructions. The
26203 default is -mfmaf when targeting a CPU that supports such
26204 instructions, such as Niagara-3 and later.
26205
26206 -mfsmuld
26207 -mno-fsmuld
26208 With -mfsmuld, GCC generates code that takes advantage of the
26209 Floating-point Multiply Single to Double (FsMULd) instruction. The
26210 default is -mfsmuld when targeting a CPU supporting the
26211 architecture versions V8 or V9 with FPU except -mcpu=leon.
26212
26213 -mpopc
26214 -mno-popc
26215 With -mpopc, GCC generates code that takes advantage of the
26216 UltraSPARC Population Count instruction. The default is -mpopc
26217 when targeting a CPU that supports such an instruction, such as
26218 Niagara-2 and later.
26219
26220 -msubxc
26221 -mno-subxc
26222 With -msubxc, GCC generates code that takes advantage of the
26223 UltraSPARC Subtract-Extended-with-Carry instruction. The default
26224 is -msubxc when targeting a CPU that supports such an instruction,
26225 such as Niagara-7 and later.
26226
26227 -mfix-at697f
26228 Enable the documented workaround for the single erratum of the
26229 Atmel AT697F processor (which corresponds to erratum #13 of the
26230 AT697E processor).
26231
26232 -mfix-ut699
26233 Enable the documented workarounds for the floating-point errata and
26234 the data cache nullify errata of the UT699 processor.
26235
26236 -mfix-ut700
26237 Enable the documented workaround for the back-to-back store errata
26238 of the UT699E/UT700 processor.
26239
26240 -mfix-gr712rc
26241 Enable the documented workaround for the back-to-back store errata
26242 of the GR712RC processor.
26243
26244 These -m options are supported in addition to the above on SPARC-V9
26245 processors in 64-bit environments:
26246
26247 -m32
26248 -m64
26249 Generate code for a 32-bit or 64-bit environment. The 32-bit
26250 environment sets int, long and pointer to 32 bits. The 64-bit
26251 environment sets int to 32 bits and long and pointer to 64 bits.
26252
26253 -mcmodel=which
26254 Set the code model to one of
26255
26256 medlow
26257 The Medium/Low code model: 64-bit addresses, programs must be
26258 linked in the low 32 bits of memory. Programs can be
26259 statically or dynamically linked.
26260
26261 medmid
26262 The Medium/Middle code model: 64-bit addresses, programs must
26263 be linked in the low 44 bits of memory, the text and data
26264 segments must be less than 2GB in size and the data segment
26265 must be located within 2GB of the text segment.
26266
26267 medany
26268 The Medium/Anywhere code model: 64-bit addresses, programs may
26269 be linked anywhere in memory, the text and data segments must
26270 be less than 2GB in size and the data segment must be located
26271 within 2GB of the text segment.
26272
26273 embmedany
26274 The Medium/Anywhere code model for embedded systems: 64-bit
26275 addresses, the text and data segments must be less than 2GB in
26276 size, both starting anywhere in memory (determined at link
26277 time). The global register %g4 points to the base of the data
26278 segment. Programs are statically linked and PIC is not
26279 supported.
26280
26281 -mmemory-model=mem-model
26282 Set the memory model in force on the processor to one of
26283
26284 default
26285 The default memory model for the processor and operating
26286 system.
26287
26288 rmo Relaxed Memory Order
26289
26290 pso Partial Store Order
26291
26292 tso Total Store Order
26293
26294 sc Sequential Consistency
26295
26296 These memory models are formally defined in Appendix D of the
26297 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
26298 field.
26299
26300 -mstack-bias
26301 -mno-stack-bias
26302 With -mstack-bias, GCC assumes that the stack pointer, and frame
26303 pointer if present, are offset by -2047 which must be added back
26304 when making stack frame references. This is the default in 64-bit
26305 mode. Otherwise, assume no such offset is present.
26306
26307 Options for System V
26308 These additional options are available on System V Release 4 for
26309 compatibility with other compilers on those systems:
26310
26311 -G Create a shared object. It is recommended that -symbolic or
26312 -shared be used instead.
26313
26314 -Qy Identify the versions of each tool used by the compiler, in a
26315 ".ident" assembler directive in the output.
26316
26317 -Qn Refrain from adding ".ident" directives to the output file (this is
26318 the default).
26319
26320 -YP,dirs
26321 Search the directories dirs, and no others, for libraries specified
26322 with -l.
26323
26324 -Ym,dir
26325 Look in the directory dir to find the M4 preprocessor. The
26326 assembler uses this option.
26327
26328 TILE-Gx Options
26329 These -m options are supported on the TILE-Gx:
26330
26331 -mcmodel=small
26332 Generate code for the small model. The distance for direct calls
26333 is limited to 500M in either direction. PC-relative addresses are
26334 32 bits. Absolute addresses support the full address range.
26335
26336 -mcmodel=large
26337 Generate code for the large model. There is no limitation on call
26338 distance, pc-relative addresses, or absolute addresses.
26339
26340 -mcpu=name
26341 Selects the type of CPU to be targeted. Currently the only
26342 supported type is tilegx.
26343
26344 -m32
26345 -m64
26346 Generate code for a 32-bit or 64-bit environment. The 32-bit
26347 environment sets int, long, and pointer to 32 bits. The 64-bit
26348 environment sets int to 32 bits and long and pointer to 64 bits.
26349
26350 -mbig-endian
26351 -mlittle-endian
26352 Generate code in big/little endian mode, respectively.
26353
26354 TILEPro Options
26355 These -m options are supported on the TILEPro:
26356
26357 -mcpu=name
26358 Selects the type of CPU to be targeted. Currently the only
26359 supported type is tilepro.
26360
26361 -m32
26362 Generate code for a 32-bit environment, which sets int, long, and
26363 pointer to 32 bits. This is the only supported behavior so the
26364 flag is essentially ignored.
26365
26366 V850 Options
26367 These -m options are defined for V850 implementations:
26368
26369 -mlong-calls
26370 -mno-long-calls
26371 Treat all calls as being far away (near). If calls are assumed to
26372 be far away, the compiler always loads the function's address into
26373 a register, and calls indirect through the pointer.
26374
26375 -mno-ep
26376 -mep
26377 Do not optimize (do optimize) basic blocks that use the same index
26378 pointer 4 or more times to copy pointer into the "ep" register, and
26379 use the shorter "sld" and "sst" instructions. The -mep option is
26380 on by default if you optimize.
26381
26382 -mno-prolog-function
26383 -mprolog-function
26384 Do not use (do use) external functions to save and restore
26385 registers at the prologue and epilogue of a function. The external
26386 functions are slower, but use less code space if more than one
26387 function saves the same number of registers. The -mprolog-function
26388 option is on by default if you optimize.
26389
26390 -mspace
26391 Try to make the code as small as possible. At present, this just
26392 turns on the -mep and -mprolog-function options.
26393
26394 -mtda=n
26395 Put static or global variables whose size is n bytes or less into
26396 the tiny data area that register "ep" points to. The tiny data
26397 area can hold up to 256 bytes in total (128 bytes for byte
26398 references).
26399
26400 -msda=n
26401 Put static or global variables whose size is n bytes or less into
26402 the small data area that register "gp" points to. The small data
26403 area can hold up to 64 kilobytes.
26404
26405 -mzda=n
26406 Put static or global variables whose size is n bytes or less into
26407 the first 32 kilobytes of memory.
26408
26409 -mv850
26410 Specify that the target processor is the V850.
26411
26412 -mv850e3v5
26413 Specify that the target processor is the V850E3V5. The
26414 preprocessor constant "__v850e3v5__" is defined if this option is
26415 used.
26416
26417 -mv850e2v4
26418 Specify that the target processor is the V850E3V5. This is an
26419 alias for the -mv850e3v5 option.
26420
26421 -mv850e2v3
26422 Specify that the target processor is the V850E2V3. The
26423 preprocessor constant "__v850e2v3__" is defined if this option is
26424 used.
26425
26426 -mv850e2
26427 Specify that the target processor is the V850E2. The preprocessor
26428 constant "__v850e2__" is defined if this option is used.
26429
26430 -mv850e1
26431 Specify that the target processor is the V850E1. The preprocessor
26432 constants "__v850e1__" and "__v850e__" are defined if this option
26433 is used.
26434
26435 -mv850es
26436 Specify that the target processor is the V850ES. This is an alias
26437 for the -mv850e1 option.
26438
26439 -mv850e
26440 Specify that the target processor is the V850E. The preprocessor
26441 constant "__v850e__" is defined if this option is used.
26442
26443 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
26444 -mv850e2v3 nor -mv850e3v5 are defined then a default target
26445 processor is chosen and the relevant __v850*__ preprocessor
26446 constant is defined.
26447
26448 The preprocessor constants "__v850" and "__v851__" are always
26449 defined, regardless of which processor variant is the target.
26450
26451 -mdisable-callt
26452 -mno-disable-callt
26453 This option suppresses generation of the "CALLT" instruction for
26454 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
26455 v850 architecture.
26456
26457 This option is enabled by default when the RH850 ABI is in use (see
26458 -mrh850-abi), and disabled by default when the GCC ABI is in use.
26459 If "CALLT" instructions are being generated then the C preprocessor
26460 symbol "__V850_CALLT__" is defined.
26461
26462 -mrelax
26463 -mno-relax
26464 Pass on (or do not pass on) the -mrelax command-line option to the
26465 assembler.
26466
26467 -mlong-jumps
26468 -mno-long-jumps
26469 Disable (or re-enable) the generation of PC-relative jump
26470 instructions.
26471
26472 -msoft-float
26473 -mhard-float
26474 Disable (or re-enable) the generation of hardware floating point
26475 instructions. This option is only significant when the target
26476 architecture is V850E2V3 or higher. If hardware floating point
26477 instructions are being generated then the C preprocessor symbol
26478 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
26479 defined.
26480
26481 -mloop
26482 Enables the use of the e3v5 LOOP instruction. The use of this
26483 instruction is not enabled by default when the e3v5 architecture is
26484 selected because its use is still experimental.
26485
26486 -mrh850-abi
26487 -mghs
26488 Enables support for the RH850 version of the V850 ABI. This is the
26489 default. With this version of the ABI the following rules apply:
26490
26491 * Integer sized structures and unions are returned via a memory
26492 pointer rather than a register.
26493
26494 * Large structures and unions (more than 8 bytes in size) are
26495 passed by value.
26496
26497 * Functions are aligned to 16-bit boundaries.
26498
26499 * The -m8byte-align command-line option is supported.
26500
26501 * The -mdisable-callt command-line option is enabled by default.
26502 The -mno-disable-callt command-line option is not supported.
26503
26504 When this version of the ABI is enabled the C preprocessor symbol
26505 "__V850_RH850_ABI__" is defined.
26506
26507 -mgcc-abi
26508 Enables support for the old GCC version of the V850 ABI. With this
26509 version of the ABI the following rules apply:
26510
26511 * Integer sized structures and unions are returned in register
26512 "r10".
26513
26514 * Large structures and unions (more than 8 bytes in size) are
26515 passed by reference.
26516
26517 * Functions are aligned to 32-bit boundaries, unless optimizing
26518 for size.
26519
26520 * The -m8byte-align command-line option is not supported.
26521
26522 * The -mdisable-callt command-line option is supported but not
26523 enabled by default.
26524
26525 When this version of the ABI is enabled the C preprocessor symbol
26526 "__V850_GCC_ABI__" is defined.
26527
26528 -m8byte-align
26529 -mno-8byte-align
26530 Enables support for "double" and "long long" types to be aligned on
26531 8-byte boundaries. The default is to restrict the alignment of all
26532 objects to at most 4-bytes. When -m8byte-align is in effect the C
26533 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
26534
26535 -mbig-switch
26536 Generate code suitable for big switch tables. Use this option only
26537 if the assembler/linker complain about out of range branches within
26538 a switch table.
26539
26540 -mapp-regs
26541 This option causes r2 and r5 to be used in the code generated by
26542 the compiler. This setting is the default.
26543
26544 -mno-app-regs
26545 This option causes r2 and r5 to be treated as fixed registers.
26546
26547 VAX Options
26548 These -m options are defined for the VAX:
26549
26550 -munix
26551 Do not output certain jump instructions ("aobleq" and so on) that
26552 the Unix assembler for the VAX cannot handle across long ranges.
26553
26554 -mgnu
26555 Do output those jump instructions, on the assumption that the GNU
26556 assembler is being used.
26557
26558 -mg Output code for G-format floating-point numbers instead of
26559 D-format.
26560
26561 -mlra
26562 -mno-lra
26563 Enable Local Register Allocation. This is still experimental for
26564 the VAX, so by default the compiler uses standard reload.
26565
26566 Visium Options
26567 -mdebug
26568 A program which performs file I/O and is destined to run on an MCM
26569 target should be linked with this option. It causes the libraries
26570 libc.a and libdebug.a to be linked. The program should be run on
26571 the target under the control of the GDB remote debugging stub.
26572
26573 -msim
26574 A program which performs file I/O and is destined to run on the
26575 simulator should be linked with option. This causes libraries
26576 libc.a and libsim.a to be linked.
26577
26578 -mfpu
26579 -mhard-float
26580 Generate code containing floating-point instructions. This is the
26581 default.
26582
26583 -mno-fpu
26584 -msoft-float
26585 Generate code containing library calls for floating-point.
26586
26587 -msoft-float changes the calling convention in the output file;
26588 therefore, it is only useful if you compile all of a program with
26589 this option. In particular, you need to compile libgcc.a, the
26590 library that comes with GCC, with -msoft-float in order for this to
26591 work.
26592
26593 -mcpu=cpu_type
26594 Set the instruction set, register set, and instruction scheduling
26595 parameters for machine type cpu_type. Supported values for
26596 cpu_type are mcm, gr5 and gr6.
26597
26598 mcm is a synonym of gr5 present for backward compatibility.
26599
26600 By default (unless configured otherwise), GCC generates code for
26601 the GR5 variant of the Visium architecture.
26602
26603 With -mcpu=gr6, GCC generates code for the GR6 variant of the
26604 Visium architecture. The only difference from GR5 code is that the
26605 compiler will generate block move instructions.
26606
26607 -mtune=cpu_type
26608 Set the instruction scheduling parameters for machine type
26609 cpu_type, but do not set the instruction set or register set that
26610 the option -mcpu=cpu_type would.
26611
26612 -msv-mode
26613 Generate code for the supervisor mode, where there are no
26614 restrictions on the access to general registers. This is the
26615 default.
26616
26617 -muser-mode
26618 Generate code for the user mode, where the access to some general
26619 registers is forbidden: on the GR5, registers r24 to r31 cannot be
26620 accessed in this mode; on the GR6, only registers r29 to r31 are
26621 affected.
26622
26623 VMS Options
26624 These -m options are defined for the VMS implementations:
26625
26626 -mvms-return-codes
26627 Return VMS condition codes from "main". The default is to return
26628 POSIX-style condition (e.g. error) codes.
26629
26630 -mdebug-main=prefix
26631 Flag the first routine whose name starts with prefix as the main
26632 routine for the debugger.
26633
26634 -mmalloc64
26635 Default to 64-bit memory allocation routines.
26636
26637 -mpointer-size=size
26638 Set the default size of pointers. Possible options for size are 32
26639 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
26640 no for supporting only 32 bit pointers. The later option disables
26641 "pragma pointer_size".
26642
26643 VxWorks Options
26644 The options in this section are defined for all VxWorks targets.
26645 Options specific to the target hardware are listed with the other
26646 options for that target.
26647
26648 -mrtp
26649 GCC can generate code for both VxWorks kernels and real time
26650 processes (RTPs). This option switches from the former to the
26651 latter. It also defines the preprocessor macro "__RTP__".
26652
26653 -non-static
26654 Link an RTP executable against shared libraries rather than static
26655 libraries. The options -static and -shared can also be used for
26656 RTPs; -static is the default.
26657
26658 -Bstatic
26659 -Bdynamic
26660 These options are passed down to the linker. They are defined for
26661 compatibility with Diab.
26662
26663 -Xbind-lazy
26664 Enable lazy binding of function calls. This option is equivalent
26665 to -Wl,-z,now and is defined for compatibility with Diab.
26666
26667 -Xbind-now
26668 Disable lazy binding of function calls. This option is the default
26669 and is defined for compatibility with Diab.
26670
26671 x86 Options
26672 These -m options are defined for the x86 family of computers.
26673
26674 -march=cpu-type
26675 Generate instructions for the machine type cpu-type. In contrast
26676 to -mtune=cpu-type, which merely tunes the generated code for the
26677 specified cpu-type, -march=cpu-type allows GCC to generate code
26678 that may not run at all on processors other than the one indicated.
26679 Specifying -march=cpu-type implies -mtune=cpu-type, except where
26680 noted otherwise.
26681
26682 The choices for cpu-type are:
26683
26684 native
26685 This selects the CPU to generate code for at compilation time
26686 by determining the processor type of the compiling machine.
26687 Using -march=native enables all instruction subsets supported
26688 by the local machine (hence the result might not run on
26689 different machines). Using -mtune=native produces code
26690 optimized for the local machine under the constraints of the
26691 selected instruction set.
26692
26693 x86-64
26694 A generic CPU with 64-bit extensions.
26695
26696 x86-64-v2
26697 x86-64-v3
26698 x86-64-v4
26699 These choices for cpu-type select the corresponding micro-
26700 architecture level from the x86-64 psABI. On ABIs other than
26701 the x86-64 psABI they select the same CPU features as the
26702 x86-64 psABI documents for the particular micro-architecture
26703 level.
26704
26705 Since these cpu-type values do not have a corresponding -mtune
26706 setting, using -march with these values enables generic tuning.
26707 Specific tuning can be enabled using the -mtune=other-cpu-type
26708 option with an appropriate other-cpu-type value.
26709
26710 i386
26711 Original Intel i386 CPU.
26712
26713 i486
26714 Intel i486 CPU. (No scheduling is implemented for this chip.)
26715
26716 i586
26717 pentium
26718 Intel Pentium CPU with no MMX support.
26719
26720 lakemont
26721 Intel Lakemont MCU, based on Intel Pentium CPU.
26722
26723 pentium-mmx
26724 Intel Pentium MMX CPU, based on Pentium core with MMX
26725 instruction set support.
26726
26727 pentiumpro
26728 Intel Pentium Pro CPU.
26729
26730 i686
26731 When used with -march, the Pentium Pro instruction set is used,
26732 so the code runs on all i686 family chips. When used with
26733 -mtune, it has the same meaning as generic.
26734
26735 pentium2
26736 Intel Pentium II CPU, based on Pentium Pro core with MMX and
26737 FXSR instruction set support.
26738
26739 pentium3
26740 pentium3m
26741 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR
26742 and SSE instruction set support.
26743
26744 pentium-m
26745 Intel Pentium M; low-power version of Intel Pentium III CPU
26746 with MMX, SSE, SSE2 and FXSR instruction set support. Used by
26747 Centrino notebooks.
26748
26749 pentium4
26750 pentium4m
26751 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction
26752 set support.
26753
26754 prescott
26755 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2,
26756 SSE3 and FXSR instruction set support.
26757
26758 nocona
26759 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
26760 MMX, SSE, SSE2, SSE3 and FXSR instruction set support.
26761
26762 core2
26763 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
26764 SSSE3, CX16, SAHF and FXSR instruction set support.
26765
26766 nehalem
26767 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
26768 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction
26769 set support.
26770
26771 westmere
26772 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
26773 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and
26774 PCLMUL instruction set support.
26775
26776 sandybridge
26777 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
26778 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
26779 XSAVE and PCLMUL instruction set support.
26780
26781 ivybridge
26782 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
26783 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
26784 XSAVE, PCLMUL, FSGSBASE, RDRND and F16C instruction set
26785 support.
26786
26787 haswell
26788 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
26789 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26790 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26791 LZCNT, FMA, MOVBE and HLE instruction set support.
26792
26793 broadwell
26794 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
26795 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26796 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26797 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW instruction
26798 set support.
26799
26800 skylake
26801 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26802 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26803 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26804 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26805 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
26806
26807 bonnell
26808 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
26809 SSE2, SSE3 and SSSE3 instruction set support.
26810
26811 silvermont
26812 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
26813 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26814 PCLMUL, PREFETCHW and RDRND instruction set support.
26815
26816 goldmont
26817 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
26818 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26819 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
26820 XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction set
26821 support.
26822
26823 goldmont-plus
26824 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
26825 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26826 FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE,
26827 XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID
26828 and SGX instruction set support.
26829
26830 tremont
26831 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
26832 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26833 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
26834 XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID, SGX,
26835 CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG
26836 instruction set support.
26837
26838 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
26839 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26840 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26841 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
26842 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1
26843 instruction set support.
26844
26845 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
26846 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26847 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26848 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AVX512PF,
26849 AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
26850 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
26851
26852 skylake-avx512
26853 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
26854 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26855 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26856 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26857 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
26858 AVX512BW, AVX512DQ and AVX512CD instruction set support.
26859
26860 cannonlake
26861 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX,
26862 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26863 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26864 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26865 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26866 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA
26867 instruction set support.
26868
26869 icelake-client
26870 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX,
26871 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26872 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26873 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26874 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26875 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
26876 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
26877 RDPID and AVX512VPOPCNTDQ instruction set support.
26878
26879 icelake-server
26880 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
26881 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26882 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26883 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26884 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26885 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
26886 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
26887 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB instruction
26888 set support.
26889
26890 cascadelake
26891 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26892 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26893 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26894 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26895 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
26896 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
26897 support.
26898
26899 cooperlake
26900 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26901 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26902 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26903 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26904 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
26905 AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16
26906 instruction set support.
26907
26908 tigerlake
26909 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26910 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26911 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26912 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26913 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26914 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
26915 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
26916 RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
26917 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
26918
26919 sapphirerapids
26920 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX,
26921 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26922 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26923 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26924 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26925 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
26926 AVX512VNNI, GFNI, VAES, AVX512VBMI2 VPCLMULQDQ, AVX512BITALG,
26927 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI,
26928 MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE,
26929 WAITPKG, SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE,
26930 AMX-INT8, AVX-VNNI, AVX512FP16 and AVX512BF16 instruction set
26931 support.
26932
26933 alderlake
26934 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26935 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
26936 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
26937 PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
26938 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
26939 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
26940 WIDEKL and AVX-VNNI instruction set support.
26941
26942 rocketlake
26943 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26944 SSE2, SSE3, SSSE3 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26945 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26946 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26947 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW,
26948 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
26949 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
26950 RDPID and AVX512VPOPCNTDQ instruction set support.
26951
26952 k6 AMD K6 CPU with MMX instruction set support.
26953
26954 k6-2
26955 k6-3
26956 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
26957 set support.
26958
26959 athlon
26960 athlon-tbird
26961 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
26962 prefetch instructions support.
26963
26964 athlon-4
26965 athlon-xp
26966 athlon-mp
26967 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
26968 full SSE instruction set support.
26969
26970 k8
26971 opteron
26972 athlon64
26973 athlon-fx
26974 Processors based on the AMD K8 core with x86-64 instruction set
26975 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
26976 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
26977 3DNow! and 64-bit instruction set extensions.)
26978
26979 k8-sse3
26980 opteron-sse3
26981 athlon64-sse3
26982 Improved versions of AMD K8 cores with SSE3 instruction set
26983 support.
26984
26985 amdfam10
26986 barcelona
26987 CPUs based on AMD Family 10h cores with x86-64 instruction set
26988 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
26989 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
26990
26991 bdver1
26992 CPUs based on AMD Family 15h cores with x86-64 instruction set
26993 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL,
26994 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
26995 and 64-bit instruction set extensions.)
26996
26997 bdver2
26998 AMD Family 15h core based CPUs with x86-64 instruction set
26999 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
27000 LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27001 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27002
27003 bdver3
27004 AMD Family 15h core based CPUs with x86-64 instruction set
27005 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
27006 AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27007 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27008 extensions.)
27009
27010 bdver4
27011 AMD Family 15h core based CPUs with x86-64 instruction set
27012 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
27013 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX,
27014 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
27015 instruction set extensions.)
27016
27017 znver1
27018 AMD Family 17h core based CPUs with x86-64 instruction set
27019 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
27020 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16,
27021 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
27022 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
27023 extensions.)
27024
27025 znver2
27026 AMD Family 17h core based CPUs with x86-64 instruction set
27027 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
27028 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
27029 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27030 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
27031 WBNOINVD, and 64-bit instruction set extensions.)
27032
27033 znver3
27034 AMD Family 19h core based CPUs with x86-64 instruction set
27035 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
27036 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
27037 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27038 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
27039 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set
27040 extensions.)
27041
27042 btver1
27043 CPUs based on AMD Family 14h cores with x86-64 instruction set
27044 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
27045 CX16, ABM and 64-bit instruction set extensions.)
27046
27047 btver2
27048 CPUs based on AMD Family 16h cores with x86-64 instruction set
27049 support. This includes MOVBE, F16C, BMI, AVX, PCLMUL, AES,
27050 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
27051 and 64-bit instruction set extensions.
27052
27053 winchip-c6
27054 IDT WinChip C6 CPU, dealt in same way as i486 with additional
27055 MMX instruction set support.
27056
27057 winchip2
27058 IDT WinChip 2 CPU, dealt in same way as i486 with additional
27059 MMX and 3DNow! instruction set support.
27060
27061 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
27062 scheduling is implemented for this chip.)
27063
27064 c3-2
27065 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
27066 support. (No scheduling is implemented for this chip.)
27067
27068 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
27069 set support. (No scheduling is implemented for this chip.)
27070
27071 samuel-2
27072 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
27073 support. (No scheduling is implemented for this chip.)
27074
27075 nehemiah
27076 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27077 (No scheduling is implemented for this chip.)
27078
27079 esther
27080 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
27081 set support. (No scheduling is implemented for this chip.)
27082
27083 eden-x2
27084 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
27085 instruction set support. (No scheduling is implemented for
27086 this chip.)
27087
27088 eden-x4
27089 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
27090 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
27091 scheduling is implemented for this chip.)
27092
27093 nano
27094 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
27095 SSSE3 instruction set support. (No scheduling is implemented
27096 for this chip.)
27097
27098 nano-1000
27099 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27100 instruction set support. (No scheduling is implemented for
27101 this chip.)
27102
27103 nano-2000
27104 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27105 instruction set support. (No scheduling is implemented for
27106 this chip.)
27107
27108 nano-3000
27109 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
27110 SSE4.1 instruction set support. (No scheduling is implemented
27111 for this chip.)
27112
27113 nano-x2
27114 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
27115 and SSE4.1 instruction set support. (No scheduling is
27116 implemented for this chip.)
27117
27118 nano-x4
27119 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
27120 and SSE4.1 instruction set support. (No scheduling is
27121 implemented for this chip.)
27122
27123 geode
27124 AMD Geode embedded processor with MMX and 3DNow! instruction
27125 set support.
27126
27127 -mtune=cpu-type
27128 Tune to cpu-type everything applicable about the generated code,
27129 except for the ABI and the set of available instructions. While
27130 picking a specific cpu-type schedules things appropriately for that
27131 particular chip, the compiler does not generate any code that
27132 cannot run on the default machine type unless you use a -march=cpu-
27133 type option. For example, if GCC is configured for
27134 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
27135 for Pentium 4 but still runs on i686 machines.
27136
27137 The choices for cpu-type are the same as for -march. In addition,
27138 -mtune supports 2 extra choices for cpu-type:
27139
27140 generic
27141 Produce code optimized for the most common IA32/AMD64/EM64T
27142 processors. If you know the CPU on which your code will run,
27143 then you should use the corresponding -mtune or -march option
27144 instead of -mtune=generic. But, if you do not know exactly
27145 what CPU users of your application will have, then you should
27146 use this option.
27147
27148 As new processors are deployed in the marketplace, the behavior
27149 of this option will change. Therefore, if you upgrade to a
27150 newer version of GCC, code generation controlled by this option
27151 will change to reflect the processors that are most common at
27152 the time that version of GCC is released.
27153
27154 There is no -march=generic option because -march indicates the
27155 instruction set the compiler can use, and there is no generic
27156 instruction set applicable to all processors. In contrast,
27157 -mtune indicates the processor (or, in this case, collection of
27158 processors) for which the code is optimized.
27159
27160 intel
27161 Produce code optimized for the most current Intel processors,
27162 which are Haswell and Silvermont for this version of GCC. If
27163 you know the CPU on which your code will run, then you should
27164 use the corresponding -mtune or -march option instead of
27165 -mtune=intel. But, if you want your application performs
27166 better on both Haswell and Silvermont, then you should use this
27167 option.
27168
27169 As new Intel processors are deployed in the marketplace, the
27170 behavior of this option will change. Therefore, if you upgrade
27171 to a newer version of GCC, code generation controlled by this
27172 option will change to reflect the most current Intel processors
27173 at the time that version of GCC is released.
27174
27175 There is no -march=intel option because -march indicates the
27176 instruction set the compiler can use, and there is no common
27177 instruction set applicable to all processors. In contrast,
27178 -mtune indicates the processor (or, in this case, collection of
27179 processors) for which the code is optimized.
27180
27181 -mcpu=cpu-type
27182 A deprecated synonym for -mtune.
27183
27184 -mfpmath=unit
27185 Generate floating-point arithmetic for selected unit unit. The
27186 choices for unit are:
27187
27188 387 Use the standard 387 floating-point coprocessor present on the
27189 majority of chips and emulated otherwise. Code compiled with
27190 this option runs almost everywhere. The temporary results are
27191 computed in 80-bit precision instead of the precision specified
27192 by the type, resulting in slightly different results compared
27193 to most of other chips. See -ffloat-store for more detailed
27194 description.
27195
27196 This is the default choice for non-Darwin x86-32 targets.
27197
27198 sse Use scalar floating-point instructions present in the SSE
27199 instruction set. This instruction set is supported by Pentium
27200 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
27201 and Athlon MP chips. The earlier version of the SSE
27202 instruction set supports only single-precision arithmetic, thus
27203 the double and extended-precision arithmetic are still done
27204 using 387. A later version, present only in Pentium 4 and AMD
27205 x86-64 chips, supports double-precision arithmetic too.
27206
27207 For the x86-32 compiler, you must use -march=cpu-type, -msse or
27208 -msse2 switches to enable SSE extensions and make this option
27209 effective. For the x86-64 compiler, these extensions are
27210 enabled by default.
27211
27212 The resulting code should be considerably faster in the
27213 majority of cases and avoid the numerical instability problems
27214 of 387 code, but may break some existing code that expects
27215 temporaries to be 80 bits.
27216
27217 This is the default choice for the x86-64 compiler, Darwin
27218 x86-32 targets, and the default choice for x86-32 targets with
27219 the SSE2 instruction set when -ffast-math is enabled.
27220
27221 sse,387
27222 sse+387
27223 both
27224 Attempt to utilize both instruction sets at once. This
27225 effectively doubles the amount of available registers, and on
27226 chips with separate execution units for 387 and SSE the
27227 execution resources too. Use this option with care, as it is
27228 still experimental, because the GCC register allocator does not
27229 model separate functional units well, resulting in unstable
27230 performance.
27231
27232 -masm=dialect
27233 Output assembly instructions using selected dialect. Also affects
27234 which dialect is used for basic "asm" and extended "asm". Supported
27235 choices (in dialect order) are att or intel. The default is att.
27236 Darwin does not support intel.
27237
27238 -mieee-fp
27239 -mno-ieee-fp
27240 Control whether or not the compiler uses IEEE floating-point
27241 comparisons. These correctly handle the case where the result of a
27242 comparison is unordered.
27243
27244 -m80387
27245 -mhard-float
27246 Generate output containing 80387 instructions for floating point.
27247
27248 -mno-80387
27249 -msoft-float
27250 Generate output containing library calls for floating point.
27251
27252 Warning: the requisite libraries are not part of GCC. Normally the
27253 facilities of the machine's usual C compiler are used, but this
27254 cannot be done directly in cross-compilation. You must make your
27255 own arrangements to provide suitable library functions for cross-
27256 compilation.
27257
27258 On machines where a function returns floating-point results in the
27259 80387 register stack, some floating-point opcodes may be emitted
27260 even if -msoft-float is used.
27261
27262 -mno-fp-ret-in-387
27263 Do not use the FPU registers for return values of functions.
27264
27265 The usual calling convention has functions return values of types
27266 "float" and "double" in an FPU register, even if there is no FPU.
27267 The idea is that the operating system should emulate an FPU.
27268
27269 The option -mno-fp-ret-in-387 causes such values to be returned in
27270 ordinary CPU registers instead.
27271
27272 -mno-fancy-math-387
27273 Some 387 emulators do not support the "sin", "cos" and "sqrt"
27274 instructions for the 387. Specify this option to avoid generating
27275 those instructions. This option is overridden when -march
27276 indicates that the target CPU always has an FPU and so the
27277 instruction does not need emulation. These instructions are not
27278 generated unless you also use the -funsafe-math-optimizations
27279 switch.
27280
27281 -malign-double
27282 -mno-align-double
27283 Control whether GCC aligns "double", "long double", and "long long"
27284 variables on a two-word boundary or a one-word boundary. Aligning
27285 "double" variables on a two-word boundary produces code that runs
27286 somewhat faster on a Pentium at the expense of more memory.
27287
27288 On x86-64, -malign-double is enabled by default.
27289
27290 Warning: if you use the -malign-double switch, structures
27291 containing the above types are aligned differently than the
27292 published application binary interface specifications for the
27293 x86-32 and are not binary compatible with structures in code
27294 compiled without that switch.
27295
27296 -m96bit-long-double
27297 -m128bit-long-double
27298 These switches control the size of "long double" type. The x86-32
27299 application binary interface specifies the size to be 96 bits, so
27300 -m96bit-long-double is the default in 32-bit mode.
27301
27302 Modern architectures (Pentium and newer) prefer "long double" to be
27303 aligned to an 8- or 16-byte boundary. In arrays or structures
27304 conforming to the ABI, this is not possible. So specifying
27305 -m128bit-long-double aligns "long double" to a 16-byte boundary by
27306 padding the "long double" with an additional 32-bit zero.
27307
27308 In the x86-64 compiler, -m128bit-long-double is the default choice
27309 as its ABI specifies that "long double" is aligned on 16-byte
27310 boundary.
27311
27312 Notice that neither of these options enable any extra precision
27313 over the x87 standard of 80 bits for a "long double".
27314
27315 Warning: if you override the default value for your target ABI,
27316 this changes the size of structures and arrays containing "long
27317 double" variables, as well as modifying the function calling
27318 convention for functions taking "long double". Hence they are not
27319 binary-compatible with code compiled without that switch.
27320
27321 -mlong-double-64
27322 -mlong-double-80
27323 -mlong-double-128
27324 These switches control the size of "long double" type. A size of 64
27325 bits makes the "long double" type equivalent to the "double" type.
27326 This is the default for 32-bit Bionic C library. A size of 128
27327 bits makes the "long double" type equivalent to the "__float128"
27328 type. This is the default for 64-bit Bionic C library.
27329
27330 Warning: if you override the default value for your target ABI,
27331 this changes the size of structures and arrays containing "long
27332 double" variables, as well as modifying the function calling
27333 convention for functions taking "long double". Hence they are not
27334 binary-compatible with code compiled without that switch.
27335
27336 -malign-data=type
27337 Control how GCC aligns variables. Supported values for type are
27338 compat uses increased alignment value compatible uses GCC 4.8 and
27339 earlier, abi uses alignment value as specified by the psABI, and
27340 cacheline uses increased alignment value to match the cache line
27341 size. compat is the default.
27342
27343 -mlarge-data-threshold=threshold
27344 When -mcmodel=medium is specified, data objects larger than
27345 threshold are placed in the large data section. This value must be
27346 the same across all objects linked into the binary, and defaults to
27347 65535.
27348
27349 -mrtd
27350 Use a different function-calling convention, in which functions
27351 that take a fixed number of arguments return with the "ret num"
27352 instruction, which pops their arguments while returning. This
27353 saves one instruction in the caller since there is no need to pop
27354 the arguments there.
27355
27356 You can specify that an individual function is called with this
27357 calling sequence with the function attribute "stdcall". You can
27358 also override the -mrtd option by using the function attribute
27359 "cdecl".
27360
27361 Warning: this calling convention is incompatible with the one
27362 normally used on Unix, so you cannot use it if you need to call
27363 libraries compiled with the Unix compiler.
27364
27365 Also, you must provide function prototypes for all functions that
27366 take variable numbers of arguments (including "printf"); otherwise
27367 incorrect code is generated for calls to those functions.
27368
27369 In addition, seriously incorrect code results if you call a
27370 function with too many arguments. (Normally, extra arguments are
27371 harmlessly ignored.)
27372
27373 -mregparm=num
27374 Control how many registers are used to pass integer arguments. By
27375 default, no registers are used to pass arguments, and at most 3
27376 registers can be used. You can control this behavior for a
27377 specific function by using the function attribute "regparm".
27378
27379 Warning: if you use this switch, and num is nonzero, then you must
27380 build all modules with the same value, including any libraries.
27381 This includes the system libraries and startup modules.
27382
27383 -msseregparm
27384 Use SSE register passing conventions for float and double arguments
27385 and return values. You can control this behavior for a specific
27386 function by using the function attribute "sseregparm".
27387
27388 Warning: if you use this switch then you must build all modules
27389 with the same value, including any libraries. This includes the
27390 system libraries and startup modules.
27391
27392 -mvect8-ret-in-mem
27393 Return 8-byte vectors in memory instead of MMX registers. This is
27394 the default on VxWorks to match the ABI of the Sun Studio compilers
27395 until version 12. Only use this option if you need to remain
27396 compatible with existing code produced by those previous compiler
27397 versions or older versions of GCC.
27398
27399 -mpc32
27400 -mpc64
27401 -mpc80
27402 Set 80387 floating-point precision to 32, 64 or 80 bits. When
27403 -mpc32 is specified, the significands of results of floating-point
27404 operations are rounded to 24 bits (single precision); -mpc64 rounds
27405 the significands of results of floating-point operations to 53 bits
27406 (double precision) and -mpc80 rounds the significands of results of
27407 floating-point operations to 64 bits (extended double precision),
27408 which is the default. When this option is used, floating-point
27409 operations in higher precisions are not available to the programmer
27410 without setting the FPU control word explicitly.
27411
27412 Setting the rounding of floating-point operations to less than the
27413 default 80 bits can speed some programs by 2% or more. Note that
27414 some mathematical libraries assume that extended-precision (80-bit)
27415 floating-point operations are enabled by default; routines in such
27416 libraries could suffer significant loss of accuracy, typically
27417 through so-called "catastrophic cancellation", when this option is
27418 used to set the precision to less than extended precision.
27419
27420 -mstackrealign
27421 Realign the stack at entry. On the x86, the -mstackrealign option
27422 generates an alternate prologue and epilogue that realigns the run-
27423 time stack if necessary. This supports mixing legacy codes that
27424 keep 4-byte stack alignment with modern codes that keep 16-byte
27425 stack alignment for SSE compatibility. See also the attribute
27426 "force_align_arg_pointer", applicable to individual functions.
27427
27428 -mpreferred-stack-boundary=num
27429 Attempt to keep the stack boundary aligned to a 2 raised to num
27430 byte boundary. If -mpreferred-stack-boundary is not specified, the
27431 default is 4 (16 bytes or 128 bits).
27432
27433 Warning: When generating code for the x86-64 architecture with SSE
27434 extensions disabled, -mpreferred-stack-boundary=3 can be used to
27435 keep the stack boundary aligned to 8 byte boundary. Since x86-64
27436 ABI require 16 byte stack alignment, this is ABI incompatible and
27437 intended to be used in controlled environment where stack space is
27438 important limitation. This option leads to wrong code when
27439 functions compiled with 16 byte stack alignment (such as functions
27440 from a standard library) are called with misaligned stack. In this
27441 case, SSE instructions may lead to misaligned memory access traps.
27442 In addition, variable arguments are handled incorrectly for 16 byte
27443 aligned objects (including x87 long double and __int128), leading
27444 to wrong results. You must build all modules with
27445 -mpreferred-stack-boundary=3, including any libraries. This
27446 includes the system libraries and startup modules.
27447
27448 -mincoming-stack-boundary=num
27449 Assume the incoming stack is aligned to a 2 raised to num byte
27450 boundary. If -mincoming-stack-boundary is not specified, the one
27451 specified by -mpreferred-stack-boundary is used.
27452
27453 On Pentium and Pentium Pro, "double" and "long double" values
27454 should be aligned to an 8-byte boundary (see -malign-double) or
27455 suffer significant run time performance penalties. On Pentium III,
27456 the Streaming SIMD Extension (SSE) data type "__m128" may not work
27457 properly if it is not 16-byte aligned.
27458
27459 To ensure proper alignment of this values on the stack, the stack
27460 boundary must be as aligned as that required by any value stored on
27461 the stack. Further, every function must be generated such that it
27462 keeps the stack aligned. Thus calling a function compiled with a
27463 higher preferred stack boundary from a function compiled with a
27464 lower preferred stack boundary most likely misaligns the stack. It
27465 is recommended that libraries that use callbacks always use the
27466 default setting.
27467
27468 This extra alignment does consume extra stack space, and generally
27469 increases code size. Code that is sensitive to stack space usage,
27470 such as embedded systems and operating system kernels, may want to
27471 reduce the preferred alignment to -mpreferred-stack-boundary=2.
27472
27473 -mmmx
27474 -msse
27475 -msse2
27476 -msse3
27477 -mssse3
27478 -msse4
27479 -msse4a
27480 -msse4.1
27481 -msse4.2
27482 -mavx
27483 -mavx2
27484 -mavx512f
27485 -mavx512pf
27486 -mavx512er
27487 -mavx512cd
27488 -mavx512vl
27489 -mavx512bw
27490 -mavx512dq
27491 -mavx512ifma
27492 -mavx512vbmi
27493 -msha
27494 -maes
27495 -mpclmul
27496 -mclflushopt
27497 -mclwb
27498 -mfsgsbase
27499 -mptwrite
27500 -mrdrnd
27501 -mf16c
27502 -mfma
27503 -mpconfig
27504 -mwbnoinvd
27505 -mfma4
27506 -mprfchw
27507 -mrdpid
27508 -mprefetchwt1
27509 -mrdseed
27510 -msgx
27511 -mxop
27512 -mlwp
27513 -m3dnow
27514 -m3dnowa
27515 -mpopcnt
27516 -mabm
27517 -madx
27518 -mbmi
27519 -mbmi2
27520 -mlzcnt
27521 -mfxsr
27522 -mxsave
27523 -mxsaveopt
27524 -mxsavec
27525 -mxsaves
27526 -mrtm
27527 -mhle
27528 -mtbm
27529 -mmwaitx
27530 -mclzero
27531 -mpku
27532 -mavx512vbmi2
27533 -mavx512bf16
27534 -mavx512fp16
27535 -mgfni
27536 -mvaes
27537 -mwaitpkg
27538 -mvpclmulqdq
27539 -mavx512bitalg
27540 -mmovdiri
27541 -mmovdir64b
27542 -menqcmd
27543 -muintr
27544 -mtsxldtrk
27545 -mavx512vpopcntdq
27546 -mavx512vp2intersect
27547 -mavx5124fmaps
27548 -mavx512vnni
27549 -mavxvnni
27550 -mavx5124vnniw
27551 -mcldemote
27552 -mserialize
27553 -mamx-tile
27554 -mamx-int8
27555 -mamx-bf16
27556 -mhreset
27557 -mkl
27558 -mwidekl
27559 These switches enable the use of instructions in the MMX, SSE,
27560 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
27561 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
27562 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
27563 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
27564 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
27565 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
27566 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
27567 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
27568 MOVDIRI, MOVDIR64B, AVX512BF16, ENQCMD, AVX512VPOPCNTDQ,
27569 AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE, UINTR, HRESET,
27570 AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512FP16 or
27571 CLDEMOTE extended instruction sets. Each has a corresponding -mno-
27572 option to disable use of these instructions.
27573
27574 These extensions are also available as built-in functions: see x86
27575 Built-in Functions, for details of the functions enabled and
27576 disabled by these switches.
27577
27578 To generate SSE/SSE2 instructions automatically from floating-point
27579 code (as opposed to 387 instructions), see -mfpmath=sse.
27580
27581 GCC depresses SSEx instructions when -mavx is used. Instead, it
27582 generates new AVX instructions or AVX equivalence for all SSEx
27583 instructions when needed.
27584
27585 These options enable GCC to use these extended instructions in
27586 generated code, even without -mfpmath=sse. Applications that
27587 perform run-time CPU detection must compile separate files for each
27588 supported architecture, using the appropriate flags. In
27589 particular, the file containing the CPU detection code should be
27590 compiled without these options.
27591
27592 -mdump-tune-features
27593 This option instructs GCC to dump the names of the x86 performance
27594 tuning features and default settings. The names can be used in
27595 -mtune-ctrl=feature-list.
27596
27597 -mtune-ctrl=feature-list
27598 This option is used to do fine grain control of x86 code generation
27599 features. feature-list is a comma separated list of feature names.
27600 See also -mdump-tune-features. When specified, the feature is
27601 turned on if it is not preceded with ^, otherwise, it is turned
27602 off. -mtune-ctrl=feature-list is intended to be used by GCC
27603 developers. Using it may lead to code paths not covered by testing
27604 and can potentially result in compiler ICEs or runtime errors.
27605
27606 -mno-default
27607 This option instructs GCC to turn off all tunable features. See
27608 also -mtune-ctrl=feature-list and -mdump-tune-features.
27609
27610 -mcld
27611 This option instructs GCC to emit a "cld" instruction in the
27612 prologue of functions that use string instructions. String
27613 instructions depend on the DF flag to select between autoincrement
27614 or autodecrement mode. While the ABI specifies the DF flag to be
27615 cleared on function entry, some operating systems violate this
27616 specification by not clearing the DF flag in their exception
27617 dispatchers. The exception handler can be invoked with the DF flag
27618 set, which leads to wrong direction mode when string instructions
27619 are used. This option can be enabled by default on 32-bit x86
27620 targets by configuring GCC with the --enable-cld configure option.
27621 Generation of "cld" instructions can be suppressed with the
27622 -mno-cld compiler option in this case.
27623
27624 -mvzeroupper
27625 This option instructs GCC to emit a "vzeroupper" instruction before
27626 a transfer of control flow out of the function to minimize the AVX
27627 to SSE transition penalty as well as remove unnecessary "zeroupper"
27628 intrinsics.
27629
27630 -mprefer-avx128
27631 This option instructs GCC to use 128-bit AVX instructions instead
27632 of 256-bit AVX instructions in the auto-vectorizer.
27633
27634 -mprefer-vector-width=opt
27635 This option instructs GCC to use opt-bit vector width in
27636 instructions instead of default on the selected platform.
27637
27638 -mmove-max=bits
27639 This option instructs GCC to set the maximum number of bits can be
27640 moved from memory to memory efficiently to bits. The valid bits
27641 are 128, 256 and 512.
27642
27643 -mstore-max=bits
27644 This option instructs GCC to set the maximum number of bits can be
27645 stored to memory efficiently to bits. The valid bits are 128, 256
27646 and 512.
27647
27648 none
27649 No extra limitations applied to GCC other than defined by the
27650 selected platform.
27651
27652 128 Prefer 128-bit vector width for instructions.
27653
27654 256 Prefer 256-bit vector width for instructions.
27655
27656 512 Prefer 512-bit vector width for instructions.
27657
27658 -mcx16
27659 This option enables GCC to generate "CMPXCHG16B" instructions in
27660 64-bit code to implement compare-and-exchange operations on 16-byte
27661 aligned 128-bit objects. This is useful for atomic updates of data
27662 structures exceeding one machine word in size. The compiler uses
27663 this instruction to implement __sync Builtins. However, for
27664 __atomic Builtins operating on 128-bit integers, a library call is
27665 always used.
27666
27667 -msahf
27668 This option enables generation of "SAHF" instructions in 64-bit
27669 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
27670 the introduction of Pentium 4 G1 step in December 2005, lacked the
27671 "LAHF" and "SAHF" instructions which are supported by AMD64. These
27672 are load and store instructions, respectively, for certain status
27673 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
27674 "fmod", "drem", and "remainder" built-in functions; see Other
27675 Builtins for details.
27676
27677 -mmovbe
27678 This option enables use of the "movbe" instruction to implement
27679 "__builtin_bswap32" and "__builtin_bswap64".
27680
27681 -mshstk
27682 The -mshstk option enables shadow stack built-in functions from x86
27683 Control-flow Enforcement Technology (CET).
27684
27685 -mcrc32
27686 This option enables built-in functions "__builtin_ia32_crc32qi",
27687 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
27688 "__builtin_ia32_crc32di" to generate the "crc32" machine
27689 instruction.
27690
27691 -mmwait
27692 This option enables built-in functions "__builtin_ia32_monitor",
27693 and "__builtin_ia32_mwait" to generate the "monitor" and "mwait"
27694 machine instructions.
27695
27696 -mrecip
27697 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
27698 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
27699 Newton-Raphson step to increase precision instead of "DIVSS" and
27700 "SQRTSS" (and their vectorized variants) for single-precision
27701 floating-point arguments. These instructions are generated only
27702 when -funsafe-math-optimizations is enabled together with
27703 -ffinite-math-only and -fno-trapping-math. Note that while the
27704 throughput of the sequence is higher than the throughput of the
27705 non-reciprocal instruction, the precision of the sequence can be
27706 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
27707 0.99999994).
27708
27709 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
27710 "RSQRTPS") already with -ffast-math (or the above option
27711 combination), and doesn't need -mrecip.
27712
27713 Also note that GCC emits the above sequence with additional Newton-
27714 Raphson step for vectorized single-float division and vectorized
27715 "sqrtf(x)" already with -ffast-math (or the above option
27716 combination), and doesn't need -mrecip.
27717
27718 -mrecip=opt
27719 This option controls which reciprocal estimate instructions may be
27720 used. opt is a comma-separated list of options, which may be
27721 preceded by a ! to invert the option:
27722
27723 all Enable all estimate instructions.
27724
27725 default
27726 Enable the default instructions, equivalent to -mrecip.
27727
27728 none
27729 Disable all estimate instructions, equivalent to -mno-recip.
27730
27731 div Enable the approximation for scalar division.
27732
27733 vec-div
27734 Enable the approximation for vectorized division.
27735
27736 sqrt
27737 Enable the approximation for scalar square root.
27738
27739 vec-sqrt
27740 Enable the approximation for vectorized square root.
27741
27742 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
27743 approximations, except for square root.
27744
27745 -mveclibabi=type
27746 Specifies the ABI type to use for vectorizing intrinsics using an
27747 external library. Supported values for type are svml for the Intel
27748 short vector math library and acml for the AMD math core library.
27749 To use this option, both -ftree-vectorize and
27750 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
27751 ABI-compatible library must be specified at link time.
27752
27753 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
27754 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
27755 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
27756 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
27757 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
27758 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
27759 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
27760 and "vmlsAcos4" for corresponding function type when
27761 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
27762 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
27763 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
27764 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
27765 corresponding function type when -mveclibabi=acml is used.
27766
27767 -mabi=name
27768 Generate code for the specified calling convention. Permissible
27769 values are sysv for the ABI used on GNU/Linux and other systems,
27770 and ms for the Microsoft ABI. The default is to use the Microsoft
27771 ABI when targeting Microsoft Windows and the SysV ABI on all other
27772 systems. You can control this behavior for specific functions by
27773 using the function attributes "ms_abi" and "sysv_abi".
27774
27775 -mforce-indirect-call
27776 Force all calls to functions to be indirect. This is useful when
27777 using Intel Processor Trace where it generates more precise timing
27778 information for function calls.
27779
27780 -mmanual-endbr
27781 Insert ENDBR instruction at function entry only via the "cf_check"
27782 function attribute. This is useful when used with the option
27783 -fcf-protection=branch to control ENDBR insertion at the function
27784 entry.
27785
27786 -mcall-ms2sysv-xlogues
27787 Due to differences in 64-bit ABIs, any Microsoft ABI function that
27788 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
27789 clobbered. By default, the code for saving and restoring these
27790 registers is emitted inline, resulting in fairly lengthy prologues
27791 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
27792 epilogues that use stubs in the static portion of libgcc to perform
27793 these saves and restores, thus reducing function size at the cost
27794 of a few extra instructions.
27795
27796 -mtls-dialect=type
27797 Generate code to access thread-local storage using the gnu or gnu2
27798 conventions. gnu is the conservative default; gnu2 is more
27799 efficient, but it may add compile- and run-time requirements that
27800 cannot be satisfied on all systems.
27801
27802 -mpush-args
27803 -mno-push-args
27804 Use PUSH operations to store outgoing parameters. This method is
27805 shorter and usually equally fast as method using SUB/MOV operations
27806 and is enabled by default. In some cases disabling it may improve
27807 performance because of improved scheduling and reduced
27808 dependencies.
27809
27810 -maccumulate-outgoing-args
27811 If enabled, the maximum amount of space required for outgoing
27812 arguments is computed in the function prologue. This is faster on
27813 most modern CPUs because of reduced dependencies, improved
27814 scheduling and reduced stack usage when the preferred stack
27815 boundary is not equal to 2. The drawback is a notable increase in
27816 code size. This switch implies -mno-push-args.
27817
27818 -mthreads
27819 Support thread-safe exception handling on MinGW. Programs that
27820 rely on thread-safe exception handling must compile and link all
27821 code with the -mthreads option. When compiling, -mthreads defines
27822 -D_MT; when linking, it links in a special thread helper library
27823 -lmingwthrd which cleans up per-thread exception-handling data.
27824
27825 -mms-bitfields
27826 -mno-ms-bitfields
27827 Enable/disable bit-field layout compatible with the native
27828 Microsoft Windows compiler.
27829
27830 If "packed" is used on a structure, or if bit-fields are used, it
27831 may be that the Microsoft ABI lays out the structure differently
27832 than the way GCC normally does. Particularly when moving packed
27833 data between functions compiled with GCC and the native Microsoft
27834 compiler (either via function call or as data in a file), it may be
27835 necessary to access either format.
27836
27837 This option is enabled by default for Microsoft Windows targets.
27838 This behavior can also be controlled locally by use of variable or
27839 type attributes. For more information, see x86 Variable Attributes
27840 and x86 Type Attributes.
27841
27842 The Microsoft structure layout algorithm is fairly simple with the
27843 exception of the bit-field packing. The padding and alignment of
27844 members of structures and whether a bit-field can straddle a
27845 storage-unit boundary are determine by these rules:
27846
27847 1. Structure members are stored sequentially in the order in which
27848 they are
27849 declared: the first member has the lowest memory address and
27850 the last member the highest.
27851
27852 2. Every data object has an alignment requirement. The alignment
27853 requirement
27854 for all data except structures, unions, and arrays is either
27855 the size of the object or the current packing size (specified
27856 with either the "aligned" attribute or the "pack" pragma),
27857 whichever is less. For structures, unions, and arrays, the
27858 alignment requirement is the largest alignment requirement of
27859 its members. Every object is allocated an offset so that:
27860
27861 offset % alignment_requirement == 0
27862
27863 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
27864 allocation
27865 unit if the integral types are the same size and if the next
27866 bit-field fits into the current allocation unit without
27867 crossing the boundary imposed by the common alignment
27868 requirements of the bit-fields.
27869
27870 MSVC interprets zero-length bit-fields in the following ways:
27871
27872 1. If a zero-length bit-field is inserted between two bit-fields
27873 that
27874 are normally coalesced, the bit-fields are not coalesced.
27875
27876 For example:
27877
27878 struct
27879 {
27880 unsigned long bf_1 : 12;
27881 unsigned long : 0;
27882 unsigned long bf_2 : 12;
27883 } t1;
27884
27885 The size of "t1" is 8 bytes with the zero-length bit-field. If
27886 the zero-length bit-field were removed, "t1"'s size would be 4
27887 bytes.
27888
27889 2. If a zero-length bit-field is inserted after a bit-field, "foo",
27890 and the
27891 alignment of the zero-length bit-field is greater than the
27892 member that follows it, "bar", "bar" is aligned as the type of
27893 the zero-length bit-field.
27894
27895 For example:
27896
27897 struct
27898 {
27899 char foo : 4;
27900 short : 0;
27901 char bar;
27902 } t2;
27903
27904 struct
27905 {
27906 char foo : 4;
27907 short : 0;
27908 double bar;
27909 } t3;
27910
27911 For "t2", "bar" is placed at offset 2, rather than offset 1.
27912 Accordingly, the size of "t2" is 4. For "t3", the zero-length
27913 bit-field does not affect the alignment of "bar" or, as a
27914 result, the size of the structure.
27915
27916 Taking this into account, it is important to note the
27917 following:
27918
27919 1. If a zero-length bit-field follows a normal bit-field, the
27920 type of the
27921 zero-length bit-field may affect the alignment of the
27922 structure as whole. For example, "t2" has a size of 4
27923 bytes, since the zero-length bit-field follows a normal
27924 bit-field, and is of type short.
27925
27926 2. Even if a zero-length bit-field is not followed by a normal
27927 bit-field, it may
27928 still affect the alignment of the structure:
27929
27930 struct
27931 {
27932 char foo : 6;
27933 long : 0;
27934 } t4;
27935
27936 Here, "t4" takes up 4 bytes.
27937
27938 3. Zero-length bit-fields following non-bit-field members are
27939 ignored:
27940 struct
27941 {
27942 char foo;
27943 long : 0;
27944 char bar;
27945 } t5;
27946
27947 Here, "t5" takes up 2 bytes.
27948
27949 -mno-align-stringops
27950 Do not align the destination of inlined string operations. This
27951 switch reduces code size and improves performance in case the
27952 destination is already aligned, but GCC doesn't know about it.
27953
27954 -minline-all-stringops
27955 By default GCC inlines string operations only when the destination
27956 is known to be aligned to least a 4-byte boundary. This enables
27957 more inlining and increases code size, but may improve performance
27958 of code that depends on fast "memcpy" and "memset" for short
27959 lengths. The option enables inline expansion of "strlen" for all
27960 pointer alignments.
27961
27962 -minline-stringops-dynamically
27963 For string operations of unknown size, use run-time checks with
27964 inline code for small blocks and a library call for large blocks.
27965
27966 -mstringop-strategy=alg
27967 Override the internal decision heuristic for the particular
27968 algorithm to use for inlining string operations. The allowed
27969 values for alg are:
27970
27971 rep_byte
27972 rep_4byte
27973 rep_8byte
27974 Expand using i386 "rep" prefix of the specified size.
27975
27976 byte_loop
27977 loop
27978 unrolled_loop
27979 Expand into an inline loop.
27980
27981 libcall
27982 Always use a library call.
27983
27984 -mmemcpy-strategy=strategy
27985 Override the internal decision heuristic to decide if
27986 "__builtin_memcpy" should be inlined and what inline algorithm to
27987 use when the expected size of the copy operation is known. strategy
27988 is a comma-separated list of alg:max_size:dest_align triplets. alg
27989 is specified in -mstringop-strategy, max_size specifies the max
27990 byte size with which inline algorithm alg is allowed. For the last
27991 triplet, the max_size must be "-1". The max_size of the triplets in
27992 the list must be specified in increasing order. The minimal byte
27993 size for alg is 0 for the first triplet and "max_size + 1" of the
27994 preceding range.
27995
27996 -mmemset-strategy=strategy
27997 The option is similar to -mmemcpy-strategy= except that it is to
27998 control "__builtin_memset" expansion.
27999
28000 -momit-leaf-frame-pointer
28001 Don't keep the frame pointer in a register for leaf functions.
28002 This avoids the instructions to save, set up, and restore frame
28003 pointers and makes an extra register available in leaf functions.
28004 The option -fomit-leaf-frame-pointer removes the frame pointer for
28005 leaf functions, which might make debugging harder.
28006
28007 -mtls-direct-seg-refs
28008 -mno-tls-direct-seg-refs
28009 Controls whether TLS variables may be accessed with offsets from
28010 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
28011 whether the thread base pointer must be added. Whether or not this
28012 is valid depends on the operating system, and whether it maps the
28013 segment to cover the entire TLS area.
28014
28015 For systems that use the GNU C Library, the default is on.
28016
28017 -msse2avx
28018 -mno-sse2avx
28019 Specify that the assembler should encode SSE instructions with VEX
28020 prefix. The option -mavx turns this on by default.
28021
28022 -mfentry
28023 -mno-fentry
28024 If profiling is active (-pg), put the profiling counter call before
28025 the prologue. Note: On x86 architectures the attribute
28026 "ms_hook_prologue" isn't possible at the moment for -mfentry and
28027 -pg.
28028
28029 -mrecord-mcount
28030 -mno-record-mcount
28031 If profiling is active (-pg), generate a __mcount_loc section that
28032 contains pointers to each profiling call. This is useful for
28033 automatically patching and out calls.
28034
28035 -mnop-mcount
28036 -mno-nop-mcount
28037 If profiling is active (-pg), generate the calls to the profiling
28038 functions as NOPs. This is useful when they should be patched in
28039 later dynamically. This is likely only useful together with
28040 -mrecord-mcount.
28041
28042 -minstrument-return=type
28043 Instrument function exit in -pg -mfentry instrumented functions
28044 with call to specified function. This only instruments true returns
28045 ending with ret, but not sibling calls ending with jump. Valid
28046 types are none to not instrument, call to generate a call to
28047 __return__, or nop5 to generate a 5 byte nop.
28048
28049 -mrecord-return
28050 -mno-record-return
28051 Generate a __return_loc section pointing to all return
28052 instrumentation code.
28053
28054 -mfentry-name=name
28055 Set name of __fentry__ symbol called at function entry for -pg
28056 -mfentry functions.
28057
28058 -mfentry-section=name
28059 Set name of section to record -mrecord-mcount calls (default
28060 __mcount_loc).
28061
28062 -mskip-rax-setup
28063 -mno-skip-rax-setup
28064 When generating code for the x86-64 architecture with SSE
28065 extensions disabled, -mskip-rax-setup can be used to skip setting
28066 up RAX register when there are no variable arguments passed in
28067 vector registers.
28068
28069 Warning: Since RAX register is used to avoid unnecessarily saving
28070 vector registers on stack when passing variable arguments, the
28071 impacts of this option are callees may waste some stack space,
28072 misbehave or jump to a random location. GCC 4.4 or newer don't
28073 have those issues, regardless the RAX register value.
28074
28075 -m8bit-idiv
28076 -mno-8bit-idiv
28077 On some processors, like Intel Atom, 8-bit unsigned integer divide
28078 is much faster than 32-bit/64-bit integer divide. This option
28079 generates a run-time check. If both dividend and divisor are
28080 within range of 0 to 255, 8-bit unsigned integer divide is used
28081 instead of 32-bit/64-bit integer divide.
28082
28083 -mavx256-split-unaligned-load
28084 -mavx256-split-unaligned-store
28085 Split 32-byte AVX unaligned load and store.
28086
28087 -mstack-protector-guard=guard
28088 -mstack-protector-guard-reg=reg
28089 -mstack-protector-guard-offset=offset
28090 Generate stack protection code using canary at guard. Supported
28091 locations are global for global canary or tls for per-thread canary
28092 in the TLS block (the default). This option has effect only when
28093 -fstack-protector or -fstack-protector-all is specified.
28094
28095 With the latter choice the options -mstack-protector-guard-reg=reg
28096 and -mstack-protector-guard-offset=offset furthermore specify which
28097 segment register (%fs or %gs) to use as base register for reading
28098 the canary, and from what offset from that base register. The
28099 default for those is as specified in the relevant ABI.
28100
28101 -mgeneral-regs-only
28102 Generate code that uses only the general-purpose registers. This
28103 prevents the compiler from using floating-point, vector, mask and
28104 bound registers.
28105
28106 -mrelax-cmpxchg-loop
28107 Relax cmpxchg loop by emitting an early load and compare before
28108 cmpxchg, execute pause if load value is not expected. This reduces
28109 excessive cachline bouncing when and works for all atomic logic
28110 fetch builtins that generates compare and swap loop.
28111
28112 -mindirect-branch=choice
28113 Convert indirect call and jump with choice. The default is keep,
28114 which keeps indirect call and jump unmodified. thunk converts
28115 indirect call and jump to call and return thunk. thunk-inline
28116 converts indirect call and jump to inlined call and return thunk.
28117 thunk-extern converts indirect call and jump to external call and
28118 return thunk provided in a separate object file. You can control
28119 this behavior for a specific function by using the function
28120 attribute "indirect_branch".
28121
28122 Note that -mcmodel=large is incompatible with
28123 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
28124 the thunk function may not be reachable in the large code model.
28125
28126 Note that -mindirect-branch=thunk-extern is compatible with
28127 -fcf-protection=branch since the external thunk can be made to
28128 enable control-flow check.
28129
28130 -mfunction-return=choice
28131 Convert function return with choice. The default is keep, which
28132 keeps function return unmodified. thunk converts function return
28133 to call and return thunk. thunk-inline converts function return to
28134 inlined call and return thunk. thunk-extern converts function
28135 return to external call and return thunk provided in a separate
28136 object file. You can control this behavior for a specific function
28137 by using the function attribute "function_return".
28138
28139 Note that -mindirect-return=thunk-extern is compatible with
28140 -fcf-protection=branch since the external thunk can be made to
28141 enable control-flow check.
28142
28143 Note that -mcmodel=large is incompatible with
28144 -mfunction-return=thunk and -mfunction-return=thunk-extern since
28145 the thunk function may not be reachable in the large code model.
28146
28147 -mindirect-branch-register
28148 Force indirect call and jump via register.
28149
28150 -mharden-sls=choice
28151 Generate code to mitigate against straight line speculation (SLS)
28152 with choice. The default is none which disables all SLS hardening.
28153 return enables SLS hardening for function returns. indirect-jmp
28154 enables SLS hardening for indirect jumps. all enables all SLS
28155 hardening.
28156
28157 -mindirect-branch-cs-prefix
28158 Add CS prefix to call and jmp to indirect thunk with branch target
28159 in r8-r15 registers so that the call and jmp instruction length is
28160 6 bytes to allow them to be replaced with lfence; call *%r8-r15 or
28161 lfence; jmp *%r8-r15 at run-time.
28162
28163 These -m switches are supported in addition to the above on x86-64
28164 processors in 64-bit environments.
28165
28166 -m32
28167 -m64
28168 -mx32
28169 -m16
28170 -miamcu
28171 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
28172 option sets "int", "long", and pointer types to 32 bits, and
28173 generates code that runs on any i386 system.
28174
28175 The -m64 option sets "int" to 32 bits and "long" and pointer types
28176 to 64 bits, and generates code for the x86-64 architecture. For
28177 Darwin only the -m64 option also turns off the -fno-pic and
28178 -mdynamic-no-pic options.
28179
28180 The -mx32 option sets "int", "long", and pointer types to 32 bits,
28181 and generates code for the x86-64 architecture.
28182
28183 The -m16 option is the same as -m32, except for that it outputs the
28184 ".code16gcc" assembly directive at the beginning of the assembly
28185 output so that the binary can run in 16-bit mode.
28186
28187 The -miamcu option generates code which conforms to Intel MCU
28188 psABI. It requires the -m32 option to be turned on.
28189
28190 -mno-red-zone
28191 Do not use a so-called "red zone" for x86-64 code. The red zone is
28192 mandated by the x86-64 ABI; it is a 128-byte area beyond the
28193 location of the stack pointer that is not modified by signal or
28194 interrupt handlers and therefore can be used for temporary data
28195 without adjusting the stack pointer. The flag -mno-red-zone
28196 disables this red zone.
28197
28198 -mcmodel=small
28199 Generate code for the small code model: the program and its symbols
28200 must be linked in the lower 2 GB of the address space. Pointers
28201 are 64 bits. Programs can be statically or dynamically linked.
28202 This is the default code model.
28203
28204 -mcmodel=kernel
28205 Generate code for the kernel code model. The kernel runs in the
28206 negative 2 GB of the address space. This model has to be used for
28207 Linux kernel code.
28208
28209 -mcmodel=medium
28210 Generate code for the medium model: the program is linked in the
28211 lower 2 GB of the address space. Small symbols are also placed
28212 there. Symbols with sizes larger than -mlarge-data-threshold are
28213 put into large data or BSS sections and can be located above 2GB.
28214 Programs can be statically or dynamically linked.
28215
28216 -mcmodel=large
28217 Generate code for the large model. This model makes no assumptions
28218 about addresses and sizes of sections.
28219
28220 -maddress-mode=long
28221 Generate code for long address mode. This is only supported for
28222 64-bit and x32 environments. It is the default address mode for
28223 64-bit environments.
28224
28225 -maddress-mode=short
28226 Generate code for short address mode. This is only supported for
28227 32-bit and x32 environments. It is the default address mode for
28228 32-bit and x32 environments.
28229
28230 -mneeded
28231 -mno-needed
28232 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
28233 indicate the micro-architecture ISA level required to execute the
28234 binary.
28235
28236 -mno-direct-extern-access
28237 Without -fpic nor -fPIC, always use the GOT pointer to access
28238 external symbols. With -fpic or -fPIC, treat access to protected
28239 symbols as local symbols. The default is -mdirect-extern-access.
28240
28241 Warning: shared libraries compiled with -mno-direct-extern-access
28242 and executable compiled with -mdirect-extern-access may not be
28243 binary compatible if protected symbols are used in shared libraries
28244 and executable.
28245
28246 x86 Windows Options
28247 These additional options are available for Microsoft Windows targets:
28248
28249 -mconsole
28250 This option specifies that a console application is to be
28251 generated, by instructing the linker to set the PE header subsystem
28252 type required for console applications. This option is available
28253 for Cygwin and MinGW targets and is enabled by default on those
28254 targets.
28255
28256 -mdll
28257 This option is available for Cygwin and MinGW targets. It
28258 specifies that a DLL---a dynamic link library---is to be generated,
28259 enabling the selection of the required runtime startup object and
28260 entry point.
28261
28262 -mnop-fun-dllimport
28263 This option is available for Cygwin and MinGW targets. It
28264 specifies that the "dllimport" attribute should be ignored.
28265
28266 -mthreads
28267 This option is available for MinGW targets. It specifies that
28268 MinGW-specific thread support is to be used.
28269
28270 -municode
28271 This option is available for MinGW-w64 targets. It causes the
28272 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
28273 capable runtime startup code.
28274
28275 -mwin32
28276 This option is available for Cygwin and MinGW targets. It
28277 specifies that the typical Microsoft Windows predefined macros are
28278 to be set in the pre-processor, but does not influence the choice
28279 of runtime library/startup code.
28280
28281 -mwindows
28282 This option is available for Cygwin and MinGW targets. It
28283 specifies that a GUI application is to be generated by instructing
28284 the linker to set the PE header subsystem type appropriately.
28285
28286 -fno-set-stack-executable
28287 This option is available for MinGW targets. It specifies that the
28288 executable flag for the stack used by nested functions isn't set.
28289 This is necessary for binaries running in kernel mode of Microsoft
28290 Windows, as there the User32 API, which is used to set executable
28291 privileges, isn't available.
28292
28293 -fwritable-relocated-rdata
28294 This option is available for MinGW and Cygwin targets. It
28295 specifies that relocated-data in read-only section is put into the
28296 ".data" section. This is a necessary for older runtimes not
28297 supporting modification of ".rdata" sections for pseudo-relocation.
28298
28299 -mpe-aligned-commons
28300 This option is available for Cygwin and MinGW targets. It
28301 specifies that the GNU extension to the PE file format that permits
28302 the correct alignment of COMMON variables should be used when
28303 generating code. It is enabled by default if GCC detects that the
28304 target assembler found during configuration supports the feature.
28305
28306 See also under x86 Options for standard options.
28307
28308 Xstormy16 Options
28309 These options are defined for Xstormy16:
28310
28311 -msim
28312 Choose startup files and linker script suitable for the simulator.
28313
28314 Xtensa Options
28315 These options are supported for Xtensa targets:
28316
28317 -mconst16
28318 -mno-const16
28319 Enable or disable use of "CONST16" instructions for loading
28320 constant values. The "CONST16" instruction is currently not a
28321 standard option from Tensilica. When enabled, "CONST16"
28322 instructions are always used in place of the standard "L32R"
28323 instructions. The use of "CONST16" is enabled by default only if
28324 the "L32R" instruction is not available.
28325
28326 -mfused-madd
28327 -mno-fused-madd
28328 Enable or disable use of fused multiply/add and multiply/subtract
28329 instructions in the floating-point option. This has no effect if
28330 the floating-point option is not also enabled. Disabling fused
28331 multiply/add and multiply/subtract instructions forces the compiler
28332 to use separate instructions for the multiply and add/subtract
28333 operations. This may be desirable in some cases where strict IEEE
28334 754-compliant results are required: the fused multiply add/subtract
28335 instructions do not round the intermediate result, thereby
28336 producing results with more bits of precision than specified by the
28337 IEEE standard. Disabling fused multiply add/subtract instructions
28338 also ensures that the program output is not sensitive to the
28339 compiler's ability to combine multiply and add/subtract operations.
28340
28341 -mserialize-volatile
28342 -mno-serialize-volatile
28343 When this option is enabled, GCC inserts "MEMW" instructions before
28344 "volatile" memory references to guarantee sequential consistency.
28345 The default is -mserialize-volatile. Use -mno-serialize-volatile
28346 to omit the "MEMW" instructions.
28347
28348 -mforce-no-pic
28349 For targets, like GNU/Linux, where all user-mode Xtensa code must
28350 be position-independent code (PIC), this option disables PIC for
28351 compiling kernel code.
28352
28353 -mtext-section-literals
28354 -mno-text-section-literals
28355 These options control the treatment of literal pools. The default
28356 is -mno-text-section-literals, which places literals in a separate
28357 section in the output file. This allows the literal pool to be
28358 placed in a data RAM/ROM, and it also allows the linker to combine
28359 literal pools from separate object files to remove redundant
28360 literals and improve code size. With -mtext-section-literals, the
28361 literals are interspersed in the text section in order to keep them
28362 as close as possible to their references. This may be necessary
28363 for large assembly files. Literals for each function are placed
28364 right before that function.
28365
28366 -mauto-litpools
28367 -mno-auto-litpools
28368 These options control the treatment of literal pools. The default
28369 is -mno-auto-litpools, which places literals in a separate section
28370 in the output file unless -mtext-section-literals is used. With
28371 -mauto-litpools the literals are interspersed in the text section
28372 by the assembler. Compiler does not produce explicit ".literal"
28373 directives and loads literals into registers with "MOVI"
28374 instructions instead of "L32R" to let the assembler do relaxation
28375 and place literals as necessary. This option allows assembler to
28376 create several literal pools per function and assemble very big
28377 functions, which may not be possible with -mtext-section-literals.
28378
28379 -mtarget-align
28380 -mno-target-align
28381 When this option is enabled, GCC instructs the assembler to
28382 automatically align instructions to reduce branch penalties at the
28383 expense of some code density. The assembler attempts to widen
28384 density instructions to align branch targets and the instructions
28385 following call instructions. If there are not enough preceding
28386 safe density instructions to align a target, no widening is
28387 performed. The default is -mtarget-align. These options do not
28388 affect the treatment of auto-aligned instructions like "LOOP",
28389 which the assembler always aligns, either by widening density
28390 instructions or by inserting NOP instructions.
28391
28392 -mlongcalls
28393 -mno-longcalls
28394 When this option is enabled, GCC instructs the assembler to
28395 translate direct calls to indirect calls unless it can determine
28396 that the target of a direct call is in the range allowed by the
28397 call instruction. This translation typically occurs for calls to
28398 functions in other source files. Specifically, the assembler
28399 translates a direct "CALL" instruction into an "L32R" followed by a
28400 "CALLX" instruction. The default is -mno-longcalls. This option
28401 should be used in programs where the call target can potentially be
28402 out of range. This option is implemented in the assembler, not the
28403 compiler, so the assembly code generated by GCC still shows direct
28404 call instructions---look at the disassembled object code to see the
28405 actual instructions. Note that the assembler uses an indirect call
28406 for every cross-file call, not just those that really are out of
28407 range.
28408
28409 -mabi=name
28410 Generate code for the specified ABI. Permissible values are:
28411 call0, windowed. Default ABI is chosen by the Xtensa core
28412 configuration.
28413
28414 -mabi=call0
28415 When this option is enabled function parameters are passed in
28416 registers "a2" through "a7", registers "a12" through "a15" are
28417 caller-saved, and register "a15" may be used as a frame pointer.
28418 When this version of the ABI is enabled the C preprocessor symbol
28419 "__XTENSA_CALL0_ABI__" is defined.
28420
28421 -mabi=windowed
28422 When this option is enabled function parameters are passed in
28423 registers "a10" through "a15", and called function rotates register
28424 window by 8 registers on entry so that its arguments are found in
28425 registers "a2" through "a7". Register "a7" may be used as a frame
28426 pointer. Register window is rotated 8 registers back upon return.
28427 When this version of the ABI is enabled the C preprocessor symbol
28428 "__XTENSA_WINDOWED_ABI__" is defined.
28429
28430 zSeries Options
28431 These are listed under
28432
28434 This section describes several environment variables that affect how
28435 GCC operates. Some of them work by specifying directories or prefixes
28436 to use when searching for various kinds of files. Some are used to
28437 specify other aspects of the compilation environment.
28438
28439 Note that you can also specify places to search using options such as
28440 -B, -I and -L. These take precedence over places specified using
28441 environment variables, which in turn take precedence over those
28442 specified by the configuration of GCC.
28443
28444 LANG
28445 LC_CTYPE
28446 LC_MESSAGES
28447 LC_ALL
28448 These environment variables control the way that GCC uses
28449 localization information which allows GCC to work with different
28450 national conventions. GCC inspects the locale categories LC_CTYPE
28451 and LC_MESSAGES if it has been configured to do so. These locale
28452 categories can be set to any value supported by your installation.
28453 A typical value is en_GB.UTF-8 for English in the United Kingdom
28454 encoded in UTF-8.
28455
28456 The LC_CTYPE environment variable specifies character
28457 classification. GCC uses it to determine the character boundaries
28458 in a string; this is needed for some multibyte encodings that
28459 contain quote and escape characters that are otherwise interpreted
28460 as a string end or escape.
28461
28462 The LC_MESSAGES environment variable specifies the language to use
28463 in diagnostic messages.
28464
28465 If the LC_ALL environment variable is set, it overrides the value
28466 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
28467 default to the value of the LANG environment variable. If none of
28468 these variables are set, GCC defaults to traditional C English
28469 behavior.
28470
28471 TMPDIR
28472 If TMPDIR is set, it specifies the directory to use for temporary
28473 files. GCC uses temporary files to hold the output of one stage of
28474 compilation which is to be used as input to the next stage: for
28475 example, the output of the preprocessor, which is the input to the
28476 compiler proper.
28477
28478 GCC_COMPARE_DEBUG
28479 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
28480 -fcompare-debug to the compiler driver. See the documentation of
28481 this option for more details.
28482
28483 GCC_EXEC_PREFIX
28484 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
28485 names of the subprograms executed by the compiler. No slash is
28486 added when this prefix is combined with the name of a subprogram,
28487 but you can specify a prefix that ends with a slash if you wish.
28488
28489 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
28490 appropriate prefix to use based on the pathname it is invoked with.
28491
28492 If GCC cannot find the subprogram using the specified prefix, it
28493 tries looking in the usual places for the subprogram.
28494
28495 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
28496 prefix is the prefix to the installed compiler. In many cases
28497 prefix is the value of "prefix" when you ran the configure script.
28498
28499 Other prefixes specified with -B take precedence over this prefix.
28500
28501 This prefix is also used for finding files such as crt0.o that are
28502 used for linking.
28503
28504 In addition, the prefix is used in an unusual way in finding the
28505 directories to search for header files. For each of the standard
28506 directories whose name normally begins with /usr/local/lib/gcc
28507 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
28508 replacing that beginning with the specified prefix to produce an
28509 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
28510 just before it searches the standard directory /usr/local/lib/bar.
28511 If a standard directory begins with the configured prefix then the
28512 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
28513 header files.
28514
28515 COMPILER_PATH
28516 The value of COMPILER_PATH is a colon-separated list of
28517 directories, much like PATH. GCC tries the directories thus
28518 specified when searching for subprograms, if it cannot find the
28519 subprograms using GCC_EXEC_PREFIX.
28520
28521 LIBRARY_PATH
28522 The value of LIBRARY_PATH is a colon-separated list of directories,
28523 much like PATH. When configured as a native compiler, GCC tries
28524 the directories thus specified when searching for special linker
28525 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
28526 GCC also uses these directories when searching for ordinary
28527 libraries for the -l option (but directories specified with -L come
28528 first).
28529
28530 LANG
28531 This variable is used to pass locale information to the compiler.
28532 One way in which this information is used is to determine the
28533 character set to be used when character literals, string literals
28534 and comments are parsed in C and C++. When the compiler is
28535 configured to allow multibyte characters, the following values for
28536 LANG are recognized:
28537
28538 C-JIS
28539 Recognize JIS characters.
28540
28541 C-SJIS
28542 Recognize SJIS characters.
28543
28544 C-EUCJP
28545 Recognize EUCJP characters.
28546
28547 If LANG is not defined, or if it has some other value, then the
28548 compiler uses "mblen" and "mbtowc" as defined by the default locale
28549 to recognize and translate multibyte characters.
28550
28551 GCC_EXTRA_DIAGNOSTIC_OUTPUT
28552 If GCC_EXTRA_DIAGNOSTIC_OUTPUT is set to one of the following
28553 values, then additional text will be emitted to stderr when fix-it
28554 hints are emitted. -fdiagnostics-parseable-fixits and
28555 -fno-diagnostics-parseable-fixits take precedence over this
28556 environment variable.
28557
28558 fixits-v1
28559 Emit parseable fix-it hints, equivalent to
28560 -fdiagnostics-parseable-fixits. In particular, columns are
28561 expressed as a count of bytes, starting at byte 1 for the
28562 initial column.
28563
28564 fixits-v2
28565 As "fixits-v1", but columns are expressed as display columns,
28566 as per -fdiagnostics-column-unit=display.
28567
28568 Some additional environment variables affect the behavior of the
28569 preprocessor.
28570
28571 CPATH
28572 C_INCLUDE_PATH
28573 CPLUS_INCLUDE_PATH
28574 OBJC_INCLUDE_PATH
28575 Each variable's value is a list of directories separated by a
28576 special character, much like PATH, in which to look for header
28577 files. The special character, "PATH_SEPARATOR", is target-
28578 dependent and determined at GCC build time. For Microsoft Windows-
28579 based targets it is a semicolon, and for almost all other targets
28580 it is a colon.
28581
28582 CPATH specifies a list of directories to be searched as if
28583 specified with -I, but after any paths given with -I options on the
28584 command line. This environment variable is used regardless of
28585 which language is being preprocessed.
28586
28587 The remaining environment variables apply only when preprocessing
28588 the particular language indicated. Each specifies a list of
28589 directories to be searched as if specified with -isystem, but after
28590 any paths given with -isystem options on the command line.
28591
28592 In all these variables, an empty element instructs the compiler to
28593 search its current working directory. Empty elements can appear at
28594 the beginning or end of a path. For instance, if the value of
28595 CPATH is ":/special/include", that has the same effect as
28596 -I. -I/special/include.
28597
28598 DEPENDENCIES_OUTPUT
28599 If this variable is set, its value specifies how to output
28600 dependencies for Make based on the non-system header files
28601 processed by the compiler. System header files are ignored in the
28602 dependency output.
28603
28604 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
28605 case the Make rules are written to that file, guessing the target
28606 name from the source file name. Or the value can have the form
28607 file target, in which case the rules are written to file file using
28608 target as the target name.
28609
28610 In other words, this environment variable is equivalent to
28611 combining the options -MM and -MF, with an optional -MT switch too.
28612
28613 SUNPRO_DEPENDENCIES
28614 This variable is the same as DEPENDENCIES_OUTPUT (see above),
28615 except that system header files are not ignored, so it implies -M
28616 rather than -MM. However, the dependence on the main input file is
28617 omitted.
28618
28619 SOURCE_DATE_EPOCH
28620 If this variable is set, its value specifies a UNIX timestamp to be
28621 used in replacement of the current date and time in the "__DATE__"
28622 and "__TIME__" macros, so that the embedded timestamps become
28623 reproducible.
28624
28625 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
28626 the number of seconds (excluding leap seconds) since 01 Jan 1970
28627 00:00:00 represented in ASCII; identical to the output of "date
28628 +%s" on GNU/Linux and other systems that support the %s extension
28629 in the "date" command.
28630
28631 The value should be a known timestamp such as the last modification
28632 time of the source or package and it should be set by the build
28633 process.
28634
28636 For instructions on reporting bugs, see
28637 <http://bugzilla.redhat.com/bugzilla>.
28638
28640 1. On some systems, gcc -shared needs to build supplementary stub code
28641 for constructors to work. On multi-libbed systems, gcc -shared
28642 must select the correct support libraries to link against. Failing
28643 to supply the correct flags may lead to subtle defects. Supplying
28644 them in cases where they are not necessary is innocuous.
28645
28647 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1),
28648 dbx(1) and the Info entries for gcc, cpp, as, ld, binutils and gdb.
28649
28651 See the Info entry for gcc, or
28652 <https://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for
28653 contributors to GCC.
28654
28656 Copyright (c) 1988-2022 Free Software Foundation, Inc.
28657
28658 Permission is granted to copy, distribute and/or modify this document
28659 under the terms of the GNU Free Documentation License, Version 1.3 or
28660 any later version published by the Free Software Foundation; with the
28661 Invariant Sections being "GNU General Public License" and "Funding Free
28662 Software", the Front-Cover texts being (a) (see below), and with the
28663 Back-Cover Texts being (b) (see below). A copy of the license is
28664 included in the gfdl(7) man page.
28665
28666 (a) The FSF's Front-Cover Text is:
28667
28668 A GNU Manual
28669
28670 (b) The FSF's Back-Cover Text is:
28671
28672 You have freedom to copy and modify this GNU Manual, like GNU
28673 software. Copies published by the Free Software Foundation raise
28674 funds for GNU development.
28675
28676
28677
28678gcc-12 2022-05-07 GCC(1)