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, file.*.tg.dot, and
8200 file.*.fpath.txt.
8201
8202 -fdump-analyzer-json
8203 Dump a compressed JSON representation of analyzer internals to
8204 file.analyzer.json.gz. The precise format is subject to change.
8205
8206 -fdump-analyzer-state-purge
8207 As per -fdump-analyzer-supergraph, dump a representation of the
8208 "supergraph" suitable for viewing with GraphViz, but annotate the
8209 graph with information on what state will be purged at each node.
8210 The graph is written to file.state-purge.dot.
8211
8212 -fdump-analyzer-supergraph
8213 Dump representations of the "supergraph" suitable for viewing with
8214 GraphViz to file.supergraph.dot and to file.supergraph-eg.dot.
8215 These show all of the control flow graphs in the program, with
8216 interprocedural edges for calls and returns. The second dump
8217 contains annotations showing nodes in the "exploded graph" and
8218 diagnostics associated with them.
8219
8220 -fdump-analyzer-untracked
8221 Emit custom warnings with internal details intended for analyzer
8222 developers.
8223
8224 Options for Debugging Your Program
8225 To tell GCC to emit extra information for use by a debugger, in almost
8226 all cases you need only to add -g to your other options. Some debug
8227 formats can co-exist (like DWARF with CTF) when each of them is enabled
8228 explicitly by adding the respective command line option to your other
8229 options.
8230
8231 GCC allows you to use -g with -O. The shortcuts taken by optimized
8232 code may occasionally be surprising: some variables you declared may
8233 not exist at all; flow of control may briefly move where you did not
8234 expect it; some statements may not be executed because they compute
8235 constant results or their values are already at hand; some statements
8236 may execute in different places because they have been moved out of
8237 loops. Nevertheless it is possible to debug optimized output. This
8238 makes it reasonable to use the optimizer for programs that might have
8239 bugs.
8240
8241 If you are not using some other optimization option, consider using -Og
8242 with -g. With no -O option at all, some compiler passes that collect
8243 information useful for debugging do not run at all, so that -Og may
8244 result in a better debugging experience.
8245
8246 -g Produce debugging information in the operating system's native
8247 format (stabs, COFF, XCOFF, or DWARF). GDB can work with this
8248 debugging information.
8249
8250 On most systems that use stabs format, -g enables use of extra
8251 debugging information that only GDB can use; this extra information
8252 makes debugging work better in GDB but probably makes other
8253 debuggers crash or refuse to read the program. If you want to
8254 control for certain whether to generate the extra information, use
8255 -gstabs+, -gstabs, -gxcoff+, -gxcoff, or -gvms (see below).
8256
8257 -ggdb
8258 Produce debugging information for use by GDB. This means to use
8259 the most expressive format available (DWARF, stabs, or the native
8260 format if neither of those are supported), including GDB extensions
8261 if at all possible.
8262
8263 -gdwarf
8264 -gdwarf-version
8265 Produce debugging information in DWARF format (if that is
8266 supported). The value of version may be either 2, 3, 4 or 5; the
8267 default version for most targets is 5 (with the exception of
8268 VxWorks, TPF and Darwin/Mac OS X, which default to version 2, and
8269 AIX, which defaults to version 4).
8270
8271 Note that with DWARF Version 2, some ports require and always use
8272 some non-conflicting DWARF 3 extensions in the unwind tables.
8273
8274 Version 4 may require GDB 7.0 and -fvar-tracking-assignments for
8275 maximum benefit. Version 5 requires GDB 8.0 or higher.
8276
8277 GCC no longer supports DWARF Version 1, which is substantially
8278 different than Version 2 and later. For historical reasons, some
8279 other DWARF-related options such as -fno-dwarf2-cfi-asm) retain a
8280 reference to DWARF Version 2 in their names, but apply to all
8281 currently-supported versions of DWARF.
8282
8283 -gbtf
8284 Request BTF debug information. BTF is the default debugging format
8285 for the eBPF target. On other targets, like x86, BTF debug
8286 information can be generated along with DWARF debug information
8287 when both of the debug formats are enabled explicitly via their
8288 respective command line options.
8289
8290 -gctf
8291 -gctflevel
8292 Request CTF debug information and use level to specify how much CTF
8293 debug information should be produced. If -gctf is specified
8294 without a value for level, the default level of CTF debug
8295 information is 2.
8296
8297 CTF debug information can be generated along with DWARF debug
8298 information when both of the debug formats are enabled explicitly
8299 via their respective command line options.
8300
8301 Level 0 produces no CTF debug information at all. Thus, -gctf0
8302 negates -gctf.
8303
8304 Level 1 produces CTF information for tracebacks only. This
8305 includes callsite information, but does not include type
8306 information.
8307
8308 Level 2 produces type information for entities (functions, data
8309 objects etc.) at file-scope or global-scope only.
8310
8311 -gstabs
8312 Produce debugging information in stabs format (if that is
8313 supported), without GDB extensions. This is the format used by DBX
8314 on most BSD systems. On MIPS, Alpha and System V Release 4 systems
8315 this option produces stabs debugging output that is not understood
8316 by DBX. On System V Release 4 systems this option requires the GNU
8317 assembler.
8318
8319 -gstabs+
8320 Produce debugging information in stabs format (if that is
8321 supported), using GNU extensions understood only by the GNU
8322 debugger (GDB). The use of these extensions is likely to make
8323 other debuggers crash or refuse to read the program.
8324
8325 -gxcoff
8326 Produce debugging information in XCOFF format (if that is
8327 supported). This is the format used by the DBX debugger on IBM
8328 RS/6000 systems.
8329
8330 -gxcoff+
8331 Produce debugging information in XCOFF format (if that is
8332 supported), using GNU extensions understood only by the GNU
8333 debugger (GDB). The use of these extensions is likely to make
8334 other debuggers crash or refuse to read the program, and may cause
8335 assemblers other than the GNU assembler (GAS) to fail with an
8336 error.
8337
8338 -gvms
8339 Produce debugging information in Alpha/VMS debug format (if that is
8340 supported). This is the format used by DEBUG on Alpha/VMS systems.
8341
8342 -glevel
8343 -ggdblevel
8344 -gstabslevel
8345 -gxcofflevel
8346 -gvmslevel
8347 Request debugging information and also use level to specify how
8348 much information. The default level is 2.
8349
8350 Level 0 produces no debug information at all. Thus, -g0 negates
8351 -g.
8352
8353 Level 1 produces minimal information, enough for making backtraces
8354 in parts of the program that you don't plan to debug. This
8355 includes descriptions of functions and external variables, and line
8356 number tables, but no information about local variables.
8357
8358 Level 3 includes extra information, such as all the macro
8359 definitions present in the program. Some debuggers support macro
8360 expansion when you use -g3.
8361
8362 If you use multiple -g options, with or without level numbers, the
8363 last such option is the one that is effective.
8364
8365 -gdwarf does not accept a concatenated debug level, to avoid
8366 confusion with -gdwarf-level. Instead use an additional -glevel
8367 option to change the debug level for DWARF.
8368
8369 -fno-eliminate-unused-debug-symbols
8370 By default, no debug information is produced for symbols that are
8371 not actually used. Use this option if you want debug information
8372 for all symbols.
8373
8374 -femit-class-debug-always
8375 Instead of emitting debugging information for a C++ class in only
8376 one object file, emit it in all object files using the class. This
8377 option should be used only with debuggers that are unable to handle
8378 the way GCC normally emits debugging information for classes
8379 because using this option increases the size of debugging
8380 information by as much as a factor of two.
8381
8382 -fno-merge-debug-strings
8383 Direct the linker to not merge together strings in the debugging
8384 information that are identical in different object files. Merging
8385 is not supported by all assemblers or linkers. Merging decreases
8386 the size of the debug information in the output file at the cost of
8387 increasing link processing time. Merging is enabled by default.
8388
8389 -fdebug-prefix-map=old=new
8390 When compiling files residing in directory old, record debugging
8391 information describing them as if the files resided in directory
8392 new instead. This can be used to replace a build-time path with an
8393 install-time path in the debug info. It can also be used to change
8394 an absolute path to a relative path by using . for new. This can
8395 give more reproducible builds, which are location independent, but
8396 may require an extra command to tell GDB where to find the source
8397 files. See also -ffile-prefix-map.
8398
8399 -fvar-tracking
8400 Run variable tracking pass. It computes where variables are stored
8401 at each position in code. Better debugging information is then
8402 generated (if the debugging information format supports this
8403 information).
8404
8405 It is enabled by default when compiling with optimization (-Os, -O,
8406 -O2, ...), debugging information (-g) and the debug info format
8407 supports it.
8408
8409 -fvar-tracking-assignments
8410 Annotate assignments to user variables early in the compilation and
8411 attempt to carry the annotations over throughout the compilation
8412 all the way to the end, in an attempt to improve debug information
8413 while optimizing. Use of -gdwarf-4 is recommended along with it.
8414
8415 It can be enabled even if var-tracking is disabled, in which case
8416 annotations are created and maintained, but discarded at the end.
8417 By default, this flag is enabled together with -fvar-tracking,
8418 except when selective scheduling is enabled.
8419
8420 -gsplit-dwarf
8421 If DWARF debugging information is enabled, separate as much
8422 debugging information as possible into a separate output file with
8423 the extension .dwo. This option allows the build system to avoid
8424 linking files with debug information. To be useful, this option
8425 requires a debugger capable of reading .dwo files.
8426
8427 -gdwarf32
8428 -gdwarf64
8429 If DWARF debugging information is enabled, the -gdwarf32 selects
8430 the 32-bit DWARF format and the -gdwarf64 selects the 64-bit DWARF
8431 format. The default is target specific, on most targets it is
8432 -gdwarf32 though. The 32-bit DWARF format is smaller, but can't
8433 support more than 2GiB of debug information in any of the DWARF
8434 debug information sections. The 64-bit DWARF format allows larger
8435 debug information and might not be well supported by all consumers
8436 yet.
8437
8438 -gdescribe-dies
8439 Add description attributes to some DWARF DIEs that have no name
8440 attribute, such as artificial variables, external references and
8441 call site parameter DIEs.
8442
8443 -gpubnames
8444 Generate DWARF ".debug_pubnames" and ".debug_pubtypes" sections.
8445
8446 -ggnu-pubnames
8447 Generate ".debug_pubnames" and ".debug_pubtypes" sections in a
8448 format suitable for conversion into a GDB index. This option is
8449 only useful with a linker that can produce GDB index version 7.
8450
8451 -fdebug-types-section
8452 When using DWARF Version 4 or higher, type DIEs can be put into
8453 their own ".debug_types" section instead of making them part of the
8454 ".debug_info" section. It is more efficient to put them in a
8455 separate comdat section since the linker can then remove
8456 duplicates. But not all DWARF consumers support ".debug_types"
8457 sections yet and on some objects ".debug_types" produces larger
8458 instead of smaller debugging information.
8459
8460 -grecord-gcc-switches
8461 -gno-record-gcc-switches
8462 This switch causes the command-line options used to invoke the
8463 compiler that may affect code generation to be appended to the
8464 DW_AT_producer attribute in DWARF debugging information. The
8465 options are concatenated with spaces separating them from each
8466 other and from the compiler version. It is enabled by default.
8467 See also -frecord-gcc-switches for another way of storing compiler
8468 options into the object file.
8469
8470 -gstrict-dwarf
8471 Disallow using extensions of later DWARF standard version than
8472 selected with -gdwarf-version. On most targets using non-
8473 conflicting DWARF extensions from later standard versions is
8474 allowed.
8475
8476 -gno-strict-dwarf
8477 Allow using extensions of later DWARF standard version than
8478 selected with -gdwarf-version.
8479
8480 -gas-loc-support
8481 Inform the compiler that the assembler supports ".loc" directives.
8482 It may then use them for the assembler to generate DWARF2+ line
8483 number tables.
8484
8485 This is generally desirable, because assembler-generated line-
8486 number tables are a lot more compact than those the compiler can
8487 generate itself.
8488
8489 This option will be enabled by default if, at GCC configure time,
8490 the assembler was found to support such directives.
8491
8492 -gno-as-loc-support
8493 Force GCC to generate DWARF2+ line number tables internally, if
8494 DWARF2+ line number tables are to be generated.
8495
8496 -gas-locview-support
8497 Inform the compiler that the assembler supports "view" assignment
8498 and reset assertion checking in ".loc" directives.
8499
8500 This option will be enabled by default if, at GCC configure time,
8501 the assembler was found to support them.
8502
8503 -gno-as-locview-support
8504 Force GCC to assign view numbers internally, if
8505 -gvariable-location-views are explicitly requested.
8506
8507 -gcolumn-info
8508 -gno-column-info
8509 Emit location column information into DWARF debugging information,
8510 rather than just file and line. This option is enabled by default.
8511
8512 -gstatement-frontiers
8513 -gno-statement-frontiers
8514 This option causes GCC to create markers in the internal
8515 representation at the beginning of statements, and to keep them
8516 roughly in place throughout compilation, using them to guide the
8517 output of "is_stmt" markers in the line number table. This is
8518 enabled by default when compiling with optimization (-Os, -O1, -O2,
8519 ...), and outputting DWARF 2 debug information at the normal level.
8520
8521 -gvariable-location-views
8522 -gvariable-location-views=incompat5
8523 -gno-variable-location-views
8524 Augment variable location lists with progressive view numbers
8525 implied from the line number table. This enables debug information
8526 consumers to inspect state at certain points of the program, even
8527 if no instructions associated with the corresponding source
8528 locations are present at that point. If the assembler lacks
8529 support for view numbers in line number tables, this will cause the
8530 compiler to emit the line number table, which generally makes them
8531 somewhat less compact. The augmented line number tables and
8532 location lists are fully backward-compatible, so they can be
8533 consumed by debug information consumers that are not aware of these
8534 augmentations, but they won't derive any benefit from them either.
8535
8536 This is enabled by default when outputting DWARF 2 debug
8537 information at the normal level, as long as there is assembler
8538 support, -fvar-tracking-assignments is enabled and -gstrict-dwarf
8539 is not. When assembler support is not available, this may still be
8540 enabled, but it will force GCC to output internal line number
8541 tables, and if -ginternal-reset-location-views is not enabled, that
8542 will most certainly lead to silently mismatching location views.
8543
8544 There is a proposed representation for view numbers that is not
8545 backward compatible with the location list format introduced in
8546 DWARF 5, that can be enabled with
8547 -gvariable-location-views=incompat5. This option may be removed in
8548 the future, is only provided as a reference implementation of the
8549 proposed representation. Debug information consumers are not
8550 expected to support this extended format, and they would be
8551 rendered unable to decode location lists using it.
8552
8553 -ginternal-reset-location-views
8554 -gno-internal-reset-location-views
8555 Attempt to determine location views that can be omitted from
8556 location view lists. This requires the compiler to have very
8557 accurate insn length estimates, which isn't always the case, and it
8558 may cause incorrect view lists to be generated silently when using
8559 an assembler that does not support location view lists. The GNU
8560 assembler will flag any such error as a "view number mismatch".
8561 This is only enabled on ports that define a reliable estimation
8562 function.
8563
8564 -ginline-points
8565 -gno-inline-points
8566 Generate extended debug information for inlined functions.
8567 Location view tracking markers are inserted at inlined entry
8568 points, so that address and view numbers can be computed and output
8569 in debug information. This can be enabled independently of
8570 location views, in which case the view numbers won't be output, but
8571 it can only be enabled along with statement frontiers, and it is
8572 only enabled by default if location views are enabled.
8573
8574 -gz[=type]
8575 Produce compressed debug sections in DWARF format, if that is
8576 supported. If type is not given, the default type depends on the
8577 capabilities of the assembler and linker used. type may be one of
8578 none (don't compress debug sections), zlib (use zlib compression in
8579 ELF gABI format), or zlib-gnu (use zlib compression in traditional
8580 GNU format). If the linker doesn't support writing compressed
8581 debug sections, the option is rejected. Otherwise, if the
8582 assembler does not support them, -gz is silently ignored when
8583 producing object files.
8584
8585 -femit-struct-debug-baseonly
8586 Emit debug information for struct-like types only when the base
8587 name of the compilation source file matches the base name of file
8588 in which the struct is defined.
8589
8590 This option substantially reduces the size of debugging
8591 information, but at significant potential loss in type information
8592 to the debugger. See -femit-struct-debug-reduced for a less
8593 aggressive option. See -femit-struct-debug-detailed for more
8594 detailed control.
8595
8596 This option works only with DWARF debug output.
8597
8598 -femit-struct-debug-reduced
8599 Emit debug information for struct-like types only when the base
8600 name of the compilation source file matches the base name of file
8601 in which the type is defined, unless the struct is a template or
8602 defined in a system header.
8603
8604 This option significantly reduces the size of debugging
8605 information, with some potential loss in type information to the
8606 debugger. See -femit-struct-debug-baseonly for a more aggressive
8607 option. See -femit-struct-debug-detailed for more detailed
8608 control.
8609
8610 This option works only with DWARF debug output.
8611
8612 -femit-struct-debug-detailed[=spec-list]
8613 Specify the struct-like types for which the compiler generates
8614 debug information. The intent is to reduce duplicate struct debug
8615 information between different object files within the same program.
8616
8617 This option is a detailed version of -femit-struct-debug-reduced
8618 and -femit-struct-debug-baseonly, which serves for most needs.
8619
8620 A specification has the
8621 syntax[dir:|ind:][ord:|gen:](any|sys|base|none)
8622
8623 The optional first word limits the specification to structs that
8624 are used directly (dir:) or used indirectly (ind:). A struct type
8625 is used directly when it is the type of a variable, member.
8626 Indirect uses arise through pointers to structs. That is, when use
8627 of an incomplete struct is valid, the use is indirect. An example
8628 is struct one direct; struct two * indirect;.
8629
8630 The optional second word limits the specification to ordinary
8631 structs (ord:) or generic structs (gen:). Generic structs are a
8632 bit complicated to explain. For C++, these are non-explicit
8633 specializations of template classes, or non-template classes within
8634 the above. Other programming languages have generics, but
8635 -femit-struct-debug-detailed does not yet implement them.
8636
8637 The third word specifies the source files for those structs for
8638 which the compiler should emit debug information. The values none
8639 and any have the normal meaning. The value base means that the
8640 base of name of the file in which the type declaration appears must
8641 match the base of the name of the main compilation file. In
8642 practice, this means that when compiling foo.c, debug information
8643 is generated for types declared in that file and foo.h, but not
8644 other header files. The value sys means those types satisfying
8645 base or declared in system or compiler headers.
8646
8647 You may need to experiment to determine the best settings for your
8648 application.
8649
8650 The default is -femit-struct-debug-detailed=all.
8651
8652 This option works only with DWARF debug output.
8653
8654 -fno-dwarf2-cfi-asm
8655 Emit DWARF unwind info as compiler generated ".eh_frame" section
8656 instead of using GAS ".cfi_*" directives.
8657
8658 -fno-eliminate-unused-debug-types
8659 Normally, when producing DWARF output, GCC avoids producing debug
8660 symbol output for types that are nowhere used in the source file
8661 being compiled. Sometimes it is useful to have GCC emit debugging
8662 information for all types declared in a compilation unit,
8663 regardless of whether or not they are actually used in that
8664 compilation unit, for example if, in the debugger, you want to cast
8665 a value to a type that is not actually used in your program (but is
8666 declared). More often, however, this results in a significant
8667 amount of wasted space.
8668
8669 Options That Control Optimization
8670 These options control various sorts of optimizations.
8671
8672 Without any optimization option, the compiler's goal is to reduce the
8673 cost of compilation and to make debugging produce the expected results.
8674 Statements are independent: if you stop the program with a breakpoint
8675 between statements, you can then assign a new value to any variable or
8676 change the program counter to any other statement in the function and
8677 get exactly the results you expect from the source code.
8678
8679 Turning on optimization flags makes the compiler attempt to improve the
8680 performance and/or code size at the expense of compilation time and
8681 possibly the ability to debug the program.
8682
8683 The compiler performs optimization based on the knowledge it has of the
8684 program. Compiling multiple files at once to a single output file mode
8685 allows the compiler to use information gained from all of the files
8686 when compiling each of them.
8687
8688 Not all optimizations are controlled directly by a flag. Only
8689 optimizations that have a flag are listed in this section.
8690
8691 Most optimizations are completely disabled at -O0 or if an -O level is
8692 not set on the command line, even if individual optimization flags are
8693 specified. Similarly, -Og suppresses many optimization passes.
8694
8695 Depending on the target and how GCC was configured, a slightly
8696 different set of optimizations may be enabled at each -O level than
8697 those listed here. You can invoke GCC with -Q --help=optimizers to
8698 find out the exact set of optimizations that are enabled at each level.
8699
8700 -O
8701 -O1 Optimize. Optimizing compilation takes somewhat more time, and a
8702 lot more memory for a large function.
8703
8704 With -O, the compiler tries to reduce code size and execution time,
8705 without performing any optimizations that take a great deal of
8706 compilation time.
8707
8708 -O turns on the following optimization flags:
8709
8710 -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments
8711 -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch
8712 -fdse -fforward-propagate -fguess-branch-probability
8713 -fif-conversion -fif-conversion2 -finline-functions-called-once
8714 -fipa-modref -fipa-profile -fipa-pure-const -fipa-reference
8715 -fipa-reference-addressable -fmerge-constants
8716 -fmove-loop-invariants -fmove-loop-stores -fomit-frame-pointer
8717 -freorder-blocks -fshrink-wrap -fshrink-wrap-separate
8718 -fsplit-wide-types -fssa-backprop -fssa-phiopt -ftree-bit-ccp
8719 -ftree-ccp -ftree-ch -ftree-coalesce-vars -ftree-copy-prop
8720 -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-forwprop
8721 -ftree-fre -ftree-phiprop -ftree-pta -ftree-scev-cprop -ftree-sink
8722 -ftree-slsr -ftree-sra -ftree-ter -funit-at-a-time
8723
8724 -O2 Optimize even more. GCC performs nearly all supported
8725 optimizations that do not involve a space-speed tradeoff. As
8726 compared to -O, this option increases both compilation time and the
8727 performance of the generated code.
8728
8729 -O2 turns on all optimization flags specified by -O1. It also
8730 turns on the following optimization flags:
8731
8732 -falign-functions -falign-jumps -falign-labels -falign-loops
8733 -fcaller-saves -fcode-hoisting -fcrossjumping -fcse-follow-jumps
8734 -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize
8735 -fdevirtualize-speculatively -fexpensive-optimizations
8736 -ffinite-loops -fgcse -fgcse-lm -fhoist-adjacent-loads
8737 -finline-functions -finline-small-functions -findirect-inlining
8738 -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fipa-vrp
8739 -fisolate-erroneous-paths-dereference -flra-remat
8740 -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining
8741 -fpeephole2 -freorder-blocks-algorithm=stc
8742 -freorder-blocks-and-partition -freorder-functions
8743 -frerun-cse-after-loop -fschedule-insns -fschedule-insns2
8744 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing
8745 -fthread-jumps -ftree-builtin-call-dce -ftree-loop-vectorize
8746 -ftree-pre -ftree-slp-vectorize -ftree-switch-conversion
8747 -ftree-tail-merge -ftree-vrp -fvect-cost-model=very-cheap
8748
8749 Please note the warning under -fgcse about invoking -O2 on programs
8750 that use computed gotos.
8751
8752 -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2
8753 and also turns on the following optimization flags:
8754
8755 -fgcse-after-reload -fipa-cp-clone -floop-interchange
8756 -floop-unroll-and-jam -fpeel-loops -fpredictive-commoning
8757 -fsplit-loops -fsplit-paths -ftree-loop-distribution
8758 -ftree-partial-pre -funswitch-loops -fvect-cost-model=dynamic
8759 -fversion-loops-for-strides
8760
8761 -O0 Reduce compilation time and make debugging produce the expected
8762 results. This is the default.
8763
8764 -Os Optimize for size. -Os enables all -O2 optimizations except those
8765 that often increase code size:
8766
8767 -falign-functions -falign-jumps -falign-labels -falign-loops
8768 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc
8769
8770 It also enables -finline-functions, causes the compiler to tune for
8771 code size rather than execution speed, and performs further
8772 optimizations designed to reduce code size.
8773
8774 -Ofast
8775 Disregard strict standards compliance. -Ofast enables all -O3
8776 optimizations. It also enables optimizations that are not valid
8777 for all standard-compliant programs. It turns on -ffast-math,
8778 -fallow-store-data-races and the Fortran-specific -fstack-arrays,
8779 unless -fmax-stack-var-size is specified, and -fno-protect-parens.
8780 It turns off -fsemantic-interposition.
8781
8782 -Og Optimize debugging experience. -Og should be the optimization
8783 level of choice for the standard edit-compile-debug cycle, offering
8784 a reasonable level of optimization while maintaining fast
8785 compilation and a good debugging experience. It is a better choice
8786 than -O0 for producing debuggable code because some compiler passes
8787 that collect debug information are disabled at -O0.
8788
8789 Like -O0, -Og completely disables a number of optimization passes
8790 so that individual options controlling them have no effect.
8791 Otherwise -Og enables all -O1 optimization flags except for those
8792 that may interfere with debugging:
8793
8794 -fbranch-count-reg -fdelayed-branch -fdse -fif-conversion
8795 -fif-conversion2 -finline-functions-called-once
8796 -fmove-loop-invariants -fmove-loop-stores -fssa-phiopt
8797 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra
8798
8799 -Oz Optimize aggressively for size rather than speed. This may
8800 increase the number of instructions executed if those instructions
8801 require fewer bytes to encode. -Oz behaves similarly to -Os
8802 including enabling most -O2 optimizations.
8803
8804 If you use multiple -O options, with or without level numbers, the last
8805 such option is the one that is effective.
8806
8807 Options of the form -fflag specify machine-independent flags. Most
8808 flags have both positive and negative forms; the negative form of -ffoo
8809 is -fno-foo. In the table below, only one of the forms is listed---the
8810 one you typically use. You can figure out the other form by either
8811 removing no- or adding it.
8812
8813 The following options control specific optimizations. They are either
8814 activated by -O options or are related to ones that are. You can use
8815 the following flags in the rare cases when "fine-tuning" of
8816 optimizations to be performed is desired.
8817
8818 -fno-defer-pop
8819 For machines that must pop arguments after a function call, always
8820 pop the arguments as soon as each function returns. At levels -O1
8821 and higher, -fdefer-pop is the default; this allows the compiler to
8822 let arguments accumulate on the stack for several function calls
8823 and pop them all at once.
8824
8825 -fforward-propagate
8826 Perform a forward propagation pass on RTL. The pass tries to
8827 combine two instructions and checks if the result can be
8828 simplified. If loop unrolling is active, two passes are performed
8829 and the second is scheduled after loop unrolling.
8830
8831 This option is enabled by default at optimization levels -O1, -O2,
8832 -O3, -Os.
8833
8834 -ffp-contract=style
8835 -ffp-contract=off disables floating-point expression contraction.
8836 -ffp-contract=fast enables floating-point expression contraction
8837 such as forming of fused multiply-add operations if the target has
8838 native support for them. -ffp-contract=on enables floating-point
8839 expression contraction if allowed by the language standard. This
8840 is currently not implemented and treated equal to
8841 -ffp-contract=off.
8842
8843 The default is -ffp-contract=fast.
8844
8845 -fomit-frame-pointer
8846 Omit the frame pointer in functions that don't need one. This
8847 avoids the instructions to save, set up and restore the frame
8848 pointer; on many targets it also makes an extra register available.
8849
8850 On some targets this flag has no effect because the standard
8851 calling sequence always uses a frame pointer, so it cannot be
8852 omitted.
8853
8854 Note that -fno-omit-frame-pointer doesn't guarantee the frame
8855 pointer is used in all functions. Several targets always omit the
8856 frame pointer in leaf functions.
8857
8858 Enabled by default at -O1 and higher.
8859
8860 -foptimize-sibling-calls
8861 Optimize sibling and tail recursive calls.
8862
8863 Enabled at levels -O2, -O3, -Os.
8864
8865 -foptimize-strlen
8866 Optimize various standard C string functions (e.g. "strlen",
8867 "strchr" or "strcpy") and their "_FORTIFY_SOURCE" counterparts into
8868 faster alternatives.
8869
8870 Enabled at levels -O2, -O3.
8871
8872 -fno-inline
8873 Do not expand any functions inline apart from those marked with the
8874 "always_inline" attribute. This is the default when not
8875 optimizing.
8876
8877 Single functions can be exempted from inlining by marking them with
8878 the "noinline" attribute.
8879
8880 -finline-small-functions
8881 Integrate functions into their callers when their body is smaller
8882 than expected function call code (so overall size of program gets
8883 smaller). The compiler heuristically decides which functions are
8884 simple enough to be worth integrating in this way. This inlining
8885 applies to all functions, even those not declared inline.
8886
8887 Enabled at levels -O2, -O3, -Os.
8888
8889 -findirect-inlining
8890 Inline also indirect calls that are discovered to be known at
8891 compile time thanks to previous inlining. This option has any
8892 effect only when inlining itself is turned on by the
8893 -finline-functions or -finline-small-functions options.
8894
8895 Enabled at levels -O2, -O3, -Os.
8896
8897 -finline-functions
8898 Consider all functions for inlining, even if they are not declared
8899 inline. The compiler heuristically decides which functions are
8900 worth integrating in this way.
8901
8902 If all calls to a given function are integrated, and the function
8903 is declared "static", then the function is normally not output as
8904 assembler code in its own right.
8905
8906 Enabled at levels -O2, -O3, -Os. Also enabled by -fprofile-use and
8907 -fauto-profile.
8908
8909 -finline-functions-called-once
8910 Consider all "static" functions called once for inlining into their
8911 caller even if they are not marked "inline". If a call to a given
8912 function is integrated, then the function is not output as
8913 assembler code in its own right.
8914
8915 Enabled at levels -O1, -O2, -O3 and -Os, but not -Og.
8916
8917 -fearly-inlining
8918 Inline functions marked by "always_inline" and functions whose body
8919 seems smaller than the function call overhead early before doing
8920 -fprofile-generate instrumentation and real inlining pass. Doing
8921 so makes profiling significantly cheaper and usually inlining
8922 faster on programs having large chains of nested wrapper functions.
8923
8924 Enabled by default.
8925
8926 -fipa-sra
8927 Perform interprocedural scalar replacement of aggregates, removal
8928 of unused parameters and replacement of parameters passed by
8929 reference by parameters passed by value.
8930
8931 Enabled at levels -O2, -O3 and -Os.
8932
8933 -finline-limit=n
8934 By default, GCC limits the size of functions that can be inlined.
8935 This flag allows coarse control of this limit. n is the size of
8936 functions that can be inlined in number of pseudo instructions.
8937
8938 Inlining is actually controlled by a number of parameters, which
8939 may be specified individually by using --param name=value. The
8940 -finline-limit=n option sets some of these parameters as follows:
8941
8942 max-inline-insns-single
8943 is set to n/2.
8944
8945 max-inline-insns-auto
8946 is set to n/2.
8947
8948 See below for a documentation of the individual parameters
8949 controlling inlining and for the defaults of these parameters.
8950
8951 Note: there may be no value to -finline-limit that results in
8952 default behavior.
8953
8954 Note: pseudo instruction represents, in this particular context, an
8955 abstract measurement of function's size. In no way does it
8956 represent a count of assembly instructions and as such its exact
8957 meaning might change from one release to an another.
8958
8959 -fno-keep-inline-dllexport
8960 This is a more fine-grained version of -fkeep-inline-functions,
8961 which applies only to functions that are declared using the
8962 "dllexport" attribute or declspec.
8963
8964 -fkeep-inline-functions
8965 In C, emit "static" functions that are declared "inline" into the
8966 object file, even if the function has been inlined into all of its
8967 callers. This switch does not affect functions using the "extern
8968 inline" extension in GNU C90. In C++, emit any and all inline
8969 functions into the object file.
8970
8971 -fkeep-static-functions
8972 Emit "static" functions into the object file, even if the function
8973 is never used.
8974
8975 -fkeep-static-consts
8976 Emit variables declared "static const" when optimization isn't
8977 turned on, even if the variables aren't referenced.
8978
8979 GCC enables this option by default. If you want to force the
8980 compiler to check if a variable is referenced, regardless of
8981 whether or not optimization is turned on, use the
8982 -fno-keep-static-consts option.
8983
8984 -fmerge-constants
8985 Attempt to merge identical constants (string constants and
8986 floating-point constants) across compilation units.
8987
8988 This option is the default for optimized compilation if the
8989 assembler and linker support it. Use -fno-merge-constants to
8990 inhibit this behavior.
8991
8992 Enabled at levels -O1, -O2, -O3, -Os.
8993
8994 -fmerge-all-constants
8995 Attempt to merge identical constants and identical variables.
8996
8997 This option implies -fmerge-constants. In addition to
8998 -fmerge-constants this considers e.g. even constant initialized
8999 arrays or initialized constant variables with integral or floating-
9000 point types. Languages like C or C++ require each variable,
9001 including multiple instances of the same variable in recursive
9002 calls, to have distinct locations, so using this option results in
9003 non-conforming behavior.
9004
9005 -fmodulo-sched
9006 Perform swing modulo scheduling immediately before the first
9007 scheduling pass. This pass looks at innermost loops and reorders
9008 their instructions by overlapping different iterations.
9009
9010 -fmodulo-sched-allow-regmoves
9011 Perform more aggressive SMS-based modulo scheduling with register
9012 moves allowed. By setting this flag certain anti-dependences edges
9013 are deleted, which triggers the generation of reg-moves based on
9014 the life-range analysis. This option is effective only with
9015 -fmodulo-sched enabled.
9016
9017 -fno-branch-count-reg
9018 Disable the optimization pass that scans for opportunities to use
9019 "decrement and branch" instructions on a count register instead of
9020 instruction sequences that decrement a register, compare it against
9021 zero, and then branch based upon the result. This option is only
9022 meaningful on architectures that support such instructions, which
9023 include x86, PowerPC, IA-64 and S/390. Note that the
9024 -fno-branch-count-reg option doesn't remove the decrement and
9025 branch instructions from the generated instruction stream
9026 introduced by other optimization passes.
9027
9028 The default is -fbranch-count-reg at -O1 and higher, except for
9029 -Og.
9030
9031 -fno-function-cse
9032 Do not put function addresses in registers; make each instruction
9033 that calls a constant function contain the function's address
9034 explicitly.
9035
9036 This option results in less efficient code, but some strange hacks
9037 that alter the assembler output may be confused by the
9038 optimizations performed when this option is not used.
9039
9040 The default is -ffunction-cse
9041
9042 -fno-zero-initialized-in-bss
9043 If the target supports a BSS section, GCC by default puts variables
9044 that are initialized to zero into BSS. This can save space in the
9045 resulting code.
9046
9047 This option turns off this behavior because some programs
9048 explicitly rely on variables going to the data section---e.g., so
9049 that the resulting executable can find the beginning of that
9050 section and/or make assumptions based on that.
9051
9052 The default is -fzero-initialized-in-bss.
9053
9054 -fthread-jumps
9055 Perform optimizations that check to see if a jump branches to a
9056 location where another comparison subsumed by the first is found.
9057 If so, the first branch is redirected to either the destination of
9058 the second branch or a point immediately following it, depending on
9059 whether the condition is known to be true or false.
9060
9061 Enabled at levels -O1, -O2, -O3, -Os.
9062
9063 -fsplit-wide-types
9064 When using a type that occupies multiple registers, such as "long
9065 long" on a 32-bit system, split the registers apart and allocate
9066 them independently. This normally generates better code for those
9067 types, but may make debugging more difficult.
9068
9069 Enabled at levels -O1, -O2, -O3, -Os.
9070
9071 -fsplit-wide-types-early
9072 Fully split wide types early, instead of very late. This option
9073 has no effect unless -fsplit-wide-types is turned on.
9074
9075 This is the default on some targets.
9076
9077 -fcse-follow-jumps
9078 In common subexpression elimination (CSE), scan through jump
9079 instructions when the target of the jump is not reached by any
9080 other path. For example, when CSE encounters an "if" statement
9081 with an "else" clause, CSE follows the jump when the condition
9082 tested is false.
9083
9084 Enabled at levels -O2, -O3, -Os.
9085
9086 -fcse-skip-blocks
9087 This is similar to -fcse-follow-jumps, but causes CSE to follow
9088 jumps that conditionally skip over blocks. When CSE encounters a
9089 simple "if" statement with no else clause, -fcse-skip-blocks causes
9090 CSE to follow the jump around the body of the "if".
9091
9092 Enabled at levels -O2, -O3, -Os.
9093
9094 -frerun-cse-after-loop
9095 Re-run common subexpression elimination after loop optimizations
9096 are performed.
9097
9098 Enabled at levels -O2, -O3, -Os.
9099
9100 -fgcse
9101 Perform a global common subexpression elimination pass. This pass
9102 also performs global constant and copy propagation.
9103
9104 Note: When compiling a program using computed gotos, a GCC
9105 extension, you may get better run-time performance if you disable
9106 the global common subexpression elimination pass by adding
9107 -fno-gcse to the command line.
9108
9109 Enabled at levels -O2, -O3, -Os.
9110
9111 -fgcse-lm
9112 When -fgcse-lm is enabled, global common subexpression elimination
9113 attempts to move loads that are only killed by stores into
9114 themselves. This allows a loop containing a load/store sequence to
9115 be changed to a load outside the loop, and a copy/store within the
9116 loop.
9117
9118 Enabled by default when -fgcse is enabled.
9119
9120 -fgcse-sm
9121 When -fgcse-sm is enabled, a store motion pass is run after global
9122 common subexpression elimination. This pass attempts to move
9123 stores out of loops. When used in conjunction with -fgcse-lm,
9124 loops containing a load/store sequence can be changed to a load
9125 before the loop and a store after the loop.
9126
9127 Not enabled at any optimization level.
9128
9129 -fgcse-las
9130 When -fgcse-las is enabled, the global common subexpression
9131 elimination pass eliminates redundant loads that come after stores
9132 to the same memory location (both partial and full redundancies).
9133
9134 Not enabled at any optimization level.
9135
9136 -fgcse-after-reload
9137 When -fgcse-after-reload is enabled, a redundant load elimination
9138 pass is performed after reload. The purpose of this pass is to
9139 clean up redundant spilling.
9140
9141 Enabled by -O3, -fprofile-use and -fauto-profile.
9142
9143 -faggressive-loop-optimizations
9144 This option tells the loop optimizer to use language constraints to
9145 derive bounds for the number of iterations of a loop. This assumes
9146 that loop code does not invoke undefined behavior by for example
9147 causing signed integer overflows or out-of-bound array accesses.
9148 The bounds for the number of iterations of a loop are used to guide
9149 loop unrolling and peeling and loop exit test optimizations. This
9150 option is enabled by default.
9151
9152 -funconstrained-commons
9153 This option tells the compiler that variables declared in common
9154 blocks (e.g. Fortran) may later be overridden with longer trailing
9155 arrays. This prevents certain optimizations that depend on knowing
9156 the array bounds.
9157
9158 -fcrossjumping
9159 Perform cross-jumping transformation. This transformation unifies
9160 equivalent code and saves code size. The resulting code may or may
9161 not perform better than without cross-jumping.
9162
9163 Enabled at levels -O2, -O3, -Os.
9164
9165 -fauto-inc-dec
9166 Combine increments or decrements of addresses with memory accesses.
9167 This pass is always skipped on architectures that do not have
9168 instructions to support this. Enabled by default at -O1 and higher
9169 on architectures that support this.
9170
9171 -fdce
9172 Perform dead code elimination (DCE) on RTL. Enabled by default at
9173 -O1 and higher.
9174
9175 -fdse
9176 Perform dead store elimination (DSE) on RTL. Enabled by default at
9177 -O1 and higher.
9178
9179 -fif-conversion
9180 Attempt to transform conditional jumps into branch-less
9181 equivalents. This includes use of conditional moves, min, max, set
9182 flags and abs instructions, and some tricks doable by standard
9183 arithmetics. The use of conditional execution on chips where it is
9184 available is controlled by -fif-conversion2.
9185
9186 Enabled at levels -O1, -O2, -O3, -Os, but not with -Og.
9187
9188 -fif-conversion2
9189 Use conditional execution (where available) to transform
9190 conditional jumps into branch-less equivalents.
9191
9192 Enabled at levels -O1, -O2, -O3, -Os, but not with -Og.
9193
9194 -fdeclone-ctor-dtor
9195 The C++ ABI requires multiple entry points for constructors and
9196 destructors: one for a base subobject, one for a complete object,
9197 and one for a virtual destructor that calls operator delete
9198 afterwards. For a hierarchy with virtual bases, the base and
9199 complete variants are clones, which means two copies of the
9200 function. With this option, the base and complete variants are
9201 changed to be thunks that call a common implementation.
9202
9203 Enabled by -Os.
9204
9205 -fdelete-null-pointer-checks
9206 Assume that programs cannot safely dereference null pointers, and
9207 that no code or data element resides at address zero. This option
9208 enables simple constant folding optimizations at all optimization
9209 levels. In addition, other optimization passes in GCC use this
9210 flag to control global dataflow analyses that eliminate useless
9211 checks for null pointers; these assume that a memory access to
9212 address zero always results in a trap, so that if a pointer is
9213 checked after it has already been dereferenced, it cannot be null.
9214
9215 Note however that in some environments this assumption is not true.
9216 Use -fno-delete-null-pointer-checks to disable this optimization
9217 for programs that depend on that behavior.
9218
9219 This option is enabled by default on most targets. On Nios II ELF,
9220 it defaults to off. On AVR, CR16, and MSP430, this option is
9221 completely disabled.
9222
9223 Passes that use the dataflow information are enabled independently
9224 at different optimization levels.
9225
9226 -fdevirtualize
9227 Attempt to convert calls to virtual functions to direct calls.
9228 This is done both within a procedure and interprocedurally as part
9229 of indirect inlining (-findirect-inlining) and interprocedural
9230 constant propagation (-fipa-cp). Enabled at levels -O2, -O3, -Os.
9231
9232 -fdevirtualize-speculatively
9233 Attempt to convert calls to virtual functions to speculative direct
9234 calls. Based on the analysis of the type inheritance graph,
9235 determine for a given call the set of likely targets. If the set is
9236 small, preferably of size 1, change the call into a conditional
9237 deciding between direct and indirect calls. The speculative calls
9238 enable more optimizations, such as inlining. When they seem
9239 useless after further optimization, they are converted back into
9240 original form.
9241
9242 -fdevirtualize-at-ltrans
9243 Stream extra information needed for aggressive devirtualization
9244 when running the link-time optimizer in local transformation mode.
9245 This option enables more devirtualization but significantly
9246 increases the size of streamed data. For this reason it is disabled
9247 by default.
9248
9249 -fexpensive-optimizations
9250 Perform a number of minor optimizations that are relatively
9251 expensive.
9252
9253 Enabled at levels -O2, -O3, -Os.
9254
9255 -free
9256 Attempt to remove redundant extension instructions. This is
9257 especially helpful for the x86-64 architecture, which implicitly
9258 zero-extends in 64-bit registers after writing to their lower
9259 32-bit half.
9260
9261 Enabled for Alpha, AArch64 and x86 at levels -O2, -O3, -Os.
9262
9263 -fno-lifetime-dse
9264 In C++ the value of an object is only affected by changes within
9265 its lifetime: when the constructor begins, the object has an
9266 indeterminate value, and any changes during the lifetime of the
9267 object are dead when the object is destroyed. Normally dead store
9268 elimination will take advantage of this; if your code relies on the
9269 value of the object storage persisting beyond the lifetime of the
9270 object, you can use this flag to disable this optimization. To
9271 preserve stores before the constructor starts (e.g. because your
9272 operator new clears the object storage) but still treat the object
9273 as dead after the destructor, you can use -flifetime-dse=1. The
9274 default behavior can be explicitly selected with -flifetime-dse=2.
9275 -flifetime-dse=0 is equivalent to -fno-lifetime-dse.
9276
9277 -flive-range-shrinkage
9278 Attempt to decrease register pressure through register live range
9279 shrinkage. This is helpful for fast processors with small or
9280 moderate size register sets.
9281
9282 -fira-algorithm=algorithm
9283 Use the specified coloring algorithm for the integrated register
9284 allocator. The algorithm argument can be priority, which specifies
9285 Chow's priority coloring, or CB, which specifies Chaitin-Briggs
9286 coloring. Chaitin-Briggs coloring is not implemented for all
9287 architectures, but for those targets that do support it, it is the
9288 default because it generates better code.
9289
9290 -fira-region=region
9291 Use specified regions for the integrated register allocator. The
9292 region argument should be one of the following:
9293
9294 all Use all loops as register allocation regions. This can give
9295 the best results for machines with a small and/or irregular
9296 register set.
9297
9298 mixed
9299 Use all loops except for loops with small register pressure as
9300 the regions. This value usually gives the best results in most
9301 cases and for most architectures, and is enabled by default
9302 when compiling with optimization for speed (-O, -O2, ...).
9303
9304 one Use all functions as a single region. This typically results
9305 in the smallest code size, and is enabled by default for -Os or
9306 -O0.
9307
9308 -fira-hoist-pressure
9309 Use IRA to evaluate register pressure in the code hoisting pass for
9310 decisions to hoist expressions. This option usually results in
9311 smaller code, but it can slow the compiler down.
9312
9313 This option is enabled at level -Os for all targets.
9314
9315 -fira-loop-pressure
9316 Use IRA to evaluate register pressure in loops for decisions to
9317 move loop invariants. This option usually results in generation of
9318 faster and smaller code on machines with large register files (>=
9319 32 registers), but it can slow the compiler down.
9320
9321 This option is enabled at level -O3 for some targets.
9322
9323 -fno-ira-share-save-slots
9324 Disable sharing of stack slots used for saving call-used hard
9325 registers living through a call. Each hard register gets a
9326 separate stack slot, and as a result function stack frames are
9327 larger.
9328
9329 -fno-ira-share-spill-slots
9330 Disable sharing of stack slots allocated for pseudo-registers.
9331 Each pseudo-register that does not get a hard register gets a
9332 separate stack slot, and as a result function stack frames are
9333 larger.
9334
9335 -flra-remat
9336 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9337 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9338 values if it is profitable.
9339
9340 Enabled at levels -O2, -O3, -Os.
9341
9342 -fdelayed-branch
9343 If supported for the target machine, attempt to reorder
9344 instructions to exploit instruction slots available after delayed
9345 branch instructions.
9346
9347 Enabled at levels -O1, -O2, -O3, -Os, but not at -Og.
9348
9349 -fschedule-insns
9350 If supported for the target machine, attempt to reorder
9351 instructions to eliminate execution stalls due to required data
9352 being unavailable. This helps machines that have slow floating
9353 point or memory load instructions by allowing other instructions to
9354 be issued until the result of the load or floating-point
9355 instruction is required.
9356
9357 Enabled at levels -O2, -O3.
9358
9359 -fschedule-insns2
9360 Similar to -fschedule-insns, but requests an additional pass of
9361 instruction scheduling after register allocation has been done.
9362 This is especially useful on machines with a relatively small
9363 number of registers and where memory load instructions take more
9364 than one cycle.
9365
9366 Enabled at levels -O2, -O3, -Os.
9367
9368 -fno-sched-interblock
9369 Disable instruction scheduling across basic blocks, which is
9370 normally enabled when scheduling before register allocation, i.e.
9371 with -fschedule-insns or at -O2 or higher.
9372
9373 -fno-sched-spec
9374 Disable speculative motion of non-load instructions, which is
9375 normally enabled when scheduling before register allocation, i.e.
9376 with -fschedule-insns or at -O2 or higher.
9377
9378 -fsched-pressure
9379 Enable register pressure sensitive insn scheduling before register
9380 allocation. This only makes sense when scheduling before register
9381 allocation is enabled, i.e. with -fschedule-insns or at -O2 or
9382 higher. Usage of this option can improve the generated code and
9383 decrease its size by preventing register pressure increase above
9384 the number of available hard registers and subsequent spills in
9385 register allocation.
9386
9387 -fsched-spec-load
9388 Allow speculative motion of some load instructions. This only
9389 makes sense when scheduling before register allocation, i.e. with
9390 -fschedule-insns or at -O2 or higher.
9391
9392 -fsched-spec-load-dangerous
9393 Allow speculative motion of more load instructions. This only
9394 makes sense when scheduling before register allocation, i.e. with
9395 -fschedule-insns or at -O2 or higher.
9396
9397 -fsched-stalled-insns
9398 -fsched-stalled-insns=n
9399 Define how many insns (if any) can be moved prematurely from the
9400 queue of stalled insns into the ready list during the second
9401 scheduling pass. -fno-sched-stalled-insns means that no insns are
9402 moved prematurely, -fsched-stalled-insns=0 means there is no limit
9403 on how many queued insns can be moved prematurely.
9404 -fsched-stalled-insns without a value is equivalent to
9405 -fsched-stalled-insns=1.
9406
9407 -fsched-stalled-insns-dep
9408 -fsched-stalled-insns-dep=n
9409 Define how many insn groups (cycles) are examined for a dependency
9410 on a stalled insn that is a candidate for premature removal from
9411 the queue of stalled insns. This has an effect only during the
9412 second scheduling pass, and only if -fsched-stalled-insns is used.
9413 -fno-sched-stalled-insns-dep is equivalent to
9414 -fsched-stalled-insns-dep=0. -fsched-stalled-insns-dep without a
9415 value is equivalent to -fsched-stalled-insns-dep=1.
9416
9417 -fsched2-use-superblocks
9418 When scheduling after register allocation, use superblock
9419 scheduling. This allows motion across basic block boundaries,
9420 resulting in faster schedules. This option is experimental, as not
9421 all machine descriptions used by GCC model the CPU closely enough
9422 to avoid unreliable results from the algorithm.
9423
9424 This only makes sense when scheduling after register allocation,
9425 i.e. with -fschedule-insns2 or at -O2 or higher.
9426
9427 -fsched-group-heuristic
9428 Enable the group heuristic in the scheduler. This heuristic favors
9429 the instruction that belongs to a schedule group. This is enabled
9430 by default when scheduling is enabled, i.e. with -fschedule-insns
9431 or -fschedule-insns2 or at -O2 or higher.
9432
9433 -fsched-critical-path-heuristic
9434 Enable the critical-path heuristic in the scheduler. This
9435 heuristic favors instructions on the critical path. This is
9436 enabled by default when scheduling is enabled, i.e. with
9437 -fschedule-insns or -fschedule-insns2 or at -O2 or higher.
9438
9439 -fsched-spec-insn-heuristic
9440 Enable the speculative instruction heuristic in the scheduler.
9441 This heuristic favors speculative instructions with greater
9442 dependency weakness. This is enabled by default when scheduling is
9443 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
9444 or higher.
9445
9446 -fsched-rank-heuristic
9447 Enable the rank heuristic in the scheduler. This heuristic favors
9448 the instruction belonging to a basic block with greater size or
9449 frequency. This is enabled by default when scheduling is enabled,
9450 i.e. with -fschedule-insns or -fschedule-insns2 or at -O2 or
9451 higher.
9452
9453 -fsched-last-insn-heuristic
9454 Enable the last-instruction heuristic in the scheduler. This
9455 heuristic favors the instruction that is less dependent on the last
9456 instruction scheduled. This is enabled by default when scheduling
9457 is enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at
9458 -O2 or higher.
9459
9460 -fsched-dep-count-heuristic
9461 Enable the dependent-count heuristic in the scheduler. This
9462 heuristic favors the instruction that has more instructions
9463 depending on it. This is enabled by default when scheduling is
9464 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
9465 or higher.
9466
9467 -freschedule-modulo-scheduled-loops
9468 Modulo scheduling is performed before traditional scheduling. If a
9469 loop is modulo scheduled, later scheduling passes may change its
9470 schedule. Use this option to control that behavior.
9471
9472 -fselective-scheduling
9473 Schedule instructions using selective scheduling algorithm.
9474 Selective scheduling runs instead of the first scheduler pass.
9475
9476 -fselective-scheduling2
9477 Schedule instructions using selective scheduling algorithm.
9478 Selective scheduling runs instead of the second scheduler pass.
9479
9480 -fsel-sched-pipelining
9481 Enable software pipelining of innermost loops during selective
9482 scheduling. This option has no effect unless one of
9483 -fselective-scheduling or -fselective-scheduling2 is turned on.
9484
9485 -fsel-sched-pipelining-outer-loops
9486 When pipelining loops during selective scheduling, also pipeline
9487 outer loops. This option has no effect unless
9488 -fsel-sched-pipelining is turned on.
9489
9490 -fsemantic-interposition
9491 Some object formats, like ELF, allow interposing of symbols by the
9492 dynamic linker. This means that for symbols exported from the DSO,
9493 the compiler cannot perform interprocedural propagation, inlining
9494 and other optimizations in anticipation that the function or
9495 variable in question may change. While this feature is useful, for
9496 example, to rewrite memory allocation functions by a debugging
9497 implementation, it is expensive in the terms of code quality. With
9498 -fno-semantic-interposition the compiler assumes that if
9499 interposition happens for functions the overwriting function will
9500 have precisely the same semantics (and side effects). Similarly if
9501 interposition happens for variables, the constructor of the
9502 variable will be the same. The flag has no effect for functions
9503 explicitly declared inline (where it is never allowed for
9504 interposition to change semantics) and for symbols explicitly
9505 declared weak.
9506
9507 -fshrink-wrap
9508 Emit function prologues only before parts of the function that need
9509 it, rather than at the top of the function. This flag is enabled
9510 by default at -O and higher.
9511
9512 -fshrink-wrap-separate
9513 Shrink-wrap separate parts of the prologue and epilogue separately,
9514 so that those parts are only executed when needed. This option is
9515 on by default, but has no effect unless -fshrink-wrap is also
9516 turned on and the target supports this.
9517
9518 -fcaller-saves
9519 Enable allocation of values to registers that are clobbered by
9520 function calls, by emitting extra instructions to save and restore
9521 the registers around such calls. Such allocation is done only when
9522 it seems to result in better code.
9523
9524 This option is always enabled by default on certain machines,
9525 usually those which have no call-preserved registers to use
9526 instead.
9527
9528 Enabled at levels -O2, -O3, -Os.
9529
9530 -fcombine-stack-adjustments
9531 Tracks stack adjustments (pushes and pops) and stack memory
9532 references and then tries to find ways to combine them.
9533
9534 Enabled by default at -O1 and higher.
9535
9536 -fipa-ra
9537 Use caller save registers for allocation if those registers are not
9538 used by any called function. In that case it is not necessary to
9539 save and restore them around calls. This is only possible if
9540 called functions are part of same compilation unit as current
9541 function and they are compiled before it.
9542
9543 Enabled at levels -O2, -O3, -Os, however the option is disabled if
9544 generated code will be instrumented for profiling (-p, or -pg) or
9545 if callee's register usage cannot be known exactly (this happens on
9546 targets that do not expose prologues and epilogues in RTL).
9547
9548 -fconserve-stack
9549 Attempt to minimize stack usage. The compiler attempts to use less
9550 stack space, even if that makes the program slower. This option
9551 implies setting the large-stack-frame parameter to 100 and the
9552 large-stack-frame-growth parameter to 400.
9553
9554 -ftree-reassoc
9555 Perform reassociation on trees. This flag is enabled by default at
9556 -O1 and higher.
9557
9558 -fcode-hoisting
9559 Perform code hoisting. Code hoisting tries to move the evaluation
9560 of expressions executed on all paths to the function exit as early
9561 as possible. This is especially useful as a code size
9562 optimization, but it often helps for code speed as well. This flag
9563 is enabled by default at -O2 and higher.
9564
9565 -ftree-pre
9566 Perform partial redundancy elimination (PRE) on trees. This flag
9567 is enabled by default at -O2 and -O3.
9568
9569 -ftree-partial-pre
9570 Make partial redundancy elimination (PRE) more aggressive. This
9571 flag is enabled by default at -O3.
9572
9573 -ftree-forwprop
9574 Perform forward propagation on trees. This flag is enabled by
9575 default at -O1 and higher.
9576
9577 -ftree-fre
9578 Perform full redundancy elimination (FRE) on trees. The difference
9579 between FRE and PRE is that FRE only considers expressions that are
9580 computed on all paths leading to the redundant computation. This
9581 analysis is faster than PRE, though it exposes fewer redundancies.
9582 This flag is enabled by default at -O1 and higher.
9583
9584 -ftree-phiprop
9585 Perform hoisting of loads from conditional pointers on trees. This
9586 pass is enabled by default at -O1 and higher.
9587
9588 -fhoist-adjacent-loads
9589 Speculatively hoist loads from both branches of an if-then-else if
9590 the loads are from adjacent locations in the same structure and the
9591 target architecture has a conditional move instruction. This flag
9592 is enabled by default at -O2 and higher.
9593
9594 -ftree-copy-prop
9595 Perform copy propagation on trees. This pass eliminates
9596 unnecessary copy operations. This flag is enabled by default at
9597 -O1 and higher.
9598
9599 -fipa-pure-const
9600 Discover which functions are pure or constant. Enabled by default
9601 at -O1 and higher.
9602
9603 -fipa-reference
9604 Discover which static variables do not escape the compilation unit.
9605 Enabled by default at -O1 and higher.
9606
9607 -fipa-reference-addressable
9608 Discover read-only, write-only and non-addressable static
9609 variables. Enabled by default at -O1 and higher.
9610
9611 -fipa-stack-alignment
9612 Reduce stack alignment on call sites if possible. Enabled by
9613 default.
9614
9615 -fipa-pta
9616 Perform interprocedural pointer analysis and interprocedural
9617 modification and reference analysis. This option can cause
9618 excessive memory and compile-time usage on large compilation units.
9619 It is not enabled by default at any optimization level.
9620
9621 -fipa-profile
9622 Perform interprocedural profile propagation. The functions called
9623 only from cold functions are marked as cold. Also functions
9624 executed once (such as "cold", "noreturn", static constructors or
9625 destructors) are identified. Cold functions and loop less parts of
9626 functions executed once are then optimized for size. Enabled by
9627 default at -O1 and higher.
9628
9629 -fipa-modref
9630 Perform interprocedural mod/ref analysis. This optimization
9631 analyzes the side effects of functions (memory locations that are
9632 modified or referenced) and enables better optimization across the
9633 function call boundary. This flag is enabled by default at -O1 and
9634 higher.
9635
9636 -fipa-cp
9637 Perform interprocedural constant propagation. This optimization
9638 analyzes the program to determine when values passed to functions
9639 are constants and then optimizes accordingly. This optimization
9640 can substantially increase performance if the application has
9641 constants passed to functions. This flag is enabled by default at
9642 -O2, -Os and -O3. It is also enabled by -fprofile-use and
9643 -fauto-profile.
9644
9645 -fipa-cp-clone
9646 Perform function cloning to make interprocedural constant
9647 propagation stronger. When enabled, interprocedural constant
9648 propagation performs function cloning when externally visible
9649 function can be called with constant arguments. Because this
9650 optimization can create multiple copies of functions, it may
9651 significantly increase code size (see --param
9652 ipa-cp-unit-growth=value). This flag is enabled by default at -O3.
9653 It is also enabled by -fprofile-use and -fauto-profile.
9654
9655 -fipa-bit-cp
9656 When enabled, perform interprocedural bitwise constant propagation.
9657 This flag is enabled by default at -O2 and by -fprofile-use and
9658 -fauto-profile. It requires that -fipa-cp is enabled.
9659
9660 -fipa-vrp
9661 When enabled, perform interprocedural propagation of value ranges.
9662 This flag is enabled by default at -O2. It requires that -fipa-cp
9663 is enabled.
9664
9665 -fipa-icf
9666 Perform Identical Code Folding for functions and read-only
9667 variables. The optimization reduces code size and may disturb
9668 unwind stacks by replacing a function by equivalent one with a
9669 different name. The optimization works more effectively with link-
9670 time optimization enabled.
9671
9672 Although the behavior is similar to the Gold Linker's ICF
9673 optimization, GCC ICF works on different levels and thus the
9674 optimizations are not same - there are equivalences that are found
9675 only by GCC and equivalences found only by Gold.
9676
9677 This flag is enabled by default at -O2 and -Os.
9678
9679 -flive-patching=level
9680 Control GCC's optimizations to produce output suitable for live-
9681 patching.
9682
9683 If the compiler's optimization uses a function's body or
9684 information extracted from its body to optimize/change another
9685 function, the latter is called an impacted function of the former.
9686 If a function is patched, its impacted functions should be patched
9687 too.
9688
9689 The impacted functions are determined by the compiler's
9690 interprocedural optimizations. For example, a caller is impacted
9691 when inlining a function into its caller, cloning a function and
9692 changing its caller to call this new clone, or extracting a
9693 function's pureness/constness information to optimize its direct or
9694 indirect callers, etc.
9695
9696 Usually, the more IPA optimizations enabled, the larger the number
9697 of impacted functions for each function. In order to control the
9698 number of impacted functions and more easily compute the list of
9699 impacted function, IPA optimizations can be partially enabled at
9700 two different levels.
9701
9702 The level argument should be one of the following:
9703
9704 inline-clone
9705 Only enable inlining and cloning optimizations, which includes
9706 inlining, cloning, interprocedural scalar replacement of
9707 aggregates and partial inlining. As a result, when patching a
9708 function, all its callers and its clones' callers are impacted,
9709 therefore need to be patched as well.
9710
9711 -flive-patching=inline-clone disables the following
9712 optimization flags: -fwhole-program -fipa-pta -fipa-reference
9713 -fipa-ra -fipa-icf -fipa-icf-functions -fipa-icf-variables
9714 -fipa-bit-cp -fipa-vrp -fipa-pure-const
9715 -fipa-reference-addressable -fipa-stack-alignment -fipa-modref
9716
9717 inline-only-static
9718 Only enable inlining of static functions. As a result, when
9719 patching a static function, all its callers are impacted and so
9720 need to be patched as well.
9721
9722 In addition to all the flags that -flive-patching=inline-clone
9723 disables, -flive-patching=inline-only-static disables the
9724 following additional optimization flags: -fipa-cp-clone
9725 -fipa-sra -fpartial-inlining -fipa-cp
9726
9727 When -flive-patching is specified without any value, the default
9728 value is inline-clone.
9729
9730 This flag is disabled by default.
9731
9732 Note that -flive-patching is not supported with link-time
9733 optimization (-flto).
9734
9735 -fisolate-erroneous-paths-dereference
9736 Detect paths that trigger erroneous or undefined behavior due to
9737 dereferencing a null pointer. Isolate those paths from the main
9738 control flow and turn the statement with erroneous or undefined
9739 behavior into a trap. This flag is enabled by default at -O2 and
9740 higher and depends on -fdelete-null-pointer-checks also being
9741 enabled.
9742
9743 -fisolate-erroneous-paths-attribute
9744 Detect paths that trigger erroneous or undefined behavior due to a
9745 null value being used in a way forbidden by a "returns_nonnull" or
9746 "nonnull" attribute. Isolate those paths from the main control
9747 flow and turn the statement with erroneous or undefined behavior
9748 into a trap. This is not currently enabled, but may be enabled by
9749 -O2 in the future.
9750
9751 -ftree-sink
9752 Perform forward store motion on trees. This flag is enabled by
9753 default at -O1 and higher.
9754
9755 -ftree-bit-ccp
9756 Perform sparse conditional bit constant propagation on trees and
9757 propagate pointer alignment information. This pass only operates
9758 on local scalar variables and is enabled by default at -O1 and
9759 higher, except for -Og. It requires that -ftree-ccp is enabled.
9760
9761 -ftree-ccp
9762 Perform sparse conditional constant propagation (CCP) on trees.
9763 This pass only operates on local scalar variables and is enabled by
9764 default at -O1 and higher.
9765
9766 -fssa-backprop
9767 Propagate information about uses of a value up the definition chain
9768 in order to simplify the definitions. For example, this pass
9769 strips sign operations if the sign of a value never matters. The
9770 flag is enabled by default at -O1 and higher.
9771
9772 -fssa-phiopt
9773 Perform pattern matching on SSA PHI nodes to optimize conditional
9774 code. This pass is enabled by default at -O1 and higher, except
9775 for -Og.
9776
9777 -ftree-switch-conversion
9778 Perform conversion of simple initializations in a switch to
9779 initializations from a scalar array. This flag is enabled by
9780 default at -O2 and higher.
9781
9782 -ftree-tail-merge
9783 Look for identical code sequences. When found, replace one with a
9784 jump to the other. This optimization is known as tail merging or
9785 cross jumping. This flag is enabled by default at -O2 and higher.
9786 The compilation time in this pass can be limited using max-tail-
9787 merge-comparisons parameter and max-tail-merge-iterations
9788 parameter.
9789
9790 -ftree-dce
9791 Perform dead code elimination (DCE) on trees. This flag is enabled
9792 by default at -O1 and higher.
9793
9794 -ftree-builtin-call-dce
9795 Perform conditional dead code elimination (DCE) for calls to built-
9796 in functions that may set "errno" but are otherwise free of side
9797 effects. This flag is enabled by default at -O2 and higher if -Os
9798 is not also specified.
9799
9800 -ffinite-loops
9801 Assume that a loop with an exit will eventually take the exit and
9802 not loop indefinitely. This allows the compiler to remove loops
9803 that otherwise have no side-effects, not considering eventual
9804 endless looping as such.
9805
9806 This option is enabled by default at -O2 for C++ with -std=c++11 or
9807 higher.
9808
9809 -ftree-dominator-opts
9810 Perform a variety of simple scalar cleanups (constant/copy
9811 propagation, redundancy elimination, range propagation and
9812 expression simplification) based on a dominator tree traversal.
9813 This also performs jump threading (to reduce jumps to jumps). This
9814 flag is enabled by default at -O1 and higher.
9815
9816 -ftree-dse
9817 Perform dead store elimination (DSE) on trees. A dead store is a
9818 store into a memory location that is later overwritten by another
9819 store without any intervening loads. In this case the earlier
9820 store can be deleted. This flag is enabled by default at -O1 and
9821 higher.
9822
9823 -ftree-ch
9824 Perform loop header copying on trees. This is beneficial since it
9825 increases effectiveness of code motion optimizations. It also
9826 saves one jump. This flag is enabled by default at -O1 and higher.
9827 It is not enabled for -Os, since it usually increases code size.
9828
9829 -ftree-loop-optimize
9830 Perform loop optimizations on trees. This flag is enabled by
9831 default at -O1 and higher.
9832
9833 -ftree-loop-linear
9834 -floop-strip-mine
9835 -floop-block
9836 Perform loop nest optimizations. Same as -floop-nest-optimize. To
9837 use this code transformation, GCC has to be configured with
9838 --with-isl to enable the Graphite loop transformation
9839 infrastructure.
9840
9841 -fgraphite-identity
9842 Enable the identity transformation for graphite. For every SCoP we
9843 generate the polyhedral representation and transform it back to
9844 gimple. Using -fgraphite-identity we can check the costs or
9845 benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation. Some
9846 minimal optimizations are also performed by the code generator isl,
9847 like index splitting and dead code elimination in loops.
9848
9849 -floop-nest-optimize
9850 Enable the isl based loop nest optimizer. This is a generic loop
9851 nest optimizer based on the Pluto optimization algorithms. It
9852 calculates a loop structure optimized for data-locality and
9853 parallelism. This option is experimental.
9854
9855 -floop-parallelize-all
9856 Use the Graphite data dependence analysis to identify loops that
9857 can be parallelized. Parallelize all the loops that can be
9858 analyzed to not contain loop carried dependences without checking
9859 that it is profitable to parallelize the loops.
9860
9861 -ftree-coalesce-vars
9862 While transforming the program out of the SSA representation,
9863 attempt to reduce copying by coalescing versions of different user-
9864 defined variables, instead of just compiler temporaries. This may
9865 severely limit the ability to debug an optimized program compiled
9866 with -fno-var-tracking-assignments. In the negated form, this flag
9867 prevents SSA coalescing of user variables. This option is enabled
9868 by default if optimization is enabled, and it does very little
9869 otherwise.
9870
9871 -ftree-loop-if-convert
9872 Attempt to transform conditional jumps in the innermost loops to
9873 branch-less equivalents. The intent is to remove control-flow from
9874 the innermost loops in order to improve the ability of the
9875 vectorization pass to handle these loops. This is enabled by
9876 default if vectorization is enabled.
9877
9878 -ftree-loop-distribution
9879 Perform loop distribution. This flag can improve cache performance
9880 on big loop bodies and allow further loop optimizations, like
9881 parallelization or vectorization, to take place. For example, the
9882 loop
9883
9884 DO I = 1, N
9885 A(I) = B(I) + C
9886 D(I) = E(I) * F
9887 ENDDO
9888
9889 is transformed to
9890
9891 DO I = 1, N
9892 A(I) = B(I) + C
9893 ENDDO
9894 DO I = 1, N
9895 D(I) = E(I) * F
9896 ENDDO
9897
9898 This flag is enabled by default at -O3. It is also enabled by
9899 -fprofile-use and -fauto-profile.
9900
9901 -ftree-loop-distribute-patterns
9902 Perform loop distribution of patterns that can be code generated
9903 with calls to a library. This flag is enabled by default at -O2
9904 and higher, and by -fprofile-use and -fauto-profile.
9905
9906 This pass distributes the initialization loops and generates a call
9907 to memset zero. For example, the loop
9908
9909 DO I = 1, N
9910 A(I) = 0
9911 B(I) = A(I) + I
9912 ENDDO
9913
9914 is transformed to
9915
9916 DO I = 1, N
9917 A(I) = 0
9918 ENDDO
9919 DO I = 1, N
9920 B(I) = A(I) + I
9921 ENDDO
9922
9923 and the initialization loop is transformed into a call to memset
9924 zero. This flag is enabled by default at -O3. It is also enabled
9925 by -fprofile-use and -fauto-profile.
9926
9927 -floop-interchange
9928 Perform loop interchange outside of graphite. This flag can
9929 improve cache performance on loop nest and allow further loop
9930 optimizations, like vectorization, to take place. For example, the
9931 loop
9932
9933 for (int i = 0; i < N; i++)
9934 for (int j = 0; j < N; j++)
9935 for (int k = 0; k < N; k++)
9936 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9937
9938 is transformed to
9939
9940 for (int i = 0; i < N; i++)
9941 for (int k = 0; k < N; k++)
9942 for (int j = 0; j < N; j++)
9943 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9944
9945 This flag is enabled by default at -O3. It is also enabled by
9946 -fprofile-use and -fauto-profile.
9947
9948 -floop-unroll-and-jam
9949 Apply unroll and jam transformations on feasible loops. In a loop
9950 nest this unrolls the outer loop by some factor and fuses the
9951 resulting multiple inner loops. This flag is enabled by default at
9952 -O3. It is also enabled by -fprofile-use and -fauto-profile.
9953
9954 -ftree-loop-im
9955 Perform loop invariant motion on trees. This pass moves only
9956 invariants that are hard to handle at RTL level (function calls,
9957 operations that expand to nontrivial sequences of insns). With
9958 -funswitch-loops it also moves operands of conditions that are
9959 invariant out of the loop, so that we can use just trivial
9960 invariantness analysis in loop unswitching. The pass also includes
9961 store motion.
9962
9963 -ftree-loop-ivcanon
9964 Create a canonical counter for number of iterations in loops for
9965 which determining number of iterations requires complicated
9966 analysis. Later optimizations then may determine the number
9967 easily. Useful especially in connection with unrolling.
9968
9969 -ftree-scev-cprop
9970 Perform final value replacement. If a variable is modified in a
9971 loop in such a way that its value when exiting the loop can be
9972 determined using only its initial value and the number of loop
9973 iterations, replace uses of the final value by such a computation,
9974 provided it is sufficiently cheap. This reduces data dependencies
9975 and may allow further simplifications. Enabled by default at -O1
9976 and higher.
9977
9978 -fivopts
9979 Perform induction variable optimizations (strength reduction,
9980 induction variable merging and induction variable elimination) on
9981 trees.
9982
9983 -ftree-parallelize-loops=n
9984 Parallelize loops, i.e., split their iteration space to run in n
9985 threads. This is only possible for loops whose iterations are
9986 independent and can be arbitrarily reordered. The optimization is
9987 only profitable on multiprocessor machines, for loops that are CPU-
9988 intensive, rather than constrained e.g. by memory bandwidth. This
9989 option implies -pthread, and thus is only supported on targets that
9990 have support for -pthread.
9991
9992 -ftree-pta
9993 Perform function-local points-to analysis on trees. This flag is
9994 enabled by default at -O1 and higher, except for -Og.
9995
9996 -ftree-sra
9997 Perform scalar replacement of aggregates. This pass replaces
9998 structure references with scalars to prevent committing structures
9999 to memory too early. This flag is enabled by default at -O1 and
10000 higher, except for -Og.
10001
10002 -fstore-merging
10003 Perform merging of narrow stores to consecutive memory addresses.
10004 This pass merges contiguous stores of immediate values narrower
10005 than a word into fewer wider stores to reduce the number of
10006 instructions. This is enabled by default at -O2 and higher as well
10007 as -Os.
10008
10009 -ftree-ter
10010 Perform temporary expression replacement during the SSA->normal
10011 phase. Single use/single def temporaries are replaced at their use
10012 location with their defining expression. This results in non-
10013 GIMPLE code, but gives the expanders much more complex trees to
10014 work on resulting in better RTL generation. This is enabled by
10015 default at -O1 and higher.
10016
10017 -ftree-slsr
10018 Perform straight-line strength reduction on trees. This recognizes
10019 related expressions involving multiplications and replaces them by
10020 less expensive calculations when possible. This is enabled by
10021 default at -O1 and higher.
10022
10023 -ftree-vectorize
10024 Perform vectorization on trees. This flag enables
10025 -ftree-loop-vectorize and -ftree-slp-vectorize if not explicitly
10026 specified.
10027
10028 -ftree-loop-vectorize
10029 Perform loop vectorization on trees. This flag is enabled by
10030 default at -O2 and by -ftree-vectorize, -fprofile-use, and
10031 -fauto-profile.
10032
10033 -ftree-slp-vectorize
10034 Perform basic block vectorization on trees. This flag is enabled by
10035 default at -O2 and by -ftree-vectorize, -fprofile-use, and
10036 -fauto-profile.
10037
10038 -ftrivial-auto-var-init=choice
10039 Initialize automatic variables with either a pattern or with zeroes
10040 to increase the security and predictability of a program by
10041 preventing uninitialized memory disclosure and use. GCC still
10042 considers an automatic variable that doesn't have an explicit
10043 initializer as uninitialized, -Wuninitialized and
10044 -Wanalyzer-use-of-uninitialized-value will still report warning
10045 messages on such automatic variables. With this option, GCC will
10046 also initialize any padding of automatic variables that have
10047 structure or union types to zeroes. However, the current
10048 implementation cannot initialize automatic variables that are
10049 declared between the controlling expression and the first case of a
10050 "switch" statement. Using -Wtrivial-auto-var-init to report all
10051 such cases.
10052
10053 The three values of choice are:
10054
10055 * uninitialized doesn't initialize any automatic variables. This
10056 is C and C++'s default.
10057
10058 * pattern Initialize automatic variables with values which will
10059 likely transform logic bugs into crashes down the line, are
10060 easily recognized in a crash dump and without being values that
10061 programmers can rely on for useful program semantics. The
10062 current value is byte-repeatable pattern with byte "0xFE". The
10063 values used for pattern initialization might be changed in the
10064 future.
10065
10066 * zero Initialize automatic variables with zeroes.
10067
10068 The default is uninitialized.
10069
10070 You can control this behavior for a specific variable by using the
10071 variable attribute "uninitialized".
10072
10073 -fvect-cost-model=model
10074 Alter the cost model used for vectorization. The model argument
10075 should be one of unlimited, dynamic, cheap or very-cheap. With the
10076 unlimited model the vectorized code-path is assumed to be
10077 profitable while with the dynamic model a runtime check guards the
10078 vectorized code-path to enable it only for iteration counts that
10079 will likely execute faster than when executing the original scalar
10080 loop. The cheap model disables vectorization of loops where doing
10081 so would be cost prohibitive for example due to required runtime
10082 checks for data dependence or alignment but otherwise is equal to
10083 the dynamic model. The very-cheap model only allows vectorization
10084 if the vector code would entirely replace the scalar code that is
10085 being vectorized. For example, if each iteration of a vectorized
10086 loop would only be able to handle exactly four iterations of the
10087 scalar loop, the very-cheap model would only allow vectorization if
10088 the scalar iteration count is known to be a multiple of four.
10089
10090 The default cost model depends on other optimization flags and is
10091 either dynamic or cheap.
10092
10093 -fsimd-cost-model=model
10094 Alter the cost model used for vectorization of loops marked with
10095 the OpenMP simd directive. The model argument should be one of
10096 unlimited, dynamic, cheap. All values of model have the same
10097 meaning as described in -fvect-cost-model and by default a cost
10098 model defined with -fvect-cost-model is used.
10099
10100 -ftree-vrp
10101 Perform Value Range Propagation on trees. This is similar to the
10102 constant propagation pass, but instead of values, ranges of values
10103 are propagated. This allows the optimizers to remove unnecessary
10104 range checks like array bound checks and null pointer checks. This
10105 is enabled by default at -O2 and higher. Null pointer check
10106 elimination is only done if -fdelete-null-pointer-checks is
10107 enabled.
10108
10109 -fsplit-paths
10110 Split paths leading to loop backedges. This can improve dead code
10111 elimination and common subexpression elimination. This is enabled
10112 by default at -O3 and above.
10113
10114 -fsplit-ivs-in-unroller
10115 Enables expression of values of induction variables in later
10116 iterations of the unrolled loop using the value in the first
10117 iteration. This breaks long dependency chains, thus improving
10118 efficiency of the scheduling passes.
10119
10120 A combination of -fweb and CSE is often sufficient to obtain the
10121 same effect. However, that is not reliable in cases where the loop
10122 body is more complicated than a single basic block. It also does
10123 not work at all on some architectures due to restrictions in the
10124 CSE pass.
10125
10126 This optimization is enabled by default.
10127
10128 -fvariable-expansion-in-unroller
10129 With this option, the compiler creates multiple copies of some
10130 local variables when unrolling a loop, which can result in superior
10131 code.
10132
10133 This optimization is enabled by default for PowerPC targets, but
10134 disabled by default otherwise.
10135
10136 -fpartial-inlining
10137 Inline parts of functions. This option has any effect only when
10138 inlining itself is turned on by the -finline-functions or
10139 -finline-small-functions options.
10140
10141 Enabled at levels -O2, -O3, -Os.
10142
10143 -fpredictive-commoning
10144 Perform predictive commoning optimization, i.e., reusing
10145 computations (especially memory loads and stores) performed in
10146 previous iterations of loops.
10147
10148 This option is enabled at level -O3. It is also enabled by
10149 -fprofile-use and -fauto-profile.
10150
10151 -fprefetch-loop-arrays
10152 If supported by the target machine, generate instructions to
10153 prefetch memory to improve the performance of loops that access
10154 large arrays.
10155
10156 This option may generate better or worse code; results are highly
10157 dependent on the structure of loops within the source code.
10158
10159 Disabled at level -Os.
10160
10161 -fno-printf-return-value
10162 Do not substitute constants for known return value of formatted
10163 output functions such as "sprintf", "snprintf", "vsprintf", and
10164 "vsnprintf" (but not "printf" of "fprintf"). This transformation
10165 allows GCC to optimize or even eliminate branches based on the
10166 known return value of these functions called with arguments that
10167 are either constant, or whose values are known to be in a range
10168 that makes determining the exact return value possible. For
10169 example, when -fprintf-return-value is in effect, both the branch
10170 and the body of the "if" statement (but not the call to "snprint")
10171 can be optimized away when "i" is a 32-bit or smaller integer
10172 because the return value is guaranteed to be at most 8.
10173
10174 char buf[9];
10175 if (snprintf (buf, "%08x", i) >= sizeof buf)
10176 ...
10177
10178 The -fprintf-return-value option relies on other optimizations and
10179 yields best results with -O2 and above. It works in tandem with
10180 the -Wformat-overflow and -Wformat-truncation options. The
10181 -fprintf-return-value option is enabled by default.
10182
10183 -fno-peephole
10184 -fno-peephole2
10185 Disable any machine-specific peephole optimizations. The
10186 difference between -fno-peephole and -fno-peephole2 is in how they
10187 are implemented in the compiler; some targets use one, some use the
10188 other, a few use both.
10189
10190 -fpeephole is enabled by default. -fpeephole2 enabled at levels
10191 -O2, -O3, -Os.
10192
10193 -fno-guess-branch-probability
10194 Do not guess branch probabilities using heuristics.
10195
10196 GCC uses heuristics to guess branch probabilities if they are not
10197 provided by profiling feedback (-fprofile-arcs). These heuristics
10198 are based on the control flow graph. If some branch probabilities
10199 are specified by "__builtin_expect", then the heuristics are used
10200 to guess branch probabilities for the rest of the control flow
10201 graph, taking the "__builtin_expect" info into account. The
10202 interactions between the heuristics and "__builtin_expect" can be
10203 complex, and in some cases, it may be useful to disable the
10204 heuristics so that the effects of "__builtin_expect" are easier to
10205 understand.
10206
10207 It is also possible to specify expected probability of the
10208 expression with "__builtin_expect_with_probability" built-in
10209 function.
10210
10211 The default is -fguess-branch-probability at levels -O, -O2, -O3,
10212 -Os.
10213
10214 -freorder-blocks
10215 Reorder basic blocks in the compiled function in order to reduce
10216 number of taken branches and improve code locality.
10217
10218 Enabled at levels -O1, -O2, -O3, -Os.
10219
10220 -freorder-blocks-algorithm=algorithm
10221 Use the specified algorithm for basic block reordering. The
10222 algorithm argument can be simple, which does not increase code size
10223 (except sometimes due to secondary effects like alignment), or stc,
10224 the "software trace cache" algorithm, which tries to put all often
10225 executed code together, minimizing the number of branches executed
10226 by making extra copies of code.
10227
10228 The default is simple at levels -O1, -Os, and stc at levels -O2,
10229 -O3.
10230
10231 -freorder-blocks-and-partition
10232 In addition to reordering basic blocks in the compiled function, in
10233 order to reduce number of taken branches, partitions hot and cold
10234 basic blocks into separate sections of the assembly and .o files,
10235 to improve paging and cache locality performance.
10236
10237 This optimization is automatically turned off in the presence of
10238 exception handling or unwind tables (on targets using
10239 setjump/longjump or target specific scheme), for linkonce sections,
10240 for functions with a user-defined section attribute and on any
10241 architecture that does not support named sections. When
10242 -fsplit-stack is used this option is not enabled by default (to
10243 avoid linker errors), but may be enabled explicitly (if using a
10244 working linker).
10245
10246 Enabled for x86 at levels -O2, -O3, -Os.
10247
10248 -freorder-functions
10249 Reorder functions in the object file in order to improve code
10250 locality. This is implemented by using special subsections
10251 ".text.hot" for most frequently executed functions and
10252 ".text.unlikely" for unlikely executed functions. Reordering is
10253 done by the linker so object file format must support named
10254 sections and linker must place them in a reasonable way.
10255
10256 This option isn't effective unless you either provide profile
10257 feedback (see -fprofile-arcs for details) or manually annotate
10258 functions with "hot" or "cold" attributes.
10259
10260 Enabled at levels -O2, -O3, -Os.
10261
10262 -fstrict-aliasing
10263 Allow the compiler to assume the strictest aliasing rules
10264 applicable to the language being compiled. For C (and C++), this
10265 activates optimizations based on the type of expressions. In
10266 particular, an object of one type is assumed never to reside at the
10267 same address as an object of a different type, unless the types are
10268 almost the same. For example, an "unsigned int" can alias an
10269 "int", but not a "void*" or a "double". A character type may alias
10270 any other type.
10271
10272 Pay special attention to code like this:
10273
10274 union a_union {
10275 int i;
10276 double d;
10277 };
10278
10279 int f() {
10280 union a_union t;
10281 t.d = 3.0;
10282 return t.i;
10283 }
10284
10285 The practice of reading from a different union member than the one
10286 most recently written to (called "type-punning") is common. Even
10287 with -fstrict-aliasing, type-punning is allowed, provided the
10288 memory is accessed through the union type. So, the code above
10289 works as expected. However, this code might not:
10290
10291 int f() {
10292 union a_union t;
10293 int* ip;
10294 t.d = 3.0;
10295 ip = &t.i;
10296 return *ip;
10297 }
10298
10299 Similarly, access by taking the address, casting the resulting
10300 pointer and dereferencing the result has undefined behavior, even
10301 if the cast uses a union type, e.g.:
10302
10303 int f() {
10304 double d = 3.0;
10305 return ((union a_union *) &d)->i;
10306 }
10307
10308 The -fstrict-aliasing option is enabled at levels -O2, -O3, -Os.
10309
10310 -fipa-strict-aliasing
10311 Controls whether rules of -fstrict-aliasing are applied across
10312 function boundaries. Note that if multiple functions gets inlined
10313 into a single function the memory accesses are no longer considered
10314 to be crossing a function boundary.
10315
10316 The -fipa-strict-aliasing option is enabled by default and is
10317 effective only in combination with -fstrict-aliasing.
10318
10319 -falign-functions
10320 -falign-functions=n
10321 -falign-functions=n:m
10322 -falign-functions=n:m:n2
10323 -falign-functions=n:m:n2:m2
10324 Align the start of functions to the next power-of-two greater than
10325 or equal to n, skipping up to m-1 bytes. This ensures that at
10326 least the first m bytes of the function can be fetched by the CPU
10327 without crossing an n-byte alignment boundary.
10328
10329 If m is not specified, it defaults to n.
10330
10331 Examples: -falign-functions=32 aligns functions to the next 32-byte
10332 boundary, -falign-functions=24 aligns to the next 32-byte boundary
10333 only if this can be done by skipping 23 bytes or less,
10334 -falign-functions=32:7 aligns to the next 32-byte boundary only if
10335 this can be done by skipping 6 bytes or less.
10336
10337 The second pair of n2:m2 values allows you to specify a secondary
10338 alignment: -falign-functions=64:7:32:3 aligns to the next 64-byte
10339 boundary if this can be done by skipping 6 bytes or less, otherwise
10340 aligns to the next 32-byte boundary if this can be done by skipping
10341 2 bytes or less. If m2 is not specified, it defaults to n2.
10342
10343 Some assemblers only support this flag when n is a power of two; in
10344 that case, it is rounded up.
10345
10346 -fno-align-functions and -falign-functions=1 are equivalent and
10347 mean that functions are not aligned.
10348
10349 If n is not specified or is zero, use a machine-dependent default.
10350 The maximum allowed n option value is 65536.
10351
10352 Enabled at levels -O2, -O3.
10353
10354 -flimit-function-alignment
10355 If this option is enabled, the compiler tries to avoid
10356 unnecessarily overaligning functions. It attempts to instruct the
10357 assembler to align by the amount specified by -falign-functions,
10358 but not to skip more bytes than the size of the function.
10359
10360 -falign-labels
10361 -falign-labels=n
10362 -falign-labels=n:m
10363 -falign-labels=n:m:n2
10364 -falign-labels=n:m:n2:m2
10365 Align all branch targets to a power-of-two boundary.
10366
10367 Parameters of this option are analogous to the -falign-functions
10368 option. -fno-align-labels and -falign-labels=1 are equivalent and
10369 mean that labels are not aligned.
10370
10371 If -falign-loops or -falign-jumps are applicable and are greater
10372 than this value, then their values are used instead.
10373
10374 If n is not specified or is zero, use a machine-dependent default
10375 which is very likely to be 1, meaning no alignment. The maximum
10376 allowed n option value is 65536.
10377
10378 Enabled at levels -O2, -O3.
10379
10380 -falign-loops
10381 -falign-loops=n
10382 -falign-loops=n:m
10383 -falign-loops=n:m:n2
10384 -falign-loops=n:m:n2:m2
10385 Align loops to a power-of-two boundary. If the loops are executed
10386 many times, this makes up for any execution of the dummy padding
10387 instructions.
10388
10389 If -falign-labels is greater than this value, then its value is
10390 used instead.
10391
10392 Parameters of this option are analogous to the -falign-functions
10393 option. -fno-align-loops and -falign-loops=1 are equivalent and
10394 mean that loops are not aligned. The maximum allowed n option
10395 value is 65536.
10396
10397 If n is not specified or is zero, use a machine-dependent default.
10398
10399 Enabled at levels -O2, -O3.
10400
10401 -falign-jumps
10402 -falign-jumps=n
10403 -falign-jumps=n:m
10404 -falign-jumps=n:m:n2
10405 -falign-jumps=n:m:n2:m2
10406 Align branch targets to a power-of-two boundary, for branch targets
10407 where the targets can only be reached by jumping. In this case, no
10408 dummy operations need be executed.
10409
10410 If -falign-labels is greater than this value, then its value is
10411 used instead.
10412
10413 Parameters of this option are analogous to the -falign-functions
10414 option. -fno-align-jumps and -falign-jumps=1 are equivalent and
10415 mean that loops are not aligned.
10416
10417 If n is not specified or is zero, use a machine-dependent default.
10418 The maximum allowed n option value is 65536.
10419
10420 Enabled at levels -O2, -O3.
10421
10422 -fno-allocation-dce
10423 Do not remove unused C++ allocations in dead code elimination.
10424
10425 -fallow-store-data-races
10426 Allow the compiler to perform optimizations that may introduce new
10427 data races on stores, without proving that the variable cannot be
10428 concurrently accessed by other threads. Does not affect
10429 optimization of local data. It is safe to use this option if it is
10430 known that global data will not be accessed by multiple threads.
10431
10432 Examples of optimizations enabled by -fallow-store-data-races
10433 include hoisting or if-conversions that may cause a value that was
10434 already in memory to be re-written with that same value. Such re-
10435 writing is safe in a single threaded context but may be unsafe in a
10436 multi-threaded context. Note that on some processors, if-
10437 conversions may be required in order to enable vectorization.
10438
10439 Enabled at level -Ofast.
10440
10441 -funit-at-a-time
10442 This option is left for compatibility reasons. -funit-at-a-time has
10443 no effect, while -fno-unit-at-a-time implies -fno-toplevel-reorder
10444 and -fno-section-anchors.
10445
10446 Enabled by default.
10447
10448 -fno-toplevel-reorder
10449 Do not reorder top-level functions, variables, and "asm"
10450 statements. Output them in the same order that they appear in the
10451 input file. When this option is used, unreferenced static
10452 variables are not removed. This option is intended to support
10453 existing code that relies on a particular ordering. For new code,
10454 it is better to use attributes when possible.
10455
10456 -ftoplevel-reorder is the default at -O1 and higher, and also at
10457 -O0 if -fsection-anchors is explicitly requested. Additionally
10458 -fno-toplevel-reorder implies -fno-section-anchors.
10459
10460 -fweb
10461 Constructs webs as commonly used for register allocation purposes
10462 and assign each web individual pseudo register. This allows the
10463 register allocation pass to operate on pseudos directly, but also
10464 strengthens several other optimization passes, such as CSE, loop
10465 optimizer and trivial dead code remover. It can, however, make
10466 debugging impossible, since variables no longer stay in a "home
10467 register".
10468
10469 Enabled by default with -funroll-loops.
10470
10471 -fwhole-program
10472 Assume that the current compilation unit represents the whole
10473 program being compiled. All public functions and variables with
10474 the exception of "main" and those merged by attribute
10475 "externally_visible" become static functions and in effect are
10476 optimized more aggressively by interprocedural optimizers.
10477
10478 This option should not be used in combination with -flto. Instead
10479 relying on a linker plugin should provide safer and more precise
10480 information.
10481
10482 -flto[=n]
10483 This option runs the standard link-time optimizer. When invoked
10484 with source code, it generates GIMPLE (one of GCC's internal
10485 representations) and writes it to special ELF sections in the
10486 object file. When the object files are linked together, all the
10487 function bodies are read from these ELF sections and instantiated
10488 as if they had been part of the same translation unit.
10489
10490 To use the link-time optimizer, -flto and optimization options
10491 should be specified at compile time and during the final link. It
10492 is recommended that you compile all the files participating in the
10493 same link with the same options and also specify those options at
10494 link time. For example:
10495
10496 gcc -c -O2 -flto foo.c
10497 gcc -c -O2 -flto bar.c
10498 gcc -o myprog -flto -O2 foo.o bar.o
10499
10500 The first two invocations to GCC save a bytecode representation of
10501 GIMPLE into special ELF sections inside foo.o and bar.o. The final
10502 invocation reads the GIMPLE bytecode from foo.o and bar.o, merges
10503 the two files into a single internal image, and compiles the result
10504 as usual. Since both foo.o and bar.o are merged into a single
10505 image, this causes all the interprocedural analyses and
10506 optimizations in GCC to work across the two files as if they were a
10507 single one. This means, for example, that the inliner is able to
10508 inline functions in bar.o into functions in foo.o and vice-versa.
10509
10510 Another (simpler) way to enable link-time optimization is:
10511
10512 gcc -o myprog -flto -O2 foo.c bar.c
10513
10514 The above generates bytecode for foo.c and bar.c, merges them
10515 together into a single GIMPLE representation and optimizes them as
10516 usual to produce myprog.
10517
10518 The important thing to keep in mind is that to enable link-time
10519 optimizations you need to use the GCC driver to perform the link
10520 step. GCC automatically performs link-time optimization if any of
10521 the objects involved were compiled with the -flto command-line
10522 option. You can always override the automatic decision to do link-
10523 time optimization by passing -fno-lto to the link command.
10524
10525 To make whole program optimization effective, it is necessary to
10526 make certain whole program assumptions. The compiler needs to know
10527 what functions and variables can be accessed by libraries and
10528 runtime outside of the link-time optimized unit. When supported by
10529 the linker, the linker plugin (see -fuse-linker-plugin) passes
10530 information to the compiler about used and externally visible
10531 symbols. When the linker plugin is not available, -fwhole-program
10532 should be used to allow the compiler to make these assumptions,
10533 which leads to more aggressive optimization decisions.
10534
10535 When a file is compiled with -flto without -fuse-linker-plugin, the
10536 generated object file is larger than a regular object file because
10537 it contains GIMPLE bytecodes and the usual final code (see
10538 -ffat-lto-objects). This means that object files with LTO
10539 information can be linked as normal object files; if -fno-lto is
10540 passed to the linker, no interprocedural optimizations are applied.
10541 Note that when -fno-fat-lto-objects is enabled the compile stage is
10542 faster but you cannot perform a regular, non-LTO link on them.
10543
10544 When producing the final binary, GCC only applies link-time
10545 optimizations to those files that contain bytecode. Therefore, you
10546 can mix and match object files and libraries with GIMPLE bytecodes
10547 and final object code. GCC automatically selects which files to
10548 optimize in LTO mode and which files to link without further
10549 processing.
10550
10551 Generally, options specified at link time override those specified
10552 at compile time, although in some cases GCC attempts to infer link-
10553 time options from the settings used to compile the input files.
10554
10555 If you do not specify an optimization level option -O at link time,
10556 then GCC uses the highest optimization level used when compiling
10557 the object files. Note that it is generally ineffective to specify
10558 an optimization level option only at link time and not at compile
10559 time, for two reasons. First, compiling without optimization
10560 suppresses compiler passes that gather information needed for
10561 effective optimization at link time. Second, some early
10562 optimization passes can be performed only at compile time and not
10563 at link time.
10564
10565 There are some code generation flags preserved by GCC when
10566 generating bytecodes, as they need to be used during the final
10567 link. Currently, the following options and their settings are
10568 taken from the first object file that explicitly specifies them:
10569 -fcommon, -fexceptions, -fnon-call-exceptions, -fgnu-tm and all the
10570 -m target flags.
10571
10572 The following options -fPIC, -fpic, -fpie and -fPIE are combined
10573 based on the following scheme:
10574
10575 B<-fPIC> + B<-fpic> = B<-fpic>
10576 B<-fPIC> + B<-fno-pic> = B<-fno-pic>
10577 B<-fpic/-fPIC> + (no option) = (no option)
10578 B<-fPIC> + B<-fPIE> = B<-fPIE>
10579 B<-fpic> + B<-fPIE> = B<-fpie>
10580 B<-fPIC/-fpic> + B<-fpie> = B<-fpie>
10581
10582 Certain ABI-changing flags are required to match in all compilation
10583 units, and trying to override this at link time with a conflicting
10584 value is ignored. This includes options such as
10585 -freg-struct-return and -fpcc-struct-return.
10586
10587 Other options such as -ffp-contract, -fno-strict-overflow, -fwrapv,
10588 -fno-trapv or -fno-strict-aliasing are passed through to the link
10589 stage and merged conservatively for conflicting translation units.
10590 Specifically -fno-strict-overflow, -fwrapv and -fno-trapv take
10591 precedence; and for example -ffp-contract=off takes precedence over
10592 -ffp-contract=fast. You can override them at link time.
10593
10594 Diagnostic options such as -Wstringop-overflow are passed through
10595 to the link stage and their setting matches that of the compile-
10596 step at function granularity. Note that this matters only for
10597 diagnostics emitted during optimization. Note that code transforms
10598 such as inlining can lead to warnings being enabled or disabled for
10599 regions if code not consistent with the setting at compile time.
10600
10601 When you need to pass options to the assembler via -Wa or
10602 -Xassembler make sure to either compile such translation units with
10603 -fno-lto or consistently use the same assembler options on all
10604 translation units. You can alternatively also specify assembler
10605 options at LTO link time.
10606
10607 To enable debug info generation you need to supply -g at compile
10608 time. If any of the input files at link time were built with debug
10609 info generation enabled the link will enable debug info generation
10610 as well. Any elaborate debug info settings like the dwarf level
10611 -gdwarf-5 need to be explicitly repeated at the linker command line
10612 and mixing different settings in different translation units is
10613 discouraged.
10614
10615 If LTO encounters objects with C linkage declared with incompatible
10616 types in separate translation units to be linked together
10617 (undefined behavior according to ISO C99 6.2.7), a non-fatal
10618 diagnostic may be issued. The behavior is still undefined at run
10619 time. Similar diagnostics may be raised for other languages.
10620
10621 Another feature of LTO is that it is possible to apply
10622 interprocedural optimizations on files written in different
10623 languages:
10624
10625 gcc -c -flto foo.c
10626 g++ -c -flto bar.cc
10627 gfortran -c -flto baz.f90
10628 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10629
10630 Notice that the final link is done with g++ to get the C++ runtime
10631 libraries and -lgfortran is added to get the Fortran runtime
10632 libraries. In general, when mixing languages in LTO mode, you
10633 should use the same link command options as when mixing languages
10634 in a regular (non-LTO) compilation.
10635
10636 If object files containing GIMPLE bytecode are stored in a library
10637 archive, say libfoo.a, it is possible to extract and use them in an
10638 LTO link if you are using a linker with plugin support. To create
10639 static libraries suitable for LTO, use gcc-ar and gcc-ranlib
10640 instead of ar and ranlib; to show the symbols of object files with
10641 GIMPLE bytecode, use gcc-nm. Those commands require that ar,
10642 ranlib and nm have been compiled with plugin support. At link
10643 time, use the flag -fuse-linker-plugin to ensure that the library
10644 participates in the LTO optimization process:
10645
10646 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10647
10648 With the linker plugin enabled, the linker extracts the needed
10649 GIMPLE files from libfoo.a and passes them on to the running GCC to
10650 make them part of the aggregated GIMPLE image to be optimized.
10651
10652 If you are not using a linker with plugin support and/or do not
10653 enable the linker plugin, then the objects inside libfoo.a are
10654 extracted and linked as usual, but they do not participate in the
10655 LTO optimization process. In order to make a static library
10656 suitable for both LTO optimization and usual linkage, compile its
10657 object files with -flto -ffat-lto-objects.
10658
10659 Link-time optimizations do not require the presence of the whole
10660 program to operate. If the program does not require any symbols to
10661 be exported, it is possible to combine -flto and -fwhole-program to
10662 allow the interprocedural optimizers to use more aggressive
10663 assumptions which may lead to improved optimization opportunities.
10664 Use of -fwhole-program is not needed when linker plugin is active
10665 (see -fuse-linker-plugin).
10666
10667 The current implementation of LTO makes no attempt to generate
10668 bytecode that is portable between different types of hosts. The
10669 bytecode files are versioned and there is a strict version check,
10670 so bytecode files generated in one version of GCC do not work with
10671 an older or newer version of GCC.
10672
10673 Link-time optimization does not work well with generation of
10674 debugging information on systems other than those using a
10675 combination of ELF and DWARF.
10676
10677 If you specify the optional n, the optimization and code generation
10678 done at link time is executed in parallel using n parallel jobs by
10679 utilizing an installed make program. The environment variable MAKE
10680 may be used to override the program used.
10681
10682 You can also specify -flto=jobserver to use GNU make's job server
10683 mode to determine the number of parallel jobs. This is useful when
10684 the Makefile calling GCC is already executing in parallel. You
10685 must prepend a + to the command recipe in the parent Makefile for
10686 this to work. This option likely only works if MAKE is GNU make.
10687 Even without the option value, GCC tries to automatically detect a
10688 running GNU make's job server.
10689
10690 Use -flto=auto to use GNU make's job server, if available, or
10691 otherwise fall back to autodetection of the number of CPU threads
10692 present in your system.
10693
10694 -flto-partition=alg
10695 Specify the partitioning algorithm used by the link-time optimizer.
10696 The value is either 1to1 to specify a partitioning mirroring the
10697 original source files or balanced to specify partitioning into
10698 equally sized chunks (whenever possible) or max to create new
10699 partition for every symbol where possible. Specifying none as an
10700 algorithm disables partitioning and streaming completely. The
10701 default value is balanced. While 1to1 can be used as an workaround
10702 for various code ordering issues, the max partitioning is intended
10703 for internal testing only. The value one specifies that exactly
10704 one partition should be used while the value none bypasses
10705 partitioning and executes the link-time optimization step directly
10706 from the WPA phase.
10707
10708 -flto-compression-level=n
10709 This option specifies the level of compression used for
10710 intermediate language written to LTO object files, and is only
10711 meaningful in conjunction with LTO mode (-flto). GCC currently
10712 supports two LTO compression algorithms. For zstd, valid values are
10713 0 (no compression) to 19 (maximum compression), while zlib supports
10714 values from 0 to 9. Values outside this range are clamped to
10715 either minimum or maximum of the supported values. If the option
10716 is not given, a default balanced compression setting is used.
10717
10718 -fuse-linker-plugin
10719 Enables the use of a linker plugin during link-time optimization.
10720 This option relies on plugin support in the linker, which is
10721 available in gold or in GNU ld 2.21 or newer.
10722
10723 This option enables the extraction of object files with GIMPLE
10724 bytecode out of library archives. This improves the quality of
10725 optimization by exposing more code to the link-time optimizer.
10726 This information specifies what symbols can be accessed externally
10727 (by non-LTO object or during dynamic linking). Resulting code
10728 quality improvements on binaries (and shared libraries that use
10729 hidden visibility) are similar to -fwhole-program. See -flto for a
10730 description of the effect of this flag and how to use it.
10731
10732 This option is enabled by default when LTO support in GCC is
10733 enabled and GCC was configured for use with a linker supporting
10734 plugins (GNU ld 2.21 or newer or gold).
10735
10736 -ffat-lto-objects
10737 Fat LTO objects are object files that contain both the intermediate
10738 language and the object code. This makes them usable for both LTO
10739 linking and normal linking. This option is effective only when
10740 compiling with -flto and is ignored at link time.
10741
10742 -fno-fat-lto-objects improves compilation time over plain LTO, but
10743 requires the complete toolchain to be aware of LTO. It requires a
10744 linker with linker plugin support for basic functionality.
10745 Additionally, nm, ar and ranlib need to support linker plugins to
10746 allow a full-featured build environment (capable of building static
10747 libraries etc). GCC provides the gcc-ar, gcc-nm, gcc-ranlib
10748 wrappers to pass the right options to these tools. With non fat LTO
10749 makefiles need to be modified to use them.
10750
10751 Note that modern binutils provide plugin auto-load mechanism.
10752 Installing the linker plugin into $libdir/bfd-plugins has the same
10753 effect as usage of the command wrappers (gcc-ar, gcc-nm and gcc-
10754 ranlib).
10755
10756 The default is -fno-fat-lto-objects on targets with linker plugin
10757 support.
10758
10759 -fcompare-elim
10760 After register allocation and post-register allocation instruction
10761 splitting, identify arithmetic instructions that compute processor
10762 flags similar to a comparison operation based on that arithmetic.
10763 If possible, eliminate the explicit comparison operation.
10764
10765 This pass only applies to certain targets that cannot explicitly
10766 represent the comparison operation before register allocation is
10767 complete.
10768
10769 Enabled at levels -O1, -O2, -O3, -Os.
10770
10771 -fcprop-registers
10772 After register allocation and post-register allocation instruction
10773 splitting, perform a copy-propagation pass to try to reduce
10774 scheduling dependencies and occasionally eliminate the copy.
10775
10776 Enabled at levels -O1, -O2, -O3, -Os.
10777
10778 -fprofile-correction
10779 Profiles collected using an instrumented binary for multi-threaded
10780 programs may be inconsistent due to missed counter updates. When
10781 this option is specified, GCC uses heuristics to correct or smooth
10782 out such inconsistencies. By default, GCC emits an error message
10783 when an inconsistent profile is detected.
10784
10785 This option is enabled by -fauto-profile.
10786
10787 -fprofile-partial-training
10788 With "-fprofile-use" all portions of programs not executed during
10789 train run are optimized agressively for size rather than speed. In
10790 some cases it is not practical to train all possible hot paths in
10791 the program. (For example, program may contain functions specific
10792 for a given hardware and trianing may not cover all hardware
10793 configurations program is run on.) With
10794 "-fprofile-partial-training" profile feedback will be ignored for
10795 all functions not executed during the train run leading them to be
10796 optimized as if they were compiled without profile feedback. This
10797 leads to better performance when train run is not representative
10798 but also leads to significantly bigger code.
10799
10800 -fprofile-use
10801 -fprofile-use=path
10802 Enable profile feedback-directed optimizations, and the following
10803 optimizations, many of which are generally profitable only with
10804 profile feedback available:
10805
10806 -fbranch-probabilities -fprofile-values -funroll-loops
10807 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
10808 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
10809 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
10810 -ftree-slp-vectorize -fvect-cost-model=dynamic
10811 -ftree-loop-distribute-patterns -fprofile-reorder-functions
10812
10813 Before you can use this option, you must first generate profiling
10814 information.
10815
10816 By default, GCC emits an error message if the feedback profiles do
10817 not match the source code. This error can be turned into a warning
10818 by using -Wno-error=coverage-mismatch. Note this may result in
10819 poorly optimized code. Additionally, by default, GCC also emits a
10820 warning message if the feedback profiles do not exist (see
10821 -Wmissing-profile).
10822
10823 If path is specified, GCC looks at the path to find the profile
10824 feedback data files. See -fprofile-dir.
10825
10826 -fauto-profile
10827 -fauto-profile=path
10828 Enable sampling-based feedback-directed optimizations, and the
10829 following optimizations, many of which are generally profitable
10830 only with profile feedback available:
10831
10832 -fbranch-probabilities -fprofile-values -funroll-loops
10833 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
10834 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
10835 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
10836 -ftree-slp-vectorize -fvect-cost-model=dynamic
10837 -ftree-loop-distribute-patterns -fprofile-correction
10838
10839 path is the name of a file containing AutoFDO profile information.
10840 If omitted, it defaults to fbdata.afdo in the current directory.
10841
10842 Producing an AutoFDO profile data file requires running your
10843 program with the perf utility on a supported GNU/Linux target
10844 system. For more information, see <https://perf.wiki.kernel.org/>.
10845
10846 E.g.
10847
10848 perf record -e br_inst_retired:near_taken -b -o perf.data \
10849 -- your_program
10850
10851 Then use the create_gcov tool to convert the raw profile data to a
10852 format that can be used by GCC. You must also supply the
10853 unstripped binary for your program to this tool. See
10854 <https://github.com/google/autofdo>.
10855
10856 E.g.
10857
10858 create_gcov --binary=your_program.unstripped --profile=perf.data \
10859 --gcov=profile.afdo
10860
10861 The following options control compiler behavior regarding floating-
10862 point arithmetic. These options trade off between speed and
10863 correctness. All must be specifically enabled.
10864
10865 -ffloat-store
10866 Do not store floating-point variables in registers, and inhibit
10867 other options that might change whether a floating-point value is
10868 taken from a register or memory.
10869
10870 This option prevents undesirable excess precision on machines such
10871 as the 68000 where the floating registers (of the 68881) keep more
10872 precision than a "double" is supposed to have. Similarly for the
10873 x86 architecture. For most programs, the excess precision does
10874 only good, but a few programs rely on the precise definition of
10875 IEEE floating point. Use -ffloat-store for such programs, after
10876 modifying them to store all pertinent intermediate computations
10877 into variables.
10878
10879 -fexcess-precision=style
10880 This option allows further control over excess precision on
10881 machines where floating-point operations occur in a format with
10882 more precision or range than the IEEE standard and interchange
10883 floating-point types. By default, -fexcess-precision=fast is in
10884 effect; this means that operations may be carried out in a wider
10885 precision than the types specified in the source if that would
10886 result in faster code, and it is unpredictable when rounding to the
10887 types specified in the source code takes place. When compiling C,
10888 if -fexcess-precision=standard is specified then excess precision
10889 follows the rules specified in ISO C99; in particular, both casts
10890 and assignments cause values to be rounded to their semantic types
10891 (whereas -ffloat-store only affects assignments). This option is
10892 enabled by default for C if a strict conformance option such as
10893 -std=c99 is used. -ffast-math enables -fexcess-precision=fast by
10894 default regardless of whether a strict conformance option is used.
10895
10896 -fexcess-precision=standard is not implemented for languages other
10897 than C. On the x86, it has no effect if -mfpmath=sse or
10898 -mfpmath=sse+387 is specified; in the former case, IEEE semantics
10899 apply without excess precision, and in the latter, rounding is
10900 unpredictable.
10901
10902 -ffast-math
10903 Sets the options -fno-math-errno, -funsafe-math-optimizations,
10904 -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans,
10905 -fcx-limited-range and -fexcess-precision=fast.
10906
10907 This option causes the preprocessor macro "__FAST_MATH__" to be
10908 defined.
10909
10910 This option is not turned on by any -O option besides -Ofast since
10911 it can result in incorrect output for programs that depend on an
10912 exact implementation of IEEE or ISO rules/specifications for math
10913 functions. It may, however, yield faster code for programs that do
10914 not require the guarantees of these specifications.
10915
10916 -fno-math-errno
10917 Do not set "errno" after calling math functions that are executed
10918 with a single instruction, e.g., "sqrt". A program that relies on
10919 IEEE exceptions for math error handling may want to use this flag
10920 for speed while maintaining IEEE arithmetic compatibility.
10921
10922 This option is not turned on by any -O option since it can result
10923 in incorrect output for programs that depend on an exact
10924 implementation of IEEE or ISO rules/specifications for math
10925 functions. It may, however, yield faster code for programs that do
10926 not require the guarantees of these specifications.
10927
10928 The default is -fmath-errno.
10929
10930 On Darwin systems, the math library never sets "errno". There is
10931 therefore no reason for the compiler to consider the possibility
10932 that it might, and -fno-math-errno is the default.
10933
10934 -funsafe-math-optimizations
10935 Allow optimizations for floating-point arithmetic that (a) assume
10936 that arguments and results are valid and (b) may violate IEEE or
10937 ANSI standards. When used at link time, it may include libraries
10938 or startup files that change the default FPU control word or other
10939 similar optimizations.
10940
10941 This option is not turned on by any -O option since it can result
10942 in incorrect output for programs that depend on an exact
10943 implementation of IEEE or ISO rules/specifications for math
10944 functions. It may, however, yield faster code for programs that do
10945 not require the guarantees of these specifications. Enables
10946 -fno-signed-zeros, -fno-trapping-math, -fassociative-math and
10947 -freciprocal-math.
10948
10949 The default is -fno-unsafe-math-optimizations.
10950
10951 -fassociative-math
10952 Allow re-association of operands in series of floating-point
10953 operations. This violates the ISO C and C++ language standard by
10954 possibly changing computation result. NOTE: re-ordering may change
10955 the sign of zero as well as ignore NaNs and inhibit or create
10956 underflow or overflow (and thus cannot be used on code that relies
10957 on rounding behavior like "(x + 2**52) - 2**52". May also reorder
10958 floating-point comparisons and thus may not be used when ordered
10959 comparisons are required. This option requires that both
10960 -fno-signed-zeros and -fno-trapping-math be in effect. Moreover,
10961 it doesn't make much sense with -frounding-math. For Fortran the
10962 option is automatically enabled when both -fno-signed-zeros and
10963 -fno-trapping-math are in effect.
10964
10965 The default is -fno-associative-math.
10966
10967 -freciprocal-math
10968 Allow the reciprocal of a value to be used instead of dividing by
10969 the value if this enables optimizations. For example "x / y" can
10970 be replaced with "x * (1/y)", which is useful if "(1/y)" is subject
10971 to common subexpression elimination. Note that this loses
10972 precision and increases the number of flops operating on the value.
10973
10974 The default is -fno-reciprocal-math.
10975
10976 -ffinite-math-only
10977 Allow optimizations for floating-point arithmetic that assume that
10978 arguments and results are not NaNs or +-Infs.
10979
10980 This option is not turned on by any -O option since it can result
10981 in incorrect output for programs that depend on an exact
10982 implementation of IEEE or ISO rules/specifications for math
10983 functions. It may, however, yield faster code for programs that do
10984 not require the guarantees of these specifications.
10985
10986 The default is -fno-finite-math-only.
10987
10988 -fno-signed-zeros
10989 Allow optimizations for floating-point arithmetic that ignore the
10990 signedness of zero. IEEE arithmetic specifies the behavior of
10991 distinct +0.0 and -0.0 values, which then prohibits simplification
10992 of expressions such as x+0.0 or 0.0*x (even with
10993 -ffinite-math-only). This option implies that the sign of a zero
10994 result isn't significant.
10995
10996 The default is -fsigned-zeros.
10997
10998 -fno-trapping-math
10999 Compile code assuming that floating-point operations cannot
11000 generate user-visible traps. These traps include division by zero,
11001 overflow, underflow, inexact result and invalid operation. This
11002 option requires that -fno-signaling-nans be in effect. Setting
11003 this option may allow faster code if one relies on "non-stop" IEEE
11004 arithmetic, for example.
11005
11006 This option should never be turned on by any -O option since it can
11007 result in incorrect output for programs that depend on an exact
11008 implementation of IEEE or ISO rules/specifications for math
11009 functions.
11010
11011 The default is -ftrapping-math.
11012
11013 -frounding-math
11014 Disable transformations and optimizations that assume default
11015 floating-point rounding behavior. This is round-to-zero for all
11016 floating point to integer conversions, and round-to-nearest for all
11017 other arithmetic truncations. This option should be specified for
11018 programs that change the FP rounding mode dynamically, or that may
11019 be executed with a non-default rounding mode. This option disables
11020 constant folding of floating-point expressions at compile time
11021 (which may be affected by rounding mode) and arithmetic
11022 transformations that are unsafe in the presence of sign-dependent
11023 rounding modes.
11024
11025 The default is -fno-rounding-math.
11026
11027 This option is experimental and does not currently guarantee to
11028 disable all GCC optimizations that are affected by rounding mode.
11029 Future versions of GCC may provide finer control of this setting
11030 using C99's "FENV_ACCESS" pragma. This command-line option will be
11031 used to specify the default state for "FENV_ACCESS".
11032
11033 -fsignaling-nans
11034 Compile code assuming that IEEE signaling NaNs may generate user-
11035 visible traps during floating-point operations. Setting this
11036 option disables optimizations that may change the number of
11037 exceptions visible with signaling NaNs. This option implies
11038 -ftrapping-math.
11039
11040 This option causes the preprocessor macro "__SUPPORT_SNAN__" to be
11041 defined.
11042
11043 The default is -fno-signaling-nans.
11044
11045 This option is experimental and does not currently guarantee to
11046 disable all GCC optimizations that affect signaling NaN behavior.
11047
11048 -fno-fp-int-builtin-inexact
11049 Do not allow the built-in functions "ceil", "floor", "round" and
11050 "trunc", and their "float" and "long double" variants, to generate
11051 code that raises the "inexact" floating-point exception for
11052 noninteger arguments. ISO C99 and C11 allow these functions to
11053 raise the "inexact" exception, but ISO/IEC TS 18661-1:2014, the C
11054 bindings to IEEE 754-2008, as integrated into ISO C2X, does not
11055 allow these functions to do so.
11056
11057 The default is -ffp-int-builtin-inexact, allowing the exception to
11058 be raised, unless C2X or a later C standard is selected. This
11059 option does nothing unless -ftrapping-math is in effect.
11060
11061 Even if -fno-fp-int-builtin-inexact is used, if the functions
11062 generate a call to a library function then the "inexact" exception
11063 may be raised if the library implementation does not follow TS
11064 18661.
11065
11066 -fsingle-precision-constant
11067 Treat floating-point constants as single precision instead of
11068 implicitly converting them to double-precision constants.
11069
11070 -fcx-limited-range
11071 When enabled, this option states that a range reduction step is not
11072 needed when performing complex division. Also, there is no
11073 checking whether the result of a complex multiplication or division
11074 is "NaN + I*NaN", with an attempt to rescue the situation in that
11075 case. The default is -fno-cx-limited-range, but is enabled by
11076 -ffast-math.
11077
11078 This option controls the default setting of the ISO C99
11079 "CX_LIMITED_RANGE" pragma. Nevertheless, the option applies to all
11080 languages.
11081
11082 -fcx-fortran-rules
11083 Complex multiplication and division follow Fortran rules. Range
11084 reduction is done as part of complex division, but there is no
11085 checking whether the result of a complex multiplication or division
11086 is "NaN + I*NaN", with an attempt to rescue the situation in that
11087 case.
11088
11089 The default is -fno-cx-fortran-rules.
11090
11091 The following options control optimizations that may improve
11092 performance, but are not enabled by any -O options. This section
11093 includes experimental options that may produce broken code.
11094
11095 -fbranch-probabilities
11096 After running a program compiled with -fprofile-arcs, you can
11097 compile it a second time using -fbranch-probabilities, to improve
11098 optimizations based on the number of times each branch was taken.
11099 When a program compiled with -fprofile-arcs exits, it saves arc
11100 execution counts to a file called sourcename.gcda for each source
11101 file. The information in this data file is very dependent on the
11102 structure of the generated code, so you must use the same source
11103 code and the same optimization options for both compilations. See
11104 details about the file naming in -fprofile-arcs.
11105
11106 With -fbranch-probabilities, GCC puts a REG_BR_PROB note on each
11107 JUMP_INSN and CALL_INSN. These can be used to improve
11108 optimization. Currently, they are only used in one place: in
11109 reorg.cc, instead of guessing which path a branch is most likely to
11110 take, the REG_BR_PROB values are used to exactly determine which
11111 path is taken more often.
11112
11113 Enabled by -fprofile-use and -fauto-profile.
11114
11115 -fprofile-values
11116 If combined with -fprofile-arcs, it adds code so that some data
11117 about values of expressions in the program is gathered.
11118
11119 With -fbranch-probabilities, it reads back the data gathered from
11120 profiling values of expressions for usage in optimizations.
11121
11122 Enabled by -fprofile-generate, -fprofile-use, and -fauto-profile.
11123
11124 -fprofile-reorder-functions
11125 Function reordering based on profile instrumentation collects first
11126 time of execution of a function and orders these functions in
11127 ascending order.
11128
11129 Enabled with -fprofile-use.
11130
11131 -fvpt
11132 If combined with -fprofile-arcs, this option instructs the compiler
11133 to add code to gather information about values of expressions.
11134
11135 With -fbranch-probabilities, it reads back the data gathered and
11136 actually performs the optimizations based on them. Currently the
11137 optimizations include specialization of division operations using
11138 the knowledge about the value of the denominator.
11139
11140 Enabled with -fprofile-use and -fauto-profile.
11141
11142 -frename-registers
11143 Attempt to avoid false dependencies in scheduled code by making use
11144 of registers left over after register allocation. This
11145 optimization most benefits processors with lots of registers.
11146 Depending on the debug information format adopted by the target,
11147 however, it can make debugging impossible, since variables no
11148 longer stay in a "home register".
11149
11150 Enabled by default with -funroll-loops.
11151
11152 -fschedule-fusion
11153 Performs a target dependent pass over the instruction stream to
11154 schedule instructions of same type together because target machine
11155 can execute them more efficiently if they are adjacent to each
11156 other in the instruction flow.
11157
11158 Enabled at levels -O2, -O3, -Os.
11159
11160 -ftracer
11161 Perform tail duplication to enlarge superblock size. This
11162 transformation simplifies the control flow of the function allowing
11163 other optimizations to do a better job.
11164
11165 Enabled by -fprofile-use and -fauto-profile.
11166
11167 -funroll-loops
11168 Unroll loops whose number of iterations can be determined at
11169 compile time or upon entry to the loop. -funroll-loops implies
11170 -frerun-cse-after-loop, -fweb and -frename-registers. It also
11171 turns on complete loop peeling (i.e. complete removal of loops with
11172 a small constant number of iterations). This option makes code
11173 larger, and may or may not make it run faster.
11174
11175 Enabled by -fprofile-use and -fauto-profile.
11176
11177 -funroll-all-loops
11178 Unroll all loops, even if their number of iterations is uncertain
11179 when the loop is entered. This usually makes programs run more
11180 slowly. -funroll-all-loops implies the same options as
11181 -funroll-loops.
11182
11183 -fpeel-loops
11184 Peels loops for which there is enough information that they do not
11185 roll much (from profile feedback or static analysis). It also
11186 turns on complete loop peeling (i.e. complete removal of loops with
11187 small constant number of iterations).
11188
11189 Enabled by -O3, -fprofile-use, and -fauto-profile.
11190
11191 -fmove-loop-invariants
11192 Enables the loop invariant motion pass in the RTL loop optimizer.
11193 Enabled at level -O1 and higher, except for -Og.
11194
11195 -fmove-loop-stores
11196 Enables the loop store motion pass in the GIMPLE loop optimizer.
11197 This moves invariant stores to after the end of the loop in
11198 exchange for carrying the stored value in a register across the
11199 iteration. Note for this option to have an effect -ftree-loop-im
11200 has to be enabled as well. Enabled at level -O1 and higher, except
11201 for -Og.
11202
11203 -fsplit-loops
11204 Split a loop into two if it contains a condition that's always true
11205 for one side of the iteration space and false for the other.
11206
11207 Enabled by -fprofile-use and -fauto-profile.
11208
11209 -funswitch-loops
11210 Move branches with loop invariant conditions out of the loop, with
11211 duplicates of the loop on both branches (modified according to
11212 result of the condition).
11213
11214 Enabled by -fprofile-use and -fauto-profile.
11215
11216 -fversion-loops-for-strides
11217 If a loop iterates over an array with a variable stride, create
11218 another version of the loop that assumes the stride is always one.
11219 For example:
11220
11221 for (int i = 0; i < n; ++i)
11222 x[i * stride] = ...;
11223
11224 becomes:
11225
11226 if (stride == 1)
11227 for (int i = 0; i < n; ++i)
11228 x[i] = ...;
11229 else
11230 for (int i = 0; i < n; ++i)
11231 x[i * stride] = ...;
11232
11233 This is particularly useful for assumed-shape arrays in Fortran
11234 where (for example) it allows better vectorization assuming
11235 contiguous accesses. This flag is enabled by default at -O3. It
11236 is also enabled by -fprofile-use and -fauto-profile.
11237
11238 -ffunction-sections
11239 -fdata-sections
11240 Place each function or data item into its own section in the output
11241 file if the target supports arbitrary sections. The name of the
11242 function or the name of the data item determines the section's name
11243 in the output file.
11244
11245 Use these options on systems where the linker can perform
11246 optimizations to improve locality of reference in the instruction
11247 space. Most systems using the ELF object format have linkers with
11248 such optimizations. On AIX, the linker rearranges sections
11249 (CSECTs) based on the call graph. The performance impact varies.
11250
11251 Together with a linker garbage collection (linker --gc-sections
11252 option) these options may lead to smaller statically-linked
11253 executables (after stripping).
11254
11255 On ELF/DWARF systems these options do not degenerate the quality of
11256 the debug information. There could be issues with other object
11257 files/debug info formats.
11258
11259 Only use these options when there are significant benefits from
11260 doing so. When you specify these options, the assembler and linker
11261 create larger object and executable files and are also slower.
11262 These options affect code generation. They prevent optimizations
11263 by the compiler and assembler using relative locations inside a
11264 translation unit since the locations are unknown until link time.
11265 An example of such an optimization is relaxing calls to short call
11266 instructions.
11267
11268 -fstdarg-opt
11269 Optimize the prologue of variadic argument functions with respect
11270 to usage of those arguments.
11271
11272 -fsection-anchors
11273 Try to reduce the number of symbolic address calculations by using
11274 shared "anchor" symbols to address nearby objects. This
11275 transformation can help to reduce the number of GOT entries and GOT
11276 accesses on some targets.
11277
11278 For example, the implementation of the following function "foo":
11279
11280 static int a, b, c;
11281 int foo (void) { return a + b + c; }
11282
11283 usually calculates the addresses of all three variables, but if you
11284 compile it with -fsection-anchors, it accesses the variables from a
11285 common anchor point instead. The effect is similar to the
11286 following pseudocode (which isn't valid C):
11287
11288 int foo (void)
11289 {
11290 register int *xr = &x;
11291 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11292 }
11293
11294 Not all targets support this option.
11295
11296 -fzero-call-used-regs=choice
11297 Zero call-used registers at function return to increase program
11298 security by either mitigating Return-Oriented Programming (ROP)
11299 attacks or preventing information leakage through registers.
11300
11301 The possible values of choice are the same as for the
11302 "zero_call_used_regs" attribute. The default is skip.
11303
11304 You can control this behavior for a specific function by using the
11305 function attribute "zero_call_used_regs".
11306
11307 --param name=value
11308 In some places, GCC uses various constants to control the amount of
11309 optimization that is done. For example, GCC does not inline
11310 functions that contain more than a certain number of instructions.
11311 You can control some of these constants on the command line using
11312 the --param option.
11313
11314 The names of specific parameters, and the meaning of the values,
11315 are tied to the internals of the compiler, and are subject to
11316 change without notice in future releases.
11317
11318 In order to get minimal, maximal and default value of a parameter,
11319 one can use --help=param -Q options.
11320
11321 In each case, the value is an integer. The following choices of
11322 name are recognized for all targets:
11323
11324 predictable-branch-outcome
11325 When branch is predicted to be taken with probability lower
11326 than this threshold (in percent), then it is considered well
11327 predictable.
11328
11329 max-rtl-if-conversion-insns
11330 RTL if-conversion tries to remove conditional branches around a
11331 block and replace them with conditionally executed
11332 instructions. This parameter gives the maximum number of
11333 instructions in a block which should be considered for if-
11334 conversion. The compiler will also use other heuristics to
11335 decide whether if-conversion is likely to be profitable.
11336
11337 max-rtl-if-conversion-predictable-cost
11338 RTL if-conversion will try to remove conditional branches
11339 around a block and replace them with conditionally executed
11340 instructions. These parameters give the maximum permissible
11341 cost for the sequence that would be generated by if-conversion
11342 depending on whether the branch is statically determined to be
11343 predictable or not. The units for this parameter are the same
11344 as those for the GCC internal seq_cost metric. The compiler
11345 will try to provide a reasonable default for this parameter
11346 using the BRANCH_COST target macro.
11347
11348 max-crossjump-edges
11349 The maximum number of incoming edges to consider for cross-
11350 jumping. The algorithm used by -fcrossjumping is O(N^2) in the
11351 number of edges incoming to each block. Increasing values mean
11352 more aggressive optimization, making the compilation time
11353 increase with probably small improvement in executable size.
11354
11355 min-crossjump-insns
11356 The minimum number of instructions that must be matched at the
11357 end of two blocks before cross-jumping is performed on them.
11358 This value is ignored in the case where all instructions in the
11359 block being cross-jumped from are matched.
11360
11361 max-grow-copy-bb-insns
11362 The maximum code size expansion factor when copying basic
11363 blocks instead of jumping. The expansion is relative to a jump
11364 instruction.
11365
11366 max-goto-duplication-insns
11367 The maximum number of instructions to duplicate to a block that
11368 jumps to a computed goto. To avoid O(N^2) behavior in a number
11369 of passes, GCC factors computed gotos early in the compilation
11370 process, and unfactors them as late as possible. Only computed
11371 jumps at the end of a basic blocks with no more than max-goto-
11372 duplication-insns are unfactored.
11373
11374 max-delay-slot-insn-search
11375 The maximum number of instructions to consider when looking for
11376 an instruction to fill a delay slot. If more than this
11377 arbitrary number of instructions are searched, the time savings
11378 from filling the delay slot are minimal, so stop searching.
11379 Increasing values mean more aggressive optimization, making the
11380 compilation time increase with probably small improvement in
11381 execution time.
11382
11383 max-delay-slot-live-search
11384 When trying to fill delay slots, the maximum number of
11385 instructions to consider when searching for a block with valid
11386 live register information. Increasing this arbitrarily chosen
11387 value means more aggressive optimization, increasing the
11388 compilation time. This parameter should be removed when the
11389 delay slot code is rewritten to maintain the control-flow
11390 graph.
11391
11392 max-gcse-memory
11393 The approximate maximum amount of memory in "kB" that can be
11394 allocated in order to perform the global common subexpression
11395 elimination optimization. If more memory than specified is
11396 required, the optimization is not done.
11397
11398 max-gcse-insertion-ratio
11399 If the ratio of expression insertions to deletions is larger
11400 than this value for any expression, then RTL PRE inserts or
11401 removes the expression and thus leaves partially redundant
11402 computations in the instruction stream.
11403
11404 max-pending-list-length
11405 The maximum number of pending dependencies scheduling allows
11406 before flushing the current state and starting over. Large
11407 functions with few branches or calls can create excessively
11408 large lists which needlessly consume memory and resources.
11409
11410 max-modulo-backtrack-attempts
11411 The maximum number of backtrack attempts the scheduler should
11412 make when modulo scheduling a loop. Larger values can
11413 exponentially increase compilation time.
11414
11415 max-inline-functions-called-once-loop-depth
11416 Maximal loop depth of a call considered by inline heuristics
11417 that tries to inline all functions called once.
11418
11419 max-inline-functions-called-once-insns
11420 Maximal estimated size of functions produced while inlining
11421 functions called once.
11422
11423 max-inline-insns-single
11424 Several parameters control the tree inliner used in GCC. This
11425 number sets the maximum number of instructions (counted in
11426 GCC's internal representation) in a single function that the
11427 tree inliner considers for inlining. This only affects
11428 functions declared inline and methods implemented in a class
11429 declaration (C++).
11430
11431 max-inline-insns-auto
11432 When you use -finline-functions (included in -O3), a lot of
11433 functions that would otherwise not be considered for inlining
11434 by the compiler are investigated. To those functions, a
11435 different (more restrictive) limit compared to functions
11436 declared inline can be applied (--param max-inline-insns-auto).
11437
11438 max-inline-insns-small
11439 This is bound applied to calls which are considered relevant
11440 with -finline-small-functions.
11441
11442 max-inline-insns-size
11443 This is bound applied to calls which are optimized for size.
11444 Small growth may be desirable to anticipate optimization
11445 oppurtunities exposed by inlining.
11446
11447 uninlined-function-insns
11448 Number of instructions accounted by inliner for function
11449 overhead such as function prologue and epilogue.
11450
11451 uninlined-function-time
11452 Extra time accounted by inliner for function overhead such as
11453 time needed to execute function prologue and epilogue.
11454
11455 inline-heuristics-hint-percent
11456 The scale (in percents) applied to inline-insns-single,
11457 inline-insns-single-O2, inline-insns-auto when inline
11458 heuristics hints that inlining is very profitable (will enable
11459 later optimizations).
11460
11461 uninlined-thunk-insns
11462 uninlined-thunk-time
11463 Same as --param uninlined-function-insns and --param uninlined-
11464 function-time but applied to function thunks.
11465
11466 inline-min-speedup
11467 When estimated performance improvement of caller + callee
11468 runtime exceeds this threshold (in percent), the function can
11469 be inlined regardless of the limit on --param max-inline-insns-
11470 single and --param max-inline-insns-auto.
11471
11472 large-function-insns
11473 The limit specifying really large functions. For functions
11474 larger than this limit after inlining, inlining is constrained
11475 by --param large-function-growth. This parameter is useful
11476 primarily to avoid extreme compilation time caused by non-
11477 linear algorithms used by the back end.
11478
11479 large-function-growth
11480 Specifies maximal growth of large function caused by inlining
11481 in percents. For example, parameter value 100 limits large
11482 function growth to 2.0 times the original size.
11483
11484 large-unit-insns
11485 The limit specifying large translation unit. Growth caused by
11486 inlining of units larger than this limit is limited by --param
11487 inline-unit-growth. For small units this might be too tight.
11488 For example, consider a unit consisting of function A that is
11489 inline and B that just calls A three times. If B is small
11490 relative to A, the growth of unit is 300\% and yet such
11491 inlining is very sane. For very large units consisting of
11492 small inlineable functions, however, the overall unit growth
11493 limit is needed to avoid exponential explosion of code size.
11494 Thus for smaller units, the size is increased to --param large-
11495 unit-insns before applying --param inline-unit-growth.
11496
11497 lazy-modules
11498 Maximum number of concurrently open C++ module files when lazy
11499 loading.
11500
11501 inline-unit-growth
11502 Specifies maximal overall growth of the compilation unit caused
11503 by inlining. For example, parameter value 20 limits unit
11504 growth to 1.2 times the original size. Cold functions (either
11505 marked cold via an attribute or by profile feedback) are not
11506 accounted into the unit size.
11507
11508 ipa-cp-unit-growth
11509 Specifies maximal overall growth of the compilation unit caused
11510 by interprocedural constant propagation. For example,
11511 parameter value 10 limits unit growth to 1.1 times the original
11512 size.
11513
11514 ipa-cp-large-unit-insns
11515 The size of translation unit that IPA-CP pass considers large.
11516
11517 large-stack-frame
11518 The limit specifying large stack frames. While inlining the
11519 algorithm is trying to not grow past this limit too much.
11520
11521 large-stack-frame-growth
11522 Specifies maximal growth of large stack frames caused by
11523 inlining in percents. For example, parameter value 1000 limits
11524 large stack frame growth to 11 times the original size.
11525
11526 max-inline-insns-recursive
11527 max-inline-insns-recursive-auto
11528 Specifies the maximum number of instructions an out-of-line
11529 copy of a self-recursive inline function can grow into by
11530 performing recursive inlining.
11531
11532 --param max-inline-insns-recursive applies to functions
11533 declared inline. For functions not declared inline, recursive
11534 inlining happens only when -finline-functions (included in -O3)
11535 is enabled; --param max-inline-insns-recursive-auto applies
11536 instead.
11537
11538 max-inline-recursive-depth
11539 max-inline-recursive-depth-auto
11540 Specifies the maximum recursion depth used for recursive
11541 inlining.
11542
11543 --param max-inline-recursive-depth applies to functions
11544 declared inline. For functions not declared inline, recursive
11545 inlining happens only when -finline-functions (included in -O3)
11546 is enabled; --param max-inline-recursive-depth-auto applies
11547 instead.
11548
11549 min-inline-recursive-probability
11550 Recursive inlining is profitable only for function having deep
11551 recursion in average and can hurt for function having little
11552 recursion depth by increasing the prologue size or complexity
11553 of function body to other optimizers.
11554
11555 When profile feedback is available (see -fprofile-generate) the
11556 actual recursion depth can be guessed from the probability that
11557 function recurses via a given call expression. This parameter
11558 limits inlining only to call expressions whose probability
11559 exceeds the given threshold (in percents).
11560
11561 early-inlining-insns
11562 Specify growth that the early inliner can make. In effect it
11563 increases the amount of inlining for code having a large
11564 abstraction penalty.
11565
11566 max-early-inliner-iterations
11567 Limit of iterations of the early inliner. This basically
11568 bounds the number of nested indirect calls the early inliner
11569 can resolve. Deeper chains are still handled by late inlining.
11570
11571 comdat-sharing-probability
11572 Probability (in percent) that C++ inline function with comdat
11573 visibility are shared across multiple compilation units.
11574
11575 modref-max-bases
11576 modref-max-refs
11577 modref-max-accesses
11578 Specifies the maximal number of base pointers, references and
11579 accesses stored for a single function by mod/ref analysis.
11580
11581 modref-max-tests
11582 Specifies the maxmal number of tests alias oracle can perform
11583 to disambiguate memory locations using the mod/ref information.
11584 This parameter ought to be bigger than --param modref-max-bases
11585 and --param modref-max-refs.
11586
11587 modref-max-depth
11588 Specifies the maximum depth of DFS walk used by modref escape
11589 analysis. Setting to 0 disables the analysis completely.
11590
11591 modref-max-escape-points
11592 Specifies the maximum number of escape points tracked by modref
11593 per SSA-name.
11594
11595 modref-max-adjustments
11596 Specifies the maximum number the access range is enlarged
11597 during modref dataflow analysis.
11598
11599 profile-func-internal-id
11600 A parameter to control whether to use function internal id in
11601 profile database lookup. If the value is 0, the compiler uses
11602 an id that is based on function assembler name and filename,
11603 which makes old profile data more tolerant to source changes
11604 such as function reordering etc.
11605
11606 min-vect-loop-bound
11607 The minimum number of iterations under which loops are not
11608 vectorized when -ftree-vectorize is used. The number of
11609 iterations after vectorization needs to be greater than the
11610 value specified by this option to allow vectorization.
11611
11612 gcse-cost-distance-ratio
11613 Scaling factor in calculation of maximum distance an expression
11614 can be moved by GCSE optimizations. This is currently
11615 supported only in the code hoisting pass. The bigger the
11616 ratio, the more aggressive code hoisting is with simple
11617 expressions, i.e., the expressions that have cost less than
11618 gcse-unrestricted-cost. Specifying 0 disables hoisting of
11619 simple expressions.
11620
11621 gcse-unrestricted-cost
11622 Cost, roughly measured as the cost of a single typical machine
11623 instruction, at which GCSE optimizations do not constrain the
11624 distance an expression can travel. This is currently supported
11625 only in the code hoisting pass. The lesser the cost, the more
11626 aggressive code hoisting is. Specifying 0 allows all
11627 expressions to travel unrestricted distances.
11628
11629 max-hoist-depth
11630 The depth of search in the dominator tree for expressions to
11631 hoist. This is used to avoid quadratic behavior in hoisting
11632 algorithm. The value of 0 does not limit on the search, but
11633 may slow down compilation of huge functions.
11634
11635 max-tail-merge-comparisons
11636 The maximum amount of similar bbs to compare a bb with. This
11637 is used to avoid quadratic behavior in tree tail merging.
11638
11639 max-tail-merge-iterations
11640 The maximum amount of iterations of the pass over the function.
11641 This is used to limit compilation time in tree tail merging.
11642
11643 store-merging-allow-unaligned
11644 Allow the store merging pass to introduce unaligned stores if
11645 it is legal to do so.
11646
11647 max-stores-to-merge
11648 The maximum number of stores to attempt to merge into wider
11649 stores in the store merging pass.
11650
11651 max-store-chains-to-track
11652 The maximum number of store chains to track at the same time in
11653 the attempt to merge them into wider stores in the store
11654 merging pass.
11655
11656 max-stores-to-track
11657 The maximum number of stores to track at the same time in the
11658 attemt to to merge them into wider stores in the store merging
11659 pass.
11660
11661 max-unrolled-insns
11662 The maximum number of instructions that a loop may have to be
11663 unrolled. If a loop is unrolled, this parameter also
11664 determines how many times the loop code is unrolled.
11665
11666 max-average-unrolled-insns
11667 The maximum number of instructions biased by probabilities of
11668 their execution that a loop may have to be unrolled. If a loop
11669 is unrolled, this parameter also determines how many times the
11670 loop code is unrolled.
11671
11672 max-unroll-times
11673 The maximum number of unrollings of a single loop.
11674
11675 max-peeled-insns
11676 The maximum number of instructions that a loop may have to be
11677 peeled. If a loop is peeled, this parameter also determines
11678 how many times the loop code is peeled.
11679
11680 max-peel-times
11681 The maximum number of peelings of a single loop.
11682
11683 max-peel-branches
11684 The maximum number of branches on the hot path through the
11685 peeled sequence.
11686
11687 max-completely-peeled-insns
11688 The maximum number of insns of a completely peeled loop.
11689
11690 max-completely-peel-times
11691 The maximum number of iterations of a loop to be suitable for
11692 complete peeling.
11693
11694 max-completely-peel-loop-nest-depth
11695 The maximum depth of a loop nest suitable for complete peeling.
11696
11697 max-unswitch-insns
11698 The maximum number of insns of an unswitched loop.
11699
11700 max-unswitch-level
11701 The maximum number of branches unswitched in a single loop.
11702
11703 lim-expensive
11704 The minimum cost of an expensive expression in the loop
11705 invariant motion.
11706
11707 min-loop-cond-split-prob
11708 When FDO profile information is available, min-loop-cond-split-
11709 prob specifies minimum threshold for probability of semi-
11710 invariant condition statement to trigger loop split.
11711
11712 iv-consider-all-candidates-bound
11713 Bound on number of candidates for induction variables, below
11714 which all candidates are considered for each use in induction
11715 variable optimizations. If there are more candidates than
11716 this, only the most relevant ones are considered to avoid
11717 quadratic time complexity.
11718
11719 iv-max-considered-uses
11720 The induction variable optimizations give up on loops that
11721 contain more induction variable uses.
11722
11723 iv-always-prune-cand-set-bound
11724 If the number of candidates in the set is smaller than this
11725 value, always try to remove unnecessary ivs from the set when
11726 adding a new one.
11727
11728 avg-loop-niter
11729 Average number of iterations of a loop.
11730
11731 dse-max-object-size
11732 Maximum size (in bytes) of objects tracked bytewise by dead
11733 store elimination. Larger values may result in larger
11734 compilation times.
11735
11736 dse-max-alias-queries-per-store
11737 Maximum number of queries into the alias oracle per store.
11738 Larger values result in larger compilation times and may result
11739 in more removed dead stores.
11740
11741 scev-max-expr-size
11742 Bound on size of expressions used in the scalar evolutions
11743 analyzer. Large expressions slow the analyzer.
11744
11745 scev-max-expr-complexity
11746 Bound on the complexity of the expressions in the scalar
11747 evolutions analyzer. Complex expressions slow the analyzer.
11748
11749 max-tree-if-conversion-phi-args
11750 Maximum number of arguments in a PHI supported by TREE if
11751 conversion unless the loop is marked with simd pragma.
11752
11753 vect-max-version-for-alignment-checks
11754 The maximum number of run-time checks that can be performed
11755 when doing loop versioning for alignment in the vectorizer.
11756
11757 vect-max-version-for-alias-checks
11758 The maximum number of run-time checks that can be performed
11759 when doing loop versioning for alias in the vectorizer.
11760
11761 vect-max-peeling-for-alignment
11762 The maximum number of loop peels to enhance access alignment
11763 for vectorizer. Value -1 means no limit.
11764
11765 max-iterations-to-track
11766 The maximum number of iterations of a loop the brute-force
11767 algorithm for analysis of the number of iterations of the loop
11768 tries to evaluate.
11769
11770 hot-bb-count-fraction
11771 The denominator n of fraction 1/n of the maximal execution
11772 count of a basic block in the entire program that a basic block
11773 needs to at least have in order to be considered hot. The
11774 default is 10000, which means that a basic block is considered
11775 hot if its execution count is greater than 1/10000 of the
11776 maximal execution count. 0 means that it is never considered
11777 hot. Used in non-LTO mode.
11778
11779 hot-bb-count-ws-permille
11780 The number of most executed permilles, ranging from 0 to 1000,
11781 of the profiled execution of the entire program to which the
11782 execution count of a basic block must be part of in order to be
11783 considered hot. The default is 990, which means that a basic
11784 block is considered hot if its execution count contributes to
11785 the upper 990 permilles, or 99.0%, of the profiled execution of
11786 the entire program. 0 means that it is never considered hot.
11787 Used in LTO mode.
11788
11789 hot-bb-frequency-fraction
11790 The denominator n of fraction 1/n of the execution frequency of
11791 the entry block of a function that a basic block of this
11792 function needs to at least have in order to be considered hot.
11793 The default is 1000, which means that a basic block is
11794 considered hot in a function if it is executed more frequently
11795 than 1/1000 of the frequency of the entry block of the
11796 function. 0 means that it is never considered hot.
11797
11798 unlikely-bb-count-fraction
11799 The denominator n of fraction 1/n of the number of profiled
11800 runs of the entire program below which the execution count of a
11801 basic block must be in order for the basic block to be
11802 considered unlikely executed. The default is 20, which means
11803 that a basic block is considered unlikely executed if it is
11804 executed in fewer than 1/20, or 5%, of the runs of the program.
11805 0 means that it is always considered unlikely executed.
11806
11807 max-predicted-iterations
11808 The maximum number of loop iterations we predict statically.
11809 This is useful in cases where a function contains a single loop
11810 with known bound and another loop with unknown bound. The
11811 known number of iterations is predicted correctly, while the
11812 unknown number of iterations average to roughly 10. This means
11813 that the loop without bounds appears artificially cold relative
11814 to the other one.
11815
11816 builtin-expect-probability
11817 Control the probability of the expression having the specified
11818 value. This parameter takes a percentage (i.e. 0 ... 100) as
11819 input.
11820
11821 builtin-string-cmp-inline-length
11822 The maximum length of a constant string for a builtin string
11823 cmp call eligible for inlining.
11824
11825 align-threshold
11826 Select fraction of the maximal frequency of executions of a
11827 basic block in a function to align the basic block.
11828
11829 align-loop-iterations
11830 A loop expected to iterate at least the selected number of
11831 iterations is aligned.
11832
11833 tracer-dynamic-coverage
11834 tracer-dynamic-coverage-feedback
11835 This value is used to limit superblock formation once the given
11836 percentage of executed instructions is covered. This limits
11837 unnecessary code size expansion.
11838
11839 The tracer-dynamic-coverage-feedback parameter is used only
11840 when profile feedback is available. The real profiles (as
11841 opposed to statically estimated ones) are much less balanced
11842 allowing the threshold to be larger value.
11843
11844 tracer-max-code-growth
11845 Stop tail duplication once code growth has reached given
11846 percentage. This is a rather artificial limit, as most of the
11847 duplicates are eliminated later in cross jumping, so it may be
11848 set to much higher values than is the desired code growth.
11849
11850 tracer-min-branch-ratio
11851 Stop reverse growth when the reverse probability of best edge
11852 is less than this threshold (in percent).
11853
11854 tracer-min-branch-probability
11855 tracer-min-branch-probability-feedback
11856 Stop forward growth if the best edge has probability lower than
11857 this threshold.
11858
11859 Similarly to tracer-dynamic-coverage two parameters are
11860 provided. tracer-min-branch-probability-feedback is used for
11861 compilation with profile feedback and tracer-min-branch-
11862 probability compilation without. The value for compilation
11863 with profile feedback needs to be more conservative (higher) in
11864 order to make tracer effective.
11865
11866 stack-clash-protection-guard-size
11867 Specify the size of the operating system provided stack guard
11868 as 2 raised to num bytes. Higher values may reduce the number
11869 of explicit probes, but a value larger than the operating
11870 system provided guard will leave code vulnerable to stack clash
11871 style attacks.
11872
11873 stack-clash-protection-probe-interval
11874 Stack clash protection involves probing stack space as it is
11875 allocated. This param controls the maximum distance between
11876 probes into the stack as 2 raised to num bytes. Higher values
11877 may reduce the number of explicit probes, but a value larger
11878 than the operating system provided guard will leave code
11879 vulnerable to stack clash style attacks.
11880
11881 max-cse-path-length
11882 The maximum number of basic blocks on path that CSE considers.
11883
11884 max-cse-insns
11885 The maximum number of instructions CSE processes before
11886 flushing.
11887
11888 ggc-min-expand
11889 GCC uses a garbage collector to manage its own memory
11890 allocation. This parameter specifies the minimum percentage by
11891 which the garbage collector's heap should be allowed to expand
11892 between collections. Tuning this may improve compilation
11893 speed; it has no effect on code generation.
11894
11895 The default is 30% + 70% * (RAM/1GB) with an upper bound of
11896 100% when RAM >= 1GB. If "getrlimit" is available, the notion
11897 of "RAM" is the smallest of actual RAM and "RLIMIT_DATA" or
11898 "RLIMIT_AS". If GCC is not able to calculate RAM on a
11899 particular platform, the lower bound of 30% is used. Setting
11900 this parameter and ggc-min-heapsize to zero causes a full
11901 collection to occur at every opportunity. This is extremely
11902 slow, but can be useful for debugging.
11903
11904 ggc-min-heapsize
11905 Minimum size of the garbage collector's heap before it begins
11906 bothering to collect garbage. The first collection occurs
11907 after the heap expands by ggc-min-expand% beyond ggc-min-
11908 heapsize. Again, tuning this may improve compilation speed,
11909 and has no effect on code generation.
11910
11911 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit
11912 that tries to ensure that RLIMIT_DATA or RLIMIT_AS are not
11913 exceeded, but with a lower bound of 4096 (four megabytes) and
11914 an upper bound of 131072 (128 megabytes). If GCC is not able
11915 to calculate RAM on a particular platform, the lower bound is
11916 used. Setting this parameter very large effectively disables
11917 garbage collection. Setting this parameter and ggc-min-expand
11918 to zero causes a full collection to occur at every opportunity.
11919
11920 max-reload-search-insns
11921 The maximum number of instruction reload should look backward
11922 for equivalent register. Increasing values mean more
11923 aggressive optimization, making the compilation time increase
11924 with probably slightly better performance.
11925
11926 max-cselib-memory-locations
11927 The maximum number of memory locations cselib should take into
11928 account. Increasing values mean more aggressive optimization,
11929 making the compilation time increase with probably slightly
11930 better performance.
11931
11932 max-sched-ready-insns
11933 The maximum number of instructions ready to be issued the
11934 scheduler should consider at any given time during the first
11935 scheduling pass. Increasing values mean more thorough
11936 searches, making the compilation time increase with probably
11937 little benefit.
11938
11939 max-sched-region-blocks
11940 The maximum number of blocks in a region to be considered for
11941 interblock scheduling.
11942
11943 max-pipeline-region-blocks
11944 The maximum number of blocks in a region to be considered for
11945 pipelining in the selective scheduler.
11946
11947 max-sched-region-insns
11948 The maximum number of insns in a region to be considered for
11949 interblock scheduling.
11950
11951 max-pipeline-region-insns
11952 The maximum number of insns in a region to be considered for
11953 pipelining in the selective scheduler.
11954
11955 min-spec-prob
11956 The minimum probability (in percents) of reaching a source
11957 block for interblock speculative scheduling.
11958
11959 max-sched-extend-regions-iters
11960 The maximum number of iterations through CFG to extend regions.
11961 A value of 0 disables region extensions.
11962
11963 max-sched-insn-conflict-delay
11964 The maximum conflict delay for an insn to be considered for
11965 speculative motion.
11966
11967 sched-spec-prob-cutoff
11968 The minimal probability of speculation success (in percents),
11969 so that speculative insns are scheduled.
11970
11971 sched-state-edge-prob-cutoff
11972 The minimum probability an edge must have for the scheduler to
11973 save its state across it.
11974
11975 sched-mem-true-dep-cost
11976 Minimal distance (in CPU cycles) between store and load
11977 targeting same memory locations.
11978
11979 selsched-max-lookahead
11980 The maximum size of the lookahead window of selective
11981 scheduling. It is a depth of search for available
11982 instructions.
11983
11984 selsched-max-sched-times
11985 The maximum number of times that an instruction is scheduled
11986 during selective scheduling. This is the limit on the number
11987 of iterations through which the instruction may be pipelined.
11988
11989 selsched-insns-to-rename
11990 The maximum number of best instructions in the ready list that
11991 are considered for renaming in the selective scheduler.
11992
11993 sms-min-sc
11994 The minimum value of stage count that swing modulo scheduler
11995 generates.
11996
11997 max-last-value-rtl
11998 The maximum size measured as number of RTLs that can be
11999 recorded in an expression in combiner for a pseudo register as
12000 last known value of that register.
12001
12002 max-combine-insns
12003 The maximum number of instructions the RTL combiner tries to
12004 combine.
12005
12006 integer-share-limit
12007 Small integer constants can use a shared data structure,
12008 reducing the compiler's memory usage and increasing its speed.
12009 This sets the maximum value of a shared integer constant.
12010
12011 ssp-buffer-size
12012 The minimum size of buffers (i.e. arrays) that receive stack
12013 smashing protection when -fstack-protector is used.
12014
12015 min-size-for-stack-sharing
12016 The minimum size of variables taking part in stack slot sharing
12017 when not optimizing.
12018
12019 max-jump-thread-duplication-stmts
12020 Maximum number of statements allowed in a block that needs to
12021 be duplicated when threading jumps.
12022
12023 max-fields-for-field-sensitive
12024 Maximum number of fields in a structure treated in a field
12025 sensitive manner during pointer analysis.
12026
12027 prefetch-latency
12028 Estimate on average number of instructions that are executed
12029 before prefetch finishes. The distance prefetched ahead is
12030 proportional to this constant. Increasing this number may also
12031 lead to less streams being prefetched (see simultaneous-
12032 prefetches).
12033
12034 simultaneous-prefetches
12035 Maximum number of prefetches that can run at the same time.
12036
12037 l1-cache-line-size
12038 The size of cache line in L1 data cache, in bytes.
12039
12040 l1-cache-size
12041 The size of L1 data cache, in kilobytes.
12042
12043 l2-cache-size
12044 The size of L2 data cache, in kilobytes.
12045
12046 prefetch-dynamic-strides
12047 Whether the loop array prefetch pass should issue software
12048 prefetch hints for strides that are non-constant. In some
12049 cases this may be beneficial, though the fact the stride is
12050 non-constant may make it hard to predict when there is clear
12051 benefit to issuing these hints.
12052
12053 Set to 1 if the prefetch hints should be issued for non-
12054 constant strides. Set to 0 if prefetch hints should be issued
12055 only for strides that are known to be constant and below
12056 prefetch-minimum-stride.
12057
12058 prefetch-minimum-stride
12059 Minimum constant stride, in bytes, to start using prefetch
12060 hints for. If the stride is less than this threshold, prefetch
12061 hints will not be issued.
12062
12063 This setting is useful for processors that have hardware
12064 prefetchers, in which case there may be conflicts between the
12065 hardware prefetchers and the software prefetchers. If the
12066 hardware prefetchers have a maximum stride they can handle, it
12067 should be used here to improve the use of software prefetchers.
12068
12069 A value of -1 means we don't have a threshold and therefore
12070 prefetch hints can be issued for any constant stride.
12071
12072 This setting is only useful for strides that are known and
12073 constant.
12074
12075 destructive-interference-size
12076 constructive-interference-size
12077 The values for the C++17 variables
12078 "std::hardware_destructive_interference_size" and
12079 "std::hardware_constructive_interference_size". The
12080 destructive interference size is the minimum recommended offset
12081 between two independent concurrently-accessed objects; the
12082 constructive interference size is the maximum recommended size
12083 of contiguous memory accessed together. Typically both will be
12084 the size of an L1 cache line for the target, in bytes. For a
12085 generic target covering a range of L1 cache line sizes,
12086 typically the constructive interference size will be the small
12087 end of the range and the destructive size will be the large
12088 end.
12089
12090 The destructive interference size is intended to be used for
12091 layout, and thus has ABI impact. The default value is not
12092 expected to be stable, and on some targets varies with -mtune,
12093 so use of this variable in a context where ABI stability is
12094 important, such as the public interface of a library, is
12095 strongly discouraged; if it is used in that context, users can
12096 stabilize the value using this option.
12097
12098 The constructive interference size is less sensitive, as it is
12099 typically only used in a static_assert to make sure that a type
12100 fits within a cache line.
12101
12102 See also -Winterference-size.
12103
12104 loop-interchange-max-num-stmts
12105 The maximum number of stmts in a loop to be interchanged.
12106
12107 loop-interchange-stride-ratio
12108 The minimum ratio between stride of two loops for interchange
12109 to be profitable.
12110
12111 min-insn-to-prefetch-ratio
12112 The minimum ratio between the number of instructions and the
12113 number of prefetches to enable prefetching in a loop.
12114
12115 prefetch-min-insn-to-mem-ratio
12116 The minimum ratio between the number of instructions and the
12117 number of memory references to enable prefetching in a loop.
12118
12119 use-canonical-types
12120 Whether the compiler should use the "canonical" type system.
12121 Should always be 1, which uses a more efficient internal
12122 mechanism for comparing types in C++ and Objective-C++.
12123 However, if bugs in the canonical type system are causing
12124 compilation failures, set this value to 0 to disable canonical
12125 types.
12126
12127 switch-conversion-max-branch-ratio
12128 Switch initialization conversion refuses to create arrays that
12129 are bigger than switch-conversion-max-branch-ratio times the
12130 number of branches in the switch.
12131
12132 max-partial-antic-length
12133 Maximum length of the partial antic set computed during the
12134 tree partial redundancy elimination optimization (-ftree-pre)
12135 when optimizing at -O3 and above. For some sorts of source
12136 code the enhanced partial redundancy elimination optimization
12137 can run away, consuming all of the memory available on the host
12138 machine. This parameter sets a limit on the length of the sets
12139 that are computed, which prevents the runaway behavior.
12140 Setting a value of 0 for this parameter allows an unlimited set
12141 length.
12142
12143 rpo-vn-max-loop-depth
12144 Maximum loop depth that is value-numbered optimistically. When
12145 the limit hits the innermost rpo-vn-max-loop-depth loops and
12146 the outermost loop in the loop nest are value-numbered
12147 optimistically and the remaining ones not.
12148
12149 sccvn-max-alias-queries-per-access
12150 Maximum number of alias-oracle queries we perform when looking
12151 for redundancies for loads and stores. If this limit is hit
12152 the search is aborted and the load or store is not considered
12153 redundant. The number of queries is algorithmically limited to
12154 the number of stores on all paths from the load to the function
12155 entry.
12156
12157 ira-max-loops-num
12158 IRA uses regional register allocation by default. If a
12159 function contains more loops than the number given by this
12160 parameter, only at most the given number of the most
12161 frequently-executed loops form regions for regional register
12162 allocation.
12163
12164 ira-max-conflict-table-size
12165 Although IRA uses a sophisticated algorithm to compress the
12166 conflict table, the table can still require excessive amounts
12167 of memory for huge functions. If the conflict table for a
12168 function could be more than the size in MB given by this
12169 parameter, the register allocator instead uses a faster,
12170 simpler, and lower-quality algorithm that does not require
12171 building a pseudo-register conflict table.
12172
12173 ira-loop-reserved-regs
12174 IRA can be used to evaluate more accurate register pressure in
12175 loops for decisions to move loop invariants (see -O3). The
12176 number of available registers reserved for some other purposes
12177 is given by this parameter. Default of the parameter is the
12178 best found from numerous experiments.
12179
12180 ira-consider-dup-in-all-alts
12181 Make IRA to consider matching constraint (duplicated operand
12182 number) heavily in all available alternatives for preferred
12183 register class. If it is set as zero, it means IRA only
12184 respects the matching constraint when it's in the only
12185 available alternative with an appropriate register class.
12186 Otherwise, it means IRA will check all available alternatives
12187 for preferred register class even if it has found some choice
12188 with an appropriate register class and respect the found
12189 qualified matching constraint.
12190
12191 lra-inheritance-ebb-probability-cutoff
12192 LRA tries to reuse values reloaded in registers in subsequent
12193 insns. This optimization is called inheritance. EBB is used
12194 as a region to do this optimization. The parameter defines a
12195 minimal fall-through edge probability in percentage used to add
12196 BB to inheritance EBB in LRA. The default value was chosen
12197 from numerous runs of SPEC2000 on x86-64.
12198
12199 loop-invariant-max-bbs-in-loop
12200 Loop invariant motion can be very expensive, both in
12201 compilation time and in amount of needed compile-time memory,
12202 with very large loops. Loops with more basic blocks than this
12203 parameter won't have loop invariant motion optimization
12204 performed on them.
12205
12206 loop-max-datarefs-for-datadeps
12207 Building data dependencies is expensive for very large loops.
12208 This parameter limits the number of data references in loops
12209 that are considered for data dependence analysis. These large
12210 loops are no handled by the optimizations using loop data
12211 dependencies.
12212
12213 max-vartrack-size
12214 Sets a maximum number of hash table slots to use during
12215 variable tracking dataflow analysis of any function. If this
12216 limit is exceeded with variable tracking at assignments
12217 enabled, analysis for that function is retried without it,
12218 after removing all debug insns from the function. If the limit
12219 is exceeded even without debug insns, var tracking analysis is
12220 completely disabled for the function. Setting the parameter to
12221 zero makes it unlimited.
12222
12223 max-vartrack-expr-depth
12224 Sets a maximum number of recursion levels when attempting to
12225 map variable names or debug temporaries to value expressions.
12226 This trades compilation time for more complete debug
12227 information. If this is set too low, value expressions that
12228 are available and could be represented in debug information may
12229 end up not being used; setting this higher may enable the
12230 compiler to find more complex debug expressions, but compile
12231 time and memory use may grow.
12232
12233 max-debug-marker-count
12234 Sets a threshold on the number of debug markers (e.g. begin
12235 stmt markers) to avoid complexity explosion at inlining or
12236 expanding to RTL. If a function has more such gimple stmts
12237 than the set limit, such stmts will be dropped from the inlined
12238 copy of a function, and from its RTL expansion.
12239
12240 min-nondebug-insn-uid
12241 Use uids starting at this parameter for nondebug insns. The
12242 range below the parameter is reserved exclusively for debug
12243 insns created by -fvar-tracking-assignments, but debug insns
12244 may get (non-overlapping) uids above it if the reserved range
12245 is exhausted.
12246
12247 ipa-sra-ptr-growth-factor
12248 IPA-SRA replaces a pointer to an aggregate with one or more new
12249 parameters only when their cumulative size is less or equal to
12250 ipa-sra-ptr-growth-factor times the size of the original
12251 pointer parameter.
12252
12253 ipa-sra-max-replacements
12254 Maximum pieces of an aggregate that IPA-SRA tracks. As a
12255 consequence, it is also the maximum number of replacements of a
12256 formal parameter.
12257
12258 sra-max-scalarization-size-Ospeed
12259 sra-max-scalarization-size-Osize
12260 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA)
12261 aim to replace scalar parts of aggregates with uses of
12262 independent scalar variables. These parameters control the
12263 maximum size, in storage units, of aggregate which is
12264 considered for replacement when compiling for speed (sra-max-
12265 scalarization-size-Ospeed) or size (sra-max-scalarization-size-
12266 Osize) respectively.
12267
12268 sra-max-propagations
12269 The maximum number of artificial accesses that Scalar
12270 Replacement of Aggregates (SRA) will track, per one local
12271 variable, in order to facilitate copy propagation.
12272
12273 tm-max-aggregate-size
12274 When making copies of thread-local variables in a transaction,
12275 this parameter specifies the size in bytes after which
12276 variables are saved with the logging functions as opposed to
12277 save/restore code sequence pairs. This option only applies
12278 when using -fgnu-tm.
12279
12280 graphite-max-nb-scop-params
12281 To avoid exponential effects in the Graphite loop transforms,
12282 the number of parameters in a Static Control Part (SCoP) is
12283 bounded. A value of zero can be used to lift the bound. A
12284 variable whose value is unknown at compilation time and defined
12285 outside a SCoP is a parameter of the SCoP.
12286
12287 loop-block-tile-size
12288 Loop blocking or strip mining transforms, enabled with
12289 -floop-block or -floop-strip-mine, strip mine each loop in the
12290 loop nest by a given number of iterations. The strip length
12291 can be changed using the loop-block-tile-size parameter.
12292
12293 ipa-jump-function-lookups
12294 Specifies number of statements visited during jump function
12295 offset discovery.
12296
12297 ipa-cp-value-list-size
12298 IPA-CP attempts to track all possible values and types passed
12299 to a function's parameter in order to propagate them and
12300 perform devirtualization. ipa-cp-value-list-size is the
12301 maximum number of values and types it stores per one formal
12302 parameter of a function.
12303
12304 ipa-cp-eval-threshold
12305 IPA-CP calculates its own score of cloning profitability
12306 heuristics and performs those cloning opportunities with scores
12307 that exceed ipa-cp-eval-threshold.
12308
12309 ipa-cp-max-recursive-depth
12310 Maximum depth of recursive cloning for self-recursive function.
12311
12312 ipa-cp-min-recursive-probability
12313 Recursive cloning only when the probability of call being
12314 executed exceeds the parameter.
12315
12316 ipa-cp-profile-count-base
12317 When using -fprofile-use option, IPA-CP will consider the
12318 measured execution count of a call graph edge at this
12319 percentage position in their histogram as the basis for its
12320 heuristics calculation.
12321
12322 ipa-cp-recursive-freq-factor
12323 The number of times interprocedural copy propagation expects
12324 recursive functions to call themselves.
12325
12326 ipa-cp-recursion-penalty
12327 Percentage penalty the recursive functions will receive when
12328 they are evaluated for cloning.
12329
12330 ipa-cp-single-call-penalty
12331 Percentage penalty functions containing a single call to
12332 another function will receive when they are evaluated for
12333 cloning.
12334
12335 ipa-max-agg-items
12336 IPA-CP is also capable to propagate a number of scalar values
12337 passed in an aggregate. ipa-max-agg-items controls the maximum
12338 number of such values per one parameter.
12339
12340 ipa-cp-loop-hint-bonus
12341 When IPA-CP determines that a cloning candidate would make the
12342 number of iterations of a loop known, it adds a bonus of ipa-
12343 cp-loop-hint-bonus to the profitability score of the candidate.
12344
12345 ipa-max-loop-predicates
12346 The maximum number of different predicates IPA will use to
12347 describe when loops in a function have known properties.
12348
12349 ipa-max-aa-steps
12350 During its analysis of function bodies, IPA-CP employs alias
12351 analysis in order to track values pointed to by function
12352 parameters. In order not spend too much time analyzing huge
12353 functions, it gives up and consider all memory clobbered after
12354 examining ipa-max-aa-steps statements modifying memory.
12355
12356 ipa-max-switch-predicate-bounds
12357 Maximal number of boundary endpoints of case ranges of switch
12358 statement. For switch exceeding this limit, IPA-CP will not
12359 construct cloning cost predicate, which is used to estimate
12360 cloning benefit, for default case of the switch statement.
12361
12362 ipa-max-param-expr-ops
12363 IPA-CP will analyze conditional statement that references some
12364 function parameter to estimate benefit for cloning upon certain
12365 constant value. But if number of operations in a parameter
12366 expression exceeds ipa-max-param-expr-ops, the expression is
12367 treated as complicated one, and is not handled by IPA analysis.
12368
12369 lto-partitions
12370 Specify desired number of partitions produced during WHOPR
12371 compilation. The number of partitions should exceed the number
12372 of CPUs used for compilation.
12373
12374 lto-min-partition
12375 Size of minimal partition for WHOPR (in estimated
12376 instructions). This prevents expenses of splitting very small
12377 programs into too many partitions.
12378
12379 lto-max-partition
12380 Size of max partition for WHOPR (in estimated instructions).
12381 to provide an upper bound for individual size of partition.
12382 Meant to be used only with balanced partitioning.
12383
12384 lto-max-streaming-parallelism
12385 Maximal number of parallel processes used for LTO streaming.
12386
12387 cxx-max-namespaces-for-diagnostic-help
12388 The maximum number of namespaces to consult for suggestions
12389 when C++ name lookup fails for an identifier.
12390
12391 sink-frequency-threshold
12392 The maximum relative execution frequency (in percents) of the
12393 target block relative to a statement's original block to allow
12394 statement sinking of a statement. Larger numbers result in
12395 more aggressive statement sinking. A small positive adjustment
12396 is applied for statements with memory operands as those are
12397 even more profitable so sink.
12398
12399 max-stores-to-sink
12400 The maximum number of conditional store pairs that can be sunk.
12401 Set to 0 if either vectorization (-ftree-vectorize) or if-
12402 conversion (-ftree-loop-if-convert) is disabled.
12403
12404 case-values-threshold
12405 The smallest number of different values for which it is best to
12406 use a jump-table instead of a tree of conditional branches. If
12407 the value is 0, use the default for the machine.
12408
12409 jump-table-max-growth-ratio-for-size
12410 The maximum code size growth ratio when expanding into a jump
12411 table (in percent). The parameter is used when optimizing for
12412 size.
12413
12414 jump-table-max-growth-ratio-for-speed
12415 The maximum code size growth ratio when expanding into a jump
12416 table (in percent). The parameter is used when optimizing for
12417 speed.
12418
12419 tree-reassoc-width
12420 Set the maximum number of instructions executed in parallel in
12421 reassociated tree. This parameter overrides target dependent
12422 heuristics used by default if has non zero value.
12423
12424 sched-pressure-algorithm
12425 Choose between the two available implementations of
12426 -fsched-pressure. Algorithm 1 is the original implementation
12427 and is the more likely to prevent instructions from being
12428 reordered. Algorithm 2 was designed to be a compromise between
12429 the relatively conservative approach taken by algorithm 1 and
12430 the rather aggressive approach taken by the default scheduler.
12431 It relies more heavily on having a regular register file and
12432 accurate register pressure classes. See haifa-sched.cc in the
12433 GCC sources for more details.
12434
12435 The default choice depends on the target.
12436
12437 max-slsr-cand-scan
12438 Set the maximum number of existing candidates that are
12439 considered when seeking a basis for a new straight-line
12440 strength reduction candidate.
12441
12442 asan-globals
12443 Enable buffer overflow detection for global objects. This kind
12444 of protection is enabled by default if you are using
12445 -fsanitize=address option. To disable global objects
12446 protection use --param asan-globals=0.
12447
12448 asan-stack
12449 Enable buffer overflow detection for stack objects. This kind
12450 of protection is enabled by default when using
12451 -fsanitize=address. To disable stack protection use --param
12452 asan-stack=0 option.
12453
12454 asan-instrument-reads
12455 Enable buffer overflow detection for memory reads. This kind
12456 of protection is enabled by default when using
12457 -fsanitize=address. To disable memory reads protection use
12458 --param asan-instrument-reads=0.
12459
12460 asan-instrument-writes
12461 Enable buffer overflow detection for memory writes. This kind
12462 of protection is enabled by default when using
12463 -fsanitize=address. To disable memory writes protection use
12464 --param asan-instrument-writes=0 option.
12465
12466 asan-memintrin
12467 Enable detection for built-in functions. This kind of
12468 protection is enabled by default when using -fsanitize=address.
12469 To disable built-in functions protection use --param
12470 asan-memintrin=0.
12471
12472 asan-use-after-return
12473 Enable detection of use-after-return. This kind of protection
12474 is enabled by default when using the -fsanitize=address option.
12475 To disable it use --param asan-use-after-return=0.
12476
12477 Note: By default the check is disabled at run time. To enable
12478 it, add "detect_stack_use_after_return=1" to the environment
12479 variable ASAN_OPTIONS.
12480
12481 asan-instrumentation-with-call-threshold
12482 If number of memory accesses in function being instrumented is
12483 greater or equal to this number, use callbacks instead of
12484 inline checks. E.g. to disable inline code use --param
12485 asan-instrumentation-with-call-threshold=0.
12486
12487 hwasan-instrument-stack
12488 Enable hwasan instrumentation of statically sized stack-
12489 allocated variables. This kind of instrumentation is enabled
12490 by default when using -fsanitize=hwaddress and disabled by
12491 default when using -fsanitize=kernel-hwaddress. To disable
12492 stack instrumentation use --param hwasan-instrument-stack=0,
12493 and to enable it use --param hwasan-instrument-stack=1.
12494
12495 hwasan-random-frame-tag
12496 When using stack instrumentation, decide tags for stack
12497 variables using a deterministic sequence beginning at a random
12498 tag for each frame. With this parameter unset tags are chosen
12499 using the same sequence but beginning from 1. This is enabled
12500 by default for -fsanitize=hwaddress and unavailable for
12501 -fsanitize=kernel-hwaddress. To disable it use --param
12502 hwasan-random-frame-tag=0.
12503
12504 hwasan-instrument-allocas
12505 Enable hwasan instrumentation of dynamically sized stack-
12506 allocated variables. This kind of instrumentation is enabled
12507 by default when using -fsanitize=hwaddress and disabled by
12508 default when using -fsanitize=kernel-hwaddress. To disable
12509 instrumentation of such variables use --param
12510 hwasan-instrument-allocas=0, and to enable it use --param
12511 hwasan-instrument-allocas=1.
12512
12513 hwasan-instrument-reads
12514 Enable hwasan checks on memory reads. Instrumentation of reads
12515 is enabled by default for both -fsanitize=hwaddress and
12516 -fsanitize=kernel-hwaddress. To disable checking memory reads
12517 use --param hwasan-instrument-reads=0.
12518
12519 hwasan-instrument-writes
12520 Enable hwasan checks on memory writes. Instrumentation of
12521 writes is enabled by default for both -fsanitize=hwaddress and
12522 -fsanitize=kernel-hwaddress. To disable checking memory writes
12523 use --param hwasan-instrument-writes=0.
12524
12525 hwasan-instrument-mem-intrinsics
12526 Enable hwasan instrumentation of builtin functions.
12527 Instrumentation of these builtin functions is enabled by
12528 default for both -fsanitize=hwaddress and
12529 -fsanitize=kernel-hwaddress. To disable instrumentation of
12530 builtin functions use --param
12531 hwasan-instrument-mem-intrinsics=0.
12532
12533 use-after-scope-direct-emission-threshold
12534 If the size of a local variable in bytes is smaller or equal to
12535 this number, directly poison (or unpoison) shadow memory
12536 instead of using run-time callbacks.
12537
12538 tsan-distinguish-volatile
12539 Emit special instrumentation for accesses to volatiles.
12540
12541 tsan-instrument-func-entry-exit
12542 Emit instrumentation calls to __tsan_func_entry() and
12543 __tsan_func_exit().
12544
12545 max-fsm-thread-path-insns
12546 Maximum number of instructions to copy when duplicating blocks
12547 on a finite state automaton jump thread path.
12548
12549 max-fsm-thread-length
12550 Maximum number of basic blocks on a jump thread path.
12551
12552 threader-debug
12553 threader-debug=[none|all] Enables verbose dumping of the
12554 threader solver.
12555
12556 parloops-chunk-size
12557 Chunk size of omp schedule for loops parallelized by parloops.
12558
12559 parloops-schedule
12560 Schedule type of omp schedule for loops parallelized by
12561 parloops (static, dynamic, guided, auto, runtime).
12562
12563 parloops-min-per-thread
12564 The minimum number of iterations per thread of an innermost
12565 parallelized loop for which the parallelized variant is
12566 preferred over the single threaded one. Note that for a
12567 parallelized loop nest the minimum number of iterations of the
12568 outermost loop per thread is two.
12569
12570 max-ssa-name-query-depth
12571 Maximum depth of recursion when querying properties of SSA
12572 names in things like fold routines. One level of recursion
12573 corresponds to following a use-def chain.
12574
12575 max-speculative-devirt-maydefs
12576 The maximum number of may-defs we analyze when looking for a
12577 must-def specifying the dynamic type of an object that invokes
12578 a virtual call we may be able to devirtualize speculatively.
12579
12580 max-vrp-switch-assertions
12581 The maximum number of assertions to add along the default edge
12582 of a switch statement during VRP.
12583
12584 evrp-sparse-threshold
12585 Maximum number of basic blocks before EVRP uses a sparse cache.
12586
12587 evrp-mode
12588 Specifies the mode Early VRP should operate in.
12589
12590 vrp1-mode
12591 Specifies the mode VRP pass 1 should operate in.
12592
12593 vrp2-mode
12594 Specifies the mode VRP pass 2 should operate in.
12595
12596 ranger-debug
12597 Specifies the type of debug output to be issued for ranges.
12598
12599 evrp-switch-limit
12600 Specifies the maximum number of switch cases before EVRP
12601 ignores a switch.
12602
12603 unroll-jam-min-percent
12604 The minimum percentage of memory references that must be
12605 optimized away for the unroll-and-jam transformation to be
12606 considered profitable.
12607
12608 unroll-jam-max-unroll
12609 The maximum number of times the outer loop should be unrolled
12610 by the unroll-and-jam transformation.
12611
12612 max-rtl-if-conversion-unpredictable-cost
12613 Maximum permissible cost for the sequence that would be
12614 generated by the RTL if-conversion pass for a branch that is
12615 considered unpredictable.
12616
12617 max-variable-expansions-in-unroller
12618 If -fvariable-expansion-in-unroller is used, the maximum number
12619 of times that an individual variable will be expanded during
12620 loop unrolling.
12621
12622 partial-inlining-entry-probability
12623 Maximum probability of the entry BB of split region (in percent
12624 relative to entry BB of the function) to make partial inlining
12625 happen.
12626
12627 max-tracked-strlens
12628 Maximum number of strings for which strlen optimization pass
12629 will track string lengths.
12630
12631 gcse-after-reload-partial-fraction
12632 The threshold ratio for performing partial redundancy
12633 elimination after reload.
12634
12635 gcse-after-reload-critical-fraction
12636 The threshold ratio of critical edges execution count that
12637 permit performing redundancy elimination after reload.
12638
12639 max-loop-header-insns
12640 The maximum number of insns in loop header duplicated by the
12641 copy loop headers pass.
12642
12643 vect-epilogues-nomask
12644 Enable loop epilogue vectorization using smaller vector size.
12645
12646 vect-partial-vector-usage
12647 Controls when the loop vectorizer considers using partial
12648 vector loads and stores as an alternative to falling back to
12649 scalar code. 0 stops the vectorizer from ever using partial
12650 vector loads and stores. 1 allows partial vector loads and
12651 stores if vectorization removes the need for the code to
12652 iterate. 2 allows partial vector loads and stores in all
12653 loops. The parameter only has an effect on targets that
12654 support partial vector loads and stores.
12655
12656 vect-inner-loop-cost-factor
12657 The maximum factor which the loop vectorizer applies to the
12658 cost of statements in an inner loop relative to the loop being
12659 vectorized. The factor applied is the maximum of the estimated
12660 number of iterations of the inner loop and this parameter. The
12661 default value of this parameter is 50.
12662
12663 vect-induction-float
12664 Enable loop vectorization of floating point inductions.
12665
12666 avoid-fma-max-bits
12667 Maximum number of bits for which we avoid creating FMAs.
12668
12669 sms-loop-average-count-threshold
12670 A threshold on the average loop count considered by the swing
12671 modulo scheduler.
12672
12673 sms-dfa-history
12674 The number of cycles the swing modulo scheduler considers when
12675 checking conflicts using DFA.
12676
12677 graphite-allow-codegen-errors
12678 Whether codegen errors should be ICEs when -fchecking.
12679
12680 sms-max-ii-factor
12681 A factor for tuning the upper bound that swing modulo scheduler
12682 uses for scheduling a loop.
12683
12684 lra-max-considered-reload-pseudos
12685 The max number of reload pseudos which are considered during
12686 spilling a non-reload pseudo.
12687
12688 max-pow-sqrt-depth
12689 Maximum depth of sqrt chains to use when synthesizing
12690 exponentiation by a real constant.
12691
12692 max-dse-active-local-stores
12693 Maximum number of active local stores in RTL dead store
12694 elimination.
12695
12696 asan-instrument-allocas
12697 Enable asan allocas/VLAs protection.
12698
12699 max-iterations-computation-cost
12700 Bound on the cost of an expression to compute the number of
12701 iterations.
12702
12703 max-isl-operations
12704 Maximum number of isl operations, 0 means unlimited.
12705
12706 graphite-max-arrays-per-scop
12707 Maximum number of arrays per scop.
12708
12709 max-vartrack-reverse-op-size
12710 Max. size of loc list for which reverse ops should be added.
12711
12712 fsm-scale-path-stmts
12713 Scale factor to apply to the number of statements in a
12714 threading path when comparing to the number of (scaled) blocks.
12715
12716 uninit-control-dep-attempts
12717 Maximum number of nested calls to search for control
12718 dependencies during uninitialized variable analysis.
12719
12720 fsm-scale-path-blocks
12721 Scale factor to apply to the number of blocks in a threading
12722 path when comparing to the number of (scaled) statements.
12723
12724 sched-autopref-queue-depth
12725 Hardware autoprefetcher scheduler model control flag. Number
12726 of lookahead cycles the model looks into; at ' ' only enable
12727 instruction sorting heuristic.
12728
12729 loop-versioning-max-inner-insns
12730 The maximum number of instructions that an inner loop can have
12731 before the loop versioning pass considers it too big to copy.
12732
12733 loop-versioning-max-outer-insns
12734 The maximum number of instructions that an outer loop can have
12735 before the loop versioning pass considers it too big to copy,
12736 discounting any instructions in inner loops that directly
12737 benefit from versioning.
12738
12739 ssa-name-def-chain-limit
12740 The maximum number of SSA_NAME assignments to follow in
12741 determining a property of a variable such as its value. This
12742 limits the number of iterations or recursive calls GCC performs
12743 when optimizing certain statements or when determining their
12744 validity prior to issuing diagnostics.
12745
12746 store-merging-max-size
12747 Maximum size of a single store merging region in bytes.
12748
12749 hash-table-verification-limit
12750 The number of elements for which hash table verification is
12751 done for each searched element.
12752
12753 max-find-base-term-values
12754 Maximum number of VALUEs handled during a single find_base_term
12755 call.
12756
12757 analyzer-max-enodes-per-program-point
12758 The maximum number of exploded nodes per program point within
12759 the analyzer, before terminating analysis of that point.
12760
12761 analyzer-max-constraints
12762 The maximum number of constraints per state.
12763
12764 analyzer-min-snodes-for-call-summary
12765 The minimum number of supernodes within a function for the
12766 analyzer to consider summarizing its effects at call sites.
12767
12768 analyzer-max-enodes-for-full-dump
12769 The maximum depth of exploded nodes that should appear in a dot
12770 dump before switching to a less verbose format.
12771
12772 analyzer-max-recursion-depth
12773 The maximum number of times a callsite can appear in a call
12774 stack within the analyzer, before terminating analysis of a
12775 call that would recurse deeper.
12776
12777 analyzer-max-svalue-depth
12778 The maximum depth of a symbolic value, before approximating the
12779 value as unknown.
12780
12781 analyzer-max-infeasible-edges
12782 The maximum number of infeasible edges to reject before
12783 declaring a diagnostic as infeasible.
12784
12785 gimple-fe-computed-hot-bb-threshold
12786 The number of executions of a basic block which is considered
12787 hot. The parameter is used only in GIMPLE FE.
12788
12789 analyzer-bb-explosion-factor
12790 The maximum number of 'after supernode' exploded nodes within
12791 the analyzer per supernode, before terminating analysis.
12792
12793 ranger-logical-depth
12794 Maximum depth of logical expression evaluation ranger will look
12795 through when evaluating outgoing edge ranges.
12796
12797 relation-block-limit
12798 Maximum number of relations the oracle will register in a basic
12799 block.
12800
12801 min-pagesize
12802 Minimum page size for warning purposes.
12803
12804 openacc-kernels
12805 Specify mode of OpenACC `kernels' constructs handling. With
12806 --param=openacc-kernels=decompose, OpenACC `kernels' constructs
12807 are decomposed into parts, a sequence of compute constructs,
12808 each then handled individually. This is work in progress.
12809 With --param=openacc-kernels=parloops, OpenACC `kernels'
12810 constructs are handled by the parloops pass, en bloc. This is
12811 the current default.
12812
12813 openacc-privatization
12814 Specify mode of OpenACC privatization diagnostics for
12815 -fopt-info-omp-note and applicable -fdump-tree-*-details. With
12816 --param=openacc-privatization=quiet, don't diagnose. This is
12817 the current default. With --param=openacc-privatization=noisy,
12818 do diagnose.
12819
12820 The following choices of name are available on AArch64 targets:
12821
12822 aarch64-sve-compare-costs
12823 When vectorizing for SVE, consider using "unpacked" vectors for
12824 smaller elements and use the cost model to pick the cheapest
12825 approach. Also use the cost model to choose between SVE and
12826 Advanced SIMD vectorization.
12827
12828 Using unpacked vectors includes storing smaller elements in
12829 larger containers and accessing elements with extending loads
12830 and truncating stores.
12831
12832 aarch64-float-recp-precision
12833 The number of Newton iterations for calculating the reciprocal
12834 for float type. The precision of division is proportional to
12835 this param when division approximation is enabled. The default
12836 value is 1.
12837
12838 aarch64-double-recp-precision
12839 The number of Newton iterations for calculating the reciprocal
12840 for double type. The precision of division is propotional to
12841 this param when division approximation is enabled. The default
12842 value is 2.
12843
12844 aarch64-autovec-preference
12845 Force an ISA selection strategy for auto-vectorization.
12846 Accepts values from 0 to 4, inclusive.
12847
12848 0 Use the default heuristics.
12849
12850 1 Use only Advanced SIMD for auto-vectorization.
12851
12852 2 Use only SVE for auto-vectorization.
12853
12854 3 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when
12855 the costs are deemed equal.
12856
12857 4 Use both Advanced SIMD and SVE. Prefer SVE when the costs
12858 are deemed equal.
12859
12860 The default value is 0.
12861
12862 aarch64-loop-vect-issue-rate-niters
12863 The tuning for some AArch64 CPUs tries to take both latencies
12864 and issue rates into account when deciding whether a loop
12865 should be vectorized using SVE, vectorized using Advanced SIMD,
12866 or not vectorized at all. If this parameter is set to n, GCC
12867 will not use this heuristic for loops that are known to execute
12868 in fewer than n Advanced SIMD iterations.
12869
12870 aarch64-vect-unroll-limit
12871 The vectorizer will use available tuning information to
12872 determine whether it would be beneficial to unroll the main
12873 vectorized loop and by how much. This parameter set's the
12874 upper bound of how much the vectorizer will unroll the main
12875 loop. The default value is four.
12876
12877 The following choices of name are available on i386 and x86_64
12878 targets:
12879
12880 x86-stlf-window-ninsns
12881 Instructions number above which STFL stall penalty can be
12882 compensated.
12883
12884 Program Instrumentation Options
12885 GCC supports a number of command-line options that control adding run-
12886 time instrumentation to the code it normally generates. For example,
12887 one purpose of instrumentation is collect profiling statistics for use
12888 in finding program hot spots, code coverage analysis, or profile-guided
12889 optimizations. Another class of program instrumentation is adding run-
12890 time checking to detect programming errors like invalid pointer
12891 dereferences or out-of-bounds array accesses, as well as deliberately
12892 hostile attacks such as stack smashing or C++ vtable hijacking. There
12893 is also a general hook which can be used to implement other forms of
12894 tracing or function-level instrumentation for debug or program analysis
12895 purposes.
12896
12897 -p
12898 -pg Generate extra code to write profile information suitable for the
12899 analysis program prof (for -p) or gprof (for -pg). You must use
12900 this option when compiling the source files you want data about,
12901 and you must also use it when linking.
12902
12903 You can use the function attribute "no_instrument_function" to
12904 suppress profiling of individual functions when compiling with
12905 these options.
12906
12907 -fprofile-arcs
12908 Add code so that program flow arcs are instrumented. During
12909 execution the program records how many times each branch and call
12910 is executed and how many times it is taken or returns. On targets
12911 that support constructors with priority support, profiling properly
12912 handles constructors, destructors and C++ constructors (and
12913 destructors) of classes which are used as a type of a global
12914 variable.
12915
12916 When the compiled program exits it saves this data to a file called
12917 auxname.gcda for each source file. The data may be used for
12918 profile-directed optimizations (-fbranch-probabilities), or for
12919 test coverage analysis (-ftest-coverage). Each object file's
12920 auxname is generated from the name of the output file, if
12921 explicitly specified and it is not the final executable, otherwise
12922 it is the basename of the source file. In both cases any suffix is
12923 removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda
12924 for output file specified as -o dir/foo.o).
12925
12926 Note that if a command line directly links source files, the
12927 corresponding .gcda files will be prefixed with the unsuffixed name
12928 of the output file. E.g. "gcc a.c b.c -o binary" would generate
12929 binary-a.gcda and binary-b.gcda files.
12930
12931 --coverage
12932 This option is used to compile and link code instrumented for
12933 coverage analysis. The option is a synonym for -fprofile-arcs
12934 -ftest-coverage (when compiling) and -lgcov (when linking). See
12935 the documentation for those options for more details.
12936
12937 * Compile the source files with -fprofile-arcs plus optimization
12938 and code generation options. For test coverage analysis, use
12939 the additional -ftest-coverage option. You do not need to
12940 profile every source file in a program.
12941
12942 * Compile the source files additionally with -fprofile-abs-path
12943 to create absolute path names in the .gcno files. This allows
12944 gcov to find the correct sources in projects where compilations
12945 occur with different working directories.
12946
12947 * Link your object files with -lgcov or -fprofile-arcs (the
12948 latter implies the former).
12949
12950 * Run the program on a representative workload to generate the
12951 arc profile information. This may be repeated any number of
12952 times. You can run concurrent instances of your program, and
12953 provided that the file system supports locking, the data files
12954 will be correctly updated. Unless a strict ISO C dialect
12955 option is in effect, "fork" calls are detected and correctly
12956 handled without double counting.
12957
12958 Moreover, an object file can be recompiled multiple times and
12959 the corresponding .gcda file merges as long as the source file
12960 and the compiler options are unchanged.
12961
12962 * For profile-directed optimizations, compile the source files
12963 again with the same optimization and code generation options
12964 plus -fbranch-probabilities.
12965
12966 * For test coverage analysis, use gcov to produce human readable
12967 information from the .gcno and .gcda files. Refer to the gcov
12968 documentation for further information.
12969
12970 With -fprofile-arcs, for each function of your program GCC creates
12971 a program flow graph, then finds a spanning tree for the graph.
12972 Only arcs that are not on the spanning tree have to be
12973 instrumented: the compiler adds code to count the number of times
12974 that these arcs are executed. When an arc is the only exit or only
12975 entrance to a block, the instrumentation code can be added to the
12976 block; otherwise, a new basic block must be created to hold the
12977 instrumentation code.
12978
12979 -ftest-coverage
12980 Produce a notes file that the gcov code-coverage utility can use to
12981 show program coverage. Each source file's note file is called
12982 auxname.gcno. Refer to the -fprofile-arcs option above for a
12983 description of auxname and instructions on how to generate test
12984 coverage data. Coverage data matches the source files more closely
12985 if you do not optimize.
12986
12987 -fprofile-abs-path
12988 Automatically convert relative source file names to absolute path
12989 names in the .gcno files. This allows gcov to find the correct
12990 sources in projects where compilations occur with different working
12991 directories.
12992
12993 -fprofile-dir=path
12994 Set the directory to search for the profile data files in to path.
12995 This option affects only the profile data generated by
12996 -fprofile-generate, -ftest-coverage, -fprofile-arcs and used by
12997 -fprofile-use and -fbranch-probabilities and its related options.
12998 Both absolute and relative paths can be used. By default, GCC uses
12999 the current directory as path, thus the profile data file appears
13000 in the same directory as the object file. In order to prevent the
13001 file name clashing, if the object file name is not an absolute
13002 path, we mangle the absolute path of the sourcename.gcda file and
13003 use it as the file name of a .gcda file. See details about the
13004 file naming in -fprofile-arcs. See similar option -fprofile-note.
13005
13006 When an executable is run in a massive parallel environment, it is
13007 recommended to save profile to different folders. That can be done
13008 with variables in path that are exported during run-time:
13009
13010 %p process ID.
13011
13012 %q{VAR}
13013 value of environment variable VAR
13014
13015 -fprofile-generate
13016 -fprofile-generate=path
13017 Enable options usually used for instrumenting application to
13018 produce profile useful for later recompilation with profile
13019 feedback based optimization. You must use -fprofile-generate both
13020 when compiling and when linking your program.
13021
13022 The following options are enabled: -fprofile-arcs,
13023 -fprofile-values, -finline-functions, and -fipa-bit-cp.
13024
13025 If path is specified, GCC looks at the path to find the profile
13026 feedback data files. See -fprofile-dir.
13027
13028 To optimize the program based on the collected profile information,
13029 use -fprofile-use.
13030
13031 -fprofile-info-section
13032 -fprofile-info-section=name
13033 Register the profile information in the specified section instead
13034 of using a constructor/destructor. The section name is name if it
13035 is specified, otherwise the section name defaults to ".gcov_info".
13036 A pointer to the profile information generated by -fprofile-arcs is
13037 placed in the specified section for each translation unit. This
13038 option disables the profile information registration through a
13039 constructor and it disables the profile information processing
13040 through a destructor. This option is not intended to be used in
13041 hosted environments such as GNU/Linux. It targets free-standing
13042 environments (for example embedded systems) with limited resources
13043 which do not support constructors/destructors or the C library file
13044 I/O.
13045
13046 The linker could collect the input sections in a continuous memory
13047 block and define start and end symbols. A GNU linker script
13048 example which defines a linker output section follows:
13049
13050 .gcov_info :
13051 {
13052 PROVIDE (__gcov_info_start = .);
13053 KEEP (*(.gcov_info))
13054 PROVIDE (__gcov_info_end = .);
13055 }
13056
13057 The program could dump the profiling information registered in this
13058 linker set for example like this:
13059
13060 #include <gcov.h>
13061 #include <stdio.h>
13062 #include <stdlib.h>
13063
13064 extern const struct gcov_info *__gcov_info_start[];
13065 extern const struct gcov_info *__gcov_info_end[];
13066
13067 static void
13068 filename (const char *f, void *arg)
13069 {
13070 puts (f);
13071 }
13072
13073 static void
13074 dump (const void *d, unsigned n, void *arg)
13075 {
13076 const unsigned char *c = d;
13077
13078 for (unsigned i = 0; i < n; ++i)
13079 printf ("%02x", c[i]);
13080 }
13081
13082 static void *
13083 allocate (unsigned length, void *arg)
13084 {
13085 return malloc (length);
13086 }
13087
13088 static void
13089 dump_gcov_info (void)
13090 {
13091 const struct gcov_info **info = __gcov_info_start;
13092 const struct gcov_info **end = __gcov_info_end;
13093
13094 /* Obfuscate variable to prevent compiler optimizations. */
13095 __asm__ ("" : "+r" (info));
13096
13097 while (info != end)
13098 {
13099 void *arg = NULL;
13100 __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
13101 putchar ('\n');
13102 ++info;
13103 }
13104 }
13105
13106 int
13107 main()
13108 {
13109 dump_gcov_info();
13110 return 0;
13111 }
13112
13113 -fprofile-note=path
13114 If path is specified, GCC saves .gcno file into path location. If
13115 you combine the option with multiple source files, the .gcno file
13116 will be overwritten.
13117
13118 -fprofile-prefix-path=path
13119 This option can be used in combination with
13120 profile-generate=profile_dir and profile-use=profile_dir to inform
13121 GCC where is the base directory of built source tree. By default
13122 profile_dir will contain files with mangled absolute paths of all
13123 object files in the built project. This is not desirable when
13124 directory used to build the instrumented binary differs from the
13125 directory used to build the binary optimized with profile feedback
13126 because the profile data will not be found during the optimized
13127 build. In such setups -fprofile-prefix-path=path with path
13128 pointing to the base directory of the build can be used to strip
13129 the irrelevant part of the path and keep all file names relative to
13130 the main build directory.
13131
13132 -fprofile-prefix-map=old=new
13133 When compiling files residing in directory old, record profiling
13134 information (with --coverage) describing them as if the files
13135 resided in directory new instead. See also -ffile-prefix-map.
13136
13137 -fprofile-update=method
13138 Alter the update method for an application instrumented for profile
13139 feedback based optimization. The method argument should be one of
13140 single, atomic or prefer-atomic. The first one is useful for
13141 single-threaded applications, while the second one prevents profile
13142 corruption by emitting thread-safe code.
13143
13144 Warning: When an application does not properly join all threads (or
13145 creates an detached thread), a profile file can be still corrupted.
13146
13147 Using prefer-atomic would be transformed either to atomic, when
13148 supported by a target, or to single otherwise. The GCC driver
13149 automatically selects prefer-atomic when -pthread is present in the
13150 command line.
13151
13152 -fprofile-filter-files=regex
13153 Instrument only functions from files whose name matches any of the
13154 regular expressions (separated by semi-colons).
13155
13156 For example, -fprofile-filter-files=main\.c;module.*\.c will
13157 instrument only main.c and all C files starting with 'module'.
13158
13159 -fprofile-exclude-files=regex
13160 Instrument only functions from files whose name does not match any
13161 of the regular expressions (separated by semi-colons).
13162
13163 For example, -fprofile-exclude-files=/usr/.* will prevent
13164 instrumentation of all files that are located in the /usr/ folder.
13165
13166 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
13167 Control level of reproducibility of profile gathered by
13168 "-fprofile-generate". This makes it possible to rebuild program
13169 with same outcome which is useful, for example, for distribution
13170 packages.
13171
13172 With -fprofile-reproducible=serial the profile gathered by
13173 -fprofile-generate is reproducible provided the trained program
13174 behaves the same at each invocation of the train run, it is not
13175 multi-threaded and profile data streaming is always done in the
13176 same order. Note that profile streaming happens at the end of
13177 program run but also before "fork" function is invoked.
13178
13179 Note that it is quite common that execution counts of some part of
13180 programs depends, for example, on length of temporary file names or
13181 memory space randomization (that may affect hash-table collision
13182 rate). Such non-reproducible part of programs may be annotated by
13183 "no_instrument_function" function attribute. gcov-dump with -l can
13184 be used to dump gathered data and verify that they are indeed
13185 reproducible.
13186
13187 With -fprofile-reproducible=parallel-runs collected profile stays
13188 reproducible regardless the order of streaming of the data into
13189 gcda files. This setting makes it possible to run multiple
13190 instances of instrumented program in parallel (such as with "make
13191 -j"). This reduces quality of gathered data, in particular of
13192 indirect call profiling.
13193
13194 -fsanitize=address
13195 Enable AddressSanitizer, a fast memory error detector. Memory
13196 access instructions are instrumented to detect out-of-bounds and
13197 use-after-free bugs. The option enables
13198 -fsanitize-address-use-after-scope. See
13199 <https://github.com/google/sanitizers/wiki/AddressSanitizer> for
13200 more details. The run-time behavior can be influenced using the
13201 ASAN_OPTIONS environment variable. When set to "help=1", the
13202 available options are shown at startup of the instrumented program.
13203 See
13204 <https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags>
13205 for a list of supported options. The option cannot be combined
13206 with -fsanitize=thread or -fsanitize=hwaddress. Note that the only
13207 target -fsanitize=hwaddress is currently supported on is AArch64.
13208
13209 -fsanitize=kernel-address
13210 Enable AddressSanitizer for Linux kernel. See
13211 <https://github.com/google/kasan> for more details.
13212
13213 -fsanitize=hwaddress
13214 Enable Hardware-assisted AddressSanitizer, which uses a hardware
13215 ability to ignore the top byte of a pointer to allow the detection
13216 of memory errors with a low memory overhead. Memory access
13217 instructions are instrumented to detect out-of-bounds and use-
13218 after-free bugs. The option enables
13219 -fsanitize-address-use-after-scope. See
13220 <https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html>
13221 for more details. The run-time behavior can be influenced using
13222 the HWASAN_OPTIONS environment variable. When set to "help=1", the
13223 available options are shown at startup of the instrumented program.
13224 The option cannot be combined with -fsanitize=thread or
13225 -fsanitize=address, and is currently only available on AArch64.
13226
13227 -fsanitize=kernel-hwaddress
13228 Enable Hardware-assisted AddressSanitizer for compilation of the
13229 Linux kernel. Similar to -fsanitize=kernel-address but using an
13230 alternate instrumentation method, and similar to
13231 -fsanitize=hwaddress but with instrumentation differences necessary
13232 for compiling the Linux kernel. These differences are to avoid
13233 hwasan library initialization calls and to account for the stack
13234 pointer having a different value in its top byte.
13235
13236 Note: This option has different defaults to the
13237 -fsanitize=hwaddress. Instrumenting the stack and alloca calls are
13238 not on by default but are still possible by specifying the command-
13239 line options --param hwasan-instrument-stack=1 and --param
13240 hwasan-instrument-allocas=1 respectively. Using a random frame tag
13241 is not implemented for kernel instrumentation.
13242
13243 -fsanitize=pointer-compare
13244 Instrument comparison operation (<, <=, >, >=) with pointer
13245 operands. The option must be combined with either
13246 -fsanitize=kernel-address or -fsanitize=address The option cannot
13247 be combined with -fsanitize=thread. Note: By default the check is
13248 disabled at run time. To enable it, add
13249 "detect_invalid_pointer_pairs=2" to the environment variable
13250 ASAN_OPTIONS. Using "detect_invalid_pointer_pairs=1" detects
13251 invalid operation only when both pointers are non-null.
13252
13253 -fsanitize=pointer-subtract
13254 Instrument subtraction with pointer operands. The option must be
13255 combined with either -fsanitize=kernel-address or
13256 -fsanitize=address The option cannot be combined with
13257 -fsanitize=thread. Note: By default the check is disabled at run
13258 time. To enable it, add "detect_invalid_pointer_pairs=2" to the
13259 environment variable ASAN_OPTIONS. Using
13260 "detect_invalid_pointer_pairs=1" detects invalid operation only
13261 when both pointers are non-null.
13262
13263 -fsanitize=shadow-call-stack
13264 Enable ShadowCallStack, a security enhancement mechanism used to
13265 protect programs against return address overwrites (e.g. stack
13266 buffer overflows.) It works by saving a function's return address
13267 to a separately allocated shadow call stack in the function
13268 prologue and restoring the return address from the shadow call
13269 stack in the function epilogue. Instrumentation only occurs in
13270 functions that need to save the return address to the stack.
13271
13272 Currently it only supports the aarch64 platform. It is
13273 specifically designed for linux kernels that enable the
13274 CONFIG_SHADOW_CALL_STACK option. For the user space programs,
13275 runtime support is not currently provided in libc and libgcc.
13276 Users who want to use this feature in user space need to provide
13277 their own support for the runtime. It should be noted that this
13278 may cause the ABI rules to be broken.
13279
13280 On aarch64, the instrumentation makes use of the platform register
13281 "x18". This generally means that any code that may run on the same
13282 thread as code compiled with ShadowCallStack must be compiled with
13283 the flag -ffixed-x18, otherwise functions compiled without
13284 -ffixed-x18 might clobber "x18" and so corrupt the shadow stack
13285 pointer.
13286
13287 Also, because there is no userspace runtime support, code compiled
13288 with ShadowCallStack cannot use exception handling. Use
13289 -fno-exceptions to turn off exceptions.
13290
13291 See <https://clang.llvm.org/docs/ShadowCallStack.html> for more
13292 details.
13293
13294 -fsanitize=thread
13295 Enable ThreadSanitizer, a fast data race detector. Memory access
13296 instructions are instrumented to detect data race bugs. See
13297 <https://github.com/google/sanitizers/wiki#threadsanitizer> for
13298 more details. The run-time behavior can be influenced using the
13299 TSAN_OPTIONS environment variable; see
13300 <https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags>
13301 for a list of supported options. The option cannot be combined
13302 with -fsanitize=address, -fsanitize=leak.
13303
13304 Note that sanitized atomic builtins cannot throw exceptions when
13305 operating on invalid memory addresses with non-call exceptions
13306 (-fnon-call-exceptions).
13307
13308 -fsanitize=leak
13309 Enable LeakSanitizer, a memory leak detector. This option only
13310 matters for linking of executables and the executable is linked
13311 against a library that overrides "malloc" and other allocator
13312 functions. See
13313 <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
13314 for more details. The run-time behavior can be influenced using
13315 the LSAN_OPTIONS environment variable. The option cannot be
13316 combined with -fsanitize=thread.
13317
13318 -fsanitize=undefined
13319 Enable UndefinedBehaviorSanitizer, a fast undefined behavior
13320 detector. Various computations are instrumented to detect
13321 undefined behavior at runtime. See
13322 <https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html> for
13323 more details. The run-time behavior can be influenced using the
13324 UBSAN_OPTIONS environment variable. Current suboptions are:
13325
13326 -fsanitize=shift
13327 This option enables checking that the result of a shift
13328 operation is not undefined. Note that what exactly is
13329 considered undefined differs slightly between C and C++, as
13330 well as between ISO C90 and C99, etc. This option has two
13331 suboptions, -fsanitize=shift-base and
13332 -fsanitize=shift-exponent.
13333
13334 -fsanitize=shift-exponent
13335 This option enables checking that the second argument of a
13336 shift operation is not negative and is smaller than the
13337 precision of the promoted first argument.
13338
13339 -fsanitize=shift-base
13340 If the second argument of a shift operation is within range,
13341 check that the result of a shift operation is not undefined.
13342 Note that what exactly is considered undefined differs slightly
13343 between C and C++, as well as between ISO C90 and C99, etc.
13344
13345 -fsanitize=integer-divide-by-zero
13346 Detect integer division by zero.
13347
13348 -fsanitize=unreachable
13349 With this option, the compiler turns the
13350 "__builtin_unreachable" call into a diagnostics message call
13351 instead. When reaching the "__builtin_unreachable" call, the
13352 behavior is undefined.
13353
13354 -fsanitize=vla-bound
13355 This option instructs the compiler to check that the size of a
13356 variable length array is positive.
13357
13358 -fsanitize=null
13359 This option enables pointer checking. Particularly, the
13360 application built with this option turned on will issue an
13361 error message when it tries to dereference a NULL pointer, or
13362 if a reference (possibly an rvalue reference) is bound to a
13363 NULL pointer, or if a method is invoked on an object pointed by
13364 a NULL pointer.
13365
13366 -fsanitize=return
13367 This option enables return statement checking. Programs built
13368 with this option turned on will issue an error message when the
13369 end of a non-void function is reached without actually
13370 returning a value. This option works in C++ only.
13371
13372 -fsanitize=signed-integer-overflow
13373 This option enables signed integer overflow checking. We check
13374 that the result of "+", "*", and both unary and binary "-" does
13375 not overflow in the signed arithmetics. This also detects
13376 "INT_MIN / -1" signed division. Note, integer promotion rules
13377 must be taken into account. That is, the following is not an
13378 overflow:
13379
13380 signed char a = SCHAR_MAX;
13381 a++;
13382
13383 -fsanitize=bounds
13384 This option enables instrumentation of array bounds. Various
13385 out of bounds accesses are detected. Flexible array members,
13386 flexible array member-like arrays, and initializers of
13387 variables with static storage are not instrumented.
13388
13389 -fsanitize=bounds-strict
13390 This option enables strict instrumentation of array bounds.
13391 Most out of bounds accesses are detected, including flexible
13392 array members and flexible array member-like arrays.
13393 Initializers of variables with static storage are not
13394 instrumented.
13395
13396 -fsanitize=alignment
13397 This option enables checking of alignment of pointers when they
13398 are dereferenced, or when a reference is bound to
13399 insufficiently aligned target, or when a method or constructor
13400 is invoked on insufficiently aligned object.
13401
13402 -fsanitize=object-size
13403 This option enables instrumentation of memory references using
13404 the "__builtin_object_size" function. Various out of bounds
13405 pointer accesses are detected.
13406
13407 -fsanitize=float-divide-by-zero
13408 Detect floating-point division by zero. Unlike other similar
13409 options, -fsanitize=float-divide-by-zero is not enabled by
13410 -fsanitize=undefined, since floating-point division by zero can
13411 be a legitimate way of obtaining infinities and NaNs.
13412
13413 -fsanitize=float-cast-overflow
13414 This option enables floating-point type to integer conversion
13415 checking. We check that the result of the conversion does not
13416 overflow. Unlike other similar options,
13417 -fsanitize=float-cast-overflow is not enabled by
13418 -fsanitize=undefined. This option does not work well with
13419 "FE_INVALID" exceptions enabled.
13420
13421 -fsanitize=nonnull-attribute
13422 This option enables instrumentation of calls, checking whether
13423 null values are not passed to arguments marked as requiring a
13424 non-null value by the "nonnull" function attribute.
13425
13426 -fsanitize=returns-nonnull-attribute
13427 This option enables instrumentation of return statements in
13428 functions marked with "returns_nonnull" function attribute, to
13429 detect returning of null values from such functions.
13430
13431 -fsanitize=bool
13432 This option enables instrumentation of loads from bool. If a
13433 value other than 0/1 is loaded, a run-time error is issued.
13434
13435 -fsanitize=enum
13436 This option enables instrumentation of loads from an enum type.
13437 If a value outside the range of values for the enum type is
13438 loaded, a run-time error is issued.
13439
13440 -fsanitize=vptr
13441 This option enables instrumentation of C++ member function
13442 calls, member accesses and some conversions between pointers to
13443 base and derived classes, to verify the referenced object has
13444 the correct dynamic type.
13445
13446 -fsanitize=pointer-overflow
13447 This option enables instrumentation of pointer arithmetics. If
13448 the pointer arithmetics overflows, a run-time error is issued.
13449
13450 -fsanitize=builtin
13451 This option enables instrumentation of arguments to selected
13452 builtin functions. If an invalid value is passed to such
13453 arguments, a run-time error is issued. E.g. passing 0 as the
13454 argument to "__builtin_ctz" or "__builtin_clz" invokes
13455 undefined behavior and is diagnosed by this option.
13456
13457 While -ftrapv causes traps for signed overflows to be emitted,
13458 -fsanitize=undefined gives a diagnostic message. This currently
13459 works only for the C family of languages.
13460
13461 -fno-sanitize=all
13462 This option disables all previously enabled sanitizers.
13463 -fsanitize=all is not allowed, as some sanitizers cannot be used
13464 together.
13465
13466 -fasan-shadow-offset=number
13467 This option forces GCC to use custom shadow offset in
13468 AddressSanitizer checks. It is useful for experimenting with
13469 different shadow memory layouts in Kernel AddressSanitizer.
13470
13471 -fsanitize-sections=s1,s2,...
13472 Sanitize global variables in selected user-defined sections. si
13473 may contain wildcards.
13474
13475 -fsanitize-recover[=opts]
13476 -fsanitize-recover= controls error recovery mode for sanitizers
13477 mentioned in comma-separated list of opts. Enabling this option
13478 for a sanitizer component causes it to attempt to continue running
13479 the program as if no error happened. This means multiple runtime
13480 errors can be reported in a single program run, and the exit code
13481 of the program may indicate success even when errors have been
13482 reported. The -fno-sanitize-recover= option can be used to alter
13483 this behavior: only the first detected error is reported and
13484 program then exits with a non-zero exit code.
13485
13486 Currently this feature only works for -fsanitize=undefined (and its
13487 suboptions except for -fsanitize=unreachable and
13488 -fsanitize=return), -fsanitize=float-cast-overflow,
13489 -fsanitize=float-divide-by-zero, -fsanitize=bounds-strict,
13490 -fsanitize=kernel-address and -fsanitize=address. For these
13491 sanitizers error recovery is turned on by default, except
13492 -fsanitize=address, for which this feature is experimental.
13493 -fsanitize-recover=all and -fno-sanitize-recover=all is also
13494 accepted, the former enables recovery for all sanitizers that
13495 support it, the latter disables recovery for all sanitizers that
13496 support it.
13497
13498 Even if a recovery mode is turned on the compiler side, it needs to
13499 be also enabled on the runtime library side, otherwise the failures
13500 are still fatal. The runtime library defaults to "halt_on_error=0"
13501 for ThreadSanitizer and UndefinedBehaviorSanitizer, while default
13502 value for AddressSanitizer is "halt_on_error=1". This can be
13503 overridden through setting the "halt_on_error" flag in the
13504 corresponding environment variable.
13505
13506 Syntax without an explicit opts parameter is deprecated. It is
13507 equivalent to specifying an opts list of:
13508
13509 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
13510
13511 -fsanitize-address-use-after-scope
13512 Enable sanitization of local variables to detect use-after-scope
13513 bugs. The option sets -fstack-reuse to none.
13514
13515 -fsanitize-undefined-trap-on-error
13516 The -fsanitize-undefined-trap-on-error option instructs the
13517 compiler to report undefined behavior using "__builtin_trap" rather
13518 than a "libubsan" library routine. The advantage of this is that
13519 the "libubsan" library is not needed and is not linked in, so this
13520 is usable even in freestanding environments.
13521
13522 -fsanitize-coverage=trace-pc
13523 Enable coverage-guided fuzzing code instrumentation. Inserts a
13524 call to "__sanitizer_cov_trace_pc" into every basic block.
13525
13526 -fsanitize-coverage=trace-cmp
13527 Enable dataflow guided fuzzing code instrumentation. Inserts a
13528 call to "__sanitizer_cov_trace_cmp1", "__sanitizer_cov_trace_cmp2",
13529 "__sanitizer_cov_trace_cmp4" or "__sanitizer_cov_trace_cmp8" for
13530 integral comparison with both operands variable or
13531 "__sanitizer_cov_trace_const_cmp1",
13532 "__sanitizer_cov_trace_const_cmp2",
13533 "__sanitizer_cov_trace_const_cmp4" or
13534 "__sanitizer_cov_trace_const_cmp8" for integral comparison with one
13535 operand constant, "__sanitizer_cov_trace_cmpf" or
13536 "__sanitizer_cov_trace_cmpd" for float or double comparisons and
13537 "__sanitizer_cov_trace_switch" for switch statements.
13538
13539 -fcf-protection=[full|branch|return|none|check]
13540 Enable code instrumentation of control-flow transfers to increase
13541 program security by checking that target addresses of control-flow
13542 transfer instructions (such as indirect function call, function
13543 return, indirect jump) are valid. This prevents diverting the flow
13544 of control to an unexpected target. This is intended to protect
13545 against such threats as Return-oriented Programming (ROP), and
13546 similarly call/jmp-oriented programming (COP/JOP).
13547
13548 The value "branch" tells the compiler to implement checking of
13549 validity of control-flow transfer at the point of indirect branch
13550 instructions, i.e. call/jmp instructions. The value "return"
13551 implements checking of validity at the point of returning from a
13552 function. The value "full" is an alias for specifying both
13553 "branch" and "return". The value "none" turns off instrumentation.
13554
13555 The value "check" is used for the final link with link-time
13556 optimization (LTO). An error is issued if LTO object files are
13557 compiled with different -fcf-protection values. The value "check"
13558 is ignored at the compile time.
13559
13560 The macro "__CET__" is defined when -fcf-protection is used. The
13561 first bit of "__CET__" is set to 1 for the value "branch" and the
13562 second bit of "__CET__" is set to 1 for the "return".
13563
13564 You can also use the "nocf_check" attribute to identify which
13565 functions and calls should be skipped from instrumentation.
13566
13567 Currently the x86 GNU/Linux target provides an implementation based
13568 on Intel Control-flow Enforcement Technology (CET) which works for
13569 i686 processor or newer.
13570
13571 -fharden-compares
13572 For every logical test that survives gimple optimizations and is
13573 not the condition in a conditional branch (for example, conditions
13574 tested for conditional moves, or to store in boolean variables),
13575 emit extra code to compute and verify the reversed condition, and
13576 to call "__builtin_trap" if the results do not match. Use with
13577 -fharden-conditional-branches to cover all conditionals.
13578
13579 -fharden-conditional-branches
13580 For every non-vectorized conditional branch that survives gimple
13581 optimizations, emit extra code to compute and verify the reversed
13582 condition, and to call "__builtin_trap" if the result is
13583 unexpected. Use with -fharden-compares to cover all conditionals.
13584
13585 -fstack-protector
13586 Emit extra code to check for buffer overflows, such as stack
13587 smashing attacks. This is done by adding a guard variable to
13588 functions with vulnerable objects. This includes functions that
13589 call "alloca", and functions with buffers larger than or equal to 8
13590 bytes. The guards are initialized when a function is entered and
13591 then checked when the function exits. If a guard check fails, an
13592 error message is printed and the program exits. Only variables
13593 that are actually allocated on the stack are considered, optimized
13594 away variables or variables allocated in registers don't count.
13595
13596 -fstack-protector-all
13597 Like -fstack-protector except that all functions are protected.
13598
13599 -fstack-protector-strong
13600 Like -fstack-protector but includes additional functions to be
13601 protected --- those that have local array definitions, or have
13602 references to local frame addresses. Only variables that are
13603 actually allocated on the stack are considered, optimized away
13604 variables or variables allocated in registers don't count.
13605
13606 -fstack-protector-explicit
13607 Like -fstack-protector but only protects those functions which have
13608 the "stack_protect" attribute.
13609
13610 -fstack-check
13611 Generate code to verify that you do not go beyond the boundary of
13612 the stack. You should specify this flag if you are running in an
13613 environment with multiple threads, but you only rarely need to
13614 specify it in a single-threaded environment since stack overflow is
13615 automatically detected on nearly all systems if there is only one
13616 stack.
13617
13618 Note that this switch does not actually cause checking to be done;
13619 the operating system or the language runtime must do that. The
13620 switch causes generation of code to ensure that they see the stack
13621 being extended.
13622
13623 You can additionally specify a string parameter: no means no
13624 checking, generic means force the use of old-style checking,
13625 specific means use the best checking method and is equivalent to
13626 bare -fstack-check.
13627
13628 Old-style checking is a generic mechanism that requires no specific
13629 target support in the compiler but comes with the following
13630 drawbacks:
13631
13632 1. Modified allocation strategy for large objects: they are always
13633 allocated dynamically if their size exceeds a fixed threshold.
13634 Note this may change the semantics of some code.
13635
13636 2. Fixed limit on the size of the static frame of functions: when
13637 it is topped by a particular function, stack checking is not
13638 reliable and a warning is issued by the compiler.
13639
13640 3. Inefficiency: because of both the modified allocation strategy
13641 and the generic implementation, code performance is hampered.
13642
13643 Note that old-style stack checking is also the fallback method for
13644 specific if no target support has been added in the compiler.
13645
13646 -fstack-check= is designed for Ada's needs to detect infinite
13647 recursion and stack overflows. specific is an excellent choice
13648 when compiling Ada code. It is not generally sufficient to protect
13649 against stack-clash attacks. To protect against those you want
13650 -fstack-clash-protection.
13651
13652 -fstack-clash-protection
13653 Generate code to prevent stack clash style attacks. When this
13654 option is enabled, the compiler will only allocate one page of
13655 stack space at a time and each page is accessed immediately after
13656 allocation. Thus, it prevents allocations from jumping over any
13657 stack guard page provided by the operating system.
13658
13659 Most targets do not fully support stack clash protection. However,
13660 on those targets -fstack-clash-protection will protect dynamic
13661 stack allocations. -fstack-clash-protection may also provide
13662 limited protection for static stack allocations if the target
13663 supports -fstack-check=specific.
13664
13665 -fstack-limit-register=reg
13666 -fstack-limit-symbol=sym
13667 -fno-stack-limit
13668 Generate code to ensure that the stack does not grow beyond a
13669 certain value, either the value of a register or the address of a
13670 symbol. If a larger stack is required, a signal is raised at run
13671 time. For most targets, the signal is raised before the stack
13672 overruns the boundary, so it is possible to catch the signal
13673 without taking special precautions.
13674
13675 For instance, if the stack starts at absolute address 0x80000000
13676 and grows downwards, you can use the flags
13677 -fstack-limit-symbol=__stack_limit and
13678 -Wl,--defsym,__stack_limit=0x7ffe0000 to enforce a stack limit of
13679 128KB. Note that this may only work with the GNU linker.
13680
13681 You can locally override stack limit checking by using the
13682 "no_stack_limit" function attribute.
13683
13684 -fsplit-stack
13685 Generate code to automatically split the stack before it overflows.
13686 The resulting program has a discontiguous stack which can only
13687 overflow if the program is unable to allocate any more memory.
13688 This is most useful when running threaded programs, as it is no
13689 longer necessary to calculate a good stack size to use for each
13690 thread. This is currently only implemented for the x86 targets
13691 running GNU/Linux.
13692
13693 When code compiled with -fsplit-stack calls code compiled without
13694 -fsplit-stack, there may not be much stack space available for the
13695 latter code to run. If compiling all code, including library code,
13696 with -fsplit-stack is not an option, then the linker can fix up
13697 these calls so that the code compiled without -fsplit-stack always
13698 has a large stack. Support for this is implemented in the gold
13699 linker in GNU binutils release 2.21 and later.
13700
13701 -fvtable-verify=[std|preinit|none]
13702 This option is only available when compiling C++ code. It turns on
13703 (or off, if using -fvtable-verify=none) the security feature that
13704 verifies at run time, for every virtual call, that the vtable
13705 pointer through which the call is made is valid for the type of the
13706 object, and has not been corrupted or overwritten. If an invalid
13707 vtable pointer is detected at run time, an error is reported and
13708 execution of the program is immediately halted.
13709
13710 This option causes run-time data structures to be built at program
13711 startup, which are used for verifying the vtable pointers. The
13712 options std and preinit control the timing of when these data
13713 structures are built. In both cases the data structures are built
13714 before execution reaches "main". Using -fvtable-verify=std causes
13715 the data structures to be built after shared libraries have been
13716 loaded and initialized. -fvtable-verify=preinit causes them to be
13717 built before shared libraries have been loaded and initialized.
13718
13719 If this option appears multiple times in the command line with
13720 different values specified, none takes highest priority over both
13721 std and preinit; preinit takes priority over std.
13722
13723 -fvtv-debug
13724 When used in conjunction with -fvtable-verify=std or
13725 -fvtable-verify=preinit, causes debug versions of the runtime
13726 functions for the vtable verification feature to be called. This
13727 flag also causes the compiler to log information about which vtable
13728 pointers it finds for each class. This information is written to a
13729 file named vtv_set_ptr_data.log in the directory named by the
13730 environment variable VTV_LOGS_DIR if that is defined or the current
13731 working directory otherwise.
13732
13733 Note: This feature appends data to the log file. If you want a
13734 fresh log file, be sure to delete any existing one.
13735
13736 -fvtv-counts
13737 This is a debugging flag. When used in conjunction with
13738 -fvtable-verify=std or -fvtable-verify=preinit, this causes the
13739 compiler to keep track of the total number of virtual calls it
13740 encounters and the number of verifications it inserts. It also
13741 counts the number of calls to certain run-time library functions
13742 that it inserts and logs this information for each compilation
13743 unit. The compiler writes this information to a file named
13744 vtv_count_data.log in the directory named by the environment
13745 variable VTV_LOGS_DIR if that is defined or the current working
13746 directory otherwise. It also counts the size of the vtable pointer
13747 sets for each class, and writes this information to
13748 vtv_class_set_sizes.log in the same directory.
13749
13750 Note: This feature appends data to the log files. To get fresh
13751 log files, be sure to delete any existing ones.
13752
13753 -finstrument-functions
13754 Generate instrumentation calls for entry and exit to functions.
13755 Just after function entry and just before function exit, the
13756 following profiling functions are called with the address of the
13757 current function and its call site. (On some platforms,
13758 "__builtin_return_address" does not work beyond the current
13759 function, so the call site information may not be available to the
13760 profiling functions otherwise.)
13761
13762 void __cyg_profile_func_enter (void *this_fn,
13763 void *call_site);
13764 void __cyg_profile_func_exit (void *this_fn,
13765 void *call_site);
13766
13767 The first argument is the address of the start of the current
13768 function, which may be looked up exactly in the symbol table.
13769
13770 This instrumentation is also done for functions expanded inline in
13771 other functions. The profiling calls indicate where, conceptually,
13772 the inline function is entered and exited. This means that
13773 addressable versions of such functions must be available. If all
13774 your uses of a function are expanded inline, this may mean an
13775 additional expansion of code size. If you use "extern inline" in
13776 your C code, an addressable version of such functions must be
13777 provided. (This is normally the case anyway, but if you get lucky
13778 and the optimizer always expands the functions inline, you might
13779 have gotten away without providing static copies.)
13780
13781 A function may be given the attribute "no_instrument_function", in
13782 which case this instrumentation is not done. This can be used, for
13783 example, for the profiling functions listed above, high-priority
13784 interrupt routines, and any functions from which the profiling
13785 functions cannot safely be called (perhaps signal handlers, if the
13786 profiling routines generate output or allocate memory).
13787
13788 -finstrument-functions-exclude-file-list=file,file,...
13789 Set the list of functions that are excluded from instrumentation
13790 (see the description of -finstrument-functions). If the file that
13791 contains a function definition matches with one of file, then that
13792 function is not instrumented. The match is done on substrings: if
13793 the file parameter is a substring of the file name, it is
13794 considered to be a match.
13795
13796 For example:
13797
13798 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13799
13800 excludes any inline function defined in files whose pathnames
13801 contain /bits/stl or include/sys.
13802
13803 If, for some reason, you want to include letter , in one of sym,
13804 write ,. For example,
13805 -finstrument-functions-exclude-file-list=',,tmp' (note the single
13806 quote surrounding the option).
13807
13808 -finstrument-functions-exclude-function-list=sym,sym,...
13809 This is similar to -finstrument-functions-exclude-file-list, but
13810 this option sets the list of function names to be excluded from
13811 instrumentation. The function name to be matched is its user-
13812 visible name, such as "vector<int> blah(const vector<int> &)", not
13813 the internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The
13814 match is done on substrings: if the sym parameter is a substring of
13815 the function name, it is considered to be a match. For C99 and C++
13816 extended identifiers, the function name must be given in UTF-8, not
13817 using universal character names.
13818
13819 -fpatchable-function-entry=N[,M]
13820 Generate N NOPs right at the beginning of each function, with the
13821 function entry point before the Mth NOP. If M is omitted, it
13822 defaults to 0 so the function entry points to the address just at
13823 the first NOP. The NOP instructions reserve extra space which can
13824 be used to patch in any desired instrumentation at run time,
13825 provided that the code segment is writable. The amount of space is
13826 controllable indirectly via the number of NOPs; the NOP instruction
13827 used corresponds to the instruction emitted by the internal GCC
13828 back-end interface "gen_nop". This behavior is target-specific and
13829 may also depend on the architecture variant and/or other
13830 compilation options.
13831
13832 For run-time identification, the starting addresses of these areas,
13833 which correspond to their respective function entries minus M, are
13834 additionally collected in the "__patchable_function_entries"
13835 section of the resulting binary.
13836
13837 Note that the value of "__attribute__ ((patchable_function_entry
13838 (N,M)))" takes precedence over command-line option
13839 -fpatchable-function-entry=N,M. This can be used to increase the
13840 area size or to remove it completely on a single function. If
13841 "N=0", no pad location is recorded.
13842
13843 The NOP instructions are inserted at---and maybe before, depending
13844 on M---the function entry address, even before the prologue.
13845
13846 The maximum value of N and M is 65535.
13847
13848 Options Controlling the Preprocessor
13849 These options control the C preprocessor, which is run on each C source
13850 file before actual compilation.
13851
13852 If you use the -E option, nothing is done except preprocessing. Some
13853 of these options make sense only together with -E because they cause
13854 the preprocessor output to be unsuitable for actual compilation.
13855
13856 In addition to the options listed here, there are a number of options
13857 to control search paths for include files documented in Directory
13858 Options. Options to control preprocessor diagnostics are listed in
13859 Warning Options.
13860
13861 -D name
13862 Predefine name as a macro, with definition 1.
13863
13864 -D name=definition
13865 The contents of definition are tokenized and processed as if they
13866 appeared during translation phase three in a #define directive. In
13867 particular, the definition is truncated by embedded newline
13868 characters.
13869
13870 If you are invoking the preprocessor from a shell or shell-like
13871 program you may need to use the shell's quoting syntax to protect
13872 characters such as spaces that have a meaning in the shell syntax.
13873
13874 If you wish to define a function-like macro on the command line,
13875 write its argument list with surrounding parentheses before the
13876 equals sign (if any). Parentheses are meaningful to most shells,
13877 so you should quote the option. With sh and csh,
13878 -D'name(args...)=definition' works.
13879
13880 -D and -U options are processed in the order they are given on the
13881 command line. All -imacros file and -include file options are
13882 processed after all -D and -U options.
13883
13884 -U name
13885 Cancel any previous definition of name, either built in or provided
13886 with a -D option.
13887
13888 -include file
13889 Process file as if "#include "file"" appeared as the first line of
13890 the primary source file. However, the first directory searched for
13891 file is the preprocessor's working directory instead of the
13892 directory containing the main source file. If not found there, it
13893 is searched for in the remainder of the "#include "..."" search
13894 chain as normal.
13895
13896 If multiple -include options are given, the files are included in
13897 the order they appear on the command line.
13898
13899 -imacros file
13900 Exactly like -include, except that any output produced by scanning
13901 file is thrown away. Macros it defines remain defined. This
13902 allows you to acquire all the macros from a header without also
13903 processing its declarations.
13904
13905 All files specified by -imacros are processed before all files
13906 specified by -include.
13907
13908 -undef
13909 Do not predefine any system-specific or GCC-specific macros. The
13910 standard predefined macros remain defined.
13911
13912 -pthread
13913 Define additional macros required for using the POSIX threads
13914 library. You should use this option consistently for both
13915 compilation and linking. This option is supported on GNU/Linux
13916 targets, most other Unix derivatives, and also on x86 Cygwin and
13917 MinGW targets.
13918
13919 -M Instead of outputting the result of preprocessing, output a rule
13920 suitable for make describing the dependencies of the main source
13921 file. The preprocessor outputs one make rule containing the object
13922 file name for that source file, a colon, and the names of all the
13923 included files, including those coming from -include or -imacros
13924 command-line options.
13925
13926 Unless specified explicitly (with -MT or -MQ), the object file name
13927 consists of the name of the source file with any suffix replaced
13928 with object file suffix and with any leading directory parts
13929 removed. If there are many included files then the rule is split
13930 into several lines using \-newline. The rule has no commands.
13931
13932 This option does not suppress the preprocessor's debug output, such
13933 as -dM. To avoid mixing such debug output with the dependency
13934 rules you should explicitly specify the dependency output file with
13935 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
13936 Debug output is still sent to the regular output stream as normal.
13937
13938 Passing -M to the driver implies -E, and suppresses warnings with
13939 an implicit -w.
13940
13941 -MM Like -M but do not mention header files that are found in system
13942 header directories, nor header files that are included, directly or
13943 indirectly, from such a header.
13944
13945 This implies that the choice of angle brackets or double quotes in
13946 an #include directive does not in itself determine whether that
13947 header appears in -MM dependency output.
13948
13949 -MF file
13950 When used with -M or -MM, specifies a file to write the
13951 dependencies to. If no -MF switch is given the preprocessor sends
13952 the rules to the same place it would send preprocessed output.
13953
13954 When used with the driver options -MD or -MMD, -MF overrides the
13955 default dependency output file.
13956
13957 If file is -, then the dependencies are written to stdout.
13958
13959 -MG In conjunction with an option such as -M requesting dependency
13960 generation, -MG assumes missing header files are generated files
13961 and adds them to the dependency list without raising an error. The
13962 dependency filename is taken directly from the "#include" directive
13963 without prepending any path. -MG also suppresses preprocessed
13964 output, as a missing header file renders this useless.
13965
13966 This feature is used in automatic updating of makefiles.
13967
13968 -Mno-modules
13969 Disable dependency generation for compiled module interfaces.
13970
13971 -MP This option instructs CPP to add a phony target for each dependency
13972 other than the main file, causing each to depend on nothing. These
13973 dummy rules work around errors make gives if you remove header
13974 files without updating the Makefile to match.
13975
13976 This is typical output:
13977
13978 test.o: test.c test.h
13979
13980 test.h:
13981
13982 -MT target
13983 Change the target of the rule emitted by dependency generation. By
13984 default CPP takes the name of the main input file, deletes any
13985 directory components and any file suffix such as .c, and appends
13986 the platform's usual object suffix. The result is the target.
13987
13988 An -MT option sets the target to be exactly the string you specify.
13989 If you want multiple targets, you can specify them as a single
13990 argument to -MT, or use multiple -MT options.
13991
13992 For example, -MT '$(objpfx)foo.o' might give
13993
13994 $(objpfx)foo.o: foo.c
13995
13996 -MQ target
13997 Same as -MT, but it quotes any characters which are special to
13998 Make. -MQ '$(objpfx)foo.o' gives
13999
14000 $$(objpfx)foo.o: foo.c
14001
14002 The default target is automatically quoted, as if it were given
14003 with -MQ.
14004
14005 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
14006 The driver determines file based on whether an -o option is given.
14007 If it is, the driver uses its argument but with a suffix of .d,
14008 otherwise it takes the name of the input file, removes any
14009 directory components and suffix, and applies a .d suffix.
14010
14011 If -MD is used in conjunction with -E, any -o switch is understood
14012 to specify the dependency output file, but if used without -E, each
14013 -o is understood to specify a target object file.
14014
14015 Since -E is not implied, -MD can be used to generate a dependency
14016 output file as a side effect of the compilation process.
14017
14018 -MMD
14019 Like -MD except mention only user header files, not system header
14020 files.
14021
14022 -fpreprocessed
14023 Indicate to the preprocessor that the input file has already been
14024 preprocessed. This suppresses things like macro expansion,
14025 trigraph conversion, escaped newline splicing, and processing of
14026 most directives. The preprocessor still recognizes and removes
14027 comments, so that you can pass a file preprocessed with -C to the
14028 compiler without problems. In this mode the integrated
14029 preprocessor is little more than a tokenizer for the front ends.
14030
14031 -fpreprocessed is implicit if the input file has one of the
14032 extensions .i, .ii or .mi. These are the extensions that GCC uses
14033 for preprocessed files created by -save-temps.
14034
14035 -fdirectives-only
14036 When preprocessing, handle directives, but do not expand macros.
14037
14038 The option's behavior depends on the -E and -fpreprocessed options.
14039
14040 With -E, preprocessing is limited to the handling of directives
14041 such as "#define", "#ifdef", and "#error". Other preprocessor
14042 operations, such as macro expansion and trigraph conversion are not
14043 performed. In addition, the -dD option is implicitly enabled.
14044
14045 With -fpreprocessed, predefinition of command line and most builtin
14046 macros is disabled. Macros such as "__LINE__", which are
14047 contextually dependent, are handled normally. This enables
14048 compilation of files previously preprocessed with "-E
14049 -fdirectives-only".
14050
14051 With both -E and -fpreprocessed, the rules for -fpreprocessed take
14052 precedence. This enables full preprocessing of files previously
14053 preprocessed with "-E -fdirectives-only".
14054
14055 -fdollars-in-identifiers
14056 Accept $ in identifiers.
14057
14058 -fextended-identifiers
14059 Accept universal character names and extended characters in
14060 identifiers. This option is enabled by default for C99 (and later
14061 C standard versions) and C++.
14062
14063 -fno-canonical-system-headers
14064 When preprocessing, do not shorten system header paths with
14065 canonicalization.
14066
14067 -fmax-include-depth=depth
14068 Set the maximum depth of the nested #include. The default is 200.
14069
14070 -ftabstop=width
14071 Set the distance between tab stops. This helps the preprocessor
14072 report correct column numbers in warnings or errors, even if tabs
14073 appear on the line. If the value is less than 1 or greater than
14074 100, the option is ignored. The default is 8.
14075
14076 -ftrack-macro-expansion[=level]
14077 Track locations of tokens across macro expansions. This allows the
14078 compiler to emit diagnostic about the current macro expansion stack
14079 when a compilation error occurs in a macro expansion. Using this
14080 option makes the preprocessor and the compiler consume more memory.
14081 The level parameter can be used to choose the level of precision of
14082 token location tracking thus decreasing the memory consumption if
14083 necessary. Value 0 of level de-activates this option. Value 1
14084 tracks tokens locations in a degraded mode for the sake of minimal
14085 memory overhead. In this mode all tokens resulting from the
14086 expansion of an argument of a function-like macro have the same
14087 location. Value 2 tracks tokens locations completely. This value is
14088 the most memory hungry. When this option is given no argument, the
14089 default parameter value is 2.
14090
14091 Note that "-ftrack-macro-expansion=2" is activated by default.
14092
14093 -fmacro-prefix-map=old=new
14094 When preprocessing files residing in directory old, expand the
14095 "__FILE__" and "__BASE_FILE__" macros as if the files resided in
14096 directory new instead. This can be used to change an absolute path
14097 to a relative path by using . for new which can result in more
14098 reproducible builds that are location independent. This option
14099 also affects "__builtin_FILE()" during compilation. See also
14100 -ffile-prefix-map.
14101
14102 -fexec-charset=charset
14103 Set the execution character set, used for string and character
14104 constants. The default is UTF-8. charset can be any encoding
14105 supported by the system's "iconv" library routine.
14106
14107 -fwide-exec-charset=charset
14108 Set the wide execution character set, used for wide string and
14109 character constants. The default is one of UTF-32BE, UTF-32LE,
14110 UTF-16BE, or UTF-16LE, whichever corresponds to the width of
14111 "wchar_t" and the big-endian or little-endian byte order being used
14112 for code generation. As with -fexec-charset, charset can be any
14113 encoding supported by the system's "iconv" library routine;
14114 however, you will have problems with encodings that do not fit
14115 exactly in "wchar_t".
14116
14117 -finput-charset=charset
14118 Set the input character set, used for translation from the
14119 character set of the input file to the source character set used by
14120 GCC. If the locale does not specify, or GCC cannot get this
14121 information from the locale, the default is UTF-8. This can be
14122 overridden by either the locale or this command-line option.
14123 Currently the command-line option takes precedence if there's a
14124 conflict. charset can be any encoding supported by the system's
14125 "iconv" library routine.
14126
14127 -fpch-deps
14128 When using precompiled headers, this flag causes the dependency-
14129 output flags to also list the files from the precompiled header's
14130 dependencies. If not specified, only the precompiled header are
14131 listed and not the files that were used to create it, because those
14132 files are not consulted when a precompiled header is used.
14133
14134 -fpch-preprocess
14135 This option allows use of a precompiled header together with -E.
14136 It inserts a special "#pragma", "#pragma GCC pch_preprocess
14137 "filename"" in the output to mark the place where the precompiled
14138 header was found, and its filename. When -fpreprocessed is in use,
14139 GCC recognizes this "#pragma" and loads the PCH.
14140
14141 This option is off by default, because the resulting preprocessed
14142 output is only really suitable as input to GCC. It is switched on
14143 by -save-temps.
14144
14145 You should not write this "#pragma" in your own code, but it is
14146 safe to edit the filename if the PCH file is available in a
14147 different location. The filename may be absolute or it may be
14148 relative to GCC's current directory.
14149
14150 -fworking-directory
14151 Enable generation of linemarkers in the preprocessor output that
14152 let the compiler know the current working directory at the time of
14153 preprocessing. When this option is enabled, the preprocessor
14154 emits, after the initial linemarker, a second linemarker with the
14155 current working directory followed by two slashes. GCC uses this
14156 directory, when it's present in the preprocessed input, as the
14157 directory emitted as the current working directory in some
14158 debugging information formats. This option is implicitly enabled
14159 if debugging information is enabled, but this can be inhibited with
14160 the negated form -fno-working-directory. If the -P flag is present
14161 in the command line, this option has no effect, since no "#line"
14162 directives are emitted whatsoever.
14163
14164 -A predicate=answer
14165 Make an assertion with the predicate predicate and answer answer.
14166 This form is preferred to the older form -A predicate(answer),
14167 which is still supported, because it does not use shell special
14168 characters.
14169
14170 -A -predicate=answer
14171 Cancel an assertion with the predicate predicate and answer answer.
14172
14173 -C Do not discard comments. All comments are passed through to the
14174 output file, except for comments in processed directives, which are
14175 deleted along with the directive.
14176
14177 You should be prepared for side effects when using -C; it causes
14178 the preprocessor to treat comments as tokens in their own right.
14179 For example, comments appearing at the start of what would be a
14180 directive line have the effect of turning that line into an
14181 ordinary source line, since the first token on the line is no
14182 longer a #.
14183
14184 -CC Do not discard comments, including during macro expansion. This is
14185 like -C, except that comments contained within macros are also
14186 passed through to the output file where the macro is expanded.
14187
14188 In addition to the side effects of the -C option, the -CC option
14189 causes all C++-style comments inside a macro to be converted to
14190 C-style comments. This is to prevent later use of that macro from
14191 inadvertently commenting out the remainder of the source line.
14192
14193 The -CC option is generally used to support lint comments.
14194
14195 -P Inhibit generation of linemarkers in the output from the
14196 preprocessor. This might be useful when running the preprocessor
14197 on something that is not C code, and will be sent to a program
14198 which might be confused by the linemarkers.
14199
14200 -traditional
14201 -traditional-cpp
14202 Try to imitate the behavior of pre-standard C preprocessors, as
14203 opposed to ISO C preprocessors. See the GNU CPP manual for
14204 details.
14205
14206 Note that GCC does not otherwise attempt to emulate a pre-standard
14207 C compiler, and these options are only supported with the -E
14208 switch, or when invoking CPP explicitly.
14209
14210 -trigraphs
14211 Support ISO C trigraphs. These are three-character sequences, all
14212 starting with ??, that are defined by ISO C to stand for single
14213 characters. For example, ??/ stands for \, so '??/n' is a
14214 character constant for a newline.
14215
14216 The nine trigraphs and their replacements are
14217
14218 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
14219 Replacement: [ ] { } # \ ^ | ~
14220
14221 By default, GCC ignores trigraphs, but in standard-conforming modes
14222 it converts them. See the -std and -ansi options.
14223
14224 -remap
14225 Enable special code to work around file systems which only permit
14226 very short file names, such as MS-DOS.
14227
14228 -H Print the name of each header file used, in addition to other
14229 normal activities. Each name is indented to show how deep in the
14230 #include stack it is. Precompiled header files are also printed,
14231 even if they are found to be invalid; an invalid precompiled header
14232 file is printed with ...x and a valid one with ...! .
14233
14234 -dletters
14235 Says to make debugging dumps during compilation as specified by
14236 letters. The flags documented here are those relevant to the
14237 preprocessor. Other letters are interpreted by the compiler
14238 proper, or reserved for future versions of GCC, and so are silently
14239 ignored. If you specify letters whose behavior conflicts, the
14240 result is undefined.
14241
14242 -dM Instead of the normal output, generate a list of #define
14243 directives for all the macros defined during the execution of
14244 the preprocessor, including predefined macros. This gives you
14245 a way of finding out what is predefined in your version of the
14246 preprocessor. Assuming you have no file foo.h, the command
14247
14248 touch foo.h; cpp -dM foo.h
14249
14250 shows all the predefined macros.
14251
14252 If you use -dM without the -E option, -dM is interpreted as a
14253 synonym for -fdump-rtl-mach.
14254
14255 -dD Like -dM except in two respects: it does not include the
14256 predefined macros, and it outputs both the #define directives
14257 and the result of preprocessing. Both kinds of output go to
14258 the standard output file.
14259
14260 -dN Like -dD, but emit only the macro names, not their expansions.
14261
14262 -dI Output #include directives in addition to the result of
14263 preprocessing.
14264
14265 -dU Like -dD except that only macros that are expanded, or whose
14266 definedness is tested in preprocessor directives, are output;
14267 the output is delayed until the use or test of the macro; and
14268 #undef directives are also output for macros tested but
14269 undefined at the time.
14270
14271 -fdebug-cpp
14272 This option is only useful for debugging GCC. When used from CPP
14273 or with -E, it dumps debugging information about location maps.
14274 Every token in the output is preceded by the dump of the map its
14275 location belongs to.
14276
14277 When used from GCC without -E, this option has no effect.
14278
14279 -Wp,option
14280 You can use -Wp,option to bypass the compiler driver and pass
14281 option directly through to the preprocessor. If option contains
14282 commas, it is split into multiple options at the commas. However,
14283 many options are modified, translated or interpreted by the
14284 compiler driver before being passed to the preprocessor, and -Wp
14285 forcibly bypasses this phase. The preprocessor's direct interface
14286 is undocumented and subject to change, so whenever possible you
14287 should avoid using -Wp and let the driver handle the options
14288 instead.
14289
14290 -Xpreprocessor option
14291 Pass option as an option to the preprocessor. You can use this to
14292 supply system-specific preprocessor options that GCC does not
14293 recognize.
14294
14295 If you want to pass an option that takes an argument, you must use
14296 -Xpreprocessor twice, once for the option and once for the
14297 argument.
14298
14299 -no-integrated-cpp
14300 Perform preprocessing as a separate pass before compilation. By
14301 default, GCC performs preprocessing as an integrated part of input
14302 tokenization and parsing. If this option is provided, the
14303 appropriate language front end (cc1, cc1plus, or cc1obj for C, C++,
14304 and Objective-C, respectively) is instead invoked twice, once for
14305 preprocessing only and once for actual compilation of the
14306 preprocessed input. This option may be useful in conjunction with
14307 the -B or -wrapper options to specify an alternate preprocessor or
14308 perform additional processing of the program source between normal
14309 preprocessing and compilation.
14310
14311 -flarge-source-files
14312 Adjust GCC to expect large source files, at the expense of slower
14313 compilation and higher memory usage.
14314
14315 Specifically, GCC normally tracks both column numbers and line
14316 numbers within source files and it normally prints both of these
14317 numbers in diagnostics. However, once it has processed a certain
14318 number of source lines, it stops tracking column numbers and only
14319 tracks line numbers. This means that diagnostics for later lines
14320 do not include column numbers. It also means that options like
14321 -Wmisleading-indentation cease to work at that point, although the
14322 compiler prints a note if this happens. Passing
14323 -flarge-source-files significantly increases the number of source
14324 lines that GCC can process before it stops tracking columns.
14325
14326 Passing Options to the Assembler
14327 You can pass options to the assembler.
14328
14329 -Wa,option
14330 Pass option as an option to the assembler. If option contains
14331 commas, it is split into multiple options at the commas.
14332
14333 -Xassembler option
14334 Pass option as an option to the assembler. You can use this to
14335 supply system-specific assembler options that GCC does not
14336 recognize.
14337
14338 If you want to pass an option that takes an argument, you must use
14339 -Xassembler twice, once for the option and once for the argument.
14340
14341 Options for Linking
14342 These options come into play when the compiler links object files into
14343 an executable output file. They are meaningless if the compiler is not
14344 doing a link step.
14345
14346 object-file-name
14347 A file name that does not end in a special recognized suffix is
14348 considered to name an object file or library. (Object files are
14349 distinguished from libraries by the linker according to the file
14350 contents.) If linking is done, these object files are used as
14351 input to the linker.
14352
14353 -c
14354 -S
14355 -E If any of these options is used, then the linker is not run, and
14356 object file names should not be used as arguments.
14357
14358 -flinker-output=type
14359 This option controls code generation of the link-time optimizer.
14360 By default the linker output is automatically determined by the
14361 linker plugin. For debugging the compiler and if incremental
14362 linking with a non-LTO object file is desired, it may be useful to
14363 control the type manually.
14364
14365 If type is exec, code generation produces a static binary. In this
14366 case -fpic and -fpie are both disabled.
14367
14368 If type is dyn, code generation produces a shared library. In this
14369 case -fpic or -fPIC is preserved, but not enabled automatically.
14370 This allows to build shared libraries without position-independent
14371 code on architectures where this is possible, i.e. on x86.
14372
14373 If type is pie, code generation produces an -fpie executable. This
14374 results in similar optimizations as exec except that -fpie is not
14375 disabled if specified at compilation time.
14376
14377 If type is rel, the compiler assumes that incremental linking is
14378 done. The sections containing intermediate code for link-time
14379 optimization are merged, pre-optimized, and output to the resulting
14380 object file. In addition, if -ffat-lto-objects is specified, binary
14381 code is produced for future non-LTO linking. The object file
14382 produced by incremental linking is smaller than a static library
14383 produced from the same object files. At link time the result of
14384 incremental linking also loads faster than a static library
14385 assuming that the majority of objects in the library are used.
14386
14387 Finally nolto-rel configures the compiler for incremental linking
14388 where code generation is forced, a final binary is produced, and
14389 the intermediate code for later link-time optimization is stripped.
14390 When multiple object files are linked together the resulting code
14391 is better optimized than with link-time optimizations disabled (for
14392 example, cross-module inlining happens), but most of benefits of
14393 whole program optimizations are lost.
14394
14395 During the incremental link (by -r) the linker plugin defaults to
14396 rel. With current interfaces to GNU Binutils it is however not
14397 possible to incrementally link LTO objects and non-LTO objects into
14398 a single mixed object file. If any of object files in incremental
14399 link cannot be used for link-time optimization, the linker plugin
14400 issues a warning and uses nolto-rel. To maintain whole program
14401 optimization, it is recommended to link such objects into static
14402 library instead. Alternatively it is possible to use H.J. Lu's
14403 binutils with support for mixed objects.
14404
14405 -fuse-ld=bfd
14406 Use the bfd linker instead of the default linker.
14407
14408 -fuse-ld=gold
14409 Use the gold linker instead of the default linker.
14410
14411 -fuse-ld=lld
14412 Use the LLVM lld linker instead of the default linker.
14413
14414 -fuse-ld=mold
14415 Use the Modern Linker (mold) instead of the default linker.
14416
14417 -llibrary
14418 -l library
14419 Search the library named library when linking. (The second
14420 alternative with the library as a separate argument is only for
14421 POSIX compliance and is not recommended.)
14422
14423 The -l option is passed directly to the linker by GCC. Refer to
14424 your linker documentation for exact details. The general
14425 description below applies to the GNU linker.
14426
14427 The linker searches a standard list of directories for the library.
14428 The directories searched include several standard system
14429 directories plus any that you specify with -L.
14430
14431 Static libraries are archives of object files, and have file names
14432 like liblibrary.a. Some targets also support shared libraries,
14433 which typically have names like liblibrary.so. If both static and
14434 shared libraries are found, the linker gives preference to linking
14435 with the shared library unless the -static option is used.
14436
14437 It makes a difference where in the command you write this option;
14438 the linker searches and processes libraries and object files in the
14439 order they are specified. Thus, foo.o -lz bar.o searches library z
14440 after file foo.o but before bar.o. If bar.o refers to functions in
14441 z, those functions may not be loaded.
14442
14443 -lobjc
14444 You need this special case of the -l option in order to link an
14445 Objective-C or Objective-C++ program.
14446
14447 -nostartfiles
14448 Do not use the standard system startup files when linking. The
14449 standard system libraries are used normally, unless -nostdlib,
14450 -nolibc, or -nodefaultlibs is used.
14451
14452 -nodefaultlibs
14453 Do not use the standard system libraries when linking. Only the
14454 libraries you specify are passed to the linker, and options
14455 specifying linkage of the system libraries, such as -static-libgcc
14456 or -shared-libgcc, are ignored. The standard startup files are
14457 used normally, unless -nostartfiles is used.
14458
14459 The compiler may generate calls to "memcmp", "memset", "memcpy" and
14460 "memmove". These entries are usually resolved by entries in libc.
14461 These entry points should be supplied through some other mechanism
14462 when this option is specified.
14463
14464 -nolibc
14465 Do not use the C library or system libraries tightly coupled with
14466 it when linking. Still link with the startup files, libgcc or
14467 toolchain provided language support libraries such as libgnat,
14468 libgfortran or libstdc++ unless options preventing their inclusion
14469 are used as well. This typically removes -lc from the link command
14470 line, as well as system libraries that normally go with it and
14471 become meaningless when absence of a C library is assumed, for
14472 example -lpthread or -lm in some configurations. This is intended
14473 for bare-board targets when there is indeed no C library available.
14474
14475 -nostdlib
14476 Do not use the standard system startup files or libraries when
14477 linking. No startup files and only the libraries you specify are
14478 passed to the linker, and options specifying linkage of the system
14479 libraries, such as -static-libgcc or -shared-libgcc, are ignored.
14480
14481 The compiler may generate calls to "memcmp", "memset", "memcpy" and
14482 "memmove". These entries are usually resolved by entries in libc.
14483 These entry points should be supplied through some other mechanism
14484 when this option is specified.
14485
14486 One of the standard libraries bypassed by -nostdlib and
14487 -nodefaultlibs is libgcc.a, a library of internal subroutines which
14488 GCC uses to overcome shortcomings of particular machines, or
14489 special needs for some languages.
14490
14491 In most cases, you need libgcc.a even when you want to avoid other
14492 standard libraries. In other words, when you specify -nostdlib or
14493 -nodefaultlibs you should usually specify -lgcc as well. This
14494 ensures that you have no unresolved references to internal GCC
14495 library subroutines. (An example of such an internal subroutine is
14496 "__main", used to ensure C++ constructors are called.)
14497
14498 -e entry
14499 --entry=entry
14500 Specify that the program entry point is entry. The argument is
14501 interpreted by the linker; the GNU linker accepts either a symbol
14502 name or an address.
14503
14504 -pie
14505 Produce a dynamically linked position independent executable on
14506 targets that support it. For predictable results, you must also
14507 specify the same set of options used for compilation (-fpie, -fPIE,
14508 or model suboptions) when you specify this linker option.
14509
14510 -no-pie
14511 Don't produce a dynamically linked position independent executable.
14512
14513 -static-pie
14514 Produce a static position independent executable on targets that
14515 support it. A static position independent executable is similar to
14516 a static executable, but can be loaded at any address without a
14517 dynamic linker. For predictable results, you must also specify the
14518 same set of options used for compilation (-fpie, -fPIE, or model
14519 suboptions) when you specify this linker option.
14520
14521 -pthread
14522 Link with the POSIX threads library. This option is supported on
14523 GNU/Linux targets, most other Unix derivatives, and also on x86
14524 Cygwin and MinGW targets. On some targets this option also sets
14525 flags for the preprocessor, so it should be used consistently for
14526 both compilation and linking.
14527
14528 -r Produce a relocatable object as output. This is also known as
14529 partial linking.
14530
14531 -rdynamic
14532 Pass the flag -export-dynamic to the ELF linker, on targets that
14533 support it. This instructs the linker to add all symbols, not only
14534 used ones, to the dynamic symbol table. This option is needed for
14535 some uses of "dlopen" or to allow obtaining backtraces from within
14536 a program.
14537
14538 -s Remove all symbol table and relocation information from the
14539 executable.
14540
14541 -static
14542 On systems that support dynamic linking, this overrides -pie and
14543 prevents linking with the shared libraries. On other systems, this
14544 option has no effect.
14545
14546 -shared
14547 Produce a shared object which can then be linked with other objects
14548 to form an executable. Not all systems support this option. For
14549 predictable results, you must also specify the same set of options
14550 used for compilation (-fpic, -fPIC, or model suboptions) when you
14551 specify this linker option.[1]
14552
14553 -shared-libgcc
14554 -static-libgcc
14555 On systems that provide libgcc as a shared library, these options
14556 force the use of either the shared or static version, respectively.
14557 If no shared version of libgcc was built when the compiler was
14558 configured, these options have no effect.
14559
14560 There are several situations in which an application should use the
14561 shared libgcc instead of the static version. The most common of
14562 these is when the application wishes to throw and catch exceptions
14563 across different shared libraries. In that case, each of the
14564 libraries as well as the application itself should use the shared
14565 libgcc.
14566
14567 Therefore, the G++ driver automatically adds -shared-libgcc
14568 whenever you build a shared library or a main executable, because
14569 C++ programs typically use exceptions, so this is the right thing
14570 to do.
14571
14572 If, instead, you use the GCC driver to create shared libraries, you
14573 may find that they are not always linked with the shared libgcc.
14574 If GCC finds, at its configuration time, that you have a non-GNU
14575 linker or a GNU linker that does not support option --eh-frame-hdr,
14576 it links the shared version of libgcc into shared libraries by
14577 default. Otherwise, it takes advantage of the linker and optimizes
14578 away the linking with the shared version of libgcc, linking with
14579 the static version of libgcc by default. This allows exceptions to
14580 propagate through such shared libraries, without incurring
14581 relocation costs at library load time.
14582
14583 However, if a library or main executable is supposed to throw or
14584 catch exceptions, you must link it using the G++ driver, or using
14585 the option -shared-libgcc, such that it is linked with the shared
14586 libgcc.
14587
14588 -static-libasan
14589 When the -fsanitize=address option is used to link a program, the
14590 GCC driver automatically links against libasan. If libasan is
14591 available as a shared library, and the -static option is not used,
14592 then this links against the shared version of libasan. The
14593 -static-libasan option directs the GCC driver to link libasan
14594 statically, without necessarily linking other libraries statically.
14595
14596 -static-libtsan
14597 When the -fsanitize=thread option is used to link a program, the
14598 GCC driver automatically links against libtsan. If libtsan is
14599 available as a shared library, and the -static option is not used,
14600 then this links against the shared version of libtsan. The
14601 -static-libtsan option directs the GCC driver to link libtsan
14602 statically, without necessarily linking other libraries statically.
14603
14604 -static-liblsan
14605 When the -fsanitize=leak option is used to link a program, the GCC
14606 driver automatically links against liblsan. If liblsan is
14607 available as a shared library, and the -static option is not used,
14608 then this links against the shared version of liblsan. The
14609 -static-liblsan option directs the GCC driver to link liblsan
14610 statically, without necessarily linking other libraries statically.
14611
14612 -static-libubsan
14613 When the -fsanitize=undefined option is used to link a program, the
14614 GCC driver automatically links against libubsan. If libubsan is
14615 available as a shared library, and the -static option is not used,
14616 then this links against the shared version of libubsan. The
14617 -static-libubsan option directs the GCC driver to link libubsan
14618 statically, without necessarily linking other libraries statically.
14619
14620 -static-libstdc++
14621 When the g++ program is used to link a C++ program, it normally
14622 automatically links against libstdc++. If libstdc++ is available
14623 as a shared library, and the -static option is not used, then this
14624 links against the shared version of libstdc++. That is normally
14625 fine. However, it is sometimes useful to freeze the version of
14626 libstdc++ used by the program without going all the way to a fully
14627 static link. The -static-libstdc++ option directs the g++ driver
14628 to link libstdc++ statically, without necessarily linking other
14629 libraries statically.
14630
14631 -symbolic
14632 Bind references to global symbols when building a shared object.
14633 Warn about any unresolved references (unless overridden by the link
14634 editor option -Xlinker -z -Xlinker defs). Only a few systems
14635 support this option.
14636
14637 -T script
14638 Use script as the linker script. This option is supported by most
14639 systems using the GNU linker. On some targets, such as bare-board
14640 targets without an operating system, the -T option may be required
14641 when linking to avoid references to undefined symbols.
14642
14643 -Xlinker option
14644 Pass option as an option to the linker. You can use this to supply
14645 system-specific linker options that GCC does not recognize.
14646
14647 If you want to pass an option that takes a separate argument, you
14648 must use -Xlinker twice, once for the option and once for the
14649 argument. For example, to pass -assert definitions, you must write
14650 -Xlinker -assert -Xlinker definitions. It does not work to write
14651 -Xlinker "-assert definitions", because this passes the entire
14652 string as a single argument, which is not what the linker expects.
14653
14654 When using the GNU linker, it is usually more convenient to pass
14655 arguments to linker options using the option=value syntax than as
14656 separate arguments. For example, you can specify -Xlinker
14657 -Map=output.map rather than -Xlinker -Map -Xlinker output.map.
14658 Other linkers may not support this syntax for command-line options.
14659
14660 -Wl,option
14661 Pass option as an option to the linker. If option contains commas,
14662 it is split into multiple options at the commas. You can use this
14663 syntax to pass an argument to the option. For example,
14664 -Wl,-Map,output.map passes -Map output.map to the linker. When
14665 using the GNU linker, you can also get the same effect with
14666 -Wl,-Map=output.map.
14667
14668 -u symbol
14669 Pretend the symbol symbol is undefined, to force linking of library
14670 modules to define it. You can use -u multiple times with different
14671 symbols to force loading of additional library modules.
14672
14673 -z keyword
14674 -z is passed directly on to the linker along with the keyword
14675 keyword. See the section in the documentation of your linker for
14676 permitted values and their meanings.
14677
14678 Options for Directory Search
14679 These options specify directories to search for header files, for
14680 libraries and for parts of the compiler:
14681
14682 -I dir
14683 -iquote dir
14684 -isystem dir
14685 -idirafter dir
14686 Add the directory dir to the list of directories to be searched for
14687 header files during preprocessing. If dir begins with = or
14688 $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix;
14689 see --sysroot and -isysroot.
14690
14691 Directories specified with -iquote apply only to the quote form of
14692 the directive, "#include "file"". Directories specified with -I,
14693 -isystem, or -idirafter apply to lookup for both the
14694 "#include "file"" and "#include <file>" directives.
14695
14696 You can specify any number or combination of these options on the
14697 command line to search for header files in several directories.
14698 The lookup order is as follows:
14699
14700 1. For the quote form of the include directive, the directory of
14701 the current file is searched first.
14702
14703 2. For the quote form of the include directive, the directories
14704 specified by -iquote options are searched in left-to-right
14705 order, as they appear on the command line.
14706
14707 3. Directories specified with -I options are scanned in left-to-
14708 right order.
14709
14710 4. Directories specified with -isystem options are scanned in
14711 left-to-right order.
14712
14713 5. Standard system directories are scanned.
14714
14715 6. Directories specified with -idirafter options are scanned in
14716 left-to-right order.
14717
14718 You can use -I to override a system header file, substituting your
14719 own version, since these directories are searched before the
14720 standard system header file directories. However, you should not
14721 use this option to add directories that contain vendor-supplied
14722 system header files; use -isystem for that.
14723
14724 The -isystem and -idirafter options also mark the directory as a
14725 system directory, so that it gets the same special treatment that
14726 is applied to the standard system directories.
14727
14728 If a standard system include directory, or a directory specified
14729 with -isystem, is also specified with -I, the -I option is ignored.
14730 The directory is still searched but as a system directory at its
14731 normal position in the system include chain. This is to ensure
14732 that GCC's procedure to fix buggy system headers and the ordering
14733 for the "#include_next" directive are not inadvertently changed.
14734 If you really need to change the search order for system
14735 directories, use the -nostdinc and/or -isystem options.
14736
14737 -I- Split the include path. This option has been deprecated. Please
14738 use -iquote instead for -I directories before the -I- and remove
14739 the -I- option.
14740
14741 Any directories specified with -I options before -I- are searched
14742 only for headers requested with "#include "file""; they are not
14743 searched for "#include <file>". If additional directories are
14744 specified with -I options after the -I-, those directories are
14745 searched for all #include directives.
14746
14747 In addition, -I- inhibits the use of the directory of the current
14748 file directory as the first search directory for "#include "file"".
14749 There is no way to override this effect of -I-.
14750
14751 -iprefix prefix
14752 Specify prefix as the prefix for subsequent -iwithprefix options.
14753 If the prefix represents a directory, you should include the final
14754 /.
14755
14756 -iwithprefix dir
14757 -iwithprefixbefore dir
14758 Append dir to the prefix specified previously with -iprefix, and
14759 add the resulting directory to the include search path.
14760 -iwithprefixbefore puts it in the same place -I would; -iwithprefix
14761 puts it where -idirafter would.
14762
14763 -isysroot dir
14764 This option is like the --sysroot option, but applies only to
14765 header files (except for Darwin targets, where it applies to both
14766 header files and libraries). See the --sysroot option for more
14767 information.
14768
14769 -imultilib dir
14770 Use dir as a subdirectory of the directory containing target-
14771 specific C++ headers.
14772
14773 -nostdinc
14774 Do not search the standard system directories for header files.
14775 Only the directories explicitly specified with -I, -iquote,
14776 -isystem, and/or -idirafter options (and the directory of the
14777 current file, if appropriate) are searched.
14778
14779 -nostdinc++
14780 Do not search for header files in the C++-specific standard
14781 directories, but do still search the other standard directories.
14782 (This option is used when building the C++ library.)
14783
14784 -iplugindir=dir
14785 Set the directory to search for plugins that are passed by
14786 -fplugin=name instead of -fplugin=path/name.so. This option is not
14787 meant to be used by the user, but only passed by the driver.
14788
14789 -Ldir
14790 Add directory dir to the list of directories to be searched for -l.
14791
14792 -Bprefix
14793 This option specifies where to find the executables, libraries,
14794 include files, and data files of the compiler itself.
14795
14796 The compiler driver program runs one or more of the subprograms
14797 cpp, cc1, as and ld. It tries prefix as a prefix for each program
14798 it tries to run, both with and without machine/version/ for the
14799 corresponding target machine and compiler version.
14800
14801 For each subprogram to be run, the compiler driver first tries the
14802 -B prefix, if any. If that name is not found, or if -B is not
14803 specified, the driver tries two standard prefixes, /usr/lib/gcc/
14804 and /usr/local/lib/gcc/. If neither of those results in a file
14805 name that is found, the unmodified program name is searched for
14806 using the directories specified in your PATH environment variable.
14807
14808 The compiler checks to see if the path provided by -B refers to a
14809 directory, and if necessary it adds a directory separator character
14810 at the end of the path.
14811
14812 -B prefixes that effectively specify directory names also apply to
14813 libraries in the linker, because the compiler translates these
14814 options into -L options for the linker. They also apply to include
14815 files in the preprocessor, because the compiler translates these
14816 options into -isystem options for the preprocessor. In this case,
14817 the compiler appends include to the prefix.
14818
14819 The runtime support file libgcc.a can also be searched for using
14820 the -B prefix, if needed. If it is not found there, the two
14821 standard prefixes above are tried, and that is all. The file is
14822 left out of the link if it is not found by those means.
14823
14824 Another way to specify a prefix much like the -B prefix is to use
14825 the environment variable GCC_EXEC_PREFIX.
14826
14827 As a special kludge, if the path provided by -B is [dir/]stageN/,
14828 where N is a number in the range 0 to 9, then it is replaced by
14829 [dir/]include. This is to help with boot-strapping the compiler.
14830
14831 -no-canonical-prefixes
14832 Do not expand any symbolic links, resolve references to /../ or
14833 /./, or make the path absolute when generating a relative prefix.
14834
14835 --sysroot=dir
14836 Use dir as the logical root directory for headers and libraries.
14837 For example, if the compiler normally searches for headers in
14838 /usr/include and libraries in /usr/lib, it instead searches
14839 dir/usr/include and dir/usr/lib.
14840
14841 If you use both this option and the -isysroot option, then the
14842 --sysroot option applies to libraries, but the -isysroot option
14843 applies to header files.
14844
14845 The GNU linker (beginning with version 2.16) has the necessary
14846 support for this option. If your linker does not support this
14847 option, the header file aspect of --sysroot still works, but the
14848 library aspect does not.
14849
14850 --no-sysroot-suffix
14851 For some targets, a suffix is added to the root directory specified
14852 with --sysroot, depending on the other options used, so that
14853 headers may for example be found in dir/suffix/usr/include instead
14854 of dir/usr/include. This option disables the addition of such a
14855 suffix.
14856
14857 Options for Code Generation Conventions
14858 These machine-independent options control the interface conventions
14859 used in code generation.
14860
14861 Most of them have both positive and negative forms; the negative form
14862 of -ffoo is -fno-foo. In the table below, only one of the forms is
14863 listed---the one that is not the default. You can figure out the other
14864 form by either removing no- or adding it.
14865
14866 -fstack-reuse=reuse-level
14867 This option controls stack space reuse for user declared local/auto
14868 variables and compiler generated temporaries. reuse_level can be
14869 all, named_vars, or none. all enables stack reuse for all local
14870 variables and temporaries, named_vars enables the reuse only for
14871 user defined local variables with names, and none disables stack
14872 reuse completely. The default value is all. The option is needed
14873 when the program extends the lifetime of a scoped local variable or
14874 a compiler generated temporary beyond the end point defined by the
14875 language. When a lifetime of a variable ends, and if the variable
14876 lives in memory, the optimizing compiler has the freedom to reuse
14877 its stack space with other temporaries or scoped local variables
14878 whose live range does not overlap with it. Legacy code extending
14879 local lifetime is likely to break with the stack reuse
14880 optimization.
14881
14882 For example,
14883
14884 int *p;
14885 {
14886 int local1;
14887
14888 p = &local1;
14889 local1 = 10;
14890 ....
14891 }
14892 {
14893 int local2;
14894 local2 = 20;
14895 ...
14896 }
14897
14898 if (*p == 10) // out of scope use of local1
14899 {
14900
14901 }
14902
14903 Another example:
14904
14905 struct A
14906 {
14907 A(int k) : i(k), j(k) { }
14908 int i;
14909 int j;
14910 };
14911
14912 A *ap;
14913
14914 void foo(const A& ar)
14915 {
14916 ap = &ar;
14917 }
14918
14919 void bar()
14920 {
14921 foo(A(10)); // temp object's lifetime ends when foo returns
14922
14923 {
14924 A a(20);
14925 ....
14926 }
14927 ap->i+= 10; // ap references out of scope temp whose space
14928 // is reused with a. What is the value of ap->i?
14929 }
14930
14931 The lifetime of a compiler generated temporary is well defined by
14932 the C++ standard. When a lifetime of a temporary ends, and if the
14933 temporary lives in memory, the optimizing compiler has the freedom
14934 to reuse its stack space with other temporaries or scoped local
14935 variables whose live range does not overlap with it. However some
14936 of the legacy code relies on the behavior of older compilers in
14937 which temporaries' stack space is not reused, the aggressive stack
14938 reuse can lead to runtime errors. This option is used to control
14939 the temporary stack reuse optimization.
14940
14941 -ftrapv
14942 This option generates traps for signed overflow on addition,
14943 subtraction, multiplication operations. The options -ftrapv and
14944 -fwrapv override each other, so using -ftrapv -fwrapv on the
14945 command-line results in -fwrapv being effective. Note that only
14946 active options override, so using -ftrapv -fwrapv -fno-wrapv on the
14947 command-line results in -ftrapv being effective.
14948
14949 -fwrapv
14950 This option instructs the compiler to assume that signed arithmetic
14951 overflow of addition, subtraction and multiplication wraps around
14952 using twos-complement representation. This flag enables some
14953 optimizations and disables others. The options -ftrapv and -fwrapv
14954 override each other, so using -ftrapv -fwrapv on the command-line
14955 results in -fwrapv being effective. Note that only active options
14956 override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
14957 results in -ftrapv being effective.
14958
14959 -fwrapv-pointer
14960 This option instructs the compiler to assume that pointer
14961 arithmetic overflow on addition and subtraction wraps around using
14962 twos-complement representation. This flag disables some
14963 optimizations which assume pointer overflow is invalid.
14964
14965 -fstrict-overflow
14966 This option implies -fno-wrapv -fno-wrapv-pointer and when negated
14967 implies -fwrapv -fwrapv-pointer.
14968
14969 -fexceptions
14970 Enable exception handling. Generates extra code needed to
14971 propagate exceptions. For some targets, this implies GCC generates
14972 frame unwind information for all functions, which can produce
14973 significant data size overhead, although it does not affect
14974 execution. If you do not specify this option, GCC enables it by
14975 default for languages like C++ that normally require exception
14976 handling, and disables it for languages like C that do not normally
14977 require it. However, you may need to enable this option when
14978 compiling C code that needs to interoperate properly with exception
14979 handlers written in C++. You may also wish to disable this option
14980 if you are compiling older C++ programs that don't use exception
14981 handling.
14982
14983 -fnon-call-exceptions
14984 Generate code that allows trapping instructions to throw
14985 exceptions. Note that this requires platform-specific runtime
14986 support that does not exist everywhere. Moreover, it only allows
14987 trapping instructions to throw exceptions, i.e. memory references
14988 or floating-point instructions. It does not allow exceptions to be
14989 thrown from arbitrary signal handlers such as "SIGALRM". This
14990 enables -fexceptions.
14991
14992 -fdelete-dead-exceptions
14993 Consider that instructions that may throw exceptions but don't
14994 otherwise contribute to the execution of the program can be
14995 optimized away. This does not affect calls to functions except
14996 those with the "pure" or "const" attributes. This option is
14997 enabled by default for the Ada and C++ compilers, as permitted by
14998 the language specifications. Optimization passes that cause dead
14999 exceptions to be removed are enabled independently at different
15000 optimization levels.
15001
15002 -funwind-tables
15003 Similar to -fexceptions, except that it just generates any needed
15004 static data, but does not affect the generated code in any other
15005 way. You normally do not need to enable this option; instead, a
15006 language processor that needs this handling enables it on your
15007 behalf.
15008
15009 -fasynchronous-unwind-tables
15010 Generate unwind table in DWARF format, if supported by target
15011 machine. The table is exact at each instruction boundary, so it
15012 can be used for stack unwinding from asynchronous events (such as
15013 debugger or garbage collector).
15014
15015 -fno-gnu-unique
15016 On systems with recent GNU assembler and C library, the C++
15017 compiler uses the "STB_GNU_UNIQUE" binding to make sure that
15018 definitions of template static data members and static local
15019 variables in inline functions are unique even in the presence of
15020 "RTLD_LOCAL"; this is necessary to avoid problems with a library
15021 used by two different "RTLD_LOCAL" plugins depending on a
15022 definition in one of them and therefore disagreeing with the other
15023 one about the binding of the symbol. But this causes "dlclose" to
15024 be ignored for affected DSOs; if your program relies on
15025 reinitialization of a DSO via "dlclose" and "dlopen", you can use
15026 -fno-gnu-unique.
15027
15028 -fpcc-struct-return
15029 Return "short" "struct" and "union" values in memory like longer
15030 ones, rather than in registers. This convention is less efficient,
15031 but it has the advantage of allowing intercallability between GCC-
15032 compiled files and files compiled with other compilers,
15033 particularly the Portable C Compiler (pcc).
15034
15035 The precise convention for returning structures in memory depends
15036 on the target configuration macros.
15037
15038 Short structures and unions are those whose size and alignment
15039 match that of some integer type.
15040
15041 Warning: code compiled with the -fpcc-struct-return switch is not
15042 binary compatible with code compiled with the -freg-struct-return
15043 switch. Use it to conform to a non-default application binary
15044 interface.
15045
15046 -freg-struct-return
15047 Return "struct" and "union" values in registers when possible.
15048 This is more efficient for small structures than
15049 -fpcc-struct-return.
15050
15051 If you specify neither -fpcc-struct-return nor -freg-struct-return,
15052 GCC defaults to whichever convention is standard for the target.
15053 If there is no standard convention, GCC defaults to
15054 -fpcc-struct-return, except on targets where GCC is the principal
15055 compiler. In those cases, we can choose the standard, and we chose
15056 the more efficient register return alternative.
15057
15058 Warning: code compiled with the -freg-struct-return switch is not
15059 binary compatible with code compiled with the -fpcc-struct-return
15060 switch. Use it to conform to a non-default application binary
15061 interface.
15062
15063 -fshort-enums
15064 Allocate to an "enum" type only as many bytes as it needs for the
15065 declared range of possible values. Specifically, the "enum" type
15066 is equivalent to the smallest integer type that has enough room.
15067
15068 Warning: the -fshort-enums switch causes GCC to generate code that
15069 is not binary compatible with code generated without that switch.
15070 Use it to conform to a non-default application binary interface.
15071
15072 -fshort-wchar
15073 Override the underlying type for "wchar_t" to be "short unsigned
15074 int" instead of the default for the target. This option is useful
15075 for building programs to run under WINE.
15076
15077 Warning: the -fshort-wchar switch causes GCC to generate code that
15078 is not binary compatible with code generated without that switch.
15079 Use it to conform to a non-default application binary interface.
15080
15081 -fcommon
15082 In C code, this option controls the placement of global variables
15083 defined without an initializer, known as tentative definitions in
15084 the C standard. Tentative definitions are distinct from
15085 declarations of a variable with the "extern" keyword, which do not
15086 allocate storage.
15087
15088 The default is -fno-common, which specifies that the compiler
15089 places uninitialized global variables in the BSS section of the
15090 object file. This inhibits the merging of tentative definitions by
15091 the linker so you get a multiple-definition error if the same
15092 variable is accidentally defined in more than one compilation unit.
15093
15094 The -fcommon places uninitialized global variables in a common
15095 block. This allows the linker to resolve all tentative definitions
15096 of the same variable in different compilation units to the same
15097 object, or to a non-tentative definition. This behavior is
15098 inconsistent with C++, and on many targets implies a speed and code
15099 size penalty on global variable references. It is mainly useful to
15100 enable legacy code to link without errors.
15101
15102 -fno-ident
15103 Ignore the "#ident" directive.
15104
15105 -finhibit-size-directive
15106 Don't output a ".size" assembler directive, or anything else that
15107 would cause trouble if the function is split in the middle, and the
15108 two halves are placed at locations far apart in memory. This
15109 option is used when compiling crtstuff.c; you should not need to
15110 use it for anything else.
15111
15112 -fverbose-asm
15113 Put extra commentary information in the generated assembly code to
15114 make it more readable. This option is generally only of use to
15115 those who actually need to read the generated assembly code
15116 (perhaps while debugging the compiler itself).
15117
15118 -fno-verbose-asm, the default, causes the extra information to be
15119 omitted and is useful when comparing two assembler files.
15120
15121 The added comments include:
15122
15123 * information on the compiler version and command-line options,
15124
15125 * the source code lines associated with the assembly
15126 instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE,
15127
15128 * hints on which high-level expressions correspond to the various
15129 assembly instruction operands.
15130
15131 For example, given this C source file:
15132
15133 int test (int n)
15134 {
15135 int i;
15136 int total = 0;
15137
15138 for (i = 0; i < n; i++)
15139 total += i * i;
15140
15141 return total;
15142 }
15143
15144 compiling to (x86_64) assembly via -S and emitting the result
15145 direct to stdout via -o -
15146
15147 gcc -S test.c -fverbose-asm -Os -o -
15148
15149 gives output similar to this:
15150
15151 .file "test.c"
15152 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
15153 [...snip...]
15154 # options passed:
15155 [...snip...]
15156
15157 .text
15158 .globl test
15159 .type test, @function
15160 test:
15161 .LFB0:
15162 .cfi_startproc
15163 # test.c:4: int total = 0;
15164 xorl %eax, %eax # <retval>
15165 # test.c:6: for (i = 0; i < n; i++)
15166 xorl %edx, %edx # i
15167 .L2:
15168 # test.c:6: for (i = 0; i < n; i++)
15169 cmpl %edi, %edx # n, i
15170 jge .L5 #,
15171 # test.c:7: total += i * i;
15172 movl %edx, %ecx # i, tmp92
15173 imull %edx, %ecx # i, tmp92
15174 # test.c:6: for (i = 0; i < n; i++)
15175 incl %edx # i
15176 # test.c:7: total += i * i;
15177 addl %ecx, %eax # tmp92, <retval>
15178 jmp .L2 #
15179 .L5:
15180 # test.c:10: }
15181 ret
15182 .cfi_endproc
15183 .LFE0:
15184 .size test, .-test
15185 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
15186 .section .note.GNU-stack,"",@progbits
15187
15188 The comments are intended for humans rather than machines and hence
15189 the precise format of the comments is subject to change.
15190
15191 -frecord-gcc-switches
15192 This switch causes the command line used to invoke the compiler to
15193 be recorded into the object file that is being created. This
15194 switch is only implemented on some targets and the exact format of
15195 the recording is target and binary file format dependent, but it
15196 usually takes the form of a section containing ASCII text. This
15197 switch is related to the -fverbose-asm switch, but that switch only
15198 records information in the assembler output file as comments, so it
15199 never reaches the object file. See also -grecord-gcc-switches for
15200 another way of storing compiler options into the object file.
15201
15202 -fpic
15203 Generate position-independent code (PIC) suitable for use in a
15204 shared library, if supported for the target machine. Such code
15205 accesses all constant addresses through a global offset table
15206 (GOT). The dynamic loader resolves the GOT entries when the
15207 program starts (the dynamic loader is not part of GCC; it is part
15208 of the operating system). If the GOT size for the linked
15209 executable exceeds a machine-specific maximum size, you get an
15210 error message from the linker indicating that -fpic does not work;
15211 in that case, recompile with -fPIC instead. (These maximums are 8k
15212 on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The
15213 x86 has no such limit.)
15214
15215 Position-independent code requires special support, and therefore
15216 works only on certain machines. For the x86, GCC supports PIC for
15217 System V but not for the Sun 386i. Code generated for the IBM
15218 RS/6000 is always position-independent.
15219
15220 When this flag is set, the macros "__pic__" and "__PIC__" are
15221 defined to 1.
15222
15223 -fPIC
15224 If supported for the target machine, emit position-independent
15225 code, suitable for dynamic linking and avoiding any limit on the
15226 size of the global offset table. This option makes a difference on
15227 AArch64, m68k, PowerPC and SPARC.
15228
15229 Position-independent code requires special support, and therefore
15230 works only on certain machines.
15231
15232 When this flag is set, the macros "__pic__" and "__PIC__" are
15233 defined to 2.
15234
15235 -fpie
15236 -fPIE
15237 These options are similar to -fpic and -fPIC, but the generated
15238 position-independent code can be only linked into executables.
15239 Usually these options are used to compile code that will be linked
15240 using the -pie GCC option.
15241
15242 -fpie and -fPIE both define the macros "__pie__" and "__PIE__".
15243 The macros have the value 1 for -fpie and 2 for -fPIE.
15244
15245 -fno-plt
15246 Do not use the PLT for external function calls in position-
15247 independent code. Instead, load the callee address at call sites
15248 from the GOT and branch to it. This leads to more efficient code
15249 by eliminating PLT stubs and exposing GOT loads to optimizations.
15250 On architectures such as 32-bit x86 where PLT stubs expect the GOT
15251 pointer in a specific register, this gives more register allocation
15252 freedom to the compiler. Lazy binding requires use of the PLT;
15253 with -fno-plt all external symbols are resolved at load time.
15254
15255 Alternatively, the function attribute "noplt" can be used to avoid
15256 calls through the PLT for specific external functions.
15257
15258 In position-dependent code, a few targets also convert calls to
15259 functions that are marked to not use the PLT to use the GOT
15260 instead.
15261
15262 -fno-jump-tables
15263 Do not use jump tables for switch statements even where it would be
15264 more efficient than other code generation strategies. This option
15265 is of use in conjunction with -fpic or -fPIC for building code that
15266 forms part of a dynamic linker and cannot reference the address of
15267 a jump table. On some targets, jump tables do not require a GOT
15268 and this option is not needed.
15269
15270 -fno-bit-tests
15271 Do not use bit tests for switch statements even where it would be
15272 more efficient than other code generation strategies.
15273
15274 -ffixed-reg
15275 Treat the register named reg as a fixed register; generated code
15276 should never refer to it (except perhaps as a stack pointer, frame
15277 pointer or in some other fixed role).
15278
15279 reg must be the name of a register. The register names accepted
15280 are machine-specific and are defined in the "REGISTER_NAMES" macro
15281 in the machine description macro file.
15282
15283 This flag does not have a negative form, because it specifies a
15284 three-way choice.
15285
15286 -fcall-used-reg
15287 Treat the register named reg as an allocable register that is
15288 clobbered by function calls. It may be allocated for temporaries
15289 or variables that do not live across a call. Functions compiled
15290 this way do not save and restore the register reg.
15291
15292 It is an error to use this flag with the frame pointer or stack
15293 pointer. Use of this flag for other registers that have fixed
15294 pervasive roles in the machine's execution model produces
15295 disastrous results.
15296
15297 This flag does not have a negative form, because it specifies a
15298 three-way choice.
15299
15300 -fcall-saved-reg
15301 Treat the register named reg as an allocable register saved by
15302 functions. It may be allocated even for temporaries or variables
15303 that live across a call. Functions compiled this way save and
15304 restore the register reg if they use it.
15305
15306 It is an error to use this flag with the frame pointer or stack
15307 pointer. Use of this flag for other registers that have fixed
15308 pervasive roles in the machine's execution model produces
15309 disastrous results.
15310
15311 A different sort of disaster results from the use of this flag for
15312 a register in which function values may be returned.
15313
15314 This flag does not have a negative form, because it specifies a
15315 three-way choice.
15316
15317 -fpack-struct[=n]
15318 Without a value specified, pack all structure members together
15319 without holes. When a value is specified (which must be a small
15320 power of two), pack structure members according to this value,
15321 representing the maximum alignment (that is, objects with default
15322 alignment requirements larger than this are output potentially
15323 unaligned at the next fitting location.
15324
15325 Warning: the -fpack-struct switch causes GCC to generate code that
15326 is not binary compatible with code generated without that switch.
15327 Additionally, it makes the code suboptimal. Use it to conform to a
15328 non-default application binary interface.
15329
15330 -fleading-underscore
15331 This option and its counterpart, -fno-leading-underscore, forcibly
15332 change the way C symbols are represented in the object file. One
15333 use is to help link with legacy assembly code.
15334
15335 Warning: the -fleading-underscore switch causes GCC to generate
15336 code that is not binary compatible with code generated without that
15337 switch. Use it to conform to a non-default application binary
15338 interface. Not all targets provide complete support for this
15339 switch.
15340
15341 -ftls-model=model
15342 Alter the thread-local storage model to be used. The model
15343 argument should be one of global-dynamic, local-dynamic, initial-
15344 exec or local-exec. Note that the choice is subject to
15345 optimization: the compiler may use a more efficient model for
15346 symbols not visible outside of the translation unit, or if -fpic is
15347 not given on the command line.
15348
15349 The default without -fpic is initial-exec; with -fpic the default
15350 is global-dynamic.
15351
15352 -ftrampolines
15353 For targets that normally need trampolines for nested functions,
15354 always generate them instead of using descriptors. Otherwise, for
15355 targets that do not need them, like for example HP-PA or IA-64, do
15356 nothing.
15357
15358 A trampoline is a small piece of code that is created at run time
15359 on the stack when the address of a nested function is taken, and is
15360 used to call the nested function indirectly. Therefore, it
15361 requires the stack to be made executable in order for the program
15362 to work properly.
15363
15364 -fno-trampolines is enabled by default on a language by language
15365 basis to let the compiler avoid generating them, if it computes
15366 that this is safe, and replace them with descriptors. Descriptors
15367 are made up of data only, but the generated code must be prepared
15368 to deal with them. As of this writing, -fno-trampolines is enabled
15369 by default only for Ada.
15370
15371 Moreover, code compiled with -ftrampolines and code compiled with
15372 -fno-trampolines are not binary compatible if nested functions are
15373 present. This option must therefore be used on a program-wide
15374 basis and be manipulated with extreme care.
15375
15376 For languages other than Ada, the "-ftrampolines" and
15377 "-fno-trampolines" options currently have no effect, and
15378 trampolines are always generated on platforms that need them for
15379 nested functions.
15380
15381 -fvisibility=[default|internal|hidden|protected]
15382 Set the default ELF image symbol visibility to the specified
15383 option---all symbols are marked with this unless overridden within
15384 the code. Using this feature can very substantially improve
15385 linking and load times of shared object libraries, produce more
15386 optimized code, provide near-perfect API export and prevent symbol
15387 clashes. It is strongly recommended that you use this in any
15388 shared objects you distribute.
15389
15390 Despite the nomenclature, default always means public; i.e.,
15391 available to be linked against from outside the shared object.
15392 protected and internal are pretty useless in real-world usage so
15393 the only other commonly used option is hidden. The default if
15394 -fvisibility isn't specified is default, i.e., make every symbol
15395 public.
15396
15397 A good explanation of the benefits offered by ensuring ELF symbols
15398 have the correct visibility is given by "How To Write Shared
15399 Libraries" by Ulrich Drepper (which can be found at
15400 <https://www.akkadia.org/drepper/>)---however a superior solution
15401 made possible by this option to marking things hidden when the
15402 default is public is to make the default hidden and mark things
15403 public. This is the norm with DLLs on Windows and with
15404 -fvisibility=hidden and "__attribute__ ((visibility("default")))"
15405 instead of "__declspec(dllexport)" you get almost identical
15406 semantics with identical syntax. This is a great boon to those
15407 working with cross-platform projects.
15408
15409 For those adding visibility support to existing code, you may find
15410 "#pragma GCC visibility" of use. This works by you enclosing the
15411 declarations you wish to set visibility for with (for example)
15412 "#pragma GCC visibility push(hidden)" and "#pragma GCC visibility
15413 pop". Bear in mind that symbol visibility should be viewed as part
15414 of the API interface contract and thus all new code should always
15415 specify visibility when it is not the default; i.e., declarations
15416 only for use within the local DSO should always be marked
15417 explicitly as hidden as so to avoid PLT indirection
15418 overheads---making this abundantly clear also aids readability and
15419 self-documentation of the code. Note that due to ISO C++
15420 specification requirements, "operator new" and "operator delete"
15421 must always be of default visibility.
15422
15423 Be aware that headers from outside your project, in particular
15424 system headers and headers from any other library you use, may not
15425 be expecting to be compiled with visibility other than the default.
15426 You may need to explicitly say "#pragma GCC visibility
15427 push(default)" before including any such headers.
15428
15429 "extern" declarations are not affected by -fvisibility, so a lot of
15430 code can be recompiled with -fvisibility=hidden with no
15431 modifications. However, this means that calls to "extern"
15432 functions with no explicit visibility use the PLT, so it is more
15433 effective to use "__attribute ((visibility))" and/or "#pragma GCC
15434 visibility" to tell the compiler which "extern" declarations should
15435 be treated as hidden.
15436
15437 Note that -fvisibility does affect C++ vague linkage entities. This
15438 means that, for instance, an exception class that is be thrown
15439 between DSOs must be explicitly marked with default visibility so
15440 that the type_info nodes are unified between the DSOs.
15441
15442 An overview of these techniques, their benefits and how to use them
15443 is at <https://gcc.gnu.org/wiki/Visibility>.
15444
15445 -fstrict-volatile-bitfields
15446 This option should be used if accesses to volatile bit-fields (or
15447 other structure fields, although the compiler usually honors those
15448 types anyway) should use a single access of the width of the
15449 field's type, aligned to a natural alignment if possible. For
15450 example, targets with memory-mapped peripheral registers might
15451 require all such accesses to be 16 bits wide; with this flag you
15452 can declare all peripheral bit-fields as "unsigned short" (assuming
15453 short is 16 bits on these targets) to force GCC to use 16-bit
15454 accesses instead of, perhaps, a more efficient 32-bit access.
15455
15456 If this option is disabled, the compiler uses the most efficient
15457 instruction. In the previous example, that might be a 32-bit load
15458 instruction, even though that accesses bytes that do not contain
15459 any portion of the bit-field, or memory-mapped registers unrelated
15460 to the one being updated.
15461
15462 In some cases, such as when the "packed" attribute is applied to a
15463 structure field, it may not be possible to access the field with a
15464 single read or write that is correctly aligned for the target
15465 machine. In this case GCC falls back to generating multiple
15466 accesses rather than code that will fault or truncate the result at
15467 run time.
15468
15469 Note: Due to restrictions of the C/C++11 memory model, write
15470 accesses are not allowed to touch non bit-field members. It is
15471 therefore recommended to define all bits of the field's type as
15472 bit-field members.
15473
15474 The default value of this option is determined by the application
15475 binary interface for the target processor.
15476
15477 -fsync-libcalls
15478 This option controls whether any out-of-line instance of the
15479 "__sync" family of functions may be used to implement the C++11
15480 "__atomic" family of functions.
15481
15482 The default value of this option is enabled, thus the only useful
15483 form of the option is -fno-sync-libcalls. This option is used in
15484 the implementation of the libatomic runtime library.
15485
15486 GCC Developer Options
15487 This section describes command-line options that are primarily of
15488 interest to GCC developers, including options to support compiler
15489 testing and investigation of compiler bugs and compile-time performance
15490 problems. This includes options that produce debug dumps at various
15491 points in the compilation; that print statistics such as memory use and
15492 execution time; and that print information about GCC's configuration,
15493 such as where it searches for libraries. You should rarely need to use
15494 any of these options for ordinary compilation and linking tasks.
15495
15496 Many developer options that cause GCC to dump output to a file take an
15497 optional =filename suffix. You can specify stdout or - to dump to
15498 standard output, and stderr for standard error.
15499
15500 If =filename is omitted, a default dump file name is constructed by
15501 concatenating the base dump file name, a pass number, phase letter, and
15502 pass name. The base dump file name is the name of output file produced
15503 by the compiler if explicitly specified and not an executable;
15504 otherwise it is the source file name. The pass number is determined by
15505 the order passes are registered with the compiler's pass manager. This
15506 is generally the same as the order of execution, but passes registered
15507 by plugins, target-specific passes, or passes that are otherwise
15508 registered late are numbered higher than the pass named final, even if
15509 they are executed earlier. The phase letter is one of i (inter-
15510 procedural analysis), l (language-specific), r (RTL), or t (tree). The
15511 files are created in the directory of the output file.
15512
15513 -fcallgraph-info
15514 -fcallgraph-info=MARKERS
15515 Makes the compiler output callgraph information for the program, on
15516 a per-object-file basis. The information is generated in the
15517 common VCG format. It can be decorated with additional, per-node
15518 and/or per-edge information, if a list of comma-separated markers
15519 is additionally specified. When the "su" marker is specified, the
15520 callgraph is decorated with stack usage information; it is
15521 equivalent to -fstack-usage. When the "da" marker is specified,
15522 the callgraph is decorated with information about dynamically
15523 allocated objects.
15524
15525 When compiling with -flto, no callgraph information is output along
15526 with the object file. At LTO link time, -fcallgraph-info may
15527 generate multiple callgraph information files next to intermediate
15528 LTO output files.
15529
15530 -dletters
15531 -fdump-rtl-pass
15532 -fdump-rtl-pass=filename
15533 Says to make debugging dumps during compilation at times specified
15534 by letters. This is used for debugging the RTL-based passes of the
15535 compiler.
15536
15537 Some -dletters switches have different meaning when -E is used for
15538 preprocessing.
15539
15540 Debug dumps can be enabled with a -fdump-rtl switch or some -d
15541 option letters. Here are the possible letters for use in pass and
15542 letters, and their meanings:
15543
15544 -fdump-rtl-alignments
15545 Dump after branch alignments have been computed.
15546
15547 -fdump-rtl-asmcons
15548 Dump after fixing rtl statements that have unsatisfied in/out
15549 constraints.
15550
15551 -fdump-rtl-auto_inc_dec
15552 Dump after auto-inc-dec discovery. This pass is only run on
15553 architectures that have auto inc or auto dec instructions.
15554
15555 -fdump-rtl-barriers
15556 Dump after cleaning up the barrier instructions.
15557
15558 -fdump-rtl-bbpart
15559 Dump after partitioning hot and cold basic blocks.
15560
15561 -fdump-rtl-bbro
15562 Dump after block reordering.
15563
15564 -fdump-rtl-btl1
15565 -fdump-rtl-btl2
15566 -fdump-rtl-btl1 and -fdump-rtl-btl2 enable dumping after the
15567 two branch target load optimization passes.
15568
15569 -fdump-rtl-bypass
15570 Dump after jump bypassing and control flow optimizations.
15571
15572 -fdump-rtl-combine
15573 Dump after the RTL instruction combination pass.
15574
15575 -fdump-rtl-compgotos
15576 Dump after duplicating the computed gotos.
15577
15578 -fdump-rtl-ce1
15579 -fdump-rtl-ce2
15580 -fdump-rtl-ce3
15581 -fdump-rtl-ce1, -fdump-rtl-ce2, and -fdump-rtl-ce3 enable
15582 dumping after the three if conversion passes.
15583
15584 -fdump-rtl-cprop_hardreg
15585 Dump after hard register copy propagation.
15586
15587 -fdump-rtl-csa
15588 Dump after combining stack adjustments.
15589
15590 -fdump-rtl-cse1
15591 -fdump-rtl-cse2
15592 -fdump-rtl-cse1 and -fdump-rtl-cse2 enable dumping after the
15593 two common subexpression elimination passes.
15594
15595 -fdump-rtl-dce
15596 Dump after the standalone dead code elimination passes.
15597
15598 -fdump-rtl-dbr
15599 Dump after delayed branch scheduling.
15600
15601 -fdump-rtl-dce1
15602 -fdump-rtl-dce2
15603 -fdump-rtl-dce1 and -fdump-rtl-dce2 enable dumping after the
15604 two dead store elimination passes.
15605
15606 -fdump-rtl-eh
15607 Dump after finalization of EH handling code.
15608
15609 -fdump-rtl-eh_ranges
15610 Dump after conversion of EH handling range regions.
15611
15612 -fdump-rtl-expand
15613 Dump after RTL generation.
15614
15615 -fdump-rtl-fwprop1
15616 -fdump-rtl-fwprop2
15617 -fdump-rtl-fwprop1 and -fdump-rtl-fwprop2 enable dumping after
15618 the two forward propagation passes.
15619
15620 -fdump-rtl-gcse1
15621 -fdump-rtl-gcse2
15622 -fdump-rtl-gcse1 and -fdump-rtl-gcse2 enable dumping after
15623 global common subexpression elimination.
15624
15625 -fdump-rtl-init-regs
15626 Dump after the initialization of the registers.
15627
15628 -fdump-rtl-initvals
15629 Dump after the computation of the initial value sets.
15630
15631 -fdump-rtl-into_cfglayout
15632 Dump after converting to cfglayout mode.
15633
15634 -fdump-rtl-ira
15635 Dump after iterated register allocation.
15636
15637 -fdump-rtl-jump
15638 Dump after the second jump optimization.
15639
15640 -fdump-rtl-loop2
15641 -fdump-rtl-loop2 enables dumping after the rtl loop
15642 optimization passes.
15643
15644 -fdump-rtl-mach
15645 Dump after performing the machine dependent reorganization
15646 pass, if that pass exists.
15647
15648 -fdump-rtl-mode_sw
15649 Dump after removing redundant mode switches.
15650
15651 -fdump-rtl-rnreg
15652 Dump after register renumbering.
15653
15654 -fdump-rtl-outof_cfglayout
15655 Dump after converting from cfglayout mode.
15656
15657 -fdump-rtl-peephole2
15658 Dump after the peephole pass.
15659
15660 -fdump-rtl-postreload
15661 Dump after post-reload optimizations.
15662
15663 -fdump-rtl-pro_and_epilogue
15664 Dump after generating the function prologues and epilogues.
15665
15666 -fdump-rtl-sched1
15667 -fdump-rtl-sched2
15668 -fdump-rtl-sched1 and -fdump-rtl-sched2 enable dumping after
15669 the basic block scheduling passes.
15670
15671 -fdump-rtl-ree
15672 Dump after sign/zero extension elimination.
15673
15674 -fdump-rtl-seqabstr
15675 Dump after common sequence discovery.
15676
15677 -fdump-rtl-shorten
15678 Dump after shortening branches.
15679
15680 -fdump-rtl-sibling
15681 Dump after sibling call optimizations.
15682
15683 -fdump-rtl-split1
15684 -fdump-rtl-split2
15685 -fdump-rtl-split3
15686 -fdump-rtl-split4
15687 -fdump-rtl-split5
15688 These options enable dumping after five rounds of instruction
15689 splitting.
15690
15691 -fdump-rtl-sms
15692 Dump after modulo scheduling. This pass is only run on some
15693 architectures.
15694
15695 -fdump-rtl-stack
15696 Dump after conversion from GCC's "flat register file" registers
15697 to the x87's stack-like registers. This pass is only run on
15698 x86 variants.
15699
15700 -fdump-rtl-subreg1
15701 -fdump-rtl-subreg2
15702 -fdump-rtl-subreg1 and -fdump-rtl-subreg2 enable dumping after
15703 the two subreg expansion passes.
15704
15705 -fdump-rtl-unshare
15706 Dump after all rtl has been unshared.
15707
15708 -fdump-rtl-vartrack
15709 Dump after variable tracking.
15710
15711 -fdump-rtl-vregs
15712 Dump after converting virtual registers to hard registers.
15713
15714 -fdump-rtl-web
15715 Dump after live range splitting.
15716
15717 -fdump-rtl-regclass
15718 -fdump-rtl-subregs_of_mode_init
15719 -fdump-rtl-subregs_of_mode_finish
15720 -fdump-rtl-dfinit
15721 -fdump-rtl-dfinish
15722 These dumps are defined but always produce empty files.
15723
15724 -da
15725 -fdump-rtl-all
15726 Produce all the dumps listed above.
15727
15728 -dA Annotate the assembler output with miscellaneous debugging
15729 information.
15730
15731 -dD Dump all macro definitions, at the end of preprocessing, in
15732 addition to normal output.
15733
15734 -dH Produce a core dump whenever an error occurs.
15735
15736 -dp Annotate the assembler output with a comment indicating which
15737 pattern and alternative is used. The length and cost of each
15738 instruction are also printed.
15739
15740 -dP Dump the RTL in the assembler output as a comment before each
15741 instruction. Also turns on -dp annotation.
15742
15743 -dx Just generate RTL for a function instead of compiling it.
15744 Usually used with -fdump-rtl-expand.
15745
15746 -fdump-debug
15747 Dump debugging information generated during the debug generation
15748 phase.
15749
15750 -fdump-earlydebug
15751 Dump debugging information generated during the early debug
15752 generation phase.
15753
15754 -fdump-noaddr
15755 When doing debugging dumps, suppress address output. This makes it
15756 more feasible to use diff on debugging dumps for compiler
15757 invocations with different compiler binaries and/or different text
15758 / bss / data / heap / stack / dso start locations.
15759
15760 -freport-bug
15761 Collect and dump debug information into a temporary file if an
15762 internal compiler error (ICE) occurs.
15763
15764 -fdump-unnumbered
15765 When doing debugging dumps, suppress instruction numbers and
15766 address output. This makes it more feasible to use diff on
15767 debugging dumps for compiler invocations with different options, in
15768 particular with and without -g.
15769
15770 -fdump-unnumbered-links
15771 When doing debugging dumps (see -d option above), suppress
15772 instruction numbers for the links to the previous and next
15773 instructions in a sequence.
15774
15775 -fdump-ipa-switch
15776 -fdump-ipa-switch-options
15777 Control the dumping at various stages of inter-procedural analysis
15778 language tree to a file. The file name is generated by appending a
15779 switch specific suffix to the source file name, and the file is
15780 created in the same directory as the output file. The following
15781 dumps are possible:
15782
15783 all Enables all inter-procedural analysis dumps.
15784
15785 cgraph
15786 Dumps information about call-graph optimization, unused
15787 function removal, and inlining decisions.
15788
15789 inline
15790 Dump after function inlining.
15791
15792 Additionally, the options -optimized, -missed, -note, and -all can
15793 be provided, with the same meaning as for -fopt-info, defaulting to
15794 -optimized.
15795
15796 For example, -fdump-ipa-inline-optimized-missed will emit
15797 information on callsites that were inlined, along with callsites
15798 that were not inlined.
15799
15800 By default, the dump will contain messages about successful
15801 optimizations (equivalent to -optimized) together with low-level
15802 details about the analysis.
15803
15804 -fdump-lang
15805 Dump language-specific information. The file name is made by
15806 appending .lang to the source file name.
15807
15808 -fdump-lang-all
15809 -fdump-lang-switch
15810 -fdump-lang-switch-options
15811 -fdump-lang-switch-options=filename
15812 Control the dumping of language-specific information. The options
15813 and filename portions behave as described in the -fdump-tree
15814 option. The following switch values are accepted:
15815
15816 all Enable all language-specific dumps.
15817
15818 class
15819 Dump class hierarchy information. Virtual table information is
15820 emitted unless 'slim' is specified. This option is applicable
15821 to C++ only.
15822
15823 module
15824 Dump module information. Options lineno (locations), graph
15825 (reachability), blocks (clusters), uid (serialization), alias
15826 (mergeable), asmname (Elrond), eh (mapper) & vops (macros) may
15827 provide additional information. This option is applicable to
15828 C++ only.
15829
15830 raw Dump the raw internal tree data. This option is applicable to
15831 C++ only.
15832
15833 -fdump-passes
15834 Print on stderr the list of optimization passes that are turned on
15835 and off by the current command-line options.
15836
15837 -fdump-statistics-option
15838 Enable and control dumping of pass statistics in a separate file.
15839 The file name is generated by appending a suffix ending in
15840 .statistics to the source file name, and the file is created in the
15841 same directory as the output file. If the -option form is used,
15842 -stats causes counters to be summed over the whole compilation unit
15843 while -details dumps every event as the passes generate them. The
15844 default with no option is to sum counters for each function
15845 compiled.
15846
15847 -fdump-tree-all
15848 -fdump-tree-switch
15849 -fdump-tree-switch-options
15850 -fdump-tree-switch-options=filename
15851 Control the dumping at various stages of processing the
15852 intermediate language tree to a file. If the -options form is
15853 used, options is a list of - separated options which control the
15854 details of the dump. Not all options are applicable to all dumps;
15855 those that are not meaningful are ignored. The following options
15856 are available
15857
15858 address
15859 Print the address of each node. Usually this is not meaningful
15860 as it changes according to the environment and source file.
15861 Its primary use is for tying up a dump file with a debug
15862 environment.
15863
15864 asmname
15865 If "DECL_ASSEMBLER_NAME" has been set for a given decl, use
15866 that in the dump instead of "DECL_NAME". Its primary use is
15867 ease of use working backward from mangled names in the assembly
15868 file.
15869
15870 slim
15871 When dumping front-end intermediate representations, inhibit
15872 dumping of members of a scope or body of a function merely
15873 because that scope has been reached. Only dump such items when
15874 they are directly reachable by some other path.
15875
15876 When dumping pretty-printed trees, this option inhibits dumping
15877 the bodies of control structures.
15878
15879 When dumping RTL, print the RTL in slim (condensed) form
15880 instead of the default LISP-like representation.
15881
15882 raw Print a raw representation of the tree. By default, trees are
15883 pretty-printed into a C-like representation.
15884
15885 details
15886 Enable more detailed dumps (not honored by every dump option).
15887 Also include information from the optimization passes.
15888
15889 stats
15890 Enable dumping various statistics about the pass (not honored
15891 by every dump option).
15892
15893 blocks
15894 Enable showing basic block boundaries (disabled in raw dumps).
15895
15896 graph
15897 For each of the other indicated dump files (-fdump-rtl-pass),
15898 dump a representation of the control flow graph suitable for
15899 viewing with GraphViz to file.passid.pass.dot. Each function
15900 in the file is pretty-printed as a subgraph, so that GraphViz
15901 can render them all in a single plot.
15902
15903 This option currently only works for RTL dumps, and the RTL is
15904 always dumped in slim form.
15905
15906 vops
15907 Enable showing virtual operands for every statement.
15908
15909 lineno
15910 Enable showing line numbers for statements.
15911
15912 uid Enable showing the unique ID ("DECL_UID") for each variable.
15913
15914 verbose
15915 Enable showing the tree dump for each statement.
15916
15917 eh Enable showing the EH region number holding each statement.
15918
15919 scev
15920 Enable showing scalar evolution analysis details.
15921
15922 optimized
15923 Enable showing optimization information (only available in
15924 certain passes).
15925
15926 missed
15927 Enable showing missed optimization information (only available
15928 in certain passes).
15929
15930 note
15931 Enable other detailed optimization information (only available
15932 in certain passes).
15933
15934 all Turn on all options, except raw, slim, verbose and lineno.
15935
15936 optall
15937 Turn on all optimization options, i.e., optimized, missed, and
15938 note.
15939
15940 To determine what tree dumps are available or find the dump for a
15941 pass of interest follow the steps below.
15942
15943 1. Invoke GCC with -fdump-passes and in the stderr output look for
15944 a code that corresponds to the pass you are interested in. For
15945 example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2"
15946 correspond to the three Value Range Propagation passes. The
15947 number at the end distinguishes distinct invocations of the
15948 same pass.
15949
15950 2. To enable the creation of the dump file, append the pass code
15951 to the -fdump- option prefix and invoke GCC with it. For
15952 example, to enable the dump from the Early Value Range
15953 Propagation pass, invoke GCC with the -fdump-tree-evrp option.
15954 Optionally, you may specify the name of the dump file. If you
15955 don't specify one, GCC creates as described below.
15956
15957 3. Find the pass dump in a file whose name is composed of three
15958 components separated by a period: the name of the source file
15959 GCC was invoked to compile, a numeric suffix indicating the
15960 pass number followed by the letter t for tree passes (and the
15961 letter r for RTL passes), and finally the pass code. For
15962 example, the Early VRP pass dump might be in a file named
15963 myfile.c.038t.evrp in the current working directory. Note that
15964 the numeric codes are not stable and may change from one
15965 version of GCC to another.
15966
15967 -fopt-info
15968 -fopt-info-options
15969 -fopt-info-options=filename
15970 Controls optimization dumps from various optimization passes. If
15971 the -options form is used, options is a list of - separated option
15972 keywords to select the dump details and optimizations.
15973
15974 The options can be divided into three groups:
15975
15976 1. options describing what kinds of messages should be emitted,
15977
15978 2. options describing the verbosity of the dump, and
15979
15980 3. options describing which optimizations should be included.
15981
15982 The options from each group can be freely mixed as they are non-
15983 overlapping. However, in case of any conflicts, the later options
15984 override the earlier options on the command line.
15985
15986 The following options control which kinds of messages should be
15987 emitted:
15988
15989 optimized
15990 Print information when an optimization is successfully applied.
15991 It is up to a pass to decide which information is relevant. For
15992 example, the vectorizer passes print the source location of
15993 loops which are successfully vectorized.
15994
15995 missed
15996 Print information about missed optimizations. Individual passes
15997 control which information to include in the output.
15998
15999 note
16000 Print verbose information about optimizations, such as certain
16001 transformations, more detailed messages about decisions etc.
16002
16003 all Print detailed optimization information. This includes
16004 optimized, missed, and note.
16005
16006 The following option controls the dump verbosity:
16007
16008 internals
16009 By default, only "high-level" messages are emitted. This option
16010 enables additional, more detailed, messages, which are likely
16011 to only be of interest to GCC developers.
16012
16013 One or more of the following option keywords can be used to
16014 describe a group of optimizations:
16015
16016 ipa Enable dumps from all interprocedural optimizations.
16017
16018 loop
16019 Enable dumps from all loop optimizations.
16020
16021 inline
16022 Enable dumps from all inlining optimizations.
16023
16024 omp Enable dumps from all OMP (Offloading and Multi Processing)
16025 optimizations.
16026
16027 vec Enable dumps from all vectorization optimizations.
16028
16029 optall
16030 Enable dumps from all optimizations. This is a superset of the
16031 optimization groups listed above.
16032
16033 If options is omitted, it defaults to optimized-optall, which means
16034 to dump messages about successful optimizations from all the
16035 passes, omitting messages that are treated as "internals".
16036
16037 If the filename is provided, then the dumps from all the applicable
16038 optimizations are concatenated into the filename. Otherwise the
16039 dump is output onto stderr. Though multiple -fopt-info options are
16040 accepted, only one of them can include a filename. If other
16041 filenames are provided then all but the first such option are
16042 ignored.
16043
16044 Note that the output filename is overwritten in case of multiple
16045 translation units. If a combined output from multiple translation
16046 units is desired, stderr should be used instead.
16047
16048 In the following example, the optimization info is output to
16049 stderr:
16050
16051 gcc -O3 -fopt-info
16052
16053 This example:
16054
16055 gcc -O3 -fopt-info-missed=missed.all
16056
16057 outputs missed optimization report from all the passes into
16058 missed.all, and this one:
16059
16060 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
16061
16062 prints information about missed optimization opportunities from
16063 vectorization passes on stderr. Note that -fopt-info-vec-missed is
16064 equivalent to -fopt-info-missed-vec. The order of the optimization
16065 group names and message types listed after -fopt-info does not
16066 matter.
16067
16068 As another example,
16069
16070 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
16071
16072 outputs information about missed optimizations as well as optimized
16073 locations from all the inlining passes into inline.txt.
16074
16075 Finally, consider:
16076
16077 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
16078
16079 Here the two output filenames vec.miss and loop.opt are in conflict
16080 since only one output file is allowed. In this case, only the first
16081 option takes effect and the subsequent options are ignored. Thus
16082 only vec.miss is produced which contains dumps from the vectorizer
16083 about missed opportunities.
16084
16085 -fsave-optimization-record
16086 Write a SRCFILE.opt-record.json.gz file detailing what
16087 optimizations were performed, for those optimizations that support
16088 -fopt-info.
16089
16090 This option is experimental and the format of the data within the
16091 compressed JSON file is subject to change.
16092
16093 It is roughly equivalent to a machine-readable version of
16094 -fopt-info-all, as a collection of messages with source file, line
16095 number and column number, with the following additional data for
16096 each message:
16097
16098 * the execution count of the code being optimized, along with
16099 metadata about whether this was from actual profile data, or
16100 just an estimate, allowing consumers to prioritize messages by
16101 code hotness,
16102
16103 * the function name of the code being optimized, where
16104 applicable,
16105
16106 * the "inlining chain" for the code being optimized, so that when
16107 a function is inlined into several different places (which
16108 might themselves be inlined), the reader can distinguish
16109 between the copies,
16110
16111 * objects identifying those parts of the message that refer to
16112 expressions, statements or symbol-table nodes, which of these
16113 categories they are, and, when available, their source code
16114 location,
16115
16116 * the GCC pass that emitted the message, and
16117
16118 * the location in GCC's own code from which the message was
16119 emitted
16120
16121 Additionally, some messages are logically nested within other
16122 messages, reflecting implementation details of the optimization
16123 passes.
16124
16125 -fsched-verbose=n
16126 On targets that use instruction scheduling, this option controls
16127 the amount of debugging output the scheduler prints to the dump
16128 files.
16129
16130 For n greater than zero, -fsched-verbose outputs the same
16131 information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n
16132 greater than one, it also output basic block probabilities,
16133 detailed ready list information and unit/insn info. For n greater
16134 than two, it includes RTL at abort point, control-flow and regions
16135 info. And for n over four, -fsched-verbose also includes
16136 dependence info.
16137
16138 -fenable-kind-pass
16139 -fdisable-kind-pass=range-list
16140 This is a set of options that are used to explicitly disable/enable
16141 optimization passes. These options are intended for use for
16142 debugging GCC. Compiler users should use regular options for
16143 enabling/disabling passes instead.
16144
16145 -fdisable-ipa-pass
16146 Disable IPA pass pass. pass is the pass name. If the same pass
16147 is statically invoked in the compiler multiple times, the pass
16148 name should be appended with a sequential number starting from
16149 1.
16150
16151 -fdisable-rtl-pass
16152 -fdisable-rtl-pass=range-list
16153 Disable RTL pass pass. pass is the pass name. If the same
16154 pass is statically invoked in the compiler multiple times, the
16155 pass name should be appended with a sequential number starting
16156 from 1. range-list is a comma-separated list of function
16157 ranges or assembler names. Each range is a number pair
16158 separated by a colon. The range is inclusive in both ends. If
16159 the range is trivial, the number pair can be simplified as a
16160 single number. If the function's call graph node's uid falls
16161 within one of the specified ranges, the pass is disabled for
16162 that function. The uid is shown in the function header of a
16163 dump file, and the pass names can be dumped by using option
16164 -fdump-passes.
16165
16166 -fdisable-tree-pass
16167 -fdisable-tree-pass=range-list
16168 Disable tree pass pass. See -fdisable-rtl for the description
16169 of option arguments.
16170
16171 -fenable-ipa-pass
16172 Enable IPA pass pass. pass is the pass name. If the same pass
16173 is statically invoked in the compiler multiple times, the pass
16174 name should be appended with a sequential number starting from
16175 1.
16176
16177 -fenable-rtl-pass
16178 -fenable-rtl-pass=range-list
16179 Enable RTL pass pass. See -fdisable-rtl for option argument
16180 description and examples.
16181
16182 -fenable-tree-pass
16183 -fenable-tree-pass=range-list
16184 Enable tree pass pass. See -fdisable-rtl for the description
16185 of option arguments.
16186
16187 Here are some examples showing uses of these options.
16188
16189 # disable ccp1 for all functions
16190 -fdisable-tree-ccp1
16191 # disable complete unroll for function whose cgraph node uid is 1
16192 -fenable-tree-cunroll=1
16193 # disable gcse2 for functions at the following ranges [1,1],
16194 # [300,400], and [400,1000]
16195 # disable gcse2 for functions foo and foo2
16196 -fdisable-rtl-gcse2=foo,foo2
16197 # disable early inlining
16198 -fdisable-tree-einline
16199 # disable ipa inlining
16200 -fdisable-ipa-inline
16201 # enable tree full unroll
16202 -fenable-tree-unroll
16203
16204 -fchecking
16205 -fchecking=n
16206 Enable internal consistency checking. The default depends on the
16207 compiler configuration. -fchecking=2 enables further internal
16208 consistency checking that might affect code generation.
16209
16210 -frandom-seed=string
16211 This option provides a seed that GCC uses in place of random
16212 numbers in generating certain symbol names that have to be
16213 different in every compiled file. It is also used to place unique
16214 stamps in coverage data files and the object files that produce
16215 them. You can use the -frandom-seed option to produce reproducibly
16216 identical object files.
16217
16218 The string can either be a number (decimal, octal or hex) or an
16219 arbitrary string (in which case it's converted to a number by
16220 computing CRC32).
16221
16222 The string should be different for every file you compile.
16223
16224 -save-temps
16225 Store the usual "temporary" intermediate files permanently; name
16226 them as auxiliary output files, as specified described under
16227 -dumpbase and -dumpdir.
16228
16229 When used in combination with the -x command-line option,
16230 -save-temps is sensible enough to avoid overwriting an input source
16231 file with the same extension as an intermediate file. The
16232 corresponding intermediate file may be obtained by renaming the
16233 source file before using -save-temps.
16234
16235 -save-temps=cwd
16236 Equivalent to -save-temps -dumpdir ./.
16237
16238 -save-temps=obj
16239 Equivalent to -save-temps -dumpdir outdir/, where outdir/ is the
16240 directory of the output file specified after the -o option,
16241 including any directory separators. If the -o option is not used,
16242 the -save-temps=obj switch behaves like -save-temps=cwd.
16243
16244 -time[=file]
16245 Report the CPU time taken by each subprocess in the compilation
16246 sequence. For C source files, this is the compiler proper and
16247 assembler (plus the linker if linking is done).
16248
16249 Without the specification of an output file, the output looks like
16250 this:
16251
16252 # cc1 0.12 0.01
16253 # as 0.00 0.01
16254
16255 The first number on each line is the "user time", that is time
16256 spent executing the program itself. The second number is "system
16257 time", time spent executing operating system routines on behalf of
16258 the program. Both numbers are in seconds.
16259
16260 With the specification of an output file, the output is appended to
16261 the named file, and it looks like this:
16262
16263 0.12 0.01 cc1 <options>
16264 0.00 0.01 as <options>
16265
16266 The "user time" and the "system time" are moved before the program
16267 name, and the options passed to the program are displayed, so that
16268 one can later tell what file was being compiled, and with which
16269 options.
16270
16271 -fdump-final-insns[=file]
16272 Dump the final internal representation (RTL) to file. If the
16273 optional argument is omitted (or if file is "."), the name of the
16274 dump file is determined by appending ".gkd" to the dump base name,
16275 see -dumpbase.
16276
16277 -fcompare-debug[=opts]
16278 If no error occurs during compilation, run the compiler a second
16279 time, adding opts and -fcompare-debug-second to the arguments
16280 passed to the second compilation. Dump the final internal
16281 representation in both compilations, and print an error if they
16282 differ.
16283
16284 If the equal sign is omitted, the default -gtoggle is used.
16285
16286 The environment variable GCC_COMPARE_DEBUG, if defined, non-empty
16287 and nonzero, implicitly enables -fcompare-debug. If
16288 GCC_COMPARE_DEBUG is defined to a string starting with a dash, then
16289 it is used for opts, otherwise the default -gtoggle is used.
16290
16291 -fcompare-debug=, with the equal sign but without opts, is
16292 equivalent to -fno-compare-debug, which disables the dumping of the
16293 final representation and the second compilation, preventing even
16294 GCC_COMPARE_DEBUG from taking effect.
16295
16296 To verify full coverage during -fcompare-debug testing, set
16297 GCC_COMPARE_DEBUG to say -fcompare-debug-not-overridden, which GCC
16298 rejects as an invalid option in any actual compilation (rather than
16299 preprocessing, assembly or linking). To get just a warning,
16300 setting GCC_COMPARE_DEBUG to -w%n-fcompare-debug not overridden
16301 will do.
16302
16303 -fcompare-debug-second
16304 This option is implicitly passed to the compiler for the second
16305 compilation requested by -fcompare-debug, along with options to
16306 silence warnings, and omitting other options that would cause the
16307 compiler to produce output to files or to standard output as a side
16308 effect. Dump files and preserved temporary files are renamed so as
16309 to contain the ".gk" additional extension during the second
16310 compilation, to avoid overwriting those generated by the first.
16311
16312 When this option is passed to the compiler driver, it causes the
16313 first compilation to be skipped, which makes it useful for little
16314 other than debugging the compiler proper.
16315
16316 -gtoggle
16317 Turn off generation of debug info, if leaving out this option
16318 generates it, or turn it on at level 2 otherwise. The position of
16319 this argument in the command line does not matter; it takes effect
16320 after all other options are processed, and it does so only once, no
16321 matter how many times it is given. This is mainly intended to be
16322 used with -fcompare-debug.
16323
16324 -fvar-tracking-assignments-toggle
16325 Toggle -fvar-tracking-assignments, in the same way that -gtoggle
16326 toggles -g.
16327
16328 -Q Makes the compiler print out each function name as it is compiled,
16329 and print some statistics about each pass when it finishes.
16330
16331 -ftime-report
16332 Makes the compiler print some statistics about the time consumed by
16333 each pass when it finishes.
16334
16335 -ftime-report-details
16336 Record the time consumed by infrastructure parts separately for
16337 each pass.
16338
16339 -fira-verbose=n
16340 Control the verbosity of the dump file for the integrated register
16341 allocator. The default value is 5. If the value n is greater or
16342 equal to 10, the dump output is sent to stderr using the same
16343 format as n minus 10.
16344
16345 -flto-report
16346 Prints a report with internal details on the workings of the link-
16347 time optimizer. The contents of this report vary from version to
16348 version. It is meant to be useful to GCC developers when
16349 processing object files in LTO mode (via -flto).
16350
16351 Disabled by default.
16352
16353 -flto-report-wpa
16354 Like -flto-report, but only print for the WPA phase of link-time
16355 optimization.
16356
16357 -fmem-report
16358 Makes the compiler print some statistics about permanent memory
16359 allocation when it finishes.
16360
16361 -fmem-report-wpa
16362 Makes the compiler print some statistics about permanent memory
16363 allocation for the WPA phase only.
16364
16365 -fpre-ipa-mem-report
16366 -fpost-ipa-mem-report
16367 Makes the compiler print some statistics about permanent memory
16368 allocation before or after interprocedural optimization.
16369
16370 -fprofile-report
16371 Makes the compiler print some statistics about consistency of the
16372 (estimated) profile and effect of individual passes.
16373
16374 -fstack-usage
16375 Makes the compiler output stack usage information for the program,
16376 on a per-function basis. The filename for the dump is made by
16377 appending .su to the auxname. auxname is generated from the name
16378 of the output file, if explicitly specified and it is not an
16379 executable, otherwise it is the basename of the source file. An
16380 entry is made up of three fields:
16381
16382 * The name of the function.
16383
16384 * A number of bytes.
16385
16386 * One or more qualifiers: "static", "dynamic", "bounded".
16387
16388 The qualifier "static" means that the function manipulates the
16389 stack statically: a fixed number of bytes are allocated for the
16390 frame on function entry and released on function exit; no stack
16391 adjustments are otherwise made in the function. The second field
16392 is this fixed number of bytes.
16393
16394 The qualifier "dynamic" means that the function manipulates the
16395 stack dynamically: in addition to the static allocation described
16396 above, stack adjustments are made in the body of the function, for
16397 example to push/pop arguments around function calls. If the
16398 qualifier "bounded" is also present, the amount of these
16399 adjustments is bounded at compile time and the second field is an
16400 upper bound of the total amount of stack used by the function. If
16401 it is not present, the amount of these adjustments is not bounded
16402 at compile time and the second field only represents the bounded
16403 part.
16404
16405 -fstats
16406 Emit statistics about front-end processing at the end of the
16407 compilation. This option is supported only by the C++ front end,
16408 and the information is generally only useful to the G++ development
16409 team.
16410
16411 -fdbg-cnt-list
16412 Print the name and the counter upper bound for all debug counters.
16413
16414 -fdbg-cnt=counter-value-list
16415 Set the internal debug counter lower and upper bound. counter-
16416 value-list is a comma-separated list of
16417 name:lower_bound1-upper_bound1 [:lower_bound2-upper_bound2...]
16418 tuples which sets the name of the counter and list of closed
16419 intervals. The lower_bound is optional and is zero initialized if
16420 not set. For example, with -fdbg-cnt=dce:2-4:10-11,tail_call:10,
16421 "dbg_cnt(dce)" returns true only for second, third, fourth, tenth
16422 and eleventh invocation. For "dbg_cnt(tail_call)" true is returned
16423 for first 10 invocations.
16424
16425 -print-file-name=library
16426 Print the full absolute name of the library file library that would
16427 be used when linking---and don't do anything else. With this
16428 option, GCC does not compile or link anything; it just prints the
16429 file name.
16430
16431 -print-multi-directory
16432 Print the directory name corresponding to the multilib selected by
16433 any other switches present in the command line. This directory is
16434 supposed to exist in GCC_EXEC_PREFIX.
16435
16436 -print-multi-lib
16437 Print the mapping from multilib directory names to compiler
16438 switches that enable them. The directory name is separated from
16439 the switches by ;, and each switch starts with an @ instead of the
16440 -, without spaces between multiple switches. This is supposed to
16441 ease shell processing.
16442
16443 -print-multi-os-directory
16444 Print the path to OS libraries for the selected multilib, relative
16445 to some lib subdirectory. If OS libraries are present in the lib
16446 subdirectory and no multilibs are used, this is usually just ., if
16447 OS libraries are present in libsuffix sibling directories this
16448 prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are
16449 present in lib/subdir subdirectories it prints e.g. amd64, sparcv9
16450 or ev6.
16451
16452 -print-multiarch
16453 Print the path to OS libraries for the selected multiarch, relative
16454 to some lib subdirectory.
16455
16456 -print-prog-name=program
16457 Like -print-file-name, but searches for a program such as cpp.
16458
16459 -print-libgcc-file-name
16460 Same as -print-file-name=libgcc.a.
16461
16462 This is useful when you use -nostdlib or -nodefaultlibs but you do
16463 want to link with libgcc.a. You can do:
16464
16465 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
16466
16467 -print-search-dirs
16468 Print the name of the configured installation directory and a list
16469 of program and library directories gcc searches---and don't do
16470 anything else.
16471
16472 This is useful when gcc prints the error message installation
16473 problem, cannot exec cpp0: No such file or directory. To resolve
16474 this you either need to put cpp0 and the other compiler components
16475 where gcc expects to find them, or you can set the environment
16476 variable GCC_EXEC_PREFIX to the directory where you installed them.
16477 Don't forget the trailing /.
16478
16479 -print-sysroot
16480 Print the target sysroot directory that is used during compilation.
16481 This is the target sysroot specified either at configure time or
16482 using the --sysroot option, possibly with an extra suffix that
16483 depends on compilation options. If no target sysroot is specified,
16484 the option prints nothing.
16485
16486 -print-sysroot-headers-suffix
16487 Print the suffix added to the target sysroot when searching for
16488 headers, or give an error if the compiler is not configured with
16489 such a suffix---and don't do anything else.
16490
16491 -dumpmachine
16492 Print the compiler's target machine (for example,
16493 i686-pc-linux-gnu)---and don't do anything else.
16494
16495 -dumpversion
16496 Print the compiler version (for example, 3.0, 6.3.0 or 7)---and
16497 don't do anything else. This is the compiler version used in
16498 filesystem paths and specs. Depending on how the compiler has been
16499 configured it can be just a single number (major version), two
16500 numbers separated by a dot (major and minor version) or three
16501 numbers separated by dots (major, minor and patchlevel version).
16502
16503 -dumpfullversion
16504 Print the full compiler version---and don't do anything else. The
16505 output is always three numbers separated by dots, major, minor and
16506 patchlevel version.
16507
16508 -dumpspecs
16509 Print the compiler's built-in specs---and don't do anything else.
16510 (This is used when GCC itself is being built.)
16511
16512 Machine-Dependent Options
16513 Each target machine supported by GCC can have its own options---for
16514 example, to allow you to compile for a particular processor variant or
16515 ABI, or to control optimizations specific to that machine. By
16516 convention, the names of machine-specific options start with -m.
16517
16518 Some configurations of the compiler also support additional target-
16519 specific options, usually for compatibility with other compilers on the
16520 same platform.
16521
16522 AArch64 Options
16523 These options are defined for AArch64 implementations:
16524
16525 -mabi=name
16526 Generate code for the specified data model. Permissible values are
16527 ilp32 for SysV-like data model where int, long int and pointers are
16528 32 bits, and lp64 for SysV-like data model where int is 32 bits,
16529 but long int and pointers are 64 bits.
16530
16531 The default depends on the specific target configuration. Note
16532 that the LP64 and ILP32 ABIs are not link-compatible; you must
16533 compile your entire program with the same ABI, and link with a
16534 compatible set of libraries.
16535
16536 -mbig-endian
16537 Generate big-endian code. This is the default when GCC is
16538 configured for an aarch64_be-*-* target.
16539
16540 -mgeneral-regs-only
16541 Generate code which uses only the general-purpose registers. This
16542 will prevent the compiler from using floating-point and Advanced
16543 SIMD registers but will not impose any restrictions on the
16544 assembler.
16545
16546 -mlittle-endian
16547 Generate little-endian code. This is the default when GCC is
16548 configured for an aarch64-*-* but not an aarch64_be-*-* target.
16549
16550 -mcmodel=tiny
16551 Generate code for the tiny code model. The program and its
16552 statically defined symbols must be within 1MB of each other.
16553 Programs can be statically or dynamically linked.
16554
16555 -mcmodel=small
16556 Generate code for the small code model. The program and its
16557 statically defined symbols must be within 4GB of each other.
16558 Programs can be statically or dynamically linked. This is the
16559 default code model.
16560
16561 -mcmodel=large
16562 Generate code for the large code model. This makes no assumptions
16563 about addresses and sizes of sections. Programs can be statically
16564 linked only. The -mcmodel=large option is incompatible with
16565 -mabi=ilp32, -fpic and -fPIC.
16566
16567 -mstrict-align
16568 -mno-strict-align
16569 Avoid or allow generating memory accesses that may not be aligned
16570 on a natural object boundary as described in the architecture
16571 specification.
16572
16573 -momit-leaf-frame-pointer
16574 -mno-omit-leaf-frame-pointer
16575 Omit or keep the frame pointer in leaf functions. The former
16576 behavior is the default.
16577
16578 -mstack-protector-guard=guard
16579 -mstack-protector-guard-reg=reg
16580 -mstack-protector-guard-offset=offset
16581 Generate stack protection code using canary at guard. Supported
16582 locations are global for a global canary or sysreg for a canary in
16583 an appropriate system register.
16584
16585 With the latter choice the options -mstack-protector-guard-reg=reg
16586 and -mstack-protector-guard-offset=offset furthermore specify which
16587 system register to use as base register for reading the canary, and
16588 from what offset from that base register. There is no default
16589 register or offset as this is entirely for use within the Linux
16590 kernel.
16591
16592 -mtls-dialect=desc
16593 Use TLS descriptors as the thread-local storage mechanism for
16594 dynamic accesses of TLS variables. This is the default.
16595
16596 -mtls-dialect=traditional
16597 Use traditional TLS as the thread-local storage mechanism for
16598 dynamic accesses of TLS variables.
16599
16600 -mtls-size=size
16601 Specify bit size of immediate TLS offsets. Valid values are 12,
16602 24, 32, 48. This option requires binutils 2.26 or newer.
16603
16604 -mfix-cortex-a53-835769
16605 -mno-fix-cortex-a53-835769
16606 Enable or disable the workaround for the ARM Cortex-A53 erratum
16607 number 835769. This involves inserting a NOP instruction between
16608 memory instructions and 64-bit integer multiply-accumulate
16609 instructions.
16610
16611 -mfix-cortex-a53-843419
16612 -mno-fix-cortex-a53-843419
16613 Enable or disable the workaround for the ARM Cortex-A53 erratum
16614 number 843419. This erratum workaround is made at link time and
16615 this will only pass the corresponding flag to the linker.
16616
16617 -mlow-precision-recip-sqrt
16618 -mno-low-precision-recip-sqrt
16619 Enable or disable the reciprocal square root approximation. This
16620 option only has an effect if -ffast-math or
16621 -funsafe-math-optimizations is used as well. Enabling this reduces
16622 precision of reciprocal square root results to about 16 bits for
16623 single precision and to 32 bits for double precision.
16624
16625 -mlow-precision-sqrt
16626 -mno-low-precision-sqrt
16627 Enable or disable the square root approximation. This option only
16628 has an effect if -ffast-math or -funsafe-math-optimizations is used
16629 as well. Enabling this reduces precision of square root results to
16630 about 16 bits for single precision and to 32 bits for double
16631 precision. If enabled, it implies -mlow-precision-recip-sqrt.
16632
16633 -mlow-precision-div
16634 -mno-low-precision-div
16635 Enable or disable the division approximation. This option only has
16636 an effect if -ffast-math or -funsafe-math-optimizations is used as
16637 well. Enabling this reduces precision of division results to about
16638 16 bits for single precision and to 32 bits for double precision.
16639
16640 -mtrack-speculation
16641 -mno-track-speculation
16642 Enable or disable generation of additional code to track
16643 speculative execution through conditional branches. The tracking
16644 state can then be used by the compiler when expanding calls to
16645 "__builtin_speculation_safe_copy" to permit a more efficient code
16646 sequence to be generated.
16647
16648 -moutline-atomics
16649 -mno-outline-atomics
16650 Enable or disable calls to out-of-line helpers to implement atomic
16651 operations. These helpers will, at runtime, determine if the LSE
16652 instructions from ARMv8.1-A can be used; if not, they will use the
16653 load/store-exclusive instructions that are present in the base
16654 ARMv8.0 ISA.
16655
16656 This option is only applicable when compiling for the base ARMv8.0
16657 instruction set. If using a later revision, e.g. -march=armv8.1-a
16658 or -march=armv8-a+lse, the ARMv8.1-Atomics instructions will be
16659 used directly. The same applies when using -mcpu= when the
16660 selected cpu supports the lse feature. This option is on by
16661 default.
16662
16663 -march=name
16664 Specify the name of the target architecture and, optionally, one or
16665 more feature modifiers. This option has the form
16666 -march=arch{+[no]feature}*.
16667
16668 The table below summarizes the permissible values for arch and the
16669 features that they enable by default:
16670
16671 arch value : Architecture : Includes by default
16672 armv8-a : Armv8-A : +fp, +simd
16673 armv8.1-a : Armv8.1-A : armv8-a, +crc, +lse, +rdma
16674 armv8.2-a : Armv8.2-A : armv8.1-a
16675 armv8.3-a : Armv8.3-A : armv8.2-a, +pauth
16676 armv8.4-a : Armv8.4-A : armv8.3-a, +flagm, +fp16fml, +dotprod
16677 armv8.5-a : Armv8.5-A : armv8.4-a, +sb, +ssbs, +predres
16678 armv8.6-a : Armv8.6-A : armv8.5-a, +bf16, +i8mm
16679 armv8.7-a : Armv8.7-A : armv8.6-a, +ls64
16680 armv8.8-a : Armv8.8-a : armv8.7-a, +mops
16681 armv9-a : Armv9-A : armv8.5-a, +sve, +sve2
16682 armv8-r : Armv8-R : armv8-r
16683
16684 The value native is available on native AArch64 GNU/Linux and
16685 causes the compiler to pick the architecture of the host system.
16686 This option has no effect if the compiler is unable to recognize
16687 the architecture of the host system,
16688
16689 The permissible values for feature are listed in the sub-section on
16690 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
16691 Where conflicting feature modifiers are specified, the right-most
16692 feature is used.
16693
16694 GCC uses name to determine what kind of instructions it can emit
16695 when generating assembly code. If -march is specified without
16696 either of -mtune or -mcpu also being specified, the code is tuned
16697 to perform well across a range of target processors implementing
16698 the target architecture.
16699
16700 -mtune=name
16701 Specify the name of the target processor for which GCC should tune
16702 the performance of the code. Permissible values for this option
16703 are: generic, cortex-a35, cortex-a53, cortex-a55, cortex-a57,
16704 cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae,
16705 cortex-a77, cortex-a65, cortex-a65ae, cortex-a34, cortex-a78,
16706 cortex-a78ae, cortex-a78c, ares, exynos-m1, emag, falkor,
16707 neoverse-512tvb, neoverse-e1, neoverse-n1, neoverse-n2,
16708 neoverse-v1, neoverse-v2, qdf24xx, saphira, phecda, xgene1, vulcan,
16709 octeontx, octeontx81, octeontx83, octeontx2, octeontx2t98,
16710 octeontx2t96 octeontx2t93, octeontx2f95, octeontx2f95n,
16711 octeontx2f95mm, a64fx, thunderx, thunderxt88, thunderxt88p1,
16712 thunderxt81, tsv110, thunderxt83, thunderx2t99, thunderx3t110,
16713 zeus, cortex-a57.cortex-a53, cortex-a72.cortex-a53,
16714 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
16715 cortex-a75.cortex-a55, cortex-a76.cortex-a55, cortex-r82,
16716 cortex-x1, cortex-x2, cortex-a510, cortex-a710, ampere1, ampere1a,
16717 native.
16718
16719 The values cortex-a57.cortex-a53, cortex-a72.cortex-a53,
16720 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
16721 cortex-a75.cortex-a55, cortex-a76.cortex-a55 specify that GCC
16722 should tune for a big.LITTLE system.
16723
16724 The value neoverse-512tvb specifies that GCC should tune for
16725 Neoverse cores that (a) implement SVE and (b) have a total vector
16726 bandwidth of 512 bits per cycle. In other words, the option tells
16727 GCC to tune for Neoverse cores that can execute 4 128-bit Advanced
16728 SIMD arithmetic instructions a cycle and that can execute an
16729 equivalent number of SVE arithmetic instructions per cycle (2 for
16730 256-bit SVE, 4 for 128-bit SVE). This is more general than tuning
16731 for a specific core like Neoverse V1 but is more specific than the
16732 default tuning described below.
16733
16734 Additionally on native AArch64 GNU/Linux systems the value native
16735 tunes performance to the host system. This option has no effect if
16736 the compiler is unable to recognize the processor of the host
16737 system.
16738
16739 Where none of -mtune=, -mcpu= or -march= are specified, the code is
16740 tuned to perform well across a range of target processors.
16741
16742 This option cannot be suffixed by feature modifiers.
16743
16744 -mcpu=name
16745 Specify the name of the target processor, optionally suffixed by
16746 one or more feature modifiers. This option has the form
16747 -mcpu=cpu{+[no]feature}*, where the permissible values for cpu are
16748 the same as those available for -mtune. The permissible values for
16749 feature are documented in the sub-section on
16750 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
16751 Where conflicting feature modifiers are specified, the right-most
16752 feature is used.
16753
16754 GCC uses name to determine what kind of instructions it can emit
16755 when generating assembly code (as if by -march) and to determine
16756 the target processor for which to tune for performance (as if by
16757 -mtune). Where this option is used in conjunction with -march or
16758 -mtune, those options take precedence over the appropriate part of
16759 this option.
16760
16761 -mcpu=neoverse-512tvb is special in that it does not refer to a
16762 specific core, but instead refers to all Neoverse cores that (a)
16763 implement SVE and (b) have a total vector bandwidth of 512 bits a
16764 cycle. Unless overridden by -march, -mcpu=neoverse-512tvb
16765 generates code that can run on a Neoverse V1 core, since Neoverse
16766 V1 is the first Neoverse core with these properties. Unless
16767 overridden by -mtune, -mcpu=neoverse-512tvb tunes code in the same
16768 way as for -mtune=neoverse-512tvb.
16769
16770 -moverride=string
16771 Override tuning decisions made by the back-end in response to a
16772 -mtune= switch. The syntax, semantics, and accepted values for
16773 string in this option are not guaranteed to be consistent across
16774 releases.
16775
16776 This option is only intended to be useful when developing GCC.
16777
16778 -mverbose-cost-dump
16779 Enable verbose cost model dumping in the debug dump files. This
16780 option is provided for use in debugging the compiler.
16781
16782 -mpc-relative-literal-loads
16783 -mno-pc-relative-literal-loads
16784 Enable or disable PC-relative literal loads. With this option
16785 literal pools are accessed using a single instruction and emitted
16786 after each function. This limits the maximum size of functions to
16787 1MB. This is enabled by default for -mcmodel=tiny.
16788
16789 -msign-return-address=scope
16790 Select the function scope on which return address signing will be
16791 applied. Permissible values are none, which disables return
16792 address signing, non-leaf, which enables pointer signing for
16793 functions which are not leaf functions, and all, which enables
16794 pointer signing for all functions. The default value is none. This
16795 option has been deprecated by -mbranch-protection.
16796
16797 -mbranch-protection=none|standard|pac-ret[+leaf+b-key]|bti
16798 Select the branch protection features to use. none is the default
16799 and turns off all types of branch protection. standard turns on
16800 all types of branch protection features. If a feature has
16801 additional tuning options, then standard sets it to its standard
16802 level. pac-ret[+leaf] turns on return address signing to its
16803 standard level: signing functions that save the return address to
16804 memory (non-leaf functions will practically always do this) using
16805 the a-key. The optional argument leaf can be used to extend the
16806 signing to include leaf functions. The optional argument b-key can
16807 be used to sign the functions with the B-key instead of the A-key.
16808 bti turns on branch target identification mechanism.
16809
16810 -mharden-sls=opts
16811 Enable compiler hardening against straight line speculation (SLS).
16812 opts is a comma-separated list of the following options:
16813
16814 retbr
16815 blr
16816
16817 In addition, -mharden-sls=all enables all SLS hardening while
16818 -mharden-sls=none disables all SLS hardening.
16819
16820 -msve-vector-bits=bits
16821 Specify the number of bits in an SVE vector register. This option
16822 only has an effect when SVE is enabled.
16823
16824 GCC supports two forms of SVE code generation: "vector-length
16825 agnostic" output that works with any size of vector register and
16826 "vector-length specific" output that allows GCC to make assumptions
16827 about the vector length when it is useful for optimization reasons.
16828 The possible values of bits are: scalable, 128, 256, 512, 1024 and
16829 2048. Specifying scalable selects vector-length agnostic output.
16830 At present -msve-vector-bits=128 also generates vector-length
16831 agnostic output for big-endian targets. All other values generate
16832 vector-length specific code. The behavior of these values may
16833 change in future releases and no value except scalable should be
16834 relied on for producing code that is portable across different
16835 hardware SVE vector lengths.
16836
16837 The default is -msve-vector-bits=scalable, which produces vector-
16838 length agnostic code.
16839
16840 -march and -mcpu Feature Modifiers
16841
16842 Feature modifiers used with -march and -mcpu can be any of the
16843 following and their inverses nofeature:
16844
16845 crc Enable CRC extension. This is on by default for -march=armv8.1-a.
16846
16847 crypto
16848 Enable Crypto extension. This also enables Advanced SIMD and
16849 floating-point instructions.
16850
16851 fp Enable floating-point instructions. This is on by default for all
16852 possible values for options -march and -mcpu.
16853
16854 simd
16855 Enable Advanced SIMD instructions. This also enables floating-
16856 point instructions. This is on by default for all possible values
16857 for options -march and -mcpu.
16858
16859 sve Enable Scalable Vector Extension instructions. This also enables
16860 Advanced SIMD and floating-point instructions.
16861
16862 lse Enable Large System Extension instructions. This is on by default
16863 for -march=armv8.1-a.
16864
16865 rdma
16866 Enable Round Double Multiply Accumulate instructions. This is on
16867 by default for -march=armv8.1-a.
16868
16869 fp16
16870 Enable FP16 extension. This also enables floating-point
16871 instructions.
16872
16873 fp16fml
16874 Enable FP16 fmla extension. This also enables FP16 extensions and
16875 floating-point instructions. This option is enabled by default for
16876 -march=armv8.4-a. Use of this option with architectures prior to
16877 Armv8.2-A is not supported.
16878
16879 rcpc
16880 Enable the RcPc extension. This does not change code generation
16881 from GCC, but is passed on to the assembler, enabling inline asm
16882 statements to use instructions from the RcPc extension.
16883
16884 dotprod
16885 Enable the Dot Product extension. This also enables Advanced SIMD
16886 instructions.
16887
16888 aes Enable the Armv8-a aes and pmull crypto extension. This also
16889 enables Advanced SIMD instructions.
16890
16891 sha2
16892 Enable the Armv8-a sha2 crypto extension. This also enables
16893 Advanced SIMD instructions.
16894
16895 sha3
16896 Enable the sha512 and sha3 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 sm4 Enable the sm3 and sm4 crypto extension. This also enables
16901 Advanced SIMD instructions. Use of this option with architectures
16902 prior to Armv8.2-A is not supported.
16903
16904 profile
16905 Enable the Statistical Profiling extension. This option is only to
16906 enable the extension at the assembler level and does not affect
16907 code generation.
16908
16909 rng Enable the Armv8.5-a Random Number instructions. This option is
16910 only to enable the extension at the assembler level and does not
16911 affect code generation.
16912
16913 memtag
16914 Enable the Armv8.5-a Memory Tagging Extensions. Use of this option
16915 with architectures prior to Armv8.5-A is not supported.
16916
16917 sb Enable the Armv8-a Speculation Barrier instruction. This option is
16918 only to enable the extension at the assembler level and does not
16919 affect code generation. This option is enabled by default for
16920 -march=armv8.5-a.
16921
16922 ssbs
16923 Enable the Armv8-a Speculative Store Bypass Safe instruction. This
16924 option is only to enable the extension at the assembler level and
16925 does not affect code generation. This option is enabled by default
16926 for -march=armv8.5-a.
16927
16928 predres
16929 Enable the Armv8-a Execution and Data Prediction Restriction
16930 instructions. This option is only to enable the extension at the
16931 assembler level and does not affect code generation. This option
16932 is enabled by default for -march=armv8.5-a.
16933
16934 sve2
16935 Enable the Armv8-a Scalable Vector Extension 2. This also enables
16936 SVE instructions.
16937
16938 sve2-bitperm
16939 Enable SVE2 bitperm instructions. This also enables SVE2
16940 instructions.
16941
16942 sve2-sm4
16943 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16944
16945 sve2-aes
16946 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16947
16948 sve2-sha3
16949 Enable SVE2 sha3 instructions. This also enables SVE2
16950 instructions.
16951
16952 tme Enable the Transactional Memory Extension.
16953
16954 i8mm
16955 Enable 8-bit Integer Matrix Multiply instructions. This also
16956 enables Advanced SIMD and floating-point instructions. This option
16957 is enabled by default for -march=armv8.6-a. Use of this option
16958 with architectures prior to Armv8.2-A is not supported.
16959
16960 f32mm
16961 Enable 32-bit Floating point Matrix Multiply instructions. This
16962 also enables SVE instructions. Use of this option with
16963 architectures prior to Armv8.2-A is not supported.
16964
16965 f64mm
16966 Enable 64-bit Floating point Matrix Multiply instructions. This
16967 also enables SVE instructions. Use of this option with
16968 architectures prior to Armv8.2-A is not supported.
16969
16970 bf16
16971 Enable brain half-precision floating-point instructions. This also
16972 enables Advanced SIMD and floating-point instructions. This option
16973 is enabled by default for -march=armv8.6-a. Use of this option
16974 with architectures prior to Armv8.2-A is not supported.
16975
16976 ls64
16977 Enable the 64-byte atomic load and store instructions for
16978 accelerators. This option is enabled by default for
16979 -march=armv8.7-a.
16980
16981 mops
16982 Enable the instructions to accelerate memory operations like
16983 "memcpy", "memmove", "memset". This option is enabled by default
16984 for -march=armv8.8-a
16985
16986 flagm
16987 Enable the Flag Manipulation instructions Extension.
16988
16989 pauth
16990 Enable the Pointer Authentication Extension.
16991
16992 Feature crypto implies aes, sha2, and simd, which implies fp.
16993 Conversely, nofp implies nosimd, which implies nocrypto, noaes and
16994 nosha2.
16995
16996 Adapteva Epiphany Options
16997 These -m options are defined for Adapteva Epiphany:
16998
16999 -mhalf-reg-file
17000 Don't allocate any register in the range "r32"..."r63". That
17001 allows code to run on hardware variants that lack these registers.
17002
17003 -mprefer-short-insn-regs
17004 Preferentially allocate registers that allow short instruction
17005 generation. This can result in increased instruction count, so
17006 this may either reduce or increase overall code size.
17007
17008 -mbranch-cost=num
17009 Set the cost of branches to roughly num "simple" instructions.
17010 This cost is only a heuristic and is not guaranteed to produce
17011 consistent results across releases.
17012
17013 -mcmove
17014 Enable the generation of conditional moves.
17015
17016 -mnops=num
17017 Emit num NOPs before every other generated instruction.
17018
17019 -mno-soft-cmpsf
17020 For single-precision floating-point comparisons, emit an "fsub"
17021 instruction and test the flags. This is faster than a software
17022 comparison, but can get incorrect results in the presence of NaNs,
17023 or when two different small numbers are compared such that their
17024 difference is calculated as zero. The default is -msoft-cmpsf,
17025 which uses slower, but IEEE-compliant, software comparisons.
17026
17027 -mstack-offset=num
17028 Set the offset between the top of the stack and the stack pointer.
17029 E.g., a value of 8 means that the eight bytes in the range
17030 "sp+0...sp+7" can be used by leaf functions without stack
17031 allocation. Values other than 8 or 16 are untested and unlikely to
17032 work. Note also that this option changes the ABI; compiling a
17033 program with a different stack offset than the libraries have been
17034 compiled with generally does not work. This option can be useful
17035 if you want to evaluate if a different stack offset would give you
17036 better code, but to actually use a different stack offset to build
17037 working programs, it is recommended to configure the toolchain with
17038 the appropriate --with-stack-offset=num option.
17039
17040 -mno-round-nearest
17041 Make the scheduler assume that the rounding mode has been set to
17042 truncating. The default is -mround-nearest.
17043
17044 -mlong-calls
17045 If not otherwise specified by an attribute, assume all calls might
17046 be beyond the offset range of the "b" / "bl" instructions, and
17047 therefore load the function address into a register before
17048 performing a (otherwise direct) call. This is the default.
17049
17050 -mshort-calls
17051 If not otherwise specified by an attribute, assume all direct calls
17052 are in the range of the "b" / "bl" instructions, so use these
17053 instructions for direct calls. The default is -mlong-calls.
17054
17055 -msmall16
17056 Assume addresses can be loaded as 16-bit unsigned values. This
17057 does not apply to function addresses for which -mlong-calls
17058 semantics are in effect.
17059
17060 -mfp-mode=mode
17061 Set the prevailing mode of the floating-point unit. This
17062 determines the floating-point mode that is provided and expected at
17063 function call and return time. Making this mode match the mode you
17064 predominantly need at function start can make your programs smaller
17065 and faster by avoiding unnecessary mode switches.
17066
17067 mode can be set to one the following values:
17068
17069 caller
17070 Any mode at function entry is valid, and retained or restored
17071 when the function returns, and when it calls other functions.
17072 This mode is useful for compiling libraries or other
17073 compilation units you might want to incorporate into different
17074 programs with different prevailing FPU modes, and the
17075 convenience of being able to use a single object file outweighs
17076 the size and speed overhead for any extra mode switching that
17077 might be needed, compared with what would be needed with a more
17078 specific choice of prevailing FPU mode.
17079
17080 truncate
17081 This is the mode used for floating-point calculations with
17082 truncating (i.e. round towards zero) rounding mode. That
17083 includes conversion from floating point to integer.
17084
17085 round-nearest
17086 This is the mode used for floating-point calculations with
17087 round-to-nearest-or-even rounding mode.
17088
17089 int This is the mode used to perform integer calculations in the
17090 FPU, e.g. integer multiply, or integer multiply-and-
17091 accumulate.
17092
17093 The default is -mfp-mode=caller
17094
17095 -mno-split-lohi
17096 -mno-postinc
17097 -mno-postmodify
17098 Code generation tweaks that disable, respectively, splitting of
17099 32-bit loads, generation of post-increment addresses, and
17100 generation of post-modify addresses. The defaults are msplit-lohi,
17101 -mpost-inc, and -mpost-modify.
17102
17103 -mnovect-double
17104 Change the preferred SIMD mode to SImode. The default is
17105 -mvect-double, which uses DImode as preferred SIMD mode.
17106
17107 -max-vect-align=num
17108 The maximum alignment for SIMD vector mode types. num may be 4 or
17109 8. The default is 8. Note that this is an ABI change, even though
17110 many library function interfaces are unaffected if they don't use
17111 SIMD vector modes in places that affect size and/or alignment of
17112 relevant types.
17113
17114 -msplit-vecmove-early
17115 Split vector moves into single word moves before reload. In theory
17116 this can give better register allocation, but so far the reverse
17117 seems to be generally the case.
17118
17119 -m1reg-reg
17120 Specify a register to hold the constant -1, which makes loading
17121 small negative constants and certain bitmasks faster. Allowable
17122 values for reg are r43 and r63, which specify use of that register
17123 as a fixed register, and none, which means that no register is used
17124 for this purpose. The default is -m1reg-none.
17125
17126 AMD GCN Options
17127 These options are defined specifically for the AMD GCN port.
17128
17129 -march=gpu
17130 -mtune=gpu
17131 Set architecture type or tuning for gpu. Supported values for gpu
17132 are
17133
17134 fiji
17135 Compile for GCN3 Fiji devices (gfx803).
17136
17137 gfx900
17138 Compile for GCN5 Vega 10 devices (gfx900).
17139
17140 gfx906
17141 Compile for GCN5 Vega 20 devices (gfx906).
17142
17143 -msram-ecc=on
17144 -msram-ecc=off
17145 -msram-ecc=any
17146 Compile binaries suitable for devices with the SRAM-ECC feature
17147 enabled, disabled, or either mode. This feature can be enabled
17148 per-process on some devices. The compiled code must match the
17149 device mode. The default is any, for devices that support it.
17150
17151 -mstack-size=bytes
17152 Specify how many bytes of stack space will be requested for each
17153 GPU thread (wave-front). Beware that there may be many threads and
17154 limited memory available. The size of the stack allocation may
17155 also have an impact on run-time performance. The default is 32KB
17156 when using OpenACC or OpenMP, and 1MB otherwise.
17157
17158 -mxnack
17159 Compile binaries suitable for devices with the XNACK feature
17160 enabled. Some devices always require XNACK and some allow the user
17161 to configure XNACK. The compiled code must match the device mode.
17162 The default is -mno-xnack. At present this option is a placeholder
17163 for support that is not yet implemented.
17164
17165 ARC Options
17166 The following options control the architecture variant for which code
17167 is being compiled:
17168
17169 -mbarrel-shifter
17170 Generate instructions supported by barrel shifter. This is the
17171 default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
17172
17173 -mjli-always
17174 Force to call a function using jli_s instruction. This option is
17175 valid only for ARCv2 architecture.
17176
17177 -mcpu=cpu
17178 Set architecture type, register usage, and instruction scheduling
17179 parameters for cpu. There are also shortcut alias options
17180 available for backward compatibility and convenience. Supported
17181 values for cpu are
17182
17183 arc600
17184 Compile for ARC600. Aliases: -mA6, -mARC600.
17185
17186 arc601
17187 Compile for ARC601. Alias: -mARC601.
17188
17189 arc700
17190 Compile for ARC700. Aliases: -mA7, -mARC700. This is the
17191 default when configured with --with-cpu=arc700.
17192
17193 arcem
17194 Compile for ARC EM.
17195
17196 archs
17197 Compile for ARC HS.
17198
17199 em Compile for ARC EM CPU with no hardware extensions.
17200
17201 em4 Compile for ARC EM4 CPU.
17202
17203 em4_dmips
17204 Compile for ARC EM4 DMIPS CPU.
17205
17206 em4_fpus
17207 Compile for ARC EM4 DMIPS CPU with the single-precision
17208 floating-point extension.
17209
17210 em4_fpuda
17211 Compile for ARC EM4 DMIPS CPU with single-precision floating-
17212 point and double assist instructions.
17213
17214 hs Compile for ARC HS CPU with no hardware extensions except the
17215 atomic instructions.
17216
17217 hs34
17218 Compile for ARC HS34 CPU.
17219
17220 hs38
17221 Compile for ARC HS38 CPU.
17222
17223 hs38_linux
17224 Compile for ARC HS38 CPU with all hardware extensions on.
17225
17226 arc600_norm
17227 Compile for ARC 600 CPU with "norm" instructions enabled.
17228
17229 arc600_mul32x16
17230 Compile for ARC 600 CPU with "norm" and 32x16-bit multiply
17231 instructions enabled.
17232
17233 arc600_mul64
17234 Compile for ARC 600 CPU with "norm" and "mul64"-family
17235 instructions enabled.
17236
17237 arc601_norm
17238 Compile for ARC 601 CPU with "norm" instructions enabled.
17239
17240 arc601_mul32x16
17241 Compile for ARC 601 CPU with "norm" and 32x16-bit multiply
17242 instructions enabled.
17243
17244 arc601_mul64
17245 Compile for ARC 601 CPU with "norm" and "mul64"-family
17246 instructions enabled.
17247
17248 nps400
17249 Compile for ARC 700 on NPS400 chip.
17250
17251 em_mini
17252 Compile for ARC EM minimalist configuration featuring reduced
17253 register set.
17254
17255 -mdpfp
17256 -mdpfp-compact
17257 Generate double-precision FPX instructions, tuned for the compact
17258 implementation.
17259
17260 -mdpfp-fast
17261 Generate double-precision FPX instructions, tuned for the fast
17262 implementation.
17263
17264 -mno-dpfp-lrsr
17265 Disable "lr" and "sr" instructions from using FPX extension aux
17266 registers.
17267
17268 -mea
17269 Generate extended arithmetic instructions. Currently only "divaw",
17270 "adds", "subs", and "sat16" are supported. Only valid for
17271 -mcpu=ARC700.
17272
17273 -mno-mpy
17274 Do not generate "mpy"-family instructions for ARC700. This option
17275 is deprecated.
17276
17277 -mmul32x16
17278 Generate 32x16-bit multiply and multiply-accumulate instructions.
17279
17280 -mmul64
17281 Generate "mul64" and "mulu64" instructions. Only valid for
17282 -mcpu=ARC600.
17283
17284 -mnorm
17285 Generate "norm" instructions. This is the default if -mcpu=ARC700
17286 is in effect.
17287
17288 -mspfp
17289 -mspfp-compact
17290 Generate single-precision FPX instructions, tuned for the compact
17291 implementation.
17292
17293 -mspfp-fast
17294 Generate single-precision FPX instructions, tuned for the fast
17295 implementation.
17296
17297 -msimd
17298 Enable generation of ARC SIMD instructions via target-specific
17299 builtins. Only valid for -mcpu=ARC700.
17300
17301 -msoft-float
17302 This option ignored; it is provided for compatibility purposes
17303 only. Software floating-point code is emitted by default, and this
17304 default can overridden by FPX options; -mspfp, -mspfp-compact, or
17305 -mspfp-fast for single precision, and -mdpfp, -mdpfp-compact, or
17306 -mdpfp-fast for double precision.
17307
17308 -mswap
17309 Generate "swap" instructions.
17310
17311 -matomic
17312 This enables use of the locked load/store conditional extension to
17313 implement atomic memory built-in functions. Not available for ARC
17314 6xx or ARC EM cores.
17315
17316 -mdiv-rem
17317 Enable "div" and "rem" instructions for ARCv2 cores.
17318
17319 -mcode-density
17320 Enable code density instructions for ARC EM. This option is on by
17321 default for ARC HS.
17322
17323 -mll64
17324 Enable double load/store operations for ARC HS cores.
17325
17326 -mtp-regno=regno
17327 Specify thread pointer register number.
17328
17329 -mmpy-option=multo
17330 Compile ARCv2 code with a multiplier design option. You can
17331 specify the option using either a string or numeric value for
17332 multo. wlh1 is the default value. The recognized values are:
17333
17334 0
17335 none
17336 No multiplier available.
17337
17338 1
17339 w 16x16 multiplier, fully pipelined. The following instructions
17340 are enabled: "mpyw" and "mpyuw".
17341
17342 2
17343 wlh1
17344 32x32 multiplier, fully pipelined (1 stage). The following
17345 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17346 "mpymu", and "mpy_s".
17347
17348 3
17349 wlh2
17350 32x32 multiplier, fully pipelined (2 stages). The following
17351 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17352 "mpymu", and "mpy_s".
17353
17354 4
17355 wlh3
17356 Two 16x16 multipliers, blocking, sequential. The following
17357 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17358 "mpymu", and "mpy_s".
17359
17360 5
17361 wlh4
17362 One 16x16 multiplier, blocking, sequential. The following
17363 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17364 "mpymu", and "mpy_s".
17365
17366 6
17367 wlh5
17368 One 32x4 multiplier, blocking, sequential. The following
17369 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17370 "mpymu", and "mpy_s".
17371
17372 7
17373 plus_dmpy
17374 ARC HS SIMD support.
17375
17376 8
17377 plus_macd
17378 ARC HS SIMD support.
17379
17380 9
17381 plus_qmacw
17382 ARC HS SIMD support.
17383
17384 This option is only available for ARCv2 cores.
17385
17386 -mfpu=fpu
17387 Enables support for specific floating-point hardware extensions for
17388 ARCv2 cores. Supported values for fpu are:
17389
17390 fpus
17391 Enables support for single-precision floating-point hardware
17392 extensions.
17393
17394 fpud
17395 Enables support for double-precision floating-point hardware
17396 extensions. The single-precision floating-point extension is
17397 also enabled. Not available for ARC EM.
17398
17399 fpuda
17400 Enables support for double-precision floating-point hardware
17401 extensions using double-precision assist instructions. The
17402 single-precision floating-point extension is also enabled.
17403 This option is only available for ARC EM.
17404
17405 fpuda_div
17406 Enables support for double-precision floating-point hardware
17407 extensions using double-precision assist instructions. The
17408 single-precision floating-point, square-root, and divide
17409 extensions are also enabled. This option is only available for
17410 ARC EM.
17411
17412 fpuda_fma
17413 Enables support for double-precision floating-point hardware
17414 extensions using double-precision assist instructions. The
17415 single-precision floating-point and fused multiply and add
17416 hardware extensions are also enabled. This option is only
17417 available for ARC EM.
17418
17419 fpuda_all
17420 Enables support for double-precision floating-point hardware
17421 extensions using double-precision assist instructions. All
17422 single-precision floating-point hardware extensions are also
17423 enabled. This option is only available for ARC EM.
17424
17425 fpus_div
17426 Enables support for single-precision floating-point, square-
17427 root and divide hardware extensions.
17428
17429 fpud_div
17430 Enables support for double-precision floating-point, square-
17431 root and divide hardware extensions. This option includes
17432 option fpus_div. Not available for ARC EM.
17433
17434 fpus_fma
17435 Enables support for single-precision floating-point and fused
17436 multiply and add hardware extensions.
17437
17438 fpud_fma
17439 Enables support for double-precision floating-point and fused
17440 multiply and add hardware extensions. This option includes
17441 option fpus_fma. Not available for ARC EM.
17442
17443 fpus_all
17444 Enables support for all single-precision floating-point
17445 hardware extensions.
17446
17447 fpud_all
17448 Enables support for all single- and double-precision floating-
17449 point hardware extensions. Not available for ARC EM.
17450
17451 -mirq-ctrl-saved=register-range, blink, lp_count
17452 Specifies general-purposes registers that the processor
17453 automatically saves/restores on interrupt entry and exit.
17454 register-range is specified as two registers separated by a dash.
17455 The register range always starts with "r0", the upper limit is "fp"
17456 register. blink and lp_count are optional. This option is only
17457 valid for ARC EM and ARC HS cores.
17458
17459 -mrgf-banked-regs=number
17460 Specifies the number of registers replicated in second register
17461 bank on entry to fast interrupt. Fast interrupts are interrupts
17462 with the highest priority level P0. These interrupts save only PC
17463 and STATUS32 registers to avoid memory transactions during
17464 interrupt entry and exit sequences. Use this option when you are
17465 using fast interrupts in an ARC V2 family processor. Permitted
17466 values are 4, 8, 16, and 32.
17467
17468 -mlpc-width=width
17469 Specify the width of the "lp_count" register. Valid values for
17470 width are 8, 16, 20, 24, 28 and 32 bits. The default width is
17471 fixed to 32 bits. If the width is less than 32, the compiler does
17472 not attempt to transform loops in your program to use the zero-
17473 delay loop mechanism unless it is known that the "lp_count"
17474 register can hold the required loop-counter value. Depending on
17475 the width specified, the compiler and run-time library might
17476 continue to use the loop mechanism for various needs. This option
17477 defines macro "__ARC_LPC_WIDTH__" with the value of width.
17478
17479 -mrf16
17480 This option instructs the compiler to generate code for a 16-entry
17481 register file. This option defines the "__ARC_RF16__" preprocessor
17482 macro.
17483
17484 -mbranch-index
17485 Enable use of "bi" or "bih" instructions to implement jump tables.
17486
17487 The following options are passed through to the assembler, and also
17488 define preprocessor macro symbols.
17489
17490 -mdsp-packa
17491 Passed down to the assembler to enable the DSP Pack A extensions.
17492 Also sets the preprocessor symbol "__Xdsp_packa". This option is
17493 deprecated.
17494
17495 -mdvbf
17496 Passed down to the assembler to enable the dual Viterbi butterfly
17497 extension. Also sets the preprocessor symbol "__Xdvbf". This
17498 option is deprecated.
17499
17500 -mlock
17501 Passed down to the assembler to enable the locked load/store
17502 conditional extension. Also sets the preprocessor symbol
17503 "__Xlock".
17504
17505 -mmac-d16
17506 Passed down to the assembler. Also sets the preprocessor symbol
17507 "__Xxmac_d16". This option is deprecated.
17508
17509 -mmac-24
17510 Passed down to the assembler. Also sets the preprocessor symbol
17511 "__Xxmac_24". This option is deprecated.
17512
17513 -mrtsc
17514 Passed down to the assembler to enable the 64-bit time-stamp
17515 counter extension instruction. Also sets the preprocessor symbol
17516 "__Xrtsc". This option is deprecated.
17517
17518 -mswape
17519 Passed down to the assembler to enable the swap byte ordering
17520 extension instruction. Also sets the preprocessor symbol
17521 "__Xswape".
17522
17523 -mtelephony
17524 Passed down to the assembler to enable dual- and single-operand
17525 instructions for telephony. Also sets the preprocessor symbol
17526 "__Xtelephony". This option is deprecated.
17527
17528 -mxy
17529 Passed down to the assembler to enable the XY memory extension.
17530 Also sets the preprocessor symbol "__Xxy".
17531
17532 The following options control how the assembly code is annotated:
17533
17534 -misize
17535 Annotate assembler instructions with estimated addresses.
17536
17537 -mannotate-align
17538 Explain what alignment considerations lead to the decision to make
17539 an instruction short or long.
17540
17541 The following options are passed through to the linker:
17542
17543 -marclinux
17544 Passed through to the linker, to specify use of the "arclinux"
17545 emulation. This option is enabled by default in tool chains built
17546 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
17547 profiling is not requested.
17548
17549 -marclinux_prof
17550 Passed through to the linker, to specify use of the "arclinux_prof"
17551 emulation. This option is enabled by default in tool chains built
17552 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
17553 profiling is requested.
17554
17555 The following options control the semantics of generated code:
17556
17557 -mlong-calls
17558 Generate calls as register indirect calls, thus providing access to
17559 the full 32-bit address range.
17560
17561 -mmedium-calls
17562 Don't use less than 25-bit addressing range for calls, which is the
17563 offset available for an unconditional branch-and-link instruction.
17564 Conditional execution of function calls is suppressed, to allow use
17565 of the 25-bit range, rather than the 21-bit range with conditional
17566 branch-and-link. This is the default for tool chains built for
17567 "arc-linux-uclibc" and "arceb-linux-uclibc" targets.
17568
17569 -G num
17570 Put definitions of externally-visible data in a small data section
17571 if that data is no bigger than num bytes. The default value of num
17572 is 4 for any ARC configuration, or 8 when we have double load/store
17573 operations.
17574
17575 -mno-sdata
17576 Do not generate sdata references. This is the default for tool
17577 chains built for "arc-linux-uclibc" and "arceb-linux-uclibc"
17578 targets.
17579
17580 -mvolatile-cache
17581 Use ordinarily cached memory accesses for volatile references.
17582 This is the default.
17583
17584 -mno-volatile-cache
17585 Enable cache bypass for volatile references.
17586
17587 The following options fine tune code generation:
17588
17589 -malign-call
17590 Does nothing. Preserved for backward compatibility.
17591
17592 -mauto-modify-reg
17593 Enable the use of pre/post modify with register displacement.
17594
17595 -mbbit-peephole
17596 Enable bbit peephole2.
17597
17598 -mno-brcc
17599 This option disables a target-specific pass in arc_reorg to
17600 generate compare-and-branch ("brcc") instructions. It has no
17601 effect on generation of these instructions driven by the combiner
17602 pass.
17603
17604 -mcase-vector-pcrel
17605 Use PC-relative switch case tables to enable case table shortening.
17606 This is the default for -Os.
17607
17608 -mcompact-casesi
17609 Enable compact "casesi" pattern. This is the default for -Os, and
17610 only available for ARCv1 cores. This option is deprecated.
17611
17612 -mno-cond-exec
17613 Disable the ARCompact-specific pass to generate conditional
17614 execution instructions.
17615
17616 Due to delay slot scheduling and interactions between operand
17617 numbers, literal sizes, instruction lengths, and the support for
17618 conditional execution, the target-independent pass to generate
17619 conditional execution is often lacking, so the ARC port has kept a
17620 special pass around that tries to find more conditional execution
17621 generation opportunities after register allocation, branch
17622 shortening, and delay slot scheduling have been done. This pass
17623 generally, but not always, improves performance and code size, at
17624 the cost of extra compilation time, which is why there is an option
17625 to switch it off. If you have a problem with call instructions
17626 exceeding their allowable offset range because they are
17627 conditionalized, you should consider using -mmedium-calls instead.
17628
17629 -mearly-cbranchsi
17630 Enable pre-reload use of the "cbranchsi" pattern.
17631
17632 -mexpand-adddi
17633 Expand "adddi3" and "subdi3" at RTL generation time into "add.f",
17634 "adc" etc. This option is deprecated.
17635
17636 -mindexed-loads
17637 Enable the use of indexed loads. This can be problematic because
17638 some optimizers then assume that indexed stores exist, which is not
17639 the case.
17640
17641 -mlra
17642 Enable Local Register Allocation. This is still experimental for
17643 ARC, so by default the compiler uses standard reload (i.e.
17644 -mno-lra).
17645
17646 -mlra-priority-none
17647 Don't indicate any priority for target registers.
17648
17649 -mlra-priority-compact
17650 Indicate target register priority for r0..r3 / r12..r15.
17651
17652 -mlra-priority-noncompact
17653 Reduce target register priority for r0..r3 / r12..r15.
17654
17655 -mmillicode
17656 When optimizing for size (using -Os), prologues and epilogues that
17657 have to save or restore a large number of registers are often
17658 shortened by using call to a special function in libgcc; this is
17659 referred to as a millicode call. As these calls can pose
17660 performance issues, and/or cause linking issues when linking in a
17661 nonstandard way, this option is provided to turn on or off
17662 millicode call generation.
17663
17664 -mcode-density-frame
17665 This option enable the compiler to emit "enter" and "leave"
17666 instructions. These instructions are only valid for CPUs with
17667 code-density feature.
17668
17669 -mmixed-code
17670 Does nothing. Preserved for backward compatibility.
17671
17672 -mq-class
17673 Ths option is deprecated. Enable q instruction alternatives. This
17674 is the default for -Os.
17675
17676 -mRcq
17677 Enable Rcq constraint handling. Most short code generation depends
17678 on this. This is the default.
17679
17680 -mRcw
17681 Enable Rcw constraint handling. Most ccfsm condexec mostly depends
17682 on this. This is the default.
17683
17684 -msize-level=level
17685 Fine-tune size optimization with regards to instruction lengths and
17686 alignment. The recognized values for level are:
17687
17688 0 No size optimization. This level is deprecated and treated
17689 like 1.
17690
17691 1 Short instructions are used opportunistically.
17692
17693 2 In addition, alignment of loops and of code after barriers are
17694 dropped.
17695
17696 3 In addition, optional data alignment is dropped, and the option
17697 Os is enabled.
17698
17699 This defaults to 3 when -Os is in effect. Otherwise, the behavior
17700 when this is not set is equivalent to level 1.
17701
17702 -mtune=cpu
17703 Set instruction scheduling parameters for cpu, overriding any
17704 implied by -mcpu=.
17705
17706 Supported values for cpu are
17707
17708 ARC600
17709 Tune for ARC600 CPU.
17710
17711 ARC601
17712 Tune for ARC601 CPU.
17713
17714 ARC700
17715 Tune for ARC700 CPU with standard multiplier block.
17716
17717 ARC700-xmac
17718 Tune for ARC700 CPU with XMAC block.
17719
17720 ARC725D
17721 Tune for ARC725D CPU.
17722
17723 ARC750D
17724 Tune for ARC750D CPU.
17725
17726 -mmultcost=num
17727 Cost to assume for a multiply instruction, with 4 being equal to a
17728 normal instruction.
17729
17730 -munalign-prob-threshold=probability
17731 Does nothing. Preserved for backward compatibility.
17732
17733 The following options are maintained for backward compatibility, but
17734 are now deprecated and will be removed in a future release:
17735
17736 -margonaut
17737 Obsolete FPX.
17738
17739 -mbig-endian
17740 -EB Compile code for big-endian targets. Use of these options is now
17741 deprecated. Big-endian code is supported by configuring GCC to
17742 build "arceb-elf32" and "arceb-linux-uclibc" targets, for which big
17743 endian is the default.
17744
17745 -mlittle-endian
17746 -EL Compile code for little-endian targets. Use of these options is
17747 now deprecated. Little-endian code is supported by configuring GCC
17748 to build "arc-elf32" and "arc-linux-uclibc" targets, for which
17749 little endian is the default.
17750
17751 -mbarrel_shifter
17752 Replaced by -mbarrel-shifter.
17753
17754 -mdpfp_compact
17755 Replaced by -mdpfp-compact.
17756
17757 -mdpfp_fast
17758 Replaced by -mdpfp-fast.
17759
17760 -mdsp_packa
17761 Replaced by -mdsp-packa.
17762
17763 -mEA
17764 Replaced by -mea.
17765
17766 -mmac_24
17767 Replaced by -mmac-24.
17768
17769 -mmac_d16
17770 Replaced by -mmac-d16.
17771
17772 -mspfp_compact
17773 Replaced by -mspfp-compact.
17774
17775 -mspfp_fast
17776 Replaced by -mspfp-fast.
17777
17778 -mtune=cpu
17779 Values arc600, arc601, arc700 and arc700-xmac for cpu are replaced
17780 by ARC600, ARC601, ARC700 and ARC700-xmac respectively.
17781
17782 -multcost=num
17783 Replaced by -mmultcost.
17784
17785 ARM Options
17786 These -m options are defined for the ARM port:
17787
17788 -mabi=name
17789 Generate code for the specified ABI. Permissible values are: apcs-
17790 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
17791
17792 -mapcs-frame
17793 Generate a stack frame that is compliant with the ARM Procedure
17794 Call Standard for all functions, even if this is not strictly
17795 necessary for correct execution of the code. Specifying
17796 -fomit-frame-pointer with this option causes the stack frames not
17797 to be generated for leaf functions. The default is
17798 -mno-apcs-frame. This option is deprecated.
17799
17800 -mapcs
17801 This is a synonym for -mapcs-frame and is deprecated.
17802
17803 -mthumb-interwork
17804 Generate code that supports calling between the ARM and Thumb
17805 instruction sets. Without this option, on pre-v5 architectures,
17806 the two instruction sets cannot be reliably used inside one
17807 program. The default is -mno-thumb-interwork, since slightly
17808 larger code is generated when -mthumb-interwork is specified. In
17809 AAPCS configurations this option is meaningless.
17810
17811 -mno-sched-prolog
17812 Prevent the reordering of instructions in the function prologue, or
17813 the merging of those instruction with the instructions in the
17814 function's body. This means that all functions start with a
17815 recognizable set of instructions (or in fact one of a choice from a
17816 small set of different function prologues), and this information
17817 can be used to locate the start of functions inside an executable
17818 piece of code. The default is -msched-prolog.
17819
17820 -mfloat-abi=name
17821 Specifies which floating-point ABI to use. Permissible values are:
17822 soft, softfp and hard.
17823
17824 Specifying soft causes GCC to generate output containing library
17825 calls for floating-point operations. softfp allows the generation
17826 of code using hardware floating-point instructions, but still uses
17827 the soft-float calling conventions. hard allows generation of
17828 floating-point instructions and uses FPU-specific calling
17829 conventions.
17830
17831 The default depends on the specific target configuration. Note
17832 that the hard-float and soft-float ABIs are not link-compatible;
17833 you must compile your entire program with the same ABI, and link
17834 with a compatible set of libraries.
17835
17836 -mgeneral-regs-only
17837 Generate code which uses only the general-purpose registers. This
17838 will prevent the compiler from using floating-point and Advanced
17839 SIMD registers but will not impose any restrictions on the
17840 assembler.
17841
17842 -mlittle-endian
17843 Generate code for a processor running in little-endian mode. This
17844 is the default for all standard configurations.
17845
17846 -mbig-endian
17847 Generate code for a processor running in big-endian mode; the
17848 default is to compile code for a little-endian processor.
17849
17850 -mbe8
17851 -mbe32
17852 When linking a big-endian image select between BE8 and BE32
17853 formats. The option has no effect for little-endian images and is
17854 ignored. The default is dependent on the selected target
17855 architecture. For ARMv6 and later architectures the default is
17856 BE8, for older architectures the default is BE32. BE32 format has
17857 been deprecated by ARM.
17858
17859 -march=name[+extension...]
17860 This specifies the name of the target ARM architecture. GCC uses
17861 this name to determine what kind of instructions it can emit when
17862 generating assembly code. This option can be used in conjunction
17863 with or instead of the -mcpu= option.
17864
17865 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
17866 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
17867 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
17868 armv8.6-a, armv9-a, armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m,
17869 armv7e-m, armv8-m.base, armv8-m.main, armv8.1-m.main, armv9-a,
17870 iwmmxt and iwmmxt2.
17871
17872 Additionally, the following architectures, which lack support for
17873 the Thumb execution state, are recognized but support is
17874 deprecated: armv4.
17875
17876 Many of the architectures support extensions. These can be added
17877 by appending +extension to the architecture name. Extension
17878 options are processed in order and capabilities accumulate. An
17879 extension will also enable any necessary base extensions upon which
17880 it depends. For example, the +crypto extension will always enable
17881 the +simd extension. The exception to the additive construction is
17882 for extensions that are prefixed with +no...: these extensions
17883 disable the specified option and any other extensions that may
17884 depend on the presence of that extension.
17885
17886 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
17887 writing -march=armv7-a+vfpv4 since the +simd option is entirely
17888 disabled by the +nofp option that follows it.
17889
17890 Most extension names are generically named, but have an effect that
17891 is dependent upon the architecture to which it is applied. For
17892 example, the +simd option can be applied to both armv7-a and
17893 armv8-a architectures, but will enable the original ARMv7-A
17894 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
17895 for armv8-a.
17896
17897 The table below lists the supported extensions for each
17898 architecture. Architectures not mentioned do not support any
17899 extensions.
17900
17901 armv5te
17902 armv6
17903 armv6j
17904 armv6k
17905 armv6kz
17906 armv6t2
17907 armv6z
17908 armv6zk
17909 +fp The VFPv2 floating-point instructions. The extension
17910 +vfpv2 can be used as an alias for this extension.
17911
17912 +nofp
17913 Disable the floating-point instructions.
17914
17915 armv7
17916 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
17917 architectures.
17918
17919 +fp The VFPv3 floating-point instructions, with 16 double-
17920 precision registers. The extension +vfpv3-d16 can be used
17921 as an alias for this extension. Note that floating-point
17922 is not supported by the base ARMv7-M architecture, but is
17923 compatible with both the ARMv7-A and ARMv7-R architectures.
17924
17925 +nofp
17926 Disable the floating-point instructions.
17927
17928 armv7-a
17929 +mp The multiprocessing extension.
17930
17931 +sec
17932 The security extension.
17933
17934 +fp The VFPv3 floating-point instructions, with 16 double-
17935 precision registers. The extension +vfpv3-d16 can be used
17936 as an alias for this extension.
17937
17938 +simd
17939 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17940 instructions. The extensions +neon and +neon-vfpv3 can be
17941 used as aliases for this extension.
17942
17943 +vfpv3
17944 The VFPv3 floating-point instructions, with 32 double-
17945 precision registers.
17946
17947 +vfpv3-d16-fp16
17948 The VFPv3 floating-point instructions, with 16 double-
17949 precision registers and the half-precision floating-point
17950 conversion operations.
17951
17952 +vfpv3-fp16
17953 The VFPv3 floating-point instructions, with 32 double-
17954 precision registers and the half-precision floating-point
17955 conversion operations.
17956
17957 +vfpv4-d16
17958 The VFPv4 floating-point instructions, with 16 double-
17959 precision registers.
17960
17961 +vfpv4
17962 The VFPv4 floating-point instructions, with 32 double-
17963 precision registers.
17964
17965 +neon-fp16
17966 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17967 instructions, with the half-precision floating-point
17968 conversion operations.
17969
17970 +neon-vfpv4
17971 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17972 instructions.
17973
17974 +nosimd
17975 Disable the Advanced SIMD instructions (does not disable
17976 floating point).
17977
17978 +nofp
17979 Disable the floating-point and Advanced SIMD instructions.
17980
17981 armv7ve
17982 The extended version of the ARMv7-A architecture with support
17983 for virtualization.
17984
17985 +fp The VFPv4 floating-point instructions, with 16 double-
17986 precision registers. The extension +vfpv4-d16 can be used
17987 as an alias for this extension.
17988
17989 +simd
17990 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17991 instructions. The extension +neon-vfpv4 can be used as an
17992 alias for this extension.
17993
17994 +vfpv3-d16
17995 The VFPv3 floating-point instructions, with 16 double-
17996 precision registers.
17997
17998 +vfpv3
17999 The VFPv3 floating-point instructions, with 32 double-
18000 precision registers.
18001
18002 +vfpv3-d16-fp16
18003 The VFPv3 floating-point instructions, with 16 double-
18004 precision registers and the half-precision floating-point
18005 conversion operations.
18006
18007 +vfpv3-fp16
18008 The VFPv3 floating-point instructions, with 32 double-
18009 precision registers and the half-precision floating-point
18010 conversion operations.
18011
18012 +vfpv4-d16
18013 The VFPv4 floating-point instructions, with 16 double-
18014 precision registers.
18015
18016 +vfpv4
18017 The VFPv4 floating-point instructions, with 32 double-
18018 precision registers.
18019
18020 +neon
18021 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
18022 instructions. The extension +neon-vfpv3 can be used as an
18023 alias for this extension.
18024
18025 +neon-fp16
18026 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
18027 instructions, with the half-precision floating-point
18028 conversion operations.
18029
18030 +nosimd
18031 Disable the Advanced SIMD instructions (does not disable
18032 floating point).
18033
18034 +nofp
18035 Disable the floating-point and Advanced SIMD instructions.
18036
18037 armv8-a
18038 +crc
18039 The Cyclic Redundancy Check (CRC) instructions.
18040
18041 +simd
18042 The ARMv8-A Advanced SIMD and floating-point instructions.
18043
18044 +crypto
18045 The cryptographic instructions.
18046
18047 +nocrypto
18048 Disable the cryptographic instructions.
18049
18050 +nofp
18051 Disable the floating-point, Advanced SIMD and cryptographic
18052 instructions.
18053
18054 +sb Speculation Barrier Instruction.
18055
18056 +predres
18057 Execution and Data Prediction Restriction Instructions.
18058
18059 armv8.1-a
18060 +simd
18061 The ARMv8.1-A Advanced SIMD and floating-point
18062 instructions.
18063
18064 +crypto
18065 The cryptographic instructions. This also enables the
18066 Advanced SIMD and floating-point instructions.
18067
18068 +nocrypto
18069 Disable the cryptographic instructions.
18070
18071 +nofp
18072 Disable the floating-point, Advanced SIMD and cryptographic
18073 instructions.
18074
18075 +sb Speculation Barrier Instruction.
18076
18077 +predres
18078 Execution and Data Prediction Restriction Instructions.
18079
18080 armv8.2-a
18081 armv8.3-a
18082 +fp16
18083 The half-precision floating-point data processing
18084 instructions. This also enables the Advanced SIMD and
18085 floating-point instructions.
18086
18087 +fp16fml
18088 The half-precision floating-point fmla extension. This
18089 also enables the half-precision floating-point extension
18090 and Advanced SIMD and floating-point instructions.
18091
18092 +simd
18093 The ARMv8.1-A Advanced SIMD and floating-point
18094 instructions.
18095
18096 +crypto
18097 The cryptographic instructions. This also enables the
18098 Advanced SIMD and floating-point instructions.
18099
18100 +dotprod
18101 Enable the Dot Product extension. This also enables
18102 Advanced SIMD instructions.
18103
18104 +nocrypto
18105 Disable the cryptographic extension.
18106
18107 +nofp
18108 Disable the floating-point, Advanced SIMD and cryptographic
18109 instructions.
18110
18111 +sb Speculation Barrier Instruction.
18112
18113 +predres
18114 Execution and Data Prediction Restriction Instructions.
18115
18116 +i8mm
18117 8-bit Integer Matrix Multiply instructions. This also
18118 enables Advanced SIMD and floating-point instructions.
18119
18120 +bf16
18121 Brain half-precision floating-point instructions. This
18122 also enables Advanced SIMD and floating-point instructions.
18123
18124 armv8.4-a
18125 +fp16
18126 The half-precision floating-point data processing
18127 instructions. This also enables the Advanced SIMD and
18128 floating-point instructions as well as the Dot Product
18129 extension and the half-precision floating-point fmla
18130 extension.
18131
18132 +simd
18133 The ARMv8.3-A Advanced SIMD and floating-point instructions
18134 as well as the Dot Product extension.
18135
18136 +crypto
18137 The cryptographic instructions. This also enables the
18138 Advanced SIMD and floating-point instructions as well as
18139 the Dot Product extension.
18140
18141 +nocrypto
18142 Disable the cryptographic extension.
18143
18144 +nofp
18145 Disable the floating-point, Advanced SIMD and cryptographic
18146 instructions.
18147
18148 +sb Speculation Barrier Instruction.
18149
18150 +predres
18151 Execution and Data Prediction Restriction Instructions.
18152
18153 +i8mm
18154 8-bit Integer Matrix Multiply instructions. This also
18155 enables Advanced SIMD and floating-point instructions.
18156
18157 +bf16
18158 Brain half-precision floating-point instructions. This
18159 also enables Advanced SIMD and floating-point instructions.
18160
18161 armv8.5-a
18162 +fp16
18163 The half-precision floating-point data processing
18164 instructions. This also enables the Advanced SIMD and
18165 floating-point instructions as well as the Dot Product
18166 extension and the half-precision floating-point fmla
18167 extension.
18168
18169 +simd
18170 The ARMv8.3-A Advanced SIMD and floating-point instructions
18171 as well as the Dot Product extension.
18172
18173 +crypto
18174 The cryptographic instructions. This also enables the
18175 Advanced SIMD and floating-point instructions as well as
18176 the Dot Product extension.
18177
18178 +nocrypto
18179 Disable the cryptographic extension.
18180
18181 +nofp
18182 Disable the floating-point, Advanced SIMD and cryptographic
18183 instructions.
18184
18185 +i8mm
18186 8-bit Integer Matrix Multiply instructions. This also
18187 enables Advanced SIMD and floating-point instructions.
18188
18189 +bf16
18190 Brain half-precision floating-point instructions. This
18191 also enables Advanced SIMD and floating-point instructions.
18192
18193 armv8.6-a
18194 +fp16
18195 The half-precision floating-point data processing
18196 instructions. This also enables the Advanced SIMD and
18197 floating-point instructions as well as the Dot Product
18198 extension and the half-precision floating-point fmla
18199 extension.
18200
18201 +simd
18202 The ARMv8.3-A Advanced SIMD and floating-point instructions
18203 as well as the Dot Product extension.
18204
18205 +crypto
18206 The cryptographic instructions. This also enables the
18207 Advanced SIMD and floating-point instructions as well as
18208 the Dot Product extension.
18209
18210 +nocrypto
18211 Disable the cryptographic extension.
18212
18213 +nofp
18214 Disable the floating-point, Advanced SIMD and cryptographic
18215 instructions.
18216
18217 +i8mm
18218 8-bit Integer Matrix Multiply instructions. This also
18219 enables Advanced SIMD and floating-point instructions.
18220
18221 +bf16
18222 Brain half-precision floating-point instructions. This
18223 also enables Advanced SIMD and floating-point instructions.
18224
18225 armv7-r
18226 +fp.sp
18227 The single-precision VFPv3 floating-point instructions.
18228 The extension +vfpv3xd can be used as an alias for this
18229 extension.
18230
18231 +fp The VFPv3 floating-point instructions with 16 double-
18232 precision registers. The extension +vfpv3-d16 can be used
18233 as an alias for this extension.
18234
18235 +vfpv3xd-d16-fp16
18236 The single-precision VFPv3 floating-point instructions with
18237 16 double-precision registers and the half-precision
18238 floating-point conversion operations.
18239
18240 +vfpv3-d16-fp16
18241 The VFPv3 floating-point instructions with 16 double-
18242 precision registers and the half-precision floating-point
18243 conversion operations.
18244
18245 +nofp
18246 Disable the floating-point extension.
18247
18248 +idiv
18249 The ARM-state integer division instructions.
18250
18251 +noidiv
18252 Disable the ARM-state integer division extension.
18253
18254 armv7e-m
18255 +fp The single-precision VFPv4 floating-point instructions.
18256
18257 +fpv5
18258 The single-precision FPv5 floating-point instructions.
18259
18260 +fp.dp
18261 The single- and double-precision FPv5 floating-point
18262 instructions.
18263
18264 +nofp
18265 Disable the floating-point extensions.
18266
18267 armv8.1-m.main
18268 +dsp
18269 The DSP instructions.
18270
18271 +mve
18272 The M-Profile Vector Extension (MVE) integer instructions.
18273
18274 +mve.fp
18275 The M-Profile Vector Extension (MVE) integer and single
18276 precision floating-point instructions.
18277
18278 +fp The single-precision floating-point instructions.
18279
18280 +fp.dp
18281 The single- and double-precision floating-point
18282 instructions.
18283
18284 +nofp
18285 Disable the floating-point extension.
18286
18287 +cdecp0, +cdecp1, ... , +cdecp7
18288 Enable the Custom Datapath Extension (CDE) on selected
18289 coprocessors according to the numbers given in the options
18290 in the range 0 to 7.
18291
18292 armv8-m.main
18293 +dsp
18294 The DSP instructions.
18295
18296 +nodsp
18297 Disable the DSP extension.
18298
18299 +fp The single-precision floating-point instructions.
18300
18301 +fp.dp
18302 The single- and double-precision floating-point
18303 instructions.
18304
18305 +nofp
18306 Disable the floating-point extension.
18307
18308 +cdecp0, +cdecp1, ... , +cdecp7
18309 Enable the Custom Datapath Extension (CDE) on selected
18310 coprocessors according to the numbers given in the options
18311 in the range 0 to 7.
18312
18313 armv8-r
18314 +crc
18315 The Cyclic Redundancy Check (CRC) instructions.
18316
18317 +fp.sp
18318 The single-precision FPv5 floating-point instructions.
18319
18320 +simd
18321 The ARMv8-A Advanced SIMD and floating-point instructions.
18322
18323 +crypto
18324 The cryptographic instructions.
18325
18326 +nocrypto
18327 Disable the cryptographic instructions.
18328
18329 +nofp
18330 Disable the floating-point, Advanced SIMD and cryptographic
18331 instructions.
18332
18333 -march=native causes the compiler to auto-detect the architecture
18334 of the build computer. At present, this feature is only supported
18335 on GNU/Linux, and not all architectures are recognized. If the
18336 auto-detect is unsuccessful the option has no effect.
18337
18338 -mtune=name
18339 This option specifies the name of the target ARM processor for
18340 which GCC should tune the performance of the code. For some ARM
18341 implementations better performance can be obtained by using this
18342 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
18343 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
18344 strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t, arm922t,
18345 arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t, arm9tdmi,
18346 arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e, arm1022e,
18347 arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp, arm1156t2-s,
18348 arm1156t2f-s, arm1176jz-s, arm1176jzf-s, generic-armv7-a,
18349 cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
18350 cortex-a17, cortex-a32, cortex-a35, cortex-a53, cortex-a55,
18351 cortex-a57, cortex-a72, cortex-a73, cortex-a75, cortex-a76,
18352 cortex-a76ae, cortex-a77, cortex-a78, cortex-a78ae, cortex-a78c,
18353 cortex-a710, ares, cortex-r4, cortex-r4f, cortex-r5, cortex-r7,
18354 cortex-r8, cortex-r52, cortex-r52plus, cortex-m0, cortex-m0plus,
18355 cortex-m1, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33,
18356 cortex-m35p, cortex-m55, cortex-x1, cortex-m1.small-multiply,
18357 cortex-m0.small-multiply, cortex-m0plus.small-multiply, exynos-m1,
18358 marvell-pj4, neoverse-n1, neoverse-n2, neoverse-v1, xscale, iwmmxt,
18359 iwmmxt2, ep9312, fa526, fa626, fa606te, fa626te, fmp626, fa726te,
18360 xgene1.
18361
18362 Additionally, this option can specify that GCC should tune the
18363 performance of the code for a big.LITTLE system. Permissible names
18364 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
18365 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
18366 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
18367 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
18368
18369 -mtune=generic-arch specifies that GCC should tune the performance
18370 for a blend of processors within architecture arch. The aim is to
18371 generate code that run well on the current most popular processors,
18372 balancing between optimizations that benefit some CPUs in the
18373 range, and avoiding performance pitfalls of other CPUs. The
18374 effects of this option may change in future GCC versions as CPU
18375 models come and go.
18376
18377 -mtune permits the same extension options as -mcpu, but the
18378 extension options do not affect the tuning of the generated code.
18379
18380 -mtune=native causes the compiler to auto-detect the CPU of the
18381 build computer. At present, this feature is only supported on
18382 GNU/Linux, and not all architectures are recognized. If the auto-
18383 detect is unsuccessful the option has no effect.
18384
18385 -mcpu=name[+extension...]
18386 This specifies the name of the target ARM processor. GCC uses this
18387 name to derive the name of the target ARM architecture (as if
18388 specified by -march) and the ARM processor type for which to tune
18389 for performance (as if specified by -mtune). Where this option is
18390 used in conjunction with -march or -mtune, those options take
18391 precedence over the appropriate part of this option.
18392
18393 Many of the supported CPUs implement optional architectural
18394 extensions. Where this is so the architectural extensions are
18395 normally enabled by default. If implementations that lack the
18396 extension exist, then the extension syntax can be used to disable
18397 those extensions that have been omitted. For floating-point and
18398 Advanced SIMD (Neon) instructions, the settings of the options
18399 -mfloat-abi and -mfpu must also be considered: floating-point and
18400 Advanced SIMD instructions will only be used if -mfloat-abi is not
18401 set to soft; and any setting of -mfpu other than auto will override
18402 the available floating-point and SIMD extension instructions.
18403
18404 For example, cortex-a9 can be found in three major configurations:
18405 integer only, with just a floating-point unit or with floating-
18406 point and Advanced SIMD. The default is to enable all the
18407 instructions, but the extensions +nosimd and +nofp can be used to
18408 disable just the SIMD or both the SIMD and floating-point
18409 instructions respectively.
18410
18411 Permissible names for this option are the same as those for -mtune.
18412
18413 The following extension options are common to the listed CPUs:
18414
18415 +nodsp
18416 Disable the DSP instructions on cortex-m33, cortex-m35p.
18417
18418 +nofp
18419 Disables the floating-point instructions on arm9e, arm946e-s,
18420 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
18421 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
18422 cortex-m7, cortex-m33 and cortex-m35p. Disables the floating-
18423 point and SIMD instructions on generic-armv7-a, cortex-a5,
18424 cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
18425 cortex-a17, cortex-a15.cortex-a7, cortex-a17.cortex-a7,
18426 cortex-a32, cortex-a35, cortex-a53 and cortex-a55.
18427
18428 +nofp.dp
18429 Disables the double-precision component of the floating-point
18430 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52,
18431 cortex-r52plus and cortex-m7.
18432
18433 +nosimd
18434 Disables the SIMD (but not floating-point) instructions on
18435 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
18436
18437 +crypto
18438 Enables the cryptographic instructions on cortex-a32,
18439 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
18440 cortex-a73, cortex-a75, exynos-m1, xgene1,
18441 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
18442 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
18443 cortex-a75.cortex-a55.
18444
18445 Additionally the generic-armv7-a pseudo target defaults to VFPv3
18446 with 16 double-precision registers. It supports the following
18447 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
18448 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
18449 neon-vfpv4. The meanings are the same as for the extensions to
18450 -march=armv7-a.
18451
18452 -mcpu=generic-arch is also permissible, and is equivalent to
18453 -march=arch -mtune=generic-arch. See -mtune for more information.
18454
18455 -mcpu=native causes the compiler to auto-detect the CPU of the
18456 build computer. At present, this feature is only supported on
18457 GNU/Linux, and not all architectures are recognized. If the auto-
18458 detect is unsuccessful the option has no effect.
18459
18460 -mfpu=name
18461 This specifies what floating-point hardware (or hardware emulation)
18462 is available on the target. Permissible names are: auto, vfpv2,
18463 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
18464 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
18465 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
18466 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
18467 and vfp is an alias for vfpv2.
18468
18469 The setting auto is the default and is special. It causes the
18470 compiler to select the floating-point and Advanced SIMD
18471 instructions based on the settings of -mcpu and -march.
18472
18473 If the selected floating-point hardware includes the NEON extension
18474 (e.g. -mfpu=neon), note that floating-point operations are not
18475 generated by GCC's auto-vectorization pass unless
18476 -funsafe-math-optimizations is also specified. This is because
18477 NEON hardware does not fully implement the IEEE 754 standard for
18478 floating-point arithmetic (in particular denormal values are
18479 treated as zero), so the use of NEON instructions may lead to a
18480 loss of precision.
18481
18482 You can also set the fpu name at function level by using the
18483 "target("fpu=")" function attributes or pragmas.
18484
18485 -mfp16-format=name
18486 Specify the format of the "__fp16" half-precision floating-point
18487 type. Permissible names are none, ieee, and alternative; the
18488 default is none, in which case the "__fp16" type is not defined.
18489
18490 -mstructure-size-boundary=n
18491 The sizes of all structures and unions are rounded up to a multiple
18492 of the number of bits set by this option. Permissible values are
18493 8, 32 and 64. The default value varies for different toolchains.
18494 For the COFF targeted toolchain the default value is 8. A value of
18495 64 is only allowed if the underlying ABI supports it.
18496
18497 Specifying a larger number can produce faster, more efficient code,
18498 but can also increase the size of the program. Different values
18499 are potentially incompatible. Code compiled with one value cannot
18500 necessarily expect to work with code or libraries compiled with
18501 another value, if they exchange information using structures or
18502 unions.
18503
18504 This option is deprecated.
18505
18506 -mabort-on-noreturn
18507 Generate a call to the function "abort" at the end of a "noreturn"
18508 function. It is executed if the function tries to return.
18509
18510 -mlong-calls
18511 -mno-long-calls
18512 Tells the compiler to perform function calls by first loading the
18513 address of the function into a register and then performing a
18514 subroutine call on this register. This switch is needed if the
18515 target function lies outside of the 64-megabyte addressing range of
18516 the offset-based version of subroutine call instruction.
18517
18518 Even if this switch is enabled, not all function calls are turned
18519 into long calls. The heuristic is that static functions, functions
18520 that have the "short_call" attribute, functions that are inside the
18521 scope of a "#pragma no_long_calls" directive, and functions whose
18522 definitions have already been compiled within the current
18523 compilation unit are not turned into long calls. The exceptions to
18524 this rule are that weak function definitions, functions with the
18525 "long_call" attribute or the "section" attribute, and functions
18526 that are within the scope of a "#pragma long_calls" directive are
18527 always turned into long calls.
18528
18529 This feature is not enabled by default. Specifying -mno-long-calls
18530 restores the default behavior, as does placing the function calls
18531 within the scope of a "#pragma long_calls_off" directive. Note
18532 these switches have no effect on how the compiler generates code to
18533 handle function calls via function pointers.
18534
18535 -msingle-pic-base
18536 Treat the register used for PIC addressing as read-only, rather
18537 than loading it in the prologue for each function. The runtime
18538 system is responsible for initializing this register with an
18539 appropriate value before execution begins.
18540
18541 -mpic-register=reg
18542 Specify the register to be used for PIC addressing. For standard
18543 PIC base case, the default is any suitable register determined by
18544 compiler. For single PIC base case, the default is R9 if target is
18545 EABI based or stack-checking is enabled, otherwise the default is
18546 R10.
18547
18548 -mpic-data-is-text-relative
18549 Assume that the displacement between the text and data segments is
18550 fixed at static link time. This permits using PC-relative
18551 addressing operations to access data known to be in the data
18552 segment. For non-VxWorks RTP targets, this option is enabled by
18553 default. When disabled on such targets, it will enable
18554 -msingle-pic-base by default.
18555
18556 -mpoke-function-name
18557 Write the name of each function into the text section, directly
18558 preceding the function prologue. The generated code is similar to
18559 this:
18560
18561 t0
18562 .ascii "arm_poke_function_name", 0
18563 .align
18564 t1
18565 .word 0xff000000 + (t1 - t0)
18566 arm_poke_function_name
18567 mov ip, sp
18568 stmfd sp!, {fp, ip, lr, pc}
18569 sub fp, ip, #4
18570
18571 When performing a stack backtrace, code can inspect the value of
18572 "pc" stored at "fp + 0". If the trace function then looks at
18573 location "pc - 12" and the top 8 bits are set, then we know that
18574 there is a function name embedded immediately preceding this
18575 location and has length "((pc[-3]) & 0xff000000)".
18576
18577 -mthumb
18578 -marm
18579 Select between generating code that executes in ARM and Thumb
18580 states. The default for most configurations is to generate code
18581 that executes in ARM state, but the default can be changed by
18582 configuring GCC with the --with-mode=state configure option.
18583
18584 You can also override the ARM and Thumb mode for each function by
18585 using the "target("thumb")" and "target("arm")" function attributes
18586 or pragmas.
18587
18588 -mflip-thumb
18589 Switch ARM/Thumb modes on alternating functions. This option is
18590 provided for regression testing of mixed Thumb/ARM code generation,
18591 and is not intended for ordinary use in compiling code.
18592
18593 -mtpcs-frame
18594 Generate a stack frame that is compliant with the Thumb Procedure
18595 Call Standard for all non-leaf functions. (A leaf function is one
18596 that does not call any other functions.) The default is
18597 -mno-tpcs-frame.
18598
18599 -mtpcs-leaf-frame
18600 Generate a stack frame that is compliant with the Thumb Procedure
18601 Call Standard for all leaf functions. (A leaf function is one that
18602 does not call any other functions.) The default is
18603 -mno-apcs-leaf-frame.
18604
18605 -mcallee-super-interworking
18606 Gives all externally visible functions in the file being compiled
18607 an ARM instruction set header which switches to Thumb mode before
18608 executing the rest of the function. This allows these functions to
18609 be called from non-interworking code. This option is not valid in
18610 AAPCS configurations because interworking is enabled by default.
18611
18612 -mcaller-super-interworking
18613 Allows calls via function pointers (including virtual functions) to
18614 execute correctly regardless of whether the target code has been
18615 compiled for interworking or not. There is a small overhead in the
18616 cost of executing a function pointer if this option is enabled.
18617 This option is not valid in AAPCS configurations because
18618 interworking is enabled by default.
18619
18620 -mtp=name
18621 Specify the access model for the thread local storage pointer. The
18622 valid models are soft, which generates calls to "__aeabi_read_tp",
18623 cp15, which fetches the thread pointer from "cp15" directly
18624 (supported in the arm6k architecture), and auto, which uses the
18625 best available method for the selected processor. The default
18626 setting is auto.
18627
18628 -mtls-dialect=dialect
18629 Specify the dialect to use for accessing thread local storage. Two
18630 dialects are supported---gnu and gnu2. The gnu dialect selects the
18631 original GNU scheme for supporting local and global dynamic TLS
18632 models. The gnu2 dialect selects the GNU descriptor scheme, which
18633 provides better performance for shared libraries. The GNU
18634 descriptor scheme is compatible with the original scheme, but does
18635 require new assembler, linker and library support. Initial and
18636 local exec TLS models are unaffected by this option and always use
18637 the original scheme.
18638
18639 -mword-relocations
18640 Only generate absolute relocations on word-sized values (i.e.
18641 R_ARM_ABS32). This is enabled by default on targets (uClinux,
18642 SymbianOS) where the runtime loader imposes this restriction, and
18643 when -fpic or -fPIC is specified. This option conflicts with
18644 -mslow-flash-data.
18645
18646 -mfix-cortex-m3-ldrd
18647 Some Cortex-M3 cores can cause data corruption when "ldrd"
18648 instructions with overlapping destination and base registers are
18649 used. This option avoids generating these instructions. This
18650 option is enabled by default when -mcpu=cortex-m3 is specified.
18651
18652 -mfix-cortex-a57-aes-1742098
18653 -mno-fix-cortex-a57-aes-1742098
18654 -mfix-cortex-a72-aes-1655431
18655 -mno-fix-cortex-a72-aes-1655431
18656 Enable (disable) mitigation for an erratum on Cortex-A57 and
18657 Cortex-A72 that affects the AES cryptographic instructions. This
18658 option is enabled by default when either -mcpu=cortex-a57 or
18659 -mcpu=cortex-a72 is specified.
18660
18661 -munaligned-access
18662 -mno-unaligned-access
18663 Enables (or disables) reading and writing of 16- and 32- bit values
18664 from addresses that are not 16- or 32- bit aligned. By default
18665 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
18666 ARMv8-M Baseline architectures, and enabled for all other
18667 architectures. If unaligned access is not enabled then words in
18668 packed data structures are accessed a byte at a time.
18669
18670 The ARM attribute "Tag_CPU_unaligned_access" is set in the
18671 generated object file to either true or false, depending upon the
18672 setting of this option. If unaligned access is enabled then the
18673 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
18674
18675 -mneon-for-64bits
18676 This option is deprecated and has no effect.
18677
18678 -mslow-flash-data
18679 Assume loading data from flash is slower than fetching instruction.
18680 Therefore literal load is minimized for better performance. This
18681 option is only supported when compiling for ARMv7 M-profile and off
18682 by default. It conflicts with -mword-relocations.
18683
18684 -masm-syntax-unified
18685 Assume inline assembler is using unified asm syntax. The default
18686 is currently off which implies divided syntax. This option has no
18687 impact on Thumb2. However, this may change in future releases of
18688 GCC. Divided syntax should be considered deprecated.
18689
18690 -mrestrict-it
18691 Restricts generation of IT blocks to conform to the rules of
18692 ARMv8-A. IT blocks can only contain a single 16-bit instruction
18693 from a select set of instructions. This option is on by default for
18694 ARMv8-A Thumb mode.
18695
18696 -mprint-tune-info
18697 Print CPU tuning information as comment in assembler file. This is
18698 an option used only for regression testing of the compiler and not
18699 intended for ordinary use in compiling code. This option is
18700 disabled by default.
18701
18702 -mverbose-cost-dump
18703 Enable verbose cost model dumping in the debug dump files. This
18704 option is provided for use in debugging the compiler.
18705
18706 -mpure-code
18707 Do not allow constant data to be placed in code sections.
18708 Additionally, when compiling for ELF object format give all text
18709 sections the ELF processor-specific section attribute
18710 "SHF_ARM_PURECODE". This option is only available when generating
18711 non-pic code for M-profile targets.
18712
18713 -mcmse
18714 Generate secure code as per the "ARMv8-M Security Extensions:
18715 Requirements on Development Tools Engineering Specification", which
18716 can be found on
18717 <https://developer.arm.com/documentation/ecm0359818/latest/>.
18718
18719 -mfix-cmse-cve-2021-35465
18720 Mitigate against a potential security issue with the "VLLDM"
18721 instruction in some M-profile devices when using CMSE
18722 (CVE-2021-365465). This option is enabled by default when the
18723 option -mcpu= is used with "cortex-m33", "cortex-m35p" or
18724 "cortex-m55". The option -mno-fix-cmse-cve-2021-35465 can be used
18725 to disable the mitigation.
18726
18727 -mstack-protector-guard=guard
18728 -mstack-protector-guard-offset=offset
18729 Generate stack protection code using canary at guard. Supported
18730 locations are global for a global canary or tls for a canary
18731 accessible via the TLS register. The option
18732 -mstack-protector-guard-offset= is for use with
18733 -fstack-protector-guard=tls and not for use in user-land code.
18734
18735 -mfdpic
18736 -mno-fdpic
18737 Select the FDPIC ABI, which uses 64-bit function descriptors to
18738 represent pointers to functions. When the compiler is configured
18739 for "arm-*-uclinuxfdpiceabi" targets, this option is on by default
18740 and implies -fPIE if none of the PIC/PIE-related options is
18741 provided. On other targets, it only enables the FDPIC-specific
18742 code generation features, and the user should explicitly provide
18743 the PIC/PIE-related options as needed.
18744
18745 Note that static linking is not supported because it would still
18746 involve the dynamic linker when the program self-relocates. If
18747 such behavior is acceptable, use -static and -Wl,-dynamic-linker
18748 options.
18749
18750 The opposite -mno-fdpic option is useful (and required) to build
18751 the Linux kernel using the same ("arm-*-uclinuxfdpiceabi")
18752 toolchain as the one used to build the userland programs.
18753
18754 AVR Options
18755 These options are defined for AVR implementations:
18756
18757 -mmcu=mcu
18758 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18759
18760 The default for this option is avr2.
18761
18762 GCC supports the following AVR devices and ISAs:
18763
18764 "avr2"
18765 "Classic" devices with up to 8 KiB of program memory. mcu =
18766 "attiny22", "attiny26", "at90s2313", "at90s2323", "at90s2333",
18767 "at90s2343", "at90s4414", "at90s4433", "at90s4434",
18768 "at90c8534", "at90s8515", "at90s8535".
18769
18770 "avr25"
18771 "Classic" devices with up to 8 KiB of program memory and with
18772 the "MOVW" instruction. mcu = "attiny13", "attiny13a",
18773 "attiny24", "attiny24a", "attiny25", "attiny261", "attiny261a",
18774 "attiny2313", "attiny2313a", "attiny43u", "attiny44",
18775 "attiny44a", "attiny45", "attiny48", "attiny441", "attiny461",
18776 "attiny461a", "attiny4313", "attiny84", "attiny84a",
18777 "attiny85", "attiny87", "attiny88", "attiny828", "attiny841",
18778 "attiny861", "attiny861a", "ata5272", "ata6616c", "at86rf401".
18779
18780 "avr3"
18781 "Classic" devices with 16 KiB up to 64 KiB of program memory.
18782 mcu = "at76c711", "at43usb355".
18783
18784 "avr31"
18785 "Classic" devices with 128 KiB of program memory. mcu =
18786 "atmega103", "at43usb320".
18787
18788 "avr35"
18789 "Classic" devices with 16 KiB up to 64 KiB of program memory
18790 and with the "MOVW" instruction. mcu = "attiny167",
18791 "attiny1634", "atmega8u2", "atmega16u2", "atmega32u2",
18792 "ata5505", "ata6617c", "ata664251", "at90usb82", "at90usb162".
18793
18794 "avr4"
18795 "Enhanced" devices with up to 8 KiB of program memory. mcu =
18796 "atmega48", "atmega48a", "atmega48p", "atmega48pa",
18797 "atmega48pb", "atmega8", "atmega8a", "atmega8hva", "atmega88",
18798 "atmega88a", "atmega88p", "atmega88pa", "atmega88pb",
18799 "atmega8515", "atmega8535", "ata6285", "ata6286", "ata6289",
18800 "ata6612c", "at90pwm1", "at90pwm2", "at90pwm2b", "at90pwm3",
18801 "at90pwm3b", "at90pwm81".
18802
18803 "avr5"
18804 "Enhanced" devices with 16 KiB up to 64 KiB of program memory.
18805 mcu = "atmega16", "atmega16a", "atmega16hva", "atmega16hva2",
18806 "atmega16hvb", "atmega16hvbrevb", "atmega16m1", "atmega16u4",
18807 "atmega161", "atmega162", "atmega163", "atmega164a",
18808 "atmega164p", "atmega164pa", "atmega165", "atmega165a",
18809 "atmega165p", "atmega165pa", "atmega168", "atmega168a",
18810 "atmega168p", "atmega168pa", "atmega168pb", "atmega169",
18811 "atmega169a", "atmega169p", "atmega169pa", "atmega32",
18812 "atmega32a", "atmega32c1", "atmega32hvb", "atmega32hvbrevb",
18813 "atmega32m1", "atmega32u4", "atmega32u6", "atmega323",
18814 "atmega324a", "atmega324p", "atmega324pa", "atmega324pb",
18815 "atmega325", "atmega325a", "atmega325p", "atmega325pa",
18816 "atmega328", "atmega328p", "atmega328pb", "atmega329",
18817 "atmega329a", "atmega329p", "atmega329pa", "atmega3250",
18818 "atmega3250a", "atmega3250p", "atmega3250pa", "atmega3290",
18819 "atmega3290a", "atmega3290p", "atmega3290pa", "atmega406",
18820 "atmega64", "atmega64a", "atmega64c1", "atmega64hve",
18821 "atmega64hve2", "atmega64m1", "atmega64rfr2", "atmega640",
18822 "atmega644", "atmega644a", "atmega644p", "atmega644pa",
18823 "atmega644rfr2", "atmega645", "atmega645a", "atmega645p",
18824 "atmega649", "atmega649a", "atmega649p", "atmega6450",
18825 "atmega6450a", "atmega6450p", "atmega6490", "atmega6490a",
18826 "atmega6490p", "ata5795", "ata5790", "ata5790n", "ata5791",
18827 "ata6613c", "ata6614q", "ata5782", "ata5831", "ata8210",
18828 "ata8510", "ata5702m322", "at90pwm161", "at90pwm216",
18829 "at90pwm316", "at90can32", "at90can64", "at90scr100",
18830 "at90usb646", "at90usb647", "at94k", "m3000".
18831
18832 "avr51"
18833 "Enhanced" devices with 128 KiB of program memory. mcu =
18834 "atmega128", "atmega128a", "atmega128rfa1", "atmega128rfr2",
18835 "atmega1280", "atmega1281", "atmega1284", "atmega1284p",
18836 "atmega1284rfr2", "at90can128", "at90usb1286", "at90usb1287".
18837
18838 "avr6"
18839 "Enhanced" devices with 3-byte PC, i.e. with more than 128 KiB
18840 of program memory. mcu = "atmega256rfr2", "atmega2560",
18841 "atmega2561", "atmega2564rfr2".
18842
18843 "avrxmega2"
18844 "XMEGA" devices with more than 8 KiB and up to 64 KiB of
18845 program memory. mcu = "atxmega8e5", "atxmega16a4",
18846 "atxmega16a4u", "atxmega16c4", "atxmega16d4", "atxmega16e5",
18847 "atxmega32a4", "atxmega32a4u", "atxmega32c3", "atxmega32c4",
18848 "atxmega32d3", "atxmega32d4", "atxmega32e5".
18849
18850 "avrxmega3"
18851 "XMEGA" devices with up to 64 KiB of combined program memory
18852 and RAM, and with program memory visible in the RAM address
18853 space. mcu = "attiny202", "attiny204", "attiny212",
18854 "attiny214", "attiny402", "attiny404", "attiny406",
18855 "attiny412", "attiny414", "attiny416", "attiny417",
18856 "attiny804", "attiny806", "attiny807", "attiny814",
18857 "attiny816", "attiny817", "attiny1604", "attiny1606",
18858 "attiny1607", "attiny1614", "attiny1616", "attiny1617",
18859 "attiny3214", "attiny3216", "attiny3217", "atmega808",
18860 "atmega809", "atmega1608", "atmega1609", "atmega3208",
18861 "atmega3209", "atmega4808", "atmega4809".
18862
18863 "avrxmega4"
18864 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
18865 program memory. mcu = "atxmega64a3", "atxmega64a3u",
18866 "atxmega64a4u", "atxmega64b1", "atxmega64b3", "atxmega64c3",
18867 "atxmega64d3", "atxmega64d4".
18868
18869 "avrxmega5"
18870 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
18871 program memory and more than 64 KiB of RAM. mcu =
18872 "atxmega64a1", "atxmega64a1u".
18873
18874 "avrxmega6"
18875 "XMEGA" devices with more than 128 KiB of program memory. mcu
18876 = "atxmega128a3", "atxmega128a3u", "atxmega128b1",
18877 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
18878 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
18879 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
18880 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
18881 "atxmega256d3", "atxmega384c3", "atxmega384d3".
18882
18883 "avrxmega7"
18884 "XMEGA" devices with more than 128 KiB of program memory and
18885 more than 64 KiB of RAM. mcu = "atxmega128a1",
18886 "atxmega128a1u", "atxmega128a4u".
18887
18888 "avrtiny"
18889 "TINY" Tiny core devices with 512 B up to 4 KiB of program
18890 memory. mcu = "attiny4", "attiny5", "attiny9", "attiny10",
18891 "attiny20", "attiny40".
18892
18893 "avr1"
18894 This ISA is implemented by the minimal AVR core and supported
18895 for assembler only. mcu = "attiny11", "attiny12", "attiny15",
18896 "attiny28", "at90s1200".
18897
18898 -mabsdata
18899 Assume that all data in static storage can be accessed by LDS / STS
18900 instructions. This option has only an effect on reduced Tiny
18901 devices like ATtiny40. See also the "absdata" AVR Variable
18902 Attributes,variable attribute.
18903
18904 -maccumulate-args
18905 Accumulate outgoing function arguments and acquire/release the
18906 needed stack space for outgoing function arguments once in function
18907 prologue/epilogue. Without this option, outgoing arguments are
18908 pushed before calling a function and popped afterwards.
18909
18910 Popping the arguments after the function call can be expensive on
18911 AVR so that accumulating the stack space might lead to smaller
18912 executables because arguments need not be removed from the stack
18913 after such a function call.
18914
18915 This option can lead to reduced code size for functions that
18916 perform several calls to functions that get their arguments on the
18917 stack like calls to printf-like functions.
18918
18919 -mbranch-cost=cost
18920 Set the branch costs for conditional branch instructions to cost.
18921 Reasonable values for cost are small, non-negative integers. The
18922 default branch cost is 0.
18923
18924 -mcall-prologues
18925 Functions prologues/epilogues are expanded as calls to appropriate
18926 subroutines. Code size is smaller.
18927
18928 -mdouble=bits
18929 -mlong-double=bits
18930 Set the size (in bits) of the "double" or "long double" type,
18931 respectively. Possible values for bits are 32 and 64. Whether or
18932 not a specific value for bits is allowed depends on the
18933 "--with-double=" and "--with-long-double=" configure options
18934 ("https://gcc.gnu.org/install/configure.html#avr"), and the same
18935 applies for the default values of the options.
18936
18937 -mgas-isr-prologues
18938 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
18939 instruction supported by GNU Binutils. If this option is on, the
18940 feature can still be disabled for individual ISRs by means of the
18941 AVR Function Attributes,,"no_gccisr" function attribute. This
18942 feature is activated per default if optimization is on (but not
18943 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
18944 PR21683 ("https://sourceware.org/PR21683").
18945
18946 -mint8
18947 Assume "int" to be 8-bit integer. This affects the sizes of all
18948 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
18949 and "long long" is 4 bytes. Please note that this option does not
18950 conform to the C standards, but it results in smaller code size.
18951
18952 -mmain-is-OS_task
18953 Do not save registers in "main". The effect is the same like
18954 attaching attribute AVR Function Attributes,,"OS_task" to "main".
18955 It is activated per default if optimization is on.
18956
18957 -mn-flash=num
18958 Assume that the flash memory has a size of num times 64 KiB.
18959
18960 -mno-interrupts
18961 Generated code is not compatible with hardware interrupts. Code
18962 size is smaller.
18963
18964 -mrelax
18965 Try to replace "CALL" resp. "JMP" instruction by the shorter
18966 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
18967 just adds the --mlink-relax option to the assembler's command line
18968 and the --relax option to the linker's command line.
18969
18970 Jump relaxing is performed by the linker because jump offsets are
18971 not known before code is located. Therefore, the assembler code
18972 generated by the compiler is the same, but the instructions in the
18973 executable may differ from instructions in the assembler code.
18974
18975 Relaxing must be turned on if linker stubs are needed, see the
18976 section on "EIND" and linker stubs below.
18977
18978 -mrmw
18979 Assume that the device supports the Read-Modify-Write instructions
18980 "XCH", "LAC", "LAS" and "LAT".
18981
18982 -mshort-calls
18983 Assume that "RJMP" and "RCALL" can target the whole program memory.
18984
18985 This option is used internally for multilib selection. It is not
18986 an optimization option, and you don't need to set it by hand.
18987
18988 -msp8
18989 Treat the stack pointer register as an 8-bit register, i.e. assume
18990 the high byte of the stack pointer is zero. In general, you don't
18991 need to set this option by hand.
18992
18993 This option is used internally by the compiler to select and build
18994 multilibs for architectures "avr2" and "avr25". These
18995 architectures mix devices with and without "SPH". For any setting
18996 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
18997 removes this option from the compiler proper's command line,
18998 because the compiler then knows if the device or architecture has
18999 an 8-bit stack pointer and thus no "SPH" register or not.
19000
19001 -mstrict-X
19002 Use address register "X" in a way proposed by the hardware. This
19003 means that "X" is only used in indirect, post-increment or pre-
19004 decrement addressing.
19005
19006 Without this option, the "X" register may be used in the same way
19007 as "Y" or "Z" which then is emulated by additional instructions.
19008 For example, loading a value with "X+const" addressing with a small
19009 non-negative "const < 64" to a register Rn is performed as
19010
19011 adiw r26, const ; X += const
19012 ld <Rn>, X ; <Rn> = *X
19013 sbiw r26, const ; X -= const
19014
19015 -mtiny-stack
19016 Only change the lower 8 bits of the stack pointer.
19017
19018 -mfract-convert-truncate
19019 Allow to use truncation instead of rounding towards zero for
19020 fractional fixed-point types.
19021
19022 -nodevicelib
19023 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
19024
19025 -nodevicespecs
19026 Don't add -specs=device-specs/specs-mcu to the compiler driver's
19027 command line. The user takes responsibility for supplying the sub-
19028 processes like compiler proper, assembler and linker with
19029 appropriate command line options. This means that the user has to
19030 supply her private device specs file by means of -specs=path-to-
19031 specs-file. There is no more need for option -mmcu=mcu.
19032
19033 This option can also serve as a replacement for the older way of
19034 specifying custom device-specs files that needed -B some-path to
19035 point to a directory which contains a folder named "device-specs"
19036 which contains a specs file named "specs-mcu", where mcu was
19037 specified by -mmcu=mcu.
19038
19039 -Waddr-space-convert
19040 Warn about conversions between address spaces in the case where the
19041 resulting address space is not contained in the incoming address
19042 space.
19043
19044 -Wmisspelled-isr
19045 Warn if the ISR is misspelled, i.e. without __vector prefix.
19046 Enabled by default.
19047
19048 "EIND" and Devices with More Than 128 Ki Bytes of Flash
19049
19050 Pointers in the implementation are 16 bits wide. The address of a
19051 function or label is represented as word address so that indirect jumps
19052 and calls can target any code address in the range of 64 Ki words.
19053
19054 In order to facilitate indirect jump on devices with more than 128 Ki
19055 bytes of program memory space, there is a special function register
19056 called "EIND" that serves as most significant part of the target
19057 address when "EICALL" or "EIJMP" instructions are used.
19058
19059 Indirect jumps and calls on these devices are handled as follows by the
19060 compiler and are subject to some limitations:
19061
19062 * The compiler never sets "EIND".
19063
19064 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
19065 instructions or might read "EIND" directly in order to emulate an
19066 indirect call/jump by means of a "RET" instruction.
19067
19068 * The compiler assumes that "EIND" never changes during the startup
19069 code or during the application. In particular, "EIND" is not
19070 saved/restored in function or interrupt service routine
19071 prologue/epilogue.
19072
19073 * For indirect calls to functions and computed goto, the linker
19074 generates stubs. Stubs are jump pads sometimes also called
19075 trampolines. Thus, the indirect call/jump jumps to such a stub.
19076 The stub contains a direct jump to the desired address.
19077
19078 * Linker relaxation must be turned on so that the linker generates
19079 the stubs correctly in all situations. See the compiler option
19080 -mrelax and the linker option --relax. There are corner cases
19081 where the linker is supposed to generate stubs but aborts without
19082 relaxation and without a helpful error message.
19083
19084 * The default linker script is arranged for code with "EIND = 0". If
19085 code is supposed to work for a setup with "EIND != 0", a custom
19086 linker script has to be used in order to place the sections whose
19087 name start with ".trampolines" into the segment where "EIND" points
19088 to.
19089
19090 * The startup code from libgcc never sets "EIND". Notice that
19091 startup code is a blend of code from libgcc and AVR-LibC. For the
19092 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
19093 ("http://nongnu.org/avr-libc/user-manual/").
19094
19095 * It is legitimate for user-specific startup code to set up "EIND"
19096 early, for example by means of initialization code located in
19097 section ".init3". Such code runs prior to general startup code that
19098 initializes RAM and calls constructors, but after the bit of
19099 startup code from AVR-LibC that sets "EIND" to the segment where
19100 the vector table is located.
19101
19102 #include <avr/io.h>
19103
19104 static void
19105 __attribute__((section(".init3"),naked,used,no_instrument_function))
19106 init3_set_eind (void)
19107 {
19108 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
19109 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
19110 }
19111
19112 The "__trampolines_start" symbol is defined in the linker script.
19113
19114 * Stubs are generated automatically by the linker if the following
19115 two conditions are met:
19116
19117 -<The address of a label is taken by means of the "gs" modifier>
19118 (short for generate stubs) like so:
19119
19120 LDI r24, lo8(gs(<func>))
19121 LDI r25, hi8(gs(<func>))
19122
19123 -<The final location of that label is in a code segment>
19124 outside the segment where the stubs are located.
19125
19126 * The compiler emits such "gs" modifiers for code labels in the
19127 following situations:
19128
19129 -<Taking address of a function or code label.>
19130 -<Computed goto.>
19131 -<If prologue-save function is used, see -mcall-prologues>
19132 command-line option.
19133
19134 -<Switch/case dispatch tables. If you do not want such dispatch>
19135 tables you can specify the -fno-jump-tables command-line
19136 option.
19137
19138 -<C and C++ constructors/destructors called during
19139 startup/shutdown.>
19140 -<If the tools hit a "gs()" modifier explained above.>
19141 * Jumping to non-symbolic addresses like so is not supported:
19142
19143 int main (void)
19144 {
19145 /* Call function at word address 0x2 */
19146 return ((int(*)(void)) 0x2)();
19147 }
19148
19149 Instead, a stub has to be set up, i.e. the function has to be
19150 called through a symbol ("func_4" in the example):
19151
19152 int main (void)
19153 {
19154 extern int func_4 (void);
19155
19156 /* Call function at byte address 0x4 */
19157 return func_4();
19158 }
19159
19160 and the application be linked with -Wl,--defsym,func_4=0x4.
19161 Alternatively, "func_4" can be defined in the linker script.
19162
19163 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
19164 Registers
19165
19166 Some AVR devices support memories larger than the 64 KiB range that can
19167 be accessed with 16-bit pointers. To access memory locations outside
19168 this 64 KiB range, the content of a "RAMP" register is used as high
19169 part of the address: The "X", "Y", "Z" address register is concatenated
19170 with the "RAMPX", "RAMPY", "RAMPZ" special function register,
19171 respectively, to get a wide address. Similarly, "RAMPD" is used
19172 together with direct addressing.
19173
19174 * The startup code initializes the "RAMP" special function registers
19175 with zero.
19176
19177 * If a AVR Named Address Spaces,named address space other than
19178 generic or "__flash" is used, then "RAMPZ" is set as needed before
19179 the operation.
19180
19181 * If the device supports RAM larger than 64 KiB and the compiler
19182 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
19183 reset to zero after the operation.
19184
19185 * If the device comes with a specific "RAMP" register, the ISR
19186 prologue/epilogue saves/restores that SFR and initializes it with
19187 zero in case the ISR code might (implicitly) use it.
19188
19189 * RAM larger than 64 KiB is not supported by GCC for AVR targets. If
19190 you use inline assembler to read from locations outside the 16-bit
19191 address range and change one of the "RAMP" registers, you must
19192 reset it to zero after the access.
19193
19194 AVR Built-in Macros
19195
19196 GCC defines several built-in macros so that the user code can test for
19197 the presence or absence of features. Almost any of the following
19198 built-in macros are deduced from device capabilities and thus triggered
19199 by the -mmcu= command-line option.
19200
19201 For even more AVR-specific built-in macros see AVR Named Address Spaces
19202 and AVR Built-in Functions.
19203
19204 "__AVR_ARCH__"
19205 Build-in macro that resolves to a decimal number that identifies
19206 the architecture and depends on the -mmcu=mcu option. Possible
19207 values are:
19208
19209 2, 25, 3, 31, 35, 4, 5, 51, 6
19210
19211 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
19212 "avr51", "avr6",
19213
19214 respectively and
19215
19216 100, 102, 103, 104, 105, 106, 107
19217
19218 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
19219 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
19220 specifies a device, this built-in macro is set accordingly. For
19221 example, with -mmcu=atmega8 the macro is defined to 4.
19222
19223 "__AVR_Device__"
19224 Setting -mmcu=device defines this built-in macro which reflects the
19225 device's name. For example, -mmcu=atmega8 defines the built-in
19226 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
19227 "__AVR_ATtiny261A__", etc.
19228
19229 The built-in macros' names follow the scheme "__AVR_Device__" where
19230 Device is the device name as from the AVR user manual. The
19231 difference between Device in the built-in macro and device in
19232 -mmcu=device is that the latter is always lowercase.
19233
19234 If device is not a device but only a core architecture like avr51,
19235 this macro is not defined.
19236
19237 "__AVR_DEVICE_NAME__"
19238 Setting -mmcu=device defines this built-in macro to the device's
19239 name. For example, with -mmcu=atmega8 the macro is defined to
19240 "atmega8".
19241
19242 If device is not a device but only a core architecture like avr51,
19243 this macro is not defined.
19244
19245 "__AVR_XMEGA__"
19246 The device / architecture belongs to the XMEGA family of devices.
19247
19248 "__AVR_HAVE_ELPM__"
19249 The device has the "ELPM" instruction.
19250
19251 "__AVR_HAVE_ELPMX__"
19252 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
19253
19254 "__AVR_HAVE_MOVW__"
19255 The device has the "MOVW" instruction to perform 16-bit register-
19256 register moves.
19257
19258 "__AVR_HAVE_LPMX__"
19259 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
19260
19261 "__AVR_HAVE_MUL__"
19262 The device has a hardware multiplier.
19263
19264 "__AVR_HAVE_JMP_CALL__"
19265 The device has the "JMP" and "CALL" instructions. This is the case
19266 for devices with more than 8 KiB of program memory.
19267
19268 "__AVR_HAVE_EIJMP_EICALL__"
19269 "__AVR_3_BYTE_PC__"
19270 The device has the "EIJMP" and "EICALL" instructions. This is the
19271 case for devices with more than 128 KiB of program memory. This
19272 also means that the program counter (PC) is 3 bytes wide.
19273
19274 "__AVR_2_BYTE_PC__"
19275 The program counter (PC) is 2 bytes wide. This is the case for
19276 devices with up to 128 KiB of program memory.
19277
19278 "__AVR_HAVE_8BIT_SP__"
19279 "__AVR_HAVE_16BIT_SP__"
19280 The stack pointer (SP) register is treated as 8-bit respectively
19281 16-bit register by the compiler. The definition of these macros is
19282 affected by -mtiny-stack.
19283
19284 "__AVR_HAVE_SPH__"
19285 "__AVR_SP8__"
19286 The device has the SPH (high part of stack pointer) special
19287 function register or has an 8-bit stack pointer, respectively. The
19288 definition of these macros is affected by -mmcu= and in the cases
19289 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
19290
19291 "__AVR_HAVE_RAMPD__"
19292 "__AVR_HAVE_RAMPX__"
19293 "__AVR_HAVE_RAMPY__"
19294 "__AVR_HAVE_RAMPZ__"
19295 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
19296 function register, respectively.
19297
19298 "__NO_INTERRUPTS__"
19299 This macro reflects the -mno-interrupts command-line option.
19300
19301 "__AVR_ERRATA_SKIP__"
19302 "__AVR_ERRATA_SKIP_JMP_CALL__"
19303 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
19304 instructions because of a hardware erratum. Skip instructions are
19305 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
19306 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
19307
19308 "__AVR_ISA_RMW__"
19309 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
19310 LAT).
19311
19312 "__AVR_SFR_OFFSET__=offset"
19313 Instructions that can address I/O special function registers
19314 directly like "IN", "OUT", "SBI", etc. may use a different address
19315 as if addressed by an instruction to access RAM like "LD" or "STS".
19316 This offset depends on the device architecture and has to be
19317 subtracted from the RAM address in order to get the respective I/O
19318 address.
19319
19320 "__AVR_SHORT_CALLS__"
19321 The -mshort-calls command line option is set.
19322
19323 "__AVR_PM_BASE_ADDRESS__=addr"
19324 Some devices support reading from flash memory by means of "LD*"
19325 instructions. The flash memory is seen in the data address space
19326 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
19327 defined, this feature is not available. If defined, the address
19328 space is linear and there is no need to put ".rodata" into RAM.
19329 This is handled by the default linker description file, and is
19330 currently available for "avrtiny" and "avrxmega3". Even more
19331 convenient, there is no need to use address spaces like "__flash"
19332 or features like attribute "progmem" and "pgm_read_*".
19333
19334 "__WITH_AVRLIBC__"
19335 The compiler is configured to be used together with AVR-Libc. See
19336 the --with-avrlibc configure option.
19337
19338 "__HAVE_DOUBLE_MULTILIB__"
19339 Defined if -mdouble= acts as a multilib option.
19340
19341 "__HAVE_DOUBLE32__"
19342 "__HAVE_DOUBLE64__"
19343 Defined if the compiler supports 32-bit double resp. 64-bit double.
19344 The actual layout is specified by option -mdouble=.
19345
19346 "__DEFAULT_DOUBLE__"
19347 The size in bits of "double" if -mdouble= is not set. To test the
19348 layout of "double" in a program, use the built-in macro
19349 "__SIZEOF_DOUBLE__".
19350
19351 "__HAVE_LONG_DOUBLE32__"
19352 "__HAVE_LONG_DOUBLE64__"
19353 "__HAVE_LONG_DOUBLE_MULTILIB__"
19354 "__DEFAULT_LONG_DOUBLE__"
19355 Same as above, but for "long double" instead of "double".
19356
19357 "__WITH_DOUBLE_COMPARISON__"
19358 Reflects the "--with-double-comparison={tristate|bool|libf7}"
19359 configure option ("https://gcc.gnu.org/install/configure.html#avr")
19360 and is defined to 2 or 3.
19361
19362 "__WITH_LIBF7_LIBGCC__"
19363 "__WITH_LIBF7_MATH__"
19364 "__WITH_LIBF7_MATH_SYMBOLS__"
19365 Reflects the "--with-libf7={libgcc|math|math-symbols}"
19366 configure option
19367 ("https://gcc.gnu.org/install/configure.html#avr").
19368
19369 Blackfin Options
19370 -mcpu=cpu[-sirevision]
19371 Specifies the name of the target Blackfin processor. Currently,
19372 cpu can be one of bf512, bf514, bf516, bf518, bf522, bf523, bf524,
19373 bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf536, bf537,
19374 bf538, bf539, bf542, bf544, bf547, bf548, bf549, bf542m, bf544m,
19375 bf547m, bf548m, bf549m, bf561, bf592.
19376
19377 The optional sirevision specifies the silicon revision of the
19378 target Blackfin processor. Any workarounds available for the
19379 targeted silicon revision are enabled. If sirevision is none, no
19380 workarounds are enabled. If sirevision is any, all workarounds for
19381 the targeted processor are enabled. The "__SILICON_REVISION__"
19382 macro is defined to two hexadecimal digits representing the major
19383 and minor numbers in the silicon revision. If sirevision is none,
19384 the "__SILICON_REVISION__" is not defined. If sirevision is any,
19385 the "__SILICON_REVISION__" is defined to be 0xffff. If this
19386 optional sirevision is not used, GCC assumes the latest known
19387 silicon revision of the targeted Blackfin processor.
19388
19389 GCC defines a preprocessor macro for the specified cpu. For the
19390 bfin-elf toolchain, this option causes the hardware BSP provided by
19391 libgloss to be linked in if -msim is not given.
19392
19393 Without this option, bf532 is used as the processor by default.
19394
19395 Note that support for bf561 is incomplete. For bf561, only the
19396 preprocessor macro is defined.
19397
19398 -msim
19399 Specifies that the program will be run on the simulator. This
19400 causes the simulator BSP provided by libgloss to be linked in.
19401 This option has effect only for bfin-elf toolchain. Certain other
19402 options, such as -mid-shared-library and -mfdpic, imply -msim.
19403
19404 -momit-leaf-frame-pointer
19405 Don't keep the frame pointer in a register for leaf functions.
19406 This avoids the instructions to save, set up and restore frame
19407 pointers and makes an extra register available in leaf functions.
19408
19409 -mspecld-anomaly
19410 When enabled, the compiler ensures that the generated code does not
19411 contain speculative loads after jump instructions. If this option
19412 is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
19413
19414 -mno-specld-anomaly
19415 Don't generate extra code to prevent speculative loads from
19416 occurring.
19417
19418 -mcsync-anomaly
19419 When enabled, the compiler ensures that the generated code does not
19420 contain CSYNC or SSYNC instructions too soon after conditional
19421 branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS"
19422 is defined.
19423
19424 -mno-csync-anomaly
19425 Don't generate extra code to prevent CSYNC or SSYNC instructions
19426 from occurring too soon after a conditional branch.
19427
19428 -mlow64k
19429 When enabled, the compiler is free to take advantage of the
19430 knowledge that the entire program fits into the low 64k of memory.
19431
19432 -mno-low64k
19433 Assume that the program is arbitrarily large. This is the default.
19434
19435 -mstack-check-l1
19436 Do stack checking using information placed into L1 scratchpad
19437 memory by the uClinux kernel.
19438
19439 -mid-shared-library
19440 Generate code that supports shared libraries via the library ID
19441 method. This allows for execute in place and shared libraries in
19442 an environment without virtual memory management. This option
19443 implies -fPIC. With a bfin-elf target, this option implies -msim.
19444
19445 -mno-id-shared-library
19446 Generate code that doesn't assume ID-based shared libraries are
19447 being used. This is the default.
19448
19449 -mleaf-id-shared-library
19450 Generate code that supports shared libraries via the library ID
19451 method, but assumes that this library or executable won't link
19452 against any other ID shared libraries. That allows the compiler to
19453 use faster code for jumps and calls.
19454
19455 -mno-leaf-id-shared-library
19456 Do not assume that the code being compiled won't link against any
19457 ID shared libraries. Slower code is generated for jump and call
19458 insns.
19459
19460 -mshared-library-id=n
19461 Specifies the identification number of the ID-based shared library
19462 being compiled. Specifying a value of 0 generates more compact
19463 code; specifying other values forces the allocation of that number
19464 to the current library but is no more space- or time-efficient than
19465 omitting this option.
19466
19467 -msep-data
19468 Generate code that allows the data segment to be located in a
19469 different area of memory from the text segment. This allows for
19470 execute in place in an environment without virtual memory
19471 management by eliminating relocations against the text section.
19472
19473 -mno-sep-data
19474 Generate code that assumes that the data segment follows the text
19475 segment. This is the default.
19476
19477 -mlong-calls
19478 -mno-long-calls
19479 Tells the compiler to perform function calls by first loading the
19480 address of the function into a register and then performing a
19481 subroutine call on this register. This switch is needed if the
19482 target function lies outside of the 24-bit addressing range of the
19483 offset-based version of subroutine call instruction.
19484
19485 This feature is not enabled by default. Specifying -mno-long-calls
19486 restores the default behavior. Note these switches have no effect
19487 on how the compiler generates code to handle function calls via
19488 function pointers.
19489
19490 -mfast-fp
19491 Link with the fast floating-point library. This library relaxes
19492 some of the IEEE floating-point standard's rules for checking
19493 inputs against Not-a-Number (NAN), in the interest of performance.
19494
19495 -minline-plt
19496 Enable inlining of PLT entries in function calls to functions that
19497 are not known to bind locally. It has no effect without -mfdpic.
19498
19499 -mmulticore
19500 Build a standalone application for multicore Blackfin processors.
19501 This option causes proper start files and link scripts supporting
19502 multicore to be used, and defines the macro "__BFIN_MULTICORE". It
19503 can only be used with -mcpu=bf561[-sirevision].
19504
19505 This option can be used with -mcorea or -mcoreb, which selects the
19506 one-application-per-core programming model. Without -mcorea or
19507 -mcoreb, the single-application/dual-core programming model is
19508 used. In this model, the main function of Core B should be named as
19509 "coreb_main".
19510
19511 If this option is not used, the single-core application programming
19512 model is used.
19513
19514 -mcorea
19515 Build a standalone application for Core A of BF561 when using the
19516 one-application-per-core programming model. Proper start files and
19517 link scripts are used to support Core A, and the macro
19518 "__BFIN_COREA" is defined. This option can only be used in
19519 conjunction with -mmulticore.
19520
19521 -mcoreb
19522 Build a standalone application for Core B of BF561 when using the
19523 one-application-per-core programming model. Proper start files and
19524 link scripts are used to support Core B, and the macro
19525 "__BFIN_COREB" is defined. When this option is used, "coreb_main"
19526 should be used instead of "main". This option can only be used in
19527 conjunction with -mmulticore.
19528
19529 -msdram
19530 Build a standalone application for SDRAM. Proper start files and
19531 link scripts are used to put the application into SDRAM, and the
19532 macro "__BFIN_SDRAM" is defined. The loader should initialize
19533 SDRAM before loading the application.
19534
19535 -micplb
19536 Assume that ICPLBs are enabled at run time. This has an effect on
19537 certain anomaly workarounds. For Linux targets, the default is to
19538 assume ICPLBs are enabled; for standalone applications the default
19539 is off.
19540
19541 C6X Options
19542 -march=name
19543 This specifies the name of the target architecture. GCC uses this
19544 name to determine what kind of instructions it can emit when
19545 generating assembly code. Permissible names are: c62x, c64x,
19546 c64x+, c67x, c67x+, c674x.
19547
19548 -mbig-endian
19549 Generate code for a big-endian target.
19550
19551 -mlittle-endian
19552 Generate code for a little-endian target. This is the default.
19553
19554 -msim
19555 Choose startup files and linker script suitable for the simulator.
19556
19557 -msdata=default
19558 Put small global and static data in the ".neardata" section, which
19559 is pointed to by register "B14". Put small uninitialized global
19560 and static data in the ".bss" section, which is adjacent to the
19561 ".neardata" section. Put small read-only data into the ".rodata"
19562 section. The corresponding sections used for large pieces of data
19563 are ".fardata", ".far" and ".const".
19564
19565 -msdata=all
19566 Put all data, not just small objects, into the sections reserved
19567 for small data, and use addressing relative to the "B14" register
19568 to access them.
19569
19570 -msdata=none
19571 Make no use of the sections reserved for small data, and use
19572 absolute addresses to access all data. Put all initialized global
19573 and static data in the ".fardata" section, and all uninitialized
19574 data in the ".far" section. Put all constant data into the
19575 ".const" section.
19576
19577 CRIS Options
19578 These options are defined specifically for the CRIS ports.
19579
19580 -march=architecture-type
19581 -mcpu=architecture-type
19582 Generate code for the specified architecture. The choices for
19583 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
19584 ETRAX 100, and ETRAX 100 LX. Default is v0.
19585
19586 -mtune=architecture-type
19587 Tune to architecture-type everything applicable about the generated
19588 code, except for the ABI and the set of available instructions.
19589 The choices for architecture-type are the same as for
19590 -march=architecture-type.
19591
19592 -mmax-stack-frame=n
19593 Warn when the stack frame of a function exceeds n bytes.
19594
19595 -metrax4
19596 -metrax100
19597 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
19598 -march=v8 respectively.
19599
19600 -mmul-bug-workaround
19601 -mno-mul-bug-workaround
19602 Work around a bug in the "muls" and "mulu" instructions for CPU
19603 models where it applies. This option is disabled by default.
19604
19605 -mpdebug
19606 Enable CRIS-specific verbose debug-related information in the
19607 assembly code. This option also has the effect of turning off the
19608 #NO_APP formatted-code indicator to the assembler at the beginning
19609 of the assembly file.
19610
19611 -mcc-init
19612 Do not use condition-code results from previous instruction; always
19613 emit compare and test instructions before use of condition codes.
19614
19615 -mno-side-effects
19616 Do not emit instructions with side effects in addressing modes
19617 other than post-increment.
19618
19619 -mstack-align
19620 -mno-stack-align
19621 -mdata-align
19622 -mno-data-align
19623 -mconst-align
19624 -mno-const-align
19625 These options (no- options) arrange (eliminate arrangements) for
19626 the stack frame, individual data and constants to be aligned for
19627 the maximum single data access size for the chosen CPU model. The
19628 default is to arrange for 32-bit alignment. ABI details such as
19629 structure layout are not affected by these options.
19630
19631 -m32-bit
19632 -m16-bit
19633 -m8-bit
19634 Similar to the stack- data- and const-align options above, these
19635 options arrange for stack frame, writable data and constants to all
19636 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
19637 alignment.
19638
19639 -mno-prologue-epilogue
19640 -mprologue-epilogue
19641 With -mno-prologue-epilogue, the normal function prologue and
19642 epilogue which set up the stack frame are omitted and no return
19643 instructions or return sequences are generated in the code. Use
19644 this option only together with visual inspection of the compiled
19645 code: no warnings or errors are generated when call-saved registers
19646 must be saved, or storage for local variables needs to be
19647 allocated.
19648
19649 -melf
19650 Legacy no-op option.
19651
19652 -sim
19653 This option arranges to link with input-output functions from a
19654 simulator library. Code, initialized data and zero-initialized
19655 data are allocated consecutively.
19656
19657 -sim2
19658 Like -sim, but pass linker options to locate initialized data at
19659 0x40000000 and zero-initialized data at 0x80000000.
19660
19661 CR16 Options
19662 These options are defined specifically for the CR16 ports.
19663
19664 -mmac
19665 Enable the use of multiply-accumulate instructions. Disabled by
19666 default.
19667
19668 -mcr16cplus
19669 -mcr16c
19670 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
19671 is default.
19672
19673 -msim
19674 Links the library libsim.a which is in compatible with simulator.
19675 Applicable to ELF compiler only.
19676
19677 -mint32
19678 Choose integer type as 32-bit wide.
19679
19680 -mbit-ops
19681 Generates "sbit"/"cbit" instructions for bit manipulations.
19682
19683 -mdata-model=model
19684 Choose a data model. The choices for model are near, far or medium.
19685 medium is default. However, far is not valid with -mcr16c, as the
19686 CR16C architecture does not support the far data model.
19687
19688 C-SKY Options
19689 GCC supports these options when compiling for C-SKY V2 processors.
19690
19691 -march=arch
19692 Specify the C-SKY target architecture. Valid values for arch are:
19693 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
19694
19695 -mcpu=cpu
19696 Specify the C-SKY target processor. Valid values for cpu are:
19697 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
19698 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
19699 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
19700 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
19701 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
19702 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
19703 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
19704 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
19705 ck810tv, ck810ft, and ck810ftv.
19706
19707 -mbig-endian
19708 -EB
19709 -mlittle-endian
19710 -EL Select big- or little-endian code. The default is little-endian.
19711
19712 -mfloat-abi=name
19713 Specifies which floating-point ABI to use. Permissible values are:
19714 soft, softfp and hard.
19715
19716 Specifying soft causes GCC to generate output containing library
19717 calls for floating-point operations. softfp allows the generation
19718 of code using hardware floating-point instructions, but still uses
19719 the soft-float calling conventions. hard allows generation of
19720 floating-point instructions and uses FPU-specific calling
19721 conventions.
19722
19723 The default depends on the specific target configuration. Note
19724 that the hard-float and soft-float ABIs are not link-compatible;
19725 you must compile your entire program with the same ABI, and link
19726 with a compatible set of libraries.
19727
19728 -mhard-float
19729 -msoft-float
19730 Select hardware or software floating-point implementations. The
19731 default is soft float.
19732
19733 -mdouble-float
19734 -mno-double-float
19735 When -mhard-float is in effect, enable generation of double-
19736 precision float instructions. This is the default except when
19737 compiling for CK803.
19738
19739 -mfdivdu
19740 -mno-fdivdu
19741 When -mhard-float is in effect, enable generation of "frecipd",
19742 "fsqrtd", and "fdivd" instructions. This is the default except
19743 when compiling for CK803.
19744
19745 -mfpu=fpu
19746 Select the floating-point processor. This option can only be used
19747 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
19748 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
19749 and fpv2_divd (-mdouble-float -mdivdu).
19750
19751 -melrw
19752 -mno-elrw
19753 Enable the extended "lrw" instruction. This option defaults to on
19754 for CK801 and off otherwise.
19755
19756 -mistack
19757 -mno-istack
19758 Enable interrupt stack instructions; the default is off.
19759
19760 The -mistack option is required to handle the "interrupt" and "isr"
19761 function attributes.
19762
19763 -mmp
19764 Enable multiprocessor instructions; the default is off.
19765
19766 -mcp
19767 Enable coprocessor instructions; the default is off.
19768
19769 -mcache
19770 Enable coprocessor instructions; the default is off.
19771
19772 -msecurity
19773 Enable C-SKY security instructions; the default is off.
19774
19775 -mtrust
19776 Enable C-SKY trust instructions; the default is off.
19777
19778 -mdsp
19779 -medsp
19780 -mvdsp
19781 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
19782 respectively. All of these options default to off.
19783
19784 -mdiv
19785 -mno-div
19786 Generate divide instructions. Default is off.
19787
19788 -msmart
19789 -mno-smart
19790 Generate code for Smart Mode, using only registers numbered 0-7 to
19791 allow use of 16-bit instructions. This option is ignored for CK801
19792 where this is the required behavior, and it defaults to on for
19793 CK802. For other targets, the default is off.
19794
19795 -mhigh-registers
19796 -mno-high-registers
19797 Generate code using the high registers numbered 16-31. This option
19798 is not supported on CK801, CK802, or CK803, and is enabled by
19799 default for other processors.
19800
19801 -manchor
19802 -mno-anchor
19803 Generate code using global anchor symbol addresses.
19804
19805 -mpushpop
19806 -mno-pushpop
19807 Generate code using "push" and "pop" instructions. This option
19808 defaults to on.
19809
19810 -mmultiple-stld
19811 -mstm
19812 -mno-multiple-stld
19813 -mno-stm
19814 Generate code using "stm" and "ldm" instructions. This option
19815 isn't supported on CK801 but is enabled by default on other
19816 processors.
19817
19818 -mconstpool
19819 -mno-constpool
19820 Create constant pools in the compiler instead of deferring it to
19821 the assembler. This option is the default and required for correct
19822 code generation on CK801 and CK802, and is optional on other
19823 processors.
19824
19825 -mstack-size
19826 -mno-stack-size
19827 Emit ".stack_size" directives for each function in the assembly
19828 output. This option defaults to off.
19829
19830 -mccrt
19831 -mno-ccrt
19832 Generate code for the C-SKY compiler runtime instead of libgcc.
19833 This option defaults to off.
19834
19835 -mbranch-cost=n
19836 Set the branch costs to roughly "n" instructions. The default is
19837 1.
19838
19839 -msched-prolog
19840 -mno-sched-prolog
19841 Permit scheduling of function prologue and epilogue sequences.
19842 Using this option can result in code that is not compliant with the
19843 C-SKY V2 ABI prologue requirements and that cannot be debugged or
19844 backtraced. It is disabled by default.
19845
19846 -msim
19847 Links the library libsemi.a which is in compatible with simulator.
19848 Applicable to ELF compiler only.
19849
19850 Darwin Options
19851 These options are defined for all architectures running the Darwin
19852 operating system.
19853
19854 FSF GCC on Darwin does not create "fat" object files; it creates an
19855 object file for the single architecture that GCC was built to target.
19856 Apple's GCC on Darwin does create "fat" files if multiple -arch options
19857 are used; it does so by running the compiler or linker multiple times
19858 and joining the results together with lipo.
19859
19860 The subtype of the file created (like ppc7400 or ppc970 or i686) is
19861 determined by the flags that specify the ISA that GCC is targeting,
19862 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
19863 override this.
19864
19865 The Darwin tools vary in their behavior when presented with an ISA
19866 mismatch. The assembler, as, only permits instructions to be used that
19867 are valid for the subtype of the file it is generating, so you cannot
19868 put 64-bit instructions in a ppc750 object file. The linker for shared
19869 libraries, /usr/bin/libtool, fails and prints an error if asked to
19870 create a shared library with a less restrictive subtype than its input
19871 files (for instance, trying to put a ppc970 object file in a ppc7400
19872 library). The linker for executables, ld, quietly gives the executable
19873 the most restrictive subtype of any of its input files.
19874
19875 -Fdir
19876 Add the framework directory dir to the head of the list of
19877 directories to be searched for header files. These directories are
19878 interleaved with those specified by -I options and are scanned in a
19879 left-to-right order.
19880
19881 A framework directory is a directory with frameworks in it. A
19882 framework is a directory with a Headers and/or PrivateHeaders
19883 directory contained directly in it that ends in .framework. The
19884 name of a framework is the name of this directory excluding the
19885 .framework. Headers associated with the framework are found in one
19886 of those two directories, with Headers being searched first. A
19887 subframework is a framework directory that is in a framework's
19888 Frameworks directory. Includes of subframework headers can only
19889 appear in a header of a framework that contains the subframework,
19890 or in a sibling subframework header. Two subframeworks are
19891 siblings if they occur in the same framework. A subframework
19892 should not have the same name as a framework; a warning is issued
19893 if this is violated. Currently a subframework cannot have
19894 subframeworks; in the future, the mechanism may be extended to
19895 support this. The standard frameworks can be found in
19896 /System/Library/Frameworks and /Library/Frameworks. An example
19897 include looks like "#include <Framework/header.h>", where Framework
19898 denotes the name of the framework and header.h is found in the
19899 PrivateHeaders or Headers directory.
19900
19901 -iframeworkdir
19902 Like -F except the directory is a treated as a system directory.
19903 The main difference between this -iframework and -F is that with
19904 -iframework the compiler does not warn about constructs contained
19905 within header files found via dir. This option is valid only for
19906 the C family of languages.
19907
19908 -gused
19909 Emit debugging information for symbols that are used. For stabs
19910 debugging format, this enables -feliminate-unused-debug-symbols.
19911 This is by default ON.
19912
19913 -gfull
19914 Emit debugging information for all symbols and types.
19915
19916 -mmacosx-version-min=version
19917 The earliest version of MacOS X that this executable will run on is
19918 version. Typical values of version include 10.1, 10.2, and 10.3.9.
19919
19920 If the compiler was built to use the system's headers by default,
19921 then the default for this option is the system version on which the
19922 compiler is running, otherwise the default is to make choices that
19923 are compatible with as many systems and code bases as possible.
19924
19925 -mkernel
19926 Enable kernel development mode. The -mkernel option sets -static,
19927 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
19928 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
19929 where applicable. This mode also sets -mno-altivec, -msoft-float,
19930 -fno-builtin and -mlong-branch for PowerPC targets.
19931
19932 -mone-byte-bool
19933 Override the defaults for "bool" so that "sizeof(bool)==1". By
19934 default "sizeof(bool)" is 4 when compiling for Darwin/PowerPC and 1
19935 when compiling for Darwin/x86, so this option has no effect on x86.
19936
19937 Warning: The -mone-byte-bool switch causes GCC to generate code
19938 that is not binary compatible with code generated without that
19939 switch. Using this switch may require recompiling all other
19940 modules in a program, including system libraries. Use this switch
19941 to conform to a non-default data model.
19942
19943 -mfix-and-continue
19944 -ffix-and-continue
19945 -findirect-data
19946 Generate code suitable for fast turnaround development, such as to
19947 allow GDB to dynamically load .o files into already-running
19948 programs. -findirect-data and -ffix-and-continue are provided for
19949 backwards compatibility.
19950
19951 -all_load
19952 Loads all members of static archive libraries. See man ld(1) for
19953 more information.
19954
19955 -arch_errors_fatal
19956 Cause the errors having to do with files that have the wrong
19957 architecture to be fatal.
19958
19959 -bind_at_load
19960 Causes the output file to be marked such that the dynamic linker
19961 will bind all undefined references when the file is loaded or
19962 launched.
19963
19964 -bundle
19965 Produce a Mach-o bundle format file. See man ld(1) for more
19966 information.
19967
19968 -bundle_loader executable
19969 This option specifies the executable that will load the build
19970 output file being linked. See man ld(1) for more information.
19971
19972 -dynamiclib
19973 When passed this option, GCC produces a dynamic library instead of
19974 an executable when linking, using the Darwin libtool command.
19975
19976 -force_cpusubtype_ALL
19977 This causes GCC's output file to have the ALL subtype, instead of
19978 one controlled by the -mcpu or -march option.
19979
19980 -allowable_client client_name
19981 -client_name
19982 -compatibility_version
19983 -current_version
19984 -dead_strip
19985 -dependency-file
19986 -dylib_file
19987 -dylinker_install_name
19988 -dynamic
19989 -exported_symbols_list
19990 -filelist
19991 -flat_namespace
19992 -force_flat_namespace
19993 -headerpad_max_install_names
19994 -image_base
19995 -init
19996 -install_name
19997 -keep_private_externs
19998 -multi_module
19999 -multiply_defined
20000 -multiply_defined_unused
20001 -noall_load
20002 -no_dead_strip_inits_and_terms
20003 -nofixprebinding
20004 -nomultidefs
20005 -noprebind
20006 -noseglinkedit
20007 -pagezero_size
20008 -prebind
20009 -prebind_all_twolevel_modules
20010 -private_bundle
20011 -read_only_relocs
20012 -sectalign
20013 -sectobjectsymbols
20014 -whyload
20015 -seg1addr
20016 -sectcreate
20017 -sectobjectsymbols
20018 -sectorder
20019 -segaddr
20020 -segs_read_only_addr
20021 -segs_read_write_addr
20022 -seg_addr_table
20023 -seg_addr_table_filename
20024 -seglinkedit
20025 -segprot
20026 -segs_read_only_addr
20027 -segs_read_write_addr
20028 -single_module
20029 -static
20030 -sub_library
20031 -sub_umbrella
20032 -twolevel_namespace
20033 -umbrella
20034 -undefined
20035 -unexported_symbols_list
20036 -weak_reference_mismatches
20037 -whatsloaded
20038 These options are passed to the Darwin linker. The Darwin linker
20039 man page describes them in detail.
20040
20041 DEC Alpha Options
20042 These -m options are defined for the DEC Alpha implementations:
20043
20044 -mno-soft-float
20045 -msoft-float
20046 Use (do not use) the hardware floating-point instructions for
20047 floating-point operations. When -msoft-float is specified,
20048 functions in libgcc.a are used to perform floating-point
20049 operations. Unless they are replaced by routines that emulate the
20050 floating-point operations, or compiled in such a way as to call
20051 such emulations routines, these routines issue floating-point
20052 operations. If you are compiling for an Alpha without floating-
20053 point operations, you must ensure that the library is built so as
20054 not to call them.
20055
20056 Note that Alpha implementations without floating-point operations
20057 are required to have floating-point registers.
20058
20059 -mfp-reg
20060 -mno-fp-regs
20061 Generate code that uses (does not use) the floating-point register
20062 set. -mno-fp-regs implies -msoft-float. If the floating-point
20063 register set is not used, floating-point operands are passed in
20064 integer registers as if they were integers and floating-point
20065 results are passed in $0 instead of $f0. This is a non-standard
20066 calling sequence, so any function with a floating-point argument or
20067 return value called by code compiled with -mno-fp-regs must also be
20068 compiled with that option.
20069
20070 A typical use of this option is building a kernel that does not
20071 use, and hence need not save and restore, any floating-point
20072 registers.
20073
20074 -mieee
20075 The Alpha architecture implements floating-point hardware optimized
20076 for maximum performance. It is mostly compliant with the IEEE
20077 floating-point standard. However, for full compliance, software
20078 assistance is required. This option generates code fully IEEE-
20079 compliant code except that the inexact-flag is not maintained (see
20080 below). If this option is turned on, the preprocessor macro
20081 "_IEEE_FP" is defined during compilation. The resulting code is
20082 less efficient but is able to correctly support denormalized
20083 numbers and exceptional IEEE values such as not-a-number and
20084 plus/minus infinity. Other Alpha compilers call this option
20085 -ieee_with_no_inexact.
20086
20087 -mieee-with-inexact
20088 This is like -mieee except the generated code also maintains the
20089 IEEE inexact-flag. Turning on this option causes the generated
20090 code to implement fully-compliant IEEE math. In addition to
20091 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
20092 On some Alpha implementations the resulting code may execute
20093 significantly slower than the code generated by default. Since
20094 there is very little code that depends on the inexact-flag, you
20095 should normally not specify this option. Other Alpha compilers
20096 call this option -ieee_with_inexact.
20097
20098 -mfp-trap-mode=trap-mode
20099 This option controls what floating-point related traps are enabled.
20100 Other Alpha compilers call this option -fptm trap-mode. The trap
20101 mode can be set to one of four values:
20102
20103 n This is the default (normal) setting. The only traps that are
20104 enabled are the ones that cannot be disabled in software (e.g.,
20105 division by zero trap).
20106
20107 u In addition to the traps enabled by n, underflow traps are
20108 enabled as well.
20109
20110 su Like u, but the instructions are marked to be safe for software
20111 completion (see Alpha architecture manual for details).
20112
20113 sui Like su, but inexact traps are enabled as well.
20114
20115 -mfp-rounding-mode=rounding-mode
20116 Selects the IEEE rounding mode. Other Alpha compilers call this
20117 option -fprm rounding-mode. The rounding-mode can be one of:
20118
20119 n Normal IEEE rounding mode. Floating-point numbers are rounded
20120 towards the nearest machine number or towards the even machine
20121 number in case of a tie.
20122
20123 m Round towards minus infinity.
20124
20125 c Chopped rounding mode. Floating-point numbers are rounded
20126 towards zero.
20127
20128 d Dynamic rounding mode. A field in the floating-point control
20129 register (fpcr, see Alpha architecture reference manual)
20130 controls the rounding mode in effect. The C library
20131 initializes this register for rounding towards plus infinity.
20132 Thus, unless your program modifies the fpcr, d corresponds to
20133 round towards plus infinity.
20134
20135 -mtrap-precision=trap-precision
20136 In the Alpha architecture, floating-point traps are imprecise.
20137 This means without software assistance it is impossible to recover
20138 from a floating trap and program execution normally needs to be
20139 terminated. GCC can generate code that can assist operating system
20140 trap handlers in determining the exact location that caused a
20141 floating-point trap. Depending on the requirements of an
20142 application, different levels of precisions can be selected:
20143
20144 p Program precision. This option is the default and means a trap
20145 handler can only identify which program caused a floating-point
20146 exception.
20147
20148 f Function precision. The trap handler can determine the
20149 function that caused a floating-point exception.
20150
20151 i Instruction precision. The trap handler can determine the
20152 exact instruction that caused a floating-point exception.
20153
20154 Other Alpha compilers provide the equivalent options called
20155 -scope_safe and -resumption_safe.
20156
20157 -mieee-conformant
20158 This option marks the generated code as IEEE conformant. You must
20159 not use this option unless you also specify -mtrap-precision=i and
20160 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
20161 to emit the line .eflag 48 in the function prologue of the
20162 generated assembly file.
20163
20164 -mbuild-constants
20165 Normally GCC examines a 32- or 64-bit integer constant to see if it
20166 can construct it from smaller constants in two or three
20167 instructions. If it cannot, it outputs the constant as a literal
20168 and generates code to load it from the data segment at run time.
20169
20170 Use this option to require GCC to construct all integer constants
20171 using code, even if it takes more instructions (the maximum is
20172 six).
20173
20174 You typically use this option to build a shared library dynamic
20175 loader. Itself a shared library, it must relocate itself in memory
20176 before it can find the variables and constants in its own data
20177 segment.
20178
20179 -mbwx
20180 -mno-bwx
20181 -mcix
20182 -mno-cix
20183 -mfix
20184 -mno-fix
20185 -mmax
20186 -mno-max
20187 Indicate whether GCC should generate code to use the optional BWX,
20188 CIX, FIX and MAX instruction sets. The default is to use the
20189 instruction sets supported by the CPU type specified via -mcpu=
20190 option or that of the CPU on which GCC was built if none is
20191 specified.
20192
20193 -mfloat-vax
20194 -mfloat-ieee
20195 Generate code that uses (does not use) VAX F and G floating-point
20196 arithmetic instead of IEEE single and double precision.
20197
20198 -mexplicit-relocs
20199 -mno-explicit-relocs
20200 Older Alpha assemblers provided no way to generate symbol
20201 relocations except via assembler macros. Use of these macros does
20202 not allow optimal instruction scheduling. GNU binutils as of
20203 version 2.12 supports a new syntax that allows the compiler to
20204 explicitly mark which relocations should apply to which
20205 instructions. This option is mostly useful for debugging, as GCC
20206 detects the capabilities of the assembler when it is built and sets
20207 the default accordingly.
20208
20209 -msmall-data
20210 -mlarge-data
20211 When -mexplicit-relocs is in effect, static data is accessed via
20212 gp-relative relocations. When -msmall-data is used, objects 8
20213 bytes long or smaller are placed in a small data area (the ".sdata"
20214 and ".sbss" sections) and are accessed via 16-bit relocations off
20215 of the $gp register. This limits the size of the small data area
20216 to 64KB, but allows the variables to be directly accessed via a
20217 single instruction.
20218
20219 The default is -mlarge-data. With this option the data area is
20220 limited to just below 2GB. Programs that require more than 2GB of
20221 data must use "malloc" or "mmap" to allocate the data in the heap
20222 instead of in the program's data segment.
20223
20224 When generating code for shared libraries, -fpic implies
20225 -msmall-data and -fPIC implies -mlarge-data.
20226
20227 -msmall-text
20228 -mlarge-text
20229 When -msmall-text is used, the compiler assumes that the code of
20230 the entire program (or shared library) fits in 4MB, and is thus
20231 reachable with a branch instruction. When -msmall-data is used,
20232 the compiler can assume that all local symbols share the same $gp
20233 value, and thus reduce the number of instructions required for a
20234 function call from 4 to 1.
20235
20236 The default is -mlarge-text.
20237
20238 -mcpu=cpu_type
20239 Set the instruction set and instruction scheduling parameters for
20240 machine type cpu_type. You can specify either the EV style name or
20241 the corresponding chip number. GCC supports scheduling parameters
20242 for the EV4, EV5 and EV6 family of processors and chooses the
20243 default values for the instruction set from the processor you
20244 specify. If you do not specify a processor type, GCC defaults to
20245 the processor on which the compiler was built.
20246
20247 Supported values for cpu_type are
20248
20249 ev4
20250 ev45
20251 21064
20252 Schedules as an EV4 and has no instruction set extensions.
20253
20254 ev5
20255 21164
20256 Schedules as an EV5 and has no instruction set extensions.
20257
20258 ev56
20259 21164a
20260 Schedules as an EV5 and supports the BWX extension.
20261
20262 pca56
20263 21164pc
20264 21164PC
20265 Schedules as an EV5 and supports the BWX and MAX extensions.
20266
20267 ev6
20268 21264
20269 Schedules as an EV6 and supports the BWX, FIX, and MAX
20270 extensions.
20271
20272 ev67
20273 21264a
20274 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
20275 extensions.
20276
20277 Native toolchains also support the value native, which selects the
20278 best architecture option for the host processor. -mcpu=native has
20279 no effect if GCC does not recognize the processor.
20280
20281 -mtune=cpu_type
20282 Set only the instruction scheduling parameters for machine type
20283 cpu_type. The instruction set is not changed.
20284
20285 Native toolchains also support the value native, which selects the
20286 best architecture option for the host processor. -mtune=native has
20287 no effect if GCC does not recognize the processor.
20288
20289 -mmemory-latency=time
20290 Sets the latency the scheduler should assume for typical memory
20291 references as seen by the application. This number is highly
20292 dependent on the memory access patterns used by the application and
20293 the size of the external cache on the machine.
20294
20295 Valid options for time are
20296
20297 number
20298 A decimal number representing clock cycles.
20299
20300 L1
20301 L2
20302 L3
20303 main
20304 The compiler contains estimates of the number of clock cycles
20305 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
20306 (also called Dcache, Scache, and Bcache), as well as to main
20307 memory. Note that L3 is only valid for EV5.
20308
20309 eBPF Options
20310 -mframe-limit=bytes
20311 This specifies the hard limit for frame sizes, in bytes.
20312 Currently, the value that can be specified should be less than or
20313 equal to 32767. Defaults to whatever limit is imposed by the
20314 version of the Linux kernel targeted.
20315
20316 -mkernel=version
20317 This specifies the minimum version of the kernel that will run the
20318 compiled program. GCC uses this version to determine which
20319 instructions to use, what kernel helpers to allow, etc. Currently,
20320 version can be one of 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8,
20321 4.9, 4.10, 4.11, 4.12, 4.13, 4.14, 4.15, 4.16, 4.17, 4.18, 4.19,
20322 4.20, 5.0, 5.1, 5.2, latest and native.
20323
20324 -mbig-endian
20325 Generate code for a big-endian target.
20326
20327 -mlittle-endian
20328 Generate code for a little-endian target. This is the default.
20329
20330 -mjmpext
20331 Enable generation of extra conditional-branch instructions.
20332 Enabled for CPU v2 and above.
20333
20334 -mjmp32
20335 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
20336
20337 -malu32
20338 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
20339
20340 -mcpu=version
20341 This specifies which version of the eBPF ISA to target. Newer
20342 versions may not be supported by all kernels. The default is v3.
20343
20344 Supported values for version are:
20345
20346 v1 The first stable eBPF ISA with no special features or
20347 extensions.
20348
20349 v2 Supports the jump extensions, as in -mjmpext.
20350
20351 v3 All features of v2, plus:
20352
20353 -<32-bit jump operations, as in -mjmp32>
20354 -<32-bit ALU operations, as in -malu32>
20355 -mco-re
20356 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires
20357 and is implied by -gbtf.
20358
20359 -mno-co-re
20360 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-
20361 RE support is enabled by default when generating BTF debug
20362 information for the BPF target.
20363
20364 -mxbpf
20365 Generate code for an expanded version of BPF, which relaxes some of
20366 the restrictions imposed by the BPF architecture:
20367
20368 -<Save and restore callee-saved registers at function entry and>
20369 exit, respectively.
20370
20371 FR30 Options
20372 These options are defined specifically for the FR30 port.
20373
20374 -msmall-model
20375 Use the small address space model. This can produce smaller code,
20376 but it does assume that all symbolic values and addresses fit into
20377 a 20-bit range.
20378
20379 -mno-lsim
20380 Assume that runtime support has been provided and so there is no
20381 need to include the simulator library (libsim.a) on the linker
20382 command line.
20383
20384 FT32 Options
20385 These options are defined specifically for the FT32 port.
20386
20387 -msim
20388 Specifies that the program will be run on the simulator. This
20389 causes an alternate runtime startup and library to be linked. You
20390 must not use this option when generating programs that will run on
20391 real hardware; you must provide your own runtime library for
20392 whatever I/O functions are needed.
20393
20394 -mlra
20395 Enable Local Register Allocation. This is still experimental for
20396 FT32, so by default the compiler uses standard reload.
20397
20398 -mnodiv
20399 Do not use div and mod instructions.
20400
20401 -mft32b
20402 Enable use of the extended instructions of the FT32B processor.
20403
20404 -mcompress
20405 Compress all code using the Ft32B code compression scheme.
20406
20407 -mnopm
20408 Do not generate code that reads program memory.
20409
20410 FRV Options
20411 -mgpr-32
20412 Only use the first 32 general-purpose registers.
20413
20414 -mgpr-64
20415 Use all 64 general-purpose registers.
20416
20417 -mfpr-32
20418 Use only the first 32 floating-point registers.
20419
20420 -mfpr-64
20421 Use all 64 floating-point registers.
20422
20423 -mhard-float
20424 Use hardware instructions for floating-point operations.
20425
20426 -msoft-float
20427 Use library routines for floating-point operations.
20428
20429 -malloc-cc
20430 Dynamically allocate condition code registers.
20431
20432 -mfixed-cc
20433 Do not try to dynamically allocate condition code registers, only
20434 use "icc0" and "fcc0".
20435
20436 -mdword
20437 Change ABI to use double word insns.
20438
20439 -mno-dword
20440 Do not use double word instructions.
20441
20442 -mdouble
20443 Use floating-point double instructions.
20444
20445 -mno-double
20446 Do not use floating-point double instructions.
20447
20448 -mmedia
20449 Use media instructions.
20450
20451 -mno-media
20452 Do not use media instructions.
20453
20454 -mmuladd
20455 Use multiply and add/subtract instructions.
20456
20457 -mno-muladd
20458 Do not use multiply and add/subtract instructions.
20459
20460 -mfdpic
20461 Select the FDPIC ABI, which uses function descriptors to represent
20462 pointers to functions. Without any PIC/PIE-related options, it
20463 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
20464 small data are within a 12-bit range from the GOT base address;
20465 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
20466 bfin-elf target, this option implies -msim.
20467
20468 -minline-plt
20469 Enable inlining of PLT entries in function calls to functions that
20470 are not known to bind locally. It has no effect without -mfdpic.
20471 It's enabled by default if optimizing for speed and compiling for
20472 shared libraries (i.e., -fPIC or -fpic), or when an optimization
20473 option such as -O3 or above is present in the command line.
20474
20475 -mTLS
20476 Assume a large TLS segment when generating thread-local code.
20477
20478 -mtls
20479 Do not assume a large TLS segment when generating thread-local
20480 code.
20481
20482 -mgprel-ro
20483 Enable the use of "GPREL" relocations in the FDPIC ABI for data
20484 that is known to be in read-only sections. It's enabled by
20485 default, except for -fpic or -fpie: even though it may help make
20486 the global offset table smaller, it trades 1 instruction for 4.
20487 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
20488 may be shared by multiple symbols, and it avoids the need for a GOT
20489 entry for the referenced symbol, so it's more likely to be a win.
20490 If it is not, -mno-gprel-ro can be used to disable it.
20491
20492 -multilib-library-pic
20493 Link with the (library, not FD) pic libraries. It's implied by
20494 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
20495 should never have to use it explicitly.
20496
20497 -mlinked-fp
20498 Follow the EABI requirement of always creating a frame pointer
20499 whenever a stack frame is allocated. This option is enabled by
20500 default and can be disabled with -mno-linked-fp.
20501
20502 -mlong-calls
20503 Use indirect addressing to call functions outside the current
20504 compilation unit. This allows the functions to be placed anywhere
20505 within the 32-bit address space.
20506
20507 -malign-labels
20508 Try to align labels to an 8-byte boundary by inserting NOPs into
20509 the previous packet. This option only has an effect when VLIW
20510 packing is enabled. It doesn't create new packets; it merely adds
20511 NOPs to existing ones.
20512
20513 -mlibrary-pic
20514 Generate position-independent EABI code.
20515
20516 -macc-4
20517 Use only the first four media accumulator registers.
20518
20519 -macc-8
20520 Use all eight media accumulator registers.
20521
20522 -mpack
20523 Pack VLIW instructions.
20524
20525 -mno-pack
20526 Do not pack VLIW instructions.
20527
20528 -mno-eflags
20529 Do not mark ABI switches in e_flags.
20530
20531 -mcond-move
20532 Enable the use of conditional-move instructions (default).
20533
20534 This switch is mainly for debugging the compiler and will likely be
20535 removed in a future version.
20536
20537 -mno-cond-move
20538 Disable the use of conditional-move instructions.
20539
20540 This switch is mainly for debugging the compiler and will likely be
20541 removed in a future version.
20542
20543 -mscc
20544 Enable the use of conditional set instructions (default).
20545
20546 This switch is mainly for debugging the compiler and will likely be
20547 removed in a future version.
20548
20549 -mno-scc
20550 Disable the use of conditional set instructions.
20551
20552 This switch is mainly for debugging the compiler and will likely be
20553 removed in a future version.
20554
20555 -mcond-exec
20556 Enable the use of conditional execution (default).
20557
20558 This switch is mainly for debugging the compiler and will likely be
20559 removed in a future version.
20560
20561 -mno-cond-exec
20562 Disable the use of conditional execution.
20563
20564 This switch is mainly for debugging the compiler and will likely be
20565 removed in a future version.
20566
20567 -mvliw-branch
20568 Run a pass to pack branches into VLIW instructions (default).
20569
20570 This switch is mainly for debugging the compiler and will likely be
20571 removed in a future version.
20572
20573 -mno-vliw-branch
20574 Do not run a pass to pack branches into VLIW instructions.
20575
20576 This switch is mainly for debugging the compiler and will likely be
20577 removed in a future version.
20578
20579 -mmulti-cond-exec
20580 Enable optimization of "&&" and "||" in conditional execution
20581 (default).
20582
20583 This switch is mainly for debugging the compiler and will likely be
20584 removed in a future version.
20585
20586 -mno-multi-cond-exec
20587 Disable optimization of "&&" and "||" in conditional execution.
20588
20589 This switch is mainly for debugging the compiler and will likely be
20590 removed in a future version.
20591
20592 -mnested-cond-exec
20593 Enable nested conditional execution optimizations (default).
20594
20595 This switch is mainly for debugging the compiler and will likely be
20596 removed in a future version.
20597
20598 -mno-nested-cond-exec
20599 Disable nested conditional execution optimizations.
20600
20601 This switch is mainly for debugging the compiler and will likely be
20602 removed in a future version.
20603
20604 -moptimize-membar
20605 This switch removes redundant "membar" instructions from the
20606 compiler-generated code. It is enabled by default.
20607
20608 -mno-optimize-membar
20609 This switch disables the automatic removal of redundant "membar"
20610 instructions from the generated code.
20611
20612 -mtomcat-stats
20613 Cause gas to print out tomcat statistics.
20614
20615 -mcpu=cpu
20616 Select the processor type for which to generate code. Possible
20617 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
20618 and simple.
20619
20620 GNU/Linux Options
20621 These -m options are defined for GNU/Linux targets:
20622
20623 -mglibc
20624 Use the GNU C library. This is the default except on
20625 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
20626 targets.
20627
20628 -muclibc
20629 Use uClibc C library. This is the default on *-*-linux-*uclibc*
20630 targets.
20631
20632 -mmusl
20633 Use the musl C library. This is the default on *-*-linux-*musl*
20634 targets.
20635
20636 -mbionic
20637 Use Bionic C library. This is the default on *-*-linux-*android*
20638 targets.
20639
20640 -mandroid
20641 Compile code compatible with Android platform. This is the default
20642 on *-*-linux-*android* targets.
20643
20644 When compiling, this option enables -mbionic, -fPIC,
20645 -fno-exceptions and -fno-rtti by default. When linking, this
20646 option makes the GCC driver pass Android-specific options to the
20647 linker. Finally, this option causes the preprocessor macro
20648 "__ANDROID__" to be defined.
20649
20650 -tno-android-cc
20651 Disable compilation effects of -mandroid, i.e., do not enable
20652 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
20653
20654 -tno-android-ld
20655 Disable linking effects of -mandroid, i.e., pass standard Linux
20656 linking options to the linker.
20657
20658 H8/300 Options
20659 These -m options are defined for the H8/300 implementations:
20660
20661 -mrelax
20662 Shorten some address references at link time, when possible; uses
20663 the linker option -relax.
20664
20665 -mh Generate code for the H8/300H.
20666
20667 -ms Generate code for the H8S.
20668
20669 -mn Generate code for the H8S and H8/300H in the normal mode. This
20670 switch must be used either with -mh or -ms.
20671
20672 -ms2600
20673 Generate code for the H8S/2600. This switch must be used with -ms.
20674
20675 -mexr
20676 Extended registers are stored on stack before execution of function
20677 with monitor attribute. Default option is -mexr. This option is
20678 valid only for H8S targets.
20679
20680 -mno-exr
20681 Extended registers are not stored on stack before execution of
20682 function with monitor attribute. Default option is -mno-exr. This
20683 option is valid only for H8S targets.
20684
20685 -mint32
20686 Make "int" data 32 bits by default.
20687
20688 -malign-300
20689 On the H8/300H and H8S, use the same alignment rules as for the
20690 H8/300. The default for the H8/300H and H8S is to align longs and
20691 floats on 4-byte boundaries. -malign-300 causes them to be aligned
20692 on 2-byte boundaries. This option has no effect on the H8/300.
20693
20694 HPPA Options
20695 These -m options are defined for the HPPA family of computers:
20696
20697 -march=architecture-type
20698 Generate code for the specified architecture. The choices for
20699 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
20700 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
20701 system to determine the proper architecture option for your
20702 machine. Code compiled for lower numbered architectures runs on
20703 higher numbered architectures, but not the other way around.
20704
20705 -mpa-risc-1-0
20706 -mpa-risc-1-1
20707 -mpa-risc-2-0
20708 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
20709
20710 -mcaller-copies
20711 The caller copies function arguments passed by hidden reference.
20712 This option should be used with care as it is not compatible with
20713 the default 32-bit runtime. However, only aggregates larger than
20714 eight bytes are passed by hidden reference and the option provides
20715 better compatibility with OpenMP.
20716
20717 -mjump-in-delay
20718 This option is ignored and provided for compatibility purposes
20719 only.
20720
20721 -mdisable-fpregs
20722 Prevent floating-point registers from being used in any manner.
20723 This is necessary for compiling kernels that perform lazy context
20724 switching of floating-point registers. If you use this option and
20725 attempt to perform floating-point operations, the compiler aborts.
20726
20727 -mdisable-indexing
20728 Prevent the compiler from using indexing address modes. This
20729 avoids some rather obscure problems when compiling MIG generated
20730 code under MACH.
20731
20732 -mno-space-regs
20733 Generate code that assumes the target has no space registers. This
20734 allows GCC to generate faster indirect calls and use unscaled index
20735 address modes.
20736
20737 Such code is suitable for level 0 PA systems and kernels.
20738
20739 -mfast-indirect-calls
20740 Generate code that assumes calls never cross space boundaries.
20741 This allows GCC to emit code that performs faster indirect calls.
20742
20743 This option does not work in the presence of shared libraries or
20744 nested functions.
20745
20746 -mfixed-range=register-range
20747 Generate code treating the given register range as fixed registers.
20748 A fixed register is one that the register allocator cannot use.
20749 This is useful when compiling kernel code. A register range is
20750 specified as two registers separated by a dash. Multiple register
20751 ranges can be specified separated by a comma.
20752
20753 -mlong-load-store
20754 Generate 3-instruction load and store sequences as sometimes
20755 required by the HP-UX 10 linker. This is equivalent to the +k
20756 option to the HP compilers.
20757
20758 -mportable-runtime
20759 Use the portable calling conventions proposed by HP for ELF
20760 systems.
20761
20762 -mgas
20763 Enable the use of assembler directives only GAS understands.
20764
20765 -mschedule=cpu-type
20766 Schedule code according to the constraints for the machine type
20767 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
20768 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
20769 to determine the proper scheduling option for your machine. The
20770 default scheduling is 8000.
20771
20772 -mlinker-opt
20773 Enable the optimization pass in the HP-UX linker. Note this makes
20774 symbolic debugging impossible. It also triggers a bug in the HP-UX
20775 8 and HP-UX 9 linkers in which they give bogus error messages when
20776 linking some programs.
20777
20778 -msoft-float
20779 Generate output containing library calls for floating point.
20780 Warning: the requisite libraries are not available for all HPPA
20781 targets. Normally the facilities of the machine's usual C compiler
20782 are used, but this cannot be done directly in cross-compilation.
20783 You must make your own arrangements to provide suitable library
20784 functions for cross-compilation.
20785
20786 -msoft-float changes the calling convention in the output file;
20787 therefore, it is only useful if you compile all of a program with
20788 this option. In particular, you need to compile libgcc.a, the
20789 library that comes with GCC, with -msoft-float in order for this to
20790 work.
20791
20792 -msio
20793 Generate the predefine, "_SIO", for server IO. The default is
20794 -mwsio. This generates the predefines, "__hp9000s700",
20795 "__hp9000s700__" and "_WSIO", for workstation IO. These options
20796 are available under HP-UX and HI-UX.
20797
20798 -mgnu-ld
20799 Use options specific to GNU ld. This passes -shared to ld when
20800 building a shared library. It is the default when GCC is
20801 configured, explicitly or implicitly, with the GNU linker. This
20802 option does not affect which ld is called; it only changes what
20803 parameters are passed to that ld. The ld that is called is
20804 determined by the --with-ld configure option, GCC's program search
20805 path, and finally by the user's PATH. The linker used by GCC can
20806 be printed using which `gcc -print-prog-name=ld`. This option is
20807 only available on the 64-bit HP-UX GCC, i.e. configured with
20808 hppa*64*-*-hpux*.
20809
20810 -mhp-ld
20811 Use options specific to HP ld. This passes -b to ld when building
20812 a shared library and passes +Accept TypeMismatch to ld on all
20813 links. It is the default when GCC is configured, explicitly or
20814 implicitly, with the HP linker. This option does not affect which
20815 ld is called; it only changes what parameters are passed to that
20816 ld. The ld that is called is determined by the --with-ld configure
20817 option, GCC's program search path, and finally by the user's PATH.
20818 The linker used by GCC can be printed using which `gcc
20819 -print-prog-name=ld`. This option is only available on the 64-bit
20820 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
20821
20822 -mlong-calls
20823 Generate code that uses long call sequences. This ensures that a
20824 call is always able to reach linker generated stubs. The default
20825 is to generate long calls only when the distance from the call site
20826 to the beginning of the function or translation unit, as the case
20827 may be, exceeds a predefined limit set by the branch type being
20828 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
20829 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
20830 always limited at 240,000 bytes.
20831
20832 Distances are measured from the beginning of functions when using
20833 the -ffunction-sections option, or when using the -mgas and
20834 -mno-portable-runtime options together under HP-UX with the SOM
20835 linker.
20836
20837 It is normally not desirable to use this option as it degrades
20838 performance. However, it may be useful in large applications,
20839 particularly when partial linking is used to build the application.
20840
20841 The types of long calls used depends on the capabilities of the
20842 assembler and linker, and the type of code being generated. The
20843 impact on systems that support long absolute calls, and long pic
20844 symbol-difference or pc-relative calls should be relatively small.
20845 However, an indirect call is used on 32-bit ELF systems in pic code
20846 and it is quite long.
20847
20848 -munix=unix-std
20849 Generate compiler predefines and select a startfile for the
20850 specified UNIX standard. The choices for unix-std are 93, 95 and
20851 98. 93 is supported on all HP-UX versions. 95 is available on HP-
20852 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
20853 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
20854 11.00, and 98 for HP-UX 11.11 and later.
20855
20856 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
20857 -munix=95 provides additional predefines for "XOPEN_UNIX" and
20858 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
20859 provides additional predefines for "_XOPEN_UNIX",
20860 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
20861 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
20862
20863 It is important to note that this option changes the interfaces for
20864 various library routines. It also affects the operational behavior
20865 of the C library. Thus, extreme care is needed in using this
20866 option.
20867
20868 Library code that is intended to operate with more than one UNIX
20869 standard must test, set and restore the variable
20870 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
20871 provide this capability.
20872
20873 -nolibdld
20874 Suppress the generation of link options to search libdld.sl when
20875 the -static option is specified on HP-UX 10 and later.
20876
20877 -static
20878 The HP-UX implementation of setlocale in libc has a dependency on
20879 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20880 when the -static option is specified, special link options are
20881 needed to resolve this dependency.
20882
20883 On HP-UX 10 and later, the GCC driver adds the necessary options to
20884 link with libdld.sl when the -static option is specified. This
20885 causes the resulting binary to be dynamic. On the 64-bit port, the
20886 linkers generate dynamic binaries by default in any case. The
20887 -nolibdld option can be used to prevent the GCC driver from adding
20888 these link options.
20889
20890 -threads
20891 Add support for multithreading with the dce thread library under
20892 HP-UX. This option sets flags for both the preprocessor and
20893 linker.
20894
20895 IA-64 Options
20896 These are the -m options defined for the Intel IA-64 architecture.
20897
20898 -mbig-endian
20899 Generate code for a big-endian target. This is the default for HP-
20900 UX.
20901
20902 -mlittle-endian
20903 Generate code for a little-endian target. This is the default for
20904 AIX5 and GNU/Linux.
20905
20906 -mgnu-as
20907 -mno-gnu-as
20908 Generate (or don't) code for the GNU assembler. This is the
20909 default.
20910
20911 -mgnu-ld
20912 -mno-gnu-ld
20913 Generate (or don't) code for the GNU linker. This is the default.
20914
20915 -mno-pic
20916 Generate code that does not use a global pointer register. The
20917 result is not position independent code, and violates the IA-64
20918 ABI.
20919
20920 -mvolatile-asm-stop
20921 -mno-volatile-asm-stop
20922 Generate (or don't) a stop bit immediately before and after
20923 volatile asm statements.
20924
20925 -mregister-names
20926 -mno-register-names
20927 Generate (or don't) in, loc, and out register names for the stacked
20928 registers. This may make assembler output more readable.
20929
20930 -mno-sdata
20931 -msdata
20932 Disable (or enable) optimizations that use the small data section.
20933 This may be useful for working around optimizer bugs.
20934
20935 -mconstant-gp
20936 Generate code that uses a single constant global pointer value.
20937 This is useful when compiling kernel code.
20938
20939 -mauto-pic
20940 Generate code that is self-relocatable. This implies
20941 -mconstant-gp. This is useful when compiling firmware code.
20942
20943 -minline-float-divide-min-latency
20944 Generate code for inline divides of floating-point values using the
20945 minimum latency algorithm.
20946
20947 -minline-float-divide-max-throughput
20948 Generate code for inline divides of floating-point values using the
20949 maximum throughput algorithm.
20950
20951 -mno-inline-float-divide
20952 Do not generate inline code for divides of floating-point values.
20953
20954 -minline-int-divide-min-latency
20955 Generate code for inline divides of integer values using the
20956 minimum latency algorithm.
20957
20958 -minline-int-divide-max-throughput
20959 Generate code for inline divides of integer values using the
20960 maximum throughput algorithm.
20961
20962 -mno-inline-int-divide
20963 Do not generate inline code for divides of integer values.
20964
20965 -minline-sqrt-min-latency
20966 Generate code for inline square roots using the minimum latency
20967 algorithm.
20968
20969 -minline-sqrt-max-throughput
20970 Generate code for inline square roots using the maximum throughput
20971 algorithm.
20972
20973 -mno-inline-sqrt
20974 Do not generate inline code for "sqrt".
20975
20976 -mfused-madd
20977 -mno-fused-madd
20978 Do (don't) generate code that uses the fused multiply/add or
20979 multiply/subtract instructions. The default is to use these
20980 instructions.
20981
20982 -mno-dwarf2-asm
20983 -mdwarf2-asm
20984 Don't (or do) generate assembler code for the DWARF line number
20985 debugging info. This may be useful when not using the GNU
20986 assembler.
20987
20988 -mearly-stop-bits
20989 -mno-early-stop-bits
20990 Allow stop bits to be placed earlier than immediately preceding the
20991 instruction that triggered the stop bit. This can improve
20992 instruction scheduling, but does not always do so.
20993
20994 -mfixed-range=register-range
20995 Generate code treating the given register range as fixed registers.
20996 A fixed register is one that the register allocator cannot use.
20997 This is useful when compiling kernel code. A register range is
20998 specified as two registers separated by a dash. Multiple register
20999 ranges can be specified separated by a comma.
21000
21001 -mtls-size=tls-size
21002 Specify bit size of immediate TLS offsets. Valid values are 14,
21003 22, and 64.
21004
21005 -mtune=cpu-type
21006 Tune the instruction scheduling for a particular CPU, Valid values
21007 are itanium, itanium1, merced, itanium2, and mckinley.
21008
21009 -milp32
21010 -mlp64
21011 Generate code for a 32-bit or 64-bit environment. The 32-bit
21012 environment sets int, long and pointer to 32 bits. The 64-bit
21013 environment sets int to 32 bits and long and pointer to 64 bits.
21014 These are HP-UX specific flags.
21015
21016 -mno-sched-br-data-spec
21017 -msched-br-data-spec
21018 (Dis/En)able data speculative scheduling before reload. This
21019 results in generation of "ld.a" instructions and the corresponding
21020 check instructions ("ld.c" / "chk.a"). The default setting is
21021 disabled.
21022
21023 -msched-ar-data-spec
21024 -mno-sched-ar-data-spec
21025 (En/Dis)able data speculative scheduling after reload. This
21026 results in generation of "ld.a" instructions and the corresponding
21027 check instructions ("ld.c" / "chk.a"). The default setting is
21028 enabled.
21029
21030 -mno-sched-control-spec
21031 -msched-control-spec
21032 (Dis/En)able control speculative scheduling. This feature is
21033 available only during region scheduling (i.e. before reload). This
21034 results in generation of the "ld.s" instructions and the
21035 corresponding check instructions "chk.s". The default setting is
21036 disabled.
21037
21038 -msched-br-in-data-spec
21039 -mno-sched-br-in-data-spec
21040 (En/Dis)able speculative scheduling of the instructions that are
21041 dependent on the data speculative loads before reload. This is
21042 effective only with -msched-br-data-spec enabled. The default
21043 setting is enabled.
21044
21045 -msched-ar-in-data-spec
21046 -mno-sched-ar-in-data-spec
21047 (En/Dis)able speculative scheduling of the instructions that are
21048 dependent on the data speculative loads after reload. This is
21049 effective only with -msched-ar-data-spec enabled. The default
21050 setting is enabled.
21051
21052 -msched-in-control-spec
21053 -mno-sched-in-control-spec
21054 (En/Dis)able speculative scheduling of the instructions that are
21055 dependent on the control speculative loads. This is effective only
21056 with -msched-control-spec enabled. The default setting is enabled.
21057
21058 -mno-sched-prefer-non-data-spec-insns
21059 -msched-prefer-non-data-spec-insns
21060 If enabled, data-speculative instructions are chosen for schedule
21061 only if there are no other choices at the moment. This makes the
21062 use of the data speculation much more conservative. The default
21063 setting is disabled.
21064
21065 -mno-sched-prefer-non-control-spec-insns
21066 -msched-prefer-non-control-spec-insns
21067 If enabled, control-speculative instructions are chosen for
21068 schedule only if there are no other choices at the moment. This
21069 makes the use of the control speculation much more conservative.
21070 The default setting is disabled.
21071
21072 -mno-sched-count-spec-in-critical-path
21073 -msched-count-spec-in-critical-path
21074 If enabled, speculative dependencies are considered during
21075 computation of the instructions priorities. This makes the use of
21076 the speculation a bit more conservative. The default setting is
21077 disabled.
21078
21079 -msched-spec-ldc
21080 Use a simple data speculation check. This option is on by default.
21081
21082 -msched-control-spec-ldc
21083 Use a simple check for control speculation. This option is on by
21084 default.
21085
21086 -msched-stop-bits-after-every-cycle
21087 Place a stop bit after every cycle when scheduling. This option is
21088 on by default.
21089
21090 -msched-fp-mem-deps-zero-cost
21091 Assume that floating-point stores and loads are not likely to cause
21092 a conflict when placed into the same instruction group. This
21093 option is disabled by default.
21094
21095 -msel-sched-dont-check-control-spec
21096 Generate checks for control speculation in selective scheduling.
21097 This flag is disabled by default.
21098
21099 -msched-max-memory-insns=max-insns
21100 Limit on the number of memory insns per instruction group, giving
21101 lower priority to subsequent memory insns attempting to schedule in
21102 the same instruction group. Frequently useful to prevent cache bank
21103 conflicts. The default value is 1.
21104
21105 -msched-max-memory-insns-hard-limit
21106 Makes the limit specified by msched-max-memory-insns a hard limit,
21107 disallowing more than that number in an instruction group.
21108 Otherwise, the limit is "soft", meaning that non-memory operations
21109 are preferred when the limit is reached, but memory operations may
21110 still be scheduled.
21111
21112 LM32 Options
21113 These -m options are defined for the LatticeMico32 architecture:
21114
21115 -mbarrel-shift-enabled
21116 Enable barrel-shift instructions.
21117
21118 -mdivide-enabled
21119 Enable divide and modulus instructions.
21120
21121 -mmultiply-enabled
21122 Enable multiply instructions.
21123
21124 -msign-extend-enabled
21125 Enable sign extend instructions.
21126
21127 -muser-enabled
21128 Enable user-defined instructions.
21129
21130 LoongArch Options
21131 These command-line options are defined for LoongArch targets:
21132
21133 -march=cpu-type
21134 Generate instructions for the machine type cpu-type. In contrast
21135 to -mtune=cpu-type, which merely tunes the generated code for the
21136 specified cpu-type, -march=cpu-type allows GCC to generate code
21137 that may not run at all on processors other than the one indicated.
21138 Specifying -march=cpu-type implies -mtune=cpu-type, except where
21139 noted otherwise.
21140
21141 The choices for cpu-type are:
21142
21143 native
21144 This selects the CPU to generate code for at compilation time
21145 by determining the processor type of the compiling machine.
21146 Using -march=native enables all instruction subsets supported
21147 by the local machine (hence the result might not run on
21148 different machines). Using -mtune=native produces code
21149 optimized for the local machine under the constraints of the
21150 selected instruction set.
21151
21152 loongarch64
21153 A generic CPU with 64-bit extensions.
21154
21155 la464
21156 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
21157
21158 -mtune=cpu-type
21159 Optimize the output for the given processor, specified by
21160 microarchitecture name.
21161
21162 -mabi=base-abi-type
21163 Generate code for the specified calling convention. base-abi-type
21164 can be one of:
21165
21166 lp64d
21167 Uses 64-bit general purpose registers and 32/64-bit floating-
21168 point registers for parameter passing. Data model is LP64,
21169 where int is 32 bits, while long int and pointers are 64 bits.
21170
21171 lp64f
21172 Uses 64-bit general purpose registers and 32-bit floating-point
21173 registers for parameter passing. Data model is LP64, where int
21174 is 32 bits, while long int and pointers are 64 bits.
21175
21176 lp64s
21177 Uses 64-bit general purpose registers and no floating-point
21178 registers for parameter passing. Data model is LP64, where int
21179 is 32 bits, while long int and pointers are 64 bits.
21180
21181 -mfpu=fpu-type
21182 Generate code for the specified FPU type, which can be one of:
21183
21184 64 Allow the use of hardware floating-point instructions for
21185 32-bit and 64-bit operations.
21186
21187 32 Allow the use of hardware floating-point instructions for
21188 32-bit operations.
21189
21190 none
21191 0 Prevent the use of hardware floating-point instructions.
21192
21193 -msoft-float
21194 Force -mfpu=none and prevents the use of floating-point registers
21195 for parameter passing. This option may change the target ABI.
21196
21197 -msingle-float
21198 Force -mfpu=32 and allow the use of 32-bit floating-point registers
21199 for parameter passing. This option may change the target ABI.
21200
21201 -mdouble-float
21202 Force -mfpu=64 and allow the use of 32/64-bit floating-point
21203 registers for parameter passing. This option may change the target
21204 ABI.
21205
21206 -mbranch-cost=n
21207 Set the cost of branches to roughly n instructions.
21208
21209 -mcheck-zero-division
21210 -mno-check-zero-divison
21211 Trap (do not trap) on integer division by zero. The default is
21212 -mcheck-zero-division for -O0 or -Og, and -mno-check-zero-division
21213 for other optimization levels.
21214
21215 -mcond-move-int
21216 -mno-cond-move-int
21217 Conditional moves for integral data in general-purpose registers
21218 are enabled (disabled). The default is -mcond-move-int.
21219
21220 -mcond-move-float
21221 -mno-cond-move-float
21222 Conditional moves for floating-point registers are enabled
21223 (disabled). The default is -mcond-move-float.
21224
21225 -mmemcpy
21226 -mno-memcpy
21227 Force (do not force) the use of "memcpy" for non-trivial block
21228 moves. The default is -mno-memcpy, which allows GCC to inline most
21229 constant-sized copies. Setting optimization level to -Os also
21230 forces the use of "memcpy", but -mno-memcpy may override this
21231 behavior if explicitly specified, regardless of the order these
21232 options on the command line.
21233
21234 -mstrict-align
21235 -mno-strict-align
21236 Avoid or allow generating memory accesses that may not be aligned
21237 on a natural object boundary as described in the architecture
21238 specification. The default is -mno-strict-align.
21239
21240 -msmall-data-limit=number
21241 Put global and static data smaller than number bytes into a special
21242 section (on some targets). The default value is 0.
21243
21244 -mmax-inline-memcpy-size=n
21245 Inline all block moves (such as calls to "memcpy" or structure
21246 copies) less than or equal to n bytes. The default value of n is
21247 1024.
21248
21249 -mcmodel=code-model
21250 Set the code model to one of:
21251
21252 tiny-static
21253 * local symbol and global strong symbol: The data section
21254 must be within +/-2MiB addressing space. The text section
21255 must be within +/-128MiB addressing space.
21256
21257 * global weak symbol: The got table must be within +/-2GiB
21258 addressing space.
21259
21260 tiny
21261 * local symbol: The data section must be within +/-2MiB
21262 addressing space. The text section must be within
21263 +/-128MiB addressing space.
21264
21265 * global symbol: The got table must be within +/-2GiB
21266 addressing space.
21267
21268 normal
21269 * local symbol: The data section must be within +/-2GiB
21270 addressing space. The text section must be within
21271 +/-128MiB addressing space.
21272
21273 * global symbol: The got table must be within +/-2GiB
21274 addressing space.
21275
21276 large
21277 * local symbol: The data section must be within +/-2GiB
21278 addressing space. The text section must be within
21279 +/-128GiB addressing space.
21280
21281 * global symbol: The got table must be within +/-2GiB
21282 addressing space.
21283
21284 extreme(Not implemented yet)
21285 * local symbol: The data and text section must be within
21286 +/-8EiB addressing space.
21287
21288 * global symbol: The data got table must be within +/-8EiB
21289 addressing space.
21290
21291 The default code model is "normal".
21292
21293 M32C Options
21294 -mcpu=name
21295 Select the CPU for which code is generated. name may be one of r8c
21296 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
21297 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
21298
21299 -msim
21300 Specifies that the program will be run on the simulator. This
21301 causes an alternate runtime library to be linked in which supports,
21302 for example, file I/O. You must not use this option when
21303 generating programs that will run on real hardware; you must
21304 provide your own runtime library for whatever I/O functions are
21305 needed.
21306
21307 -memregs=number
21308 Specifies the number of memory-based pseudo-registers GCC uses
21309 during code generation. These pseudo-registers are used like real
21310 registers, so there is a tradeoff between GCC's ability to fit the
21311 code into available registers, and the performance penalty of using
21312 memory instead of registers. Note that all modules in a program
21313 must be compiled with the same value for this option. Because of
21314 that, you must not use this option with GCC's default runtime
21315 libraries.
21316
21317 M32R/D Options
21318 These -m options are defined for Renesas M32R/D architectures:
21319
21320 -m32r2
21321 Generate code for the M32R/2.
21322
21323 -m32rx
21324 Generate code for the M32R/X.
21325
21326 -m32r
21327 Generate code for the M32R. This is the default.
21328
21329 -mmodel=small
21330 Assume all objects live in the lower 16MB of memory (so that their
21331 addresses can be loaded with the "ld24" instruction), and assume
21332 all subroutines are reachable with the "bl" instruction. This is
21333 the default.
21334
21335 The addressability of a particular object can be set with the
21336 "model" attribute.
21337
21338 -mmodel=medium
21339 Assume objects may be anywhere in the 32-bit address space (the
21340 compiler generates "seth/add3" instructions to load their
21341 addresses), and assume all subroutines are reachable with the "bl"
21342 instruction.
21343
21344 -mmodel=large
21345 Assume objects may be anywhere in the 32-bit address space (the
21346 compiler generates "seth/add3" instructions to load their
21347 addresses), and assume subroutines may not be reachable with the
21348 "bl" instruction (the compiler generates the much slower
21349 "seth/add3/jl" instruction sequence).
21350
21351 -msdata=none
21352 Disable use of the small data area. Variables are put into one of
21353 ".data", ".bss", or ".rodata" (unless the "section" attribute has
21354 been specified). This is the default.
21355
21356 The small data area consists of sections ".sdata" and ".sbss".
21357 Objects may be explicitly put in the small data area with the
21358 "section" attribute using one of these sections.
21359
21360 -msdata=sdata
21361 Put small global and static data in the small data area, but do not
21362 generate special code to reference them.
21363
21364 -msdata=use
21365 Put small global and static data in the small data area, and
21366 generate special instructions to reference them.
21367
21368 -G num
21369 Put global and static objects less than or equal to num bytes into
21370 the small data or BSS sections instead of the normal data or BSS
21371 sections. The default value of num is 8. The -msdata option must
21372 be set to one of sdata or use for this option to have any effect.
21373
21374 All modules should be compiled with the same -G num value.
21375 Compiling with different values of num may or may not work; if it
21376 doesn't the linker gives an error message---incorrect code is not
21377 generated.
21378
21379 -mdebug
21380 Makes the M32R-specific code in the compiler display some
21381 statistics that might help in debugging programs.
21382
21383 -malign-loops
21384 Align all loops to a 32-byte boundary.
21385
21386 -mno-align-loops
21387 Do not enforce a 32-byte alignment for loops. This is the default.
21388
21389 -missue-rate=number
21390 Issue number instructions per cycle. number can only be 1 or 2.
21391
21392 -mbranch-cost=number
21393 number can only be 1 or 2. If it is 1 then branches are preferred
21394 over conditional code, if it is 2, then the opposite applies.
21395
21396 -mflush-trap=number
21397 Specifies the trap number to use to flush the cache. The default
21398 is 12. Valid numbers are between 0 and 15 inclusive.
21399
21400 -mno-flush-trap
21401 Specifies that the cache cannot be flushed by using a trap.
21402
21403 -mflush-func=name
21404 Specifies the name of the operating system function to call to
21405 flush the cache. The default is _flush_cache, but a function call
21406 is only used if a trap is not available.
21407
21408 -mno-flush-func
21409 Indicates that there is no OS function for flushing the cache.
21410
21411 M680x0 Options
21412 These are the -m options defined for M680x0 and ColdFire processors.
21413 The default settings depend on which architecture was selected when the
21414 compiler was configured; the defaults for the most common choices are
21415 given below.
21416
21417 -march=arch
21418 Generate code for a specific M680x0 or ColdFire instruction set
21419 architecture. Permissible values of arch for M680x0 architectures
21420 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
21421 architectures are selected according to Freescale's ISA
21422 classification and the permissible values are: isaa, isaaplus, isab
21423 and isac.
21424
21425 GCC defines a macro "__mcfarch__" whenever it is generating code
21426 for a ColdFire target. The arch in this macro is one of the -march
21427 arguments given above.
21428
21429 When used together, -march and -mtune select code that runs on a
21430 family of similar processors but that is optimized for a particular
21431 microarchitecture.
21432
21433 -mcpu=cpu
21434 Generate code for a specific M680x0 or ColdFire processor. The
21435 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
21436 68332 and cpu32. The ColdFire cpus are given by the table below,
21437 which also classifies the CPUs into families:
21438
21439 Family : -mcpu arguments
21440 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
21441 5206 : 5202 5204 5206
21442 5206e : 5206e
21443 5208 : 5207 5208
21444 5211a : 5210a 5211a
21445 5213 : 5211 5212 5213
21446 5216 : 5214 5216
21447 52235 : 52230 52231 52232 52233 52234 52235
21448 5225 : 5224 5225
21449 52259 : 52252 52254 52255 52256 52258 52259
21450 5235 : 5232 5233 5234 5235 523x
21451 5249 : 5249
21452 5250 : 5250
21453 5271 : 5270 5271
21454 5272 : 5272
21455 5275 : 5274 5275
21456 5282 : 5280 5281 5282 528x
21457 53017 : 53011 53012 53013 53014 53015 53016 53017
21458 5307 : 5307
21459 5329 : 5327 5328 5329 532x
21460 5373 : 5372 5373 537x
21461 5407 : 5407
21462 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
21463 5485
21464
21465 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
21466 Other combinations of -mcpu and -march are rejected.
21467
21468 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
21469 selected. It also defines "__mcf_family_family", where the value
21470 of family is given by the table above.
21471
21472 -mtune=tune
21473 Tune the code for a particular microarchitecture within the
21474 constraints set by -march and -mcpu. The M680x0 microarchitectures
21475 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
21476 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
21477
21478 You can also use -mtune=68020-40 for code that needs to run
21479 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
21480 is similar but includes 68060 targets as well. These two options
21481 select the same tuning decisions as -m68020-40 and -m68020-60
21482 respectively.
21483
21484 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
21485 680x0 architecture arch. It also defines "mcarch" unless either
21486 -ansi or a non-GNU -std option is used. If GCC is tuning for a
21487 range of architectures, as selected by -mtune=68020-40 or
21488 -mtune=68020-60, it defines the macros for every architecture in
21489 the range.
21490
21491 GCC also defines the macro "__muarch__" when tuning for ColdFire
21492 microarchitecture uarch, where uarch is one of the arguments given
21493 above.
21494
21495 -m68000
21496 -mc68000
21497 Generate output for a 68000. This is the default when the compiler
21498 is configured for 68000-based systems. It is equivalent to
21499 -march=68000.
21500
21501 Use this option for microcontrollers with a 68000 or EC000 core,
21502 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21503
21504 -m68010
21505 Generate output for a 68010. This is the default when the compiler
21506 is configured for 68010-based systems. It is equivalent to
21507 -march=68010.
21508
21509 -m68020
21510 -mc68020
21511 Generate output for a 68020. This is the default when the compiler
21512 is configured for 68020-based systems. It is equivalent to
21513 -march=68020.
21514
21515 -m68030
21516 Generate output for a 68030. This is the default when the compiler
21517 is configured for 68030-based systems. It is equivalent to
21518 -march=68030.
21519
21520 -m68040
21521 Generate output for a 68040. This is the default when the compiler
21522 is configured for 68040-based systems. It is equivalent to
21523 -march=68040.
21524
21525 This option inhibits the use of 68881/68882 instructions that have
21526 to be emulated by software on the 68040. Use this option if your
21527 68040 does not have code to emulate those instructions.
21528
21529 -m68060
21530 Generate output for a 68060. This is the default when the compiler
21531 is configured for 68060-based systems. It is equivalent to
21532 -march=68060.
21533
21534 This option inhibits the use of 68020 and 68881/68882 instructions
21535 that have to be emulated by software on the 68060. Use this option
21536 if your 68060 does not have code to emulate those instructions.
21537
21538 -mcpu32
21539 Generate output for a CPU32. This is the default when the compiler
21540 is configured for CPU32-based systems. It is equivalent to
21541 -march=cpu32.
21542
21543 Use this option for microcontrollers with a CPU32 or CPU32+ core,
21544 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
21545 68341, 68349 and 68360.
21546
21547 -m5200
21548 Generate output for a 520X ColdFire CPU. This is the default when
21549 the compiler is configured for 520X-based systems. It is
21550 equivalent to -mcpu=5206, and is now deprecated in favor of that
21551 option.
21552
21553 Use this option for microcontroller with a 5200 core, including the
21554 MCF5202, MCF5203, MCF5204 and MCF5206.
21555
21556 -m5206e
21557 Generate output for a 5206e ColdFire CPU. The option is now
21558 deprecated in favor of the equivalent -mcpu=5206e.
21559
21560 -m528x
21561 Generate output for a member of the ColdFire 528X family. The
21562 option is now deprecated in favor of the equivalent -mcpu=528x.
21563
21564 -m5307
21565 Generate output for a ColdFire 5307 CPU. The option is now
21566 deprecated in favor of the equivalent -mcpu=5307.
21567
21568 -m5407
21569 Generate output for a ColdFire 5407 CPU. The option is now
21570 deprecated in favor of the equivalent -mcpu=5407.
21571
21572 -mcfv4e
21573 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
21574 This includes use of hardware floating-point instructions. The
21575 option is equivalent to -mcpu=547x, and is now deprecated in favor
21576 of that option.
21577
21578 -m68020-40
21579 Generate output for a 68040, without using any of the new
21580 instructions. This results in code that can run relatively
21581 efficiently on either a 68020/68881 or a 68030 or a 68040. The
21582 generated code does use the 68881 instructions that are emulated on
21583 the 68040.
21584
21585 The option is equivalent to -march=68020 -mtune=68020-40.
21586
21587 -m68020-60
21588 Generate output for a 68060, without using any of the new
21589 instructions. This results in code that can run relatively
21590 efficiently on either a 68020/68881 or a 68030 or a 68040. The
21591 generated code does use the 68881 instructions that are emulated on
21592 the 68060.
21593
21594 The option is equivalent to -march=68020 -mtune=68020-60.
21595
21596 -mhard-float
21597 -m68881
21598 Generate floating-point instructions. This is the default for
21599 68020 and above, and for ColdFire devices that have an FPU. It
21600 defines the macro "__HAVE_68881__" on M680x0 targets and
21601 "__mcffpu__" on ColdFire targets.
21602
21603 -msoft-float
21604 Do not generate floating-point instructions; use library calls
21605 instead. This is the default for 68000, 68010, and 68832 targets.
21606 It is also the default for ColdFire devices that have no FPU.
21607
21608 -mdiv
21609 -mno-div
21610 Generate (do not generate) ColdFire hardware divide and remainder
21611 instructions. If -march is used without -mcpu, the default is "on"
21612 for ColdFire architectures and "off" for M680x0 architectures.
21613 Otherwise, the default is taken from the target CPU (either the
21614 default CPU, or the one specified by -mcpu). For example, the
21615 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
21616
21617 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
21618
21619 -mshort
21620 Consider type "int" to be 16 bits wide, like "short int".
21621 Additionally, parameters passed on the stack are also aligned to a
21622 16-bit boundary even on targets whose API mandates promotion to
21623 32-bit.
21624
21625 -mno-short
21626 Do not consider type "int" to be 16 bits wide. This is the
21627 default.
21628
21629 -mnobitfield
21630 -mno-bitfield
21631 Do not use the bit-field instructions. The -m68000, -mcpu32 and
21632 -m5200 options imply -mnobitfield.
21633
21634 -mbitfield
21635 Do use the bit-field instructions. The -m68020 option implies
21636 -mbitfield. This is the default if you use a configuration
21637 designed for a 68020.
21638
21639 -mrtd
21640 Use a different function-calling convention, in which functions
21641 that take a fixed number of arguments return with the "rtd"
21642 instruction, which pops their arguments while returning. This
21643 saves one instruction in the caller since there is no need to pop
21644 the arguments there.
21645
21646 This calling convention is incompatible with the one normally used
21647 on Unix, so you cannot use it if you need to call libraries
21648 compiled with the Unix compiler.
21649
21650 Also, you must provide function prototypes for all functions that
21651 take variable numbers of arguments (including "printf"); otherwise
21652 incorrect code is generated for calls to those functions.
21653
21654 In addition, seriously incorrect code results if you call a
21655 function with too many arguments. (Normally, extra arguments are
21656 harmlessly ignored.)
21657
21658 The "rtd" instruction is supported by the 68010, 68020, 68030,
21659 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21660
21661 The default is -mno-rtd.
21662
21663 -malign-int
21664 -mno-align-int
21665 Control whether GCC aligns "int", "long", "long long", "float",
21666 "double", and "long double" variables on a 32-bit boundary
21667 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
21668 variables on 32-bit boundaries produces code that runs somewhat
21669 faster on processors with 32-bit busses at the expense of more
21670 memory.
21671
21672 Warning: if you use the -malign-int switch, GCC aligns structures
21673 containing the above types differently than most published
21674 application binary interface specifications for the m68k.
21675
21676 Use the pc-relative addressing mode of the 68000 directly, instead
21677 of using a global offset table. At present, this option implies
21678 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
21679 -fPIC is not presently supported with -mpcrel, though this could be
21680 supported for 68020 and higher processors.
21681
21682 -mno-strict-align
21683 -mstrict-align
21684 Do not (do) assume that unaligned memory references are handled by
21685 the system.
21686
21687 -msep-data
21688 Generate code that allows the data segment to be located in a
21689 different area of memory from the text segment. This allows for
21690 execute-in-place in an environment without virtual memory
21691 management. This option implies -fPIC.
21692
21693 -mno-sep-data
21694 Generate code that assumes that the data segment follows the text
21695 segment. This is the default.
21696
21697 -mid-shared-library
21698 Generate code that supports shared libraries via the library ID
21699 method. This allows for execute-in-place and shared libraries in
21700 an environment without virtual memory management. This option
21701 implies -fPIC.
21702
21703 -mno-id-shared-library
21704 Generate code that doesn't assume ID-based shared libraries are
21705 being used. This is the default.
21706
21707 -mshared-library-id=n
21708 Specifies the identification number of the ID-based shared library
21709 being compiled. Specifying a value of 0 generates more compact
21710 code; specifying other values forces the allocation of that number
21711 to the current library, but is no more space- or time-efficient
21712 than omitting this option.
21713
21714 -mxgot
21715 -mno-xgot
21716 When generating position-independent code for ColdFire, generate
21717 code that works if the GOT has more than 8192 entries. This code
21718 is larger and slower than code generated without this option. On
21719 M680x0 processors, this option is not needed; -fPIC suffices.
21720
21721 GCC normally uses a single instruction to load values from the GOT.
21722 While this is relatively efficient, it only works if the GOT is
21723 smaller than about 64k. Anything larger causes the linker to
21724 report an error such as:
21725
21726 relocation truncated to fit: R_68K_GOT16O foobar
21727
21728 If this happens, you should recompile your code with -mxgot. It
21729 should then work with very large GOTs. However, code generated
21730 with -mxgot is less efficient, since it takes 4 instructions to
21731 fetch the value of a global symbol.
21732
21733 Note that some linkers, including newer versions of the GNU linker,
21734 can create multiple GOTs and sort GOT entries. If you have such a
21735 linker, you should only need to use -mxgot when compiling a single
21736 object file that accesses more than 8192 GOT entries. Very few do.
21737
21738 These options have no effect unless GCC is generating position-
21739 independent code.
21740
21741 -mlong-jump-table-offsets
21742 Use 32-bit offsets in "switch" tables. The default is to use
21743 16-bit offsets.
21744
21745 MCore Options
21746 These are the -m options defined for the Motorola M*Core processors.
21747
21748 -mhardlit
21749 -mno-hardlit
21750 Inline constants into the code stream if it can be done in two
21751 instructions or less.
21752
21753 -mdiv
21754 -mno-div
21755 Use the divide instruction. (Enabled by default).
21756
21757 -mrelax-immediate
21758 -mno-relax-immediate
21759 Allow arbitrary-sized immediates in bit operations.
21760
21761 -mwide-bitfields
21762 -mno-wide-bitfields
21763 Always treat bit-fields as "int"-sized.
21764
21765 -m4byte-functions
21766 -mno-4byte-functions
21767 Force all functions to be aligned to a 4-byte boundary.
21768
21769 -mcallgraph-data
21770 -mno-callgraph-data
21771 Emit callgraph information.
21772
21773 -mslow-bytes
21774 -mno-slow-bytes
21775 Prefer word access when reading byte quantities.
21776
21777 -mlittle-endian
21778 -mbig-endian
21779 Generate code for a little-endian target.
21780
21781 -m210
21782 -m340
21783 Generate code for the 210 processor.
21784
21785 -mno-lsim
21786 Assume that runtime support has been provided and so omit the
21787 simulator library (libsim.a) from the linker command line.
21788
21789 -mstack-increment=size
21790 Set the maximum amount for a single stack increment operation.
21791 Large values can increase the speed of programs that contain
21792 functions that need a large amount of stack space, but they can
21793 also trigger a segmentation fault if the stack is extended too
21794 much. The default value is 0x1000.
21795
21796 MeP Options
21797 -mabsdiff
21798 Enables the "abs" instruction, which is the absolute difference
21799 between two registers.
21800
21801 -mall-opts
21802 Enables all the optional instructions---average, multiply, divide,
21803 bit operations, leading zero, absolute difference, min/max, clip,
21804 and saturation.
21805
21806 -maverage
21807 Enables the "ave" instruction, which computes the average of two
21808 registers.
21809
21810 -mbased=n
21811 Variables of size n bytes or smaller are placed in the ".based"
21812 section by default. Based variables use the $tp register as a base
21813 register, and there is a 128-byte limit to the ".based" section.
21814
21815 -mbitops
21816 Enables the bit operation instructions---bit test ("btstm"), set
21817 ("bsetm"), clear ("bclrm"), invert ("bnotm"), and test-and-set
21818 ("tas").
21819
21820 -mc=name
21821 Selects which section constant data is placed in. name may be
21822 tiny, near, or far.
21823
21824 -mclip
21825 Enables the "clip" instruction. Note that -mclip is not useful
21826 unless you also provide -mminmax.
21827
21828 -mconfig=name
21829 Selects one of the built-in core configurations. Each MeP chip has
21830 one or more modules in it; each module has a core CPU and a variety
21831 of coprocessors, optional instructions, and peripherals. The
21832 "MeP-Integrator" tool, not part of GCC, provides these
21833 configurations through this option; using this option is the same
21834 as using all the corresponding command-line options. The default
21835 configuration is default.
21836
21837 -mcop
21838 Enables the coprocessor instructions. By default, this is a 32-bit
21839 coprocessor. Note that the coprocessor is normally enabled via the
21840 -mconfig= option.
21841
21842 -mcop32
21843 Enables the 32-bit coprocessor's instructions.
21844
21845 -mcop64
21846 Enables the 64-bit coprocessor's instructions.
21847
21848 -mivc2
21849 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21850
21851 -mdc
21852 Causes constant variables to be placed in the ".near" section.
21853
21854 -mdiv
21855 Enables the "div" and "divu" instructions.
21856
21857 -meb
21858 Generate big-endian code.
21859
21860 -mel
21861 Generate little-endian code.
21862
21863 -mio-volatile
21864 Tells the compiler that any variable marked with the "io" attribute
21865 is to be considered volatile.
21866
21867 -ml Causes variables to be assigned to the ".far" section by default.
21868
21869 -mleadz
21870 Enables the "leadz" (leading zero) instruction.
21871
21872 -mm Causes variables to be assigned to the ".near" section by default.
21873
21874 -mminmax
21875 Enables the "min" and "max" instructions.
21876
21877 -mmult
21878 Enables the multiplication and multiply-accumulate instructions.
21879
21880 -mno-opts
21881 Disables all the optional instructions enabled by -mall-opts.
21882
21883 -mrepeat
21884 Enables the "repeat" and "erepeat" instructions, used for low-
21885 overhead looping.
21886
21887 -ms Causes all variables to default to the ".tiny" section. Note that
21888 there is a 65536-byte limit to this section. Accesses to these
21889 variables use the %gp base register.
21890
21891 -msatur
21892 Enables the saturation instructions. Note that the compiler does
21893 not currently generate these itself, but this option is included
21894 for compatibility with other tools, like "as".
21895
21896 -msdram
21897 Link the SDRAM-based runtime instead of the default ROM-based
21898 runtime.
21899
21900 -msim
21901 Link the simulator run-time libraries.
21902
21903 -msimnovec
21904 Link the simulator runtime libraries, excluding built-in support
21905 for reset and exception vectors and tables.
21906
21907 -mtf
21908 Causes all functions to default to the ".far" section. Without
21909 this option, functions default to the ".near" section.
21910
21911 -mtiny=n
21912 Variables that are n bytes or smaller are allocated to the ".tiny"
21913 section. These variables use the $gp base register. The default
21914 for this option is 4, but note that there's a 65536-byte limit to
21915 the ".tiny" section.
21916
21917 MicroBlaze Options
21918 -msoft-float
21919 Use software emulation for floating point (default).
21920
21921 -mhard-float
21922 Use hardware floating-point instructions.
21923
21924 -mmemcpy
21925 Do not optimize block moves, use "memcpy".
21926
21927 -mno-clearbss
21928 This option is deprecated. Use -fno-zero-initialized-in-bss
21929 instead.
21930
21931 -mcpu=cpu-type
21932 Use features of, and schedule code for, the given CPU. Supported
21933 values are in the format vX.YY.Z, where X is a major version, YY is
21934 the minor version, and Z is compatibility code. Example values are
21935 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
21936
21937 -mxl-soft-mul
21938 Use software multiply emulation (default).
21939
21940 -mxl-soft-div
21941 Use software emulation for divides (default).
21942
21943 -mxl-barrel-shift
21944 Use the hardware barrel shifter.
21945
21946 -mxl-pattern-compare
21947 Use pattern compare instructions.
21948
21949 -msmall-divides
21950 Use table lookup optimization for small signed integer divisions.
21951
21952 -mxl-stack-check
21953 This option is deprecated. Use -fstack-check instead.
21954
21955 -mxl-gp-opt
21956 Use GP-relative ".sdata"/".sbss" sections.
21957
21958 -mxl-multiply-high
21959 Use multiply high instructions for high part of 32x32 multiply.
21960
21961 -mxl-float-convert
21962 Use hardware floating-point conversion instructions.
21963
21964 -mxl-float-sqrt
21965 Use hardware floating-point square root instruction.
21966
21967 -mbig-endian
21968 Generate code for a big-endian target.
21969
21970 -mlittle-endian
21971 Generate code for a little-endian target.
21972
21973 -mxl-reorder
21974 Use reorder instructions (swap and byte reversed load/store).
21975
21976 -mxl-mode-app-model
21977 Select application model app-model. Valid models are
21978
21979 executable
21980 normal executable (default), uses startup code crt0.o.
21981
21982 xmdstub
21983 for use with Xilinx Microprocessor Debugger (XMD) based
21984 software intrusive debug agent called xmdstub. This uses
21985 startup file crt1.o and sets the start address of the program
21986 to 0x800.
21987
21988 bootstrap
21989 for applications that are loaded using a bootloader. This
21990 model uses startup file crt2.o which does not contain a
21991 processor reset vector handler. This is suitable for
21992 transferring control on a processor reset to the bootloader
21993 rather than the application.
21994
21995 novectors
21996 for applications that do not require any of the MicroBlaze
21997 vectors. This option may be useful for applications running
21998 within a monitoring application. This model uses crt3.o as a
21999 startup file.
22000
22001 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
22002 model.
22003
22004 -mpic-data-is-text-relative
22005 Assume that the displacement between the text and data segments is
22006 fixed at static link time. This allows data to be referenced by
22007 offset from start of text address instead of GOT since PC-relative
22008 addressing is not supported.
22009
22010 MIPS Options
22011 -EB Generate big-endian code.
22012
22013 -EL Generate little-endian code. This is the default for mips*el-*-*
22014 configurations.
22015
22016 -march=arch
22017 Generate code that runs on arch, which can be the name of a generic
22018 MIPS ISA, or the name of a particular processor. The ISA names
22019 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
22020 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
22021 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
22022 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
22023 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
22024 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
22025 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
22026 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
22027 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
22028 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
22029 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
22030 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
22031 and xlp. The special value from-abi selects the most compatible
22032 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
22033 and mips3 for 64-bit ABIs).
22034
22035 The native Linux/GNU toolchain also supports the value native,
22036 which selects the best architecture option for the host processor.
22037 -march=native has no effect if GCC does not recognize the
22038 processor.
22039
22040 In processor names, a final 000 can be abbreviated as k (for
22041 example, -march=r2k). Prefixes are optional, and vr may be written
22042 r.
22043
22044 Names of the form nf2_1 refer to processors with FPUs clocked at
22045 half the rate of the core, names of the form nf1_1 refer to
22046 processors with FPUs clocked at the same rate as the core, and
22047 names of the form nf3_2 refer to processors with FPUs clocked a
22048 ratio of 3:2 with respect to the core. For compatibility reasons,
22049 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
22050 as synonyms for nf1_1.
22051
22052 GCC defines two macros based on the value of this option. The
22053 first is "_MIPS_ARCH", which gives the name of target architecture,
22054 as a string. The second has the form "_MIPS_ARCH_foo", where foo
22055 is the capitalized value of "_MIPS_ARCH". For example,
22056 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
22057 "_MIPS_ARCH_R2000".
22058
22059 Note that the "_MIPS_ARCH" macro uses the processor names given
22060 above. In other words, it has the full prefix and does not
22061 abbreviate 000 as k. In the case of from-abi, the macro names the
22062 resolved architecture (either "mips1" or "mips3"). It names the
22063 default architecture when no -march option is given.
22064
22065 -mtune=arch
22066 Optimize for arch. Among other things, this option controls the
22067 way instructions are scheduled, and the perceived cost of
22068 arithmetic operations. The list of arch values is the same as for
22069 -march.
22070
22071 When this option is not used, GCC optimizes for the processor
22072 specified by -march. By using -march and -mtune together, it is
22073 possible to generate code that runs on a family of processors, but
22074 optimize the code for one particular member of that family.
22075
22076 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
22077 work in the same way as the -march ones described above.
22078
22079 -mips1
22080 Equivalent to -march=mips1.
22081
22082 -mips2
22083 Equivalent to -march=mips2.
22084
22085 -mips3
22086 Equivalent to -march=mips3.
22087
22088 -mips4
22089 Equivalent to -march=mips4.
22090
22091 -mips32
22092 Equivalent to -march=mips32.
22093
22094 -mips32r3
22095 Equivalent to -march=mips32r3.
22096
22097 -mips32r5
22098 Equivalent to -march=mips32r5.
22099
22100 -mips32r6
22101 Equivalent to -march=mips32r6.
22102
22103 -mips64
22104 Equivalent to -march=mips64.
22105
22106 -mips64r2
22107 Equivalent to -march=mips64r2.
22108
22109 -mips64r3
22110 Equivalent to -march=mips64r3.
22111
22112 -mips64r5
22113 Equivalent to -march=mips64r5.
22114
22115 -mips64r6
22116 Equivalent to -march=mips64r6.
22117
22118 -mips16
22119 -mno-mips16
22120 Generate (do not generate) MIPS16 code. If GCC is targeting a
22121 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
22122
22123 MIPS16 code generation can also be controlled on a per-function
22124 basis by means of "mips16" and "nomips16" attributes.
22125
22126 -mflip-mips16
22127 Generate MIPS16 code on alternating functions. This option is
22128 provided for regression testing of mixed MIPS16/non-MIPS16 code
22129 generation, and is not intended for ordinary use in compiling user
22130 code.
22131
22132 -minterlink-compressed
22133 -mno-interlink-compressed
22134 Require (do not require) that code using the standard
22135 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
22136 microMIPS code, and vice versa.
22137
22138 For example, code using the standard ISA encoding cannot jump
22139 directly to MIPS16 or microMIPS code; it must either use a call or
22140 an indirect jump. -minterlink-compressed therefore disables direct
22141 jumps unless GCC knows that the target of the jump is not
22142 compressed.
22143
22144 -minterlink-mips16
22145 -mno-interlink-mips16
22146 Aliases of -minterlink-compressed and -mno-interlink-compressed.
22147 These options predate the microMIPS ASE and are retained for
22148 backwards compatibility.
22149
22150 -mabi=32
22151 -mabi=o64
22152 -mabi=n32
22153 -mabi=64
22154 -mabi=eabi
22155 Generate code for the given ABI.
22156
22157 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
22158 generates 64-bit code when you select a 64-bit architecture, but
22159 you can use -mgp32 to get 32-bit code instead.
22160
22161 For information about the O64 ABI, see
22162 <https://gcc.gnu.org/projects/mipso64-abi.html>.
22163
22164 GCC supports a variant of the o32 ABI in which floating-point
22165 registers are 64 rather than 32 bits wide. You can select this
22166 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
22167 and "mfhc1" instructions and is therefore only supported for
22168 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
22169
22170 The register assignments for arguments and return values remain the
22171 same, but each scalar value is passed in a single 64-bit register
22172 rather than a pair of 32-bit registers. For example, scalar
22173 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
22174 The set of call-saved registers also remains the same in that the
22175 even-numbered double-precision registers are saved.
22176
22177 Two additional variants of the o32 ABI are supported to enable a
22178 transition from 32-bit to 64-bit registers. These are FPXX
22179 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
22180 mandates that all code must execute correctly when run using 32-bit
22181 or 64-bit registers. The code can be interlinked with either FP32
22182 or FP64, but not both. The FP64A extension is similar to the FP64
22183 extension but forbids the use of odd-numbered single-precision
22184 registers. This can be used in conjunction with the "FRE" mode of
22185 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
22186 interlink and run in the same process without changing FPU modes.
22187
22188 -mabicalls
22189 -mno-abicalls
22190 Generate (do not generate) code that is suitable for SVR4-style
22191 dynamic objects. -mabicalls is the default for SVR4-based systems.
22192
22193 -mshared
22194 -mno-shared
22195 Generate (do not generate) code that is fully position-independent,
22196 and that can therefore be linked into shared libraries. This
22197 option only affects -mabicalls.
22198
22199 All -mabicalls code has traditionally been position-independent,
22200 regardless of options like -fPIC and -fpic. However, as an
22201 extension, the GNU toolchain allows executables to use absolute
22202 accesses for locally-binding symbols. It can also use shorter GP
22203 initialization sequences and generate direct calls to locally-
22204 defined functions. This mode is selected by -mno-shared.
22205
22206 -mno-shared depends on binutils 2.16 or higher and generates
22207 objects that can only be linked by the GNU linker. However, the
22208 option does not affect the ABI of the final executable; it only
22209 affects the ABI of relocatable objects. Using -mno-shared
22210 generally makes executables both smaller and quicker.
22211
22212 -mshared is the default.
22213
22214 -mplt
22215 -mno-plt
22216 Assume (do not assume) that the static and dynamic linkers support
22217 PLTs and copy relocations. This option only affects -mno-shared
22218 -mabicalls. For the n64 ABI, this option has no effect without
22219 -msym32.
22220
22221 You can make -mplt the default by configuring GCC with
22222 --with-mips-plt. The default is -mno-plt otherwise.
22223
22224 -mxgot
22225 -mno-xgot
22226 Lift (do not lift) the usual restrictions on the size of the global
22227 offset table.
22228
22229 GCC normally uses a single instruction to load values from the GOT.
22230 While this is relatively efficient, it only works if the GOT is
22231 smaller than about 64k. Anything larger causes the linker to
22232 report an error such as:
22233
22234 relocation truncated to fit: R_MIPS_GOT16 foobar
22235
22236 If this happens, you should recompile your code with -mxgot. This
22237 works with very large GOTs, although the code is also less
22238 efficient, since it takes three instructions to fetch the value of
22239 a global symbol.
22240
22241 Note that some linkers can create multiple GOTs. If you have such
22242 a linker, you should only need to use -mxgot when a single object
22243 file accesses more than 64k's worth of GOT entries. Very few do.
22244
22245 These options have no effect unless GCC is generating position
22246 independent code.
22247
22248 -mgp32
22249 Assume that general-purpose registers are 32 bits wide.
22250
22251 -mgp64
22252 Assume that general-purpose registers are 64 bits wide.
22253
22254 -mfp32
22255 Assume that floating-point registers are 32 bits wide.
22256
22257 -mfp64
22258 Assume that floating-point registers are 64 bits wide.
22259
22260 -mfpxx
22261 Do not assume the width of floating-point registers.
22262
22263 -mhard-float
22264 Use floating-point coprocessor instructions.
22265
22266 -msoft-float
22267 Do not use floating-point coprocessor instructions. Implement
22268 floating-point calculations using library calls instead.
22269
22270 -mno-float
22271 Equivalent to -msoft-float, but additionally asserts that the
22272 program being compiled does not perform any floating-point
22273 operations. This option is presently supported only by some bare-
22274 metal MIPS configurations, where it may select a special set of
22275 libraries that lack all floating-point support (including, for
22276 example, the floating-point "printf" formats). If code compiled
22277 with -mno-float accidentally contains floating-point operations, it
22278 is likely to suffer a link-time or run-time failure.
22279
22280 -msingle-float
22281 Assume that the floating-point coprocessor only supports single-
22282 precision operations.
22283
22284 -mdouble-float
22285 Assume that the floating-point coprocessor supports double-
22286 precision operations. This is the default.
22287
22288 -modd-spreg
22289 -mno-odd-spreg
22290 Enable the use of odd-numbered single-precision floating-point
22291 registers for the o32 ABI. This is the default for processors that
22292 are known to support these registers. When using the o32 FPXX ABI,
22293 -mno-odd-spreg is set by default.
22294
22295 -mabs=2008
22296 -mabs=legacy
22297 These options control the treatment of the special not-a-number
22298 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
22299 machine instructions.
22300
22301 By default or when -mabs=legacy is used the legacy treatment is
22302 selected. In this case these instructions are considered
22303 arithmetic and avoided where correct operation is required and the
22304 input operand might be a NaN. A longer sequence of instructions
22305 that manipulate the sign bit of floating-point datum manually is
22306 used instead unless the -ffinite-math-only option has also been
22307 specified.
22308
22309 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
22310 case these instructions are considered non-arithmetic and therefore
22311 operating correctly in all cases, including in particular where the
22312 input operand is a NaN. These instructions are therefore always
22313 used for the respective operations.
22314
22315 -mnan=2008
22316 -mnan=legacy
22317 These options control the encoding of the special not-a-number
22318 (NaN) IEEE 754 floating-point data.
22319
22320 The -mnan=legacy option selects the legacy encoding. In this case
22321 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22322 significand field being 0, whereas signaling NaNs (sNaNs) are
22323 denoted by the first bit of their trailing significand field being
22324 1.
22325
22326 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
22327 case qNaNs are denoted by the first bit of their trailing
22328 significand field being 1, whereas sNaNs are denoted by the first
22329 bit of their trailing significand field being 0.
22330
22331 The default is -mnan=legacy unless GCC has been configured with
22332 --with-nan=2008.
22333
22334 -mllsc
22335 -mno-llsc
22336 Use (do not use) ll, sc, and sync instructions to implement atomic
22337 memory built-in functions. When neither option is specified, GCC
22338 uses the instructions if the target architecture supports them.
22339
22340 -mllsc is useful if the runtime environment can emulate the
22341 instructions and -mno-llsc can be useful when compiling for
22342 nonstandard ISAs. You can make either option the default by
22343 configuring GCC with --with-llsc and --without-llsc respectively.
22344 --with-llsc is the default for some configurations; see the
22345 installation documentation for details.
22346
22347 -mdsp
22348 -mno-dsp
22349 Use (do not use) revision 1 of the MIPS DSP ASE.
22350 This option defines the preprocessor macro "__mips_dsp". It also
22351 defines "__mips_dsp_rev" to 1.
22352
22353 -mdspr2
22354 -mno-dspr2
22355 Use (do not use) revision 2 of the MIPS DSP ASE.
22356 This option defines the preprocessor macros "__mips_dsp" and
22357 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
22358
22359 -msmartmips
22360 -mno-smartmips
22361 Use (do not use) the MIPS SmartMIPS ASE.
22362
22363 -mpaired-single
22364 -mno-paired-single
22365 Use (do not use) paired-single floating-point instructions.
22366 This option requires hardware floating-point support to be
22367 enabled.
22368
22369 -mdmx
22370 -mno-mdmx
22371 Use (do not use) MIPS Digital Media Extension instructions. This
22372 option can only be used when generating 64-bit code and requires
22373 hardware floating-point support to be enabled.
22374
22375 -mips3d
22376 -mno-mips3d
22377 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
22378 -mpaired-single.
22379
22380 -mmicromips
22381 -mno-micromips
22382 Generate (do not generate) microMIPS code.
22383
22384 MicroMIPS code generation can also be controlled on a per-function
22385 basis by means of "micromips" and "nomicromips" attributes.
22386
22387 -mmt
22388 -mno-mt
22389 Use (do not use) MT Multithreading instructions.
22390
22391 -mmcu
22392 -mno-mcu
22393 Use (do not use) the MIPS MCU ASE instructions.
22394
22395 -meva
22396 -mno-eva
22397 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22398
22399 -mvirt
22400 -mno-virt
22401 Use (do not use) the MIPS Virtualization (VZ) instructions.
22402
22403 -mxpa
22404 -mno-xpa
22405 Use (do not use) the MIPS eXtended Physical Address (XPA)
22406 instructions.
22407
22408 -mcrc
22409 -mno-crc
22410 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
22411 instructions.
22412
22413 -mginv
22414 -mno-ginv
22415 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22416
22417 -mloongson-mmi
22418 -mno-loongson-mmi
22419 Use (do not use) the MIPS Loongson MultiMedia extensions
22420 Instructions (MMI).
22421
22422 -mloongson-ext
22423 -mno-loongson-ext
22424 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22425
22426 -mloongson-ext2
22427 -mno-loongson-ext2
22428 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
22429 instructions.
22430
22431 -mlong64
22432 Force "long" types to be 64 bits wide. See -mlong32 for an
22433 explanation of the default and the way that the pointer size is
22434 determined.
22435
22436 -mlong32
22437 Force "long", "int", and pointer types to be 32 bits wide.
22438
22439 The default size of "int"s, "long"s and pointers depends on the
22440 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
22441 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
22442 "long"s. Pointers are the same size as "long"s, or the same size
22443 as integer registers, whichever is smaller.
22444
22445 -msym32
22446 -mno-sym32
22447 Assume (do not assume) that all symbols have 32-bit values,
22448 regardless of the selected ABI. This option is useful in
22449 combination with -mabi=64 and -mno-abicalls because it allows GCC
22450 to generate shorter and faster references to symbolic addresses.
22451
22452 -G num
22453 Put definitions of externally-visible data in a small data section
22454 if that data is no bigger than num bytes. GCC can then generate
22455 more efficient accesses to the data; see -mgpopt for details.
22456
22457 The default -G option depends on the configuration.
22458
22459 -mlocal-sdata
22460 -mno-local-sdata
22461 Extend (do not extend) the -G behavior to local data too, such as
22462 to static variables in C. -mlocal-sdata is the default for all
22463 configurations.
22464
22465 If the linker complains that an application is using too much small
22466 data, you might want to try rebuilding the less performance-
22467 critical parts with -mno-local-sdata. You might also want to build
22468 large libraries with -mno-local-sdata, so that the libraries leave
22469 more room for the main program.
22470
22471 -mextern-sdata
22472 -mno-extern-sdata
22473 Assume (do not assume) that externally-defined data is in a small
22474 data section if the size of that data is within the -G limit.
22475 -mextern-sdata is the default for all configurations.
22476
22477 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
22478 Mod references a variable Var that is no bigger than num bytes, you
22479 must make sure that Var is placed in a small data section. If Var
22480 is defined by another module, you must either compile that module
22481 with a high-enough -G setting or attach a "section" attribute to
22482 Var's definition. If Var is common, you must link the application
22483 with a high-enough -G setting.
22484
22485 The easiest way of satisfying these restrictions is to compile and
22486 link every module with the same -G option. However, you may wish
22487 to build a library that supports several different small data
22488 limits. You can do this by compiling the library with the highest
22489 supported -G setting and additionally using -mno-extern-sdata to
22490 stop the library from making assumptions about externally-defined
22491 data.
22492
22493 -mgpopt
22494 -mno-gpopt
22495 Use (do not use) GP-relative accesses for symbols that are known to
22496 be in a small data section; see -G, -mlocal-sdata and
22497 -mextern-sdata. -mgpopt is the default for all configurations.
22498
22499 -mno-gpopt is useful for cases where the $gp register might not
22500 hold the value of "_gp". For example, if the code is part of a
22501 library that might be used in a boot monitor, programs that call
22502 boot monitor routines pass an unknown value in $gp. (In such
22503 situations, the boot monitor itself is usually compiled with -G0.)
22504
22505 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
22506
22507 -membedded-data
22508 -mno-embedded-data
22509 Allocate variables to the read-only data section first if possible,
22510 then next in the small data section if possible, otherwise in data.
22511 This gives slightly slower code than the default, but reduces the
22512 amount of RAM required when executing, and thus may be preferred
22513 for some embedded systems.
22514
22515 -muninit-const-in-rodata
22516 -mno-uninit-const-in-rodata
22517 Put uninitialized "const" variables in the read-only data section.
22518 This option is only meaningful in conjunction with -membedded-data.
22519
22520 -mcode-readable=setting
22521 Specify whether GCC may generate code that reads from executable
22522 sections. There are three possible settings:
22523
22524 -mcode-readable=yes
22525 Instructions may freely access executable sections. This is
22526 the default setting.
22527
22528 -mcode-readable=pcrel
22529 MIPS16 PC-relative load instructions can access executable
22530 sections, but other instructions must not do so. This option
22531 is useful on 4KSc and 4KSd processors when the code TLBs have
22532 the Read Inhibit bit set. It is also useful on processors that
22533 can be configured to have a dual instruction/data SRAM
22534 interface and that, like the M4K, automatically redirect PC-
22535 relative loads to the instruction RAM.
22536
22537 -mcode-readable=no
22538 Instructions must not access executable sections. This option
22539 can be useful on targets that are configured to have a dual
22540 instruction/data SRAM interface but that (unlike the M4K) do
22541 not automatically redirect PC-relative loads to the instruction
22542 RAM.
22543
22544 -msplit-addresses
22545 -mno-split-addresses
22546 Enable (disable) use of the "%hi()" and "%lo()" assembler
22547 relocation operators. This option has been superseded by
22548 -mexplicit-relocs but is retained for backwards compatibility.
22549
22550 -mexplicit-relocs
22551 -mno-explicit-relocs
22552 Use (do not use) assembler relocation operators when dealing with
22553 symbolic addresses. The alternative, selected by
22554 -mno-explicit-relocs, is to use assembler macros instead.
22555
22556 -mexplicit-relocs is the default if GCC was configured to use an
22557 assembler that supports relocation operators.
22558
22559 -mcheck-zero-division
22560 -mno-check-zero-division
22561 Trap (do not trap) on integer division by zero.
22562
22563 The default is -mcheck-zero-division.
22564
22565 -mdivide-traps
22566 -mdivide-breaks
22567 MIPS systems check for division by zero by generating either a
22568 conditional trap or a break instruction. Using traps results in
22569 smaller code, but is only supported on MIPS II and later. Also,
22570 some versions of the Linux kernel have a bug that prevents trap
22571 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
22572 to allow conditional traps on architectures that support them and
22573 -mdivide-breaks to force the use of breaks.
22574
22575 The default is usually -mdivide-traps, but this can be overridden
22576 at configure time using --with-divide=breaks. Divide-by-zero
22577 checks can be completely disabled using -mno-check-zero-division.
22578
22579 -mload-store-pairs
22580 -mno-load-store-pairs
22581 Enable (disable) an optimization that pairs consecutive load or
22582 store instructions to enable load/store bonding. This option is
22583 enabled by default but only takes effect when the selected
22584 architecture is known to support bonding.
22585
22586 -munaligned-access
22587 -mno-unaligned-access
22588 Enable (disable) direct unaligned access for MIPS Release 6.
22589 MIPSr6 requires load/store unaligned-access support, by hardware or
22590 trap&emulate. So -mno-unaligned-access may be needed by kernel.
22591
22592 -mmemcpy
22593 -mno-memcpy
22594 Force (do not force) the use of "memcpy" for non-trivial block
22595 moves. The default is -mno-memcpy, which allows GCC to inline most
22596 constant-sized copies.
22597
22598 -mlong-calls
22599 -mno-long-calls
22600 Disable (do not disable) use of the "jal" instruction. Calling
22601 functions using "jal" is more efficient but requires the caller and
22602 callee to be in the same 256 megabyte segment.
22603
22604 This option has no effect on abicalls code. The default is
22605 -mno-long-calls.
22606
22607 -mmad
22608 -mno-mad
22609 Enable (disable) use of the "mad", "madu" and "mul" instructions,
22610 as provided by the R4650 ISA.
22611
22612 -mimadd
22613 -mno-imadd
22614 Enable (disable) use of the "madd" and "msub" integer instructions.
22615 The default is -mimadd on architectures that support "madd" and
22616 "msub" except for the 74k architecture where it was found to
22617 generate slower code.
22618
22619 -mfused-madd
22620 -mno-fused-madd
22621 Enable (disable) use of the floating-point multiply-accumulate
22622 instructions, when they are available. The default is
22623 -mfused-madd.
22624
22625 On the R8000 CPU when multiply-accumulate instructions are used,
22626 the intermediate product is calculated to infinite precision and is
22627 not subject to the FCSR Flush to Zero bit. This may be undesirable
22628 in some circumstances. On other processors the result is
22629 numerically identical to the equivalent computation using separate
22630 multiply, add, subtract and negate instructions.
22631
22632 -nocpp
22633 Tell the MIPS assembler to not run its preprocessor over user
22634 assembler files (with a .s suffix) when assembling them.
22635
22636 -mfix-24k
22637 -mno-fix-24k
22638 Work around the 24K E48 (lost data on stores during refill) errata.
22639 The workarounds are implemented by the assembler rather than by
22640 GCC.
22641
22642 -mfix-r4000
22643 -mno-fix-r4000
22644 Work around certain R4000 CPU errata:
22645
22646 - A double-word or a variable shift may give an incorrect result
22647 if executed immediately after starting an integer division.
22648
22649 - A double-word or a variable shift may give an incorrect result
22650 if executed while an integer multiplication is in progress.
22651
22652 - An integer division may give an incorrect result if started in
22653 a delay slot of a taken branch or a jump.
22654
22655 -mfix-r4400
22656 -mno-fix-r4400
22657 Work around certain R4400 CPU errata:
22658
22659 - A double-word or a variable shift may give an incorrect result
22660 if executed immediately after starting an integer division.
22661
22662 -mfix-r10000
22663 -mno-fix-r10000
22664 Work around certain R10000 errata:
22665
22666 - "ll"/"sc" sequences may not behave atomically on revisions
22667 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22668
22669 This option can only be used if the target architecture supports
22670 branch-likely instructions. -mfix-r10000 is the default when
22671 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
22672
22673 -mfix-r5900
22674 -mno-fix-r5900
22675 Do not attempt to schedule the preceding instruction into the delay
22676 slot of a branch instruction placed at the end of a short loop of
22677 six instructions or fewer and always schedule a "nop" instruction
22678 there instead. The short loop bug under certain conditions causes
22679 loops to execute only once or twice, due to a hardware bug in the
22680 R5900 chip. The workaround is implemented by the assembler rather
22681 than by GCC.
22682
22683 -mfix-rm7000
22684 -mno-fix-rm7000
22685 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
22686 are implemented by the assembler rather than by GCC.
22687
22688 -mfix-vr4120
22689 -mno-fix-vr4120
22690 Work around certain VR4120 errata:
22691
22692 - "dmultu" does not always produce the correct result.
22693
22694 - "div" and "ddiv" do not always produce the correct result if
22695 one of the operands is negative.
22696
22697 The workarounds for the division errata rely on special functions
22698 in libgcc.a. At present, these functions are only provided by the
22699 "mips64vr*-elf" configurations.
22700
22701 Other VR4120 errata require a NOP to be inserted between certain
22702 pairs of instructions. These errata are handled by the assembler,
22703 not by GCC itself.
22704
22705 -mfix-vr4130
22706 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
22707 implemented by the assembler rather than by GCC, although GCC
22708 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
22709 "dmacc" and "dmacchi" instructions are available instead.
22710
22711 -mfix-sb1
22712 -mno-fix-sb1
22713 Work around certain SB-1 CPU core errata. (This flag currently
22714 works around the SB-1 revision 2 "F1" and "F2" floating-point
22715 errata.)
22716
22717 -mr10k-cache-barrier=setting
22718 Specify whether GCC should insert cache barriers to avoid the side
22719 effects of speculation on R10K processors.
22720
22721 In common with many processors, the R10K tries to predict the
22722 outcome of a conditional branch and speculatively executes
22723 instructions from the "taken" branch. It later aborts these
22724 instructions if the predicted outcome is wrong. However, on the
22725 R10K, even aborted instructions can have side effects.
22726
22727 This problem only affects kernel stores and, depending on the
22728 system, kernel loads. As an example, a speculatively-executed
22729 store may load the target memory into cache and mark the cache line
22730 as dirty, even if the store itself is later aborted. If a DMA
22731 operation writes to the same area of memory before the "dirty" line
22732 is flushed, the cached data overwrites the DMA-ed data. See the
22733 R10K processor manual for a full description, including other
22734 potential problems.
22735
22736 One workaround is to insert cache barrier instructions before every
22737 memory access that might be speculatively executed and that might
22738 have side effects even if aborted. -mr10k-cache-barrier=setting
22739 controls GCC's implementation of this workaround. It assumes that
22740 aborted accesses to any byte in the following regions does not have
22741 side effects:
22742
22743 1. the memory occupied by the current function's stack frame;
22744
22745 2. the memory occupied by an incoming stack argument;
22746
22747 3. the memory occupied by an object with a link-time-constant
22748 address.
22749
22750 It is the kernel's responsibility to ensure that speculative
22751 accesses to these regions are indeed safe.
22752
22753 If the input program contains a function declaration such as:
22754
22755 void foo (void);
22756
22757 then the implementation of "foo" must allow "j foo" and "jal foo"
22758 to be executed speculatively. GCC honors this restriction for
22759 functions it compiles itself. It expects non-GCC functions (such
22760 as hand-written assembly code) to do the same.
22761
22762 The option has three forms:
22763
22764 -mr10k-cache-barrier=load-store
22765 Insert a cache barrier before a load or store that might be
22766 speculatively executed and that might have side effects even if
22767 aborted.
22768
22769 -mr10k-cache-barrier=store
22770 Insert a cache barrier before a store that might be
22771 speculatively executed and that might have side effects even if
22772 aborted.
22773
22774 -mr10k-cache-barrier=none
22775 Disable the insertion of cache barriers. This is the default
22776 setting.
22777
22778 -mflush-func=func
22779 -mno-flush-func
22780 Specifies the function to call to flush the I and D caches, or to
22781 not call any such function. If called, the function must take the
22782 same arguments as the common "_flush_func", that is, the address of
22783 the memory range for which the cache is being flushed, the size of
22784 the memory range, and the number 3 (to flush both caches). The
22785 default depends on the target GCC was configured for, but commonly
22786 is either "_flush_func" or "__cpu_flush".
22787
22788 mbranch-cost=num
22789 Set the cost of branches to roughly num "simple" instructions.
22790 This cost is only a heuristic and is not guaranteed to produce
22791 consistent results across releases. A zero cost redundantly
22792 selects the default, which is based on the -mtune setting.
22793
22794 -mbranch-likely
22795 -mno-branch-likely
22796 Enable or disable use of Branch Likely instructions, regardless of
22797 the default for the selected architecture. By default, Branch
22798 Likely instructions may be generated if they are supported by the
22799 selected architecture. An exception is for the MIPS32 and MIPS64
22800 architectures and processors that implement those architectures;
22801 for those, Branch Likely instructions are not be generated by
22802 default because the MIPS32 and MIPS64 architectures specifically
22803 deprecate their use.
22804
22805 -mcompact-branches=never
22806 -mcompact-branches=optimal
22807 -mcompact-branches=always
22808 These options control which form of branches will be generated.
22809 The default is -mcompact-branches=optimal.
22810
22811 The -mcompact-branches=never option ensures that compact branch
22812 instructions will never be generated.
22813
22814 The -mcompact-branches=always option ensures that a compact branch
22815 instruction will be generated if available. If a compact branch
22816 instruction is not available, a delay slot form of the branch will
22817 be used instead.
22818
22819 This option is supported from MIPS Release 6 onwards.
22820
22821 The -mcompact-branches=optimal option will cause a delay slot
22822 branch to be used if one is available in the current ISA and the
22823 delay slot is successfully filled. If the delay slot is not
22824 filled, a compact branch will be chosen if one is available.
22825
22826 -mfp-exceptions
22827 -mno-fp-exceptions
22828 Specifies whether FP exceptions are enabled. This affects how FP
22829 instructions are scheduled for some processors. The default is
22830 that FP exceptions are enabled.
22831
22832 For instance, on the SB-1, if FP exceptions are disabled, and we
22833 are emitting 64-bit code, then we can use both FP pipes.
22834 Otherwise, we can only use one FP pipe.
22835
22836 -mvr4130-align
22837 -mno-vr4130-align
22838 The VR4130 pipeline is two-way superscalar, but can only issue two
22839 instructions together if the first one is 8-byte aligned. When
22840 this option is enabled, GCC aligns pairs of instructions that it
22841 thinks should execute in parallel.
22842
22843 This option only has an effect when optimizing for the VR4130. It
22844 normally makes code faster, but at the expense of making it bigger.
22845 It is enabled by default at optimization level -O3.
22846
22847 -msynci
22848 -mno-synci
22849 Enable (disable) generation of "synci" instructions on
22850 architectures that support it. The "synci" instructions (if
22851 enabled) are generated when "__builtin___clear_cache" is compiled.
22852
22853 This option defaults to -mno-synci, but the default can be
22854 overridden by configuring GCC with --with-synci.
22855
22856 When compiling code for single processor systems, it is generally
22857 safe to use "synci". However, on many multi-core (SMP) systems, it
22858 does not invalidate the instruction caches on all cores and may
22859 lead to undefined behavior.
22860
22861 -mrelax-pic-calls
22862 -mno-relax-pic-calls
22863 Try to turn PIC calls that are normally dispatched via register $25
22864 into direct calls. This is only possible if the linker can resolve
22865 the destination at link time and if the destination is within range
22866 for a direct call.
22867
22868 -mrelax-pic-calls is the default if GCC was configured to use an
22869 assembler and a linker that support the ".reloc" assembly directive
22870 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
22871 this optimization can be performed by the assembler and the linker
22872 alone without help from the compiler.
22873
22874 -mmcount-ra-address
22875 -mno-mcount-ra-address
22876 Emit (do not emit) code that allows "_mcount" to modify the calling
22877 function's return address. When enabled, this option extends the
22878 usual "_mcount" interface with a new ra-address parameter, which
22879 has type "intptr_t *" and is passed in register $12. "_mcount" can
22880 then modify the return address by doing both of the following:
22881
22882 * Returning the new address in register $31.
22883
22884 * Storing the new address in "*ra-address", if ra-address is
22885 nonnull.
22886
22887 The default is -mno-mcount-ra-address.
22888
22889 -mframe-header-opt
22890 -mno-frame-header-opt
22891 Enable (disable) frame header optimization in the o32 ABI. When
22892 using the o32 ABI, calling functions will allocate 16 bytes on the
22893 stack for the called function to write out register arguments.
22894 When enabled, this optimization will suppress the allocation of the
22895 frame header if it can be determined that it is unused.
22896
22897 This optimization is off by default at all optimization levels.
22898
22899 -mlxc1-sxc1
22900 -mno-lxc1-sxc1
22901 When applicable, enable (disable) the generation of "lwxc1",
22902 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
22903
22904 -mmadd4
22905 -mno-madd4
22906 When applicable, enable (disable) the generation of 4-operand
22907 "madd.s", "madd.d" and related instructions. Enabled by default.
22908
22909 MMIX Options
22910 These options are defined for the MMIX:
22911
22912 -mlibfuncs
22913 -mno-libfuncs
22914 Specify that intrinsic library functions are being compiled,
22915 passing all values in registers, no matter the size.
22916
22917 -mepsilon
22918 -mno-epsilon
22919 Generate floating-point comparison instructions that compare with
22920 respect to the "rE" epsilon register.
22921
22922 -mabi=mmixware
22923 -mabi=gnu
22924 Generate code that passes function parameters and return values
22925 that (in the called function) are seen as registers $0 and up, as
22926 opposed to the GNU ABI which uses global registers $231 and up.
22927
22928 -mzero-extend
22929 -mno-zero-extend
22930 When reading data from memory in sizes shorter than 64 bits, use
22931 (do not use) zero-extending load instructions by default, rather
22932 than sign-extending ones.
22933
22934 -mknuthdiv
22935 -mno-knuthdiv
22936 Make the result of a division yielding a remainder have the same
22937 sign as the divisor. With the default, -mno-knuthdiv, the sign of
22938 the remainder follows the sign of the dividend. Both methods are
22939 arithmetically valid, the latter being almost exclusively used.
22940
22941 -mtoplevel-symbols
22942 -mno-toplevel-symbols
22943 Prepend (do not prepend) a : to all global symbols, so the assembly
22944 code can be used with the "PREFIX" assembly directive.
22945
22946 -melf
22947 Generate an executable in the ELF format, rather than the default
22948 mmo format used by the mmix simulator.
22949
22950 -mbranch-predict
22951 -mno-branch-predict
22952 Use (do not use) the probable-branch instructions, when static
22953 branch prediction indicates a probable branch.
22954
22955 -mbase-addresses
22956 -mno-base-addresses
22957 Generate (do not generate) code that uses base addresses. Using a
22958 base address automatically generates a request (handled by the
22959 assembler and the linker) for a constant to be set up in a global
22960 register. The register is used for one or more base address
22961 requests within the range 0 to 255 from the value held in the
22962 register. The generally leads to short and fast code, but the
22963 number of different data items that can be addressed is limited.
22964 This means that a program that uses lots of static data may require
22965 -mno-base-addresses.
22966
22967 -msingle-exit
22968 -mno-single-exit
22969 Force (do not force) generated code to have a single exit point in
22970 each function.
22971
22972 MN10300 Options
22973 These -m options are defined for Matsushita MN10300 architectures:
22974
22975 -mmult-bug
22976 Generate code to avoid bugs in the multiply instructions for the
22977 MN10300 processors. This is the default.
22978
22979 -mno-mult-bug
22980 Do not generate code to avoid bugs in the multiply instructions for
22981 the MN10300 processors.
22982
22983 -mam33
22984 Generate code using features specific to the AM33 processor.
22985
22986 -mno-am33
22987 Do not generate code using features specific to the AM33 processor.
22988 This is the default.
22989
22990 -mam33-2
22991 Generate code using features specific to the AM33/2.0 processor.
22992
22993 -mam34
22994 Generate code using features specific to the AM34 processor.
22995
22996 -mtune=cpu-type
22997 Use the timing characteristics of the indicated CPU type when
22998 scheduling instructions. This does not change the targeted
22999 processor type. The CPU type must be one of mn10300, am33, am33-2
23000 or am34.
23001
23002 -mreturn-pointer-on-d0
23003 When generating a function that returns a pointer, return the
23004 pointer in both "a0" and "d0". Otherwise, the pointer is returned
23005 only in "a0", and attempts to call such functions without a
23006 prototype result in errors. Note that this option is on by
23007 default; use -mno-return-pointer-on-d0 to disable it.
23008
23009 -mno-crt0
23010 Do not link in the C run-time initialization object file.
23011
23012 -mrelax
23013 Indicate to the linker that it should perform a relaxation
23014 optimization pass to shorten branches, calls and absolute memory
23015 addresses. This option only has an effect when used on the command
23016 line for the final link step.
23017
23018 This option makes symbolic debugging impossible.
23019
23020 -mliw
23021 Allow the compiler to generate Long Instruction Word instructions
23022 if the target is the AM33 or later. This is the default. This
23023 option defines the preprocessor macro "__LIW__".
23024
23025 -mno-liw
23026 Do not allow the compiler to generate Long Instruction Word
23027 instructions. This option defines the preprocessor macro
23028 "__NO_LIW__".
23029
23030 -msetlb
23031 Allow the compiler to generate the SETLB and Lcc instructions if
23032 the target is the AM33 or later. This is the default. This option
23033 defines the preprocessor macro "__SETLB__".
23034
23035 -mno-setlb
23036 Do not allow the compiler to generate SETLB or Lcc instructions.
23037 This option defines the preprocessor macro "__NO_SETLB__".
23038
23039 Moxie Options
23040 -meb
23041 Generate big-endian code. This is the default for moxie-*-*
23042 configurations.
23043
23044 -mel
23045 Generate little-endian code.
23046
23047 -mmul.x
23048 Generate mul.x and umul.x instructions. This is the default for
23049 moxiebox-*-* configurations.
23050
23051 -mno-crt0
23052 Do not link in the C run-time initialization object file.
23053
23054 MSP430 Options
23055 These options are defined for the MSP430:
23056
23057 -masm-hex
23058 Force assembly output to always use hex constants. Normally such
23059 constants are signed decimals, but this option is available for
23060 testsuite and/or aesthetic purposes.
23061
23062 -mmcu=
23063 Select the MCU to target. This is used to create a C preprocessor
23064 symbol based upon the MCU name, converted to upper case and pre-
23065 and post-fixed with __. This in turn is used by the msp430.h
23066 header file to select an MCU-specific supplementary header file.
23067
23068 The option also sets the ISA to use. If the MCU name is one that
23069 is known to only support the 430 ISA then that is selected,
23070 otherwise the 430X ISA is selected. A generic MCU name of msp430
23071 can also be used to select the 430 ISA. Similarly the generic
23072 msp430x MCU name selects the 430X ISA.
23073
23074 In addition an MCU-specific linker script is added to the linker
23075 command line. The script's name is the name of the MCU with .ld
23076 appended. Thus specifying -mmcu=xxx on the gcc command line
23077 defines the C preprocessor symbol "__XXX__" and cause the linker to
23078 search for a script called xxx.ld.
23079
23080 The ISA and hardware multiply supported for the different MCUs is
23081 hard-coded into GCC. However, an external devices.csv file can be
23082 used to extend device support beyond those that have been hard-
23083 coded.
23084
23085 GCC searches for the devices.csv file using the following methods
23086 in the given precedence order, where the first method takes
23087 precendence over the second which takes precedence over the third.
23088
23089 Include path specified with "-I" and "-L"
23090 devices.csv will be searched for in each of the directories
23091 specified by include paths and linker library search paths.
23092
23093 Path specified by the environment variable MSP430_GCC_INCLUDE_DIR
23094 Define the value of the global environment variable
23095 MSP430_GCC_INCLUDE_DIR to the full path to the directory
23096 containing devices.csv, and GCC will search this directory for
23097 devices.csv. If devices.csv is found, this directory will also
23098 be registered as an include path, and linker library path.
23099 Header files and linker scripts in this directory can therefore
23100 be used without manually specifying "-I" and "-L" on the
23101 command line.
23102
23103 The msp430-elf{,bare}/include/devices directory
23104 Finally, GCC will examine msp430-elf{,bare}/include/devices
23105 from the toolchain root directory. This directory does not
23106 exist in a default installation, but if the user has created it
23107 and copied devices.csv there, then the MCU data will be read.
23108 As above, this directory will also be registered as an include
23109 path, and linker library path.
23110
23111 If none of the above search methods find devices.csv, then the
23112 hard-coded MCU data is used.
23113
23114 -mwarn-mcu
23115 -mno-warn-mcu
23116 This option enables or disables warnings about conflicts between
23117 the MCU name specified by the -mmcu option and the ISA set by the
23118 -mcpu option and/or the hardware multiply support set by the
23119 -mhwmult option. It also toggles warnings about unrecognized MCU
23120 names. This option is on by default.
23121
23122 -mcpu=
23123 Specifies the ISA to use. Accepted values are msp430, msp430x and
23124 msp430xv2. This option is deprecated. The -mmcu= option should be
23125 used to select the ISA.
23126
23127 -msim
23128 Link to the simulator runtime libraries and linker script.
23129 Overrides any scripts that would be selected by the -mmcu= option.
23130
23131 -mlarge
23132 Use large-model addressing (20-bit pointers, 20-bit "size_t").
23133
23134 -msmall
23135 Use small-model addressing (16-bit pointers, 16-bit "size_t").
23136
23137 -mrelax
23138 This option is passed to the assembler and linker, and allows the
23139 linker to perform certain optimizations that cannot be done until
23140 the final link.
23141
23142 mhwmult=
23143 Describes the type of hardware multiply supported by the target.
23144 Accepted values are none for no hardware multiply, 16bit for the
23145 original 16-bit-only multiply supported by early MCUs. 32bit for
23146 the 16/32-bit multiply supported by later MCUs and f5series for the
23147 16/32-bit multiply supported by F5-series MCUs. A value of auto
23148 can also be given. This tells GCC to deduce the hardware multiply
23149 support based upon the MCU name provided by the -mmcu option. If
23150 no -mmcu option is specified or if the MCU name is not recognized
23151 then no hardware multiply support is assumed. "auto" is the
23152 default setting.
23153
23154 Hardware multiplies are normally performed by calling a library
23155 routine. This saves space in the generated code. When compiling
23156 at -O3 or higher however the hardware multiplier is invoked inline.
23157 This makes for bigger, but faster code.
23158
23159 The hardware multiply routines disable interrupts whilst running
23160 and restore the previous interrupt state when they finish. This
23161 makes them safe to use inside interrupt handlers as well as in
23162 normal code.
23163
23164 -minrt
23165 Enable the use of a minimum runtime environment - no static
23166 initializers or constructors. This is intended for memory-
23167 constrained devices. The compiler includes special symbols in some
23168 objects that tell the linker and runtime which code fragments are
23169 required.
23170
23171 -mtiny-printf
23172 Enable reduced code size "printf" and "puts" library functions.
23173 The tiny implementations of these functions are not reentrant, so
23174 must be used with caution in multi-threaded applications.
23175
23176 Support for streams has been removed and the string to be printed
23177 will always be sent to stdout via the "write" syscall. The string
23178 is not buffered before it is sent to write.
23179
23180 This option requires Newlib Nano IO, so GCC must be configured with
23181 --enable-newlib-nano-formatted-io.
23182
23183 -mmax-inline-shift=
23184 This option takes an integer between 0 and 64 inclusive, and sets
23185 the maximum number of inline shift instructions which should be
23186 emitted to perform a shift operation by a constant amount. When
23187 this value needs to be exceeded, an mspabi helper function is used
23188 instead. The default value is 4.
23189
23190 This only affects cases where a shift by multiple positions cannot
23191 be completed with a single instruction (e.g. all shifts >1 on the
23192 430 ISA).
23193
23194 Shifts of a 32-bit value are at least twice as costly, so the value
23195 passed for this option is divided by 2 and the resulting value used
23196 instead.
23197
23198 -mcode-region=
23199 -mdata-region=
23200 These options tell the compiler where to place functions and data
23201 that do not have one of the "lower", "upper", "either" or "section"
23202 attributes. Possible values are "lower", "upper", "either" or
23203 "any". The first three behave like the corresponding attribute.
23204 The fourth possible value - "any" - is the default. It leaves
23205 placement entirely up to the linker script and how it assigns the
23206 standard sections (".text", ".data", etc) to the memory regions.
23207
23208 -msilicon-errata=
23209 This option passes on a request to assembler to enable the fixes
23210 for the named silicon errata.
23211
23212 -msilicon-errata-warn=
23213 This option passes on a request to the assembler to enable warning
23214 messages when a silicon errata might need to be applied.
23215
23216 -mwarn-devices-csv
23217 -mno-warn-devices-csv
23218 Warn if devices.csv is not found or there are problem parsing it
23219 (default: on).
23220
23221 NDS32 Options
23222 These options are defined for NDS32 implementations:
23223
23224 -mbig-endian
23225 Generate code in big-endian mode.
23226
23227 -mlittle-endian
23228 Generate code in little-endian mode.
23229
23230 -mreduced-regs
23231 Use reduced-set registers for register allocation.
23232
23233 -mfull-regs
23234 Use full-set registers for register allocation.
23235
23236 -mcmov
23237 Generate conditional move instructions.
23238
23239 -mno-cmov
23240 Do not generate conditional move instructions.
23241
23242 -mext-perf
23243 Generate performance extension instructions.
23244
23245 -mno-ext-perf
23246 Do not generate performance extension instructions.
23247
23248 -mext-perf2
23249 Generate performance extension 2 instructions.
23250
23251 -mno-ext-perf2
23252 Do not generate performance extension 2 instructions.
23253
23254 -mext-string
23255 Generate string extension instructions.
23256
23257 -mno-ext-string
23258 Do not generate string extension instructions.
23259
23260 -mv3push
23261 Generate v3 push25/pop25 instructions.
23262
23263 -mno-v3push
23264 Do not generate v3 push25/pop25 instructions.
23265
23266 -m16-bit
23267 Generate 16-bit instructions.
23268
23269 -mno-16-bit
23270 Do not generate 16-bit instructions.
23271
23272 -misr-vector-size=num
23273 Specify the size of each interrupt vector, which must be 4 or 16.
23274
23275 -mcache-block-size=num
23276 Specify the size of each cache block, which must be a power of 2
23277 between 4 and 512.
23278
23279 -march=arch
23280 Specify the name of the target architecture.
23281
23282 -mcmodel=code-model
23283 Set the code model to one of
23284
23285 small
23286 All the data and read-only data segments must be within 512KB
23287 addressing space. The text segment must be within 16MB
23288 addressing space.
23289
23290 medium
23291 The data segment must be within 512KB while the read-only data
23292 segment can be within 4GB addressing space. The text segment
23293 should be still within 16MB addressing space.
23294
23295 large
23296 All the text and data segments can be within 4GB addressing
23297 space.
23298
23299 -mctor-dtor
23300 Enable constructor/destructor feature.
23301
23302 -mrelax
23303 Guide linker to relax instructions.
23304
23305 Nios II Options
23306 These are the options defined for the Altera Nios II processor.
23307
23308 -G num
23309 Put global and static objects less than or equal to num bytes into
23310 the small data or BSS sections instead of the normal data or BSS
23311 sections. The default value of num is 8.
23312
23313 -mgpopt=option
23314 -mgpopt
23315 -mno-gpopt
23316 Generate (do not generate) GP-relative accesses. The following
23317 option names are recognized:
23318
23319 none
23320 Do not generate GP-relative accesses.
23321
23322 local
23323 Generate GP-relative accesses for small data objects that are
23324 not external, weak, or uninitialized common symbols. Also use
23325 GP-relative addressing for objects that have been explicitly
23326 placed in a small data section via a "section" attribute.
23327
23328 global
23329 As for local, but also generate GP-relative accesses for small
23330 data objects that are external, weak, or common. If you use
23331 this option, you must ensure that all parts of your program
23332 (including libraries) are compiled with the same -G setting.
23333
23334 data
23335 Generate GP-relative accesses for all data objects in the
23336 program. If you use this option, the entire data and BSS
23337 segments of your program must fit in 64K of memory and you must
23338 use an appropriate linker script to allocate them within the
23339 addressable range of the global pointer.
23340
23341 all Generate GP-relative addresses for function pointers as well as
23342 data pointers. If you use this option, the entire text, data,
23343 and BSS segments of your program must fit in 64K of memory and
23344 you must use an appropriate linker script to allocate them
23345 within the addressable range of the global pointer.
23346
23347 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
23348 equivalent to -mgpopt=none.
23349
23350 The default is -mgpopt except when -fpic or -fPIC is specified to
23351 generate position-independent code. Note that the Nios II ABI does
23352 not permit GP-relative accesses from shared libraries.
23353
23354 You may need to specify -mno-gpopt explicitly when building
23355 programs that include large amounts of small data, including large
23356 GOT data sections. In this case, the 16-bit offset for GP-relative
23357 addressing may not be large enough to allow access to the entire
23358 small data section.
23359
23360 -mgprel-sec=regexp
23361 This option specifies additional section names that can be accessed
23362 via GP-relative addressing. It is most useful in conjunction with
23363 "section" attributes on variable declarations and a custom linker
23364 script. The regexp is a POSIX Extended Regular Expression.
23365
23366 This option does not affect the behavior of the -G option, and the
23367 specified sections are in addition to the standard ".sdata" and
23368 ".sbss" small-data sections that are recognized by -mgpopt.
23369
23370 -mr0rel-sec=regexp
23371 This option specifies names of sections that can be accessed via a
23372 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
23373 32-bit address space. It is most useful in conjunction with
23374 "section" attributes on variable declarations and a custom linker
23375 script. The regexp is a POSIX Extended Regular Expression.
23376
23377 In contrast to the use of GP-relative addressing for small data,
23378 zero-based addressing is never generated by default and there are
23379 no conventional section names used in standard linker scripts for
23380 sections in the low or high areas of memory.
23381
23382 -mel
23383 -meb
23384 Generate little-endian (default) or big-endian (experimental) code,
23385 respectively.
23386
23387 -march=arch
23388 This specifies the name of the target Nios II architecture. GCC
23389 uses this name to determine what kind of instructions it can emit
23390 when generating assembly code. Permissible names are: r1, r2.
23391
23392 The preprocessor macro "__nios2_arch__" is available to programs,
23393 with value 1 or 2, indicating the targeted ISA level.
23394
23395 -mbypass-cache
23396 -mno-bypass-cache
23397 Force all load and store instructions to always bypass cache by
23398 using I/O variants of the instructions. The default is not to
23399 bypass the cache.
23400
23401 -mno-cache-volatile
23402 -mcache-volatile
23403 Volatile memory access bypass the cache using the I/O variants of
23404 the load and store instructions. The default is not to bypass the
23405 cache.
23406
23407 -mno-fast-sw-div
23408 -mfast-sw-div
23409 Do not use table-based fast divide for small numbers. The default
23410 is to use the fast divide at -O3 and above.
23411
23412 -mno-hw-mul
23413 -mhw-mul
23414 -mno-hw-mulx
23415 -mhw-mulx
23416 -mno-hw-div
23417 -mhw-div
23418 Enable or disable emitting "mul", "mulx" and "div" family of
23419 instructions by the compiler. The default is to emit "mul" and not
23420 emit "div" and "mulx".
23421
23422 -mbmx
23423 -mno-bmx
23424 -mcdx
23425 -mno-cdx
23426 Enable or disable generation of Nios II R2 BMX (bit manipulation)
23427 and CDX (code density) instructions. Enabling these instructions
23428 also requires -march=r2. Since these instructions are optional
23429 extensions to the R2 architecture, the default is not to emit them.
23430
23431 -mcustom-insn=N
23432 -mno-custom-insn
23433 Each -mcustom-insn=N option enables use of a custom instruction
23434 with encoding N when generating code that uses insn. For example,
23435 -mcustom-fadds=253 generates custom instruction 253 for single-
23436 precision floating-point add operations instead of the default
23437 behavior of using a library call.
23438
23439 The following values of insn are supported. Except as otherwise
23440 noted, floating-point operations are expected to be implemented
23441 with normal IEEE 754 semantics and correspond directly to the C
23442 operators or the equivalent GCC built-in functions.
23443
23444 Single-precision floating point:
23445
23446 fadds, fsubs, fdivs, fmuls
23447 Binary arithmetic operations.
23448
23449 fnegs
23450 Unary negation.
23451
23452 fabss
23453 Unary absolute value.
23454
23455 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
23456 Comparison operations.
23457
23458 fmins, fmaxs
23459 Floating-point minimum and maximum. These instructions are
23460 only generated if -ffinite-math-only is specified.
23461
23462 fsqrts
23463 Unary square root operation.
23464
23465 fcoss, fsins, ftans, fatans, fexps, flogs
23466 Floating-point trigonometric and exponential functions. These
23467 instructions are only generated if -funsafe-math-optimizations
23468 is also specified.
23469
23470 Double-precision floating point:
23471
23472 faddd, fsubd, fdivd, fmuld
23473 Binary arithmetic operations.
23474
23475 fnegd
23476 Unary negation.
23477
23478 fabsd
23479 Unary absolute value.
23480
23481 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
23482 Comparison operations.
23483
23484 fmind, fmaxd
23485 Double-precision minimum and maximum. These instructions are
23486 only generated if -ffinite-math-only is specified.
23487
23488 fsqrtd
23489 Unary square root operation.
23490
23491 fcosd, fsind, ftand, fatand, fexpd, flogd
23492 Double-precision trigonometric and exponential functions.
23493 These instructions are only generated if
23494 -funsafe-math-optimizations is also specified.
23495
23496 Conversions:
23497
23498 fextsd
23499 Conversion from single precision to double precision.
23500
23501 ftruncds
23502 Conversion from double precision to single precision.
23503
23504 fixsi, fixsu, fixdi, fixdu
23505 Conversion from floating point to signed or unsigned integer
23506 types, with truncation towards zero.
23507
23508 round
23509 Conversion from single-precision floating point to signed
23510 integer, rounding to the nearest integer and ties away from
23511 zero. This corresponds to the "__builtin_lroundf" function
23512 when -fno-math-errno is used.
23513
23514 floatis, floatus, floatid, floatud
23515 Conversion from signed or unsigned integer types to floating-
23516 point types.
23517
23518 In addition, all of the following transfer instructions for
23519 internal registers X and Y must be provided to use any of the
23520 double-precision floating-point instructions. Custom instructions
23521 taking two double-precision source operands expect the first
23522 operand in the 64-bit register X. The other operand (or only
23523 operand of a unary operation) is given to the custom arithmetic
23524 instruction with the least significant half in source register src1
23525 and the most significant half in src2. A custom instruction that
23526 returns a double-precision result returns the most significant 32
23527 bits in the destination register and the other half in 32-bit
23528 register Y. GCC automatically generates the necessary code
23529 sequences to write register X and/or read register Y when double-
23530 precision floating-point instructions are used.
23531
23532 fwrx
23533 Write src1 into the least significant half of X and src2 into
23534 the most significant half of X.
23535
23536 fwry
23537 Write src1 into Y.
23538
23539 frdxhi, frdxlo
23540 Read the most or least (respectively) significant half of X and
23541 store it in dest.
23542
23543 frdy
23544 Read the value of Y and store it into dest.
23545
23546 Note that you can gain more local control over generation of Nios
23547 II custom instructions by using the "target("custom-insn=N")" and
23548 "target("no-custom-insn")" function attributes or pragmas.
23549
23550 -mcustom-fpu-cfg=name
23551 This option enables a predefined, named set of custom instruction
23552 encodings (see -mcustom-insn above). Currently, the following sets
23553 are defined:
23554
23555 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
23556 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
23557
23558 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
23559 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
23560 -fsingle-precision-constant
23561
23562 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
23563 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
23564 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
23565 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
23566 -mcustom-fdivs=255 -fsingle-precision-constant
23567
23568 -mcustom-fpu-cfg=fph2 is equivalent to: -mcustom-fabss=224
23569 -mcustom-fnegs=225 -mcustom-fcmpnes=226 -mcustom-fcmpeqs=227
23570 -mcustom-fcmpges=228 -mcustom-fcmpgts=229 -mcustom-fcmples=230
23571 -mcustom-fcmplts=231 -mcustom-fmaxs=232 -mcustom-fmins=233
23572 -mcustom-round=248 -mcustom-fixsi=249 -mcustom-floatis=250
23573 -mcustom-fsqrts=251 -mcustom-fmuls=252 -mcustom-fadds=253
23574 -mcustom-fsubs=254 -mcustom-fdivs=255
23575
23576 Custom instruction assignments given by individual -mcustom-insn=
23577 options override those given by -mcustom-fpu-cfg=, regardless of
23578 the order of the options on the command line.
23579
23580 Note that you can gain more local control over selection of a FPU
23581 configuration by using the "target("custom-fpu-cfg=name")" function
23582 attribute or pragma.
23583
23584 The name fph2 is an abbreviation for Nios II Floating Point
23585 Hardware 2 Component. Please note that the custom instructions
23586 enabled by -mcustom-fmins=233 and -mcustom-fmaxs=234 are only
23587 generated if -ffinite-math-only is specified. The custom
23588 instruction enabled by -mcustom-round=248 is only generated if
23589 -fno-math-errno is specified. In contrast to the other
23590 configurations, -fsingle-precision-constant is not set.
23591
23592 These additional -m options are available for the Altera Nios II ELF
23593 (bare-metal) target:
23594
23595 -mhal
23596 Link with HAL BSP. This suppresses linking with the GCC-provided C
23597 runtime startup and termination code, and is typically used in
23598 conjunction with -msys-crt0= to specify the location of the
23599 alternate startup code provided by the HAL BSP.
23600
23601 -msmallc
23602 Link with a limited version of the C library, -lsmallc, rather than
23603 Newlib.
23604
23605 -msys-crt0=startfile
23606 startfile is the file name of the startfile (crt0) to use when
23607 linking. This option is only useful in conjunction with -mhal.
23608
23609 -msys-lib=systemlib
23610 systemlib is the library name of the library that provides low-
23611 level system calls required by the C library, e.g. "read" and
23612 "write". This option is typically used to link with a library
23613 provided by a HAL BSP.
23614
23615 Nvidia PTX Options
23616 These options are defined for Nvidia PTX:
23617
23618 -m64
23619 Ignored, but preserved for backward compatibility. Only 64-bit ABI
23620 is supported.
23621
23622 -march=architecture-string
23623 Generate code for the specified PTX ISA target architecture (e.g.
23624 sm_35). Valid architecture strings are sm_30, sm_35, sm_53, sm_70,
23625 sm_75 and sm_80. The default target architecture is sm_30.
23626
23627 This option sets the value of the preprocessor macro "__PTX_SM__";
23628 for instance, for sm_35, it has the value 350.
23629
23630 -misa=architecture-string
23631 Alias of -march=.
23632
23633 -march-map=architecture-string
23634 Select the closest available -march= value that is not more
23635 capable. For instance, for -march-map=sm_50 select -march=sm_35,
23636 and for -march-map=sm_53 select -march=sm_53.
23637
23638 -mptx=version-string
23639 Generate code for the specified PTX ISA version (e.g. 7.0). Valid
23640 version strings include 3.1, 6.0, 6.3, and 7.0. The default PTX
23641 ISA version is 6.0, unless a higher version is required for
23642 specified PTX ISA target architecture via option -march=.
23643
23644 This option sets the values of the preprocessor macros
23645 "__PTX_ISA_VERSION_MAJOR__" and "__PTX_ISA_VERSION_MINOR__"; for
23646 instance, for 3.1 the macros have the values 3 and 1, respectively.
23647
23648 -mmainkernel
23649 Link in code for a __main kernel. This is for stand-alone instead
23650 of offloading execution.
23651
23652 -moptimize
23653 Apply partitioned execution optimizations. This is the default
23654 when any level of optimization is selected.
23655
23656 -msoft-stack
23657 Generate code that does not use ".local" memory directly for stack
23658 storage. Instead, a per-warp stack pointer is maintained
23659 explicitly. This enables variable-length stack allocation (with
23660 variable-length arrays or "alloca"), and when global memory is used
23661 for underlying storage, makes it possible to access automatic
23662 variables from other threads, or with atomic instructions. This
23663 code generation variant is used for OpenMP offloading, but the
23664 option is exposed on its own for the purpose of testing the
23665 compiler; to generate code suitable for linking into programs using
23666 OpenMP offloading, use option -mgomp.
23667
23668 -muniform-simt
23669 Switch to code generation variant that allows to execute all
23670 threads in each warp, while maintaining memory state and side
23671 effects as if only one thread in each warp was active outside of
23672 OpenMP SIMD regions. All atomic operations and calls to runtime
23673 (malloc, free, vprintf) are conditionally executed (iff current
23674 lane index equals the master lane index), and the register being
23675 assigned is copied via a shuffle instruction from the master lane.
23676 Outside of SIMD regions lane 0 is the master; inside, each thread
23677 sees itself as the master. Shared memory array "int __nvptx_uni[]"
23678 stores all-zeros or all-ones bitmasks for each warp, indicating
23679 current mode (0 outside of SIMD regions). Each thread can bitwise-
23680 and the bitmask at position "tid.y" with current lane index to
23681 compute the master lane index.
23682
23683 -mgomp
23684 Generate code for use in OpenMP offloading: enables -msoft-stack
23685 and -muniform-simt options, and selects corresponding multilib
23686 variant.
23687
23688 OpenRISC Options
23689 These options are defined for OpenRISC:
23690
23691 -mboard=name
23692 Configure a board specific runtime. This will be passed to the
23693 linker for newlib board library linking. The default is "or1ksim".
23694
23695 -mnewlib
23696 This option is ignored; it is for compatibility purposes only.
23697 This used to select linker and preprocessor options for use with
23698 newlib.
23699
23700 -msoft-div
23701 -mhard-div
23702 Select software or hardware divide ("l.div", "l.divu")
23703 instructions. This default is hardware divide.
23704
23705 -msoft-mul
23706 -mhard-mul
23707 Select software or hardware multiply ("l.mul", "l.muli")
23708 instructions. This default is hardware multiply.
23709
23710 -msoft-float
23711 -mhard-float
23712 Select software or hardware for floating point operations. The
23713 default is software.
23714
23715 -mdouble-float
23716 When -mhard-float is selected, enables generation of double-
23717 precision floating point instructions. By default functions from
23718 libgcc are used to perform double-precision floating point
23719 operations.
23720
23721 -munordered-float
23722 When -mhard-float is selected, enables generation of unordered
23723 floating point compare and set flag ("lf.sfun*") instructions. By
23724 default functions from libgcc are used to perform unordered
23725 floating point compare and set flag operations.
23726
23727 -mcmov
23728 Enable generation of conditional move ("l.cmov") instructions. By
23729 default the equivalent will be generated using set and branch.
23730
23731 -mror
23732 Enable generation of rotate right ("l.ror") instructions. By
23733 default functions from libgcc are used to perform rotate right
23734 operations.
23735
23736 -mrori
23737 Enable generation of rotate right with immediate ("l.rori")
23738 instructions. By default functions from libgcc are used to perform
23739 rotate right with immediate operations.
23740
23741 -msext
23742 Enable generation of sign extension ("l.ext*") instructions. By
23743 default memory loads are used to perform sign extension.
23744
23745 -msfimm
23746 Enable generation of compare and set flag with immediate ("l.sf*i")
23747 instructions. By default extra instructions will be generated to
23748 store the immediate to a register first.
23749
23750 -mshftimm
23751 Enable generation of shift with immediate ("l.srai", "l.srli",
23752 "l.slli") instructions. By default extra instructions will be
23753 generated to store the immediate to a register first.
23754
23755 -mcmodel=small
23756 Generate OpenRISC code for the small model: The GOT is limited to
23757 64k. This is the default model.
23758
23759 -mcmodel=large
23760 Generate OpenRISC code for the large model: The GOT may grow up to
23761 4G in size.
23762
23763 PDP-11 Options
23764 These options are defined for the PDP-11:
23765
23766 -mfpu
23767 Use hardware FPP floating point. This is the default. (FIS
23768 floating point on the PDP-11/40 is not supported.) Implies -m45.
23769
23770 -msoft-float
23771 Do not use hardware floating point.
23772
23773 -mac0
23774 Return floating-point results in ac0 (fr0 in Unix assembler
23775 syntax).
23776
23777 -mno-ac0
23778 Return floating-point results in memory. This is the default.
23779
23780 -m40
23781 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23782
23783 -m45
23784 Generate code for a PDP-11/45. This is the default.
23785
23786 -m10
23787 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23788
23789 -mint16
23790 -mno-int32
23791 Use 16-bit "int". This is the default.
23792
23793 -mint32
23794 -mno-int16
23795 Use 32-bit "int".
23796
23797 -msplit
23798 Target has split instruction and data space. Implies -m45.
23799
23800 -munix-asm
23801 Use Unix assembler syntax.
23802
23803 -mdec-asm
23804 Use DEC assembler syntax.
23805
23806 -mgnu-asm
23807 Use GNU assembler syntax. This is the default.
23808
23809 -mlra
23810 Use the new LRA register allocator. By default, the old "reload"
23811 allocator is used.
23812
23813 picoChip Options
23814 These -m options are defined for picoChip implementations:
23815
23816 -mae=ae_type
23817 Set the instruction set, register set, and instruction scheduling
23818 parameters for array element type ae_type. Supported values for
23819 ae_type are ANY, MUL, and MAC.
23820
23821 -mae=ANY selects a completely generic AE type. Code generated with
23822 this option runs on any of the other AE types. The code is not as
23823 efficient as it would be if compiled for a specific AE type, and
23824 some types of operation (e.g., multiplication) do not work properly
23825 on all types of AE.
23826
23827 -mae=MUL selects a MUL AE type. This is the most useful AE type
23828 for compiled code, and is the default.
23829
23830 -mae=MAC selects a DSP-style MAC AE. Code compiled with this
23831 option may suffer from poor performance of byte (char)
23832 manipulation, since the DSP AE does not provide hardware support
23833 for byte load/stores.
23834
23835 -msymbol-as-address
23836 Enable the compiler to directly use a symbol name as an address in
23837 a load/store instruction, without first loading it into a register.
23838 Typically, the use of this option generates larger programs, which
23839 run faster than when the option isn't used. However, the results
23840 vary from program to program, so it is left as a user option,
23841 rather than being permanently enabled.
23842
23843 -mno-inefficient-warnings
23844 Disables warnings about the generation of inefficient code. These
23845 warnings can be generated, for example, when compiling code that
23846 performs byte-level memory operations on the MAC AE type. The MAC
23847 AE has no hardware support for byte-level memory operations, so all
23848 byte load/stores must be synthesized from word load/store
23849 operations. This is inefficient and a warning is generated to
23850 indicate that you should rewrite the code to avoid byte operations,
23851 or to target an AE type that has the necessary hardware support.
23852 This option disables these warnings.
23853
23854 PowerPC Options
23855 These are listed under
23856
23857 PRU Options
23858 These command-line options are defined for PRU target:
23859
23860 -minrt
23861 Link with a minimum runtime environment, with no support for static
23862 initializers and constructors. Using this option can significantly
23863 reduce the size of the final ELF binary. Beware that the compiler
23864 could still generate code with static initializers and
23865 constructors. It is up to the programmer to ensure that the source
23866 program will not use those features.
23867
23868 -mmcu=mcu
23869 Specify the PRU MCU variant to use. Check Newlib for the exact
23870 list of supported MCUs.
23871
23872 -mno-relax
23873 Make GCC pass the --no-relax command-line option to the linker
23874 instead of the --relax option.
23875
23876 -mloop
23877 Allow (or do not allow) GCC to use the LOOP instruction.
23878
23879 -mabi=variant
23880 Specify the ABI variant to output code for. -mabi=ti selects the
23881 unmodified TI ABI while -mabi=gnu selects a GNU variant that copes
23882 more naturally with certain GCC assumptions. These are the
23883 differences:
23884
23885 Function Pointer Size
23886 TI ABI specifies that function (code) pointers are 16-bit,
23887 whereas GNU supports only 32-bit data and code pointers.
23888
23889 Optional Return Value Pointer
23890 Function return values larger than 64 bits are passed by using
23891 a hidden pointer as the first argument of the function. TI
23892 ABI, though, mandates that the pointer can be NULL in case the
23893 caller is not using the returned value. GNU always passes and
23894 expects a valid return value pointer.
23895
23896 The current -mabi=ti implementation simply raises a compile error
23897 when any of the above code constructs is detected. As a
23898 consequence the standard C library cannot be built and it is
23899 omitted when linking with -mabi=ti.
23900
23901 Relaxation is a GNU feature and for safety reasons is disabled when
23902 using -mabi=ti. The TI toolchain does not emit relocations for
23903 QBBx instructions, so the GNU linker cannot adjust them when
23904 shortening adjacent LDI32 pseudo instructions.
23905
23906 RISC-V Options
23907 These command-line options are defined for RISC-V targets:
23908
23909 -mbranch-cost=n
23910 Set the cost of branches to roughly n instructions.
23911
23912 -mplt
23913 -mno-plt
23914 When generating PIC code, do or don't allow the use of PLTs.
23915 Ignored for non-PIC. The default is -mplt.
23916
23917 -mabi=ABI-string
23918 Specify integer and floating-point calling convention. ABI-string
23919 contains two parts: the size of integer types and the registers
23920 used for floating-point types. For example -march=rv64ifd
23921 -mabi=lp64d means that long and pointers are 64-bit (implicitly
23922 defining int to be 32-bit), and that floating-point values up to 64
23923 bits wide are passed in F registers. Contrast this with
23924 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
23925 generate code that uses the F and D extensions but only allows
23926 floating-point values up to 32 bits long to be passed in registers;
23927 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
23928 will be passed in registers.
23929
23930 The default for this argument is system dependent, users who want a
23931 specific calling convention should specify one explicitly. The
23932 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
23933 and lp64d. Some calling conventions are impossible to implement on
23934 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
23935 because the ABI requires 64-bit values be passed in F registers,
23936 but F registers are only 32 bits wide. There is also the ilp32e
23937 ABI that can only be used with the rv32e architecture. This ABI is
23938 not well specified at present, and is subject to change.
23939
23940 -mfdiv
23941 -mno-fdiv
23942 Do or don't use hardware floating-point divide and square root
23943 instructions. This requires the F or D extensions for floating-
23944 point registers. The default is to use them if the specified
23945 architecture has these instructions.
23946
23947 -mdiv
23948 -mno-div
23949 Do or don't use hardware instructions for integer division. This
23950 requires the M extension. The default is to use them if the
23951 specified architecture has these instructions.
23952
23953 -misa-spec=ISA-spec-string
23954 Specify the version of the RISC-V Unprivileged (formerly User-
23955 Level) ISA specification to produce code conforming to. The
23956 possibilities for ISA-spec-string are:
23957
23958 2.2 Produce code conforming to version 2.2.
23959
23960 20190608
23961 Produce code conforming to version 20190608.
23962
23963 20191213
23964 Produce code conforming to version 20191213.
23965
23966 The default is -misa-spec=20191213 unless GCC has been configured
23967 with --with-isa-spec= specifying a different default version.
23968
23969 -march=ISA-string
23970 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
23971 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
23972
23973 When -march= is not specified, use the setting from -mcpu.
23974
23975 If both -march and -mcpu= are not specified, the default for this
23976 argument is system dependent, users who want a specific
23977 architecture extensions should specify one explicitly.
23978
23979 -mcpu=processor-string
23980 Use architecture of and optimize the output for the given
23981 processor, specified by particular CPU name. Permissible values
23982 for this option are: sifive-e20, sifive-e21, sifive-e24,
23983 sifive-e31, sifive-e34, sifive-e76, sifive-s21, sifive-s51,
23984 sifive-s54, sifive-s76, sifive-u54, and sifive-u74.
23985
23986 -mtune=processor-string
23987 Optimize the output for the given processor, specified by
23988 microarchitecture or particular CPU name. Permissible values for
23989 this option are: rocket, sifive-3-series, sifive-5-series,
23990 sifive-7-series, size, and all valid options for -mcpu=.
23991
23992 When -mtune= is not specified, use the setting from -mcpu, the
23993 default is rocket if both are not specified.
23994
23995 The size choice is not intended for use by end-users. This is used
23996 when -Os is specified. It overrides the instruction cost info
23997 provided by -mtune=, but does not override the pipeline info. This
23998 helps reduce code size while still giving good performance.
23999
24000 -mpreferred-stack-boundary=num
24001 Attempt to keep the stack boundary aligned to a 2 raised to num
24002 byte boundary. If -mpreferred-stack-boundary is not specified, the
24003 default is 4 (16 bytes or 128-bits).
24004
24005 Warning: If you use this switch, then you must build all modules
24006 with the same value, including any libraries. This includes the
24007 system libraries and startup modules.
24008
24009 -msmall-data-limit=n
24010 Put global and static data smaller than n bytes into a special
24011 section (on some targets).
24012
24013 -msave-restore
24014 -mno-save-restore
24015 Do or don't use smaller but slower prologue and epilogue code that
24016 uses library function calls. The default is to use fast inline
24017 prologues and epilogues.
24018
24019 -mshorten-memrefs
24020 -mno-shorten-memrefs
24021 Do or do not attempt to make more use of compressed load/store
24022 instructions by replacing a load/store of 'base register + large
24023 offset' with a new load/store of 'new base + small offset'. If the
24024 new base gets stored in a compressed register, then the new
24025 load/store can be compressed. Currently targets 32-bit integer
24026 load/stores only.
24027
24028 -mstrict-align
24029 -mno-strict-align
24030 Do not or do generate unaligned memory accesses. The default is
24031 set depending on whether the processor we are optimizing for
24032 supports fast unaligned access or not.
24033
24034 -mcmodel=medlow
24035 Generate code for the medium-low code model. The program and its
24036 statically defined symbols must lie within a single 2 GiB address
24037 range and must lie between absolute addresses -2 GiB and +2 GiB.
24038 Programs can be statically or dynamically linked. This is the
24039 default code model.
24040
24041 -mcmodel=medany
24042 Generate code for the medium-any code model. The program and its
24043 statically defined symbols must be within any single 2 GiB address
24044 range. Programs can be statically or dynamically linked.
24045
24046 The code generated by the medium-any code model is position-
24047 independent, but is not guaranteed to function correctly when
24048 linked into position-independent executables or libraries.
24049
24050 -mexplicit-relocs
24051 -mno-exlicit-relocs
24052 Use or do not use assembler relocation operators when dealing with
24053 symbolic addresses. The alternative is to use assembler macros
24054 instead, which may limit optimization.
24055
24056 -mrelax
24057 -mno-relax
24058 Take advantage of linker relaxations to reduce the number of
24059 instructions required to materialize symbol addresses. The default
24060 is to take advantage of linker relaxations.
24061
24062 -memit-attribute
24063 -mno-emit-attribute
24064 Emit (do not emit) RISC-V attribute to record extra information
24065 into ELF objects. This feature requires at least binutils 2.32.
24066
24067 -malign-data=type
24068 Control how GCC aligns variables and constants of array, structure,
24069 or union types. Supported values for type are xlen which uses x
24070 register width as the alignment value, and natural which uses
24071 natural alignment. xlen is the default.
24072
24073 -mbig-endian
24074 Generate big-endian code. This is the default when GCC is
24075 configured for a riscv64be-*-* or riscv32be-*-* target.
24076
24077 -mlittle-endian
24078 Generate little-endian code. This is the default when GCC is
24079 configured for a riscv64-*-* or riscv32-*-* but not a riscv64be-*-*
24080 or riscv32be-*-* target.
24081
24082 -mstack-protector-guard=guard
24083 -mstack-protector-guard-reg=reg
24084 -mstack-protector-guard-offset=offset
24085 Generate stack protection code using canary at guard. Supported
24086 locations are global for a global canary or tls for per-thread
24087 canary in the TLS block.
24088
24089 With the latter choice the options -mstack-protector-guard-reg=reg
24090 and -mstack-protector-guard-offset=offset furthermore specify which
24091 register to use as base register for reading the canary, and from
24092 what offset from that base register. There is no default register
24093 or offset as this is entirely for use within the Linux kernel.
24094
24095 RL78 Options
24096 -msim
24097 Links in additional target libraries to support operation within a
24098 simulator.
24099
24100 -mmul=none
24101 -mmul=g10
24102 -mmul=g13
24103 -mmul=g14
24104 -mmul=rl78
24105 Specifies the type of hardware multiplication and division support
24106 to be used. The simplest is "none", which uses software for both
24107 multiplication and division. This is the default. The "g13" value
24108 is for the hardware multiply/divide peripheral found on the
24109 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
24110 multiplication and division instructions supported by the RL78/G14
24111 (S3 core) parts. The value "rl78" is an alias for "g14" and the
24112 value "mg10" is an alias for "none".
24113
24114 In addition a C preprocessor macro is defined, based upon the
24115 setting of this option. Possible values are: "__RL78_MUL_NONE__",
24116 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
24117
24118 -mcpu=g10
24119 -mcpu=g13
24120 -mcpu=g14
24121 -mcpu=rl78
24122 Specifies the RL78 core to target. The default is the G14 core,
24123 also known as an S3 core or just RL78. The G13 or S2 core does not
24124 have multiply or divide instructions, instead it uses a hardware
24125 peripheral for these operations. The G10 or S1 core does not have
24126 register banks, so it uses a different calling convention.
24127
24128 If this option is set it also selects the type of hardware multiply
24129 support to use, unless this is overridden by an explicit -mmul=none
24130 option on the command line. Thus specifying -mcpu=g13 enables the
24131 use of the G13 hardware multiply peripheral and specifying
24132 -mcpu=g10 disables the use of hardware multiplications altogether.
24133
24134 Note, although the RL78/G14 core is the default target, specifying
24135 -mcpu=g14 or -mcpu=rl78 on the command line does change the
24136 behavior of the toolchain since it also enables G14 hardware
24137 multiply support. If these options are not specified on the
24138 command line then software multiplication routines will be used
24139 even though the code targets the RL78 core. This is for backwards
24140 compatibility with older toolchains which did not have hardware
24141 multiply and divide support.
24142
24143 In addition a C preprocessor macro is defined, based upon the
24144 setting of this option. Possible values are: "__RL78_G10__",
24145 "__RL78_G13__" or "__RL78_G14__".
24146
24147 -mg10
24148 -mg13
24149 -mg14
24150 -mrl78
24151 These are aliases for the corresponding -mcpu= option. They are
24152 provided for backwards compatibility.
24153
24154 -mallregs
24155 Allow the compiler to use all of the available registers. By
24156 default registers "r24..r31" are reserved for use in interrupt
24157 handlers. With this option enabled these registers can be used in
24158 ordinary functions as well.
24159
24160 -m64bit-doubles
24161 -m32bit-doubles
24162 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
24163 (-m32bit-doubles) in size. The default is -m32bit-doubles.
24164
24165 -msave-mduc-in-interrupts
24166 -mno-save-mduc-in-interrupts
24167 Specifies that interrupt handler functions should preserve the MDUC
24168 registers. This is only necessary if normal code might use the
24169 MDUC registers, for example because it performs multiplication and
24170 division operations. The default is to ignore the MDUC registers
24171 as this makes the interrupt handlers faster. The target option
24172 -mg13 needs to be passed for this to work as this feature is only
24173 available on the G13 target (S2 core). The MDUC registers will
24174 only be saved if the interrupt handler performs a multiplication or
24175 division operation or it calls another function.
24176
24177 IBM RS/6000 and PowerPC Options
24178 These -m options are defined for the IBM RS/6000 and PowerPC:
24179
24180 -mpowerpc-gpopt
24181 -mno-powerpc-gpopt
24182 -mpowerpc-gfxopt
24183 -mno-powerpc-gfxopt
24184 -mpowerpc64
24185 -mno-powerpc64
24186 -mmfcrf
24187 -mno-mfcrf
24188 -mpopcntb
24189 -mno-popcntb
24190 -mpopcntd
24191 -mno-popcntd
24192 -mfprnd
24193 -mno-fprnd
24194 -mcmpb
24195 -mno-cmpb
24196 -mhard-dfp
24197 -mno-hard-dfp
24198 You use these options to specify which instructions are available
24199 on the processor you are using. The default value of these options
24200 is determined when configuring GCC. Specifying the -mcpu=cpu_type
24201 overrides the specification of these options. We recommend you use
24202 the -mcpu=cpu_type option rather than the options listed above.
24203
24204 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
24205 architecture instructions in the General Purpose group, including
24206 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
24207 to use the optional PowerPC architecture instructions in the
24208 Graphics group, including floating-point select.
24209
24210 The -mmfcrf option allows GCC to generate the move from condition
24211 register field instruction implemented on the POWER4 processor and
24212 other processors that support the PowerPC V2.01 architecture. The
24213 -mpopcntb option allows GCC to generate the popcount and double-
24214 precision FP reciprocal estimate instruction implemented on the
24215 POWER5 processor and other processors that support the PowerPC
24216 V2.02 architecture. The -mpopcntd option allows GCC to generate
24217 the popcount instruction implemented on the POWER7 processor and
24218 other processors that support the PowerPC V2.06 architecture. The
24219 -mfprnd option allows GCC to generate the FP round to integer
24220 instructions implemented on the POWER5+ processor and other
24221 processors that support the PowerPC V2.03 architecture. The -mcmpb
24222 option allows GCC to generate the compare bytes instruction
24223 implemented on the POWER6 processor and other processors that
24224 support the PowerPC V2.05 architecture. The -mhard-dfp option
24225 allows GCC to generate the decimal floating-point instructions
24226 implemented on some POWER processors.
24227
24228 The -mpowerpc64 option allows GCC to generate the additional 64-bit
24229 instructions that are found in the full PowerPC64 architecture and
24230 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24231 -mno-powerpc64.
24232
24233 -mcpu=cpu_type
24234 Set architecture type, register usage, and instruction scheduling
24235 parameters for machine type cpu_type. Supported values for
24236 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
24237 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
24238 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
24239 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
24240 power4, power5, power5+, power6, power6x, power7, power8, power9,
24241 power10, powerpc, powerpc64, powerpc64le, rs64, and native.
24242
24243 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
24244 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
24245 64-bit little endian PowerPC architecture machine types, with an
24246 appropriate, generic processor model assumed for scheduling
24247 purposes.
24248
24249 Specifying native as cpu type detects and selects the architecture
24250 option that corresponds to the host processor of the system
24251 performing the compilation. -mcpu=native has no effect if GCC does
24252 not recognize the processor.
24253
24254 The other options specify a specific processor. Code generated
24255 under those options runs best on that processor, and may not run at
24256 all on others.
24257
24258 The -mcpu options automatically enable or disable the following
24259 options:
24260
24261 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
24262 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
24263 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
24264 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
24265 -mfloat128-hardware -mprefixed -mpcrel -mmma -mrop-protect
24266
24267 The particular options set for any particular CPU varies between
24268 compiler versions, depending on what setting seems to produce
24269 optimal code for that CPU; it doesn't necessarily reflect the
24270 actual hardware's capabilities. If you wish to set an individual
24271 option to a particular value, you may specify it after the -mcpu
24272 option, like -mcpu=970 -mno-altivec.
24273
24274 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
24275 disabled by the -mcpu option at present because AIX does not have
24276 full support for these options. You may still enable or disable
24277 them individually if you're sure it'll work in your environment.
24278
24279 -mtune=cpu_type
24280 Set the instruction scheduling parameters for machine type
24281 cpu_type, but do not set the architecture type or register usage,
24282 as -mcpu=cpu_type does. The same values for cpu_type are used for
24283 -mtune as for -mcpu. If both are specified, the code generated
24284 uses the architecture and registers set by -mcpu, but the
24285 scheduling parameters set by -mtune.
24286
24287 -mcmodel=small
24288 Generate PowerPC64 code for the small model: The TOC is limited to
24289 64k.
24290
24291 -mcmodel=medium
24292 Generate PowerPC64 code for the medium model: The TOC and other
24293 static data may be up to a total of 4G in size. This is the
24294 default for 64-bit Linux.
24295
24296 -mcmodel=large
24297 Generate PowerPC64 code for the large model: The TOC may be up to
24298 4G in size. Other data and code is only limited by the 64-bit
24299 address space.
24300
24301 -maltivec
24302 -mno-altivec
24303 Generate code that uses (does not use) AltiVec instructions, and
24304 also enable the use of built-in functions that allow more direct
24305 access to the AltiVec instruction set. You may also need to set
24306 -mabi=altivec to adjust the current ABI with AltiVec ABI
24307 enhancements.
24308
24309 When -maltivec is used, the element order for AltiVec intrinsics
24310 such as "vec_splat", "vec_extract", and "vec_insert" match array
24311 element order corresponding to the endianness of the target. That
24312 is, element zero identifies the leftmost element in a vector
24313 register when targeting a big-endian platform, and identifies the
24314 rightmost element in a vector register when targeting a little-
24315 endian platform.
24316
24317 -mvrsave
24318 -mno-vrsave
24319 Generate VRSAVE instructions when generating AltiVec code.
24320
24321 -msecure-plt
24322 Generate code that allows ld and ld.so to build executables and
24323 shared libraries with non-executable ".plt" and ".got" sections.
24324 This is a PowerPC 32-bit SYSV ABI option.
24325
24326 -mbss-plt
24327 Generate code that uses a BSS ".plt" section that ld.so fills in,
24328 and requires ".plt" and ".got" sections that are both writable and
24329 executable. This is a PowerPC 32-bit SYSV ABI option.
24330
24331 -misel
24332 -mno-isel
24333 This switch enables or disables the generation of ISEL
24334 instructions.
24335
24336 -mvsx
24337 -mno-vsx
24338 Generate code that uses (does not use) vector/scalar (VSX)
24339 instructions, and also enable the use of built-in functions that
24340 allow more direct access to the VSX instruction set.
24341
24342 -mcrypto
24343 -mno-crypto
24344 Enable the use (disable) of the built-in functions that allow
24345 direct access to the cryptographic instructions that were added in
24346 version 2.07 of the PowerPC ISA.
24347
24348 -mhtm
24349 -mno-htm
24350 Enable (disable) the use of the built-in functions that allow
24351 direct access to the Hardware Transactional Memory (HTM)
24352 instructions that were added in version 2.07 of the PowerPC ISA.
24353
24354 -mpower8-fusion
24355 -mno-power8-fusion
24356 Generate code that keeps (does not keeps) some integer operations
24357 adjacent so that the instructions can be fused together on power8
24358 and later processors.
24359
24360 -mpower8-vector
24361 -mno-power8-vector
24362 Generate code that uses (does not use) the vector and scalar
24363 instructions that were added in version 2.07 of the PowerPC ISA.
24364 Also enable the use of built-in functions that allow more direct
24365 access to the vector instructions.
24366
24367 -mquad-memory
24368 -mno-quad-memory
24369 Generate code that uses (does not use) the non-atomic quad word
24370 memory instructions. The -mquad-memory option requires use of
24371 64-bit mode.
24372
24373 -mquad-memory-atomic
24374 -mno-quad-memory-atomic
24375 Generate code that uses (does not use) the atomic quad word memory
24376 instructions. The -mquad-memory-atomic option requires use of
24377 64-bit mode.
24378
24379 -mfloat128
24380 -mno-float128
24381 Enable/disable the __float128 keyword for IEEE 128-bit floating
24382 point and use either software emulation for IEEE 128-bit floating
24383 point or hardware instructions.
24384
24385 The VSX instruction set (-mvsx) must be enabled to use the IEEE
24386 128-bit floating point support. The IEEE 128-bit floating point is
24387 only supported on Linux.
24388
24389 The default for -mfloat128 is enabled on PowerPC Linux systems
24390 using the VSX instruction set, and disabled on other systems.
24391
24392 If you use the ISA 3.0 instruction set (-mpower9-vector or
24393 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
24394 support will also enable the generation of ISA 3.0 IEEE 128-bit
24395 floating point instructions. Otherwise, if you do not specify to
24396 generate ISA 3.0 instructions or you are targeting a 32-bit big
24397 endian system, IEEE 128-bit floating point will be done with
24398 software emulation.
24399
24400 -mfloat128-hardware
24401 -mno-float128-hardware
24402 Enable/disable using ISA 3.0 hardware instructions to support the
24403 __float128 data type.
24404
24405 The default for -mfloat128-hardware is enabled on PowerPC Linux
24406 systems using the ISA 3.0 instruction set, and disabled on other
24407 systems.
24408
24409 -m32
24410 -m64
24411 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24412 targets (including GNU/Linux). The 32-bit environment sets int,
24413 long and pointer to 32 bits and generates code that runs on any
24414 PowerPC variant. The 64-bit environment sets int to 32 bits and
24415 long and pointer to 64 bits, and generates code for PowerPC64, as
24416 for -mpowerpc64.
24417
24418 -mfull-toc
24419 -mno-fp-in-toc
24420 -mno-sum-in-toc
24421 -mminimal-toc
24422 Modify generation of the TOC (Table Of Contents), which is created
24423 for every executable file. The -mfull-toc option is selected by
24424 default. In that case, GCC allocates at least one TOC entry for
24425 each unique non-automatic variable reference in your program. GCC
24426 also places floating-point constants in the TOC. However, only
24427 16,384 entries are available in the TOC.
24428
24429 If you receive a linker error message that saying you have
24430 overflowed the available TOC space, you can reduce the amount of
24431 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
24432 -mno-fp-in-toc prevents GCC from putting floating-point constants
24433 in the TOC and -mno-sum-in-toc forces GCC to generate code to
24434 calculate the sum of an address and a constant at run time instead
24435 of putting that sum into the TOC. You may specify one or both of
24436 these options. Each causes GCC to produce very slightly slower and
24437 larger code at the expense of conserving TOC space.
24438
24439 If you still run out of space in the TOC even when you specify both
24440 of these options, specify -mminimal-toc instead. This option
24441 causes GCC to make only one TOC entry for every file. When you
24442 specify this option, GCC produces code that is slower and larger
24443 but which uses extremely little TOC space. You may wish to use
24444 this option only on files that contain less frequently-executed
24445 code.
24446
24447 -maix64
24448 -maix32
24449 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
24450 64-bit "long" type, and the infrastructure needed to support them.
24451 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
24452 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
24453
24454 -mxl-compat
24455 -mno-xl-compat
24456 Produce code that conforms more closely to IBM XL compiler
24457 semantics when using AIX-compatible ABI. Pass floating-point
24458 arguments to prototyped functions beyond the register save area
24459 (RSA) on the stack in addition to argument FPRs. Do not assume
24460 that most significant double in 128-bit long double value is
24461 properly rounded when comparing values and converting to double.
24462 Use XL symbol names for long double support routines.
24463
24464 The AIX calling convention was extended but not initially
24465 documented to handle an obscure K&R C case of calling a function
24466 that takes the address of its arguments with fewer arguments than
24467 declared. IBM XL compilers access floating-point arguments that do
24468 not fit in the RSA from the stack when a subroutine is compiled
24469 without optimization. Because always storing floating-point
24470 arguments on the stack is inefficient and rarely needed, this
24471 option is not enabled by default and only is necessary when calling
24472 subroutines compiled by IBM XL compilers without optimization.
24473
24474 -mpe
24475 Support IBM RS/6000 SP Parallel Environment (PE). Link an
24476 application written to use message passing with special startup
24477 code to enable the application to run. The system must have PE
24478 installed in the standard location (/usr/lpp/ppe.poe/), or the
24479 specs file must be overridden with the -specs= option to specify
24480 the appropriate directory location. The Parallel Environment does
24481 not support threads, so the -mpe option and the -pthread option are
24482 incompatible.
24483
24484 -malign-natural
24485 -malign-power
24486 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24487 -malign-natural overrides the ABI-defined alignment of larger
24488 types, such as floating-point doubles, on their natural size-based
24489 boundary. The option -malign-power instructs GCC to follow the
24490 ABI-specified alignment rules. GCC defaults to the standard
24491 alignment defined in the ABI.
24492
24493 On 64-bit Darwin, natural alignment is the default, and
24494 -malign-power is not supported.
24495
24496 -msoft-float
24497 -mhard-float
24498 Generate code that does not use (uses) the floating-point register
24499 set. Software floating-point emulation is provided if you use the
24500 -msoft-float option, and pass the option to GCC when linking.
24501
24502 -mmultiple
24503 -mno-multiple
24504 Generate code that uses (does not use) the load multiple word
24505 instructions and the store multiple word instructions. These
24506 instructions are generated by default on POWER systems, and not
24507 generated on PowerPC systems. Do not use -mmultiple on little-
24508 endian PowerPC systems, since those instructions do not work when
24509 the processor is in little-endian mode. The exceptions are PPC740
24510 and PPC750 which permit these instructions in little-endian mode.
24511
24512 -mupdate
24513 -mno-update
24514 Generate code that uses (does not use) the load or store
24515 instructions that update the base register to the address of the
24516 calculated memory location. These instructions are generated by
24517 default. If you use -mno-update, there is a small window between
24518 the time that the stack pointer is updated and the address of the
24519 previous frame is stored, which means code that walks the stack
24520 frame across interrupts or signals may get corrupted data.
24521
24522 -mavoid-indexed-addresses
24523 -mno-avoid-indexed-addresses
24524 Generate code that tries to avoid (not avoid) the use of indexed
24525 load or store instructions. These instructions can incur a
24526 performance penalty on Power6 processors in certain situations,
24527 such as when stepping through large arrays that cross a 16M
24528 boundary. This option is enabled by default when targeting Power6
24529 and disabled otherwise.
24530
24531 -mfused-madd
24532 -mno-fused-madd
24533 Generate code that uses (does not use) the floating-point multiply
24534 and accumulate instructions. These instructions are generated by
24535 default if hardware floating point is used. The machine-dependent
24536 -mfused-madd option is now mapped to the machine-independent
24537 -ffp-contract=fast option, and -mno-fused-madd is mapped to
24538 -ffp-contract=off.
24539
24540 -mmulhw
24541 -mno-mulhw
24542 Generate code that uses (does not use) the half-word multiply and
24543 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
24544 processors. These instructions are generated by default when
24545 targeting those processors.
24546
24547 -mdlmzb
24548 -mno-dlmzb
24549 Generate code that uses (does not use) the string-search dlmzb
24550 instruction on the IBM 405, 440, 464 and 476 processors. This
24551 instruction is generated by default when targeting those
24552 processors.
24553
24554 -mno-bit-align
24555 -mbit-align
24556 On System V.4 and embedded PowerPC systems do not (do) force
24557 structures and unions that contain bit-fields to be aligned to the
24558 base type of the bit-field.
24559
24560 For example, by default a structure containing nothing but 8
24561 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
24562 and has a size of 4 bytes. By using -mno-bit-align, the structure
24563 is aligned to a 1-byte boundary and is 1 byte in size.
24564
24565 -mno-strict-align
24566 -mstrict-align
24567 On System V.4 and embedded PowerPC systems do not (do) assume that
24568 unaligned memory references are handled by the system.
24569
24570 -mrelocatable
24571 -mno-relocatable
24572 Generate code that allows (does not allow) a static executable to
24573 be relocated to a different address at run time. A simple embedded
24574 PowerPC system loader should relocate the entire contents of
24575 ".got2" and 4-byte locations listed in the ".fixup" section, a
24576 table of 32-bit addresses generated by this option. For this to
24577 work, all objects linked together must be compiled with
24578 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
24579 stack to an 8-byte boundary.
24580
24581 -mrelocatable-lib
24582 -mno-relocatable-lib
24583 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
24584 to allow static executables to be relocated at run time, but
24585 -mrelocatable-lib does not use the smaller stack alignment of
24586 -mrelocatable. Objects compiled with -mrelocatable-lib may be
24587 linked with objects compiled with any combination of the
24588 -mrelocatable options.
24589
24590 -mno-toc
24591 -mtoc
24592 On System V.4 and embedded PowerPC systems do not (do) assume that
24593 register 2 contains a pointer to a global area pointing to the
24594 addresses used in the program.
24595
24596 -mlittle
24597 -mlittle-endian
24598 On System V.4 and embedded PowerPC systems compile code for the
24599 processor in little-endian mode. The -mlittle-endian option is the
24600 same as -mlittle.
24601
24602 -mbig
24603 -mbig-endian
24604 On System V.4 and embedded PowerPC systems compile code for the
24605 processor in big-endian mode. The -mbig-endian option is the same
24606 as -mbig.
24607
24608 -mdynamic-no-pic
24609 On Darwin and Mac OS X systems, compile code so that it is not
24610 relocatable, but that its external references are relocatable. The
24611 resulting code is suitable for applications, but not shared
24612 libraries.
24613
24614 -msingle-pic-base
24615 Treat the register used for PIC addressing as read-only, rather
24616 than loading it in the prologue for each function. The runtime
24617 system is responsible for initializing this register with an
24618 appropriate value before execution begins.
24619
24620 -mprioritize-restricted-insns=priority
24621 This option controls the priority that is assigned to dispatch-slot
24622 restricted instructions during the second scheduling pass. The
24623 argument priority takes the value 0, 1, or 2 to assign no, highest,
24624 or second-highest (respectively) priority to dispatch-slot
24625 restricted instructions.
24626
24627 -msched-costly-dep=dependence_type
24628 This option controls which dependences are considered costly by the
24629 target during instruction scheduling. The argument dependence_type
24630 takes one of the following values:
24631
24632 no No dependence is costly.
24633
24634 all All dependences are costly.
24635
24636 true_store_to_load
24637 A true dependence from store to load is costly.
24638
24639 store_to_load
24640 Any dependence from store to load is costly.
24641
24642 number
24643 Any dependence for which the latency is greater than or equal
24644 to number is costly.
24645
24646 -minsert-sched-nops=scheme
24647 This option controls which NOP insertion scheme is used during the
24648 second scheduling pass. The argument scheme takes one of the
24649 following values:
24650
24651 no Don't insert NOPs.
24652
24653 pad Pad with NOPs any dispatch group that has vacant issue slots,
24654 according to the scheduler's grouping.
24655
24656 regroup_exact
24657 Insert NOPs to force costly dependent insns into separate
24658 groups. Insert exactly as many NOPs as needed to force an insn
24659 to a new group, according to the estimated processor grouping.
24660
24661 number
24662 Insert NOPs to force costly dependent insns into separate
24663 groups. Insert number NOPs to force an insn to a new group.
24664
24665 -mcall-sysv
24666 On System V.4 and embedded PowerPC systems compile code using
24667 calling conventions that adhere to the March 1995 draft of the
24668 System V Application Binary Interface, PowerPC processor
24669 supplement. This is the default unless you configured GCC using
24670 powerpc-*-eabiaix.
24671
24672 -mcall-sysv-eabi
24673 -mcall-eabi
24674 Specify both -mcall-sysv and -meabi options.
24675
24676 -mcall-sysv-noeabi
24677 Specify both -mcall-sysv and -mno-eabi options.
24678
24679 -mcall-aixdesc
24680 On System V.4 and embedded PowerPC systems compile code for the AIX
24681 operating system.
24682
24683 -mcall-linux
24684 On System V.4 and embedded PowerPC systems compile code for the
24685 Linux-based GNU system.
24686
24687 -mcall-freebsd
24688 On System V.4 and embedded PowerPC systems compile code for the
24689 FreeBSD operating system.
24690
24691 -mcall-netbsd
24692 On System V.4 and embedded PowerPC systems compile code for the
24693 NetBSD operating system.
24694
24695 -mcall-openbsd
24696 On System V.4 and embedded PowerPC systems compile code for the
24697 OpenBSD operating system.
24698
24699 -mtraceback=traceback_type
24700 Select the type of traceback table. Valid values for traceback_type
24701 are full, part, and no.
24702
24703 -maix-struct-return
24704 Return all structures in memory (as specified by the AIX ABI).
24705
24706 -msvr4-struct-return
24707 Return structures smaller than 8 bytes in registers (as specified
24708 by the SVR4 ABI).
24709
24710 -mabi=abi-type
24711 Extend the current ABI with a particular extension, or remove such
24712 extension. Valid values are: altivec, no-altivec, ibmlongdouble,
24713 ieeelongdouble, elfv1, elfv2, and for AIX: vec-extabi, vec-default.
24714
24715 -mabi=ibmlongdouble
24716 Change the current ABI to use IBM extended-precision long double.
24717 This is not likely to work if your system defaults to using IEEE
24718 extended-precision long double. If you change the long double type
24719 from IEEE extended-precision, the compiler will issue a warning
24720 unless you use the -Wno-psabi option. Requires -mlong-double-128
24721 to be enabled.
24722
24723 -mabi=ieeelongdouble
24724 Change the current ABI to use IEEE extended-precision long double.
24725 This is not likely to work if your system defaults to using IBM
24726 extended-precision long double. If you change the long double type
24727 from IBM extended-precision, the compiler will issue a warning
24728 unless you use the -Wno-psabi option. Requires -mlong-double-128
24729 to be enabled.
24730
24731 -mabi=elfv1
24732 Change the current ABI to use the ELFv1 ABI. This is the default
24733 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
24734 ABI requires special system support and is likely to fail in
24735 spectacular ways.
24736
24737 -mabi=elfv2
24738 Change the current ABI to use the ELFv2 ABI. This is the default
24739 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
24740 ABI requires special system support and is likely to fail in
24741 spectacular ways.
24742
24743 -mgnu-attribute
24744 -mno-gnu-attribute
24745 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24746 .gnu.attributes section that specify ABI variations in function
24747 parameters or return values.
24748
24749 -mprototype
24750 -mno-prototype
24751 On System V.4 and embedded PowerPC systems assume that all calls to
24752 variable argument functions are properly prototyped. Otherwise,
24753 the compiler must insert an instruction before every non-prototyped
24754 call to set or clear bit 6 of the condition code register ("CR") to
24755 indicate whether floating-point values are passed in the floating-
24756 point registers in case the function takes variable arguments.
24757 With -mprototype, only calls to prototyped variable argument
24758 functions set or clear the bit.
24759
24760 -msim
24761 On embedded PowerPC systems, assume that the startup module is
24762 called sim-crt0.o and that the standard C libraries are libsim.a
24763 and libc.a. This is the default for powerpc-*-eabisim
24764 configurations.
24765
24766 -mmvme
24767 On embedded PowerPC systems, assume that the startup module is
24768 called crt0.o and the standard C libraries are libmvme.a and
24769 libc.a.
24770
24771 -mads
24772 On embedded PowerPC systems, assume that the startup module is
24773 called crt0.o and the standard C libraries are libads.a and libc.a.
24774
24775 -myellowknife
24776 On embedded PowerPC systems, assume that the startup module is
24777 called crt0.o and the standard C libraries are libyk.a and libc.a.
24778
24779 -mvxworks
24780 On System V.4 and embedded PowerPC systems, specify that you are
24781 compiling for a VxWorks system.
24782
24783 -memb
24784 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
24785 header to indicate that eabi extended relocations are used.
24786
24787 -meabi
24788 -mno-eabi
24789 On System V.4 and embedded PowerPC systems do (do not) adhere to
24790 the Embedded Applications Binary Interface (EABI), which is a set
24791 of modifications to the System V.4 specifications. Selecting
24792 -meabi means that the stack is aligned to an 8-byte boundary, a
24793 function "__eabi" is called from "main" to set up the EABI
24794 environment, and the -msdata option can use both "r2" and "r13" to
24795 point to two separate small data areas. Selecting -mno-eabi means
24796 that the stack is aligned to a 16-byte boundary, no EABI
24797 initialization function is called from "main", and the -msdata
24798 option only uses "r13" to point to a single small data area. The
24799 -meabi option is on by default if you configured GCC using one of
24800 the powerpc*-*-eabi* options.
24801
24802 -msdata=eabi
24803 On System V.4 and embedded PowerPC systems, put small initialized
24804 "const" global and static data in the ".sdata2" section, which is
24805 pointed to by register "r2". Put small initialized non-"const"
24806 global and static data in the ".sdata" section, which is pointed to
24807 by register "r13". Put small uninitialized global and static data
24808 in the ".sbss" section, which is adjacent to the ".sdata" section.
24809 The -msdata=eabi option is incompatible with the -mrelocatable
24810 option. The -msdata=eabi option also sets the -memb option.
24811
24812 -msdata=sysv
24813 On System V.4 and embedded PowerPC systems, put small global and
24814 static data in the ".sdata" section, which is pointed to by
24815 register "r13". Put small uninitialized global and static data in
24816 the ".sbss" section, which is adjacent to the ".sdata" section.
24817 The -msdata=sysv option is incompatible with the -mrelocatable
24818 option.
24819
24820 -msdata=default
24821 -msdata
24822 On System V.4 and embedded PowerPC systems, if -meabi is used,
24823 compile code the same as -msdata=eabi, otherwise compile code the
24824 same as -msdata=sysv.
24825
24826 -msdata=data
24827 On System V.4 and embedded PowerPC systems, put small global data
24828 in the ".sdata" section. Put small uninitialized global data in
24829 the ".sbss" section. Do not use register "r13" to address small
24830 data however. This is the default behavior unless other -msdata
24831 options are used.
24832
24833 -msdata=none
24834 -mno-sdata
24835 On embedded PowerPC systems, put all initialized global and static
24836 data in the ".data" section, and all uninitialized data in the
24837 ".bss" section.
24838
24839 -mreadonly-in-sdata
24840 Put read-only objects in the ".sdata" section as well. This is the
24841 default.
24842
24843 -mblock-move-inline-limit=num
24844 Inline all block moves (such as calls to "memcpy" or structure
24845 copies) less than or equal to num bytes. The minimum value for num
24846 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
24847 default value is target-specific.
24848
24849 -mblock-compare-inline-limit=num
24850 Generate non-looping inline code for all block compares (such as
24851 calls to "memcmp" or structure compares) less than or equal to num
24852 bytes. If num is 0, all inline expansion (non-loop and loop) of
24853 block compare is disabled. The default value is target-specific.
24854
24855 -mblock-compare-inline-loop-limit=num
24856 Generate an inline expansion using loop code for all block compares
24857 that are less than or equal to num bytes, but greater than the
24858 limit for non-loop inline block compare expansion. If the block
24859 length is not constant, at most num bytes will be compared before
24860 "memcmp" is called to compare the remainder of the block. The
24861 default value is target-specific.
24862
24863 -mstring-compare-inline-limit=num
24864 Compare at most num string bytes with inline code. If the
24865 difference or end of string is not found at the end of the inline
24866 compare a call to "strcmp" or "strncmp" will take care of the rest
24867 of the comparison. The default is 64 bytes.
24868
24869 -G num
24870 On embedded PowerPC systems, put global and static items less than
24871 or equal to num bytes into the small data or BSS sections instead
24872 of the normal data or BSS section. By default, num is 8. The -G
24873 num switch is also passed to the linker. All modules should be
24874 compiled with the same -G num value.
24875
24876 -mregnames
24877 -mno-regnames
24878 On System V.4 and embedded PowerPC systems do (do not) emit
24879 register names in the assembly language output using symbolic
24880 forms.
24881
24882 -mlongcall
24883 -mno-longcall
24884 By default assume that all calls are far away so that a longer and
24885 more expensive calling sequence is required. This is required for
24886 calls farther than 32 megabytes (33,554,432 bytes) from the current
24887 location. A short call is generated if the compiler knows the call
24888 cannot be that far away. This setting can be overridden by the
24889 "shortcall" function attribute, or by "#pragma longcall(0)".
24890
24891 Some linkers are capable of detecting out-of-range calls and
24892 generating glue code on the fly. On these systems, long calls are
24893 unnecessary and generate slower code. As of this writing, the AIX
24894 linker can do this, as can the GNU linker for PowerPC/64. It is
24895 planned to add this feature to the GNU linker for 32-bit PowerPC
24896 systems as well.
24897
24898 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
24899 linkers, GCC can generate long calls using an inline PLT call
24900 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
24901 ELFv1 (big-endian) do not support inline PLT calls.
24902
24903 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
24904 L42", plus a branch island (glue code). The two target addresses
24905 represent the callee and the branch island. The Darwin/PPC linker
24906 prefers the first address and generates a "bl callee" if the PPC
24907 "bl" instruction reaches the callee directly; otherwise, the linker
24908 generates "bl L42" to call the branch island. The branch island is
24909 appended to the body of the calling function; it computes the full
24910 32-bit address of the callee and jumps to it.
24911
24912 On Mach-O (Darwin) systems, this option directs the compiler emit
24913 to the glue for every direct call, and the Darwin linker decides
24914 whether to use or discard it.
24915
24916 In the future, GCC may ignore all longcall specifications when the
24917 linker is known to generate glue.
24918
24919 -mpltseq
24920 -mno-pltseq
24921 Implement (do not implement) -fno-plt and long calls using an
24922 inline PLT call sequence that supports lazy linking and long calls
24923 to functions in dlopen'd shared libraries. Inline PLT calls are
24924 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
24925 newer GNU linkers, and are enabled by default if the support is
24926 detected when configuring GCC, and, in the case of 32-bit PowerPC,
24927 if GCC is configured with --enable-secureplt. -mpltseq code and
24928 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
24929 together.
24930
24931 -mtls-markers
24932 -mno-tls-markers
24933 Mark (do not mark) calls to "__tls_get_addr" with a relocation
24934 specifying the function argument. The relocation allows the linker
24935 to reliably associate function call with argument setup
24936 instructions for TLS optimization, which in turn allows GCC to
24937 better schedule the sequence.
24938
24939 -mrecip
24940 -mno-recip
24941 This option enables use of the reciprocal estimate and reciprocal
24942 square root estimate instructions with additional Newton-Raphson
24943 steps to increase precision instead of doing a divide or square
24944 root and divide for floating-point arguments. You should use the
24945 -ffast-math option when using -mrecip (or at least
24946 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
24947 and -fno-trapping-math). Note that while the throughput of the
24948 sequence is generally higher than the throughput of the non-
24949 reciprocal instruction, the precision of the sequence can be
24950 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
24951 0.99999994) for reciprocal square roots.
24952
24953 -mrecip=opt
24954 This option controls which reciprocal estimate instructions may be
24955 used. opt is a comma-separated list of options, which may be
24956 preceded by a "!" to invert the option:
24957
24958 all Enable all estimate instructions.
24959
24960 default
24961 Enable the default instructions, equivalent to -mrecip.
24962
24963 none
24964 Disable all estimate instructions, equivalent to -mno-recip.
24965
24966 div Enable the reciprocal approximation instructions for both
24967 single and double precision.
24968
24969 divf
24970 Enable the single-precision reciprocal approximation
24971 instructions.
24972
24973 divd
24974 Enable the double-precision reciprocal approximation
24975 instructions.
24976
24977 rsqrt
24978 Enable the reciprocal square root approximation instructions
24979 for both single and double precision.
24980
24981 rsqrtf
24982 Enable the single-precision reciprocal square root
24983 approximation instructions.
24984
24985 rsqrtd
24986 Enable the double-precision reciprocal square root
24987 approximation instructions.
24988
24989 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
24990 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
24991 "XVRSQRTEDP" instructions which handle the double-precision
24992 reciprocal square root calculations.
24993
24994 -mrecip-precision
24995 -mno-recip-precision
24996 Assume (do not assume) that the reciprocal estimate instructions
24997 provide higher-precision estimates than is mandated by the PowerPC
24998 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
24999 automatically selects -mrecip-precision. The double-precision
25000 square root estimate instructions are not generated by default on
25001 low-precision machines, since they do not provide an estimate that
25002 converges after three steps.
25003
25004 -mveclibabi=type
25005 Specifies the ABI type to use for vectorizing intrinsics using an
25006 external library. The only type supported at present is mass,
25007 which specifies to use IBM's Mathematical Acceleration Subsystem
25008 (MASS) libraries for vectorizing intrinsics using external
25009 libraries. GCC currently emits calls to "acosd2", "acosf4",
25010 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
25011 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
25012 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
25013 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
25014 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
25015 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
25016 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
25017 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
25018 "tanhf4" when generating code for power7. Both -ftree-vectorize
25019 and -funsafe-math-optimizations must also be enabled. The MASS
25020 libraries must be specified at link time.
25021
25022 -mfriz
25023 -mno-friz
25024 Generate (do not generate) the "friz" instruction when the
25025 -funsafe-math-optimizations option is used to optimize rounding of
25026 floating-point values to 64-bit integer and back to floating point.
25027 The "friz" instruction does not return the same value if the
25028 floating-point number is too large to fit in an integer.
25029
25030 -mpointers-to-nested-functions
25031 -mno-pointers-to-nested-functions
25032 Generate (do not generate) code to load up the static chain
25033 register ("r11") when calling through a pointer on AIX and 64-bit
25034 Linux systems where a function pointer points to a 3-word
25035 descriptor giving the function address, TOC value to be loaded in
25036 register "r2", and static chain value to be loaded in register
25037 "r11". The -mpointers-to-nested-functions is on by default. You
25038 cannot call through pointers to nested functions or pointers to
25039 functions compiled in other languages that use the static chain if
25040 you use -mno-pointers-to-nested-functions.
25041
25042 -msave-toc-indirect
25043 -mno-save-toc-indirect
25044 Generate (do not generate) code to save the TOC value in the
25045 reserved stack location in the function prologue if the function
25046 calls through a pointer on AIX and 64-bit Linux systems. If the
25047 TOC value is not saved in the prologue, it is saved just before the
25048 call through the pointer. The -mno-save-toc-indirect option is the
25049 default.
25050
25051 -mcompat-align-parm
25052 -mno-compat-align-parm
25053 Generate (do not generate) code to pass structure parameters with a
25054 maximum alignment of 64 bits, for compatibility with older versions
25055 of GCC.
25056
25057 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25058 structure parameter on a 128-bit boundary when that structure
25059 contained a member requiring 128-bit alignment. This is corrected
25060 in more recent versions of GCC. This option may be used to
25061 generate code that is compatible with functions compiled with older
25062 versions of GCC.
25063
25064 The -mno-compat-align-parm option is the default.
25065
25066 -mstack-protector-guard=guard
25067 -mstack-protector-guard-reg=reg
25068 -mstack-protector-guard-offset=offset
25069 -mstack-protector-guard-symbol=symbol
25070 Generate stack protection code using canary at guard. Supported
25071 locations are global for global canary or tls for per-thread canary
25072 in the TLS block (the default with GNU libc version 2.4 or later).
25073
25074 With the latter choice the options -mstack-protector-guard-reg=reg
25075 and -mstack-protector-guard-offset=offset furthermore specify which
25076 register to use as base register for reading the canary, and from
25077 what offset from that base register. The default for those is as
25078 specified in the relevant ABI.
25079 -mstack-protector-guard-symbol=symbol overrides the offset with a
25080 symbol reference to a canary in the TLS block.
25081
25082 -mpcrel
25083 -mno-pcrel
25084 Generate (do not generate) pc-relative addressing. The -mpcrel
25085 option requires that the medium code model (-mcmodel=medium) and
25086 prefixed addressing (-mprefixed) options are enabled.
25087
25088 -mprefixed
25089 -mno-prefixed
25090 Generate (do not generate) addressing modes using prefixed load and
25091 store instructions. The -mprefixed option requires that the option
25092 -mcpu=power10 (or later) is enabled.
25093
25094 -mmma
25095 -mno-mma
25096 Generate (do not generate) the MMA instructions. The -mma option
25097 requires that the option -mcpu=power10 (or later) is enabled.
25098
25099 -mrop-protect
25100 -mno-rop-protect
25101 Generate (do not generate) ROP protection instructions when the
25102 target processor supports them. Currently this option disables the
25103 shrink-wrap optimization (-fshrink-wrap).
25104
25105 -mprivileged
25106 -mno-privileged
25107 Generate (do not generate) code that will run in privileged state.
25108
25109 -mblock-ops-unaligned-vsx
25110 -mno-block-ops-unaligned-vsx
25111 Generate (do not generate) unaligned vsx loads and stores for
25112 inline expansion of "memcpy" and "memmove".
25113
25114 RX Options
25115 These command-line options are defined for RX targets:
25116
25117 -m64bit-doubles
25118 -m32bit-doubles
25119 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
25120 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
25121 RX floating-point hardware only works on 32-bit values, which is
25122 why the default is -m32bit-doubles.
25123
25124 -fpu
25125 -nofpu
25126 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
25127 hardware. The default is enabled for the RX600 series and disabled
25128 for the RX200 series.
25129
25130 Floating-point instructions are only generated for 32-bit floating-
25131 point values, however, so the FPU hardware is not used for doubles
25132 if the -m64bit-doubles option is used.
25133
25134 Note If the -fpu option is enabled then -funsafe-math-optimizations
25135 is also enabled automatically. This is because the RX FPU
25136 instructions are themselves unsafe.
25137
25138 -mcpu=name
25139 Selects the type of RX CPU to be targeted. Currently three types
25140 are supported, the generic RX600 and RX200 series hardware and the
25141 specific RX610 CPU. The default is RX600.
25142
25143 The only difference between RX600 and RX610 is that the RX610 does
25144 not support the "MVTIPL" instruction.
25145
25146 The RX200 series does not have a hardware floating-point unit and
25147 so -nofpu is enabled by default when this type is selected.
25148
25149 -mbig-endian-data
25150 -mlittle-endian-data
25151 Store data (but not code) in the big-endian format. The default is
25152 -mlittle-endian-data, i.e. to store data in the little-endian
25153 format.
25154
25155 -msmall-data-limit=N
25156 Specifies the maximum size in bytes of global and static variables
25157 which can be placed into the small data area. Using the small data
25158 area can lead to smaller and faster code, but the size of area is
25159 limited and it is up to the programmer to ensure that the area does
25160 not overflow. Also when the small data area is used one of the
25161 RX's registers (usually "r13") is reserved for use pointing to this
25162 area, so it is no longer available for use by the compiler. This
25163 could result in slower and/or larger code if variables are pushed
25164 onto the stack instead of being held in this register.
25165
25166 Note, common variables (variables that have not been initialized)
25167 and constants are not placed into the small data area as they are
25168 assigned to other sections in the output executable.
25169
25170 The default value is zero, which disables this feature. Note, this
25171 feature is not enabled by default with higher optimization levels
25172 (-O2 etc) because of the potentially detrimental effects of
25173 reserving a register. It is up to the programmer to experiment and
25174 discover whether this feature is of benefit to their program. See
25175 the description of the -mpid option for a description of how the
25176 actual register to hold the small data area pointer is chosen.
25177
25178 -msim
25179 -mno-sim
25180 Use the simulator runtime. The default is to use the libgloss
25181 board-specific runtime.
25182
25183 -mas100-syntax
25184 -mno-as100-syntax
25185 When generating assembler output use a syntax that is compatible
25186 with Renesas's AS100 assembler. This syntax can also be handled by
25187 the GAS assembler, but it has some restrictions so it is not
25188 generated by default.
25189
25190 -mmax-constant-size=N
25191 Specifies the maximum size, in bytes, of a constant that can be
25192 used as an operand in a RX instruction. Although the RX
25193 instruction set does allow constants of up to 4 bytes in length to
25194 be used in instructions, a longer value equates to a longer
25195 instruction. Thus in some circumstances it can be beneficial to
25196 restrict the size of constants that are used in instructions.
25197 Constants that are too big are instead placed into a constant pool
25198 and referenced via register indirection.
25199
25200 The value N can be between 0 and 4. A value of 0 (the default) or
25201 4 means that constants of any size are allowed.
25202
25203 -mrelax
25204 Enable linker relaxation. Linker relaxation is a process whereby
25205 the linker attempts to reduce the size of a program by finding
25206 shorter versions of various instructions. Disabled by default.
25207
25208 -mint-register=N
25209 Specify the number of registers to reserve for fast interrupt
25210 handler functions. The value N can be between 0 and 4. A value of
25211 1 means that register "r13" is reserved for the exclusive use of
25212 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
25213 value of 3 reserves "r13", "r12" and "r11", and a value of 4
25214 reserves "r13" through "r10". A value of 0, the default, does not
25215 reserve any registers.
25216
25217 -msave-acc-in-interrupts
25218 Specifies that interrupt handler functions should preserve the
25219 accumulator register. This is only necessary if normal code might
25220 use the accumulator register, for example because it performs
25221 64-bit multiplications. The default is to ignore the accumulator
25222 as this makes the interrupt handlers faster.
25223
25224 -mpid
25225 -mno-pid
25226 Enables the generation of position independent data. When enabled
25227 any access to constant data is done via an offset from a base
25228 address held in a register. This allows the location of constant
25229 data to be determined at run time without requiring the executable
25230 to be relocated, which is a benefit to embedded applications with
25231 tight memory constraints. Data that can be modified is not
25232 affected by this option.
25233
25234 Note, using this feature reserves a register, usually "r13", for
25235 the constant data base address. This can result in slower and/or
25236 larger code, especially in complicated functions.
25237
25238 The actual register chosen to hold the constant data base address
25239 depends upon whether the -msmall-data-limit and/or the
25240 -mint-register command-line options are enabled. Starting with
25241 register "r13" and proceeding downwards, registers are allocated
25242 first to satisfy the requirements of -mint-register, then -mpid and
25243 finally -msmall-data-limit. Thus it is possible for the small data
25244 area register to be "r8" if both -mint-register=4 and -mpid are
25245 specified on the command line.
25246
25247 By default this feature is not enabled. The default can be
25248 restored via the -mno-pid command-line option.
25249
25250 -mno-warn-multiple-fast-interrupts
25251 -mwarn-multiple-fast-interrupts
25252 Prevents GCC from issuing a warning message if it finds more than
25253 one fast interrupt handler when it is compiling a file. The
25254 default is to issue a warning for each extra fast interrupt handler
25255 found, as the RX only supports one such interrupt.
25256
25257 -mallow-string-insns
25258 -mno-allow-string-insns
25259 Enables or disables the use of the string manipulation instructions
25260 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
25261 "RMPA" instruction. These instructions may prefetch data, which is
25262 not safe to do if accessing an I/O register. (See section 12.2.7
25263 of the RX62N Group User's Manual for more information).
25264
25265 The default is to allow these instructions, but it is not possible
25266 for GCC to reliably detect all circumstances where a string
25267 instruction might be used to access an I/O register, so their use
25268 cannot be disabled automatically. Instead it is reliant upon the
25269 programmer to use the -mno-allow-string-insns option if their
25270 program accesses I/O space.
25271
25272 When the instructions are enabled GCC defines the C preprocessor
25273 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
25274 "__RX_DISALLOW_STRING_INSNS__".
25275
25276 -mjsr
25277 -mno-jsr
25278 Use only (or not only) "JSR" instructions to access functions.
25279 This option can be used when code size exceeds the range of "BSR"
25280 instructions. Note that -mno-jsr does not mean to not use "JSR"
25281 but instead means that any type of branch may be used.
25282
25283 Note: The generic GCC command-line option -ffixed-reg has special
25284 significance to the RX port when used with the "interrupt" function
25285 attribute. This attribute indicates a function intended to process
25286 fast interrupts. GCC ensures that it only uses the registers "r10",
25287 "r11", "r12" and/or "r13" and only provided that the normal use of the
25288 corresponding registers have been restricted via the -ffixed-reg or
25289 -mint-register command-line options.
25290
25291 S/390 and zSeries Options
25292 These are the -m options defined for the S/390 and zSeries
25293 architecture.
25294
25295 -mhard-float
25296 -msoft-float
25297 Use (do not use) the hardware floating-point instructions and
25298 registers for floating-point operations. When -msoft-float is
25299 specified, functions in libgcc.a are used to perform floating-point
25300 operations. When -mhard-float is specified, the compiler generates
25301 IEEE floating-point instructions. This is the default.
25302
25303 -mhard-dfp
25304 -mno-hard-dfp
25305 Use (do not use) the hardware decimal-floating-point instructions
25306 for decimal-floating-point operations. When -mno-hard-dfp is
25307 specified, functions in libgcc.a are used to perform decimal-
25308 floating-point operations. When -mhard-dfp is specified, the
25309 compiler generates decimal-floating-point hardware instructions.
25310 This is the default for -march=z9-ec or higher.
25311
25312 -mlong-double-64
25313 -mlong-double-128
25314 These switches control the size of "long double" type. A size of 64
25315 bits makes the "long double" type equivalent to the "double" type.
25316 This is the default.
25317
25318 -mbackchain
25319 -mno-backchain
25320 Store (do not store) the address of the caller's frame as backchain
25321 pointer into the callee's stack frame. A backchain may be needed
25322 to allow debugging using tools that do not understand DWARF call
25323 frame information. When -mno-packed-stack is in effect, the
25324 backchain pointer is stored at the bottom of the stack frame; when
25325 -mpacked-stack is in effect, the backchain is placed into the
25326 topmost word of the 96/160 byte register save area.
25327
25328 In general, code compiled with -mbackchain is call-compatible with
25329 code compiled with -mno-backchain; however, use of the backchain
25330 for debugging purposes usually requires that the whole binary is
25331 built with -mbackchain. Note that the combination of -mbackchain,
25332 -mpacked-stack and -mhard-float is not supported. In order to
25333 build a linux kernel use -msoft-float.
25334
25335 The default is to not maintain the backchain.
25336
25337 -mpacked-stack
25338 -mno-packed-stack
25339 Use (do not use) the packed stack layout. When -mno-packed-stack
25340 is specified, the compiler uses the all fields of the 96/160 byte
25341 register save area only for their default purpose; unused fields
25342 still take up stack space. When -mpacked-stack is specified,
25343 register save slots are densely packed at the top of the register
25344 save area; unused space is reused for other purposes, allowing for
25345 more efficient use of the available stack space. However, when
25346 -mbackchain is also in effect, the topmost word of the save area is
25347 always used to store the backchain, and the return address register
25348 is always saved two words below the backchain.
25349
25350 As long as the stack frame backchain is not used, code generated
25351 with -mpacked-stack is call-compatible with code generated with
25352 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
25353 S/390 or zSeries generated code that uses the stack frame backchain
25354 at run time, not just for debugging purposes. Such code is not
25355 call-compatible with code compiled with -mpacked-stack. Also, note
25356 that the combination of -mbackchain, -mpacked-stack and
25357 -mhard-float is not supported. In order to build a linux kernel
25358 use -msoft-float.
25359
25360 The default is to not use the packed stack layout.
25361
25362 -msmall-exec
25363 -mno-small-exec
25364 Generate (or do not generate) code using the "bras" instruction to
25365 do subroutine calls. This only works reliably if the total
25366 executable size does not exceed 64k. The default is to use the
25367 "basr" instruction instead, which does not have this limitation.
25368
25369 -m64
25370 -m31
25371 When -m31 is specified, generate code compliant to the GNU/Linux
25372 for S/390 ABI. When -m64 is specified, generate code compliant to
25373 the GNU/Linux for zSeries ABI. This allows GCC in particular to
25374 generate 64-bit instructions. For the s390 targets, the default is
25375 -m31, while the s390x targets default to -m64.
25376
25377 -mzarch
25378 -mesa
25379 When -mzarch is specified, generate code using the instructions
25380 available on z/Architecture. When -mesa is specified, generate
25381 code using the instructions available on ESA/390. Note that -mesa
25382 is not possible with -m64. When generating code compliant to the
25383 GNU/Linux for S/390 ABI, the default is -mesa. When generating
25384 code compliant to the GNU/Linux for zSeries ABI, the default is
25385 -mzarch.
25386
25387 -mhtm
25388 -mno-htm
25389 The -mhtm option enables a set of builtins making use of
25390 instructions available with the transactional execution facility
25391 introduced with the IBM zEnterprise EC12 machine generation S/390
25392 System z Built-in Functions. -mhtm is enabled by default when
25393 using -march=zEC12.
25394
25395 -mvx
25396 -mno-vx
25397 When -mvx is specified, generate code using the instructions
25398 available with the vector extension facility introduced with the
25399 IBM z13 machine generation. This option changes the ABI for some
25400 vector type values with regard to alignment and calling
25401 conventions. In case vector type values are being used in an ABI-
25402 relevant context a GAS .gnu_attribute command will be added to mark
25403 the resulting binary with the ABI used. -mvx is enabled by default
25404 when using -march=z13.
25405
25406 -mzvector
25407 -mno-zvector
25408 The -mzvector option enables vector language extensions and
25409 builtins using instructions available with the vector extension
25410 facility introduced with the IBM z13 machine generation. This
25411 option adds support for vector to be used as a keyword to define
25412 vector type variables and arguments. vector is only available when
25413 GNU extensions are enabled. It will not be expanded when
25414 requesting strict standard compliance e.g. with -std=c99. In
25415 addition to the GCC low-level builtins -mzvector enables a set of
25416 builtins added for compatibility with AltiVec-style implementations
25417 like Power and Cell. In order to make use of these builtins the
25418 header file vecintrin.h needs to be included. -mzvector is
25419 disabled by default.
25420
25421 -mmvcle
25422 -mno-mvcle
25423 Generate (or do not generate) code using the "mvcle" instruction to
25424 perform block moves. When -mno-mvcle is specified, use a "mvc"
25425 loop instead. This is the default unless optimizing for size.
25426
25427 -mdebug
25428 -mno-debug
25429 Print (or do not print) additional debug information when
25430 compiling. The default is to not print debug information.
25431
25432 -march=cpu-type
25433 Generate code that runs on cpu-type, which is the name of a system
25434 representing a certain processor type. Possible values for cpu-
25435 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
25436 z196/arch9, zEC12, z13/arch11, z14/arch12, z15/arch13, z16/arch14,
25437 and native.
25438
25439 The default is -march=z900.
25440
25441 Specifying native as cpu type can be used to select the best
25442 architecture option for the host processor. -march=native has no
25443 effect if GCC does not recognize the processor.
25444
25445 -mtune=cpu-type
25446 Tune to cpu-type everything applicable about the generated code,
25447 except for the ABI and the set of available instructions. The list
25448 of cpu-type values is the same as for -march. The default is the
25449 value used for -march.
25450
25451 -mtpf-trace
25452 -mno-tpf-trace
25453 Generate code that adds (does not add) in TPF OS specific branches
25454 to trace routines in the operating system. This option is off by
25455 default, even when compiling for the TPF OS.
25456
25457 -mtpf-trace-skip
25458 -mno-tpf-trace-skip
25459 Generate code that changes (does not change) the default branch
25460 targets enabled by -mtpf-trace to point to specialized trace
25461 routines providing the ability of selectively skipping function
25462 trace entries for the TPF OS. This option is off by default, even
25463 when compiling for the TPF OS and specifying -mtpf-trace.
25464
25465 -mfused-madd
25466 -mno-fused-madd
25467 Generate code that uses (does not use) the floating-point multiply
25468 and accumulate instructions. These instructions are generated by
25469 default if hardware floating point is used.
25470
25471 -mwarn-framesize=framesize
25472 Emit a warning if the current function exceeds the given frame
25473 size. Because this is a compile-time check it doesn't need to be a
25474 real problem when the program runs. It is intended to identify
25475 functions that most probably cause a stack overflow. It is useful
25476 to be used in an environment with limited stack size e.g. the linux
25477 kernel.
25478
25479 -mwarn-dynamicstack
25480 Emit a warning if the function calls "alloca" or uses dynamically-
25481 sized arrays. This is generally a bad idea with a limited stack
25482 size.
25483
25484 -mstack-guard=stack-guard
25485 -mstack-size=stack-size
25486 If these options are provided the S/390 back end emits additional
25487 instructions in the function prologue that trigger a trap if the
25488 stack size is stack-guard bytes above the stack-size (remember that
25489 the stack on S/390 grows downward). If the stack-guard option is
25490 omitted the smallest power of 2 larger than the frame size of the
25491 compiled function is chosen. These options are intended to be used
25492 to help debugging stack overflow problems. The additionally
25493 emitted code causes only little overhead and hence can also be used
25494 in production-like systems without greater performance degradation.
25495 The given values have to be exact powers of 2 and stack-size has to
25496 be greater than stack-guard without exceeding 64k. In order to be
25497 efficient the extra code makes the assumption that the stack starts
25498 at an address aligned to the value given by stack-size. The stack-
25499 guard option can only be used in conjunction with stack-size.
25500
25501 -mhotpatch=pre-halfwords,post-halfwords
25502 If the hotpatch option is enabled, a "hot-patching" function
25503 prologue is generated for all functions in the compilation unit.
25504 The funtion label is prepended with the given number of two-byte
25505 NOP instructions (pre-halfwords, maximum 1000000). After the
25506 label, 2 * post-halfwords bytes are appended, using the largest NOP
25507 like instructions the architecture allows (maximum 1000000).
25508
25509 If both arguments are zero, hotpatching is disabled.
25510
25511 This option can be overridden for individual functions with the
25512 "hotpatch" attribute.
25513
25514 Score Options
25515 These options are defined for Score implementations:
25516
25517 -meb
25518 Compile code for big-endian mode. This is the default.
25519
25520 -mel
25521 Compile code for little-endian mode.
25522
25523 -mnhwloop
25524 Disable generation of "bcnz" instructions.
25525
25526 -muls
25527 Enable generation of unaligned load and store instructions.
25528
25529 -mmac
25530 Enable the use of multiply-accumulate instructions. Disabled by
25531 default.
25532
25533 -mscore5
25534 Specify the SCORE5 as the target architecture.
25535
25536 -mscore5u
25537 Specify the SCORE5U of the target architecture.
25538
25539 -mscore7
25540 Specify the SCORE7 as the target architecture. This is the default.
25541
25542 -mscore7d
25543 Specify the SCORE7D as the target architecture.
25544
25545 SH Options
25546 These -m options are defined for the SH implementations:
25547
25548 -m1 Generate code for the SH1.
25549
25550 -m2 Generate code for the SH2.
25551
25552 -m2e
25553 Generate code for the SH2e.
25554
25555 -m2a-nofpu
25556 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
25557 way that the floating-point unit is not used.
25558
25559 -m2a-single-only
25560 Generate code for the SH2a-FPU, in such a way that no double-
25561 precision floating-point operations are used.
25562
25563 -m2a-single
25564 Generate code for the SH2a-FPU assuming the floating-point unit is
25565 in single-precision mode by default.
25566
25567 -m2a
25568 Generate code for the SH2a-FPU assuming the floating-point unit is
25569 in double-precision mode by default.
25570
25571 -m3 Generate code for the SH3.
25572
25573 -m3e
25574 Generate code for the SH3e.
25575
25576 -m4-nofpu
25577 Generate code for the SH4 without a floating-point unit.
25578
25579 -m4-single-only
25580 Generate code for the SH4 with a floating-point unit that only
25581 supports single-precision arithmetic.
25582
25583 -m4-single
25584 Generate code for the SH4 assuming the floating-point unit is in
25585 single-precision mode by default.
25586
25587 -m4 Generate code for the SH4.
25588
25589 -m4-100
25590 Generate code for SH4-100.
25591
25592 -m4-100-nofpu
25593 Generate code for SH4-100 in such a way that the floating-point
25594 unit is not used.
25595
25596 -m4-100-single
25597 Generate code for SH4-100 assuming the floating-point unit is in
25598 single-precision mode by default.
25599
25600 -m4-100-single-only
25601 Generate code for SH4-100 in such a way that no double-precision
25602 floating-point operations are used.
25603
25604 -m4-200
25605 Generate code for SH4-200.
25606
25607 -m4-200-nofpu
25608 Generate code for SH4-200 without in such a way that the floating-
25609 point unit is not used.
25610
25611 -m4-200-single
25612 Generate code for SH4-200 assuming the floating-point unit is in
25613 single-precision mode by default.
25614
25615 -m4-200-single-only
25616 Generate code for SH4-200 in such a way that no double-precision
25617 floating-point operations are used.
25618
25619 -m4-300
25620 Generate code for SH4-300.
25621
25622 -m4-300-nofpu
25623 Generate code for SH4-300 without in such a way that the floating-
25624 point unit is not used.
25625
25626 -m4-300-single
25627 Generate code for SH4-300 in such a way that no double-precision
25628 floating-point operations are used.
25629
25630 -m4-300-single-only
25631 Generate code for SH4-300 in such a way that no double-precision
25632 floating-point operations are used.
25633
25634 -m4-340
25635 Generate code for SH4-340 (no MMU, no FPU).
25636
25637 -m4-500
25638 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
25639 assembler.
25640
25641 -m4a-nofpu
25642 Generate code for the SH4al-dsp, or for a SH4a in such a way that
25643 the floating-point unit is not used.
25644
25645 -m4a-single-only
25646 Generate code for the SH4a, in such a way that no double-precision
25647 floating-point operations are used.
25648
25649 -m4a-single
25650 Generate code for the SH4a assuming the floating-point unit is in
25651 single-precision mode by default.
25652
25653 -m4a
25654 Generate code for the SH4a.
25655
25656 -m4al
25657 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
25658 assembler. GCC doesn't generate any DSP instructions at the
25659 moment.
25660
25661 -mb Compile code for the processor in big-endian mode.
25662
25663 -ml Compile code for the processor in little-endian mode.
25664
25665 -mdalign
25666 Align doubles at 64-bit boundaries. Note that this changes the
25667 calling conventions, and thus some functions from the standard C
25668 library do not work unless you recompile it first with -mdalign.
25669
25670 -mrelax
25671 Shorten some address references at link time, when possible; uses
25672 the linker option -relax.
25673
25674 -mbigtable
25675 Use 32-bit offsets in "switch" tables. The default is to use
25676 16-bit offsets.
25677
25678 -mbitops
25679 Enable the use of bit manipulation instructions on SH2A.
25680
25681 -mfmovd
25682 Enable the use of the instruction "fmovd". Check -mdalign for
25683 alignment constraints.
25684
25685 -mrenesas
25686 Comply with the calling conventions defined by Renesas.
25687
25688 -mno-renesas
25689 Comply with the calling conventions defined for GCC before the
25690 Renesas conventions were available. This option is the default for
25691 all targets of the SH toolchain.
25692
25693 -mnomacsave
25694 Mark the "MAC" register as call-clobbered, even if -mrenesas is
25695 given.
25696
25697 -mieee
25698 -mno-ieee
25699 Control the IEEE compliance of floating-point comparisons, which
25700 affects the handling of cases where the result of a comparison is
25701 unordered. By default -mieee is implicitly enabled. If
25702 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
25703 results in faster floating-point greater-equal and less-equal
25704 comparisons. The implicit settings can be overridden by specifying
25705 either -mieee or -mno-ieee.
25706
25707 -minline-ic_invalidate
25708 Inline code to invalidate instruction cache entries after setting
25709 up nested function trampolines. This option has no effect if
25710 -musermode is in effect and the selected code generation option
25711 (e.g. -m4) does not allow the use of the "icbi" instruction. If
25712 the selected code generation option does not allow the use of the
25713 "icbi" instruction, and -musermode is not in effect, the inlined
25714 code manipulates the instruction cache address array directly with
25715 an associative write. This not only requires privileged mode at
25716 run time, but it also fails if the cache line had been mapped via
25717 the TLB and has become unmapped.
25718
25719 -misize
25720 Dump instruction size and location in the assembly code.
25721
25722 -mpadstruct
25723 This option is deprecated. It pads structures to multiple of 4
25724 bytes, which is incompatible with the SH ABI.
25725
25726 -matomic-model=model
25727 Sets the model of atomic operations and additional parameters as a
25728 comma separated list. For details on the atomic built-in functions
25729 see __atomic Builtins. The following models and parameters are
25730 supported:
25731
25732 none
25733 Disable compiler generated atomic sequences and emit library
25734 calls for atomic operations. This is the default if the target
25735 is not "sh*-*-linux*".
25736
25737 soft-gusa
25738 Generate GNU/Linux compatible gUSA software atomic sequences
25739 for the atomic built-in functions. The generated atomic
25740 sequences require additional support from the
25741 interrupt/exception handling code of the system and are only
25742 suitable for SH3* and SH4* single-core systems. This option is
25743 enabled by default when the target is "sh*-*-linux*" and SH3*
25744 or SH4*. When the target is SH4A, this option also partially
25745 utilizes the hardware atomic instructions "movli.l" and
25746 "movco.l" to create more efficient code, unless strict is
25747 specified.
25748
25749 soft-tcb
25750 Generate software atomic sequences that use a variable in the
25751 thread control block. This is a variation of the gUSA
25752 sequences which can also be used on SH1* and SH2* targets. The
25753 generated atomic sequences require additional support from the
25754 interrupt/exception handling code of the system and are only
25755 suitable for single-core systems. When using this model, the
25756 gbr-offset= parameter has to be specified as well.
25757
25758 soft-imask
25759 Generate software atomic sequences that temporarily disable
25760 interrupts by setting "SR.IMASK = 1111". This model works only
25761 when the program runs in privileged mode and is only suitable
25762 for single-core systems. Additional support from the
25763 interrupt/exception handling code of the system is not
25764 required. This model is enabled by default when the target is
25765 "sh*-*-linux*" and SH1* or SH2*.
25766
25767 hard-llcs
25768 Generate hardware atomic sequences using the "movli.l" and
25769 "movco.l" instructions only. This is only available on SH4A
25770 and is suitable for multi-core systems. Since the hardware
25771 instructions support only 32 bit atomic variables access to 8
25772 or 16 bit variables is emulated with 32 bit accesses. Code
25773 compiled with this option is also compatible with other
25774 software atomic model interrupt/exception handling systems if
25775 executed on an SH4A system. Additional support from the
25776 interrupt/exception handling code of the system is not required
25777 for this model.
25778
25779 gbr-offset=
25780 This parameter specifies the offset in bytes of the variable in
25781 the thread control block structure that should be used by the
25782 generated atomic sequences when the soft-tcb model has been
25783 selected. For other models this parameter is ignored. The
25784 specified value must be an integer multiple of four and in the
25785 range 0-1020.
25786
25787 strict
25788 This parameter prevents mixed usage of multiple atomic models,
25789 even if they are compatible, and makes the compiler generate
25790 atomic sequences of the specified model only.
25791
25792 -mtas
25793 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
25794 that depending on the particular hardware and software
25795 configuration this can degrade overall performance due to the
25796 operand cache line flushes that are implied by the "tas.b"
25797 instruction. On multi-core SH4A processors the "tas.b" instruction
25798 must be used with caution since it can result in data corruption
25799 for certain cache configurations.
25800
25801 -mprefergot
25802 When generating position-independent code, emit function calls
25803 using the Global Offset Table instead of the Procedure Linkage
25804 Table.
25805
25806 -musermode
25807 -mno-usermode
25808 Don't allow (allow) the compiler generating privileged mode code.
25809 Specifying -musermode also implies -mno-inline-ic_invalidate if the
25810 inlined code would not work in user mode. -musermode is the
25811 default when the target is "sh*-*-linux*". If the target is SH1*
25812 or SH2* -musermode has no effect, since there is no user mode.
25813
25814 -multcost=number
25815 Set the cost to assume for a multiply insn.
25816
25817 -mdiv=strategy
25818 Set the division strategy to be used for integer division
25819 operations. strategy can be one of:
25820
25821 call-div1
25822 Calls a library function that uses the single-step division
25823 instruction "div1" to perform the operation. Division by zero
25824 calculates an unspecified result and does not trap. This is
25825 the default except for SH4, SH2A and SHcompact.
25826
25827 call-fp
25828 Calls a library function that performs the operation in double
25829 precision floating point. Division by zero causes a floating-
25830 point exception. This is the default for SHcompact with FPU.
25831 Specifying this for targets that do not have a double precision
25832 FPU defaults to "call-div1".
25833
25834 call-table
25835 Calls a library function that uses a lookup table for small
25836 divisors and the "div1" instruction with case distinction for
25837 larger divisors. Division by zero calculates an unspecified
25838 result and does not trap. This is the default for SH4.
25839 Specifying this for targets that do not have dynamic shift
25840 instructions defaults to "call-div1".
25841
25842 When a division strategy has not been specified the default
25843 strategy is selected based on the current target. For SH2A the
25844 default strategy is to use the "divs" and "divu" instructions
25845 instead of library function calls.
25846
25847 -maccumulate-outgoing-args
25848 Reserve space once for outgoing arguments in the function prologue
25849 rather than around each call. Generally beneficial for performance
25850 and size. Also needed for unwinding to avoid changing the stack
25851 frame around conditional code.
25852
25853 -mdivsi3_libfunc=name
25854 Set the name of the library function used for 32-bit signed
25855 division to name. This only affects the name used in the call
25856 division strategies, and the compiler still expects the same sets
25857 of input/output/clobbered registers as if this option were not
25858 present.
25859
25860 -mfixed-range=register-range
25861 Generate code treating the given register range as fixed registers.
25862 A fixed register is one that the register allocator cannot use.
25863 This is useful when compiling kernel code. A register range is
25864 specified as two registers separated by a dash. Multiple register
25865 ranges can be specified separated by a comma.
25866
25867 -mbranch-cost=num
25868 Assume num to be the cost for a branch instruction. Higher numbers
25869 make the compiler try to generate more branch-free code if
25870 possible. If not specified the value is selected depending on the
25871 processor type that is being compiled for.
25872
25873 -mzdcbranch
25874 -mno-zdcbranch
25875 Assume (do not assume) that zero displacement conditional branch
25876 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
25877 the compiler prefers zero displacement branch code sequences. This
25878 is enabled by default when generating code for SH4 and SH4A. It
25879 can be explicitly disabled by specifying -mno-zdcbranch.
25880
25881 -mcbranch-force-delay-slot
25882 Force the usage of delay slots for conditional branches, which
25883 stuffs the delay slot with a "nop" if a suitable instruction cannot
25884 be found. By default this option is disabled. It can be enabled
25885 to work around hardware bugs as found in the original SH7055.
25886
25887 -mfused-madd
25888 -mno-fused-madd
25889 Generate code that uses (does not use) the floating-point multiply
25890 and accumulate instructions. These instructions are generated by
25891 default if hardware floating point is used. The machine-dependent
25892 -mfused-madd option is now mapped to the machine-independent
25893 -ffp-contract=fast option, and -mno-fused-madd is mapped to
25894 -ffp-contract=off.
25895
25896 -mfsca
25897 -mno-fsca
25898 Allow or disallow the compiler to emit the "fsca" instruction for
25899 sine and cosine approximations. The option -mfsca must be used in
25900 combination with -funsafe-math-optimizations. It is enabled by
25901 default when generating code for SH4A. Using -mno-fsca disables
25902 sine and cosine approximations even if -funsafe-math-optimizations
25903 is in effect.
25904
25905 -mfsrra
25906 -mno-fsrra
25907 Allow or disallow the compiler to emit the "fsrra" instruction for
25908 reciprocal square root approximations. The option -mfsrra must be
25909 used in combination with -funsafe-math-optimizations and
25910 -ffinite-math-only. It is enabled by default when generating code
25911 for SH4A. Using -mno-fsrra disables reciprocal square root
25912 approximations even if -funsafe-math-optimizations and
25913 -ffinite-math-only are in effect.
25914
25915 -mpretend-cmove
25916 Prefer zero-displacement conditional branches for conditional move
25917 instruction patterns. This can result in faster code on the SH4
25918 processor.
25919
25920 -mfdpic
25921 Generate code using the FDPIC ABI.
25922
25923 Solaris 2 Options
25924 These -m options are supported on Solaris 2:
25925
25926 -mclear-hwcap
25927 -mclear-hwcap tells the compiler to remove the hardware
25928 capabilities generated by the Solaris assembler. This is only
25929 necessary when object files use ISA extensions not supported by the
25930 current machine, but check at runtime whether or not to use them.
25931
25932 -mimpure-text
25933 -mimpure-text, used in addition to -shared, tells the compiler to
25934 not pass -z text to the linker when linking a shared object. Using
25935 this option, you can link position-dependent code into a shared
25936 object.
25937
25938 -mimpure-text suppresses the "relocations remain against
25939 allocatable but non-writable sections" linker error message.
25940 However, the necessary relocations trigger copy-on-write, and the
25941 shared object is not actually shared across processes. Instead of
25942 using -mimpure-text, you should compile all source code with -fpic
25943 or -fPIC.
25944
25945 These switches are supported in addition to the above on Solaris 2:
25946
25947 -pthreads
25948 This is a synonym for -pthread.
25949
25950 SPARC Options
25951 These -m options are supported on the SPARC:
25952
25953 -mno-app-regs
25954 -mapp-regs
25955 Specify -mapp-regs to generate output using the global registers 2
25956 through 4, which the SPARC SVR4 ABI reserves for applications.
25957 Like the global register 1, each global register 2 through 4 is
25958 then treated as an allocable register that is clobbered by function
25959 calls. This is the default.
25960
25961 To be fully SVR4 ABI-compliant at the cost of some performance
25962 loss, specify -mno-app-regs. You should compile libraries and
25963 system software with this option.
25964
25965 -mflat
25966 -mno-flat
25967 With -mflat, the compiler does not generate save/restore
25968 instructions and uses a "flat" or single register window model.
25969 This model is compatible with the regular register window model.
25970 The local registers and the input registers (0--5) are still
25971 treated as "call-saved" registers and are saved on the stack as
25972 needed.
25973
25974 With -mno-flat (the default), the compiler generates save/restore
25975 instructions (except for leaf functions). This is the normal
25976 operating mode.
25977
25978 -mfpu
25979 -mhard-float
25980 Generate output containing floating-point instructions. This is
25981 the default.
25982
25983 -mno-fpu
25984 -msoft-float
25985 Generate output containing library calls for floating point.
25986 Warning: the requisite libraries are not available for all SPARC
25987 targets. Normally the facilities of the machine's usual C compiler
25988 are used, but this cannot be done directly in cross-compilation.
25989 You must make your own arrangements to provide suitable library
25990 functions for cross-compilation. The embedded targets sparc-*-aout
25991 and sparclite-*-* do provide software floating-point support.
25992
25993 -msoft-float changes the calling convention in the output file;
25994 therefore, it is only useful if you compile all of a program with
25995 this option. In particular, you need to compile libgcc.a, the
25996 library that comes with GCC, with -msoft-float in order for this to
25997 work.
25998
25999 -mhard-quad-float
26000 Generate output containing quad-word (long double) floating-point
26001 instructions.
26002
26003 -msoft-quad-float
26004 Generate output containing library calls for quad-word (long
26005 double) floating-point instructions. The functions called are
26006 those specified in the SPARC ABI. This is the default.
26007
26008 As of this writing, there are no SPARC implementations that have
26009 hardware support for the quad-word floating-point instructions.
26010 They all invoke a trap handler for one of these instructions, and
26011 then the trap handler emulates the effect of the instruction.
26012 Because of the trap handler overhead, this is much slower than
26013 calling the ABI library routines. Thus the -msoft-quad-float
26014 option is the default.
26015
26016 -mno-unaligned-doubles
26017 -munaligned-doubles
26018 Assume that doubles have 8-byte alignment. This is the default.
26019
26020 With -munaligned-doubles, GCC assumes that doubles have 8-byte
26021 alignment only if they are contained in another type, or if they
26022 have an absolute address. Otherwise, it assumes they have 4-byte
26023 alignment. Specifying this option avoids some rare compatibility
26024 problems with code generated by other compilers. It is not the
26025 default because it results in a performance loss, especially for
26026 floating-point code.
26027
26028 -muser-mode
26029 -mno-user-mode
26030 Do not generate code that can only run in supervisor mode. This is
26031 relevant only for the "casa" instruction emitted for the LEON3
26032 processor. This is the default.
26033
26034 -mfaster-structs
26035 -mno-faster-structs
26036 With -mfaster-structs, the compiler assumes that structures should
26037 have 8-byte alignment. This enables the use of pairs of "ldd" and
26038 "std" instructions for copies in structure assignment, in place of
26039 twice as many "ld" and "st" pairs. However, the use of this
26040 changed alignment directly violates the SPARC ABI. Thus, it's
26041 intended only for use on targets where the developer acknowledges
26042 that their resulting code is not directly in line with the rules of
26043 the ABI.
26044
26045 -mstd-struct-return
26046 -mno-std-struct-return
26047 With -mstd-struct-return, the compiler generates checking code in
26048 functions returning structures or unions to detect size mismatches
26049 between the two sides of function calls, as per the 32-bit ABI.
26050
26051 The default is -mno-std-struct-return. This option has no effect
26052 in 64-bit mode.
26053
26054 -mlra
26055 -mno-lra
26056 Enable Local Register Allocation. This is the default for SPARC
26057 since GCC 7 so -mno-lra needs to be passed to get old Reload.
26058
26059 -mcpu=cpu_type
26060 Set the instruction set, register set, and instruction scheduling
26061 parameters for machine type cpu_type. Supported values for
26062 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
26063 leon3v7, leon5, sparclite, f930, f934, sparclite86x, sparclet,
26064 tsc701, v9, ultrasparc, ultrasparc3, niagara, niagara2, niagara3,
26065 niagara4, niagara7 and m8.
26066
26067 Native Solaris and GNU/Linux toolchains also support the value
26068 native, which selects the best architecture option for the host
26069 processor. -mcpu=native has no effect if GCC does not recognize
26070 the processor.
26071
26072 Default instruction scheduling parameters are used for values that
26073 select an architecture and not an implementation. These are v7,
26074 v8, sparclite, sparclet, v9.
26075
26076 Here is a list of each supported architecture and their supported
26077 implementations.
26078
26079 v7 cypress, leon3v7
26080
26081 v8 supersparc, hypersparc, leon, leon3, leon5
26082
26083 sparclite
26084 f930, f934, sparclite86x
26085
26086 sparclet
26087 tsc701
26088
26089 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26090 niagara7, m8
26091
26092 By default (unless configured otherwise), GCC generates code for
26093 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
26094 compiler additionally optimizes it for the Cypress CY7C602 chip, as
26095 used in the SPARCStation/SPARCServer 3xx series. This is also
26096 appropriate for the older SPARCStation 1, 2, IPX etc.
26097
26098 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
26099 architecture. The only difference from V7 code is that the
26100 compiler emits the integer multiply and integer divide instructions
26101 which exist in SPARC-V8 but not in SPARC-V7. With
26102 -mcpu=supersparc, the compiler additionally optimizes it for the
26103 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
26104 series.
26105
26106 With -mcpu=sparclite, GCC generates code for the SPARClite variant
26107 of the SPARC architecture. This adds the integer multiply, integer
26108 divide step and scan ("ffs") instructions which exist in SPARClite
26109 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
26110 optimizes it for the Fujitsu MB86930 chip, which is the original
26111 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
26112 optimizes it for the Fujitsu MB86934 chip, which is the more recent
26113 SPARClite with FPU.
26114
26115 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
26116 the SPARC architecture. This adds the integer multiply,
26117 multiply/accumulate, integer divide step and scan ("ffs")
26118 instructions which exist in SPARClet but not in SPARC-V7. With
26119 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
26120 SPARClet chip.
26121
26122 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
26123 architecture. This adds 64-bit integer and floating-point move
26124 instructions, 3 additional floating-point condition code registers
26125 and conditional move instructions. With -mcpu=ultrasparc, the
26126 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
26127 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
26128 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26129 -mcpu=niagara, the compiler additionally optimizes it for Sun
26130 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
26131 additionally optimizes it for Sun UltraSPARC T2 chips. With
26132 -mcpu=niagara3, the compiler additionally optimizes it for Sun
26133 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
26134 additionally optimizes it for Sun UltraSPARC T4 chips. With
26135 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
26136 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
26137 it for Oracle M8 chips.
26138
26139 -mtune=cpu_type
26140 Set the instruction scheduling parameters for machine type
26141 cpu_type, but do not set the instruction set or register set that
26142 the option -mcpu=cpu_type does.
26143
26144 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
26145 but the only useful values are those that select a particular CPU
26146 implementation. Those are cypress, supersparc, hypersparc, leon,
26147 leon3, leon3v7, leon5, f930, f934, sparclite86x, tsc701,
26148 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26149 niagara7 and m8. With native Solaris and GNU/Linux toolchains,
26150 native can also be used.
26151
26152 -mv8plus
26153 -mno-v8plus
26154 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
26155 difference from the V8 ABI is that the global and out registers are
26156 considered 64 bits wide. This is enabled by default on Solaris in
26157 32-bit mode for all SPARC-V9 processors.
26158
26159 -mvis
26160 -mno-vis
26161 With -mvis, GCC generates code that takes advantage of the
26162 UltraSPARC Visual Instruction Set extensions. The default is
26163 -mno-vis.
26164
26165 -mvis2
26166 -mno-vis2
26167 With -mvis2, GCC generates code that takes advantage of version 2.0
26168 of the UltraSPARC Visual Instruction Set extensions. The default
26169 is -mvis2 when targeting a cpu that supports such instructions,
26170 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
26171
26172 -mvis3
26173 -mno-vis3
26174 With -mvis3, GCC generates code that takes advantage of version 3.0
26175 of the UltraSPARC Visual Instruction Set extensions. The default
26176 is -mvis3 when targeting a cpu that supports such instructions,
26177 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
26178 -mvis.
26179
26180 -mvis4
26181 -mno-vis4
26182 With -mvis4, GCC generates code that takes advantage of version 4.0
26183 of the UltraSPARC Visual Instruction Set extensions. The default
26184 is -mvis4 when targeting a cpu that supports such instructions,
26185 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
26186 -mvis2 and -mvis.
26187
26188 -mvis4b
26189 -mno-vis4b
26190 With -mvis4b, GCC generates code that takes advantage of version
26191 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
26192 additional VIS instructions introduced in the Oracle SPARC
26193 Architecture 2017. The default is -mvis4b when targeting a cpu
26194 that supports such instructions, such as m8 and later. Setting
26195 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
26196
26197 -mcbcond
26198 -mno-cbcond
26199 With -mcbcond, GCC generates code that takes advantage of the
26200 UltraSPARC Compare-and-Branch-on-Condition instructions. The
26201 default is -mcbcond when targeting a CPU that supports such
26202 instructions, such as Niagara-4 and later.
26203
26204 -mfmaf
26205 -mno-fmaf
26206 With -mfmaf, GCC generates code that takes advantage of the
26207 UltraSPARC Fused Multiply-Add Floating-point instructions. The
26208 default is -mfmaf when targeting a CPU that supports such
26209 instructions, such as Niagara-3 and later.
26210
26211 -mfsmuld
26212 -mno-fsmuld
26213 With -mfsmuld, GCC generates code that takes advantage of the
26214 Floating-point Multiply Single to Double (FsMULd) instruction. The
26215 default is -mfsmuld when targeting a CPU supporting the
26216 architecture versions V8 or V9 with FPU except -mcpu=leon.
26217
26218 -mpopc
26219 -mno-popc
26220 With -mpopc, GCC generates code that takes advantage of the
26221 UltraSPARC Population Count instruction. The default is -mpopc
26222 when targeting a CPU that supports such an instruction, such as
26223 Niagara-2 and later.
26224
26225 -msubxc
26226 -mno-subxc
26227 With -msubxc, GCC generates code that takes advantage of the
26228 UltraSPARC Subtract-Extended-with-Carry instruction. The default
26229 is -msubxc when targeting a CPU that supports such an instruction,
26230 such as Niagara-7 and later.
26231
26232 -mfix-at697f
26233 Enable the documented workaround for the single erratum of the
26234 Atmel AT697F processor (which corresponds to erratum #13 of the
26235 AT697E processor).
26236
26237 -mfix-ut699
26238 Enable the documented workarounds for the floating-point errata and
26239 the data cache nullify errata of the UT699 processor.
26240
26241 -mfix-ut700
26242 Enable the documented workaround for the back-to-back store errata
26243 of the UT699E/UT700 processor.
26244
26245 -mfix-gr712rc
26246 Enable the documented workaround for the back-to-back store errata
26247 of the GR712RC processor.
26248
26249 These -m options are supported in addition to the above on SPARC-V9
26250 processors in 64-bit environments:
26251
26252 -m32
26253 -m64
26254 Generate code for a 32-bit or 64-bit environment. The 32-bit
26255 environment sets int, long and pointer to 32 bits. The 64-bit
26256 environment sets int to 32 bits and long and pointer to 64 bits.
26257
26258 -mcmodel=which
26259 Set the code model to one of
26260
26261 medlow
26262 The Medium/Low code model: 64-bit addresses, programs must be
26263 linked in the low 32 bits of memory. Programs can be
26264 statically or dynamically linked.
26265
26266 medmid
26267 The Medium/Middle code model: 64-bit addresses, programs must
26268 be linked in the low 44 bits of memory, the text and data
26269 segments must be less than 2GB in size and the data segment
26270 must be located within 2GB of the text segment.
26271
26272 medany
26273 The Medium/Anywhere code model: 64-bit addresses, programs may
26274 be linked anywhere in memory, the text and data segments must
26275 be less than 2GB in size and the data segment must be located
26276 within 2GB of the text segment.
26277
26278 embmedany
26279 The Medium/Anywhere code model for embedded systems: 64-bit
26280 addresses, the text and data segments must be less than 2GB in
26281 size, both starting anywhere in memory (determined at link
26282 time). The global register %g4 points to the base of the data
26283 segment. Programs are statically linked and PIC is not
26284 supported.
26285
26286 -mmemory-model=mem-model
26287 Set the memory model in force on the processor to one of
26288
26289 default
26290 The default memory model for the processor and operating
26291 system.
26292
26293 rmo Relaxed Memory Order
26294
26295 pso Partial Store Order
26296
26297 tso Total Store Order
26298
26299 sc Sequential Consistency
26300
26301 These memory models are formally defined in Appendix D of the
26302 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
26303 field.
26304
26305 -mstack-bias
26306 -mno-stack-bias
26307 With -mstack-bias, GCC assumes that the stack pointer, and frame
26308 pointer if present, are offset by -2047 which must be added back
26309 when making stack frame references. This is the default in 64-bit
26310 mode. Otherwise, assume no such offset is present.
26311
26312 Options for System V
26313 These additional options are available on System V Release 4 for
26314 compatibility with other compilers on those systems:
26315
26316 -G Create a shared object. It is recommended that -symbolic or
26317 -shared be used instead.
26318
26319 -Qy Identify the versions of each tool used by the compiler, in a
26320 ".ident" assembler directive in the output.
26321
26322 -Qn Refrain from adding ".ident" directives to the output file (this is
26323 the default).
26324
26325 -YP,dirs
26326 Search the directories dirs, and no others, for libraries specified
26327 with -l.
26328
26329 -Ym,dir
26330 Look in the directory dir to find the M4 preprocessor. The
26331 assembler uses this option.
26332
26333 TILE-Gx Options
26334 These -m options are supported on the TILE-Gx:
26335
26336 -mcmodel=small
26337 Generate code for the small model. The distance for direct calls
26338 is limited to 500M in either direction. PC-relative addresses are
26339 32 bits. Absolute addresses support the full address range.
26340
26341 -mcmodel=large
26342 Generate code for the large model. There is no limitation on call
26343 distance, pc-relative addresses, or absolute addresses.
26344
26345 -mcpu=name
26346 Selects the type of CPU to be targeted. Currently the only
26347 supported type is tilegx.
26348
26349 -m32
26350 -m64
26351 Generate code for a 32-bit or 64-bit environment. The 32-bit
26352 environment sets int, long, and pointer to 32 bits. The 64-bit
26353 environment sets int to 32 bits and long and pointer to 64 bits.
26354
26355 -mbig-endian
26356 -mlittle-endian
26357 Generate code in big/little endian mode, respectively.
26358
26359 TILEPro Options
26360 These -m options are supported on the TILEPro:
26361
26362 -mcpu=name
26363 Selects the type of CPU to be targeted. Currently the only
26364 supported type is tilepro.
26365
26366 -m32
26367 Generate code for a 32-bit environment, which sets int, long, and
26368 pointer to 32 bits. This is the only supported behavior so the
26369 flag is essentially ignored.
26370
26371 V850 Options
26372 These -m options are defined for V850 implementations:
26373
26374 -mlong-calls
26375 -mno-long-calls
26376 Treat all calls as being far away (near). If calls are assumed to
26377 be far away, the compiler always loads the function's address into
26378 a register, and calls indirect through the pointer.
26379
26380 -mno-ep
26381 -mep
26382 Do not optimize (do optimize) basic blocks that use the same index
26383 pointer 4 or more times to copy pointer into the "ep" register, and
26384 use the shorter "sld" and "sst" instructions. The -mep option is
26385 on by default if you optimize.
26386
26387 -mno-prolog-function
26388 -mprolog-function
26389 Do not use (do use) external functions to save and restore
26390 registers at the prologue and epilogue of a function. The external
26391 functions are slower, but use less code space if more than one
26392 function saves the same number of registers. The -mprolog-function
26393 option is on by default if you optimize.
26394
26395 -mspace
26396 Try to make the code as small as possible. At present, this just
26397 turns on the -mep and -mprolog-function options.
26398
26399 -mtda=n
26400 Put static or global variables whose size is n bytes or less into
26401 the tiny data area that register "ep" points to. The tiny data
26402 area can hold up to 256 bytes in total (128 bytes for byte
26403 references).
26404
26405 -msda=n
26406 Put static or global variables whose size is n bytes or less into
26407 the small data area that register "gp" points to. The small data
26408 area can hold up to 64 kilobytes.
26409
26410 -mzda=n
26411 Put static or global variables whose size is n bytes or less into
26412 the first 32 kilobytes of memory.
26413
26414 -mv850
26415 Specify that the target processor is the V850.
26416
26417 -mv850e3v5
26418 Specify that the target processor is the V850E3V5. The
26419 preprocessor constant "__v850e3v5__" is defined if this option is
26420 used.
26421
26422 -mv850e2v4
26423 Specify that the target processor is the V850E3V5. This is an
26424 alias for the -mv850e3v5 option.
26425
26426 -mv850e2v3
26427 Specify that the target processor is the V850E2V3. The
26428 preprocessor constant "__v850e2v3__" is defined if this option is
26429 used.
26430
26431 -mv850e2
26432 Specify that the target processor is the V850E2. The preprocessor
26433 constant "__v850e2__" is defined if this option is used.
26434
26435 -mv850e1
26436 Specify that the target processor is the V850E1. The preprocessor
26437 constants "__v850e1__" and "__v850e__" are defined if this option
26438 is used.
26439
26440 -mv850es
26441 Specify that the target processor is the V850ES. This is an alias
26442 for the -mv850e1 option.
26443
26444 -mv850e
26445 Specify that the target processor is the V850E. The preprocessor
26446 constant "__v850e__" is defined if this option is used.
26447
26448 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
26449 -mv850e2v3 nor -mv850e3v5 are defined then a default target
26450 processor is chosen and the relevant __v850*__ preprocessor
26451 constant is defined.
26452
26453 The preprocessor constants "__v850" and "__v851__" are always
26454 defined, regardless of which processor variant is the target.
26455
26456 -mdisable-callt
26457 -mno-disable-callt
26458 This option suppresses generation of the "CALLT" instruction for
26459 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
26460 v850 architecture.
26461
26462 This option is enabled by default when the RH850 ABI is in use (see
26463 -mrh850-abi), and disabled by default when the GCC ABI is in use.
26464 If "CALLT" instructions are being generated then the C preprocessor
26465 symbol "__V850_CALLT__" is defined.
26466
26467 -mrelax
26468 -mno-relax
26469 Pass on (or do not pass on) the -mrelax command-line option to the
26470 assembler.
26471
26472 -mlong-jumps
26473 -mno-long-jumps
26474 Disable (or re-enable) the generation of PC-relative jump
26475 instructions.
26476
26477 -msoft-float
26478 -mhard-float
26479 Disable (or re-enable) the generation of hardware floating point
26480 instructions. This option is only significant when the target
26481 architecture is V850E2V3 or higher. If hardware floating point
26482 instructions are being generated then the C preprocessor symbol
26483 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
26484 defined.
26485
26486 -mloop
26487 Enables the use of the e3v5 LOOP instruction. The use of this
26488 instruction is not enabled by default when the e3v5 architecture is
26489 selected because its use is still experimental.
26490
26491 -mrh850-abi
26492 -mghs
26493 Enables support for the RH850 version of the V850 ABI. This is the
26494 default. With this version of the ABI the following rules apply:
26495
26496 * Integer sized structures and unions are returned via a memory
26497 pointer rather than a register.
26498
26499 * Large structures and unions (more than 8 bytes in size) are
26500 passed by value.
26501
26502 * Functions are aligned to 16-bit boundaries.
26503
26504 * The -m8byte-align command-line option is supported.
26505
26506 * The -mdisable-callt command-line option is enabled by default.
26507 The -mno-disable-callt command-line option is not supported.
26508
26509 When this version of the ABI is enabled the C preprocessor symbol
26510 "__V850_RH850_ABI__" is defined.
26511
26512 -mgcc-abi
26513 Enables support for the old GCC version of the V850 ABI. With this
26514 version of the ABI the following rules apply:
26515
26516 * Integer sized structures and unions are returned in register
26517 "r10".
26518
26519 * Large structures and unions (more than 8 bytes in size) are
26520 passed by reference.
26521
26522 * Functions are aligned to 32-bit boundaries, unless optimizing
26523 for size.
26524
26525 * The -m8byte-align command-line option is not supported.
26526
26527 * The -mdisable-callt command-line option is supported but not
26528 enabled by default.
26529
26530 When this version of the ABI is enabled the C preprocessor symbol
26531 "__V850_GCC_ABI__" is defined.
26532
26533 -m8byte-align
26534 -mno-8byte-align
26535 Enables support for "double" and "long long" types to be aligned on
26536 8-byte boundaries. The default is to restrict the alignment of all
26537 objects to at most 4-bytes. When -m8byte-align is in effect the C
26538 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
26539
26540 -mbig-switch
26541 Generate code suitable for big switch tables. Use this option only
26542 if the assembler/linker complain about out of range branches within
26543 a switch table.
26544
26545 -mapp-regs
26546 This option causes r2 and r5 to be used in the code generated by
26547 the compiler. This setting is the default.
26548
26549 -mno-app-regs
26550 This option causes r2 and r5 to be treated as fixed registers.
26551
26552 VAX Options
26553 These -m options are defined for the VAX:
26554
26555 -munix
26556 Do not output certain jump instructions ("aobleq" and so on) that
26557 the Unix assembler for the VAX cannot handle across long ranges.
26558
26559 -mgnu
26560 Do output those jump instructions, on the assumption that the GNU
26561 assembler is being used.
26562
26563 -mg Output code for G-format floating-point numbers instead of
26564 D-format.
26565
26566 -mlra
26567 -mno-lra
26568 Enable Local Register Allocation. This is still experimental for
26569 the VAX, so by default the compiler uses standard reload.
26570
26571 Visium Options
26572 -mdebug
26573 A program which performs file I/O and is destined to run on an MCM
26574 target should be linked with this option. It causes the libraries
26575 libc.a and libdebug.a to be linked. The program should be run on
26576 the target under the control of the GDB remote debugging stub.
26577
26578 -msim
26579 A program which performs file I/O and is destined to run on the
26580 simulator should be linked with option. This causes libraries
26581 libc.a and libsim.a to be linked.
26582
26583 -mfpu
26584 -mhard-float
26585 Generate code containing floating-point instructions. This is the
26586 default.
26587
26588 -mno-fpu
26589 -msoft-float
26590 Generate code containing library calls for floating-point.
26591
26592 -msoft-float changes the calling convention in the output file;
26593 therefore, it is only useful if you compile all of a program with
26594 this option. In particular, you need to compile libgcc.a, the
26595 library that comes with GCC, with -msoft-float in order for this to
26596 work.
26597
26598 -mcpu=cpu_type
26599 Set the instruction set, register set, and instruction scheduling
26600 parameters for machine type cpu_type. Supported values for
26601 cpu_type are mcm, gr5 and gr6.
26602
26603 mcm is a synonym of gr5 present for backward compatibility.
26604
26605 By default (unless configured otherwise), GCC generates code for
26606 the GR5 variant of the Visium architecture.
26607
26608 With -mcpu=gr6, GCC generates code for the GR6 variant of the
26609 Visium architecture. The only difference from GR5 code is that the
26610 compiler will generate block move instructions.
26611
26612 -mtune=cpu_type
26613 Set the instruction scheduling parameters for machine type
26614 cpu_type, but do not set the instruction set or register set that
26615 the option -mcpu=cpu_type would.
26616
26617 -msv-mode
26618 Generate code for the supervisor mode, where there are no
26619 restrictions on the access to general registers. This is the
26620 default.
26621
26622 -muser-mode
26623 Generate code for the user mode, where the access to some general
26624 registers is forbidden: on the GR5, registers r24 to r31 cannot be
26625 accessed in this mode; on the GR6, only registers r29 to r31 are
26626 affected.
26627
26628 VMS Options
26629 These -m options are defined for the VMS implementations:
26630
26631 -mvms-return-codes
26632 Return VMS condition codes from "main". The default is to return
26633 POSIX-style condition (e.g. error) codes.
26634
26635 -mdebug-main=prefix
26636 Flag the first routine whose name starts with prefix as the main
26637 routine for the debugger.
26638
26639 -mmalloc64
26640 Default to 64-bit memory allocation routines.
26641
26642 -mpointer-size=size
26643 Set the default size of pointers. Possible options for size are 32
26644 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
26645 no for supporting only 32 bit pointers. The later option disables
26646 "pragma pointer_size".
26647
26648 VxWorks Options
26649 The options in this section are defined for all VxWorks targets.
26650 Options specific to the target hardware are listed with the other
26651 options for that target.
26652
26653 -mrtp
26654 GCC can generate code for both VxWorks kernels and real time
26655 processes (RTPs). This option switches from the former to the
26656 latter. It also defines the preprocessor macro "__RTP__".
26657
26658 -non-static
26659 Link an RTP executable against shared libraries rather than static
26660 libraries. The options -static and -shared can also be used for
26661 RTPs; -static is the default.
26662
26663 -Bstatic
26664 -Bdynamic
26665 These options are passed down to the linker. They are defined for
26666 compatibility with Diab.
26667
26668 -Xbind-lazy
26669 Enable lazy binding of function calls. This option is equivalent
26670 to -Wl,-z,now and is defined for compatibility with Diab.
26671
26672 -Xbind-now
26673 Disable lazy binding of function calls. This option is the default
26674 and is defined for compatibility with Diab.
26675
26676 x86 Options
26677 These -m options are defined for the x86 family of computers.
26678
26679 -march=cpu-type
26680 Generate instructions for the machine type cpu-type. In contrast
26681 to -mtune=cpu-type, which merely tunes the generated code for the
26682 specified cpu-type, -march=cpu-type allows GCC to generate code
26683 that may not run at all on processors other than the one indicated.
26684 Specifying -march=cpu-type implies -mtune=cpu-type, except where
26685 noted otherwise.
26686
26687 The choices for cpu-type are:
26688
26689 native
26690 This selects the CPU to generate code for at compilation time
26691 by determining the processor type of the compiling machine.
26692 Using -march=native enables all instruction subsets supported
26693 by the local machine (hence the result might not run on
26694 different machines). Using -mtune=native produces code
26695 optimized for the local machine under the constraints of the
26696 selected instruction set.
26697
26698 x86-64
26699 A generic CPU with 64-bit extensions.
26700
26701 x86-64-v2
26702 x86-64-v3
26703 x86-64-v4
26704 These choices for cpu-type select the corresponding micro-
26705 architecture level from the x86-64 psABI. On ABIs other than
26706 the x86-64 psABI they select the same CPU features as the
26707 x86-64 psABI documents for the particular micro-architecture
26708 level.
26709
26710 Since these cpu-type values do not have a corresponding -mtune
26711 setting, using -march with these values enables generic tuning.
26712 Specific tuning can be enabled using the -mtune=other-cpu-type
26713 option with an appropriate other-cpu-type value.
26714
26715 i386
26716 Original Intel i386 CPU.
26717
26718 i486
26719 Intel i486 CPU. (No scheduling is implemented for this chip.)
26720
26721 i586
26722 pentium
26723 Intel Pentium CPU with no MMX support.
26724
26725 lakemont
26726 Intel Lakemont MCU, based on Intel Pentium CPU.
26727
26728 pentium-mmx
26729 Intel Pentium MMX CPU, based on Pentium core with MMX
26730 instruction set support.
26731
26732 pentiumpro
26733 Intel Pentium Pro CPU.
26734
26735 i686
26736 When used with -march, the Pentium Pro instruction set is used,
26737 so the code runs on all i686 family chips. When used with
26738 -mtune, it has the same meaning as generic.
26739
26740 pentium2
26741 Intel Pentium II CPU, based on Pentium Pro core with MMX and
26742 FXSR instruction set support.
26743
26744 pentium3
26745 pentium3m
26746 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR
26747 and SSE instruction set support.
26748
26749 pentium-m
26750 Intel Pentium M; low-power version of Intel Pentium III CPU
26751 with MMX, SSE, SSE2 and FXSR instruction set support. Used by
26752 Centrino notebooks.
26753
26754 pentium4
26755 pentium4m
26756 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction
26757 set support.
26758
26759 prescott
26760 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2,
26761 SSE3 and FXSR instruction set support.
26762
26763 nocona
26764 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
26765 MMX, SSE, SSE2, SSE3 and FXSR instruction set support.
26766
26767 core2
26768 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
26769 SSSE3, CX16, SAHF and FXSR instruction set support.
26770
26771 nehalem
26772 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
26773 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction
26774 set support.
26775
26776 westmere
26777 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
26778 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and
26779 PCLMUL instruction set support.
26780
26781 sandybridge
26782 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
26783 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
26784 XSAVE and PCLMUL instruction set support.
26785
26786 ivybridge
26787 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
26788 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
26789 XSAVE, PCLMUL, FSGSBASE, RDRND and F16C instruction set
26790 support.
26791
26792 haswell
26793 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
26794 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26795 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26796 LZCNT, FMA, MOVBE and HLE instruction set support.
26797
26798 broadwell
26799 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
26800 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26801 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26802 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW instruction
26803 set support.
26804
26805 skylake
26806 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26807 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26808 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26809 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26810 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
26811
26812 bonnell
26813 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
26814 SSE2, SSE3 and SSSE3 instruction set support.
26815
26816 silvermont
26817 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
26818 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26819 PCLMUL, PREFETCHW and RDRND instruction set support.
26820
26821 goldmont
26822 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
26823 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26824 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
26825 XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction set
26826 support.
26827
26828 goldmont-plus
26829 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
26830 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26831 FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE,
26832 XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID
26833 and SGX instruction set support.
26834
26835 tremont
26836 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
26837 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26838 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
26839 XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID, SGX,
26840 CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG
26841 instruction set support.
26842
26843 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
26844 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26845 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26846 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
26847 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1
26848 instruction set support.
26849
26850 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
26851 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26852 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26853 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AVX512PF,
26854 AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
26855 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
26856
26857 skylake-avx512
26858 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
26859 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26860 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26861 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26862 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
26863 AVX512BW, AVX512DQ and AVX512CD instruction set support.
26864
26865 cannonlake
26866 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX,
26867 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26868 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26869 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26870 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26871 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA
26872 instruction set support.
26873
26874 icelake-client
26875 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX,
26876 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26877 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26878 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26879 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26880 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
26881 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
26882 RDPID and AVX512VPOPCNTDQ instruction set support.
26883
26884 icelake-server
26885 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
26886 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26887 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26888 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26889 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26890 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
26891 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
26892 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB instruction
26893 set support.
26894
26895 cascadelake
26896 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26897 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26898 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26899 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26900 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
26901 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
26902 support.
26903
26904 cooperlake
26905 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26906 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26907 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26908 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26909 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
26910 AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16
26911 instruction set support.
26912
26913 tigerlake
26914 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26915 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26916 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26917 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26918 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26919 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
26920 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
26921 RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
26922 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
26923
26924 sapphirerapids
26925 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX,
26926 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26927 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26928 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26929 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26930 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
26931 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
26932 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI,
26933 MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE,
26934 TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI,
26935 AVX512FP16 and AVX512BF16 instruction set support.
26936
26937 alderlake
26938 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26939 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
26940 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
26941 PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
26942 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
26943 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
26944 WIDEKL and AVX-VNNI instruction set support.
26945
26946 rocketlake
26947 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26948 SSE2, SSE3, SSSE3 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26949 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26950 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26951 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW,
26952 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
26953 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
26954 RDPID and AVX512VPOPCNTDQ instruction set support.
26955
26956 k6 AMD K6 CPU with MMX instruction set support.
26957
26958 k6-2
26959 k6-3
26960 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
26961 set support.
26962
26963 athlon
26964 athlon-tbird
26965 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
26966 prefetch instructions support.
26967
26968 athlon-4
26969 athlon-xp
26970 athlon-mp
26971 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
26972 full SSE instruction set support.
26973
26974 k8
26975 opteron
26976 athlon64
26977 athlon-fx
26978 Processors based on the AMD K8 core with x86-64 instruction set
26979 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
26980 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
26981 3DNow! and 64-bit instruction set extensions.)
26982
26983 k8-sse3
26984 opteron-sse3
26985 athlon64-sse3
26986 Improved versions of AMD K8 cores with SSE3 instruction set
26987 support.
26988
26989 amdfam10
26990 barcelona
26991 CPUs based on AMD Family 10h cores with x86-64 instruction set
26992 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
26993 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
26994
26995 bdver1
26996 CPUs based on AMD Family 15h cores with x86-64 instruction set
26997 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL,
26998 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
26999 and 64-bit instruction set extensions.)
27000
27001 bdver2
27002 AMD Family 15h core based CPUs with x86-64 instruction set
27003 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
27004 LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27005 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27006
27007 bdver3
27008 AMD Family 15h core based CPUs with x86-64 instruction set
27009 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
27010 AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27011 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27012 extensions.)
27013
27014 bdver4
27015 AMD Family 15h core based CPUs with x86-64 instruction set
27016 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
27017 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX,
27018 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
27019 instruction set extensions.)
27020
27021 znver1
27022 AMD Family 17h core based CPUs with x86-64 instruction set
27023 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
27024 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16,
27025 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
27026 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
27027 extensions.)
27028
27029 znver2
27030 AMD Family 17h core based CPUs with x86-64 instruction set
27031 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
27032 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
27033 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27034 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
27035 WBNOINVD, and 64-bit instruction set extensions.)
27036
27037 znver3
27038 AMD Family 19h core based CPUs with x86-64 instruction set
27039 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
27040 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
27041 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27042 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
27043 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set
27044 extensions.)
27045
27046 btver1
27047 CPUs based on AMD Family 14h cores with x86-64 instruction set
27048 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
27049 CX16, ABM and 64-bit instruction set extensions.)
27050
27051 btver2
27052 CPUs based on AMD Family 16h cores with x86-64 instruction set
27053 support. This includes MOVBE, F16C, BMI, AVX, PCLMUL, AES,
27054 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
27055 and 64-bit instruction set extensions.
27056
27057 winchip-c6
27058 IDT WinChip C6 CPU, dealt in same way as i486 with additional
27059 MMX instruction set support.
27060
27061 winchip2
27062 IDT WinChip 2 CPU, dealt in same way as i486 with additional
27063 MMX and 3DNow! instruction set support.
27064
27065 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
27066 scheduling is implemented for this chip.)
27067
27068 c3-2
27069 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
27070 support. (No scheduling is implemented for this chip.)
27071
27072 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
27073 set support. (No scheduling is implemented for this chip.)
27074
27075 samuel-2
27076 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
27077 support. (No scheduling is implemented for this chip.)
27078
27079 nehemiah
27080 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27081 (No scheduling is implemented for this chip.)
27082
27083 esther
27084 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
27085 set support. (No scheduling is implemented for this chip.)
27086
27087 eden-x2
27088 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
27089 instruction set support. (No scheduling is implemented for
27090 this chip.)
27091
27092 eden-x4
27093 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
27094 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
27095 scheduling is implemented for this chip.)
27096
27097 nano
27098 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
27099 SSSE3 instruction set support. (No scheduling is implemented
27100 for this chip.)
27101
27102 nano-1000
27103 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27104 instruction set support. (No scheduling is implemented for
27105 this chip.)
27106
27107 nano-2000
27108 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27109 instruction set support. (No scheduling is implemented for
27110 this chip.)
27111
27112 nano-3000
27113 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
27114 SSE4.1 instruction set support. (No scheduling is implemented
27115 for this chip.)
27116
27117 nano-x2
27118 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
27119 and SSE4.1 instruction set support. (No scheduling is
27120 implemented for this chip.)
27121
27122 nano-x4
27123 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
27124 and SSE4.1 instruction set support. (No scheduling is
27125 implemented for this chip.)
27126
27127 geode
27128 AMD Geode embedded processor with MMX and 3DNow! instruction
27129 set support.
27130
27131 -mtune=cpu-type
27132 Tune to cpu-type everything applicable about the generated code,
27133 except for the ABI and the set of available instructions. While
27134 picking a specific cpu-type schedules things appropriately for that
27135 particular chip, the compiler does not generate any code that
27136 cannot run on the default machine type unless you use a -march=cpu-
27137 type option. For example, if GCC is configured for
27138 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
27139 for Pentium 4 but still runs on i686 machines.
27140
27141 The choices for cpu-type are the same as for -march. In addition,
27142 -mtune supports 2 extra choices for cpu-type:
27143
27144 generic
27145 Produce code optimized for the most common IA32/AMD64/EM64T
27146 processors. If you know the CPU on which your code will run,
27147 then you should use the corresponding -mtune or -march option
27148 instead of -mtune=generic. But, if you do not know exactly
27149 what CPU users of your application will have, then you should
27150 use this option.
27151
27152 As new processors are deployed in the marketplace, the behavior
27153 of this option will change. Therefore, if you upgrade to a
27154 newer version of GCC, code generation controlled by this option
27155 will change to reflect the processors that are most common at
27156 the time that version of GCC is released.
27157
27158 There is no -march=generic option because -march indicates the
27159 instruction set the compiler can use, and there is no generic
27160 instruction set applicable to all processors. In contrast,
27161 -mtune indicates the processor (or, in this case, collection of
27162 processors) for which the code is optimized.
27163
27164 intel
27165 Produce code optimized for the most current Intel processors,
27166 which are Haswell and Silvermont for this version of GCC. If
27167 you know the CPU on which your code will run, then you should
27168 use the corresponding -mtune or -march option instead of
27169 -mtune=intel. But, if you want your application performs
27170 better on both Haswell and Silvermont, then you should use this
27171 option.
27172
27173 As new Intel processors are deployed in the marketplace, the
27174 behavior of this option will change. Therefore, if you upgrade
27175 to a newer version of GCC, code generation controlled by this
27176 option will change to reflect the most current Intel processors
27177 at the time that version of GCC is released.
27178
27179 There is no -march=intel option because -march indicates the
27180 instruction set the compiler can use, and there is no common
27181 instruction set applicable to all processors. In contrast,
27182 -mtune indicates the processor (or, in this case, collection of
27183 processors) for which the code is optimized.
27184
27185 -mcpu=cpu-type
27186 A deprecated synonym for -mtune.
27187
27188 -mfpmath=unit
27189 Generate floating-point arithmetic for selected unit unit. The
27190 choices for unit are:
27191
27192 387 Use the standard 387 floating-point coprocessor present on the
27193 majority of chips and emulated otherwise. Code compiled with
27194 this option runs almost everywhere. The temporary results are
27195 computed in 80-bit precision instead of the precision specified
27196 by the type, resulting in slightly different results compared
27197 to most of other chips. See -ffloat-store for more detailed
27198 description.
27199
27200 This is the default choice for non-Darwin x86-32 targets.
27201
27202 sse Use scalar floating-point instructions present in the SSE
27203 instruction set. This instruction set is supported by Pentium
27204 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
27205 and Athlon MP chips. The earlier version of the SSE
27206 instruction set supports only single-precision arithmetic, thus
27207 the double and extended-precision arithmetic are still done
27208 using 387. A later version, present only in Pentium 4 and AMD
27209 x86-64 chips, supports double-precision arithmetic too.
27210
27211 For the x86-32 compiler, you must use -march=cpu-type, -msse or
27212 -msse2 switches to enable SSE extensions and make this option
27213 effective. For the x86-64 compiler, these extensions are
27214 enabled by default.
27215
27216 The resulting code should be considerably faster in the
27217 majority of cases and avoid the numerical instability problems
27218 of 387 code, but may break some existing code that expects
27219 temporaries to be 80 bits.
27220
27221 This is the default choice for the x86-64 compiler, Darwin
27222 x86-32 targets, and the default choice for x86-32 targets with
27223 the SSE2 instruction set when -ffast-math is enabled.
27224
27225 sse,387
27226 sse+387
27227 both
27228 Attempt to utilize both instruction sets at once. This
27229 effectively doubles the amount of available registers, and on
27230 chips with separate execution units for 387 and SSE the
27231 execution resources too. Use this option with care, as it is
27232 still experimental, because the GCC register allocator does not
27233 model separate functional units well, resulting in unstable
27234 performance.
27235
27236 -masm=dialect
27237 Output assembly instructions using selected dialect. Also affects
27238 which dialect is used for basic "asm" and extended "asm". Supported
27239 choices (in dialect order) are att or intel. The default is att.
27240 Darwin does not support intel.
27241
27242 -mieee-fp
27243 -mno-ieee-fp
27244 Control whether or not the compiler uses IEEE floating-point
27245 comparisons. These correctly handle the case where the result of a
27246 comparison is unordered.
27247
27248 -m80387
27249 -mhard-float
27250 Generate output containing 80387 instructions for floating point.
27251
27252 -mno-80387
27253 -msoft-float
27254 Generate output containing library calls for floating point.
27255
27256 Warning: the requisite libraries are not part of GCC. Normally the
27257 facilities of the machine's usual C compiler are used, but this
27258 cannot be done directly in cross-compilation. You must make your
27259 own arrangements to provide suitable library functions for cross-
27260 compilation.
27261
27262 On machines where a function returns floating-point results in the
27263 80387 register stack, some floating-point opcodes may be emitted
27264 even if -msoft-float is used.
27265
27266 -mno-fp-ret-in-387
27267 Do not use the FPU registers for return values of functions.
27268
27269 The usual calling convention has functions return values of types
27270 "float" and "double" in an FPU register, even if there is no FPU.
27271 The idea is that the operating system should emulate an FPU.
27272
27273 The option -mno-fp-ret-in-387 causes such values to be returned in
27274 ordinary CPU registers instead.
27275
27276 -mno-fancy-math-387
27277 Some 387 emulators do not support the "sin", "cos" and "sqrt"
27278 instructions for the 387. Specify this option to avoid generating
27279 those instructions. This option is overridden when -march
27280 indicates that the target CPU always has an FPU and so the
27281 instruction does not need emulation. These instructions are not
27282 generated unless you also use the -funsafe-math-optimizations
27283 switch.
27284
27285 -malign-double
27286 -mno-align-double
27287 Control whether GCC aligns "double", "long double", and "long long"
27288 variables on a two-word boundary or a one-word boundary. Aligning
27289 "double" variables on a two-word boundary produces code that runs
27290 somewhat faster on a Pentium at the expense of more memory.
27291
27292 On x86-64, -malign-double is enabled by default.
27293
27294 Warning: if you use the -malign-double switch, structures
27295 containing the above types are aligned differently than the
27296 published application binary interface specifications for the
27297 x86-32 and are not binary compatible with structures in code
27298 compiled without that switch.
27299
27300 -m96bit-long-double
27301 -m128bit-long-double
27302 These switches control the size of "long double" type. The x86-32
27303 application binary interface specifies the size to be 96 bits, so
27304 -m96bit-long-double is the default in 32-bit mode.
27305
27306 Modern architectures (Pentium and newer) prefer "long double" to be
27307 aligned to an 8- or 16-byte boundary. In arrays or structures
27308 conforming to the ABI, this is not possible. So specifying
27309 -m128bit-long-double aligns "long double" to a 16-byte boundary by
27310 padding the "long double" with an additional 32-bit zero.
27311
27312 In the x86-64 compiler, -m128bit-long-double is the default choice
27313 as its ABI specifies that "long double" is aligned on 16-byte
27314 boundary.
27315
27316 Notice that neither of these options enable any extra precision
27317 over the x87 standard of 80 bits for a "long double".
27318
27319 Warning: if you override the default value for your target ABI,
27320 this changes the size of structures and arrays containing "long
27321 double" variables, as well as modifying the function calling
27322 convention for functions taking "long double". Hence they are not
27323 binary-compatible with code compiled without that switch.
27324
27325 -mlong-double-64
27326 -mlong-double-80
27327 -mlong-double-128
27328 These switches control the size of "long double" type. A size of 64
27329 bits makes the "long double" type equivalent to the "double" type.
27330 This is the default for 32-bit Bionic C library. A size of 128
27331 bits makes the "long double" type equivalent to the "__float128"
27332 type. This is the default for 64-bit Bionic C library.
27333
27334 Warning: if you override the default value for your target ABI,
27335 this changes the size of structures and arrays containing "long
27336 double" variables, as well as modifying the function calling
27337 convention for functions taking "long double". Hence they are not
27338 binary-compatible with code compiled without that switch.
27339
27340 -malign-data=type
27341 Control how GCC aligns variables. Supported values for type are
27342 compat uses increased alignment value compatible uses GCC 4.8 and
27343 earlier, abi uses alignment value as specified by the psABI, and
27344 cacheline uses increased alignment value to match the cache line
27345 size. compat is the default.
27346
27347 -mlarge-data-threshold=threshold
27348 When -mcmodel=medium is specified, data objects larger than
27349 threshold are placed in the large data section. This value must be
27350 the same across all objects linked into the binary, and defaults to
27351 65535.
27352
27353 -mrtd
27354 Use a different function-calling convention, in which functions
27355 that take a fixed number of arguments return with the "ret num"
27356 instruction, which pops their arguments while returning. This
27357 saves one instruction in the caller since there is no need to pop
27358 the arguments there.
27359
27360 You can specify that an individual function is called with this
27361 calling sequence with the function attribute "stdcall". You can
27362 also override the -mrtd option by using the function attribute
27363 "cdecl".
27364
27365 Warning: this calling convention is incompatible with the one
27366 normally used on Unix, so you cannot use it if you need to call
27367 libraries compiled with the Unix compiler.
27368
27369 Also, you must provide function prototypes for all functions that
27370 take variable numbers of arguments (including "printf"); otherwise
27371 incorrect code is generated for calls to those functions.
27372
27373 In addition, seriously incorrect code results if you call a
27374 function with too many arguments. (Normally, extra arguments are
27375 harmlessly ignored.)
27376
27377 -mregparm=num
27378 Control how many registers are used to pass integer arguments. By
27379 default, no registers are used to pass arguments, and at most 3
27380 registers can be used. You can control this behavior for a
27381 specific function by using the function attribute "regparm".
27382
27383 Warning: if you use this switch, and num is nonzero, then you must
27384 build all modules with the same value, including any libraries.
27385 This includes the system libraries and startup modules.
27386
27387 -msseregparm
27388 Use SSE register passing conventions for float and double arguments
27389 and return values. You can control this behavior for a specific
27390 function by using the function attribute "sseregparm".
27391
27392 Warning: if you use this switch then you must build all modules
27393 with the same value, including any libraries. This includes the
27394 system libraries and startup modules.
27395
27396 -mvect8-ret-in-mem
27397 Return 8-byte vectors in memory instead of MMX registers. This is
27398 the default on VxWorks to match the ABI of the Sun Studio compilers
27399 until version 12. Only use this option if you need to remain
27400 compatible with existing code produced by those previous compiler
27401 versions or older versions of GCC.
27402
27403 -mpc32
27404 -mpc64
27405 -mpc80
27406 Set 80387 floating-point precision to 32, 64 or 80 bits. When
27407 -mpc32 is specified, the significands of results of floating-point
27408 operations are rounded to 24 bits (single precision); -mpc64 rounds
27409 the significands of results of floating-point operations to 53 bits
27410 (double precision) and -mpc80 rounds the significands of results of
27411 floating-point operations to 64 bits (extended double precision),
27412 which is the default. When this option is used, floating-point
27413 operations in higher precisions are not available to the programmer
27414 without setting the FPU control word explicitly.
27415
27416 Setting the rounding of floating-point operations to less than the
27417 default 80 bits can speed some programs by 2% or more. Note that
27418 some mathematical libraries assume that extended-precision (80-bit)
27419 floating-point operations are enabled by default; routines in such
27420 libraries could suffer significant loss of accuracy, typically
27421 through so-called "catastrophic cancellation", when this option is
27422 used to set the precision to less than extended precision.
27423
27424 -mstackrealign
27425 Realign the stack at entry. On the x86, the -mstackrealign option
27426 generates an alternate prologue and epilogue that realigns the run-
27427 time stack if necessary. This supports mixing legacy codes that
27428 keep 4-byte stack alignment with modern codes that keep 16-byte
27429 stack alignment for SSE compatibility. See also the attribute
27430 "force_align_arg_pointer", applicable to individual functions.
27431
27432 -mpreferred-stack-boundary=num
27433 Attempt to keep the stack boundary aligned to a 2 raised to num
27434 byte boundary. If -mpreferred-stack-boundary is not specified, the
27435 default is 4 (16 bytes or 128 bits).
27436
27437 Warning: When generating code for the x86-64 architecture with SSE
27438 extensions disabled, -mpreferred-stack-boundary=3 can be used to
27439 keep the stack boundary aligned to 8 byte boundary. Since x86-64
27440 ABI require 16 byte stack alignment, this is ABI incompatible and
27441 intended to be used in controlled environment where stack space is
27442 important limitation. This option leads to wrong code when
27443 functions compiled with 16 byte stack alignment (such as functions
27444 from a standard library) are called with misaligned stack. In this
27445 case, SSE instructions may lead to misaligned memory access traps.
27446 In addition, variable arguments are handled incorrectly for 16 byte
27447 aligned objects (including x87 long double and __int128), leading
27448 to wrong results. You must build all modules with
27449 -mpreferred-stack-boundary=3, including any libraries. This
27450 includes the system libraries and startup modules.
27451
27452 -mincoming-stack-boundary=num
27453 Assume the incoming stack is aligned to a 2 raised to num byte
27454 boundary. If -mincoming-stack-boundary is not specified, the one
27455 specified by -mpreferred-stack-boundary is used.
27456
27457 On Pentium and Pentium Pro, "double" and "long double" values
27458 should be aligned to an 8-byte boundary (see -malign-double) or
27459 suffer significant run time performance penalties. On Pentium III,
27460 the Streaming SIMD Extension (SSE) data type "__m128" may not work
27461 properly if it is not 16-byte aligned.
27462
27463 To ensure proper alignment of this values on the stack, the stack
27464 boundary must be as aligned as that required by any value stored on
27465 the stack. Further, every function must be generated such that it
27466 keeps the stack aligned. Thus calling a function compiled with a
27467 higher preferred stack boundary from a function compiled with a
27468 lower preferred stack boundary most likely misaligns the stack. It
27469 is recommended that libraries that use callbacks always use the
27470 default setting.
27471
27472 This extra alignment does consume extra stack space, and generally
27473 increases code size. Code that is sensitive to stack space usage,
27474 such as embedded systems and operating system kernels, may want to
27475 reduce the preferred alignment to -mpreferred-stack-boundary=2.
27476
27477 -mmmx
27478 -msse
27479 -msse2
27480 -msse3
27481 -mssse3
27482 -msse4
27483 -msse4a
27484 -msse4.1
27485 -msse4.2
27486 -mavx
27487 -mavx2
27488 -mavx512f
27489 -mavx512pf
27490 -mavx512er
27491 -mavx512cd
27492 -mavx512vl
27493 -mavx512bw
27494 -mavx512dq
27495 -mavx512ifma
27496 -mavx512vbmi
27497 -msha
27498 -maes
27499 -mpclmul
27500 -mclflushopt
27501 -mclwb
27502 -mfsgsbase
27503 -mptwrite
27504 -mrdrnd
27505 -mf16c
27506 -mfma
27507 -mpconfig
27508 -mwbnoinvd
27509 -mfma4
27510 -mprfchw
27511 -mrdpid
27512 -mprefetchwt1
27513 -mrdseed
27514 -msgx
27515 -mxop
27516 -mlwp
27517 -m3dnow
27518 -m3dnowa
27519 -mpopcnt
27520 -mabm
27521 -madx
27522 -mbmi
27523 -mbmi2
27524 -mlzcnt
27525 -mfxsr
27526 -mxsave
27527 -mxsaveopt
27528 -mxsavec
27529 -mxsaves
27530 -mrtm
27531 -mhle
27532 -mtbm
27533 -mmwaitx
27534 -mclzero
27535 -mpku
27536 -mavx512vbmi2
27537 -mavx512bf16
27538 -mavx512fp16
27539 -mgfni
27540 -mvaes
27541 -mwaitpkg
27542 -mvpclmulqdq
27543 -mavx512bitalg
27544 -mmovdiri
27545 -mmovdir64b
27546 -menqcmd
27547 -muintr
27548 -mtsxldtrk
27549 -mavx512vpopcntdq
27550 -mavx512vp2intersect
27551 -mavx5124fmaps
27552 -mavx512vnni
27553 -mavxvnni
27554 -mavx5124vnniw
27555 -mcldemote
27556 -mserialize
27557 -mamx-tile
27558 -mamx-int8
27559 -mamx-bf16
27560 -mhreset
27561 -mkl
27562 -mwidekl
27563 These switches enable the use of instructions in the MMX, SSE,
27564 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
27565 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
27566 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
27567 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
27568 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
27569 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
27570 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
27571 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
27572 MOVDIRI, MOVDIR64B, AVX512BF16, ENQCMD, AVX512VPOPCNTDQ,
27573 AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE, UINTR, HRESET,
27574 AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512FP16 or
27575 CLDEMOTE extended instruction sets. Each has a corresponding -mno-
27576 option to disable use of these instructions.
27577
27578 These extensions are also available as built-in functions: see x86
27579 Built-in Functions, for details of the functions enabled and
27580 disabled by these switches.
27581
27582 To generate SSE/SSE2 instructions automatically from floating-point
27583 code (as opposed to 387 instructions), see -mfpmath=sse.
27584
27585 GCC depresses SSEx instructions when -mavx is used. Instead, it
27586 generates new AVX instructions or AVX equivalence for all SSEx
27587 instructions when needed.
27588
27589 These options enable GCC to use these extended instructions in
27590 generated code, even without -mfpmath=sse. Applications that
27591 perform run-time CPU detection must compile separate files for each
27592 supported architecture, using the appropriate flags. In
27593 particular, the file containing the CPU detection code should be
27594 compiled without these options.
27595
27596 -mdump-tune-features
27597 This option instructs GCC to dump the names of the x86 performance
27598 tuning features and default settings. The names can be used in
27599 -mtune-ctrl=feature-list.
27600
27601 -mtune-ctrl=feature-list
27602 This option is used to do fine grain control of x86 code generation
27603 features. feature-list is a comma separated list of feature names.
27604 See also -mdump-tune-features. When specified, the feature is
27605 turned on if it is not preceded with ^, otherwise, it is turned
27606 off. -mtune-ctrl=feature-list is intended to be used by GCC
27607 developers. Using it may lead to code paths not covered by testing
27608 and can potentially result in compiler ICEs or runtime errors.
27609
27610 -mno-default
27611 This option instructs GCC to turn off all tunable features. See
27612 also -mtune-ctrl=feature-list and -mdump-tune-features.
27613
27614 -mcld
27615 This option instructs GCC to emit a "cld" instruction in the
27616 prologue of functions that use string instructions. String
27617 instructions depend on the DF flag to select between autoincrement
27618 or autodecrement mode. While the ABI specifies the DF flag to be
27619 cleared on function entry, some operating systems violate this
27620 specification by not clearing the DF flag in their exception
27621 dispatchers. The exception handler can be invoked with the DF flag
27622 set, which leads to wrong direction mode when string instructions
27623 are used. This option can be enabled by default on 32-bit x86
27624 targets by configuring GCC with the --enable-cld configure option.
27625 Generation of "cld" instructions can be suppressed with the
27626 -mno-cld compiler option in this case.
27627
27628 -mvzeroupper
27629 This option instructs GCC to emit a "vzeroupper" instruction before
27630 a transfer of control flow out of the function to minimize the AVX
27631 to SSE transition penalty as well as remove unnecessary "zeroupper"
27632 intrinsics.
27633
27634 -mprefer-avx128
27635 This option instructs GCC to use 128-bit AVX instructions instead
27636 of 256-bit AVX instructions in the auto-vectorizer.
27637
27638 -mprefer-vector-width=opt
27639 This option instructs GCC to use opt-bit vector width in
27640 instructions instead of default on the selected platform.
27641
27642 -mmove-max=bits
27643 This option instructs GCC to set the maximum number of bits can be
27644 moved from memory to memory efficiently to bits. The valid bits
27645 are 128, 256 and 512.
27646
27647 -mstore-max=bits
27648 This option instructs GCC to set the maximum number of bits can be
27649 stored to memory efficiently to bits. The valid bits are 128, 256
27650 and 512.
27651
27652 none
27653 No extra limitations applied to GCC other than defined by the
27654 selected platform.
27655
27656 128 Prefer 128-bit vector width for instructions.
27657
27658 256 Prefer 256-bit vector width for instructions.
27659
27660 512 Prefer 512-bit vector width for instructions.
27661
27662 -mcx16
27663 This option enables GCC to generate "CMPXCHG16B" instructions in
27664 64-bit code to implement compare-and-exchange operations on 16-byte
27665 aligned 128-bit objects. This is useful for atomic updates of data
27666 structures exceeding one machine word in size. The compiler uses
27667 this instruction to implement __sync Builtins. However, for
27668 __atomic Builtins operating on 128-bit integers, a library call is
27669 always used.
27670
27671 -msahf
27672 This option enables generation of "SAHF" instructions in 64-bit
27673 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
27674 the introduction of Pentium 4 G1 step in December 2005, lacked the
27675 "LAHF" and "SAHF" instructions which are supported by AMD64. These
27676 are load and store instructions, respectively, for certain status
27677 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
27678 "fmod", "drem", and "remainder" built-in functions; see Other
27679 Builtins for details.
27680
27681 -mmovbe
27682 This option enables use of the "movbe" instruction to implement
27683 "__builtin_bswap32" and "__builtin_bswap64".
27684
27685 -mshstk
27686 The -mshstk option enables shadow stack built-in functions from x86
27687 Control-flow Enforcement Technology (CET).
27688
27689 -mcrc32
27690 This option enables built-in functions "__builtin_ia32_crc32qi",
27691 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
27692 "__builtin_ia32_crc32di" to generate the "crc32" machine
27693 instruction.
27694
27695 -mmwait
27696 This option enables built-in functions "__builtin_ia32_monitor",
27697 and "__builtin_ia32_mwait" to generate the "monitor" and "mwait"
27698 machine instructions.
27699
27700 -mrecip
27701 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
27702 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
27703 Newton-Raphson step to increase precision instead of "DIVSS" and
27704 "SQRTSS" (and their vectorized variants) for single-precision
27705 floating-point arguments. These instructions are generated only
27706 when -funsafe-math-optimizations is enabled together with
27707 -ffinite-math-only and -fno-trapping-math. Note that while the
27708 throughput of the sequence is higher than the throughput of the
27709 non-reciprocal instruction, the precision of the sequence can be
27710 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
27711 0.99999994).
27712
27713 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
27714 "RSQRTPS") already with -ffast-math (or the above option
27715 combination), and doesn't need -mrecip.
27716
27717 Also note that GCC emits the above sequence with additional Newton-
27718 Raphson step for vectorized single-float division and vectorized
27719 "sqrtf(x)" already with -ffast-math (or the above option
27720 combination), and doesn't need -mrecip.
27721
27722 -mrecip=opt
27723 This option controls which reciprocal estimate instructions may be
27724 used. opt is a comma-separated list of options, which may be
27725 preceded by a ! to invert the option:
27726
27727 all Enable all estimate instructions.
27728
27729 default
27730 Enable the default instructions, equivalent to -mrecip.
27731
27732 none
27733 Disable all estimate instructions, equivalent to -mno-recip.
27734
27735 div Enable the approximation for scalar division.
27736
27737 vec-div
27738 Enable the approximation for vectorized division.
27739
27740 sqrt
27741 Enable the approximation for scalar square root.
27742
27743 vec-sqrt
27744 Enable the approximation for vectorized square root.
27745
27746 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
27747 approximations, except for square root.
27748
27749 -mveclibabi=type
27750 Specifies the ABI type to use for vectorizing intrinsics using an
27751 external library. Supported values for type are svml for the Intel
27752 short vector math library and acml for the AMD math core library.
27753 To use this option, both -ftree-vectorize and
27754 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
27755 ABI-compatible library must be specified at link time.
27756
27757 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
27758 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
27759 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
27760 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
27761 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
27762 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
27763 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
27764 and "vmlsAcos4" for corresponding function type when
27765 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
27766 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
27767 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
27768 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
27769 corresponding function type when -mveclibabi=acml is used.
27770
27771 -mabi=name
27772 Generate code for the specified calling convention. Permissible
27773 values are sysv for the ABI used on GNU/Linux and other systems,
27774 and ms for the Microsoft ABI. The default is to use the Microsoft
27775 ABI when targeting Microsoft Windows and the SysV ABI on all other
27776 systems. You can control this behavior for specific functions by
27777 using the function attributes "ms_abi" and "sysv_abi".
27778
27779 -mforce-indirect-call
27780 Force all calls to functions to be indirect. This is useful when
27781 using Intel Processor Trace where it generates more precise timing
27782 information for function calls.
27783
27784 -mmanual-endbr
27785 Insert ENDBR instruction at function entry only via the "cf_check"
27786 function attribute. This is useful when used with the option
27787 -fcf-protection=branch to control ENDBR insertion at the function
27788 entry.
27789
27790 -mcall-ms2sysv-xlogues
27791 Due to differences in 64-bit ABIs, any Microsoft ABI function that
27792 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
27793 clobbered. By default, the code for saving and restoring these
27794 registers is emitted inline, resulting in fairly lengthy prologues
27795 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
27796 epilogues that use stubs in the static portion of libgcc to perform
27797 these saves and restores, thus reducing function size at the cost
27798 of a few extra instructions.
27799
27800 -mtls-dialect=type
27801 Generate code to access thread-local storage using the gnu or gnu2
27802 conventions. gnu is the conservative default; gnu2 is more
27803 efficient, but it may add compile- and run-time requirements that
27804 cannot be satisfied on all systems.
27805
27806 -mpush-args
27807 -mno-push-args
27808 Use PUSH operations to store outgoing parameters. This method is
27809 shorter and usually equally fast as method using SUB/MOV operations
27810 and is enabled by default. In some cases disabling it may improve
27811 performance because of improved scheduling and reduced
27812 dependencies.
27813
27814 -maccumulate-outgoing-args
27815 If enabled, the maximum amount of space required for outgoing
27816 arguments is computed in the function prologue. This is faster on
27817 most modern CPUs because of reduced dependencies, improved
27818 scheduling and reduced stack usage when the preferred stack
27819 boundary is not equal to 2. The drawback is a notable increase in
27820 code size. This switch implies -mno-push-args.
27821
27822 -mthreads
27823 Support thread-safe exception handling on MinGW. Programs that
27824 rely on thread-safe exception handling must compile and link all
27825 code with the -mthreads option. When compiling, -mthreads defines
27826 -D_MT; when linking, it links in a special thread helper library
27827 -lmingwthrd which cleans up per-thread exception-handling data.
27828
27829 -mms-bitfields
27830 -mno-ms-bitfields
27831 Enable/disable bit-field layout compatible with the native
27832 Microsoft Windows compiler.
27833
27834 If "packed" is used on a structure, or if bit-fields are used, it
27835 may be that the Microsoft ABI lays out the structure differently
27836 than the way GCC normally does. Particularly when moving packed
27837 data between functions compiled with GCC and the native Microsoft
27838 compiler (either via function call or as data in a file), it may be
27839 necessary to access either format.
27840
27841 This option is enabled by default for Microsoft Windows targets.
27842 This behavior can also be controlled locally by use of variable or
27843 type attributes. For more information, see x86 Variable Attributes
27844 and x86 Type Attributes.
27845
27846 The Microsoft structure layout algorithm is fairly simple with the
27847 exception of the bit-field packing. The padding and alignment of
27848 members of structures and whether a bit-field can straddle a
27849 storage-unit boundary are determine by these rules:
27850
27851 1. Structure members are stored sequentially in the order in which
27852 they are
27853 declared: the first member has the lowest memory address and
27854 the last member the highest.
27855
27856 2. Every data object has an alignment requirement. The alignment
27857 requirement
27858 for all data except structures, unions, and arrays is either
27859 the size of the object or the current packing size (specified
27860 with either the "aligned" attribute or the "pack" pragma),
27861 whichever is less. For structures, unions, and arrays, the
27862 alignment requirement is the largest alignment requirement of
27863 its members. Every object is allocated an offset so that:
27864
27865 offset % alignment_requirement == 0
27866
27867 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
27868 allocation
27869 unit if the integral types are the same size and if the next
27870 bit-field fits into the current allocation unit without
27871 crossing the boundary imposed by the common alignment
27872 requirements of the bit-fields.
27873
27874 MSVC interprets zero-length bit-fields in the following ways:
27875
27876 1. If a zero-length bit-field is inserted between two bit-fields
27877 that
27878 are normally coalesced, the bit-fields are not coalesced.
27879
27880 For example:
27881
27882 struct
27883 {
27884 unsigned long bf_1 : 12;
27885 unsigned long : 0;
27886 unsigned long bf_2 : 12;
27887 } t1;
27888
27889 The size of "t1" is 8 bytes with the zero-length bit-field. If
27890 the zero-length bit-field were removed, "t1"'s size would be 4
27891 bytes.
27892
27893 2. If a zero-length bit-field is inserted after a bit-field, "foo",
27894 and the
27895 alignment of the zero-length bit-field is greater than the
27896 member that follows it, "bar", "bar" is aligned as the type of
27897 the zero-length bit-field.
27898
27899 For example:
27900
27901 struct
27902 {
27903 char foo : 4;
27904 short : 0;
27905 char bar;
27906 } t2;
27907
27908 struct
27909 {
27910 char foo : 4;
27911 short : 0;
27912 double bar;
27913 } t3;
27914
27915 For "t2", "bar" is placed at offset 2, rather than offset 1.
27916 Accordingly, the size of "t2" is 4. For "t3", the zero-length
27917 bit-field does not affect the alignment of "bar" or, as a
27918 result, the size of the structure.
27919
27920 Taking this into account, it is important to note the
27921 following:
27922
27923 1. If a zero-length bit-field follows a normal bit-field, the
27924 type of the
27925 zero-length bit-field may affect the alignment of the
27926 structure as whole. For example, "t2" has a size of 4
27927 bytes, since the zero-length bit-field follows a normal
27928 bit-field, and is of type short.
27929
27930 2. Even if a zero-length bit-field is not followed by a normal
27931 bit-field, it may
27932 still affect the alignment of the structure:
27933
27934 struct
27935 {
27936 char foo : 6;
27937 long : 0;
27938 } t4;
27939
27940 Here, "t4" takes up 4 bytes.
27941
27942 3. Zero-length bit-fields following non-bit-field members are
27943 ignored:
27944 struct
27945 {
27946 char foo;
27947 long : 0;
27948 char bar;
27949 } t5;
27950
27951 Here, "t5" takes up 2 bytes.
27952
27953 -mno-align-stringops
27954 Do not align the destination of inlined string operations. This
27955 switch reduces code size and improves performance in case the
27956 destination is already aligned, but GCC doesn't know about it.
27957
27958 -minline-all-stringops
27959 By default GCC inlines string operations only when the destination
27960 is known to be aligned to least a 4-byte boundary. This enables
27961 more inlining and increases code size, but may improve performance
27962 of code that depends on fast "memcpy" and "memset" for short
27963 lengths. The option enables inline expansion of "strlen" for all
27964 pointer alignments.
27965
27966 -minline-stringops-dynamically
27967 For string operations of unknown size, use run-time checks with
27968 inline code for small blocks and a library call for large blocks.
27969
27970 -mstringop-strategy=alg
27971 Override the internal decision heuristic for the particular
27972 algorithm to use for inlining string operations. The allowed
27973 values for alg are:
27974
27975 rep_byte
27976 rep_4byte
27977 rep_8byte
27978 Expand using i386 "rep" prefix of the specified size.
27979
27980 byte_loop
27981 loop
27982 unrolled_loop
27983 Expand into an inline loop.
27984
27985 libcall
27986 Always use a library call.
27987
27988 -mmemcpy-strategy=strategy
27989 Override the internal decision heuristic to decide if
27990 "__builtin_memcpy" should be inlined and what inline algorithm to
27991 use when the expected size of the copy operation is known. strategy
27992 is a comma-separated list of alg:max_size:dest_align triplets. alg
27993 is specified in -mstringop-strategy, max_size specifies the max
27994 byte size with which inline algorithm alg is allowed. For the last
27995 triplet, the max_size must be "-1". The max_size of the triplets in
27996 the list must be specified in increasing order. The minimal byte
27997 size for alg is 0 for the first triplet and "max_size + 1" of the
27998 preceding range.
27999
28000 -mmemset-strategy=strategy
28001 The option is similar to -mmemcpy-strategy= except that it is to
28002 control "__builtin_memset" expansion.
28003
28004 -momit-leaf-frame-pointer
28005 Don't keep the frame pointer in a register for leaf functions.
28006 This avoids the instructions to save, set up, and restore frame
28007 pointers and makes an extra register available in leaf functions.
28008 The option -fomit-leaf-frame-pointer removes the frame pointer for
28009 leaf functions, which might make debugging harder.
28010
28011 -mtls-direct-seg-refs
28012 -mno-tls-direct-seg-refs
28013 Controls whether TLS variables may be accessed with offsets from
28014 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
28015 whether the thread base pointer must be added. Whether or not this
28016 is valid depends on the operating system, and whether it maps the
28017 segment to cover the entire TLS area.
28018
28019 For systems that use the GNU C Library, the default is on.
28020
28021 -msse2avx
28022 -mno-sse2avx
28023 Specify that the assembler should encode SSE instructions with VEX
28024 prefix. The option -mavx turns this on by default.
28025
28026 -mfentry
28027 -mno-fentry
28028 If profiling is active (-pg), put the profiling counter call before
28029 the prologue. Note: On x86 architectures the attribute
28030 "ms_hook_prologue" isn't possible at the moment for -mfentry and
28031 -pg.
28032
28033 -mrecord-mcount
28034 -mno-record-mcount
28035 If profiling is active (-pg), generate a __mcount_loc section that
28036 contains pointers to each profiling call. This is useful for
28037 automatically patching and out calls.
28038
28039 -mnop-mcount
28040 -mno-nop-mcount
28041 If profiling is active (-pg), generate the calls to the profiling
28042 functions as NOPs. This is useful when they should be patched in
28043 later dynamically. This is likely only useful together with
28044 -mrecord-mcount.
28045
28046 -minstrument-return=type
28047 Instrument function exit in -pg -mfentry instrumented functions
28048 with call to specified function. This only instruments true returns
28049 ending with ret, but not sibling calls ending with jump. Valid
28050 types are none to not instrument, call to generate a call to
28051 __return__, or nop5 to generate a 5 byte nop.
28052
28053 -mrecord-return
28054 -mno-record-return
28055 Generate a __return_loc section pointing to all return
28056 instrumentation code.
28057
28058 -mfentry-name=name
28059 Set name of __fentry__ symbol called at function entry for -pg
28060 -mfentry functions.
28061
28062 -mfentry-section=name
28063 Set name of section to record -mrecord-mcount calls (default
28064 __mcount_loc).
28065
28066 -mskip-rax-setup
28067 -mno-skip-rax-setup
28068 When generating code for the x86-64 architecture with SSE
28069 extensions disabled, -mskip-rax-setup can be used to skip setting
28070 up RAX register when there are no variable arguments passed in
28071 vector registers.
28072
28073 Warning: Since RAX register is used to avoid unnecessarily saving
28074 vector registers on stack when passing variable arguments, the
28075 impacts of this option are callees may waste some stack space,
28076 misbehave or jump to a random location. GCC 4.4 or newer don't
28077 have those issues, regardless the RAX register value.
28078
28079 -m8bit-idiv
28080 -mno-8bit-idiv
28081 On some processors, like Intel Atom, 8-bit unsigned integer divide
28082 is much faster than 32-bit/64-bit integer divide. This option
28083 generates a run-time check. If both dividend and divisor are
28084 within range of 0 to 255, 8-bit unsigned integer divide is used
28085 instead of 32-bit/64-bit integer divide.
28086
28087 -mavx256-split-unaligned-load
28088 -mavx256-split-unaligned-store
28089 Split 32-byte AVX unaligned load and store.
28090
28091 -mstack-protector-guard=guard
28092 -mstack-protector-guard-reg=reg
28093 -mstack-protector-guard-offset=offset
28094 Generate stack protection code using canary at guard. Supported
28095 locations are global for global canary or tls for per-thread canary
28096 in the TLS block (the default). This option has effect only when
28097 -fstack-protector or -fstack-protector-all is specified.
28098
28099 With the latter choice the options -mstack-protector-guard-reg=reg
28100 and -mstack-protector-guard-offset=offset furthermore specify which
28101 segment register (%fs or %gs) to use as base register for reading
28102 the canary, and from what offset from that base register. The
28103 default for those is as specified in the relevant ABI.
28104
28105 -mgeneral-regs-only
28106 Generate code that uses only the general-purpose registers. This
28107 prevents the compiler from using floating-point, vector, mask and
28108 bound registers.
28109
28110 -mrelax-cmpxchg-loop
28111 Relax cmpxchg loop by emitting an early load and compare before
28112 cmpxchg, execute pause if load value is not expected. This reduces
28113 excessive cachline bouncing when and works for all atomic logic
28114 fetch builtins that generates compare and swap loop.
28115
28116 -mindirect-branch=choice
28117 Convert indirect call and jump with choice. The default is keep,
28118 which keeps indirect call and jump unmodified. thunk converts
28119 indirect call and jump to call and return thunk. thunk-inline
28120 converts indirect call and jump to inlined call and return thunk.
28121 thunk-extern converts indirect call and jump to external call and
28122 return thunk provided in a separate object file. You can control
28123 this behavior for a specific function by using the function
28124 attribute "indirect_branch".
28125
28126 Note that -mcmodel=large is incompatible with
28127 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
28128 the thunk function may not be reachable in the large code model.
28129
28130 Note that -mindirect-branch=thunk-extern is compatible with
28131 -fcf-protection=branch since the external thunk can be made to
28132 enable control-flow check.
28133
28134 -mfunction-return=choice
28135 Convert function return with choice. The default is keep, which
28136 keeps function return unmodified. thunk converts function return
28137 to call and return thunk. thunk-inline converts function return to
28138 inlined call and return thunk. thunk-extern converts function
28139 return to external call and return thunk provided in a separate
28140 object file. You can control this behavior for a specific function
28141 by using the function attribute "function_return".
28142
28143 Note that -mindirect-return=thunk-extern is compatible with
28144 -fcf-protection=branch since the external thunk can be made to
28145 enable control-flow check.
28146
28147 Note that -mcmodel=large is incompatible with
28148 -mfunction-return=thunk and -mfunction-return=thunk-extern since
28149 the thunk function may not be reachable in the large code model.
28150
28151 -mindirect-branch-register
28152 Force indirect call and jump via register.
28153
28154 -mharden-sls=choice
28155 Generate code to mitigate against straight line speculation (SLS)
28156 with choice. The default is none which disables all SLS hardening.
28157 return enables SLS hardening for function returns. indirect-jmp
28158 enables SLS hardening for indirect jumps. all enables all SLS
28159 hardening.
28160
28161 -mindirect-branch-cs-prefix
28162 Add CS prefix to call and jmp to indirect thunk with branch target
28163 in r8-r15 registers so that the call and jmp instruction length is
28164 6 bytes to allow them to be replaced with lfence; call *%r8-r15 or
28165 lfence; jmp *%r8-r15 at run-time.
28166
28167 These -m switches are supported in addition to the above on x86-64
28168 processors in 64-bit environments.
28169
28170 -m32
28171 -m64
28172 -mx32
28173 -m16
28174 -miamcu
28175 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
28176 option sets "int", "long", and pointer types to 32 bits, and
28177 generates code that runs on any i386 system.
28178
28179 The -m64 option sets "int" to 32 bits and "long" and pointer types
28180 to 64 bits, and generates code for the x86-64 architecture. For
28181 Darwin only the -m64 option also turns off the -fno-pic and
28182 -mdynamic-no-pic options.
28183
28184 The -mx32 option sets "int", "long", and pointer types to 32 bits,
28185 and generates code for the x86-64 architecture.
28186
28187 The -m16 option is the same as -m32, except for that it outputs the
28188 ".code16gcc" assembly directive at the beginning of the assembly
28189 output so that the binary can run in 16-bit mode.
28190
28191 The -miamcu option generates code which conforms to Intel MCU
28192 psABI. It requires the -m32 option to be turned on.
28193
28194 -mno-red-zone
28195 Do not use a so-called "red zone" for x86-64 code. The red zone is
28196 mandated by the x86-64 ABI; it is a 128-byte area beyond the
28197 location of the stack pointer that is not modified by signal or
28198 interrupt handlers and therefore can be used for temporary data
28199 without adjusting the stack pointer. The flag -mno-red-zone
28200 disables this red zone.
28201
28202 -mcmodel=small
28203 Generate code for the small code model: the program and its symbols
28204 must be linked in the lower 2 GB of the address space. Pointers
28205 are 64 bits. Programs can be statically or dynamically linked.
28206 This is the default code model.
28207
28208 -mcmodel=kernel
28209 Generate code for the kernel code model. The kernel runs in the
28210 negative 2 GB of the address space. This model has to be used for
28211 Linux kernel code.
28212
28213 -mcmodel=medium
28214 Generate code for the medium model: the program is linked in the
28215 lower 2 GB of the address space. Small symbols are also placed
28216 there. Symbols with sizes larger than -mlarge-data-threshold are
28217 put into large data or BSS sections and can be located above 2GB.
28218 Programs can be statically or dynamically linked.
28219
28220 -mcmodel=large
28221 Generate code for the large model. This model makes no assumptions
28222 about addresses and sizes of sections.
28223
28224 -maddress-mode=long
28225 Generate code for long address mode. This is only supported for
28226 64-bit and x32 environments. It is the default address mode for
28227 64-bit environments.
28228
28229 -maddress-mode=short
28230 Generate code for short address mode. This is only supported for
28231 32-bit and x32 environments. It is the default address mode for
28232 32-bit and x32 environments.
28233
28234 -mneeded
28235 -mno-needed
28236 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
28237 indicate the micro-architecture ISA level required to execute the
28238 binary.
28239
28240 -mno-direct-extern-access
28241 Without -fpic nor -fPIC, always use the GOT pointer to access
28242 external symbols. With -fpic or -fPIC, treat access to protected
28243 symbols as local symbols. The default is -mdirect-extern-access.
28244
28245 Warning: shared libraries compiled with -mno-direct-extern-access
28246 and executable compiled with -mdirect-extern-access may not be
28247 binary compatible if protected symbols are used in shared libraries
28248 and executable.
28249
28250 x86 Windows Options
28251 These additional options are available for Microsoft Windows targets:
28252
28253 -mconsole
28254 This option specifies that a console application is to be
28255 generated, by instructing the linker to set the PE header subsystem
28256 type required for console applications. This option is available
28257 for Cygwin and MinGW targets and is enabled by default on those
28258 targets.
28259
28260 -mdll
28261 This option is available for Cygwin and MinGW targets. It
28262 specifies that a DLL---a dynamic link library---is to be generated,
28263 enabling the selection of the required runtime startup object and
28264 entry point.
28265
28266 -mnop-fun-dllimport
28267 This option is available for Cygwin and MinGW targets. It
28268 specifies that the "dllimport" attribute should be ignored.
28269
28270 -mthreads
28271 This option is available for MinGW targets. It specifies that
28272 MinGW-specific thread support is to be used.
28273
28274 -municode
28275 This option is available for MinGW-w64 targets. It causes the
28276 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
28277 capable runtime startup code.
28278
28279 -mwin32
28280 This option is available for Cygwin and MinGW targets. It
28281 specifies that the typical Microsoft Windows predefined macros are
28282 to be set in the pre-processor, but does not influence the choice
28283 of runtime library/startup code.
28284
28285 -mwindows
28286 This option is available for Cygwin and MinGW targets. It
28287 specifies that a GUI application is to be generated by instructing
28288 the linker to set the PE header subsystem type appropriately.
28289
28290 -fno-set-stack-executable
28291 This option is available for MinGW targets. It specifies that the
28292 executable flag for the stack used by nested functions isn't set.
28293 This is necessary for binaries running in kernel mode of Microsoft
28294 Windows, as there the User32 API, which is used to set executable
28295 privileges, isn't available.
28296
28297 -fwritable-relocated-rdata
28298 This option is available for MinGW and Cygwin targets. It
28299 specifies that relocated-data in read-only section is put into the
28300 ".data" section. This is a necessary for older runtimes not
28301 supporting modification of ".rdata" sections for pseudo-relocation.
28302
28303 -mpe-aligned-commons
28304 This option is available for Cygwin and MinGW targets. It
28305 specifies that the GNU extension to the PE file format that permits
28306 the correct alignment of COMMON variables should be used when
28307 generating code. It is enabled by default if GCC detects that the
28308 target assembler found during configuration supports the feature.
28309
28310 See also under x86 Options for standard options.
28311
28312 Xstormy16 Options
28313 These options are defined for Xstormy16:
28314
28315 -msim
28316 Choose startup files and linker script suitable for the simulator.
28317
28318 Xtensa Options
28319 These options are supported for Xtensa targets:
28320
28321 -mconst16
28322 -mno-const16
28323 Enable or disable use of "CONST16" instructions for loading
28324 constant values. The "CONST16" instruction is currently not a
28325 standard option from Tensilica. When enabled, "CONST16"
28326 instructions are always used in place of the standard "L32R"
28327 instructions. The use of "CONST16" is enabled by default only if
28328 the "L32R" instruction is not available.
28329
28330 -mfused-madd
28331 -mno-fused-madd
28332 Enable or disable use of fused multiply/add and multiply/subtract
28333 instructions in the floating-point option. This has no effect if
28334 the floating-point option is not also enabled. Disabling fused
28335 multiply/add and multiply/subtract instructions forces the compiler
28336 to use separate instructions for the multiply and add/subtract
28337 operations. This may be desirable in some cases where strict IEEE
28338 754-compliant results are required: the fused multiply add/subtract
28339 instructions do not round the intermediate result, thereby
28340 producing results with more bits of precision than specified by the
28341 IEEE standard. Disabling fused multiply add/subtract instructions
28342 also ensures that the program output is not sensitive to the
28343 compiler's ability to combine multiply and add/subtract operations.
28344
28345 -mserialize-volatile
28346 -mno-serialize-volatile
28347 When this option is enabled, GCC inserts "MEMW" instructions before
28348 "volatile" memory references to guarantee sequential consistency.
28349 The default is -mserialize-volatile. Use -mno-serialize-volatile
28350 to omit the "MEMW" instructions.
28351
28352 -mforce-no-pic
28353 For targets, like GNU/Linux, where all user-mode Xtensa code must
28354 be position-independent code (PIC), this option disables PIC for
28355 compiling kernel code.
28356
28357 -mtext-section-literals
28358 -mno-text-section-literals
28359 These options control the treatment of literal pools. The default
28360 is -mno-text-section-literals, which places literals in a separate
28361 section in the output file. This allows the literal pool to be
28362 placed in a data RAM/ROM, and it also allows the linker to combine
28363 literal pools from separate object files to remove redundant
28364 literals and improve code size. With -mtext-section-literals, the
28365 literals are interspersed in the text section in order to keep them
28366 as close as possible to their references. This may be necessary
28367 for large assembly files. Literals for each function are placed
28368 right before that function.
28369
28370 -mauto-litpools
28371 -mno-auto-litpools
28372 These options control the treatment of literal pools. The default
28373 is -mno-auto-litpools, which places literals in a separate section
28374 in the output file unless -mtext-section-literals is used. With
28375 -mauto-litpools the literals are interspersed in the text section
28376 by the assembler. Compiler does not produce explicit ".literal"
28377 directives and loads literals into registers with "MOVI"
28378 instructions instead of "L32R" to let the assembler do relaxation
28379 and place literals as necessary. This option allows assembler to
28380 create several literal pools per function and assemble very big
28381 functions, which may not be possible with -mtext-section-literals.
28382
28383 -mtarget-align
28384 -mno-target-align
28385 When this option is enabled, GCC instructs the assembler to
28386 automatically align instructions to reduce branch penalties at the
28387 expense of some code density. The assembler attempts to widen
28388 density instructions to align branch targets and the instructions
28389 following call instructions. If there are not enough preceding
28390 safe density instructions to align a target, no widening is
28391 performed. The default is -mtarget-align. These options do not
28392 affect the treatment of auto-aligned instructions like "LOOP",
28393 which the assembler always aligns, either by widening density
28394 instructions or by inserting NOP instructions.
28395
28396 -mlongcalls
28397 -mno-longcalls
28398 When this option is enabled, GCC instructs the assembler to
28399 translate direct calls to indirect calls unless it can determine
28400 that the target of a direct call is in the range allowed by the
28401 call instruction. This translation typically occurs for calls to
28402 functions in other source files. Specifically, the assembler
28403 translates a direct "CALL" instruction into an "L32R" followed by a
28404 "CALLX" instruction. The default is -mno-longcalls. This option
28405 should be used in programs where the call target can potentially be
28406 out of range. This option is implemented in the assembler, not the
28407 compiler, so the assembly code generated by GCC still shows direct
28408 call instructions---look at the disassembled object code to see the
28409 actual instructions. Note that the assembler uses an indirect call
28410 for every cross-file call, not just those that really are out of
28411 range.
28412
28413 -mabi=name
28414 Generate code for the specified ABI. Permissible values are:
28415 call0, windowed. Default ABI is chosen by the Xtensa core
28416 configuration.
28417
28418 -mabi=call0
28419 When this option is enabled function parameters are passed in
28420 registers "a2" through "a7", registers "a12" through "a15" are
28421 caller-saved, and register "a15" may be used as a frame pointer.
28422 When this version of the ABI is enabled the C preprocessor symbol
28423 "__XTENSA_CALL0_ABI__" is defined.
28424
28425 -mabi=windowed
28426 When this option is enabled function parameters are passed in
28427 registers "a10" through "a15", and called function rotates register
28428 window by 8 registers on entry so that its arguments are found in
28429 registers "a2" through "a7". Register "a7" may be used as a frame
28430 pointer. Register window is rotated 8 registers back upon return.
28431 When this version of the ABI is enabled the C preprocessor symbol
28432 "__XTENSA_WINDOWED_ABI__" is defined.
28433
28434 zSeries Options
28435 These are listed under
28436
28438 This section describes several environment variables that affect how
28439 GCC operates. Some of them work by specifying directories or prefixes
28440 to use when searching for various kinds of files. Some are used to
28441 specify other aspects of the compilation environment.
28442
28443 Note that you can also specify places to search using options such as
28444 -B, -I and -L. These take precedence over places specified using
28445 environment variables, which in turn take precedence over those
28446 specified by the configuration of GCC.
28447
28448 LANG
28449 LC_CTYPE
28450 LC_MESSAGES
28451 LC_ALL
28452 These environment variables control the way that GCC uses
28453 localization information which allows GCC to work with different
28454 national conventions. GCC inspects the locale categories LC_CTYPE
28455 and LC_MESSAGES if it has been configured to do so. These locale
28456 categories can be set to any value supported by your installation.
28457 A typical value is en_GB.UTF-8 for English in the United Kingdom
28458 encoded in UTF-8.
28459
28460 The LC_CTYPE environment variable specifies character
28461 classification. GCC uses it to determine the character boundaries
28462 in a string; this is needed for some multibyte encodings that
28463 contain quote and escape characters that are otherwise interpreted
28464 as a string end or escape.
28465
28466 The LC_MESSAGES environment variable specifies the language to use
28467 in diagnostic messages.
28468
28469 If the LC_ALL environment variable is set, it overrides the value
28470 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
28471 default to the value of the LANG environment variable. If none of
28472 these variables are set, GCC defaults to traditional C English
28473 behavior.
28474
28475 TMPDIR
28476 If TMPDIR is set, it specifies the directory to use for temporary
28477 files. GCC uses temporary files to hold the output of one stage of
28478 compilation which is to be used as input to the next stage: for
28479 example, the output of the preprocessor, which is the input to the
28480 compiler proper.
28481
28482 GCC_COMPARE_DEBUG
28483 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
28484 -fcompare-debug to the compiler driver. See the documentation of
28485 this option for more details.
28486
28487 GCC_EXEC_PREFIX
28488 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
28489 names of the subprograms executed by the compiler. No slash is
28490 added when this prefix is combined with the name of a subprogram,
28491 but you can specify a prefix that ends with a slash if you wish.
28492
28493 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
28494 appropriate prefix to use based on the pathname it is invoked with.
28495
28496 If GCC cannot find the subprogram using the specified prefix, it
28497 tries looking in the usual places for the subprogram.
28498
28499 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
28500 prefix is the prefix to the installed compiler. In many cases
28501 prefix is the value of "prefix" when you ran the configure script.
28502
28503 Other prefixes specified with -B take precedence over this prefix.
28504
28505 This prefix is also used for finding files such as crt0.o that are
28506 used for linking.
28507
28508 In addition, the prefix is used in an unusual way in finding the
28509 directories to search for header files. For each of the standard
28510 directories whose name normally begins with /usr/local/lib/gcc
28511 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
28512 replacing that beginning with the specified prefix to produce an
28513 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
28514 just before it searches the standard directory /usr/local/lib/bar.
28515 If a standard directory begins with the configured prefix then the
28516 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
28517 header files.
28518
28519 COMPILER_PATH
28520 The value of COMPILER_PATH is a colon-separated list of
28521 directories, much like PATH. GCC tries the directories thus
28522 specified when searching for subprograms, if it cannot find the
28523 subprograms using GCC_EXEC_PREFIX.
28524
28525 LIBRARY_PATH
28526 The value of LIBRARY_PATH is a colon-separated list of directories,
28527 much like PATH. When configured as a native compiler, GCC tries
28528 the directories thus specified when searching for special linker
28529 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
28530 GCC also uses these directories when searching for ordinary
28531 libraries for the -l option (but directories specified with -L come
28532 first).
28533
28534 LANG
28535 This variable is used to pass locale information to the compiler.
28536 One way in which this information is used is to determine the
28537 character set to be used when character literals, string literals
28538 and comments are parsed in C and C++. When the compiler is
28539 configured to allow multibyte characters, the following values for
28540 LANG are recognized:
28541
28542 C-JIS
28543 Recognize JIS characters.
28544
28545 C-SJIS
28546 Recognize SJIS characters.
28547
28548 C-EUCJP
28549 Recognize EUCJP characters.
28550
28551 If LANG is not defined, or if it has some other value, then the
28552 compiler uses "mblen" and "mbtowc" as defined by the default locale
28553 to recognize and translate multibyte characters.
28554
28555 GCC_EXTRA_DIAGNOSTIC_OUTPUT
28556 If GCC_EXTRA_DIAGNOSTIC_OUTPUT is set to one of the following
28557 values, then additional text will be emitted to stderr when fix-it
28558 hints are emitted. -fdiagnostics-parseable-fixits and
28559 -fno-diagnostics-parseable-fixits take precedence over this
28560 environment variable.
28561
28562 fixits-v1
28563 Emit parseable fix-it hints, equivalent to
28564 -fdiagnostics-parseable-fixits. In particular, columns are
28565 expressed as a count of bytes, starting at byte 1 for the
28566 initial column.
28567
28568 fixits-v2
28569 As "fixits-v1", but columns are expressed as display columns,
28570 as per -fdiagnostics-column-unit=display.
28571
28572 Some additional environment variables affect the behavior of the
28573 preprocessor.
28574
28575 CPATH
28576 C_INCLUDE_PATH
28577 CPLUS_INCLUDE_PATH
28578 OBJC_INCLUDE_PATH
28579 Each variable's value is a list of directories separated by a
28580 special character, much like PATH, in which to look for header
28581 files. The special character, "PATH_SEPARATOR", is target-
28582 dependent and determined at GCC build time. For Microsoft Windows-
28583 based targets it is a semicolon, and for almost all other targets
28584 it is a colon.
28585
28586 CPATH specifies a list of directories to be searched as if
28587 specified with -I, but after any paths given with -I options on the
28588 command line. This environment variable is used regardless of
28589 which language is being preprocessed.
28590
28591 The remaining environment variables apply only when preprocessing
28592 the particular language indicated. Each specifies a list of
28593 directories to be searched as if specified with -isystem, but after
28594 any paths given with -isystem options on the command line.
28595
28596 In all these variables, an empty element instructs the compiler to
28597 search its current working directory. Empty elements can appear at
28598 the beginning or end of a path. For instance, if the value of
28599 CPATH is ":/special/include", that has the same effect as
28600 -I. -I/special/include.
28601
28602 DEPENDENCIES_OUTPUT
28603 If this variable is set, its value specifies how to output
28604 dependencies for Make based on the non-system header files
28605 processed by the compiler. System header files are ignored in the
28606 dependency output.
28607
28608 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
28609 case the Make rules are written to that file, guessing the target
28610 name from the source file name. Or the value can have the form
28611 file target, in which case the rules are written to file file using
28612 target as the target name.
28613
28614 In other words, this environment variable is equivalent to
28615 combining the options -MM and -MF, with an optional -MT switch too.
28616
28617 SUNPRO_DEPENDENCIES
28618 This variable is the same as DEPENDENCIES_OUTPUT (see above),
28619 except that system header files are not ignored, so it implies -M
28620 rather than -MM. However, the dependence on the main input file is
28621 omitted.
28622
28623 SOURCE_DATE_EPOCH
28624 If this variable is set, its value specifies a UNIX timestamp to be
28625 used in replacement of the current date and time in the "__DATE__"
28626 and "__TIME__" macros, so that the embedded timestamps become
28627 reproducible.
28628
28629 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
28630 the number of seconds (excluding leap seconds) since 01 Jan 1970
28631 00:00:00 represented in ASCII; identical to the output of "date
28632 +%s" on GNU/Linux and other systems that support the %s extension
28633 in the "date" command.
28634
28635 The value should be a known timestamp such as the last modification
28636 time of the source or package and it should be set by the build
28637 process.
28638
28640 For instructions on reporting bugs, see
28641 <http://bugzilla.redhat.com/bugzilla>.
28642
28644 1. On some systems, gcc -shared needs to build supplementary stub code
28645 for constructors to work. On multi-libbed systems, gcc -shared
28646 must select the correct support libraries to link against. Failing
28647 to supply the correct flags may lead to subtle defects. Supplying
28648 them in cases where they are not necessary is innocuous.
28649
28651 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1),
28652 dbx(1) and the Info entries for gcc, cpp, as, ld, binutils and gdb.
28653
28655 See the Info entry for gcc, or
28656 <https://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for
28657 contributors to GCC.
28658
28660 Copyright (c) 1988-2022 Free Software Foundation, Inc.
28661
28662 Permission is granted to copy, distribute and/or modify this document
28663 under the terms of the GNU Free Documentation License, Version 1.3 or
28664 any later version published by the Free Software Foundation; with the
28665 Invariant Sections being "GNU General Public License" and "Funding Free
28666 Software", the Front-Cover texts being (a) (see below), and with the
28667 Back-Cover Texts being (b) (see below). A copy of the license is
28668 included in the gfdl(7) man page.
28669
28670 (a) The FSF's Front-Cover Text is:
28671
28672 A GNU Manual
28673
28674 (b) The FSF's Back-Cover Text is:
28675
28676 You have freedom to copy and modify this GNU Manual, like GNU
28677 software. Copies published by the Free Software Foundation raise
28678 funds for GNU development.
28679
28680
28681
28682gcc-12 2022-11-21 GCC(1)