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
16524 These options are defined for AArch64 implementations:
16525
16526 -mabi=name
16527 Generate code for the specified data model. Permissible values are
16528 ilp32 for SysV-like data model where int, long int and pointers are
16529 32 bits, and lp64 for SysV-like data model where int is 32 bits,
16530 but long int and pointers are 64 bits.
16531
16532 The default depends on the specific target configuration. Note
16533 that the LP64 and ILP32 ABIs are not link-compatible; you must
16534 compile your entire program with the same ABI, and link with a
16535 compatible set of libraries.
16536
16537 -mbig-endian
16538 Generate big-endian code. This is the default when GCC is
16539 configured for an aarch64_be-*-* target.
16540
16541 -mgeneral-regs-only
16542 Generate code which uses only the general-purpose registers. This
16543 will prevent the compiler from using floating-point and Advanced
16544 SIMD registers but will not impose any restrictions on the
16545 assembler.
16546
16547 -mlittle-endian
16548 Generate little-endian code. This is the default when GCC is
16549 configured for an aarch64-*-* but not an aarch64_be-*-* target.
16550
16551 -mcmodel=tiny
16552 Generate code for the tiny code model. The program and its
16553 statically defined symbols must be within 1MB of each other.
16554 Programs can be statically or dynamically linked.
16555
16556 -mcmodel=small
16557 Generate code for the small code model. The program and its
16558 statically defined symbols must be within 4GB of each other.
16559 Programs can be statically or dynamically linked. This is the
16560 default code model.
16561
16562 -mcmodel=large
16563 Generate code for the large code model. This makes no assumptions
16564 about addresses and sizes of sections. Programs can be statically
16565 linked only. The -mcmodel=large option is incompatible with
16566 -mabi=ilp32, -fpic and -fPIC.
16567
16568 -mstrict-align
16569 -mno-strict-align
16570 Avoid or allow generating memory accesses that may not be aligned
16571 on a natural object boundary as described in the architecture
16572 specification.
16573
16574 -momit-leaf-frame-pointer
16575 -mno-omit-leaf-frame-pointer
16576 Omit or keep the frame pointer in leaf functions. The former
16577 behavior is the default.
16578
16579 -mstack-protector-guard=guard
16580 -mstack-protector-guard-reg=reg
16581 -mstack-protector-guard-offset=offset
16582 Generate stack protection code using canary at guard. Supported
16583 locations are global for a global canary or sysreg for a canary in
16584 an appropriate system register.
16585
16586 With the latter choice the options -mstack-protector-guard-reg=reg
16587 and -mstack-protector-guard-offset=offset furthermore specify which
16588 system register to use as base register for reading the canary, and
16589 from what offset from that base register. There is no default
16590 register or offset as this is entirely for use within the Linux
16591 kernel.
16592
16593 -mtls-dialect=desc
16594 Use TLS descriptors as the thread-local storage mechanism for
16595 dynamic accesses of TLS variables. This is the default.
16596
16597 -mtls-dialect=traditional
16598 Use traditional TLS as the thread-local storage mechanism for
16599 dynamic accesses of TLS variables.
16600
16601 -mtls-size=size
16602 Specify bit size of immediate TLS offsets. Valid values are 12,
16603 24, 32, 48. This option requires binutils 2.26 or newer.
16604
16605 -mfix-cortex-a53-835769
16606 -mno-fix-cortex-a53-835769
16607 Enable or disable the workaround for the ARM Cortex-A53 erratum
16608 number 835769. This involves inserting a NOP instruction between
16609 memory instructions and 64-bit integer multiply-accumulate
16610 instructions.
16611
16612 -mfix-cortex-a53-843419
16613 -mno-fix-cortex-a53-843419
16614 Enable or disable the workaround for the ARM Cortex-A53 erratum
16615 number 843419. This erratum workaround is made at link time and
16616 this will only pass the corresponding flag to the linker.
16617
16618 -mlow-precision-recip-sqrt
16619 -mno-low-precision-recip-sqrt
16620 Enable or disable the reciprocal square root approximation. This
16621 option only has an effect if -ffast-math or
16622 -funsafe-math-optimizations is used as well. Enabling this reduces
16623 precision of reciprocal square root results to about 16 bits for
16624 single precision and to 32 bits for double precision.
16625
16626 -mlow-precision-sqrt
16627 -mno-low-precision-sqrt
16628 Enable or disable the square root approximation. This option only
16629 has an effect if -ffast-math or -funsafe-math-optimizations is used
16630 as well. Enabling this reduces precision of square root results to
16631 about 16 bits for single precision and to 32 bits for double
16632 precision. If enabled, it implies -mlow-precision-recip-sqrt.
16633
16634 -mlow-precision-div
16635 -mno-low-precision-div
16636 Enable or disable the division approximation. This option only has
16637 an effect if -ffast-math or -funsafe-math-optimizations is used as
16638 well. Enabling this reduces precision of division results to about
16639 16 bits for single precision and to 32 bits for double precision.
16640
16641 -mtrack-speculation
16642 -mno-track-speculation
16643 Enable or disable generation of additional code to track
16644 speculative execution through conditional branches. The tracking
16645 state can then be used by the compiler when expanding calls to
16646 "__builtin_speculation_safe_copy" to permit a more efficient code
16647 sequence to be generated.
16648
16649 -moutline-atomics
16650 -mno-outline-atomics
16651 Enable or disable calls to out-of-line helpers to implement atomic
16652 operations. These helpers will, at runtime, determine if the LSE
16653 instructions from ARMv8.1-A can be used; if not, they will use the
16654 load/store-exclusive instructions that are present in the base
16655 ARMv8.0 ISA.
16656
16657 This option is only applicable when compiling for the base ARMv8.0
16658 instruction set. If using a later revision, e.g. -march=armv8.1-a
16659 or -march=armv8-a+lse, the ARMv8.1-Atomics instructions will be
16660 used directly. The same applies when using -mcpu= when the
16661 selected cpu supports the lse feature. This option is on by
16662 default.
16663
16664 -march=name
16665 Specify the name of the target architecture and, optionally, one or
16666 more feature modifiers. This option has the form
16667 -march=arch{+[no]feature}*.
16668
16669 The table below summarizes the permissible values for arch and the
16670 features that they enable by default:
16671
16672 arch value : Architecture : Includes by default
16673 armv8-a : Armv8-A : +fp, +simd
16674 armv8.1-a : Armv8.1-A : armv8-a, +crc, +lse, +rdma
16675 armv8.2-a : Armv8.2-A : armv8.1-a
16676 armv8.3-a : Armv8.3-A : armv8.2-a, +pauth
16677 armv8.4-a : Armv8.4-A : armv8.3-a, +flagm, +fp16fml, +dotprod
16678 armv8.5-a : Armv8.5-A : armv8.4-a, +sb, +ssbs, +predres
16679 armv8.6-a : Armv8.6-A : armv8.5-a, +bf16, +i8mm
16680 armv8.7-a : Armv8.7-A : armv8.6-a, +ls64
16681 armv8.8-a : Armv8.8-a : armv8.7-a, +mops
16682 armv9-a : Armv9-A : armv8.5-a, +sve, +sve2
16683 armv8-r : Armv8-R : armv8-r
16684
16685 The value native is available on native AArch64 GNU/Linux and
16686 causes the compiler to pick the architecture of the host system.
16687 This option has no effect if the compiler is unable to recognize
16688 the architecture of the host system,
16689
16690 The permissible values for feature are listed in the sub-section on
16691 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
16692 Where conflicting feature modifiers are specified, the right-most
16693 feature is used.
16694
16695 GCC uses name to determine what kind of instructions it can emit
16696 when generating assembly code. If -march is specified without
16697 either of -mtune or -mcpu also being specified, the code is tuned
16698 to perform well across a range of target processors implementing
16699 the target architecture.
16700
16701 -mtune=name
16702 Specify the name of the target processor for which GCC should tune
16703 the performance of the code. Permissible values for this option
16704 are: generic, cortex-a35, cortex-a53, cortex-a55, cortex-a57,
16705 cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae,
16706 cortex-a77, cortex-a65, cortex-a65ae, cortex-a34, cortex-a78,
16707 cortex-a78ae, cortex-a78c, ares, exynos-m1, emag, falkor,
16708 neoverse-512tvb, neoverse-e1, neoverse-n1, neoverse-n2,
16709 neoverse-v1, neoverse-v2, qdf24xx, saphira, phecda, xgene1, vulcan,
16710 octeontx, octeontx81, octeontx83, octeontx2, octeontx2t98,
16711 octeontx2t96 octeontx2t93, octeontx2f95, octeontx2f95n,
16712 octeontx2f95mm, a64fx, thunderx, thunderxt88, thunderxt88p1,
16713 thunderxt81, tsv110, thunderxt83, thunderx2t99, thunderx3t110,
16714 zeus, cortex-a57.cortex-a53, cortex-a72.cortex-a53,
16715 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
16716 cortex-a75.cortex-a55, cortex-a76.cortex-a55, cortex-r82,
16717 cortex-x1, cortex-x2, cortex-a510, cortex-a710, ampere1, ampere1a,
16718 native.
16719
16720 The values cortex-a57.cortex-a53, cortex-a72.cortex-a53,
16721 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
16722 cortex-a75.cortex-a55, cortex-a76.cortex-a55 specify that GCC
16723 should tune for a big.LITTLE system.
16724
16725 The value neoverse-512tvb specifies that GCC should tune for
16726 Neoverse cores that (a) implement SVE and (b) have a total vector
16727 bandwidth of 512 bits per cycle. In other words, the option tells
16728 GCC to tune for Neoverse cores that can execute 4 128-bit Advanced
16729 SIMD arithmetic instructions a cycle and that can execute an
16730 equivalent number of SVE arithmetic instructions per cycle (2 for
16731 256-bit SVE, 4 for 128-bit SVE). This is more general than tuning
16732 for a specific core like Neoverse V1 but is more specific than the
16733 default tuning described below.
16734
16735 Additionally on native AArch64 GNU/Linux systems the value native
16736 tunes performance to the host system. This option has no effect if
16737 the compiler is unable to recognize the processor of the host
16738 system.
16739
16740 Where none of -mtune=, -mcpu= or -march= are specified, the code is
16741 tuned to perform well across a range of target processors.
16742
16743 This option cannot be suffixed by feature modifiers.
16744
16745 -mcpu=name
16746 Specify the name of the target processor, optionally suffixed by
16747 one or more feature modifiers. This option has the form
16748 -mcpu=cpu{+[no]feature}*, where the permissible values for cpu are
16749 the same as those available for -mtune. The permissible values for
16750 feature are documented in the sub-section on
16751 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
16752 Where conflicting feature modifiers are specified, the right-most
16753 feature is used.
16754
16755 GCC uses name to determine what kind of instructions it can emit
16756 when generating assembly code (as if by -march) and to determine
16757 the target processor for which to tune for performance (as if by
16758 -mtune). Where this option is used in conjunction with -march or
16759 -mtune, those options take precedence over the appropriate part of
16760 this option.
16761
16762 -mcpu=neoverse-512tvb is special in that it does not refer to a
16763 specific core, but instead refers to all Neoverse cores that (a)
16764 implement SVE and (b) have a total vector bandwidth of 512 bits a
16765 cycle. Unless overridden by -march, -mcpu=neoverse-512tvb
16766 generates code that can run on a Neoverse V1 core, since Neoverse
16767 V1 is the first Neoverse core with these properties. Unless
16768 overridden by -mtune, -mcpu=neoverse-512tvb tunes code in the same
16769 way as for -mtune=neoverse-512tvb.
16770
16771 -moverride=string
16772 Override tuning decisions made by the back-end in response to a
16773 -mtune= switch. The syntax, semantics, and accepted values for
16774 string in this option are not guaranteed to be consistent across
16775 releases.
16776
16777 This option is only intended to be useful when developing GCC.
16778
16779 -mverbose-cost-dump
16780 Enable verbose cost model dumping in the debug dump files. This
16781 option is provided for use in debugging the compiler.
16782
16783 -mpc-relative-literal-loads
16784 -mno-pc-relative-literal-loads
16785 Enable or disable PC-relative literal loads. With this option
16786 literal pools are accessed using a single instruction and emitted
16787 after each function. This limits the maximum size of functions to
16788 1MB. This is enabled by default for -mcmodel=tiny.
16789
16790 -msign-return-address=scope
16791 Select the function scope on which return address signing will be
16792 applied. Permissible values are none, which disables return
16793 address signing, non-leaf, which enables pointer signing for
16794 functions which are not leaf functions, and all, which enables
16795 pointer signing for all functions. The default value is none. This
16796 option has been deprecated by -mbranch-protection.
16797
16798 -mbranch-protection=none|standard|pac-ret[+leaf+b-key]|bti
16799 Select the branch protection features to use. none is the default
16800 and turns off all types of branch protection. standard turns on
16801 all types of branch protection features. If a feature has
16802 additional tuning options, then standard sets it to its standard
16803 level. pac-ret[+leaf] turns on return address signing to its
16804 standard level: signing functions that save the return address to
16805 memory (non-leaf functions will practically always do this) using
16806 the a-key. The optional argument leaf can be used to extend the
16807 signing to include leaf functions. The optional argument b-key can
16808 be used to sign the functions with the B-key instead of the A-key.
16809 bti turns on branch target identification mechanism.
16810
16811 -mharden-sls=opts
16812 Enable compiler hardening against straight line speculation (SLS).
16813 opts is a comma-separated list of the following options:
16814
16815 retbr
16816 blr
16817
16818 In addition, -mharden-sls=all enables all SLS hardening while
16819 -mharden-sls=none disables all SLS hardening.
16820
16821 -msve-vector-bits=bits
16822 Specify the number of bits in an SVE vector register. This option
16823 only has an effect when SVE is enabled.
16824
16825 GCC supports two forms of SVE code generation: "vector-length
16826 agnostic" output that works with any size of vector register and
16827 "vector-length specific" output that allows GCC to make assumptions
16828 about the vector length when it is useful for optimization reasons.
16829 The possible values of bits are: scalable, 128, 256, 512, 1024 and
16830 2048. Specifying scalable selects vector-length agnostic output.
16831 At present -msve-vector-bits=128 also generates vector-length
16832 agnostic output for big-endian targets. All other values generate
16833 vector-length specific code. The behavior of these values may
16834 change in future releases and no value except scalable should be
16835 relied on for producing code that is portable across different
16836 hardware SVE vector lengths.
16837
16838 The default is -msve-vector-bits=scalable, which produces vector-
16839 length agnostic code.
16840
16841 -march and -mcpu Feature Modifiers
16842
16843 Feature modifiers used with -march and -mcpu can be any of the
16844 following and their inverses nofeature:
16845
16846 crc Enable CRC extension. This is on by default for -march=armv8.1-a.
16847
16848 crypto
16849 Enable Crypto extension. This also enables Advanced SIMD and
16850 floating-point instructions.
16851
16852 fp Enable floating-point instructions. This is on by default for all
16853 possible values for options -march and -mcpu.
16854
16855 simd
16856 Enable Advanced SIMD instructions. This also enables floating-
16857 point instructions. This is on by default for all possible values
16858 for options -march and -mcpu.
16859
16860 sve Enable Scalable Vector Extension instructions. This also enables
16861 Advanced SIMD and floating-point instructions.
16862
16863 lse Enable Large System Extension instructions. This is on by default
16864 for -march=armv8.1-a.
16865
16866 rdma
16867 Enable Round Double Multiply Accumulate instructions. This is on
16868 by default for -march=armv8.1-a.
16869
16870 fp16
16871 Enable FP16 extension. This also enables floating-point
16872 instructions.
16873
16874 fp16fml
16875 Enable FP16 fmla extension. This also enables FP16 extensions and
16876 floating-point instructions. This option is enabled by default for
16877 -march=armv8.4-a. Use of this option with architectures prior to
16878 Armv8.2-A is not supported.
16879
16880 rcpc
16881 Enable the RcPc extension. This does not change code generation
16882 from GCC, but is passed on to the assembler, enabling inline asm
16883 statements to use instructions from the RcPc extension.
16884
16885 dotprod
16886 Enable the Dot Product extension. This also enables Advanced SIMD
16887 instructions.
16888
16889 aes Enable the Armv8-a aes and pmull crypto extension. This also
16890 enables Advanced SIMD instructions.
16891
16892 sha2
16893 Enable the Armv8-a sha2 crypto extension. This also enables
16894 Advanced SIMD instructions.
16895
16896 sha3
16897 Enable the sha512 and sha3 crypto extension. This also enables
16898 Advanced SIMD instructions. Use of this option with architectures
16899 prior to Armv8.2-A is not supported.
16900
16901 sm4 Enable the sm3 and sm4 crypto extension. This also enables
16902 Advanced SIMD instructions. Use of this option with architectures
16903 prior to Armv8.2-A is not supported.
16904
16905 profile
16906 Enable the Statistical Profiling extension. This option is only to
16907 enable the extension at the assembler level and does not affect
16908 code generation.
16909
16910 rng Enable the Armv8.5-a Random Number instructions. This option is
16911 only to enable the extension at the assembler level and does not
16912 affect code generation.
16913
16914 memtag
16915 Enable the Armv8.5-a Memory Tagging Extensions. Use of this option
16916 with architectures prior to Armv8.5-A is not supported.
16917
16918 sb Enable the Armv8-a Speculation Barrier instruction. This option is
16919 only to enable the extension at the assembler level and does not
16920 affect code generation. This option is enabled by default for
16921 -march=armv8.5-a.
16922
16923 ssbs
16924 Enable the Armv8-a Speculative Store Bypass Safe instruction. This
16925 option is only to enable the extension at the assembler level and
16926 does not affect code generation. This option is enabled by default
16927 for -march=armv8.5-a.
16928
16929 predres
16930 Enable the Armv8-a Execution and Data Prediction Restriction
16931 instructions. This option is only to enable the extension at the
16932 assembler level and does not affect code generation. This option
16933 is enabled by default for -march=armv8.5-a.
16934
16935 sve2
16936 Enable the Armv8-a Scalable Vector Extension 2. This also enables
16937 SVE instructions.
16938
16939 sve2-bitperm
16940 Enable SVE2 bitperm instructions. This also enables SVE2
16941 instructions.
16942
16943 sve2-sm4
16944 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16945
16946 sve2-aes
16947 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16948
16949 sve2-sha3
16950 Enable SVE2 sha3 instructions. This also enables SVE2
16951 instructions.
16952
16953 tme Enable the Transactional Memory Extension.
16954
16955 i8mm
16956 Enable 8-bit Integer Matrix Multiply instructions. This also
16957 enables Advanced SIMD and floating-point instructions. This option
16958 is enabled by default for -march=armv8.6-a. Use of this option
16959 with architectures prior to Armv8.2-A is not supported.
16960
16961 f32mm
16962 Enable 32-bit Floating point Matrix Multiply instructions. This
16963 also enables SVE instructions. Use of this option with
16964 architectures prior to Armv8.2-A is not supported.
16965
16966 f64mm
16967 Enable 64-bit Floating point Matrix Multiply instructions. This
16968 also enables SVE instructions. Use of this option with
16969 architectures prior to Armv8.2-A is not supported.
16970
16971 bf16
16972 Enable brain half-precision floating-point instructions. This also
16973 enables Advanced SIMD and floating-point instructions. This option
16974 is enabled by default for -march=armv8.6-a. Use of this option
16975 with architectures prior to Armv8.2-A is not supported.
16976
16977 ls64
16978 Enable the 64-byte atomic load and store instructions for
16979 accelerators. This option is enabled by default for
16980 -march=armv8.7-a.
16981
16982 mops
16983 Enable the instructions to accelerate memory operations like
16984 "memcpy", "memmove", "memset". This option is enabled by default
16985 for -march=armv8.8-a
16986
16987 flagm
16988 Enable the Flag Manipulation instructions Extension.
16989
16990 pauth
16991 Enable the Pointer Authentication Extension.
16992
16993 Feature crypto implies aes, sha2, and simd, which implies fp.
16994 Conversely, nofp implies nosimd, which implies nocrypto, noaes and
16995 nosha2.
16996
16997 Adapteva Epiphany Options
16998
16999 These -m options are defined for Adapteva Epiphany:
17000
17001 -mhalf-reg-file
17002 Don't allocate any register in the range "r32"..."r63". That
17003 allows code to run on hardware variants that lack these registers.
17004
17005 -mprefer-short-insn-regs
17006 Preferentially allocate registers that allow short instruction
17007 generation. This can result in increased instruction count, so
17008 this may either reduce or increase overall code size.
17009
17010 -mbranch-cost=num
17011 Set the cost of branches to roughly num "simple" instructions.
17012 This cost is only a heuristic and is not guaranteed to produce
17013 consistent results across releases.
17014
17015 -mcmove
17016 Enable the generation of conditional moves.
17017
17018 -mnops=num
17019 Emit num NOPs before every other generated instruction.
17020
17021 -mno-soft-cmpsf
17022 For single-precision floating-point comparisons, emit an "fsub"
17023 instruction and test the flags. This is faster than a software
17024 comparison, but can get incorrect results in the presence of NaNs,
17025 or when two different small numbers are compared such that their
17026 difference is calculated as zero. The default is -msoft-cmpsf,
17027 which uses slower, but IEEE-compliant, software comparisons.
17028
17029 -mstack-offset=num
17030 Set the offset between the top of the stack and the stack pointer.
17031 E.g., a value of 8 means that the eight bytes in the range
17032 "sp+0...sp+7" can be used by leaf functions without stack
17033 allocation. Values other than 8 or 16 are untested and unlikely to
17034 work. Note also that this option changes the ABI; compiling a
17035 program with a different stack offset than the libraries have been
17036 compiled with generally does not work. This option can be useful
17037 if you want to evaluate if a different stack offset would give you
17038 better code, but to actually use a different stack offset to build
17039 working programs, it is recommended to configure the toolchain with
17040 the appropriate --with-stack-offset=num option.
17041
17042 -mno-round-nearest
17043 Make the scheduler assume that the rounding mode has been set to
17044 truncating. The default is -mround-nearest.
17045
17046 -mlong-calls
17047 If not otherwise specified by an attribute, assume all calls might
17048 be beyond the offset range of the "b" / "bl" instructions, and
17049 therefore load the function address into a register before
17050 performing a (otherwise direct) call. This is the default.
17051
17052 -mshort-calls
17053 If not otherwise specified by an attribute, assume all direct calls
17054 are in the range of the "b" / "bl" instructions, so use these
17055 instructions for direct calls. The default is -mlong-calls.
17056
17057 -msmall16
17058 Assume addresses can be loaded as 16-bit unsigned values. This
17059 does not apply to function addresses for which -mlong-calls
17060 semantics are in effect.
17061
17062 -mfp-mode=mode
17063 Set the prevailing mode of the floating-point unit. This
17064 determines the floating-point mode that is provided and expected at
17065 function call and return time. Making this mode match the mode you
17066 predominantly need at function start can make your programs smaller
17067 and faster by avoiding unnecessary mode switches.
17068
17069 mode can be set to one the following values:
17070
17071 caller
17072 Any mode at function entry is valid, and retained or restored
17073 when the function returns, and when it calls other functions.
17074 This mode is useful for compiling libraries or other
17075 compilation units you might want to incorporate into different
17076 programs with different prevailing FPU modes, and the
17077 convenience of being able to use a single object file outweighs
17078 the size and speed overhead for any extra mode switching that
17079 might be needed, compared with what would be needed with a more
17080 specific choice of prevailing FPU mode.
17081
17082 truncate
17083 This is the mode used for floating-point calculations with
17084 truncating (i.e. round towards zero) rounding mode. That
17085 includes conversion from floating point to integer.
17086
17087 round-nearest
17088 This is the mode used for floating-point calculations with
17089 round-to-nearest-or-even rounding mode.
17090
17091 int This is the mode used to perform integer calculations in the
17092 FPU, e.g. integer multiply, or integer multiply-and-
17093 accumulate.
17094
17095 The default is -mfp-mode=caller
17096
17097 -mno-split-lohi
17098 -mno-postinc
17099 -mno-postmodify
17100 Code generation tweaks that disable, respectively, splitting of
17101 32-bit loads, generation of post-increment addresses, and
17102 generation of post-modify addresses. The defaults are msplit-lohi,
17103 -mpost-inc, and -mpost-modify.
17104
17105 -mnovect-double
17106 Change the preferred SIMD mode to SImode. The default is
17107 -mvect-double, which uses DImode as preferred SIMD mode.
17108
17109 -max-vect-align=num
17110 The maximum alignment for SIMD vector mode types. num may be 4 or
17111 8. The default is 8. Note that this is an ABI change, even though
17112 many library function interfaces are unaffected if they don't use
17113 SIMD vector modes in places that affect size and/or alignment of
17114 relevant types.
17115
17116 -msplit-vecmove-early
17117 Split vector moves into single word moves before reload. In theory
17118 this can give better register allocation, but so far the reverse
17119 seems to be generally the case.
17120
17121 -m1reg-reg
17122 Specify a register to hold the constant -1, which makes loading
17123 small negative constants and certain bitmasks faster. Allowable
17124 values for reg are r43 and r63, which specify use of that register
17125 as a fixed register, and none, which means that no register is used
17126 for this purpose. The default is -m1reg-none.
17127
17128 AMD GCN Options
17129
17130 These options are defined specifically for the AMD GCN port.
17131
17132 -march=gpu
17133 -mtune=gpu
17134 Set architecture type or tuning for gpu. Supported values for gpu
17135 are
17136
17137 fiji
17138 Compile for GCN3 Fiji devices (gfx803).
17139
17140 gfx900
17141 Compile for GCN5 Vega 10 devices (gfx900).
17142
17143 gfx906
17144 Compile for GCN5 Vega 20 devices (gfx906).
17145
17146 -msram-ecc=on
17147 -msram-ecc=off
17148 -msram-ecc=any
17149 Compile binaries suitable for devices with the SRAM-ECC feature
17150 enabled, disabled, or either mode. This feature can be enabled
17151 per-process on some devices. The compiled code must match the
17152 device mode. The default is any, for devices that support it.
17153
17154 -mstack-size=bytes
17155 Specify how many bytes of stack space will be requested for each
17156 GPU thread (wave-front). Beware that there may be many threads and
17157 limited memory available. The size of the stack allocation may
17158 also have an impact on run-time performance. The default is 32KB
17159 when using OpenACC or OpenMP, and 1MB otherwise.
17160
17161 -mxnack
17162 Compile binaries suitable for devices with the XNACK feature
17163 enabled. Some devices always require XNACK and some allow the user
17164 to configure XNACK. The compiled code must match the device mode.
17165 The default is -mno-xnack. At present this option is a placeholder
17166 for support that is not yet implemented.
17167
17168 ARC Options
17169
17170 The following options control the architecture variant for which code
17171 is being compiled:
17172
17173 -mbarrel-shifter
17174 Generate instructions supported by barrel shifter. This is the
17175 default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
17176
17177 -mjli-always
17178 Force to call a function using jli_s instruction. This option is
17179 valid only for ARCv2 architecture.
17180
17181 -mcpu=cpu
17182 Set architecture type, register usage, and instruction scheduling
17183 parameters for cpu. There are also shortcut alias options
17184 available for backward compatibility and convenience. Supported
17185 values for cpu are
17186
17187 arc600
17188 Compile for ARC600. Aliases: -mA6, -mARC600.
17189
17190 arc601
17191 Compile for ARC601. Alias: -mARC601.
17192
17193 arc700
17194 Compile for ARC700. Aliases: -mA7, -mARC700. This is the
17195 default when configured with --with-cpu=arc700.
17196
17197 arcem
17198 Compile for ARC EM.
17199
17200 archs
17201 Compile for ARC HS.
17202
17203 em Compile for ARC EM CPU with no hardware extensions.
17204
17205 em4 Compile for ARC EM4 CPU.
17206
17207 em4_dmips
17208 Compile for ARC EM4 DMIPS CPU.
17209
17210 em4_fpus
17211 Compile for ARC EM4 DMIPS CPU with the single-precision
17212 floating-point extension.
17213
17214 em4_fpuda
17215 Compile for ARC EM4 DMIPS CPU with single-precision floating-
17216 point and double assist instructions.
17217
17218 hs Compile for ARC HS CPU with no hardware extensions except the
17219 atomic instructions.
17220
17221 hs34
17222 Compile for ARC HS34 CPU.
17223
17224 hs38
17225 Compile for ARC HS38 CPU.
17226
17227 hs38_linux
17228 Compile for ARC HS38 CPU with all hardware extensions on.
17229
17230 arc600_norm
17231 Compile for ARC 600 CPU with "norm" instructions enabled.
17232
17233 arc600_mul32x16
17234 Compile for ARC 600 CPU with "norm" and 32x16-bit multiply
17235 instructions enabled.
17236
17237 arc600_mul64
17238 Compile for ARC 600 CPU with "norm" and "mul64"-family
17239 instructions enabled.
17240
17241 arc601_norm
17242 Compile for ARC 601 CPU with "norm" instructions enabled.
17243
17244 arc601_mul32x16
17245 Compile for ARC 601 CPU with "norm" and 32x16-bit multiply
17246 instructions enabled.
17247
17248 arc601_mul64
17249 Compile for ARC 601 CPU with "norm" and "mul64"-family
17250 instructions enabled.
17251
17252 nps400
17253 Compile for ARC 700 on NPS400 chip.
17254
17255 em_mini
17256 Compile for ARC EM minimalist configuration featuring reduced
17257 register set.
17258
17259 -mdpfp
17260 -mdpfp-compact
17261 Generate double-precision FPX instructions, tuned for the compact
17262 implementation.
17263
17264 -mdpfp-fast
17265 Generate double-precision FPX instructions, tuned for the fast
17266 implementation.
17267
17268 -mno-dpfp-lrsr
17269 Disable "lr" and "sr" instructions from using FPX extension aux
17270 registers.
17271
17272 -mea
17273 Generate extended arithmetic instructions. Currently only "divaw",
17274 "adds", "subs", and "sat16" are supported. Only valid for
17275 -mcpu=ARC700.
17276
17277 -mno-mpy
17278 Do not generate "mpy"-family instructions for ARC700. This option
17279 is deprecated.
17280
17281 -mmul32x16
17282 Generate 32x16-bit multiply and multiply-accumulate instructions.
17283
17284 -mmul64
17285 Generate "mul64" and "mulu64" instructions. Only valid for
17286 -mcpu=ARC600.
17287
17288 -mnorm
17289 Generate "norm" instructions. This is the default if -mcpu=ARC700
17290 is in effect.
17291
17292 -mspfp
17293 -mspfp-compact
17294 Generate single-precision FPX instructions, tuned for the compact
17295 implementation.
17296
17297 -mspfp-fast
17298 Generate single-precision FPX instructions, tuned for the fast
17299 implementation.
17300
17301 -msimd
17302 Enable generation of ARC SIMD instructions via target-specific
17303 builtins. Only valid for -mcpu=ARC700.
17304
17305 -msoft-float
17306 This option ignored; it is provided for compatibility purposes
17307 only. Software floating-point code is emitted by default, and this
17308 default can overridden by FPX options; -mspfp, -mspfp-compact, or
17309 -mspfp-fast for single precision, and -mdpfp, -mdpfp-compact, or
17310 -mdpfp-fast for double precision.
17311
17312 -mswap
17313 Generate "swap" instructions.
17314
17315 -matomic
17316 This enables use of the locked load/store conditional extension to
17317 implement atomic memory built-in functions. Not available for ARC
17318 6xx or ARC EM cores.
17319
17320 -mdiv-rem
17321 Enable "div" and "rem" instructions for ARCv2 cores.
17322
17323 -mcode-density
17324 Enable code density instructions for ARC EM. This option is on by
17325 default for ARC HS.
17326
17327 -mll64
17328 Enable double load/store operations for ARC HS cores.
17329
17330 -mtp-regno=regno
17331 Specify thread pointer register number.
17332
17333 -mmpy-option=multo
17334 Compile ARCv2 code with a multiplier design option. You can
17335 specify the option using either a string or numeric value for
17336 multo. wlh1 is the default value. The recognized values are:
17337
17338 0
17339 none
17340 No multiplier available.
17341
17342 1
17343 w 16x16 multiplier, fully pipelined. The following instructions
17344 are enabled: "mpyw" and "mpyuw".
17345
17346 2
17347 wlh1
17348 32x32 multiplier, fully pipelined (1 stage). The following
17349 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17350 "mpymu", and "mpy_s".
17351
17352 3
17353 wlh2
17354 32x32 multiplier, fully pipelined (2 stages). The following
17355 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17356 "mpymu", and "mpy_s".
17357
17358 4
17359 wlh3
17360 Two 16x16 multipliers, blocking, sequential. The following
17361 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17362 "mpymu", and "mpy_s".
17363
17364 5
17365 wlh4
17366 One 16x16 multiplier, blocking, sequential. The following
17367 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17368 "mpymu", and "mpy_s".
17369
17370 6
17371 wlh5
17372 One 32x4 multiplier, blocking, sequential. The following
17373 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17374 "mpymu", and "mpy_s".
17375
17376 7
17377 plus_dmpy
17378 ARC HS SIMD support.
17379
17380 8
17381 plus_macd
17382 ARC HS SIMD support.
17383
17384 9
17385 plus_qmacw
17386 ARC HS SIMD support.
17387
17388 This option is only available for ARCv2 cores.
17389
17390 -mfpu=fpu
17391 Enables support for specific floating-point hardware extensions for
17392 ARCv2 cores. Supported values for fpu are:
17393
17394 fpus
17395 Enables support for single-precision floating-point hardware
17396 extensions.
17397
17398 fpud
17399 Enables support for double-precision floating-point hardware
17400 extensions. The single-precision floating-point extension is
17401 also enabled. Not available for ARC EM.
17402
17403 fpuda
17404 Enables support for double-precision floating-point hardware
17405 extensions using double-precision assist instructions. The
17406 single-precision floating-point extension is also enabled.
17407 This option is only available for ARC EM.
17408
17409 fpuda_div
17410 Enables support for double-precision floating-point hardware
17411 extensions using double-precision assist instructions. The
17412 single-precision floating-point, square-root, and divide
17413 extensions are also enabled. This option is only available for
17414 ARC EM.
17415
17416 fpuda_fma
17417 Enables support for double-precision floating-point hardware
17418 extensions using double-precision assist instructions. The
17419 single-precision floating-point and fused multiply and add
17420 hardware extensions are also enabled. This option is only
17421 available for ARC EM.
17422
17423 fpuda_all
17424 Enables support for double-precision floating-point hardware
17425 extensions using double-precision assist instructions. All
17426 single-precision floating-point hardware extensions are also
17427 enabled. This option is only available for ARC EM.
17428
17429 fpus_div
17430 Enables support for single-precision floating-point, square-
17431 root and divide hardware extensions.
17432
17433 fpud_div
17434 Enables support for double-precision floating-point, square-
17435 root and divide hardware extensions. This option includes
17436 option fpus_div. Not available for ARC EM.
17437
17438 fpus_fma
17439 Enables support for single-precision floating-point and fused
17440 multiply and add hardware extensions.
17441
17442 fpud_fma
17443 Enables support for double-precision floating-point and fused
17444 multiply and add hardware extensions. This option includes
17445 option fpus_fma. Not available for ARC EM.
17446
17447 fpus_all
17448 Enables support for all single-precision floating-point
17449 hardware extensions.
17450
17451 fpud_all
17452 Enables support for all single- and double-precision floating-
17453 point hardware extensions. Not available for ARC EM.
17454
17455 -mirq-ctrl-saved=register-range, blink, lp_count
17456 Specifies general-purposes registers that the processor
17457 automatically saves/restores on interrupt entry and exit.
17458 register-range is specified as two registers separated by a dash.
17459 The register range always starts with "r0", the upper limit is "fp"
17460 register. blink and lp_count are optional. This option is only
17461 valid for ARC EM and ARC HS cores.
17462
17463 -mrgf-banked-regs=number
17464 Specifies the number of registers replicated in second register
17465 bank on entry to fast interrupt. Fast interrupts are interrupts
17466 with the highest priority level P0. These interrupts save only PC
17467 and STATUS32 registers to avoid memory transactions during
17468 interrupt entry and exit sequences. Use this option when you are
17469 using fast interrupts in an ARC V2 family processor. Permitted
17470 values are 4, 8, 16, and 32.
17471
17472 -mlpc-width=width
17473 Specify the width of the "lp_count" register. Valid values for
17474 width are 8, 16, 20, 24, 28 and 32 bits. The default width is
17475 fixed to 32 bits. If the width is less than 32, the compiler does
17476 not attempt to transform loops in your program to use the zero-
17477 delay loop mechanism unless it is known that the "lp_count"
17478 register can hold the required loop-counter value. Depending on
17479 the width specified, the compiler and run-time library might
17480 continue to use the loop mechanism for various needs. This option
17481 defines macro "__ARC_LPC_WIDTH__" with the value of width.
17482
17483 -mrf16
17484 This option instructs the compiler to generate code for a 16-entry
17485 register file. This option defines the "__ARC_RF16__" preprocessor
17486 macro.
17487
17488 -mbranch-index
17489 Enable use of "bi" or "bih" instructions to implement jump tables.
17490
17491 The following options are passed through to the assembler, and also
17492 define preprocessor macro symbols.
17493
17494 -mdsp-packa
17495 Passed down to the assembler to enable the DSP Pack A extensions.
17496 Also sets the preprocessor symbol "__Xdsp_packa". This option is
17497 deprecated.
17498
17499 -mdvbf
17500 Passed down to the assembler to enable the dual Viterbi butterfly
17501 extension. Also sets the preprocessor symbol "__Xdvbf". This
17502 option is deprecated.
17503
17504 -mlock
17505 Passed down to the assembler to enable the locked load/store
17506 conditional extension. Also sets the preprocessor symbol
17507 "__Xlock".
17508
17509 -mmac-d16
17510 Passed down to the assembler. Also sets the preprocessor symbol
17511 "__Xxmac_d16". This option is deprecated.
17512
17513 -mmac-24
17514 Passed down to the assembler. Also sets the preprocessor symbol
17515 "__Xxmac_24". This option is deprecated.
17516
17517 -mrtsc
17518 Passed down to the assembler to enable the 64-bit time-stamp
17519 counter extension instruction. Also sets the preprocessor symbol
17520 "__Xrtsc". This option is deprecated.
17521
17522 -mswape
17523 Passed down to the assembler to enable the swap byte ordering
17524 extension instruction. Also sets the preprocessor symbol
17525 "__Xswape".
17526
17527 -mtelephony
17528 Passed down to the assembler to enable dual- and single-operand
17529 instructions for telephony. Also sets the preprocessor symbol
17530 "__Xtelephony". This option is deprecated.
17531
17532 -mxy
17533 Passed down to the assembler to enable the XY memory extension.
17534 Also sets the preprocessor symbol "__Xxy".
17535
17536 The following options control how the assembly code is annotated:
17537
17538 -misize
17539 Annotate assembler instructions with estimated addresses.
17540
17541 -mannotate-align
17542 Explain what alignment considerations lead to the decision to make
17543 an instruction short or long.
17544
17545 The following options are passed through to the linker:
17546
17547 -marclinux
17548 Passed through to the linker, to specify use of the "arclinux"
17549 emulation. This option is enabled by default in tool chains built
17550 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
17551 profiling is not requested.
17552
17553 -marclinux_prof
17554 Passed through to the linker, to specify use of the "arclinux_prof"
17555 emulation. This option is enabled by default in tool chains built
17556 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
17557 profiling is requested.
17558
17559 The following options control the semantics of generated code:
17560
17561 -mlong-calls
17562 Generate calls as register indirect calls, thus providing access to
17563 the full 32-bit address range.
17564
17565 -mmedium-calls
17566 Don't use less than 25-bit addressing range for calls, which is the
17567 offset available for an unconditional branch-and-link instruction.
17568 Conditional execution of function calls is suppressed, to allow use
17569 of the 25-bit range, rather than the 21-bit range with conditional
17570 branch-and-link. This is the default for tool chains built for
17571 "arc-linux-uclibc" and "arceb-linux-uclibc" targets.
17572
17573 -G num
17574 Put definitions of externally-visible data in a small data section
17575 if that data is no bigger than num bytes. The default value of num
17576 is 4 for any ARC configuration, or 8 when we have double load/store
17577 operations.
17578
17579 -mno-sdata
17580 Do not generate sdata references. This is the default for tool
17581 chains built for "arc-linux-uclibc" and "arceb-linux-uclibc"
17582 targets.
17583
17584 -mvolatile-cache
17585 Use ordinarily cached memory accesses for volatile references.
17586 This is the default.
17587
17588 -mno-volatile-cache
17589 Enable cache bypass for volatile references.
17590
17591 The following options fine tune code generation:
17592
17593 -malign-call
17594 Does nothing. Preserved for backward compatibility.
17595
17596 -mauto-modify-reg
17597 Enable the use of pre/post modify with register displacement.
17598
17599 -mbbit-peephole
17600 Enable bbit peephole2.
17601
17602 -mno-brcc
17603 This option disables a target-specific pass in arc_reorg to
17604 generate compare-and-branch ("brcc") instructions. It has no
17605 effect on generation of these instructions driven by the combiner
17606 pass.
17607
17608 -mcase-vector-pcrel
17609 Use PC-relative switch case tables to enable case table shortening.
17610 This is the default for -Os.
17611
17612 -mcompact-casesi
17613 Enable compact "casesi" pattern. This is the default for -Os, and
17614 only available for ARCv1 cores. This option is deprecated.
17615
17616 -mno-cond-exec
17617 Disable the ARCompact-specific pass to generate conditional
17618 execution instructions.
17619
17620 Due to delay slot scheduling and interactions between operand
17621 numbers, literal sizes, instruction lengths, and the support for
17622 conditional execution, the target-independent pass to generate
17623 conditional execution is often lacking, so the ARC port has kept a
17624 special pass around that tries to find more conditional execution
17625 generation opportunities after register allocation, branch
17626 shortening, and delay slot scheduling have been done. This pass
17627 generally, but not always, improves performance and code size, at
17628 the cost of extra compilation time, which is why there is an option
17629 to switch it off. If you have a problem with call instructions
17630 exceeding their allowable offset range because they are
17631 conditionalized, you should consider using -mmedium-calls instead.
17632
17633 -mearly-cbranchsi
17634 Enable pre-reload use of the "cbranchsi" pattern.
17635
17636 -mexpand-adddi
17637 Expand "adddi3" and "subdi3" at RTL generation time into "add.f",
17638 "adc" etc. This option is deprecated.
17639
17640 -mindexed-loads
17641 Enable the use of indexed loads. This can be problematic because
17642 some optimizers then assume that indexed stores exist, which is not
17643 the case.
17644
17645 -mlra
17646 Enable Local Register Allocation. This is still experimental for
17647 ARC, so by default the compiler uses standard reload (i.e.
17648 -mno-lra).
17649
17650 -mlra-priority-none
17651 Don't indicate any priority for target registers.
17652
17653 -mlra-priority-compact
17654 Indicate target register priority for r0..r3 / r12..r15.
17655
17656 -mlra-priority-noncompact
17657 Reduce target register priority for r0..r3 / r12..r15.
17658
17659 -mmillicode
17660 When optimizing for size (using -Os), prologues and epilogues that
17661 have to save or restore a large number of registers are often
17662 shortened by using call to a special function in libgcc; this is
17663 referred to as a millicode call. As these calls can pose
17664 performance issues, and/or cause linking issues when linking in a
17665 nonstandard way, this option is provided to turn on or off
17666 millicode call generation.
17667
17668 -mcode-density-frame
17669 This option enable the compiler to emit "enter" and "leave"
17670 instructions. These instructions are only valid for CPUs with
17671 code-density feature.
17672
17673 -mmixed-code
17674 Does nothing. Preserved for backward compatibility.
17675
17676 -mq-class
17677 Ths option is deprecated. Enable q instruction alternatives. This
17678 is the default for -Os.
17679
17680 -mRcq
17681 Enable Rcq constraint handling. Most short code generation depends
17682 on this. This is the default.
17683
17684 -mRcw
17685 Enable Rcw constraint handling. Most ccfsm condexec mostly depends
17686 on this. This is the default.
17687
17688 -msize-level=level
17689 Fine-tune size optimization with regards to instruction lengths and
17690 alignment. The recognized values for level are:
17691
17692 0 No size optimization. This level is deprecated and treated
17693 like 1.
17694
17695 1 Short instructions are used opportunistically.
17696
17697 2 In addition, alignment of loops and of code after barriers are
17698 dropped.
17699
17700 3 In addition, optional data alignment is dropped, and the option
17701 Os is enabled.
17702
17703 This defaults to 3 when -Os is in effect. Otherwise, the behavior
17704 when this is not set is equivalent to level 1.
17705
17706 -mtune=cpu
17707 Set instruction scheduling parameters for cpu, overriding any
17708 implied by -mcpu=.
17709
17710 Supported values for cpu are
17711
17712 ARC600
17713 Tune for ARC600 CPU.
17714
17715 ARC601
17716 Tune for ARC601 CPU.
17717
17718 ARC700
17719 Tune for ARC700 CPU with standard multiplier block.
17720
17721 ARC700-xmac
17722 Tune for ARC700 CPU with XMAC block.
17723
17724 ARC725D
17725 Tune for ARC725D CPU.
17726
17727 ARC750D
17728 Tune for ARC750D CPU.
17729
17730 -mmultcost=num
17731 Cost to assume for a multiply instruction, with 4 being equal to a
17732 normal instruction.
17733
17734 -munalign-prob-threshold=probability
17735 Does nothing. Preserved for backward compatibility.
17736
17737 The following options are maintained for backward compatibility, but
17738 are now deprecated and will be removed in a future release:
17739
17740 -margonaut
17741 Obsolete FPX.
17742
17743 -mbig-endian
17744 -EB Compile code for big-endian targets. Use of these options is now
17745 deprecated. Big-endian code is supported by configuring GCC to
17746 build "arceb-elf32" and "arceb-linux-uclibc" targets, for which big
17747 endian is the default.
17748
17749 -mlittle-endian
17750 -EL Compile code for little-endian targets. Use of these options is
17751 now deprecated. Little-endian code is supported by configuring GCC
17752 to build "arc-elf32" and "arc-linux-uclibc" targets, for which
17753 little endian is the default.
17754
17755 -mbarrel_shifter
17756 Replaced by -mbarrel-shifter.
17757
17758 -mdpfp_compact
17759 Replaced by -mdpfp-compact.
17760
17761 -mdpfp_fast
17762 Replaced by -mdpfp-fast.
17763
17764 -mdsp_packa
17765 Replaced by -mdsp-packa.
17766
17767 -mEA
17768 Replaced by -mea.
17769
17770 -mmac_24
17771 Replaced by -mmac-24.
17772
17773 -mmac_d16
17774 Replaced by -mmac-d16.
17775
17776 -mspfp_compact
17777 Replaced by -mspfp-compact.
17778
17779 -mspfp_fast
17780 Replaced by -mspfp-fast.
17781
17782 -mtune=cpu
17783 Values arc600, arc601, arc700 and arc700-xmac for cpu are replaced
17784 by ARC600, ARC601, ARC700 and ARC700-xmac respectively.
17785
17786 -multcost=num
17787 Replaced by -mmultcost.
17788
17789 ARM Options
17790
17791 These -m options are defined for the ARM port:
17792
17793 -mabi=name
17794 Generate code for the specified ABI. Permissible values are: apcs-
17795 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
17796
17797 -mapcs-frame
17798 Generate a stack frame that is compliant with the ARM Procedure
17799 Call Standard for all functions, even if this is not strictly
17800 necessary for correct execution of the code. Specifying
17801 -fomit-frame-pointer with this option causes the stack frames not
17802 to be generated for leaf functions. The default is
17803 -mno-apcs-frame. This option is deprecated.
17804
17805 -mapcs
17806 This is a synonym for -mapcs-frame and is deprecated.
17807
17808 -mthumb-interwork
17809 Generate code that supports calling between the ARM and Thumb
17810 instruction sets. Without this option, on pre-v5 architectures,
17811 the two instruction sets cannot be reliably used inside one
17812 program. The default is -mno-thumb-interwork, since slightly
17813 larger code is generated when -mthumb-interwork is specified. In
17814 AAPCS configurations this option is meaningless.
17815
17816 -mno-sched-prolog
17817 Prevent the reordering of instructions in the function prologue, or
17818 the merging of those instruction with the instructions in the
17819 function's body. This means that all functions start with a
17820 recognizable set of instructions (or in fact one of a choice from a
17821 small set of different function prologues), and this information
17822 can be used to locate the start of functions inside an executable
17823 piece of code. The default is -msched-prolog.
17824
17825 -mfloat-abi=name
17826 Specifies which floating-point ABI to use. Permissible values are:
17827 soft, softfp and hard.
17828
17829 Specifying soft causes GCC to generate output containing library
17830 calls for floating-point operations. softfp allows the generation
17831 of code using hardware floating-point instructions, but still uses
17832 the soft-float calling conventions. hard allows generation of
17833 floating-point instructions and uses FPU-specific calling
17834 conventions.
17835
17836 The default depends on the specific target configuration. Note
17837 that the hard-float and soft-float ABIs are not link-compatible;
17838 you must compile your entire program with the same ABI, and link
17839 with a compatible set of libraries.
17840
17841 -mgeneral-regs-only
17842 Generate code which uses only the general-purpose registers. This
17843 will prevent the compiler from using floating-point and Advanced
17844 SIMD registers but will not impose any restrictions on the
17845 assembler.
17846
17847 -mlittle-endian
17848 Generate code for a processor running in little-endian mode. This
17849 is the default for all standard configurations.
17850
17851 -mbig-endian
17852 Generate code for a processor running in big-endian mode; the
17853 default is to compile code for a little-endian processor.
17854
17855 -mbe8
17856 -mbe32
17857 When linking a big-endian image select between BE8 and BE32
17858 formats. The option has no effect for little-endian images and is
17859 ignored. The default is dependent on the selected target
17860 architecture. For ARMv6 and later architectures the default is
17861 BE8, for older architectures the default is BE32. BE32 format has
17862 been deprecated by ARM.
17863
17864 -march=name[+extension...]
17865 This specifies the name of the target ARM architecture. GCC uses
17866 this name to determine what kind of instructions it can emit when
17867 generating assembly code. This option can be used in conjunction
17868 with or instead of the -mcpu= option.
17869
17870 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
17871 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
17872 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
17873 armv8.6-a, armv9-a, armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m,
17874 armv7e-m, armv8-m.base, armv8-m.main, armv8.1-m.main, armv9-a,
17875 iwmmxt and iwmmxt2.
17876
17877 Additionally, the following architectures, which lack support for
17878 the Thumb execution state, are recognized but support is
17879 deprecated: armv4.
17880
17881 Many of the architectures support extensions. These can be added
17882 by appending +extension to the architecture name. Extension
17883 options are processed in order and capabilities accumulate. An
17884 extension will also enable any necessary base extensions upon which
17885 it depends. For example, the +crypto extension will always enable
17886 the +simd extension. The exception to the additive construction is
17887 for extensions that are prefixed with +no...: these extensions
17888 disable the specified option and any other extensions that may
17889 depend on the presence of that extension.
17890
17891 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
17892 writing -march=armv7-a+vfpv4 since the +simd option is entirely
17893 disabled by the +nofp option that follows it.
17894
17895 Most extension names are generically named, but have an effect that
17896 is dependent upon the architecture to which it is applied. For
17897 example, the +simd option can be applied to both armv7-a and
17898 armv8-a architectures, but will enable the original ARMv7-A
17899 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
17900 for armv8-a.
17901
17902 The table below lists the supported extensions for each
17903 architecture. Architectures not mentioned do not support any
17904 extensions.
17905
17906 armv5te
17907 armv6
17908 armv6j
17909 armv6k
17910 armv6kz
17911 armv6t2
17912 armv6z
17913 armv6zk
17914 +fp The VFPv2 floating-point instructions. The extension
17915 +vfpv2 can be used as an alias for this extension.
17916
17917 +nofp
17918 Disable the floating-point instructions.
17919
17920 armv7
17921 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
17922 architectures.
17923
17924 +fp The VFPv3 floating-point instructions, with 16 double-
17925 precision registers. The extension +vfpv3-d16 can be used
17926 as an alias for this extension. Note that floating-point
17927 is not supported by the base ARMv7-M architecture, but is
17928 compatible with both the ARMv7-A and ARMv7-R architectures.
17929
17930 +nofp
17931 Disable the floating-point instructions.
17932
17933 armv7-a
17934 +mp The multiprocessing extension.
17935
17936 +sec
17937 The security extension.
17938
17939 +fp The VFPv3 floating-point instructions, with 16 double-
17940 precision registers. The extension +vfpv3-d16 can be used
17941 as an alias for this extension.
17942
17943 +simd
17944 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17945 instructions. The extensions +neon and +neon-vfpv3 can be
17946 used as aliases for this extension.
17947
17948 +vfpv3
17949 The VFPv3 floating-point instructions, with 32 double-
17950 precision registers.
17951
17952 +vfpv3-d16-fp16
17953 The VFPv3 floating-point instructions, with 16 double-
17954 precision registers and the half-precision floating-point
17955 conversion operations.
17956
17957 +vfpv3-fp16
17958 The VFPv3 floating-point instructions, with 32 double-
17959 precision registers and the half-precision floating-point
17960 conversion operations.
17961
17962 +vfpv4-d16
17963 The VFPv4 floating-point instructions, with 16 double-
17964 precision registers.
17965
17966 +vfpv4
17967 The VFPv4 floating-point instructions, with 32 double-
17968 precision registers.
17969
17970 +neon-fp16
17971 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17972 instructions, with the half-precision floating-point
17973 conversion operations.
17974
17975 +neon-vfpv4
17976 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17977 instructions.
17978
17979 +nosimd
17980 Disable the Advanced SIMD instructions (does not disable
17981 floating point).
17982
17983 +nofp
17984 Disable the floating-point and Advanced SIMD instructions.
17985
17986 armv7ve
17987 The extended version of the ARMv7-A architecture with support
17988 for virtualization.
17989
17990 +fp The VFPv4 floating-point instructions, with 16 double-
17991 precision registers. The extension +vfpv4-d16 can be used
17992 as an alias for this extension.
17993
17994 +simd
17995 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17996 instructions. The extension +neon-vfpv4 can be used as an
17997 alias for this extension.
17998
17999 +vfpv3-d16
18000 The VFPv3 floating-point instructions, with 16 double-
18001 precision registers.
18002
18003 +vfpv3
18004 The VFPv3 floating-point instructions, with 32 double-
18005 precision registers.
18006
18007 +vfpv3-d16-fp16
18008 The VFPv3 floating-point instructions, with 16 double-
18009 precision registers and the half-precision floating-point
18010 conversion operations.
18011
18012 +vfpv3-fp16
18013 The VFPv3 floating-point instructions, with 32 double-
18014 precision registers and the half-precision floating-point
18015 conversion operations.
18016
18017 +vfpv4-d16
18018 The VFPv4 floating-point instructions, with 16 double-
18019 precision registers.
18020
18021 +vfpv4
18022 The VFPv4 floating-point instructions, with 32 double-
18023 precision registers.
18024
18025 +neon
18026 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
18027 instructions. The extension +neon-vfpv3 can be used as an
18028 alias for this extension.
18029
18030 +neon-fp16
18031 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
18032 instructions, with the half-precision floating-point
18033 conversion operations.
18034
18035 +nosimd
18036 Disable the Advanced SIMD instructions (does not disable
18037 floating point).
18038
18039 +nofp
18040 Disable the floating-point and Advanced SIMD instructions.
18041
18042 armv8-a
18043 +crc
18044 The Cyclic Redundancy Check (CRC) instructions.
18045
18046 +simd
18047 The ARMv8-A Advanced SIMD and floating-point instructions.
18048
18049 +crypto
18050 The cryptographic instructions.
18051
18052 +nocrypto
18053 Disable the cryptographic instructions.
18054
18055 +nofp
18056 Disable the floating-point, Advanced SIMD and cryptographic
18057 instructions.
18058
18059 +sb Speculation Barrier Instruction.
18060
18061 +predres
18062 Execution and Data Prediction Restriction Instructions.
18063
18064 armv8.1-a
18065 +simd
18066 The ARMv8.1-A Advanced SIMD and floating-point
18067 instructions.
18068
18069 +crypto
18070 The cryptographic instructions. This also enables the
18071 Advanced SIMD and floating-point instructions.
18072
18073 +nocrypto
18074 Disable the cryptographic instructions.
18075
18076 +nofp
18077 Disable the floating-point, Advanced SIMD and cryptographic
18078 instructions.
18079
18080 +sb Speculation Barrier Instruction.
18081
18082 +predres
18083 Execution and Data Prediction Restriction Instructions.
18084
18085 armv8.2-a
18086 armv8.3-a
18087 +fp16
18088 The half-precision floating-point data processing
18089 instructions. This also enables the Advanced SIMD and
18090 floating-point instructions.
18091
18092 +fp16fml
18093 The half-precision floating-point fmla extension. This
18094 also enables the half-precision floating-point extension
18095 and Advanced SIMD and floating-point instructions.
18096
18097 +simd
18098 The ARMv8.1-A Advanced SIMD and floating-point
18099 instructions.
18100
18101 +crypto
18102 The cryptographic instructions. This also enables the
18103 Advanced SIMD and floating-point instructions.
18104
18105 +dotprod
18106 Enable the Dot Product extension. This also enables
18107 Advanced SIMD instructions.
18108
18109 +nocrypto
18110 Disable the cryptographic extension.
18111
18112 +nofp
18113 Disable the floating-point, Advanced SIMD and cryptographic
18114 instructions.
18115
18116 +sb Speculation Barrier Instruction.
18117
18118 +predres
18119 Execution and Data Prediction Restriction Instructions.
18120
18121 +i8mm
18122 8-bit Integer Matrix Multiply instructions. This also
18123 enables Advanced SIMD and floating-point instructions.
18124
18125 +bf16
18126 Brain half-precision floating-point instructions. This
18127 also enables Advanced SIMD and floating-point instructions.
18128
18129 armv8.4-a
18130 +fp16
18131 The half-precision floating-point data processing
18132 instructions. This also enables the Advanced SIMD and
18133 floating-point instructions as well as the Dot Product
18134 extension and the half-precision floating-point fmla
18135 extension.
18136
18137 +simd
18138 The ARMv8.3-A Advanced SIMD and floating-point instructions
18139 as well as the Dot Product extension.
18140
18141 +crypto
18142 The cryptographic instructions. This also enables the
18143 Advanced SIMD and floating-point instructions as well as
18144 the Dot Product extension.
18145
18146 +nocrypto
18147 Disable the cryptographic extension.
18148
18149 +nofp
18150 Disable the floating-point, Advanced SIMD and cryptographic
18151 instructions.
18152
18153 +sb Speculation Barrier Instruction.
18154
18155 +predres
18156 Execution and Data Prediction Restriction Instructions.
18157
18158 +i8mm
18159 8-bit Integer Matrix Multiply instructions. This also
18160 enables Advanced SIMD and floating-point instructions.
18161
18162 +bf16
18163 Brain half-precision floating-point instructions. This
18164 also enables Advanced SIMD and floating-point instructions.
18165
18166 armv8.5-a
18167 +fp16
18168 The half-precision floating-point data processing
18169 instructions. This also enables the Advanced SIMD and
18170 floating-point instructions as well as the Dot Product
18171 extension and the half-precision floating-point fmla
18172 extension.
18173
18174 +simd
18175 The ARMv8.3-A Advanced SIMD and floating-point instructions
18176 as well as the Dot Product extension.
18177
18178 +crypto
18179 The cryptographic instructions. This also enables the
18180 Advanced SIMD and floating-point instructions as well as
18181 the Dot Product extension.
18182
18183 +nocrypto
18184 Disable the cryptographic extension.
18185
18186 +nofp
18187 Disable the floating-point, Advanced SIMD and cryptographic
18188 instructions.
18189
18190 +i8mm
18191 8-bit Integer Matrix Multiply instructions. This also
18192 enables Advanced SIMD and floating-point instructions.
18193
18194 +bf16
18195 Brain half-precision floating-point instructions. This
18196 also enables Advanced SIMD and floating-point instructions.
18197
18198 armv8.6-a
18199 +fp16
18200 The half-precision floating-point data processing
18201 instructions. This also enables the Advanced SIMD and
18202 floating-point instructions as well as the Dot Product
18203 extension and the half-precision floating-point fmla
18204 extension.
18205
18206 +simd
18207 The ARMv8.3-A Advanced SIMD and floating-point instructions
18208 as well as the Dot Product extension.
18209
18210 +crypto
18211 The cryptographic instructions. This also enables the
18212 Advanced SIMD and floating-point instructions as well as
18213 the Dot Product extension.
18214
18215 +nocrypto
18216 Disable the cryptographic extension.
18217
18218 +nofp
18219 Disable the floating-point, Advanced SIMD and cryptographic
18220 instructions.
18221
18222 +i8mm
18223 8-bit Integer Matrix Multiply instructions. This also
18224 enables Advanced SIMD and floating-point instructions.
18225
18226 +bf16
18227 Brain half-precision floating-point instructions. This
18228 also enables Advanced SIMD and floating-point instructions.
18229
18230 armv7-r
18231 +fp.sp
18232 The single-precision VFPv3 floating-point instructions.
18233 The extension +vfpv3xd can be used as an alias for this
18234 extension.
18235
18236 +fp The VFPv3 floating-point instructions with 16 double-
18237 precision registers. The extension +vfpv3-d16 can be used
18238 as an alias for this extension.
18239
18240 +vfpv3xd-d16-fp16
18241 The single-precision VFPv3 floating-point instructions with
18242 16 double-precision registers and the half-precision
18243 floating-point conversion operations.
18244
18245 +vfpv3-d16-fp16
18246 The VFPv3 floating-point instructions with 16 double-
18247 precision registers and the half-precision floating-point
18248 conversion operations.
18249
18250 +nofp
18251 Disable the floating-point extension.
18252
18253 +idiv
18254 The ARM-state integer division instructions.
18255
18256 +noidiv
18257 Disable the ARM-state integer division extension.
18258
18259 armv7e-m
18260 +fp The single-precision VFPv4 floating-point instructions.
18261
18262 +fpv5
18263 The single-precision FPv5 floating-point instructions.
18264
18265 +fp.dp
18266 The single- and double-precision FPv5 floating-point
18267 instructions.
18268
18269 +nofp
18270 Disable the floating-point extensions.
18271
18272 armv8.1-m.main
18273 +dsp
18274 The DSP instructions.
18275
18276 +mve
18277 The M-Profile Vector Extension (MVE) integer instructions.
18278
18279 +mve.fp
18280 The M-Profile Vector Extension (MVE) integer and single
18281 precision floating-point instructions.
18282
18283 +fp The single-precision floating-point instructions.
18284
18285 +fp.dp
18286 The single- and double-precision floating-point
18287 instructions.
18288
18289 +nofp
18290 Disable the floating-point extension.
18291
18292 +cdecp0, +cdecp1, ... , +cdecp7
18293 Enable the Custom Datapath Extension (CDE) on selected
18294 coprocessors according to the numbers given in the options
18295 in the range 0 to 7.
18296
18297 armv8-m.main
18298 +dsp
18299 The DSP instructions.
18300
18301 +nodsp
18302 Disable the DSP extension.
18303
18304 +fp The single-precision floating-point instructions.
18305
18306 +fp.dp
18307 The single- and double-precision floating-point
18308 instructions.
18309
18310 +nofp
18311 Disable the floating-point extension.
18312
18313 +cdecp0, +cdecp1, ... , +cdecp7
18314 Enable the Custom Datapath Extension (CDE) on selected
18315 coprocessors according to the numbers given in the options
18316 in the range 0 to 7.
18317
18318 armv8-r
18319 +crc
18320 The Cyclic Redundancy Check (CRC) instructions.
18321
18322 +fp.sp
18323 The single-precision FPv5 floating-point instructions.
18324
18325 +simd
18326 The ARMv8-A Advanced SIMD and floating-point instructions.
18327
18328 +crypto
18329 The cryptographic instructions.
18330
18331 +nocrypto
18332 Disable the cryptographic instructions.
18333
18334 +nofp
18335 Disable the floating-point, Advanced SIMD and cryptographic
18336 instructions.
18337
18338 -march=native causes the compiler to auto-detect the architecture
18339 of the build computer. At present, this feature is only supported
18340 on GNU/Linux, and not all architectures are recognized. If the
18341 auto-detect is unsuccessful the option has no effect.
18342
18343 -mtune=name
18344 This option specifies the name of the target ARM processor for
18345 which GCC should tune the performance of the code. For some ARM
18346 implementations better performance can be obtained by using this
18347 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
18348 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
18349 strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t, arm922t,
18350 arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t, arm9tdmi,
18351 arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e, arm1022e,
18352 arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp, arm1156t2-s,
18353 arm1156t2f-s, arm1176jz-s, arm1176jzf-s, generic-armv7-a,
18354 cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
18355 cortex-a17, cortex-a32, cortex-a35, cortex-a53, cortex-a55,
18356 cortex-a57, cortex-a72, cortex-a73, cortex-a75, cortex-a76,
18357 cortex-a76ae, cortex-a77, cortex-a78, cortex-a78ae, cortex-a78c,
18358 cortex-a710, ares, cortex-r4, cortex-r4f, cortex-r5, cortex-r7,
18359 cortex-r8, cortex-r52, cortex-r52plus, cortex-m0, cortex-m0plus,
18360 cortex-m1, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33,
18361 cortex-m35p, cortex-m55, cortex-x1, cortex-m1.small-multiply,
18362 cortex-m0.small-multiply, cortex-m0plus.small-multiply, exynos-m1,
18363 marvell-pj4, neoverse-n1, neoverse-n2, neoverse-v1, xscale, iwmmxt,
18364 iwmmxt2, ep9312, fa526, fa626, fa606te, fa626te, fmp626, fa726te,
18365 xgene1.
18366
18367 Additionally, this option can specify that GCC should tune the
18368 performance of the code for a big.LITTLE system. Permissible names
18369 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
18370 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
18371 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
18372 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
18373
18374 -mtune=generic-arch specifies that GCC should tune the performance
18375 for a blend of processors within architecture arch. The aim is to
18376 generate code that run well on the current most popular processors,
18377 balancing between optimizations that benefit some CPUs in the
18378 range, and avoiding performance pitfalls of other CPUs. The
18379 effects of this option may change in future GCC versions as CPU
18380 models come and go.
18381
18382 -mtune permits the same extension options as -mcpu, but the
18383 extension options do not affect the tuning of the generated code.
18384
18385 -mtune=native causes the compiler to auto-detect the CPU of the
18386 build computer. At present, this feature is only supported on
18387 GNU/Linux, and not all architectures are recognized. If the auto-
18388 detect is unsuccessful the option has no effect.
18389
18390 -mcpu=name[+extension...]
18391 This specifies the name of the target ARM processor. GCC uses this
18392 name to derive the name of the target ARM architecture (as if
18393 specified by -march) and the ARM processor type for which to tune
18394 for performance (as if specified by -mtune). Where this option is
18395 used in conjunction with -march or -mtune, those options take
18396 precedence over the appropriate part of this option.
18397
18398 Many of the supported CPUs implement optional architectural
18399 extensions. Where this is so the architectural extensions are
18400 normally enabled by default. If implementations that lack the
18401 extension exist, then the extension syntax can be used to disable
18402 those extensions that have been omitted. For floating-point and
18403 Advanced SIMD (Neon) instructions, the settings of the options
18404 -mfloat-abi and -mfpu must also be considered: floating-point and
18405 Advanced SIMD instructions will only be used if -mfloat-abi is not
18406 set to soft; and any setting of -mfpu other than auto will override
18407 the available floating-point and SIMD extension instructions.
18408
18409 For example, cortex-a9 can be found in three major configurations:
18410 integer only, with just a floating-point unit or with floating-
18411 point and Advanced SIMD. The default is to enable all the
18412 instructions, but the extensions +nosimd and +nofp can be used to
18413 disable just the SIMD or both the SIMD and floating-point
18414 instructions respectively.
18415
18416 Permissible names for this option are the same as those for -mtune.
18417
18418 The following extension options are common to the listed CPUs:
18419
18420 +nodsp
18421 Disable the DSP instructions on cortex-m33, cortex-m35p.
18422
18423 +nofp
18424 Disables the floating-point instructions on arm9e, arm946e-s,
18425 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
18426 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
18427 cortex-m7, cortex-m33 and cortex-m35p. Disables the floating-
18428 point and SIMD instructions on generic-armv7-a, cortex-a5,
18429 cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
18430 cortex-a17, cortex-a15.cortex-a7, cortex-a17.cortex-a7,
18431 cortex-a32, cortex-a35, cortex-a53 and cortex-a55.
18432
18433 +nofp.dp
18434 Disables the double-precision component of the floating-point
18435 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52,
18436 cortex-r52plus and cortex-m7.
18437
18438 +nosimd
18439 Disables the SIMD (but not floating-point) instructions on
18440 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
18441
18442 +crypto
18443 Enables the cryptographic instructions on cortex-a32,
18444 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
18445 cortex-a73, cortex-a75, exynos-m1, xgene1,
18446 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
18447 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
18448 cortex-a75.cortex-a55.
18449
18450 Additionally the generic-armv7-a pseudo target defaults to VFPv3
18451 with 16 double-precision registers. It supports the following
18452 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
18453 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
18454 neon-vfpv4. The meanings are the same as for the extensions to
18455 -march=armv7-a.
18456
18457 -mcpu=generic-arch is also permissible, and is equivalent to
18458 -march=arch -mtune=generic-arch. See -mtune for more information.
18459
18460 -mcpu=native causes the compiler to auto-detect the CPU of the
18461 build computer. At present, this feature is only supported on
18462 GNU/Linux, and not all architectures are recognized. If the auto-
18463 detect is unsuccessful the option has no effect.
18464
18465 -mfpu=name
18466 This specifies what floating-point hardware (or hardware emulation)
18467 is available on the target. Permissible names are: auto, vfpv2,
18468 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
18469 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
18470 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
18471 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
18472 and vfp is an alias for vfpv2.
18473
18474 The setting auto is the default and is special. It causes the
18475 compiler to select the floating-point and Advanced SIMD
18476 instructions based on the settings of -mcpu and -march.
18477
18478 If the selected floating-point hardware includes the NEON extension
18479 (e.g. -mfpu=neon), note that floating-point operations are not
18480 generated by GCC's auto-vectorization pass unless
18481 -funsafe-math-optimizations is also specified. This is because
18482 NEON hardware does not fully implement the IEEE 754 standard for
18483 floating-point arithmetic (in particular denormal values are
18484 treated as zero), so the use of NEON instructions may lead to a
18485 loss of precision.
18486
18487 You can also set the fpu name at function level by using the
18488 "target("fpu=")" function attributes or pragmas.
18489
18490 -mfp16-format=name
18491 Specify the format of the "__fp16" half-precision floating-point
18492 type. Permissible names are none, ieee, and alternative; the
18493 default is none, in which case the "__fp16" type is not defined.
18494
18495 -mstructure-size-boundary=n
18496 The sizes of all structures and unions are rounded up to a multiple
18497 of the number of bits set by this option. Permissible values are
18498 8, 32 and 64. The default value varies for different toolchains.
18499 For the COFF targeted toolchain the default value is 8. A value of
18500 64 is only allowed if the underlying ABI supports it.
18501
18502 Specifying a larger number can produce faster, more efficient code,
18503 but can also increase the size of the program. Different values
18504 are potentially incompatible. Code compiled with one value cannot
18505 necessarily expect to work with code or libraries compiled with
18506 another value, if they exchange information using structures or
18507 unions.
18508
18509 This option is deprecated.
18510
18511 -mabort-on-noreturn
18512 Generate a call to the function "abort" at the end of a "noreturn"
18513 function. It is executed if the function tries to return.
18514
18515 -mlong-calls
18516 -mno-long-calls
18517 Tells the compiler to perform function calls by first loading the
18518 address of the function into a register and then performing a
18519 subroutine call on this register. This switch is needed if the
18520 target function lies outside of the 64-megabyte addressing range of
18521 the offset-based version of subroutine call instruction.
18522
18523 Even if this switch is enabled, not all function calls are turned
18524 into long calls. The heuristic is that static functions, functions
18525 that have the "short_call" attribute, functions that are inside the
18526 scope of a "#pragma no_long_calls" directive, and functions whose
18527 definitions have already been compiled within the current
18528 compilation unit are not turned into long calls. The exceptions to
18529 this rule are that weak function definitions, functions with the
18530 "long_call" attribute or the "section" attribute, and functions
18531 that are within the scope of a "#pragma long_calls" directive are
18532 always turned into long calls.
18533
18534 This feature is not enabled by default. Specifying -mno-long-calls
18535 restores the default behavior, as does placing the function calls
18536 within the scope of a "#pragma long_calls_off" directive. Note
18537 these switches have no effect on how the compiler generates code to
18538 handle function calls via function pointers.
18539
18540 -msingle-pic-base
18541 Treat the register used for PIC addressing as read-only, rather
18542 than loading it in the prologue for each function. The runtime
18543 system is responsible for initializing this register with an
18544 appropriate value before execution begins.
18545
18546 -mpic-register=reg
18547 Specify the register to be used for PIC addressing. For standard
18548 PIC base case, the default is any suitable register determined by
18549 compiler. For single PIC base case, the default is R9 if target is
18550 EABI based or stack-checking is enabled, otherwise the default is
18551 R10.
18552
18553 -mpic-data-is-text-relative
18554 Assume that the displacement between the text and data segments is
18555 fixed at static link time. This permits using PC-relative
18556 addressing operations to access data known to be in the data
18557 segment. For non-VxWorks RTP targets, this option is enabled by
18558 default. When disabled on such targets, it will enable
18559 -msingle-pic-base by default.
18560
18561 -mpoke-function-name
18562 Write the name of each function into the text section, directly
18563 preceding the function prologue. The generated code is similar to
18564 this:
18565
18566 t0
18567 .ascii "arm_poke_function_name", 0
18568 .align
18569 t1
18570 .word 0xff000000 + (t1 - t0)
18571 arm_poke_function_name
18572 mov ip, sp
18573 stmfd sp!, {fp, ip, lr, pc}
18574 sub fp, ip, #4
18575
18576 When performing a stack backtrace, code can inspect the value of
18577 "pc" stored at "fp + 0". If the trace function then looks at
18578 location "pc - 12" and the top 8 bits are set, then we know that
18579 there is a function name embedded immediately preceding this
18580 location and has length "((pc[-3]) & 0xff000000)".
18581
18582 -mthumb
18583 -marm
18584 Select between generating code that executes in ARM and Thumb
18585 states. The default for most configurations is to generate code
18586 that executes in ARM state, but the default can be changed by
18587 configuring GCC with the --with-mode=state configure option.
18588
18589 You can also override the ARM and Thumb mode for each function by
18590 using the "target("thumb")" and "target("arm")" function attributes
18591 or pragmas.
18592
18593 -mflip-thumb
18594 Switch ARM/Thumb modes on alternating functions. This option is
18595 provided for regression testing of mixed Thumb/ARM code generation,
18596 and is not intended for ordinary use in compiling code.
18597
18598 -mtpcs-frame
18599 Generate a stack frame that is compliant with the Thumb Procedure
18600 Call Standard for all non-leaf functions. (A leaf function is one
18601 that does not call any other functions.) The default is
18602 -mno-tpcs-frame.
18603
18604 -mtpcs-leaf-frame
18605 Generate a stack frame that is compliant with the Thumb Procedure
18606 Call Standard for all leaf functions. (A leaf function is one that
18607 does not call any other functions.) The default is
18608 -mno-apcs-leaf-frame.
18609
18610 -mcallee-super-interworking
18611 Gives all externally visible functions in the file being compiled
18612 an ARM instruction set header which switches to Thumb mode before
18613 executing the rest of the function. This allows these functions to
18614 be called from non-interworking code. This option is not valid in
18615 AAPCS configurations because interworking is enabled by default.
18616
18617 -mcaller-super-interworking
18618 Allows calls via function pointers (including virtual functions) to
18619 execute correctly regardless of whether the target code has been
18620 compiled for interworking or not. There is a small overhead in the
18621 cost of executing a function pointer if this option is enabled.
18622 This option is not valid in AAPCS configurations because
18623 interworking is enabled by default.
18624
18625 -mtp=name
18626 Specify the access model for the thread local storage pointer. The
18627 valid models are soft, which generates calls to "__aeabi_read_tp",
18628 cp15, which fetches the thread pointer from "cp15" directly
18629 (supported in the arm6k architecture), and auto, which uses the
18630 best available method for the selected processor. The default
18631 setting is auto.
18632
18633 -mtls-dialect=dialect
18634 Specify the dialect to use for accessing thread local storage. Two
18635 dialects are supported---gnu and gnu2. The gnu dialect selects the
18636 original GNU scheme for supporting local and global dynamic TLS
18637 models. The gnu2 dialect selects the GNU descriptor scheme, which
18638 provides better performance for shared libraries. The GNU
18639 descriptor scheme is compatible with the original scheme, but does
18640 require new assembler, linker and library support. Initial and
18641 local exec TLS models are unaffected by this option and always use
18642 the original scheme.
18643
18644 -mword-relocations
18645 Only generate absolute relocations on word-sized values (i.e.
18646 R_ARM_ABS32). This is enabled by default on targets (uClinux,
18647 SymbianOS) where the runtime loader imposes this restriction, and
18648 when -fpic or -fPIC is specified. This option conflicts with
18649 -mslow-flash-data.
18650
18651 -mfix-cortex-m3-ldrd
18652 Some Cortex-M3 cores can cause data corruption when "ldrd"
18653 instructions with overlapping destination and base registers are
18654 used. This option avoids generating these instructions. This
18655 option is enabled by default when -mcpu=cortex-m3 is specified.
18656
18657 -mfix-cortex-a57-aes-1742098
18658 -mno-fix-cortex-a57-aes-1742098
18659 -mfix-cortex-a72-aes-1655431
18660 -mno-fix-cortex-a72-aes-1655431
18661 Enable (disable) mitigation for an erratum on Cortex-A57 and
18662 Cortex-A72 that affects the AES cryptographic instructions. This
18663 option is enabled by default when either -mcpu=cortex-a57 or
18664 -mcpu=cortex-a72 is specified.
18665
18666 -munaligned-access
18667 -mno-unaligned-access
18668 Enables (or disables) reading and writing of 16- and 32- bit values
18669 from addresses that are not 16- or 32- bit aligned. By default
18670 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
18671 ARMv8-M Baseline architectures, and enabled for all other
18672 architectures. If unaligned access is not enabled then words in
18673 packed data structures are accessed a byte at a time.
18674
18675 The ARM attribute "Tag_CPU_unaligned_access" is set in the
18676 generated object file to either true or false, depending upon the
18677 setting of this option. If unaligned access is enabled then the
18678 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
18679
18680 -mneon-for-64bits
18681 This option is deprecated and has no effect.
18682
18683 -mslow-flash-data
18684 Assume loading data from flash is slower than fetching instruction.
18685 Therefore literal load is minimized for better performance. This
18686 option is only supported when compiling for ARMv7 M-profile and off
18687 by default. It conflicts with -mword-relocations.
18688
18689 -masm-syntax-unified
18690 Assume inline assembler is using unified asm syntax. The default
18691 is currently off which implies divided syntax. This option has no
18692 impact on Thumb2. However, this may change in future releases of
18693 GCC. Divided syntax should be considered deprecated.
18694
18695 -mrestrict-it
18696 Restricts generation of IT blocks to conform to the rules of
18697 ARMv8-A. IT blocks can only contain a single 16-bit instruction
18698 from a select set of instructions. This option is on by default for
18699 ARMv8-A Thumb mode.
18700
18701 -mprint-tune-info
18702 Print CPU tuning information as comment in assembler file. This is
18703 an option used only for regression testing of the compiler and not
18704 intended for ordinary use in compiling code. This option is
18705 disabled by default.
18706
18707 -mverbose-cost-dump
18708 Enable verbose cost model dumping in the debug dump files. This
18709 option is provided for use in debugging the compiler.
18710
18711 -mpure-code
18712 Do not allow constant data to be placed in code sections.
18713 Additionally, when compiling for ELF object format give all text
18714 sections the ELF processor-specific section attribute
18715 "SHF_ARM_PURECODE". This option is only available when generating
18716 non-pic code for M-profile targets.
18717
18718 -mcmse
18719 Generate secure code as per the "ARMv8-M Security Extensions:
18720 Requirements on Development Tools Engineering Specification", which
18721 can be found on
18722 <https://developer.arm.com/documentation/ecm0359818/latest/>.
18723
18724 -mfix-cmse-cve-2021-35465
18725 Mitigate against a potential security issue with the "VLLDM"
18726 instruction in some M-profile devices when using CMSE
18727 (CVE-2021-365465). This option is enabled by default when the
18728 option -mcpu= is used with "cortex-m33", "cortex-m35p" or
18729 "cortex-m55". The option -mno-fix-cmse-cve-2021-35465 can be used
18730 to disable the mitigation.
18731
18732 -mstack-protector-guard=guard
18733 -mstack-protector-guard-offset=offset
18734 Generate stack protection code using canary at guard. Supported
18735 locations are global for a global canary or tls for a canary
18736 accessible via the TLS register. The option
18737 -mstack-protector-guard-offset= is for use with
18738 -fstack-protector-guard=tls and not for use in user-land code.
18739
18740 -mfdpic
18741 -mno-fdpic
18742 Select the FDPIC ABI, which uses 64-bit function descriptors to
18743 represent pointers to functions. When the compiler is configured
18744 for "arm-*-uclinuxfdpiceabi" targets, this option is on by default
18745 and implies -fPIE if none of the PIC/PIE-related options is
18746 provided. On other targets, it only enables the FDPIC-specific
18747 code generation features, and the user should explicitly provide
18748 the PIC/PIE-related options as needed.
18749
18750 Note that static linking is not supported because it would still
18751 involve the dynamic linker when the program self-relocates. If
18752 such behavior is acceptable, use -static and -Wl,-dynamic-linker
18753 options.
18754
18755 The opposite -mno-fdpic option is useful (and required) to build
18756 the Linux kernel using the same ("arm-*-uclinuxfdpiceabi")
18757 toolchain as the one used to build the userland programs.
18758
18759 AVR Options
18760
18761 These options are defined for AVR implementations:
18762
18763 -mmcu=mcu
18764 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18765
18766 The default for this option is avr2.
18767
18768 GCC supports the following AVR devices and ISAs:
18769
18770 "avr2"
18771 "Classic" devices with up to 8 KiB of program memory. mcu =
18772 "attiny22", "attiny26", "at90s2313", "at90s2323", "at90s2333",
18773 "at90s2343", "at90s4414", "at90s4433", "at90s4434",
18774 "at90c8534", "at90s8515", "at90s8535".
18775
18776 "avr25"
18777 "Classic" devices with up to 8 KiB of program memory and with
18778 the "MOVW" instruction. mcu = "attiny13", "attiny13a",
18779 "attiny24", "attiny24a", "attiny25", "attiny261", "attiny261a",
18780 "attiny2313", "attiny2313a", "attiny43u", "attiny44",
18781 "attiny44a", "attiny45", "attiny48", "attiny441", "attiny461",
18782 "attiny461a", "attiny4313", "attiny84", "attiny84a",
18783 "attiny85", "attiny87", "attiny88", "attiny828", "attiny841",
18784 "attiny861", "attiny861a", "ata5272", "ata6616c", "at86rf401".
18785
18786 "avr3"
18787 "Classic" devices with 16 KiB up to 64 KiB of program memory.
18788 mcu = "at76c711", "at43usb355".
18789
18790 "avr31"
18791 "Classic" devices with 128 KiB of program memory. mcu =
18792 "atmega103", "at43usb320".
18793
18794 "avr35"
18795 "Classic" devices with 16 KiB up to 64 KiB of program memory
18796 and with the "MOVW" instruction. mcu = "attiny167",
18797 "attiny1634", "atmega8u2", "atmega16u2", "atmega32u2",
18798 "ata5505", "ata6617c", "ata664251", "at90usb82", "at90usb162".
18799
18800 "avr4"
18801 "Enhanced" devices with up to 8 KiB of program memory. mcu =
18802 "atmega48", "atmega48a", "atmega48p", "atmega48pa",
18803 "atmega48pb", "atmega8", "atmega8a", "atmega8hva", "atmega88",
18804 "atmega88a", "atmega88p", "atmega88pa", "atmega88pb",
18805 "atmega8515", "atmega8535", "ata6285", "ata6286", "ata6289",
18806 "ata6612c", "at90pwm1", "at90pwm2", "at90pwm2b", "at90pwm3",
18807 "at90pwm3b", "at90pwm81".
18808
18809 "avr5"
18810 "Enhanced" devices with 16 KiB up to 64 KiB of program memory.
18811 mcu = "atmega16", "atmega16a", "atmega16hva", "atmega16hva2",
18812 "atmega16hvb", "atmega16hvbrevb", "atmega16m1", "atmega16u4",
18813 "atmega161", "atmega162", "atmega163", "atmega164a",
18814 "atmega164p", "atmega164pa", "atmega165", "atmega165a",
18815 "atmega165p", "atmega165pa", "atmega168", "atmega168a",
18816 "atmega168p", "atmega168pa", "atmega168pb", "atmega169",
18817 "atmega169a", "atmega169p", "atmega169pa", "atmega32",
18818 "atmega32a", "atmega32c1", "atmega32hvb", "atmega32hvbrevb",
18819 "atmega32m1", "atmega32u4", "atmega32u6", "atmega323",
18820 "atmega324a", "atmega324p", "atmega324pa", "atmega324pb",
18821 "atmega325", "atmega325a", "atmega325p", "atmega325pa",
18822 "atmega328", "atmega328p", "atmega328pb", "atmega329",
18823 "atmega329a", "atmega329p", "atmega329pa", "atmega3250",
18824 "atmega3250a", "atmega3250p", "atmega3250pa", "atmega3290",
18825 "atmega3290a", "atmega3290p", "atmega3290pa", "atmega406",
18826 "atmega64", "atmega64a", "atmega64c1", "atmega64hve",
18827 "atmega64hve2", "atmega64m1", "atmega64rfr2", "atmega640",
18828 "atmega644", "atmega644a", "atmega644p", "atmega644pa",
18829 "atmega644rfr2", "atmega645", "atmega645a", "atmega645p",
18830 "atmega649", "atmega649a", "atmega649p", "atmega6450",
18831 "atmega6450a", "atmega6450p", "atmega6490", "atmega6490a",
18832 "atmega6490p", "ata5795", "ata5790", "ata5790n", "ata5791",
18833 "ata6613c", "ata6614q", "ata5782", "ata5831", "ata8210",
18834 "ata8510", "ata5702m322", "at90pwm161", "at90pwm216",
18835 "at90pwm316", "at90can32", "at90can64", "at90scr100",
18836 "at90usb646", "at90usb647", "at94k", "m3000".
18837
18838 "avr51"
18839 "Enhanced" devices with 128 KiB of program memory. mcu =
18840 "atmega128", "atmega128a", "atmega128rfa1", "atmega128rfr2",
18841 "atmega1280", "atmega1281", "atmega1284", "atmega1284p",
18842 "atmega1284rfr2", "at90can128", "at90usb1286", "at90usb1287".
18843
18844 "avr6"
18845 "Enhanced" devices with 3-byte PC, i.e. with more than 128 KiB
18846 of program memory. mcu = "atmega256rfr2", "atmega2560",
18847 "atmega2561", "atmega2564rfr2".
18848
18849 "avrxmega2"
18850 "XMEGA" devices with more than 8 KiB and up to 64 KiB of
18851 program memory. mcu = "atxmega8e5", "atxmega16a4",
18852 "atxmega16a4u", "atxmega16c4", "atxmega16d4", "atxmega16e5",
18853 "atxmega32a4", "atxmega32a4u", "atxmega32c3", "atxmega32c4",
18854 "atxmega32d3", "atxmega32d4", "atxmega32e5".
18855
18856 "avrxmega3"
18857 "XMEGA" devices with up to 64 KiB of combined program memory
18858 and RAM, and with program memory visible in the RAM address
18859 space. mcu = "attiny202", "attiny204", "attiny212",
18860 "attiny214", "attiny402", "attiny404", "attiny406",
18861 "attiny412", "attiny414", "attiny416", "attiny417",
18862 "attiny804", "attiny806", "attiny807", "attiny814",
18863 "attiny816", "attiny817", "attiny1604", "attiny1606",
18864 "attiny1607", "attiny1614", "attiny1616", "attiny1617",
18865 "attiny3214", "attiny3216", "attiny3217", "atmega808",
18866 "atmega809", "atmega1608", "atmega1609", "atmega3208",
18867 "atmega3209", "atmega4808", "atmega4809".
18868
18869 "avrxmega4"
18870 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
18871 program memory. mcu = "atxmega64a3", "atxmega64a3u",
18872 "atxmega64a4u", "atxmega64b1", "atxmega64b3", "atxmega64c3",
18873 "atxmega64d3", "atxmega64d4".
18874
18875 "avrxmega5"
18876 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
18877 program memory and more than 64 KiB of RAM. mcu =
18878 "atxmega64a1", "atxmega64a1u".
18879
18880 "avrxmega6"
18881 "XMEGA" devices with more than 128 KiB of program memory. mcu
18882 = "atxmega128a3", "atxmega128a3u", "atxmega128b1",
18883 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
18884 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
18885 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
18886 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
18887 "atxmega256d3", "atxmega384c3", "atxmega384d3".
18888
18889 "avrxmega7"
18890 "XMEGA" devices with more than 128 KiB of program memory and
18891 more than 64 KiB of RAM. mcu = "atxmega128a1",
18892 "atxmega128a1u", "atxmega128a4u".
18893
18894 "avrtiny"
18895 "TINY" Tiny core devices with 512 B up to 4 KiB of program
18896 memory. mcu = "attiny4", "attiny5", "attiny9", "attiny10",
18897 "attiny20", "attiny40".
18898
18899 "avr1"
18900 This ISA is implemented by the minimal AVR core and supported
18901 for assembler only. mcu = "attiny11", "attiny12", "attiny15",
18902 "attiny28", "at90s1200".
18903
18904 -mabsdata
18905 Assume that all data in static storage can be accessed by LDS / STS
18906 instructions. This option has only an effect on reduced Tiny
18907 devices like ATtiny40. See also the "absdata" AVR Variable
18908 Attributes,variable attribute.
18909
18910 -maccumulate-args
18911 Accumulate outgoing function arguments and acquire/release the
18912 needed stack space for outgoing function arguments once in function
18913 prologue/epilogue. Without this option, outgoing arguments are
18914 pushed before calling a function and popped afterwards.
18915
18916 Popping the arguments after the function call can be expensive on
18917 AVR so that accumulating the stack space might lead to smaller
18918 executables because arguments need not be removed from the stack
18919 after such a function call.
18920
18921 This option can lead to reduced code size for functions that
18922 perform several calls to functions that get their arguments on the
18923 stack like calls to printf-like functions.
18924
18925 -mbranch-cost=cost
18926 Set the branch costs for conditional branch instructions to cost.
18927 Reasonable values for cost are small, non-negative integers. The
18928 default branch cost is 0.
18929
18930 -mcall-prologues
18931 Functions prologues/epilogues are expanded as calls to appropriate
18932 subroutines. Code size is smaller.
18933
18934 -mdouble=bits
18935 -mlong-double=bits
18936 Set the size (in bits) of the "double" or "long double" type,
18937 respectively. Possible values for bits are 32 and 64. Whether or
18938 not a specific value for bits is allowed depends on the
18939 "--with-double=" and "--with-long-double=" configure options
18940 ("https://gcc.gnu.org/install/configure.html#avr"), and the same
18941 applies for the default values of the options.
18942
18943 -mgas-isr-prologues
18944 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
18945 instruction supported by GNU Binutils. If this option is on, the
18946 feature can still be disabled for individual ISRs by means of the
18947 AVR Function Attributes,,"no_gccisr" function attribute. This
18948 feature is activated per default if optimization is on (but not
18949 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
18950 PR21683 ("https://sourceware.org/PR21683").
18951
18952 -mint8
18953 Assume "int" to be 8-bit integer. This affects the sizes of all
18954 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
18955 and "long long" is 4 bytes. Please note that this option does not
18956 conform to the C standards, but it results in smaller code size.
18957
18958 -mmain-is-OS_task
18959 Do not save registers in "main". The effect is the same like
18960 attaching attribute AVR Function Attributes,,"OS_task" to "main".
18961 It is activated per default if optimization is on.
18962
18963 -mn-flash=num
18964 Assume that the flash memory has a size of num times 64 KiB.
18965
18966 -mno-interrupts
18967 Generated code is not compatible with hardware interrupts. Code
18968 size is smaller.
18969
18970 -mrelax
18971 Try to replace "CALL" resp. "JMP" instruction by the shorter
18972 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
18973 just adds the --mlink-relax option to the assembler's command line
18974 and the --relax option to the linker's command line.
18975
18976 Jump relaxing is performed by the linker because jump offsets are
18977 not known before code is located. Therefore, the assembler code
18978 generated by the compiler is the same, but the instructions in the
18979 executable may differ from instructions in the assembler code.
18980
18981 Relaxing must be turned on if linker stubs are needed, see the
18982 section on "EIND" and linker stubs below.
18983
18984 -mrmw
18985 Assume that the device supports the Read-Modify-Write instructions
18986 "XCH", "LAC", "LAS" and "LAT".
18987
18988 -mshort-calls
18989 Assume that "RJMP" and "RCALL" can target the whole program memory.
18990
18991 This option is used internally for multilib selection. It is not
18992 an optimization option, and you don't need to set it by hand.
18993
18994 -msp8
18995 Treat the stack pointer register as an 8-bit register, i.e. assume
18996 the high byte of the stack pointer is zero. In general, you don't
18997 need to set this option by hand.
18998
18999 This option is used internally by the compiler to select and build
19000 multilibs for architectures "avr2" and "avr25". These
19001 architectures mix devices with and without "SPH". For any setting
19002 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
19003 removes this option from the compiler proper's command line,
19004 because the compiler then knows if the device or architecture has
19005 an 8-bit stack pointer and thus no "SPH" register or not.
19006
19007 -mstrict-X
19008 Use address register "X" in a way proposed by the hardware. This
19009 means that "X" is only used in indirect, post-increment or pre-
19010 decrement addressing.
19011
19012 Without this option, the "X" register may be used in the same way
19013 as "Y" or "Z" which then is emulated by additional instructions.
19014 For example, loading a value with "X+const" addressing with a small
19015 non-negative "const < 64" to a register Rn is performed as
19016
19017 adiw r26, const ; X += const
19018 ld <Rn>, X ; <Rn> = *X
19019 sbiw r26, const ; X -= const
19020
19021 -mtiny-stack
19022 Only change the lower 8 bits of the stack pointer.
19023
19024 -mfract-convert-truncate
19025 Allow to use truncation instead of rounding towards zero for
19026 fractional fixed-point types.
19027
19028 -nodevicelib
19029 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
19030
19031 -nodevicespecs
19032 Don't add -specs=device-specs/specs-mcu to the compiler driver's
19033 command line. The user takes responsibility for supplying the sub-
19034 processes like compiler proper, assembler and linker with
19035 appropriate command line options. This means that the user has to
19036 supply her private device specs file by means of -specs=path-to-
19037 specs-file. There is no more need for option -mmcu=mcu.
19038
19039 This option can also serve as a replacement for the older way of
19040 specifying custom device-specs files that needed -B some-path to
19041 point to a directory which contains a folder named "device-specs"
19042 which contains a specs file named "specs-mcu", where mcu was
19043 specified by -mmcu=mcu.
19044
19045 -Waddr-space-convert
19046 Warn about conversions between address spaces in the case where the
19047 resulting address space is not contained in the incoming address
19048 space.
19049
19050 -Wmisspelled-isr
19051 Warn if the ISR is misspelled, i.e. without __vector prefix.
19052 Enabled by default.
19053
19054 "EIND" and Devices with More Than 128 Ki Bytes of Flash
19055
19056 Pointers in the implementation are 16 bits wide. The address of a
19057 function or label is represented as word address so that indirect jumps
19058 and calls can target any code address in the range of 64 Ki words.
19059
19060 In order to facilitate indirect jump on devices with more than 128 Ki
19061 bytes of program memory space, there is a special function register
19062 called "EIND" that serves as most significant part of the target
19063 address when "EICALL" or "EIJMP" instructions are used.
19064
19065 Indirect jumps and calls on these devices are handled as follows by the
19066 compiler and are subject to some limitations:
19067
19068 * The compiler never sets "EIND".
19069
19070 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
19071 instructions or might read "EIND" directly in order to emulate an
19072 indirect call/jump by means of a "RET" instruction.
19073
19074 * The compiler assumes that "EIND" never changes during the startup
19075 code or during the application. In particular, "EIND" is not
19076 saved/restored in function or interrupt service routine
19077 prologue/epilogue.
19078
19079 * For indirect calls to functions and computed goto, the linker
19080 generates stubs. Stubs are jump pads sometimes also called
19081 trampolines. Thus, the indirect call/jump jumps to such a stub.
19082 The stub contains a direct jump to the desired address.
19083
19084 * Linker relaxation must be turned on so that the linker generates
19085 the stubs correctly in all situations. See the compiler option
19086 -mrelax and the linker option --relax. There are corner cases
19087 where the linker is supposed to generate stubs but aborts without
19088 relaxation and without a helpful error message.
19089
19090 * The default linker script is arranged for code with "EIND = 0". If
19091 code is supposed to work for a setup with "EIND != 0", a custom
19092 linker script has to be used in order to place the sections whose
19093 name start with ".trampolines" into the segment where "EIND" points
19094 to.
19095
19096 * The startup code from libgcc never sets "EIND". Notice that
19097 startup code is a blend of code from libgcc and AVR-LibC. For the
19098 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
19099 ("http://nongnu.org/avr-libc/user-manual/").
19100
19101 * It is legitimate for user-specific startup code to set up "EIND"
19102 early, for example by means of initialization code located in
19103 section ".init3". Such code runs prior to general startup code that
19104 initializes RAM and calls constructors, but after the bit of
19105 startup code from AVR-LibC that sets "EIND" to the segment where
19106 the vector table is located.
19107
19108 #include <avr/io.h>
19109
19110 static void
19111 __attribute__((section(".init3"),naked,used,no_instrument_function))
19112 init3_set_eind (void)
19113 {
19114 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
19115 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
19116 }
19117
19118 The "__trampolines_start" symbol is defined in the linker script.
19119
19120 * Stubs are generated automatically by the linker if the following
19121 two conditions are met:
19122
19123 -<The address of a label is taken by means of the "gs" modifier>
19124 (short for generate stubs) like so:
19125
19126 LDI r24, lo8(gs(<func>))
19127 LDI r25, hi8(gs(<func>))
19128
19129 -<The final location of that label is in a code segment>
19130 outside the segment where the stubs are located.
19131
19132 * The compiler emits such "gs" modifiers for code labels in the
19133 following situations:
19134
19135 -<Taking address of a function or code label.>
19136 -<Computed goto.>
19137 -<If prologue-save function is used, see -mcall-prologues>
19138 command-line option.
19139
19140 -<Switch/case dispatch tables. If you do not want such dispatch>
19141 tables you can specify the -fno-jump-tables command-line
19142 option.
19143
19144 -<C and C++ constructors/destructors called during
19145 startup/shutdown.>
19146 -<If the tools hit a "gs()" modifier explained above.>
19147 * Jumping to non-symbolic addresses like so is not supported:
19148
19149 int main (void)
19150 {
19151 /* Call function at word address 0x2 */
19152 return ((int(*)(void)) 0x2)();
19153 }
19154
19155 Instead, a stub has to be set up, i.e. the function has to be
19156 called through a symbol ("func_4" in the example):
19157
19158 int main (void)
19159 {
19160 extern int func_4 (void);
19161
19162 /* Call function at byte address 0x4 */
19163 return func_4();
19164 }
19165
19166 and the application be linked with -Wl,--defsym,func_4=0x4.
19167 Alternatively, "func_4" can be defined in the linker script.
19168
19169 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
19170 Registers
19171
19172 Some AVR devices support memories larger than the 64 KiB range that can
19173 be accessed with 16-bit pointers. To access memory locations outside
19174 this 64 KiB range, the content of a "RAMP" register is used as high
19175 part of the address: The "X", "Y", "Z" address register is concatenated
19176 with the "RAMPX", "RAMPY", "RAMPZ" special function register,
19177 respectively, to get a wide address. Similarly, "RAMPD" is used
19178 together with direct addressing.
19179
19180 * The startup code initializes the "RAMP" special function registers
19181 with zero.
19182
19183 * If a AVR Named Address Spaces,named address space other than
19184 generic or "__flash" is used, then "RAMPZ" is set as needed before
19185 the operation.
19186
19187 * If the device supports RAM larger than 64 KiB and the compiler
19188 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
19189 reset to zero after the operation.
19190
19191 * If the device comes with a specific "RAMP" register, the ISR
19192 prologue/epilogue saves/restores that SFR and initializes it with
19193 zero in case the ISR code might (implicitly) use it.
19194
19195 * RAM larger than 64 KiB is not supported by GCC for AVR targets. If
19196 you use inline assembler to read from locations outside the 16-bit
19197 address range and change one of the "RAMP" registers, you must
19198 reset it to zero after the access.
19199
19200 AVR Built-in Macros
19201
19202 GCC defines several built-in macros so that the user code can test for
19203 the presence or absence of features. Almost any of the following
19204 built-in macros are deduced from device capabilities and thus triggered
19205 by the -mmcu= command-line option.
19206
19207 For even more AVR-specific built-in macros see AVR Named Address Spaces
19208 and AVR Built-in Functions.
19209
19210 "__AVR_ARCH__"
19211 Build-in macro that resolves to a decimal number that identifies
19212 the architecture and depends on the -mmcu=mcu option. Possible
19213 values are:
19214
19215 2, 25, 3, 31, 35, 4, 5, 51, 6
19216
19217 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
19218 "avr51", "avr6",
19219
19220 respectively and
19221
19222 100, 102, 103, 104, 105, 106, 107
19223
19224 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
19225 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
19226 specifies a device, this built-in macro is set accordingly. For
19227 example, with -mmcu=atmega8 the macro is defined to 4.
19228
19229 "__AVR_Device__"
19230 Setting -mmcu=device defines this built-in macro which reflects the
19231 device's name. For example, -mmcu=atmega8 defines the built-in
19232 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
19233 "__AVR_ATtiny261A__", etc.
19234
19235 The built-in macros' names follow the scheme "__AVR_Device__" where
19236 Device is the device name as from the AVR user manual. The
19237 difference between Device in the built-in macro and device in
19238 -mmcu=device is that the latter is always lowercase.
19239
19240 If device is not a device but only a core architecture like avr51,
19241 this macro is not defined.
19242
19243 "__AVR_DEVICE_NAME__"
19244 Setting -mmcu=device defines this built-in macro to the device's
19245 name. For example, with -mmcu=atmega8 the macro is defined to
19246 "atmega8".
19247
19248 If device is not a device but only a core architecture like avr51,
19249 this macro is not defined.
19250
19251 "__AVR_XMEGA__"
19252 The device / architecture belongs to the XMEGA family of devices.
19253
19254 "__AVR_HAVE_ELPM__"
19255 The device has the "ELPM" instruction.
19256
19257 "__AVR_HAVE_ELPMX__"
19258 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
19259
19260 "__AVR_HAVE_MOVW__"
19261 The device has the "MOVW" instruction to perform 16-bit register-
19262 register moves.
19263
19264 "__AVR_HAVE_LPMX__"
19265 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
19266
19267 "__AVR_HAVE_MUL__"
19268 The device has a hardware multiplier.
19269
19270 "__AVR_HAVE_JMP_CALL__"
19271 The device has the "JMP" and "CALL" instructions. This is the case
19272 for devices with more than 8 KiB of program memory.
19273
19274 "__AVR_HAVE_EIJMP_EICALL__"
19275 "__AVR_3_BYTE_PC__"
19276 The device has the "EIJMP" and "EICALL" instructions. This is the
19277 case for devices with more than 128 KiB of program memory. This
19278 also means that the program counter (PC) is 3 bytes wide.
19279
19280 "__AVR_2_BYTE_PC__"
19281 The program counter (PC) is 2 bytes wide. This is the case for
19282 devices with up to 128 KiB of program memory.
19283
19284 "__AVR_HAVE_8BIT_SP__"
19285 "__AVR_HAVE_16BIT_SP__"
19286 The stack pointer (SP) register is treated as 8-bit respectively
19287 16-bit register by the compiler. The definition of these macros is
19288 affected by -mtiny-stack.
19289
19290 "__AVR_HAVE_SPH__"
19291 "__AVR_SP8__"
19292 The device has the SPH (high part of stack pointer) special
19293 function register or has an 8-bit stack pointer, respectively. The
19294 definition of these macros is affected by -mmcu= and in the cases
19295 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
19296
19297 "__AVR_HAVE_RAMPD__"
19298 "__AVR_HAVE_RAMPX__"
19299 "__AVR_HAVE_RAMPY__"
19300 "__AVR_HAVE_RAMPZ__"
19301 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
19302 function register, respectively.
19303
19304 "__NO_INTERRUPTS__"
19305 This macro reflects the -mno-interrupts command-line option.
19306
19307 "__AVR_ERRATA_SKIP__"
19308 "__AVR_ERRATA_SKIP_JMP_CALL__"
19309 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
19310 instructions because of a hardware erratum. Skip instructions are
19311 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
19312 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
19313
19314 "__AVR_ISA_RMW__"
19315 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
19316 LAT).
19317
19318 "__AVR_SFR_OFFSET__=offset"
19319 Instructions that can address I/O special function registers
19320 directly like "IN", "OUT", "SBI", etc. may use a different address
19321 as if addressed by an instruction to access RAM like "LD" or "STS".
19322 This offset depends on the device architecture and has to be
19323 subtracted from the RAM address in order to get the respective I/O
19324 address.
19325
19326 "__AVR_SHORT_CALLS__"
19327 The -mshort-calls command line option is set.
19328
19329 "__AVR_PM_BASE_ADDRESS__=addr"
19330 Some devices support reading from flash memory by means of "LD*"
19331 instructions. The flash memory is seen in the data address space
19332 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
19333 defined, this feature is not available. If defined, the address
19334 space is linear and there is no need to put ".rodata" into RAM.
19335 This is handled by the default linker description file, and is
19336 currently available for "avrtiny" and "avrxmega3". Even more
19337 convenient, there is no need to use address spaces like "__flash"
19338 or features like attribute "progmem" and "pgm_read_*".
19339
19340 "__WITH_AVRLIBC__"
19341 The compiler is configured to be used together with AVR-Libc. See
19342 the --with-avrlibc configure option.
19343
19344 "__HAVE_DOUBLE_MULTILIB__"
19345 Defined if -mdouble= acts as a multilib option.
19346
19347 "__HAVE_DOUBLE32__"
19348 "__HAVE_DOUBLE64__"
19349 Defined if the compiler supports 32-bit double resp. 64-bit double.
19350 The actual layout is specified by option -mdouble=.
19351
19352 "__DEFAULT_DOUBLE__"
19353 The size in bits of "double" if -mdouble= is not set. To test the
19354 layout of "double" in a program, use the built-in macro
19355 "__SIZEOF_DOUBLE__".
19356
19357 "__HAVE_LONG_DOUBLE32__"
19358 "__HAVE_LONG_DOUBLE64__"
19359 "__HAVE_LONG_DOUBLE_MULTILIB__"
19360 "__DEFAULT_LONG_DOUBLE__"
19361 Same as above, but for "long double" instead of "double".
19362
19363 "__WITH_DOUBLE_COMPARISON__"
19364 Reflects the "--with-double-comparison={tristate|bool|libf7}"
19365 configure option ("https://gcc.gnu.org/install/configure.html#avr")
19366 and is defined to 2 or 3.
19367
19368 "__WITH_LIBF7_LIBGCC__"
19369 "__WITH_LIBF7_MATH__"
19370 "__WITH_LIBF7_MATH_SYMBOLS__"
19371 Reflects the "--with-libf7={libgcc|math|math-symbols}"
19372 configure option
19373 ("https://gcc.gnu.org/install/configure.html#avr").
19374
19375 Blackfin Options
19376
19377 -mcpu=cpu[-sirevision]
19378 Specifies the name of the target Blackfin processor. Currently,
19379 cpu can be one of bf512, bf514, bf516, bf518, bf522, bf523, bf524,
19380 bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf536, bf537,
19381 bf538, bf539, bf542, bf544, bf547, bf548, bf549, bf542m, bf544m,
19382 bf547m, bf548m, bf549m, bf561, bf592.
19383
19384 The optional sirevision specifies the silicon revision of the
19385 target Blackfin processor. Any workarounds available for the
19386 targeted silicon revision are enabled. If sirevision is none, no
19387 workarounds are enabled. If sirevision is any, all workarounds for
19388 the targeted processor are enabled. The "__SILICON_REVISION__"
19389 macro is defined to two hexadecimal digits representing the major
19390 and minor numbers in the silicon revision. If sirevision is none,
19391 the "__SILICON_REVISION__" is not defined. If sirevision is any,
19392 the "__SILICON_REVISION__" is defined to be 0xffff. If this
19393 optional sirevision is not used, GCC assumes the latest known
19394 silicon revision of the targeted Blackfin processor.
19395
19396 GCC defines a preprocessor macro for the specified cpu. For the
19397 bfin-elf toolchain, this option causes the hardware BSP provided by
19398 libgloss to be linked in if -msim is not given.
19399
19400 Without this option, bf532 is used as the processor by default.
19401
19402 Note that support for bf561 is incomplete. For bf561, only the
19403 preprocessor macro is defined.
19404
19405 -msim
19406 Specifies that the program will be run on the simulator. This
19407 causes the simulator BSP provided by libgloss to be linked in.
19408 This option has effect only for bfin-elf toolchain. Certain other
19409 options, such as -mid-shared-library and -mfdpic, imply -msim.
19410
19411 -momit-leaf-frame-pointer
19412 Don't keep the frame pointer in a register for leaf functions.
19413 This avoids the instructions to save, set up and restore frame
19414 pointers and makes an extra register available in leaf functions.
19415
19416 -mspecld-anomaly
19417 When enabled, the compiler ensures that the generated code does not
19418 contain speculative loads after jump instructions. If this option
19419 is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
19420
19421 -mno-specld-anomaly
19422 Don't generate extra code to prevent speculative loads from
19423 occurring.
19424
19425 -mcsync-anomaly
19426 When enabled, the compiler ensures that the generated code does not
19427 contain CSYNC or SSYNC instructions too soon after conditional
19428 branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS"
19429 is defined.
19430
19431 -mno-csync-anomaly
19432 Don't generate extra code to prevent CSYNC or SSYNC instructions
19433 from occurring too soon after a conditional branch.
19434
19435 -mlow64k
19436 When enabled, the compiler is free to take advantage of the
19437 knowledge that the entire program fits into the low 64k of memory.
19438
19439 -mno-low64k
19440 Assume that the program is arbitrarily large. This is the default.
19441
19442 -mstack-check-l1
19443 Do stack checking using information placed into L1 scratchpad
19444 memory by the uClinux kernel.
19445
19446 -mid-shared-library
19447 Generate code that supports shared libraries via the library ID
19448 method. This allows for execute in place and shared libraries in
19449 an environment without virtual memory management. This option
19450 implies -fPIC. With a bfin-elf target, this option implies -msim.
19451
19452 -mno-id-shared-library
19453 Generate code that doesn't assume ID-based shared libraries are
19454 being used. This is the default.
19455
19456 -mleaf-id-shared-library
19457 Generate code that supports shared libraries via the library ID
19458 method, but assumes that this library or executable won't link
19459 against any other ID shared libraries. That allows the compiler to
19460 use faster code for jumps and calls.
19461
19462 -mno-leaf-id-shared-library
19463 Do not assume that the code being compiled won't link against any
19464 ID shared libraries. Slower code is generated for jump and call
19465 insns.
19466
19467 -mshared-library-id=n
19468 Specifies the identification number of the ID-based shared library
19469 being compiled. Specifying a value of 0 generates more compact
19470 code; specifying other values forces the allocation of that number
19471 to the current library but is no more space- or time-efficient than
19472 omitting this option.
19473
19474 -msep-data
19475 Generate code that allows the data segment to be located in a
19476 different area of memory from the text segment. This allows for
19477 execute in place in an environment without virtual memory
19478 management by eliminating relocations against the text section.
19479
19480 -mno-sep-data
19481 Generate code that assumes that the data segment follows the text
19482 segment. This is the default.
19483
19484 -mlong-calls
19485 -mno-long-calls
19486 Tells the compiler to perform function calls by first loading the
19487 address of the function into a register and then performing a
19488 subroutine call on this register. This switch is needed if the
19489 target function lies outside of the 24-bit addressing range of the
19490 offset-based version of subroutine call instruction.
19491
19492 This feature is not enabled by default. Specifying -mno-long-calls
19493 restores the default behavior. Note these switches have no effect
19494 on how the compiler generates code to handle function calls via
19495 function pointers.
19496
19497 -mfast-fp
19498 Link with the fast floating-point library. This library relaxes
19499 some of the IEEE floating-point standard's rules for checking
19500 inputs against Not-a-Number (NAN), in the interest of performance.
19501
19502 -minline-plt
19503 Enable inlining of PLT entries in function calls to functions that
19504 are not known to bind locally. It has no effect without -mfdpic.
19505
19506 -mmulticore
19507 Build a standalone application for multicore Blackfin processors.
19508 This option causes proper start files and link scripts supporting
19509 multicore to be used, and defines the macro "__BFIN_MULTICORE". It
19510 can only be used with -mcpu=bf561[-sirevision].
19511
19512 This option can be used with -mcorea or -mcoreb, which selects the
19513 one-application-per-core programming model. Without -mcorea or
19514 -mcoreb, the single-application/dual-core programming model is
19515 used. In this model, the main function of Core B should be named as
19516 "coreb_main".
19517
19518 If this option is not used, the single-core application programming
19519 model is used.
19520
19521 -mcorea
19522 Build a standalone application for Core A of BF561 when using the
19523 one-application-per-core programming model. Proper start files and
19524 link scripts are used to support Core A, and the macro
19525 "__BFIN_COREA" is defined. This option can only be used in
19526 conjunction with -mmulticore.
19527
19528 -mcoreb
19529 Build a standalone application for Core B of BF561 when using the
19530 one-application-per-core programming model. Proper start files and
19531 link scripts are used to support Core B, and the macro
19532 "__BFIN_COREB" is defined. When this option is used, "coreb_main"
19533 should be used instead of "main". This option can only be used in
19534 conjunction with -mmulticore.
19535
19536 -msdram
19537 Build a standalone application for SDRAM. Proper start files and
19538 link scripts are used to put the application into SDRAM, and the
19539 macro "__BFIN_SDRAM" is defined. The loader should initialize
19540 SDRAM before loading the application.
19541
19542 -micplb
19543 Assume that ICPLBs are enabled at run time. This has an effect on
19544 certain anomaly workarounds. For Linux targets, the default is to
19545 assume ICPLBs are enabled; for standalone applications the default
19546 is off.
19547
19548 C6X Options
19549
19550 -march=name
19551 This specifies the name of the target architecture. GCC uses this
19552 name to determine what kind of instructions it can emit when
19553 generating assembly code. Permissible names are: c62x, c64x,
19554 c64x+, c67x, c67x+, c674x.
19555
19556 -mbig-endian
19557 Generate code for a big-endian target.
19558
19559 -mlittle-endian
19560 Generate code for a little-endian target. This is the default.
19561
19562 -msim
19563 Choose startup files and linker script suitable for the simulator.
19564
19565 -msdata=default
19566 Put small global and static data in the ".neardata" section, which
19567 is pointed to by register "B14". Put small uninitialized global
19568 and static data in the ".bss" section, which is adjacent to the
19569 ".neardata" section. Put small read-only data into the ".rodata"
19570 section. The corresponding sections used for large pieces of data
19571 are ".fardata", ".far" and ".const".
19572
19573 -msdata=all
19574 Put all data, not just small objects, into the sections reserved
19575 for small data, and use addressing relative to the "B14" register
19576 to access them.
19577
19578 -msdata=none
19579 Make no use of the sections reserved for small data, and use
19580 absolute addresses to access all data. Put all initialized global
19581 and static data in the ".fardata" section, and all uninitialized
19582 data in the ".far" section. Put all constant data into the
19583 ".const" section.
19584
19585 CRIS Options
19586
19587 These options are defined specifically for the CRIS ports.
19588
19589 -march=architecture-type
19590 -mcpu=architecture-type
19591 Generate code for the specified architecture. The choices for
19592 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
19593 ETRAX 100, and ETRAX 100 LX. Default is v0.
19594
19595 -mtune=architecture-type
19596 Tune to architecture-type everything applicable about the generated
19597 code, except for the ABI and the set of available instructions.
19598 The choices for architecture-type are the same as for
19599 -march=architecture-type.
19600
19601 -mmax-stack-frame=n
19602 Warn when the stack frame of a function exceeds n bytes.
19603
19604 -metrax4
19605 -metrax100
19606 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
19607 -march=v8 respectively.
19608
19609 -mmul-bug-workaround
19610 -mno-mul-bug-workaround
19611 Work around a bug in the "muls" and "mulu" instructions for CPU
19612 models where it applies. This option is disabled by default.
19613
19614 -mpdebug
19615 Enable CRIS-specific verbose debug-related information in the
19616 assembly code. This option also has the effect of turning off the
19617 #NO_APP formatted-code indicator to the assembler at the beginning
19618 of the assembly file.
19619
19620 -mcc-init
19621 Do not use condition-code results from previous instruction; always
19622 emit compare and test instructions before use of condition codes.
19623
19624 -mno-side-effects
19625 Do not emit instructions with side effects in addressing modes
19626 other than post-increment.
19627
19628 -mstack-align
19629 -mno-stack-align
19630 -mdata-align
19631 -mno-data-align
19632 -mconst-align
19633 -mno-const-align
19634 These options (no- options) arrange (eliminate arrangements) for
19635 the stack frame, individual data and constants to be aligned for
19636 the maximum single data access size for the chosen CPU model. The
19637 default is to arrange for 32-bit alignment. ABI details such as
19638 structure layout are not affected by these options.
19639
19640 -m32-bit
19641 -m16-bit
19642 -m8-bit
19643 Similar to the stack- data- and const-align options above, these
19644 options arrange for stack frame, writable data and constants to all
19645 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
19646 alignment.
19647
19648 -mno-prologue-epilogue
19649 -mprologue-epilogue
19650 With -mno-prologue-epilogue, the normal function prologue and
19651 epilogue which set up the stack frame are omitted and no return
19652 instructions or return sequences are generated in the code. Use
19653 this option only together with visual inspection of the compiled
19654 code: no warnings or errors are generated when call-saved registers
19655 must be saved, or storage for local variables needs to be
19656 allocated.
19657
19658 -melf
19659 Legacy no-op option.
19660
19661 -sim
19662 This option arranges to link with input-output functions from a
19663 simulator library. Code, initialized data and zero-initialized
19664 data are allocated consecutively.
19665
19666 -sim2
19667 Like -sim, but pass linker options to locate initialized data at
19668 0x40000000 and zero-initialized data at 0x80000000.
19669
19670 CR16 Options
19671
19672 These options are defined specifically for the CR16 ports.
19673
19674 -mmac
19675 Enable the use of multiply-accumulate instructions. Disabled by
19676 default.
19677
19678 -mcr16cplus
19679 -mcr16c
19680 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
19681 is default.
19682
19683 -msim
19684 Links the library libsim.a which is in compatible with simulator.
19685 Applicable to ELF compiler only.
19686
19687 -mint32
19688 Choose integer type as 32-bit wide.
19689
19690 -mbit-ops
19691 Generates "sbit"/"cbit" instructions for bit manipulations.
19692
19693 -mdata-model=model
19694 Choose a data model. The choices for model are near, far or medium.
19695 medium is default. However, far is not valid with -mcr16c, as the
19696 CR16C architecture does not support the far data model.
19697
19698 C-SKY Options
19699
19700 GCC supports these options when compiling for C-SKY V2 processors.
19701
19702 -march=arch
19703 Specify the C-SKY target architecture. Valid values for arch are:
19704 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
19705
19706 -mcpu=cpu
19707 Specify the C-SKY target processor. Valid values for cpu are:
19708 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
19709 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
19710 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
19711 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
19712 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
19713 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
19714 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
19715 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
19716 ck810tv, ck810ft, and ck810ftv.
19717
19718 -mbig-endian
19719 -EB
19720 -mlittle-endian
19721 -EL Select big- or little-endian code. The default is little-endian.
19722
19723 -mfloat-abi=name
19724 Specifies which floating-point ABI to use. Permissible values are:
19725 soft, softfp and hard.
19726
19727 Specifying soft causes GCC to generate output containing library
19728 calls for floating-point operations. softfp allows the generation
19729 of code using hardware floating-point instructions, but still uses
19730 the soft-float calling conventions. hard allows generation of
19731 floating-point instructions and uses FPU-specific calling
19732 conventions.
19733
19734 The default depends on the specific target configuration. Note
19735 that the hard-float and soft-float ABIs are not link-compatible;
19736 you must compile your entire program with the same ABI, and link
19737 with a compatible set of libraries.
19738
19739 -mhard-float
19740 -msoft-float
19741 Select hardware or software floating-point implementations. The
19742 default is soft float.
19743
19744 -mdouble-float
19745 -mno-double-float
19746 When -mhard-float is in effect, enable generation of double-
19747 precision float instructions. This is the default except when
19748 compiling for CK803.
19749
19750 -mfdivdu
19751 -mno-fdivdu
19752 When -mhard-float is in effect, enable generation of "frecipd",
19753 "fsqrtd", and "fdivd" instructions. This is the default except
19754 when compiling for CK803.
19755
19756 -mfpu=fpu
19757 Select the floating-point processor. This option can only be used
19758 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
19759 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
19760 and fpv2_divd (-mdouble-float -mdivdu).
19761
19762 -melrw
19763 -mno-elrw
19764 Enable the extended "lrw" instruction. This option defaults to on
19765 for CK801 and off otherwise.
19766
19767 -mistack
19768 -mno-istack
19769 Enable interrupt stack instructions; the default is off.
19770
19771 The -mistack option is required to handle the "interrupt" and "isr"
19772 function attributes.
19773
19774 -mmp
19775 Enable multiprocessor instructions; the default is off.
19776
19777 -mcp
19778 Enable coprocessor instructions; the default is off.
19779
19780 -mcache
19781 Enable coprocessor instructions; the default is off.
19782
19783 -msecurity
19784 Enable C-SKY security instructions; the default is off.
19785
19786 -mtrust
19787 Enable C-SKY trust instructions; the default is off.
19788
19789 -mdsp
19790 -medsp
19791 -mvdsp
19792 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
19793 respectively. All of these options default to off.
19794
19795 -mdiv
19796 -mno-div
19797 Generate divide instructions. Default is off.
19798
19799 -msmart
19800 -mno-smart
19801 Generate code for Smart Mode, using only registers numbered 0-7 to
19802 allow use of 16-bit instructions. This option is ignored for CK801
19803 where this is the required behavior, and it defaults to on for
19804 CK802. For other targets, the default is off.
19805
19806 -mhigh-registers
19807 -mno-high-registers
19808 Generate code using the high registers numbered 16-31. This option
19809 is not supported on CK801, CK802, or CK803, and is enabled by
19810 default for other processors.
19811
19812 -manchor
19813 -mno-anchor
19814 Generate code using global anchor symbol addresses.
19815
19816 -mpushpop
19817 -mno-pushpop
19818 Generate code using "push" and "pop" instructions. This option
19819 defaults to on.
19820
19821 -mmultiple-stld
19822 -mstm
19823 -mno-multiple-stld
19824 -mno-stm
19825 Generate code using "stm" and "ldm" instructions. This option
19826 isn't supported on CK801 but is enabled by default on other
19827 processors.
19828
19829 -mconstpool
19830 -mno-constpool
19831 Create constant pools in the compiler instead of deferring it to
19832 the assembler. This option is the default and required for correct
19833 code generation on CK801 and CK802, and is optional on other
19834 processors.
19835
19836 -mstack-size
19837 -mno-stack-size
19838 Emit ".stack_size" directives for each function in the assembly
19839 output. This option defaults to off.
19840
19841 -mccrt
19842 -mno-ccrt
19843 Generate code for the C-SKY compiler runtime instead of libgcc.
19844 This option defaults to off.
19845
19846 -mbranch-cost=n
19847 Set the branch costs to roughly "n" instructions. The default is
19848 1.
19849
19850 -msched-prolog
19851 -mno-sched-prolog
19852 Permit scheduling of function prologue and epilogue sequences.
19853 Using this option can result in code that is not compliant with the
19854 C-SKY V2 ABI prologue requirements and that cannot be debugged or
19855 backtraced. It is disabled by default.
19856
19857 -msim
19858 Links the library libsemi.a which is in compatible with simulator.
19859 Applicable to ELF compiler only.
19860
19861 Darwin Options
19862
19863 These options are defined for all architectures running the Darwin
19864 operating system.
19865
19866 FSF GCC on Darwin does not create "fat" object files; it creates an
19867 object file for the single architecture that GCC was built to target.
19868 Apple's GCC on Darwin does create "fat" files if multiple -arch options
19869 are used; it does so by running the compiler or linker multiple times
19870 and joining the results together with lipo.
19871
19872 The subtype of the file created (like ppc7400 or ppc970 or i686) is
19873 determined by the flags that specify the ISA that GCC is targeting,
19874 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
19875 override this.
19876
19877 The Darwin tools vary in their behavior when presented with an ISA
19878 mismatch. The assembler, as, only permits instructions to be used that
19879 are valid for the subtype of the file it is generating, so you cannot
19880 put 64-bit instructions in a ppc750 object file. The linker for shared
19881 libraries, /usr/bin/libtool, fails and prints an error if asked to
19882 create a shared library with a less restrictive subtype than its input
19883 files (for instance, trying to put a ppc970 object file in a ppc7400
19884 library). The linker for executables, ld, quietly gives the executable
19885 the most restrictive subtype of any of its input files.
19886
19887 -Fdir
19888 Add the framework directory dir to the head of the list of
19889 directories to be searched for header files. These directories are
19890 interleaved with those specified by -I options and are scanned in a
19891 left-to-right order.
19892
19893 A framework directory is a directory with frameworks in it. A
19894 framework is a directory with a Headers and/or PrivateHeaders
19895 directory contained directly in it that ends in .framework. The
19896 name of a framework is the name of this directory excluding the
19897 .framework. Headers associated with the framework are found in one
19898 of those two directories, with Headers being searched first. A
19899 subframework is a framework directory that is in a framework's
19900 Frameworks directory. Includes of subframework headers can only
19901 appear in a header of a framework that contains the subframework,
19902 or in a sibling subframework header. Two subframeworks are
19903 siblings if they occur in the same framework. A subframework
19904 should not have the same name as a framework; a warning is issued
19905 if this is violated. Currently a subframework cannot have
19906 subframeworks; in the future, the mechanism may be extended to
19907 support this. The standard frameworks can be found in
19908 /System/Library/Frameworks and /Library/Frameworks. An example
19909 include looks like "#include <Framework/header.h>", where Framework
19910 denotes the name of the framework and header.h is found in the
19911 PrivateHeaders or Headers directory.
19912
19913 -iframeworkdir
19914 Like -F except the directory is a treated as a system directory.
19915 The main difference between this -iframework and -F is that with
19916 -iframework the compiler does not warn about constructs contained
19917 within header files found via dir. This option is valid only for
19918 the C family of languages.
19919
19920 -gused
19921 Emit debugging information for symbols that are used. For stabs
19922 debugging format, this enables -feliminate-unused-debug-symbols.
19923 This is by default ON.
19924
19925 -gfull
19926 Emit debugging information for all symbols and types.
19927
19928 -mmacosx-version-min=version
19929 The earliest version of MacOS X that this executable will run on is
19930 version. Typical values of version include 10.1, 10.2, and 10.3.9.
19931
19932 If the compiler was built to use the system's headers by default,
19933 then the default for this option is the system version on which the
19934 compiler is running, otherwise the default is to make choices that
19935 are compatible with as many systems and code bases as possible.
19936
19937 -mkernel
19938 Enable kernel development mode. The -mkernel option sets -static,
19939 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
19940 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
19941 where applicable. This mode also sets -mno-altivec, -msoft-float,
19942 -fno-builtin and -mlong-branch for PowerPC targets.
19943
19944 -mone-byte-bool
19945 Override the defaults for "bool" so that "sizeof(bool)==1". By
19946 default "sizeof(bool)" is 4 when compiling for Darwin/PowerPC and 1
19947 when compiling for Darwin/x86, so this option has no effect on x86.
19948
19949 Warning: The -mone-byte-bool switch causes GCC to generate code
19950 that is not binary compatible with code generated without that
19951 switch. Using this switch may require recompiling all other
19952 modules in a program, including system libraries. Use this switch
19953 to conform to a non-default data model.
19954
19955 -mfix-and-continue
19956 -ffix-and-continue
19957 -findirect-data
19958 Generate code suitable for fast turnaround development, such as to
19959 allow GDB to dynamically load .o files into already-running
19960 programs. -findirect-data and -ffix-and-continue are provided for
19961 backwards compatibility.
19962
19963 -all_load
19964 Loads all members of static archive libraries. See man ld(1) for
19965 more information.
19966
19967 -arch_errors_fatal
19968 Cause the errors having to do with files that have the wrong
19969 architecture to be fatal.
19970
19971 -bind_at_load
19972 Causes the output file to be marked such that the dynamic linker
19973 will bind all undefined references when the file is loaded or
19974 launched.
19975
19976 -bundle
19977 Produce a Mach-o bundle format file. See man ld(1) for more
19978 information.
19979
19980 -bundle_loader executable
19981 This option specifies the executable that will load the build
19982 output file being linked. See man ld(1) for more information.
19983
19984 -dynamiclib
19985 When passed this option, GCC produces a dynamic library instead of
19986 an executable when linking, using the Darwin libtool command.
19987
19988 -force_cpusubtype_ALL
19989 This causes GCC's output file to have the ALL subtype, instead of
19990 one controlled by the -mcpu or -march option.
19991
19992 -allowable_client client_name
19993 -client_name
19994 -compatibility_version
19995 -current_version
19996 -dead_strip
19997 -dependency-file
19998 -dylib_file
19999 -dylinker_install_name
20000 -dynamic
20001 -exported_symbols_list
20002 -filelist
20003 -flat_namespace
20004 -force_flat_namespace
20005 -headerpad_max_install_names
20006 -image_base
20007 -init
20008 -install_name
20009 -keep_private_externs
20010 -multi_module
20011 -multiply_defined
20012 -multiply_defined_unused
20013 -noall_load
20014 -no_dead_strip_inits_and_terms
20015 -nofixprebinding
20016 -nomultidefs
20017 -noprebind
20018 -noseglinkedit
20019 -pagezero_size
20020 -prebind
20021 -prebind_all_twolevel_modules
20022 -private_bundle
20023 -read_only_relocs
20024 -sectalign
20025 -sectobjectsymbols
20026 -whyload
20027 -seg1addr
20028 -sectcreate
20029 -sectobjectsymbols
20030 -sectorder
20031 -segaddr
20032 -segs_read_only_addr
20033 -segs_read_write_addr
20034 -seg_addr_table
20035 -seg_addr_table_filename
20036 -seglinkedit
20037 -segprot
20038 -segs_read_only_addr
20039 -segs_read_write_addr
20040 -single_module
20041 -static
20042 -sub_library
20043 -sub_umbrella
20044 -twolevel_namespace
20045 -umbrella
20046 -undefined
20047 -unexported_symbols_list
20048 -weak_reference_mismatches
20049 -whatsloaded
20050 These options are passed to the Darwin linker. The Darwin linker
20051 man page describes them in detail.
20052
20053 DEC Alpha Options
20054
20055 These -m options are defined for the DEC Alpha implementations:
20056
20057 -mno-soft-float
20058 -msoft-float
20059 Use (do not use) the hardware floating-point instructions for
20060 floating-point operations. When -msoft-float is specified,
20061 functions in libgcc.a are used to perform floating-point
20062 operations. Unless they are replaced by routines that emulate the
20063 floating-point operations, or compiled in such a way as to call
20064 such emulations routines, these routines issue floating-point
20065 operations. If you are compiling for an Alpha without floating-
20066 point operations, you must ensure that the library is built so as
20067 not to call them.
20068
20069 Note that Alpha implementations without floating-point operations
20070 are required to have floating-point registers.
20071
20072 -mfp-reg
20073 -mno-fp-regs
20074 Generate code that uses (does not use) the floating-point register
20075 set. -mno-fp-regs implies -msoft-float. If the floating-point
20076 register set is not used, floating-point operands are passed in
20077 integer registers as if they were integers and floating-point
20078 results are passed in $0 instead of $f0. This is a non-standard
20079 calling sequence, so any function with a floating-point argument or
20080 return value called by code compiled with -mno-fp-regs must also be
20081 compiled with that option.
20082
20083 A typical use of this option is building a kernel that does not
20084 use, and hence need not save and restore, any floating-point
20085 registers.
20086
20087 -mieee
20088 The Alpha architecture implements floating-point hardware optimized
20089 for maximum performance. It is mostly compliant with the IEEE
20090 floating-point standard. However, for full compliance, software
20091 assistance is required. This option generates code fully IEEE-
20092 compliant code except that the inexact-flag is not maintained (see
20093 below). If this option is turned on, the preprocessor macro
20094 "_IEEE_FP" is defined during compilation. The resulting code is
20095 less efficient but is able to correctly support denormalized
20096 numbers and exceptional IEEE values such as not-a-number and
20097 plus/minus infinity. Other Alpha compilers call this option
20098 -ieee_with_no_inexact.
20099
20100 -mieee-with-inexact
20101 This is like -mieee except the generated code also maintains the
20102 IEEE inexact-flag. Turning on this option causes the generated
20103 code to implement fully-compliant IEEE math. In addition to
20104 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
20105 On some Alpha implementations the resulting code may execute
20106 significantly slower than the code generated by default. Since
20107 there is very little code that depends on the inexact-flag, you
20108 should normally not specify this option. Other Alpha compilers
20109 call this option -ieee_with_inexact.
20110
20111 -mfp-trap-mode=trap-mode
20112 This option controls what floating-point related traps are enabled.
20113 Other Alpha compilers call this option -fptm trap-mode. The trap
20114 mode can be set to one of four values:
20115
20116 n This is the default (normal) setting. The only traps that are
20117 enabled are the ones that cannot be disabled in software (e.g.,
20118 division by zero trap).
20119
20120 u In addition to the traps enabled by n, underflow traps are
20121 enabled as well.
20122
20123 su Like u, but the instructions are marked to be safe for software
20124 completion (see Alpha architecture manual for details).
20125
20126 sui Like su, but inexact traps are enabled as well.
20127
20128 -mfp-rounding-mode=rounding-mode
20129 Selects the IEEE rounding mode. Other Alpha compilers call this
20130 option -fprm rounding-mode. The rounding-mode can be one of:
20131
20132 n Normal IEEE rounding mode. Floating-point numbers are rounded
20133 towards the nearest machine number or towards the even machine
20134 number in case of a tie.
20135
20136 m Round towards minus infinity.
20137
20138 c Chopped rounding mode. Floating-point numbers are rounded
20139 towards zero.
20140
20141 d Dynamic rounding mode. A field in the floating-point control
20142 register (fpcr, see Alpha architecture reference manual)
20143 controls the rounding mode in effect. The C library
20144 initializes this register for rounding towards plus infinity.
20145 Thus, unless your program modifies the fpcr, d corresponds to
20146 round towards plus infinity.
20147
20148 -mtrap-precision=trap-precision
20149 In the Alpha architecture, floating-point traps are imprecise.
20150 This means without software assistance it is impossible to recover
20151 from a floating trap and program execution normally needs to be
20152 terminated. GCC can generate code that can assist operating system
20153 trap handlers in determining the exact location that caused a
20154 floating-point trap. Depending on the requirements of an
20155 application, different levels of precisions can be selected:
20156
20157 p Program precision. This option is the default and means a trap
20158 handler can only identify which program caused a floating-point
20159 exception.
20160
20161 f Function precision. The trap handler can determine the
20162 function that caused a floating-point exception.
20163
20164 i Instruction precision. The trap handler can determine the
20165 exact instruction that caused a floating-point exception.
20166
20167 Other Alpha compilers provide the equivalent options called
20168 -scope_safe and -resumption_safe.
20169
20170 -mieee-conformant
20171 This option marks the generated code as IEEE conformant. You must
20172 not use this option unless you also specify -mtrap-precision=i and
20173 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
20174 to emit the line .eflag 48 in the function prologue of the
20175 generated assembly file.
20176
20177 -mbuild-constants
20178 Normally GCC examines a 32- or 64-bit integer constant to see if it
20179 can construct it from smaller constants in two or three
20180 instructions. If it cannot, it outputs the constant as a literal
20181 and generates code to load it from the data segment at run time.
20182
20183 Use this option to require GCC to construct all integer constants
20184 using code, even if it takes more instructions (the maximum is
20185 six).
20186
20187 You typically use this option to build a shared library dynamic
20188 loader. Itself a shared library, it must relocate itself in memory
20189 before it can find the variables and constants in its own data
20190 segment.
20191
20192 -mbwx
20193 -mno-bwx
20194 -mcix
20195 -mno-cix
20196 -mfix
20197 -mno-fix
20198 -mmax
20199 -mno-max
20200 Indicate whether GCC should generate code to use the optional BWX,
20201 CIX, FIX and MAX instruction sets. The default is to use the
20202 instruction sets supported by the CPU type specified via -mcpu=
20203 option or that of the CPU on which GCC was built if none is
20204 specified.
20205
20206 -mfloat-vax
20207 -mfloat-ieee
20208 Generate code that uses (does not use) VAX F and G floating-point
20209 arithmetic instead of IEEE single and double precision.
20210
20211 -mexplicit-relocs
20212 -mno-explicit-relocs
20213 Older Alpha assemblers provided no way to generate symbol
20214 relocations except via assembler macros. Use of these macros does
20215 not allow optimal instruction scheduling. GNU binutils as of
20216 version 2.12 supports a new syntax that allows the compiler to
20217 explicitly mark which relocations should apply to which
20218 instructions. This option is mostly useful for debugging, as GCC
20219 detects the capabilities of the assembler when it is built and sets
20220 the default accordingly.
20221
20222 -msmall-data
20223 -mlarge-data
20224 When -mexplicit-relocs is in effect, static data is accessed via
20225 gp-relative relocations. When -msmall-data is used, objects 8
20226 bytes long or smaller are placed in a small data area (the ".sdata"
20227 and ".sbss" sections) and are accessed via 16-bit relocations off
20228 of the $gp register. This limits the size of the small data area
20229 to 64KB, but allows the variables to be directly accessed via a
20230 single instruction.
20231
20232 The default is -mlarge-data. With this option the data area is
20233 limited to just below 2GB. Programs that require more than 2GB of
20234 data must use "malloc" or "mmap" to allocate the data in the heap
20235 instead of in the program's data segment.
20236
20237 When generating code for shared libraries, -fpic implies
20238 -msmall-data and -fPIC implies -mlarge-data.
20239
20240 -msmall-text
20241 -mlarge-text
20242 When -msmall-text is used, the compiler assumes that the code of
20243 the entire program (or shared library) fits in 4MB, and is thus
20244 reachable with a branch instruction. When -msmall-data is used,
20245 the compiler can assume that all local symbols share the same $gp
20246 value, and thus reduce the number of instructions required for a
20247 function call from 4 to 1.
20248
20249 The default is -mlarge-text.
20250
20251 -mcpu=cpu_type
20252 Set the instruction set and instruction scheduling parameters for
20253 machine type cpu_type. You can specify either the EV style name or
20254 the corresponding chip number. GCC supports scheduling parameters
20255 for the EV4, EV5 and EV6 family of processors and chooses the
20256 default values for the instruction set from the processor you
20257 specify. If you do not specify a processor type, GCC defaults to
20258 the processor on which the compiler was built.
20259
20260 Supported values for cpu_type are
20261
20262 ev4
20263 ev45
20264 21064
20265 Schedules as an EV4 and has no instruction set extensions.
20266
20267 ev5
20268 21164
20269 Schedules as an EV5 and has no instruction set extensions.
20270
20271 ev56
20272 21164a
20273 Schedules as an EV5 and supports the BWX extension.
20274
20275 pca56
20276 21164pc
20277 21164PC
20278 Schedules as an EV5 and supports the BWX and MAX extensions.
20279
20280 ev6
20281 21264
20282 Schedules as an EV6 and supports the BWX, FIX, and MAX
20283 extensions.
20284
20285 ev67
20286 21264a
20287 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
20288 extensions.
20289
20290 Native toolchains also support the value native, which selects the
20291 best architecture option for the host processor. -mcpu=native has
20292 no effect if GCC does not recognize the processor.
20293
20294 -mtune=cpu_type
20295 Set only the instruction scheduling parameters for machine type
20296 cpu_type. The instruction set is not changed.
20297
20298 Native toolchains also support the value native, which selects the
20299 best architecture option for the host processor. -mtune=native has
20300 no effect if GCC does not recognize the processor.
20301
20302 -mmemory-latency=time
20303 Sets the latency the scheduler should assume for typical memory
20304 references as seen by the application. This number is highly
20305 dependent on the memory access patterns used by the application and
20306 the size of the external cache on the machine.
20307
20308 Valid options for time are
20309
20310 number
20311 A decimal number representing clock cycles.
20312
20313 L1
20314 L2
20315 L3
20316 main
20317 The compiler contains estimates of the number of clock cycles
20318 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
20319 (also called Dcache, Scache, and Bcache), as well as to main
20320 memory. Note that L3 is only valid for EV5.
20321
20322 eBPF Options
20323
20324 -mframe-limit=bytes
20325 This specifies the hard limit for frame sizes, in bytes.
20326 Currently, the value that can be specified should be less than or
20327 equal to 32767. Defaults to whatever limit is imposed by the
20328 version of the Linux kernel targeted.
20329
20330 -mkernel=version
20331 This specifies the minimum version of the kernel that will run the
20332 compiled program. GCC uses this version to determine which
20333 instructions to use, what kernel helpers to allow, etc. Currently,
20334 version can be one of 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8,
20335 4.9, 4.10, 4.11, 4.12, 4.13, 4.14, 4.15, 4.16, 4.17, 4.18, 4.19,
20336 4.20, 5.0, 5.1, 5.2, latest and native.
20337
20338 -mbig-endian
20339 Generate code for a big-endian target.
20340
20341 -mlittle-endian
20342 Generate code for a little-endian target. This is the default.
20343
20344 -mjmpext
20345 Enable generation of extra conditional-branch instructions.
20346 Enabled for CPU v2 and above.
20347
20348 -mjmp32
20349 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
20350
20351 -malu32
20352 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
20353
20354 -mcpu=version
20355 This specifies which version of the eBPF ISA to target. Newer
20356 versions may not be supported by all kernels. The default is v3.
20357
20358 Supported values for version are:
20359
20360 v1 The first stable eBPF ISA with no special features or
20361 extensions.
20362
20363 v2 Supports the jump extensions, as in -mjmpext.
20364
20365 v3 All features of v2, plus:
20366
20367 -<32-bit jump operations, as in -mjmp32>
20368 -<32-bit ALU operations, as in -malu32>
20369 -mco-re
20370 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires
20371 and is implied by -gbtf.
20372
20373 -mno-co-re
20374 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-
20375 RE support is enabled by default when generating BTF debug
20376 information for the BPF target.
20377
20378 -mxbpf
20379 Generate code for an expanded version of BPF, which relaxes some of
20380 the restrictions imposed by the BPF architecture:
20381
20382 -<Save and restore callee-saved registers at function entry and>
20383 exit, respectively.
20384
20385 FR30 Options
20386
20387 These options are defined specifically for the FR30 port.
20388
20389 -msmall-model
20390 Use the small address space model. This can produce smaller code,
20391 but it does assume that all symbolic values and addresses fit into
20392 a 20-bit range.
20393
20394 -mno-lsim
20395 Assume that runtime support has been provided and so there is no
20396 need to include the simulator library (libsim.a) on the linker
20397 command line.
20398
20399 FT32 Options
20400
20401 These options are defined specifically for the FT32 port.
20402
20403 -msim
20404 Specifies that the program will be run on the simulator. This
20405 causes an alternate runtime startup and library to be linked. You
20406 must not use this option when generating programs that will run on
20407 real hardware; you must provide your own runtime library for
20408 whatever I/O functions are needed.
20409
20410 -mlra
20411 Enable Local Register Allocation. This is still experimental for
20412 FT32, so by default the compiler uses standard reload.
20413
20414 -mnodiv
20415 Do not use div and mod instructions.
20416
20417 -mft32b
20418 Enable use of the extended instructions of the FT32B processor.
20419
20420 -mcompress
20421 Compress all code using the Ft32B code compression scheme.
20422
20423 -mnopm
20424 Do not generate code that reads program memory.
20425
20426 FRV Options
20427
20428 -mgpr-32
20429 Only use the first 32 general-purpose registers.
20430
20431 -mgpr-64
20432 Use all 64 general-purpose registers.
20433
20434 -mfpr-32
20435 Use only the first 32 floating-point registers.
20436
20437 -mfpr-64
20438 Use all 64 floating-point registers.
20439
20440 -mhard-float
20441 Use hardware instructions for floating-point operations.
20442
20443 -msoft-float
20444 Use library routines for floating-point operations.
20445
20446 -malloc-cc
20447 Dynamically allocate condition code registers.
20448
20449 -mfixed-cc
20450 Do not try to dynamically allocate condition code registers, only
20451 use "icc0" and "fcc0".
20452
20453 -mdword
20454 Change ABI to use double word insns.
20455
20456 -mno-dword
20457 Do not use double word instructions.
20458
20459 -mdouble
20460 Use floating-point double instructions.
20461
20462 -mno-double
20463 Do not use floating-point double instructions.
20464
20465 -mmedia
20466 Use media instructions.
20467
20468 -mno-media
20469 Do not use media instructions.
20470
20471 -mmuladd
20472 Use multiply and add/subtract instructions.
20473
20474 -mno-muladd
20475 Do not use multiply and add/subtract instructions.
20476
20477 -mfdpic
20478 Select the FDPIC ABI, which uses function descriptors to represent
20479 pointers to functions. Without any PIC/PIE-related options, it
20480 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
20481 small data are within a 12-bit range from the GOT base address;
20482 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
20483 bfin-elf target, this option implies -msim.
20484
20485 -minline-plt
20486 Enable inlining of PLT entries in function calls to functions that
20487 are not known to bind locally. It has no effect without -mfdpic.
20488 It's enabled by default if optimizing for speed and compiling for
20489 shared libraries (i.e., -fPIC or -fpic), or when an optimization
20490 option such as -O3 or above is present in the command line.
20491
20492 -mTLS
20493 Assume a large TLS segment when generating thread-local code.
20494
20495 -mtls
20496 Do not assume a large TLS segment when generating thread-local
20497 code.
20498
20499 -mgprel-ro
20500 Enable the use of "GPREL" relocations in the FDPIC ABI for data
20501 that is known to be in read-only sections. It's enabled by
20502 default, except for -fpic or -fpie: even though it may help make
20503 the global offset table smaller, it trades 1 instruction for 4.
20504 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
20505 may be shared by multiple symbols, and it avoids the need for a GOT
20506 entry for the referenced symbol, so it's more likely to be a win.
20507 If it is not, -mno-gprel-ro can be used to disable it.
20508
20509 -multilib-library-pic
20510 Link with the (library, not FD) pic libraries. It's implied by
20511 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
20512 should never have to use it explicitly.
20513
20514 -mlinked-fp
20515 Follow the EABI requirement of always creating a frame pointer
20516 whenever a stack frame is allocated. This option is enabled by
20517 default and can be disabled with -mno-linked-fp.
20518
20519 -mlong-calls
20520 Use indirect addressing to call functions outside the current
20521 compilation unit. This allows the functions to be placed anywhere
20522 within the 32-bit address space.
20523
20524 -malign-labels
20525 Try to align labels to an 8-byte boundary by inserting NOPs into
20526 the previous packet. This option only has an effect when VLIW
20527 packing is enabled. It doesn't create new packets; it merely adds
20528 NOPs to existing ones.
20529
20530 -mlibrary-pic
20531 Generate position-independent EABI code.
20532
20533 -macc-4
20534 Use only the first four media accumulator registers.
20535
20536 -macc-8
20537 Use all eight media accumulator registers.
20538
20539 -mpack
20540 Pack VLIW instructions.
20541
20542 -mno-pack
20543 Do not pack VLIW instructions.
20544
20545 -mno-eflags
20546 Do not mark ABI switches in e_flags.
20547
20548 -mcond-move
20549 Enable the use of conditional-move instructions (default).
20550
20551 This switch is mainly for debugging the compiler and will likely be
20552 removed in a future version.
20553
20554 -mno-cond-move
20555 Disable the use of conditional-move instructions.
20556
20557 This switch is mainly for debugging the compiler and will likely be
20558 removed in a future version.
20559
20560 -mscc
20561 Enable the use of conditional set instructions (default).
20562
20563 This switch is mainly for debugging the compiler and will likely be
20564 removed in a future version.
20565
20566 -mno-scc
20567 Disable the use of conditional set instructions.
20568
20569 This switch is mainly for debugging the compiler and will likely be
20570 removed in a future version.
20571
20572 -mcond-exec
20573 Enable the use of conditional execution (default).
20574
20575 This switch is mainly for debugging the compiler and will likely be
20576 removed in a future version.
20577
20578 -mno-cond-exec
20579 Disable the use of conditional execution.
20580
20581 This switch is mainly for debugging the compiler and will likely be
20582 removed in a future version.
20583
20584 -mvliw-branch
20585 Run a pass to pack branches into VLIW instructions (default).
20586
20587 This switch is mainly for debugging the compiler and will likely be
20588 removed in a future version.
20589
20590 -mno-vliw-branch
20591 Do not run a pass to pack branches into VLIW instructions.
20592
20593 This switch is mainly for debugging the compiler and will likely be
20594 removed in a future version.
20595
20596 -mmulti-cond-exec
20597 Enable optimization of "&&" and "||" in conditional execution
20598 (default).
20599
20600 This switch is mainly for debugging the compiler and will likely be
20601 removed in a future version.
20602
20603 -mno-multi-cond-exec
20604 Disable optimization of "&&" and "||" in conditional execution.
20605
20606 This switch is mainly for debugging the compiler and will likely be
20607 removed in a future version.
20608
20609 -mnested-cond-exec
20610 Enable nested conditional execution optimizations (default).
20611
20612 This switch is mainly for debugging the compiler and will likely be
20613 removed in a future version.
20614
20615 -mno-nested-cond-exec
20616 Disable nested conditional execution optimizations.
20617
20618 This switch is mainly for debugging the compiler and will likely be
20619 removed in a future version.
20620
20621 -moptimize-membar
20622 This switch removes redundant "membar" instructions from the
20623 compiler-generated code. It is enabled by default.
20624
20625 -mno-optimize-membar
20626 This switch disables the automatic removal of redundant "membar"
20627 instructions from the generated code.
20628
20629 -mtomcat-stats
20630 Cause gas to print out tomcat statistics.
20631
20632 -mcpu=cpu
20633 Select the processor type for which to generate code. Possible
20634 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
20635 and simple.
20636
20637 GNU/Linux Options
20638
20639 These -m options are defined for GNU/Linux targets:
20640
20641 -mglibc
20642 Use the GNU C library. This is the default except on
20643 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
20644 targets.
20645
20646 -muclibc
20647 Use uClibc C library. This is the default on *-*-linux-*uclibc*
20648 targets.
20649
20650 -mmusl
20651 Use the musl C library. This is the default on *-*-linux-*musl*
20652 targets.
20653
20654 -mbionic
20655 Use Bionic C library. This is the default on *-*-linux-*android*
20656 targets.
20657
20658 -mandroid
20659 Compile code compatible with Android platform. This is the default
20660 on *-*-linux-*android* targets.
20661
20662 When compiling, this option enables -mbionic, -fPIC,
20663 -fno-exceptions and -fno-rtti by default. When linking, this
20664 option makes the GCC driver pass Android-specific options to the
20665 linker. Finally, this option causes the preprocessor macro
20666 "__ANDROID__" to be defined.
20667
20668 -tno-android-cc
20669 Disable compilation effects of -mandroid, i.e., do not enable
20670 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
20671
20672 -tno-android-ld
20673 Disable linking effects of -mandroid, i.e., pass standard Linux
20674 linking options to the linker.
20675
20676 H8/300 Options
20677
20678 These -m options are defined for the H8/300 implementations:
20679
20680 -mrelax
20681 Shorten some address references at link time, when possible; uses
20682 the linker option -relax.
20683
20684 -mh Generate code for the H8/300H.
20685
20686 -ms Generate code for the H8S.
20687
20688 -mn Generate code for the H8S and H8/300H in the normal mode. This
20689 switch must be used either with -mh or -ms.
20690
20691 -ms2600
20692 Generate code for the H8S/2600. This switch must be used with -ms.
20693
20694 -mexr
20695 Extended registers are stored on stack before execution of function
20696 with monitor attribute. Default option is -mexr. This option is
20697 valid only for H8S targets.
20698
20699 -mno-exr
20700 Extended registers are not stored on stack before execution of
20701 function with monitor attribute. Default option is -mno-exr. This
20702 option is valid only for H8S targets.
20703
20704 -mint32
20705 Make "int" data 32 bits by default.
20706
20707 -malign-300
20708 On the H8/300H and H8S, use the same alignment rules as for the
20709 H8/300. The default for the H8/300H and H8S is to align longs and
20710 floats on 4-byte boundaries. -malign-300 causes them to be aligned
20711 on 2-byte boundaries. This option has no effect on the H8/300.
20712
20713 HPPA Options
20714
20715 These -m options are defined for the HPPA family of computers:
20716
20717 -march=architecture-type
20718 Generate code for the specified architecture. The choices for
20719 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
20720 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
20721 system to determine the proper architecture option for your
20722 machine. Code compiled for lower numbered architectures runs on
20723 higher numbered architectures, but not the other way around.
20724
20725 -mpa-risc-1-0
20726 -mpa-risc-1-1
20727 -mpa-risc-2-0
20728 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
20729
20730 -mcaller-copies
20731 The caller copies function arguments passed by hidden reference.
20732 This option should be used with care as it is not compatible with
20733 the default 32-bit runtime. However, only aggregates larger than
20734 eight bytes are passed by hidden reference and the option provides
20735 better compatibility with OpenMP.
20736
20737 -mjump-in-delay
20738 This option is ignored and provided for compatibility purposes
20739 only.
20740
20741 -mdisable-fpregs
20742 Prevent floating-point registers from being used in any manner.
20743 This is necessary for compiling kernels that perform lazy context
20744 switching of floating-point registers. If you use this option and
20745 attempt to perform floating-point operations, the compiler aborts.
20746
20747 -mdisable-indexing
20748 Prevent the compiler from using indexing address modes. This
20749 avoids some rather obscure problems when compiling MIG generated
20750 code under MACH.
20751
20752 -mno-space-regs
20753 Generate code that assumes the target has no space registers. This
20754 allows GCC to generate faster indirect calls and use unscaled index
20755 address modes.
20756
20757 Such code is suitable for level 0 PA systems and kernels.
20758
20759 -mfast-indirect-calls
20760 Generate code that assumes calls never cross space boundaries.
20761 This allows GCC to emit code that performs faster indirect calls.
20762
20763 This option does not work in the presence of shared libraries or
20764 nested functions.
20765
20766 -mfixed-range=register-range
20767 Generate code treating the given register range as fixed registers.
20768 A fixed register is one that the register allocator cannot use.
20769 This is useful when compiling kernel code. A register range is
20770 specified as two registers separated by a dash. Multiple register
20771 ranges can be specified separated by a comma.
20772
20773 -mlong-load-store
20774 Generate 3-instruction load and store sequences as sometimes
20775 required by the HP-UX 10 linker. This is equivalent to the +k
20776 option to the HP compilers.
20777
20778 -mportable-runtime
20779 Use the portable calling conventions proposed by HP for ELF
20780 systems.
20781
20782 -mgas
20783 Enable the use of assembler directives only GAS understands.
20784
20785 -mschedule=cpu-type
20786 Schedule code according to the constraints for the machine type
20787 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
20788 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
20789 to determine the proper scheduling option for your machine. The
20790 default scheduling is 8000.
20791
20792 -mlinker-opt
20793 Enable the optimization pass in the HP-UX linker. Note this makes
20794 symbolic debugging impossible. It also triggers a bug in the HP-UX
20795 8 and HP-UX 9 linkers in which they give bogus error messages when
20796 linking some programs.
20797
20798 -msoft-float
20799 Generate output containing library calls for floating point.
20800 Warning: the requisite libraries are not available for all HPPA
20801 targets. Normally the facilities of the machine's usual C compiler
20802 are used, but this cannot be done directly in cross-compilation.
20803 You must make your own arrangements to provide suitable library
20804 functions for cross-compilation.
20805
20806 -msoft-float changes the calling convention in the output file;
20807 therefore, it is only useful if you compile all of a program with
20808 this option. In particular, you need to compile libgcc.a, the
20809 library that comes with GCC, with -msoft-float in order for this to
20810 work.
20811
20812 -msio
20813 Generate the predefine, "_SIO", for server IO. The default is
20814 -mwsio. This generates the predefines, "__hp9000s700",
20815 "__hp9000s700__" and "_WSIO", for workstation IO. These options
20816 are available under HP-UX and HI-UX.
20817
20818 -mgnu-ld
20819 Use options specific to GNU ld. This passes -shared to ld when
20820 building a shared library. It is the default when GCC is
20821 configured, explicitly or implicitly, with the GNU linker. This
20822 option does not affect which ld is called; it only changes what
20823 parameters are passed to that ld. The ld that is called is
20824 determined by the --with-ld configure option, GCC's program search
20825 path, and finally by the user's PATH. The linker used by GCC can
20826 be printed using which `gcc -print-prog-name=ld`. This option is
20827 only available on the 64-bit HP-UX GCC, i.e. configured with
20828 hppa*64*-*-hpux*.
20829
20830 -mhp-ld
20831 Use options specific to HP ld. This passes -b to ld when building
20832 a shared library and passes +Accept TypeMismatch to ld on all
20833 links. It is the default when GCC is configured, explicitly or
20834 implicitly, with the HP linker. This option does not affect which
20835 ld is called; it only changes what parameters are passed to that
20836 ld. The ld that is called is determined by the --with-ld configure
20837 option, GCC's program search path, and finally by the user's PATH.
20838 The linker used by GCC can be printed using which `gcc
20839 -print-prog-name=ld`. This option is only available on the 64-bit
20840 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
20841
20842 -mlong-calls
20843 Generate code that uses long call sequences. This ensures that a
20844 call is always able to reach linker generated stubs. The default
20845 is to generate long calls only when the distance from the call site
20846 to the beginning of the function or translation unit, as the case
20847 may be, exceeds a predefined limit set by the branch type being
20848 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
20849 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
20850 always limited at 240,000 bytes.
20851
20852 Distances are measured from the beginning of functions when using
20853 the -ffunction-sections option, or when using the -mgas and
20854 -mno-portable-runtime options together under HP-UX with the SOM
20855 linker.
20856
20857 It is normally not desirable to use this option as it degrades
20858 performance. However, it may be useful in large applications,
20859 particularly when partial linking is used to build the application.
20860
20861 The types of long calls used depends on the capabilities of the
20862 assembler and linker, and the type of code being generated. The
20863 impact on systems that support long absolute calls, and long pic
20864 symbol-difference or pc-relative calls should be relatively small.
20865 However, an indirect call is used on 32-bit ELF systems in pic code
20866 and it is quite long.
20867
20868 -munix=unix-std
20869 Generate compiler predefines and select a startfile for the
20870 specified UNIX standard. The choices for unix-std are 93, 95 and
20871 98. 93 is supported on all HP-UX versions. 95 is available on HP-
20872 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
20873 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
20874 11.00, and 98 for HP-UX 11.11 and later.
20875
20876 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
20877 -munix=95 provides additional predefines for "XOPEN_UNIX" and
20878 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
20879 provides additional predefines for "_XOPEN_UNIX",
20880 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
20881 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
20882
20883 It is important to note that this option changes the interfaces for
20884 various library routines. It also affects the operational behavior
20885 of the C library. Thus, extreme care is needed in using this
20886 option.
20887
20888 Library code that is intended to operate with more than one UNIX
20889 standard must test, set and restore the variable
20890 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
20891 provide this capability.
20892
20893 -nolibdld
20894 Suppress the generation of link options to search libdld.sl when
20895 the -static option is specified on HP-UX 10 and later.
20896
20897 -static
20898 The HP-UX implementation of setlocale in libc has a dependency on
20899 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20900 when the -static option is specified, special link options are
20901 needed to resolve this dependency.
20902
20903 On HP-UX 10 and later, the GCC driver adds the necessary options to
20904 link with libdld.sl when the -static option is specified. This
20905 causes the resulting binary to be dynamic. On the 64-bit port, the
20906 linkers generate dynamic binaries by default in any case. The
20907 -nolibdld option can be used to prevent the GCC driver from adding
20908 these link options.
20909
20910 -threads
20911 Add support for multithreading with the dce thread library under
20912 HP-UX. This option sets flags for both the preprocessor and
20913 linker.
20914
20915 IA-64 Options
20916
20917 These are the -m options defined for the Intel IA-64 architecture.
20918
20919 -mbig-endian
20920 Generate code for a big-endian target. This is the default for HP-
20921 UX.
20922
20923 -mlittle-endian
20924 Generate code for a little-endian target. This is the default for
20925 AIX5 and GNU/Linux.
20926
20927 -mgnu-as
20928 -mno-gnu-as
20929 Generate (or don't) code for the GNU assembler. This is the
20930 default.
20931
20932 -mgnu-ld
20933 -mno-gnu-ld
20934 Generate (or don't) code for the GNU linker. This is the default.
20935
20936 -mno-pic
20937 Generate code that does not use a global pointer register. The
20938 result is not position independent code, and violates the IA-64
20939 ABI.
20940
20941 -mvolatile-asm-stop
20942 -mno-volatile-asm-stop
20943 Generate (or don't) a stop bit immediately before and after
20944 volatile asm statements.
20945
20946 -mregister-names
20947 -mno-register-names
20948 Generate (or don't) in, loc, and out register names for the stacked
20949 registers. This may make assembler output more readable.
20950
20951 -mno-sdata
20952 -msdata
20953 Disable (or enable) optimizations that use the small data section.
20954 This may be useful for working around optimizer bugs.
20955
20956 -mconstant-gp
20957 Generate code that uses a single constant global pointer value.
20958 This is useful when compiling kernel code.
20959
20960 -mauto-pic
20961 Generate code that is self-relocatable. This implies
20962 -mconstant-gp. This is useful when compiling firmware code.
20963
20964 -minline-float-divide-min-latency
20965 Generate code for inline divides of floating-point values using the
20966 minimum latency algorithm.
20967
20968 -minline-float-divide-max-throughput
20969 Generate code for inline divides of floating-point values using the
20970 maximum throughput algorithm.
20971
20972 -mno-inline-float-divide
20973 Do not generate inline code for divides of floating-point values.
20974
20975 -minline-int-divide-min-latency
20976 Generate code for inline divides of integer values using the
20977 minimum latency algorithm.
20978
20979 -minline-int-divide-max-throughput
20980 Generate code for inline divides of integer values using the
20981 maximum throughput algorithm.
20982
20983 -mno-inline-int-divide
20984 Do not generate inline code for divides of integer values.
20985
20986 -minline-sqrt-min-latency
20987 Generate code for inline square roots using the minimum latency
20988 algorithm.
20989
20990 -minline-sqrt-max-throughput
20991 Generate code for inline square roots using the maximum throughput
20992 algorithm.
20993
20994 -mno-inline-sqrt
20995 Do not generate inline code for "sqrt".
20996
20997 -mfused-madd
20998 -mno-fused-madd
20999 Do (don't) generate code that uses the fused multiply/add or
21000 multiply/subtract instructions. The default is to use these
21001 instructions.
21002
21003 -mno-dwarf2-asm
21004 -mdwarf2-asm
21005 Don't (or do) generate assembler code for the DWARF line number
21006 debugging info. This may be useful when not using the GNU
21007 assembler.
21008
21009 -mearly-stop-bits
21010 -mno-early-stop-bits
21011 Allow stop bits to be placed earlier than immediately preceding the
21012 instruction that triggered the stop bit. This can improve
21013 instruction scheduling, but does not always do so.
21014
21015 -mfixed-range=register-range
21016 Generate code treating the given register range as fixed registers.
21017 A fixed register is one that the register allocator cannot use.
21018 This is useful when compiling kernel code. A register range is
21019 specified as two registers separated by a dash. Multiple register
21020 ranges can be specified separated by a comma.
21021
21022 -mtls-size=tls-size
21023 Specify bit size of immediate TLS offsets. Valid values are 14,
21024 22, and 64.
21025
21026 -mtune=cpu-type
21027 Tune the instruction scheduling for a particular CPU, Valid values
21028 are itanium, itanium1, merced, itanium2, and mckinley.
21029
21030 -milp32
21031 -mlp64
21032 Generate code for a 32-bit or 64-bit environment. The 32-bit
21033 environment sets int, long and pointer to 32 bits. The 64-bit
21034 environment sets int to 32 bits and long and pointer to 64 bits.
21035 These are HP-UX specific flags.
21036
21037 -mno-sched-br-data-spec
21038 -msched-br-data-spec
21039 (Dis/En)able data speculative scheduling before reload. This
21040 results in generation of "ld.a" instructions and the corresponding
21041 check instructions ("ld.c" / "chk.a"). The default setting is
21042 disabled.
21043
21044 -msched-ar-data-spec
21045 -mno-sched-ar-data-spec
21046 (En/Dis)able data speculative scheduling after reload. This
21047 results in generation of "ld.a" instructions and the corresponding
21048 check instructions ("ld.c" / "chk.a"). The default setting is
21049 enabled.
21050
21051 -mno-sched-control-spec
21052 -msched-control-spec
21053 (Dis/En)able control speculative scheduling. This feature is
21054 available only during region scheduling (i.e. before reload). This
21055 results in generation of the "ld.s" instructions and the
21056 corresponding check instructions "chk.s". The default setting is
21057 disabled.
21058
21059 -msched-br-in-data-spec
21060 -mno-sched-br-in-data-spec
21061 (En/Dis)able speculative scheduling of the instructions that are
21062 dependent on the data speculative loads before reload. This is
21063 effective only with -msched-br-data-spec enabled. The default
21064 setting is enabled.
21065
21066 -msched-ar-in-data-spec
21067 -mno-sched-ar-in-data-spec
21068 (En/Dis)able speculative scheduling of the instructions that are
21069 dependent on the data speculative loads after reload. This is
21070 effective only with -msched-ar-data-spec enabled. The default
21071 setting is enabled.
21072
21073 -msched-in-control-spec
21074 -mno-sched-in-control-spec
21075 (En/Dis)able speculative scheduling of the instructions that are
21076 dependent on the control speculative loads. This is effective only
21077 with -msched-control-spec enabled. The default setting is enabled.
21078
21079 -mno-sched-prefer-non-data-spec-insns
21080 -msched-prefer-non-data-spec-insns
21081 If enabled, data-speculative instructions are chosen for schedule
21082 only if there are no other choices at the moment. This makes the
21083 use of the data speculation much more conservative. The default
21084 setting is disabled.
21085
21086 -mno-sched-prefer-non-control-spec-insns
21087 -msched-prefer-non-control-spec-insns
21088 If enabled, control-speculative instructions are chosen for
21089 schedule only if there are no other choices at the moment. This
21090 makes the use of the control speculation much more conservative.
21091 The default setting is disabled.
21092
21093 -mno-sched-count-spec-in-critical-path
21094 -msched-count-spec-in-critical-path
21095 If enabled, speculative dependencies are considered during
21096 computation of the instructions priorities. This makes the use of
21097 the speculation a bit more conservative. The default setting is
21098 disabled.
21099
21100 -msched-spec-ldc
21101 Use a simple data speculation check. This option is on by default.
21102
21103 -msched-control-spec-ldc
21104 Use a simple check for control speculation. This option is on by
21105 default.
21106
21107 -msched-stop-bits-after-every-cycle
21108 Place a stop bit after every cycle when scheduling. This option is
21109 on by default.
21110
21111 -msched-fp-mem-deps-zero-cost
21112 Assume that floating-point stores and loads are not likely to cause
21113 a conflict when placed into the same instruction group. This
21114 option is disabled by default.
21115
21116 -msel-sched-dont-check-control-spec
21117 Generate checks for control speculation in selective scheduling.
21118 This flag is disabled by default.
21119
21120 -msched-max-memory-insns=max-insns
21121 Limit on the number of memory insns per instruction group, giving
21122 lower priority to subsequent memory insns attempting to schedule in
21123 the same instruction group. Frequently useful to prevent cache bank
21124 conflicts. The default value is 1.
21125
21126 -msched-max-memory-insns-hard-limit
21127 Makes the limit specified by msched-max-memory-insns a hard limit,
21128 disallowing more than that number in an instruction group.
21129 Otherwise, the limit is "soft", meaning that non-memory operations
21130 are preferred when the limit is reached, but memory operations may
21131 still be scheduled.
21132
21133 LM32 Options
21134
21135 These -m options are defined for the LatticeMico32 architecture:
21136
21137 -mbarrel-shift-enabled
21138 Enable barrel-shift instructions.
21139
21140 -mdivide-enabled
21141 Enable divide and modulus instructions.
21142
21143 -mmultiply-enabled
21144 Enable multiply instructions.
21145
21146 -msign-extend-enabled
21147 Enable sign extend instructions.
21148
21149 -muser-enabled
21150 Enable user-defined instructions.
21151
21152 LoongArch Options
21153
21154 These command-line options are defined for LoongArch targets:
21155
21156 -march=cpu-type
21157 Generate instructions for the machine type cpu-type. In contrast
21158 to -mtune=cpu-type, which merely tunes the generated code for the
21159 specified cpu-type, -march=cpu-type allows GCC to generate code
21160 that may not run at all on processors other than the one indicated.
21161 Specifying -march=cpu-type implies -mtune=cpu-type, except where
21162 noted otherwise.
21163
21164 The choices for cpu-type are:
21165
21166 native
21167 This selects the CPU to generate code for at compilation time
21168 by determining the processor type of the compiling machine.
21169 Using -march=native enables all instruction subsets supported
21170 by the local machine (hence the result might not run on
21171 different machines). Using -mtune=native produces code
21172 optimized for the local machine under the constraints of the
21173 selected instruction set.
21174
21175 loongarch64
21176 A generic CPU with 64-bit extensions.
21177
21178 la464
21179 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
21180
21181 -mtune=cpu-type
21182 Optimize the output for the given processor, specified by
21183 microarchitecture name.
21184
21185 -mabi=base-abi-type
21186 Generate code for the specified calling convention. base-abi-type
21187 can be one of:
21188
21189 lp64d
21190 Uses 64-bit general purpose registers and 32/64-bit floating-
21191 point registers for parameter passing. Data model is LP64,
21192 where int is 32 bits, while long int and pointers are 64 bits.
21193
21194 lp64f
21195 Uses 64-bit general purpose registers and 32-bit floating-point
21196 registers for parameter passing. Data model is LP64, where int
21197 is 32 bits, while long int and pointers are 64 bits.
21198
21199 lp64s
21200 Uses 64-bit general purpose registers and no floating-point
21201 registers for parameter passing. Data model is LP64, where int
21202 is 32 bits, while long int and pointers are 64 bits.
21203
21204 -mfpu=fpu-type
21205 Generate code for the specified FPU type, which can be one of:
21206
21207 64 Allow the use of hardware floating-point instructions for
21208 32-bit and 64-bit operations.
21209
21210 32 Allow the use of hardware floating-point instructions for
21211 32-bit operations.
21212
21213 none
21214 0 Prevent the use of hardware floating-point instructions.
21215
21216 -msoft-float
21217 Force -mfpu=none and prevents the use of floating-point registers
21218 for parameter passing. This option may change the target ABI.
21219
21220 -msingle-float
21221 Force -mfpu=32 and allow the use of 32-bit floating-point registers
21222 for parameter passing. This option may change the target ABI.
21223
21224 -mdouble-float
21225 Force -mfpu=64 and allow the use of 32/64-bit floating-point
21226 registers for parameter passing. This option may change the target
21227 ABI.
21228
21229 -mbranch-cost=n
21230 Set the cost of branches to roughly n instructions.
21231
21232 -mcheck-zero-division
21233 -mno-check-zero-divison
21234 Trap (do not trap) on integer division by zero. The default is
21235 -mcheck-zero-division for -O0 or -Og, and -mno-check-zero-division
21236 for other optimization levels.
21237
21238 -mcond-move-int
21239 -mno-cond-move-int
21240 Conditional moves for integral data in general-purpose registers
21241 are enabled (disabled). The default is -mcond-move-int.
21242
21243 -mcond-move-float
21244 -mno-cond-move-float
21245 Conditional moves for floating-point registers are enabled
21246 (disabled). The default is -mcond-move-float.
21247
21248 -mmemcpy
21249 -mno-memcpy
21250 Force (do not force) the use of "memcpy" for non-trivial block
21251 moves. The default is -mno-memcpy, which allows GCC to inline most
21252 constant-sized copies. Setting optimization level to -Os also
21253 forces the use of "memcpy", but -mno-memcpy may override this
21254 behavior if explicitly specified, regardless of the order these
21255 options on the command line.
21256
21257 -mstrict-align
21258 -mno-strict-align
21259 Avoid or allow generating memory accesses that may not be aligned
21260 on a natural object boundary as described in the architecture
21261 specification. The default is -mno-strict-align.
21262
21263 -msmall-data-limit=number
21264 Put global and static data smaller than number bytes into a special
21265 section (on some targets). The default value is 0.
21266
21267 -mmax-inline-memcpy-size=n
21268 Inline all block moves (such as calls to "memcpy" or structure
21269 copies) less than or equal to n bytes. The default value of n is
21270 1024.
21271
21272 -mcmodel=code-model
21273 Set the code model to one of:
21274
21275 tiny-static
21276 * local symbol and global strong symbol: The data section
21277 must be within +/-2MiB addressing space. The text section
21278 must be within +/-128MiB addressing space.
21279
21280 * global weak symbol: The got table must be within +/-2GiB
21281 addressing space.
21282
21283 tiny
21284 * local symbol: The data section must be within +/-2MiB
21285 addressing space. The text section must be within
21286 +/-128MiB addressing space.
21287
21288 * global symbol: The got table must be within +/-2GiB
21289 addressing space.
21290
21291 normal
21292 * local symbol: The data section must be within +/-2GiB
21293 addressing space. The text section must be within
21294 +/-128MiB addressing space.
21295
21296 * global symbol: The got table must be within +/-2GiB
21297 addressing space.
21298
21299 large
21300 * local symbol: The data section must be within +/-2GiB
21301 addressing space. The text section must be within
21302 +/-128GiB addressing space.
21303
21304 * global symbol: The got table must be within +/-2GiB
21305 addressing space.
21306
21307 extreme(Not implemented yet)
21308 * local symbol: The data and text section must be within
21309 +/-8EiB addressing space.
21310
21311 * global symbol: The data got table must be within +/-8EiB
21312 addressing space.
21313
21314 The default code model is "normal".
21315
21316 M32C Options
21317
21318 -mcpu=name
21319 Select the CPU for which code is generated. name may be one of r8c
21320 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
21321 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
21322
21323 -msim
21324 Specifies that the program will be run on the simulator. This
21325 causes an alternate runtime library to be linked in which supports,
21326 for example, file I/O. You must not use this option when
21327 generating programs that will run on real hardware; you must
21328 provide your own runtime library for whatever I/O functions are
21329 needed.
21330
21331 -memregs=number
21332 Specifies the number of memory-based pseudo-registers GCC uses
21333 during code generation. These pseudo-registers are used like real
21334 registers, so there is a tradeoff between GCC's ability to fit the
21335 code into available registers, and the performance penalty of using
21336 memory instead of registers. Note that all modules in a program
21337 must be compiled with the same value for this option. Because of
21338 that, you must not use this option with GCC's default runtime
21339 libraries.
21340
21341 M32R/D Options
21342
21343 These -m options are defined for Renesas M32R/D architectures:
21344
21345 -m32r2
21346 Generate code for the M32R/2.
21347
21348 -m32rx
21349 Generate code for the M32R/X.
21350
21351 -m32r
21352 Generate code for the M32R. This is the default.
21353
21354 -mmodel=small
21355 Assume all objects live in the lower 16MB of memory (so that their
21356 addresses can be loaded with the "ld24" instruction), and assume
21357 all subroutines are reachable with the "bl" instruction. This is
21358 the default.
21359
21360 The addressability of a particular object can be set with the
21361 "model" attribute.
21362
21363 -mmodel=medium
21364 Assume objects may be anywhere in the 32-bit address space (the
21365 compiler generates "seth/add3" instructions to load their
21366 addresses), and assume all subroutines are reachable with the "bl"
21367 instruction.
21368
21369 -mmodel=large
21370 Assume objects may be anywhere in the 32-bit address space (the
21371 compiler generates "seth/add3" instructions to load their
21372 addresses), and assume subroutines may not be reachable with the
21373 "bl" instruction (the compiler generates the much slower
21374 "seth/add3/jl" instruction sequence).
21375
21376 -msdata=none
21377 Disable use of the small data area. Variables are put into one of
21378 ".data", ".bss", or ".rodata" (unless the "section" attribute has
21379 been specified). This is the default.
21380
21381 The small data area consists of sections ".sdata" and ".sbss".
21382 Objects may be explicitly put in the small data area with the
21383 "section" attribute using one of these sections.
21384
21385 -msdata=sdata
21386 Put small global and static data in the small data area, but do not
21387 generate special code to reference them.
21388
21389 -msdata=use
21390 Put small global and static data in the small data area, and
21391 generate special instructions to reference them.
21392
21393 -G num
21394 Put global and static objects less than or equal to num bytes into
21395 the small data or BSS sections instead of the normal data or BSS
21396 sections. The default value of num is 8. The -msdata option must
21397 be set to one of sdata or use for this option to have any effect.
21398
21399 All modules should be compiled with the same -G num value.
21400 Compiling with different values of num may or may not work; if it
21401 doesn't the linker gives an error message---incorrect code is not
21402 generated.
21403
21404 -mdebug
21405 Makes the M32R-specific code in the compiler display some
21406 statistics that might help in debugging programs.
21407
21408 -malign-loops
21409 Align all loops to a 32-byte boundary.
21410
21411 -mno-align-loops
21412 Do not enforce a 32-byte alignment for loops. This is the default.
21413
21414 -missue-rate=number
21415 Issue number instructions per cycle. number can only be 1 or 2.
21416
21417 -mbranch-cost=number
21418 number can only be 1 or 2. If it is 1 then branches are preferred
21419 over conditional code, if it is 2, then the opposite applies.
21420
21421 -mflush-trap=number
21422 Specifies the trap number to use to flush the cache. The default
21423 is 12. Valid numbers are between 0 and 15 inclusive.
21424
21425 -mno-flush-trap
21426 Specifies that the cache cannot be flushed by using a trap.
21427
21428 -mflush-func=name
21429 Specifies the name of the operating system function to call to
21430 flush the cache. The default is _flush_cache, but a function call
21431 is only used if a trap is not available.
21432
21433 -mno-flush-func
21434 Indicates that there is no OS function for flushing the cache.
21435
21436 M680x0 Options
21437
21438 These are the -m options defined for M680x0 and ColdFire processors.
21439 The default settings depend on which architecture was selected when the
21440 compiler was configured; the defaults for the most common choices are
21441 given below.
21442
21443 -march=arch
21444 Generate code for a specific M680x0 or ColdFire instruction set
21445 architecture. Permissible values of arch for M680x0 architectures
21446 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
21447 architectures are selected according to Freescale's ISA
21448 classification and the permissible values are: isaa, isaaplus, isab
21449 and isac.
21450
21451 GCC defines a macro "__mcfarch__" whenever it is generating code
21452 for a ColdFire target. The arch in this macro is one of the -march
21453 arguments given above.
21454
21455 When used together, -march and -mtune select code that runs on a
21456 family of similar processors but that is optimized for a particular
21457 microarchitecture.
21458
21459 -mcpu=cpu
21460 Generate code for a specific M680x0 or ColdFire processor. The
21461 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
21462 68332 and cpu32. The ColdFire cpus are given by the table below,
21463 which also classifies the CPUs into families:
21464
21465 Family : -mcpu arguments
21466 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
21467 5206 : 5202 5204 5206
21468 5206e : 5206e
21469 5208 : 5207 5208
21470 5211a : 5210a 5211a
21471 5213 : 5211 5212 5213
21472 5216 : 5214 5216
21473 52235 : 52230 52231 52232 52233 52234 52235
21474 5225 : 5224 5225
21475 52259 : 52252 52254 52255 52256 52258 52259
21476 5235 : 5232 5233 5234 5235 523x
21477 5249 : 5249
21478 5250 : 5250
21479 5271 : 5270 5271
21480 5272 : 5272
21481 5275 : 5274 5275
21482 5282 : 5280 5281 5282 528x
21483 53017 : 53011 53012 53013 53014 53015 53016 53017
21484 5307 : 5307
21485 5329 : 5327 5328 5329 532x
21486 5373 : 5372 5373 537x
21487 5407 : 5407
21488 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
21489 5485
21490
21491 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
21492 Other combinations of -mcpu and -march are rejected.
21493
21494 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
21495 selected. It also defines "__mcf_family_family", where the value
21496 of family is given by the table above.
21497
21498 -mtune=tune
21499 Tune the code for a particular microarchitecture within the
21500 constraints set by -march and -mcpu. The M680x0 microarchitectures
21501 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
21502 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
21503
21504 You can also use -mtune=68020-40 for code that needs to run
21505 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
21506 is similar but includes 68060 targets as well. These two options
21507 select the same tuning decisions as -m68020-40 and -m68020-60
21508 respectively.
21509
21510 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
21511 680x0 architecture arch. It also defines "mcarch" unless either
21512 -ansi or a non-GNU -std option is used. If GCC is tuning for a
21513 range of architectures, as selected by -mtune=68020-40 or
21514 -mtune=68020-60, it defines the macros for every architecture in
21515 the range.
21516
21517 GCC also defines the macro "__muarch__" when tuning for ColdFire
21518 microarchitecture uarch, where uarch is one of the arguments given
21519 above.
21520
21521 -m68000
21522 -mc68000
21523 Generate output for a 68000. This is the default when the compiler
21524 is configured for 68000-based systems. It is equivalent to
21525 -march=68000.
21526
21527 Use this option for microcontrollers with a 68000 or EC000 core,
21528 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21529
21530 -m68010
21531 Generate output for a 68010. This is the default when the compiler
21532 is configured for 68010-based systems. It is equivalent to
21533 -march=68010.
21534
21535 -m68020
21536 -mc68020
21537 Generate output for a 68020. This is the default when the compiler
21538 is configured for 68020-based systems. It is equivalent to
21539 -march=68020.
21540
21541 -m68030
21542 Generate output for a 68030. This is the default when the compiler
21543 is configured for 68030-based systems. It is equivalent to
21544 -march=68030.
21545
21546 -m68040
21547 Generate output for a 68040. This is the default when the compiler
21548 is configured for 68040-based systems. It is equivalent to
21549 -march=68040.
21550
21551 This option inhibits the use of 68881/68882 instructions that have
21552 to be emulated by software on the 68040. Use this option if your
21553 68040 does not have code to emulate those instructions.
21554
21555 -m68060
21556 Generate output for a 68060. This is the default when the compiler
21557 is configured for 68060-based systems. It is equivalent to
21558 -march=68060.
21559
21560 This option inhibits the use of 68020 and 68881/68882 instructions
21561 that have to be emulated by software on the 68060. Use this option
21562 if your 68060 does not have code to emulate those instructions.
21563
21564 -mcpu32
21565 Generate output for a CPU32. This is the default when the compiler
21566 is configured for CPU32-based systems. It is equivalent to
21567 -march=cpu32.
21568
21569 Use this option for microcontrollers with a CPU32 or CPU32+ core,
21570 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
21571 68341, 68349 and 68360.
21572
21573 -m5200
21574 Generate output for a 520X ColdFire CPU. This is the default when
21575 the compiler is configured for 520X-based systems. It is
21576 equivalent to -mcpu=5206, and is now deprecated in favor of that
21577 option.
21578
21579 Use this option for microcontroller with a 5200 core, including the
21580 MCF5202, MCF5203, MCF5204 and MCF5206.
21581
21582 -m5206e
21583 Generate output for a 5206e ColdFire CPU. The option is now
21584 deprecated in favor of the equivalent -mcpu=5206e.
21585
21586 -m528x
21587 Generate output for a member of the ColdFire 528X family. The
21588 option is now deprecated in favor of the equivalent -mcpu=528x.
21589
21590 -m5307
21591 Generate output for a ColdFire 5307 CPU. The option is now
21592 deprecated in favor of the equivalent -mcpu=5307.
21593
21594 -m5407
21595 Generate output for a ColdFire 5407 CPU. The option is now
21596 deprecated in favor of the equivalent -mcpu=5407.
21597
21598 -mcfv4e
21599 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
21600 This includes use of hardware floating-point instructions. The
21601 option is equivalent to -mcpu=547x, and is now deprecated in favor
21602 of that option.
21603
21604 -m68020-40
21605 Generate output for a 68040, without using any of the new
21606 instructions. This results in code that can run relatively
21607 efficiently on either a 68020/68881 or a 68030 or a 68040. The
21608 generated code does use the 68881 instructions that are emulated on
21609 the 68040.
21610
21611 The option is equivalent to -march=68020 -mtune=68020-40.
21612
21613 -m68020-60
21614 Generate output for a 68060, without using any of the new
21615 instructions. This results in code that can run relatively
21616 efficiently on either a 68020/68881 or a 68030 or a 68040. The
21617 generated code does use the 68881 instructions that are emulated on
21618 the 68060.
21619
21620 The option is equivalent to -march=68020 -mtune=68020-60.
21621
21622 -mhard-float
21623 -m68881
21624 Generate floating-point instructions. This is the default for
21625 68020 and above, and for ColdFire devices that have an FPU. It
21626 defines the macro "__HAVE_68881__" on M680x0 targets and
21627 "__mcffpu__" on ColdFire targets.
21628
21629 -msoft-float
21630 Do not generate floating-point instructions; use library calls
21631 instead. This is the default for 68000, 68010, and 68832 targets.
21632 It is also the default for ColdFire devices that have no FPU.
21633
21634 -mdiv
21635 -mno-div
21636 Generate (do not generate) ColdFire hardware divide and remainder
21637 instructions. If -march is used without -mcpu, the default is "on"
21638 for ColdFire architectures and "off" for M680x0 architectures.
21639 Otherwise, the default is taken from the target CPU (either the
21640 default CPU, or the one specified by -mcpu). For example, the
21641 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
21642
21643 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
21644
21645 -mshort
21646 Consider type "int" to be 16 bits wide, like "short int".
21647 Additionally, parameters passed on the stack are also aligned to a
21648 16-bit boundary even on targets whose API mandates promotion to
21649 32-bit.
21650
21651 -mno-short
21652 Do not consider type "int" to be 16 bits wide. This is the
21653 default.
21654
21655 -mnobitfield
21656 -mno-bitfield
21657 Do not use the bit-field instructions. The -m68000, -mcpu32 and
21658 -m5200 options imply -mnobitfield.
21659
21660 -mbitfield
21661 Do use the bit-field instructions. The -m68020 option implies
21662 -mbitfield. This is the default if you use a configuration
21663 designed for a 68020.
21664
21665 -mrtd
21666 Use a different function-calling convention, in which functions
21667 that take a fixed number of arguments return with the "rtd"
21668 instruction, which pops their arguments while returning. This
21669 saves one instruction in the caller since there is no need to pop
21670 the arguments there.
21671
21672 This calling convention is incompatible with the one normally used
21673 on Unix, so you cannot use it if you need to call libraries
21674 compiled with the Unix compiler.
21675
21676 Also, you must provide function prototypes for all functions that
21677 take variable numbers of arguments (including "printf"); otherwise
21678 incorrect code is generated for calls to those functions.
21679
21680 In addition, seriously incorrect code results if you call a
21681 function with too many arguments. (Normally, extra arguments are
21682 harmlessly ignored.)
21683
21684 The "rtd" instruction is supported by the 68010, 68020, 68030,
21685 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21686
21687 The default is -mno-rtd.
21688
21689 -malign-int
21690 -mno-align-int
21691 Control whether GCC aligns "int", "long", "long long", "float",
21692 "double", and "long double" variables on a 32-bit boundary
21693 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
21694 variables on 32-bit boundaries produces code that runs somewhat
21695 faster on processors with 32-bit busses at the expense of more
21696 memory.
21697
21698 Warning: if you use the -malign-int switch, GCC aligns structures
21699 containing the above types differently than most published
21700 application binary interface specifications for the m68k.
21701
21702 Use the pc-relative addressing mode of the 68000 directly, instead
21703 of using a global offset table. At present, this option implies
21704 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
21705 -fPIC is not presently supported with -mpcrel, though this could be
21706 supported for 68020 and higher processors.
21707
21708 -mno-strict-align
21709 -mstrict-align
21710 Do not (do) assume that unaligned memory references are handled by
21711 the system.
21712
21713 -msep-data
21714 Generate code that allows the data segment to be located in a
21715 different area of memory from the text segment. This allows for
21716 execute-in-place in an environment without virtual memory
21717 management. This option implies -fPIC.
21718
21719 -mno-sep-data
21720 Generate code that assumes that the data segment follows the text
21721 segment. This is the default.
21722
21723 -mid-shared-library
21724 Generate code that supports shared libraries via the library ID
21725 method. This allows for execute-in-place and shared libraries in
21726 an environment without virtual memory management. This option
21727 implies -fPIC.
21728
21729 -mno-id-shared-library
21730 Generate code that doesn't assume ID-based shared libraries are
21731 being used. This is the default.
21732
21733 -mshared-library-id=n
21734 Specifies the identification number of the ID-based shared library
21735 being compiled. Specifying a value of 0 generates more compact
21736 code; specifying other values forces the allocation of that number
21737 to the current library, but is no more space- or time-efficient
21738 than omitting this option.
21739
21740 -mxgot
21741 -mno-xgot
21742 When generating position-independent code for ColdFire, generate
21743 code that works if the GOT has more than 8192 entries. This code
21744 is larger and slower than code generated without this option. On
21745 M680x0 processors, this option is not needed; -fPIC suffices.
21746
21747 GCC normally uses a single instruction to load values from the GOT.
21748 While this is relatively efficient, it only works if the GOT is
21749 smaller than about 64k. Anything larger causes the linker to
21750 report an error such as:
21751
21752 relocation truncated to fit: R_68K_GOT16O foobar
21753
21754 If this happens, you should recompile your code with -mxgot. It
21755 should then work with very large GOTs. However, code generated
21756 with -mxgot is less efficient, since it takes 4 instructions to
21757 fetch the value of a global symbol.
21758
21759 Note that some linkers, including newer versions of the GNU linker,
21760 can create multiple GOTs and sort GOT entries. If you have such a
21761 linker, you should only need to use -mxgot when compiling a single
21762 object file that accesses more than 8192 GOT entries. Very few do.
21763
21764 These options have no effect unless GCC is generating position-
21765 independent code.
21766
21767 -mlong-jump-table-offsets
21768 Use 32-bit offsets in "switch" tables. The default is to use
21769 16-bit offsets.
21770
21771 MCore Options
21772
21773 These are the -m options defined for the Motorola M*Core processors.
21774
21775 -mhardlit
21776 -mno-hardlit
21777 Inline constants into the code stream if it can be done in two
21778 instructions or less.
21779
21780 -mdiv
21781 -mno-div
21782 Use the divide instruction. (Enabled by default).
21783
21784 -mrelax-immediate
21785 -mno-relax-immediate
21786 Allow arbitrary-sized immediates in bit operations.
21787
21788 -mwide-bitfields
21789 -mno-wide-bitfields
21790 Always treat bit-fields as "int"-sized.
21791
21792 -m4byte-functions
21793 -mno-4byte-functions
21794 Force all functions to be aligned to a 4-byte boundary.
21795
21796 -mcallgraph-data
21797 -mno-callgraph-data
21798 Emit callgraph information.
21799
21800 -mslow-bytes
21801 -mno-slow-bytes
21802 Prefer word access when reading byte quantities.
21803
21804 -mlittle-endian
21805 -mbig-endian
21806 Generate code for a little-endian target.
21807
21808 -m210
21809 -m340
21810 Generate code for the 210 processor.
21811
21812 -mno-lsim
21813 Assume that runtime support has been provided and so omit the
21814 simulator library (libsim.a) from the linker command line.
21815
21816 -mstack-increment=size
21817 Set the maximum amount for a single stack increment operation.
21818 Large values can increase the speed of programs that contain
21819 functions that need a large amount of stack space, but they can
21820 also trigger a segmentation fault if the stack is extended too
21821 much. The default value is 0x1000.
21822
21823 MeP Options
21824
21825 -mabsdiff
21826 Enables the "abs" instruction, which is the absolute difference
21827 between two registers.
21828
21829 -mall-opts
21830 Enables all the optional instructions---average, multiply, divide,
21831 bit operations, leading zero, absolute difference, min/max, clip,
21832 and saturation.
21833
21834 -maverage
21835 Enables the "ave" instruction, which computes the average of two
21836 registers.
21837
21838 -mbased=n
21839 Variables of size n bytes or smaller are placed in the ".based"
21840 section by default. Based variables use the $tp register as a base
21841 register, and there is a 128-byte limit to the ".based" section.
21842
21843 -mbitops
21844 Enables the bit operation instructions---bit test ("btstm"), set
21845 ("bsetm"), clear ("bclrm"), invert ("bnotm"), and test-and-set
21846 ("tas").
21847
21848 -mc=name
21849 Selects which section constant data is placed in. name may be
21850 tiny, near, or far.
21851
21852 -mclip
21853 Enables the "clip" instruction. Note that -mclip is not useful
21854 unless you also provide -mminmax.
21855
21856 -mconfig=name
21857 Selects one of the built-in core configurations. Each MeP chip has
21858 one or more modules in it; each module has a core CPU and a variety
21859 of coprocessors, optional instructions, and peripherals. The
21860 "MeP-Integrator" tool, not part of GCC, provides these
21861 configurations through this option; using this option is the same
21862 as using all the corresponding command-line options. The default
21863 configuration is default.
21864
21865 -mcop
21866 Enables the coprocessor instructions. By default, this is a 32-bit
21867 coprocessor. Note that the coprocessor is normally enabled via the
21868 -mconfig= option.
21869
21870 -mcop32
21871 Enables the 32-bit coprocessor's instructions.
21872
21873 -mcop64
21874 Enables the 64-bit coprocessor's instructions.
21875
21876 -mivc2
21877 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21878
21879 -mdc
21880 Causes constant variables to be placed in the ".near" section.
21881
21882 -mdiv
21883 Enables the "div" and "divu" instructions.
21884
21885 -meb
21886 Generate big-endian code.
21887
21888 -mel
21889 Generate little-endian code.
21890
21891 -mio-volatile
21892 Tells the compiler that any variable marked with the "io" attribute
21893 is to be considered volatile.
21894
21895 -ml Causes variables to be assigned to the ".far" section by default.
21896
21897 -mleadz
21898 Enables the "leadz" (leading zero) instruction.
21899
21900 -mm Causes variables to be assigned to the ".near" section by default.
21901
21902 -mminmax
21903 Enables the "min" and "max" instructions.
21904
21905 -mmult
21906 Enables the multiplication and multiply-accumulate instructions.
21907
21908 -mno-opts
21909 Disables all the optional instructions enabled by -mall-opts.
21910
21911 -mrepeat
21912 Enables the "repeat" and "erepeat" instructions, used for low-
21913 overhead looping.
21914
21915 -ms Causes all variables to default to the ".tiny" section. Note that
21916 there is a 65536-byte limit to this section. Accesses to these
21917 variables use the %gp base register.
21918
21919 -msatur
21920 Enables the saturation instructions. Note that the compiler does
21921 not currently generate these itself, but this option is included
21922 for compatibility with other tools, like "as".
21923
21924 -msdram
21925 Link the SDRAM-based runtime instead of the default ROM-based
21926 runtime.
21927
21928 -msim
21929 Link the simulator run-time libraries.
21930
21931 -msimnovec
21932 Link the simulator runtime libraries, excluding built-in support
21933 for reset and exception vectors and tables.
21934
21935 -mtf
21936 Causes all functions to default to the ".far" section. Without
21937 this option, functions default to the ".near" section.
21938
21939 -mtiny=n
21940 Variables that are n bytes or smaller are allocated to the ".tiny"
21941 section. These variables use the $gp base register. The default
21942 for this option is 4, but note that there's a 65536-byte limit to
21943 the ".tiny" section.
21944
21945 MicroBlaze Options
21946
21947 -msoft-float
21948 Use software emulation for floating point (default).
21949
21950 -mhard-float
21951 Use hardware floating-point instructions.
21952
21953 -mmemcpy
21954 Do not optimize block moves, use "memcpy".
21955
21956 -mno-clearbss
21957 This option is deprecated. Use -fno-zero-initialized-in-bss
21958 instead.
21959
21960 -mcpu=cpu-type
21961 Use features of, and schedule code for, the given CPU. Supported
21962 values are in the format vX.YY.Z, where X is a major version, YY is
21963 the minor version, and Z is compatibility code. Example values are
21964 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
21965
21966 -mxl-soft-mul
21967 Use software multiply emulation (default).
21968
21969 -mxl-soft-div
21970 Use software emulation for divides (default).
21971
21972 -mxl-barrel-shift
21973 Use the hardware barrel shifter.
21974
21975 -mxl-pattern-compare
21976 Use pattern compare instructions.
21977
21978 -msmall-divides
21979 Use table lookup optimization for small signed integer divisions.
21980
21981 -mxl-stack-check
21982 This option is deprecated. Use -fstack-check instead.
21983
21984 -mxl-gp-opt
21985 Use GP-relative ".sdata"/".sbss" sections.
21986
21987 -mxl-multiply-high
21988 Use multiply high instructions for high part of 32x32 multiply.
21989
21990 -mxl-float-convert
21991 Use hardware floating-point conversion instructions.
21992
21993 -mxl-float-sqrt
21994 Use hardware floating-point square root instruction.
21995
21996 -mbig-endian
21997 Generate code for a big-endian target.
21998
21999 -mlittle-endian
22000 Generate code for a little-endian target.
22001
22002 -mxl-reorder
22003 Use reorder instructions (swap and byte reversed load/store).
22004
22005 -mxl-mode-app-model
22006 Select application model app-model. Valid models are
22007
22008 executable
22009 normal executable (default), uses startup code crt0.o.
22010
22011 xmdstub
22012 for use with Xilinx Microprocessor Debugger (XMD) based
22013 software intrusive debug agent called xmdstub. This uses
22014 startup file crt1.o and sets the start address of the program
22015 to 0x800.
22016
22017 bootstrap
22018 for applications that are loaded using a bootloader. This
22019 model uses startup file crt2.o which does not contain a
22020 processor reset vector handler. This is suitable for
22021 transferring control on a processor reset to the bootloader
22022 rather than the application.
22023
22024 novectors
22025 for applications that do not require any of the MicroBlaze
22026 vectors. This option may be useful for applications running
22027 within a monitoring application. This model uses crt3.o as a
22028 startup file.
22029
22030 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
22031 model.
22032
22033 -mpic-data-is-text-relative
22034 Assume that the displacement between the text and data segments is
22035 fixed at static link time. This allows data to be referenced by
22036 offset from start of text address instead of GOT since PC-relative
22037 addressing is not supported.
22038
22039 MIPS Options
22040
22041 -EB Generate big-endian code.
22042
22043 -EL Generate little-endian code. This is the default for mips*el-*-*
22044 configurations.
22045
22046 -march=arch
22047 Generate code that runs on arch, which can be the name of a generic
22048 MIPS ISA, or the name of a particular processor. The ISA names
22049 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
22050 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
22051 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
22052 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
22053 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
22054 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
22055 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
22056 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
22057 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
22058 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
22059 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
22060 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
22061 and xlp. The special value from-abi selects the most compatible
22062 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
22063 and mips3 for 64-bit ABIs).
22064
22065 The native Linux/GNU toolchain also supports the value native,
22066 which selects the best architecture option for the host processor.
22067 -march=native has no effect if GCC does not recognize the
22068 processor.
22069
22070 In processor names, a final 000 can be abbreviated as k (for
22071 example, -march=r2k). Prefixes are optional, and vr may be written
22072 r.
22073
22074 Names of the form nf2_1 refer to processors with FPUs clocked at
22075 half the rate of the core, names of the form nf1_1 refer to
22076 processors with FPUs clocked at the same rate as the core, and
22077 names of the form nf3_2 refer to processors with FPUs clocked a
22078 ratio of 3:2 with respect to the core. For compatibility reasons,
22079 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
22080 as synonyms for nf1_1.
22081
22082 GCC defines two macros based on the value of this option. The
22083 first is "_MIPS_ARCH", which gives the name of target architecture,
22084 as a string. The second has the form "_MIPS_ARCH_foo", where foo
22085 is the capitalized value of "_MIPS_ARCH". For example,
22086 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
22087 "_MIPS_ARCH_R2000".
22088
22089 Note that the "_MIPS_ARCH" macro uses the processor names given
22090 above. In other words, it has the full prefix and does not
22091 abbreviate 000 as k. In the case of from-abi, the macro names the
22092 resolved architecture (either "mips1" or "mips3"). It names the
22093 default architecture when no -march option is given.
22094
22095 -mtune=arch
22096 Optimize for arch. Among other things, this option controls the
22097 way instructions are scheduled, and the perceived cost of
22098 arithmetic operations. The list of arch values is the same as for
22099 -march.
22100
22101 When this option is not used, GCC optimizes for the processor
22102 specified by -march. By using -march and -mtune together, it is
22103 possible to generate code that runs on a family of processors, but
22104 optimize the code for one particular member of that family.
22105
22106 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
22107 work in the same way as the -march ones described above.
22108
22109 -mips1
22110 Equivalent to -march=mips1.
22111
22112 -mips2
22113 Equivalent to -march=mips2.
22114
22115 -mips3
22116 Equivalent to -march=mips3.
22117
22118 -mips4
22119 Equivalent to -march=mips4.
22120
22121 -mips32
22122 Equivalent to -march=mips32.
22123
22124 -mips32r3
22125 Equivalent to -march=mips32r3.
22126
22127 -mips32r5
22128 Equivalent to -march=mips32r5.
22129
22130 -mips32r6
22131 Equivalent to -march=mips32r6.
22132
22133 -mips64
22134 Equivalent to -march=mips64.
22135
22136 -mips64r2
22137 Equivalent to -march=mips64r2.
22138
22139 -mips64r3
22140 Equivalent to -march=mips64r3.
22141
22142 -mips64r5
22143 Equivalent to -march=mips64r5.
22144
22145 -mips64r6
22146 Equivalent to -march=mips64r6.
22147
22148 -mips16
22149 -mno-mips16
22150 Generate (do not generate) MIPS16 code. If GCC is targeting a
22151 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
22152
22153 MIPS16 code generation can also be controlled on a per-function
22154 basis by means of "mips16" and "nomips16" attributes.
22155
22156 -mflip-mips16
22157 Generate MIPS16 code on alternating functions. This option is
22158 provided for regression testing of mixed MIPS16/non-MIPS16 code
22159 generation, and is not intended for ordinary use in compiling user
22160 code.
22161
22162 -minterlink-compressed
22163 -mno-interlink-compressed
22164 Require (do not require) that code using the standard
22165 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
22166 microMIPS code, and vice versa.
22167
22168 For example, code using the standard ISA encoding cannot jump
22169 directly to MIPS16 or microMIPS code; it must either use a call or
22170 an indirect jump. -minterlink-compressed therefore disables direct
22171 jumps unless GCC knows that the target of the jump is not
22172 compressed.
22173
22174 -minterlink-mips16
22175 -mno-interlink-mips16
22176 Aliases of -minterlink-compressed and -mno-interlink-compressed.
22177 These options predate the microMIPS ASE and are retained for
22178 backwards compatibility.
22179
22180 -mabi=32
22181 -mabi=o64
22182 -mabi=n32
22183 -mabi=64
22184 -mabi=eabi
22185 Generate code for the given ABI.
22186
22187 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
22188 generates 64-bit code when you select a 64-bit architecture, but
22189 you can use -mgp32 to get 32-bit code instead.
22190
22191 For information about the O64 ABI, see
22192 <https://gcc.gnu.org/projects/mipso64-abi.html>.
22193
22194 GCC supports a variant of the o32 ABI in which floating-point
22195 registers are 64 rather than 32 bits wide. You can select this
22196 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
22197 and "mfhc1" instructions and is therefore only supported for
22198 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
22199
22200 The register assignments for arguments and return values remain the
22201 same, but each scalar value is passed in a single 64-bit register
22202 rather than a pair of 32-bit registers. For example, scalar
22203 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
22204 The set of call-saved registers also remains the same in that the
22205 even-numbered double-precision registers are saved.
22206
22207 Two additional variants of the o32 ABI are supported to enable a
22208 transition from 32-bit to 64-bit registers. These are FPXX
22209 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
22210 mandates that all code must execute correctly when run using 32-bit
22211 or 64-bit registers. The code can be interlinked with either FP32
22212 or FP64, but not both. The FP64A extension is similar to the FP64
22213 extension but forbids the use of odd-numbered single-precision
22214 registers. This can be used in conjunction with the "FRE" mode of
22215 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
22216 interlink and run in the same process without changing FPU modes.
22217
22218 -mabicalls
22219 -mno-abicalls
22220 Generate (do not generate) code that is suitable for SVR4-style
22221 dynamic objects. -mabicalls is the default for SVR4-based systems.
22222
22223 -mshared
22224 -mno-shared
22225 Generate (do not generate) code that is fully position-independent,
22226 and that can therefore be linked into shared libraries. This
22227 option only affects -mabicalls.
22228
22229 All -mabicalls code has traditionally been position-independent,
22230 regardless of options like -fPIC and -fpic. However, as an
22231 extension, the GNU toolchain allows executables to use absolute
22232 accesses for locally-binding symbols. It can also use shorter GP
22233 initialization sequences and generate direct calls to locally-
22234 defined functions. This mode is selected by -mno-shared.
22235
22236 -mno-shared depends on binutils 2.16 or higher and generates
22237 objects that can only be linked by the GNU linker. However, the
22238 option does not affect the ABI of the final executable; it only
22239 affects the ABI of relocatable objects. Using -mno-shared
22240 generally makes executables both smaller and quicker.
22241
22242 -mshared is the default.
22243
22244 -mplt
22245 -mno-plt
22246 Assume (do not assume) that the static and dynamic linkers support
22247 PLTs and copy relocations. This option only affects -mno-shared
22248 -mabicalls. For the n64 ABI, this option has no effect without
22249 -msym32.
22250
22251 You can make -mplt the default by configuring GCC with
22252 --with-mips-plt. The default is -mno-plt otherwise.
22253
22254 -mxgot
22255 -mno-xgot
22256 Lift (do not lift) the usual restrictions on the size of the global
22257 offset table.
22258
22259 GCC normally uses a single instruction to load values from the GOT.
22260 While this is relatively efficient, it only works if the GOT is
22261 smaller than about 64k. Anything larger causes the linker to
22262 report an error such as:
22263
22264 relocation truncated to fit: R_MIPS_GOT16 foobar
22265
22266 If this happens, you should recompile your code with -mxgot. This
22267 works with very large GOTs, although the code is also less
22268 efficient, since it takes three instructions to fetch the value of
22269 a global symbol.
22270
22271 Note that some linkers can create multiple GOTs. If you have such
22272 a linker, you should only need to use -mxgot when a single object
22273 file accesses more than 64k's worth of GOT entries. Very few do.
22274
22275 These options have no effect unless GCC is generating position
22276 independent code.
22277
22278 -mgp32
22279 Assume that general-purpose registers are 32 bits wide.
22280
22281 -mgp64
22282 Assume that general-purpose registers are 64 bits wide.
22283
22284 -mfp32
22285 Assume that floating-point registers are 32 bits wide.
22286
22287 -mfp64
22288 Assume that floating-point registers are 64 bits wide.
22289
22290 -mfpxx
22291 Do not assume the width of floating-point registers.
22292
22293 -mhard-float
22294 Use floating-point coprocessor instructions.
22295
22296 -msoft-float
22297 Do not use floating-point coprocessor instructions. Implement
22298 floating-point calculations using library calls instead.
22299
22300 -mno-float
22301 Equivalent to -msoft-float, but additionally asserts that the
22302 program being compiled does not perform any floating-point
22303 operations. This option is presently supported only by some bare-
22304 metal MIPS configurations, where it may select a special set of
22305 libraries that lack all floating-point support (including, for
22306 example, the floating-point "printf" formats). If code compiled
22307 with -mno-float accidentally contains floating-point operations, it
22308 is likely to suffer a link-time or run-time failure.
22309
22310 -msingle-float
22311 Assume that the floating-point coprocessor only supports single-
22312 precision operations.
22313
22314 -mdouble-float
22315 Assume that the floating-point coprocessor supports double-
22316 precision operations. This is the default.
22317
22318 -modd-spreg
22319 -mno-odd-spreg
22320 Enable the use of odd-numbered single-precision floating-point
22321 registers for the o32 ABI. This is the default for processors that
22322 are known to support these registers. When using the o32 FPXX ABI,
22323 -mno-odd-spreg is set by default.
22324
22325 -mabs=2008
22326 -mabs=legacy
22327 These options control the treatment of the special not-a-number
22328 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
22329 machine instructions.
22330
22331 By default or when -mabs=legacy is used the legacy treatment is
22332 selected. In this case these instructions are considered
22333 arithmetic and avoided where correct operation is required and the
22334 input operand might be a NaN. A longer sequence of instructions
22335 that manipulate the sign bit of floating-point datum manually is
22336 used instead unless the -ffinite-math-only option has also been
22337 specified.
22338
22339 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
22340 case these instructions are considered non-arithmetic and therefore
22341 operating correctly in all cases, including in particular where the
22342 input operand is a NaN. These instructions are therefore always
22343 used for the respective operations.
22344
22345 -mnan=2008
22346 -mnan=legacy
22347 These options control the encoding of the special not-a-number
22348 (NaN) IEEE 754 floating-point data.
22349
22350 The -mnan=legacy option selects the legacy encoding. In this case
22351 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22352 significand field being 0, whereas signaling NaNs (sNaNs) are
22353 denoted by the first bit of their trailing significand field being
22354 1.
22355
22356 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
22357 case qNaNs are denoted by the first bit of their trailing
22358 significand field being 1, whereas sNaNs are denoted by the first
22359 bit of their trailing significand field being 0.
22360
22361 The default is -mnan=legacy unless GCC has been configured with
22362 --with-nan=2008.
22363
22364 -mllsc
22365 -mno-llsc
22366 Use (do not use) ll, sc, and sync instructions to implement atomic
22367 memory built-in functions. When neither option is specified, GCC
22368 uses the instructions if the target architecture supports them.
22369
22370 -mllsc is useful if the runtime environment can emulate the
22371 instructions and -mno-llsc can be useful when compiling for
22372 nonstandard ISAs. You can make either option the default by
22373 configuring GCC with --with-llsc and --without-llsc respectively.
22374 --with-llsc is the default for some configurations; see the
22375 installation documentation for details.
22376
22377 -mdsp
22378 -mno-dsp
22379 Use (do not use) revision 1 of the MIPS DSP ASE.
22380 This option defines the preprocessor macro "__mips_dsp". It also
22381 defines "__mips_dsp_rev" to 1.
22382
22383 -mdspr2
22384 -mno-dspr2
22385 Use (do not use) revision 2 of the MIPS DSP ASE.
22386 This option defines the preprocessor macros "__mips_dsp" and
22387 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
22388
22389 -msmartmips
22390 -mno-smartmips
22391 Use (do not use) the MIPS SmartMIPS ASE.
22392
22393 -mpaired-single
22394 -mno-paired-single
22395 Use (do not use) paired-single floating-point instructions.
22396 This option requires hardware floating-point support to be
22397 enabled.
22398
22399 -mdmx
22400 -mno-mdmx
22401 Use (do not use) MIPS Digital Media Extension instructions. This
22402 option can only be used when generating 64-bit code and requires
22403 hardware floating-point support to be enabled.
22404
22405 -mips3d
22406 -mno-mips3d
22407 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
22408 -mpaired-single.
22409
22410 -mmicromips
22411 -mno-micromips
22412 Generate (do not generate) microMIPS code.
22413
22414 MicroMIPS code generation can also be controlled on a per-function
22415 basis by means of "micromips" and "nomicromips" attributes.
22416
22417 -mmt
22418 -mno-mt
22419 Use (do not use) MT Multithreading instructions.
22420
22421 -mmcu
22422 -mno-mcu
22423 Use (do not use) the MIPS MCU ASE instructions.
22424
22425 -meva
22426 -mno-eva
22427 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22428
22429 -mvirt
22430 -mno-virt
22431 Use (do not use) the MIPS Virtualization (VZ) instructions.
22432
22433 -mxpa
22434 -mno-xpa
22435 Use (do not use) the MIPS eXtended Physical Address (XPA)
22436 instructions.
22437
22438 -mcrc
22439 -mno-crc
22440 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
22441 instructions.
22442
22443 -mginv
22444 -mno-ginv
22445 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22446
22447 -mloongson-mmi
22448 -mno-loongson-mmi
22449 Use (do not use) the MIPS Loongson MultiMedia extensions
22450 Instructions (MMI).
22451
22452 -mloongson-ext
22453 -mno-loongson-ext
22454 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22455
22456 -mloongson-ext2
22457 -mno-loongson-ext2
22458 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
22459 instructions.
22460
22461 -mlong64
22462 Force "long" types to be 64 bits wide. See -mlong32 for an
22463 explanation of the default and the way that the pointer size is
22464 determined.
22465
22466 -mlong32
22467 Force "long", "int", and pointer types to be 32 bits wide.
22468
22469 The default size of "int"s, "long"s and pointers depends on the
22470 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
22471 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
22472 "long"s. Pointers are the same size as "long"s, or the same size
22473 as integer registers, whichever is smaller.
22474
22475 -msym32
22476 -mno-sym32
22477 Assume (do not assume) that all symbols have 32-bit values,
22478 regardless of the selected ABI. This option is useful in
22479 combination with -mabi=64 and -mno-abicalls because it allows GCC
22480 to generate shorter and faster references to symbolic addresses.
22481
22482 -G num
22483 Put definitions of externally-visible data in a small data section
22484 if that data is no bigger than num bytes. GCC can then generate
22485 more efficient accesses to the data; see -mgpopt for details.
22486
22487 The default -G option depends on the configuration.
22488
22489 -mlocal-sdata
22490 -mno-local-sdata
22491 Extend (do not extend) the -G behavior to local data too, such as
22492 to static variables in C. -mlocal-sdata is the default for all
22493 configurations.
22494
22495 If the linker complains that an application is using too much small
22496 data, you might want to try rebuilding the less performance-
22497 critical parts with -mno-local-sdata. You might also want to build
22498 large libraries with -mno-local-sdata, so that the libraries leave
22499 more room for the main program.
22500
22501 -mextern-sdata
22502 -mno-extern-sdata
22503 Assume (do not assume) that externally-defined data is in a small
22504 data section if the size of that data is within the -G limit.
22505 -mextern-sdata is the default for all configurations.
22506
22507 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
22508 Mod references a variable Var that is no bigger than num bytes, you
22509 must make sure that Var is placed in a small data section. If Var
22510 is defined by another module, you must either compile that module
22511 with a high-enough -G setting or attach a "section" attribute to
22512 Var's definition. If Var is common, you must link the application
22513 with a high-enough -G setting.
22514
22515 The easiest way of satisfying these restrictions is to compile and
22516 link every module with the same -G option. However, you may wish
22517 to build a library that supports several different small data
22518 limits. You can do this by compiling the library with the highest
22519 supported -G setting and additionally using -mno-extern-sdata to
22520 stop the library from making assumptions about externally-defined
22521 data.
22522
22523 -mgpopt
22524 -mno-gpopt
22525 Use (do not use) GP-relative accesses for symbols that are known to
22526 be in a small data section; see -G, -mlocal-sdata and
22527 -mextern-sdata. -mgpopt is the default for all configurations.
22528
22529 -mno-gpopt is useful for cases where the $gp register might not
22530 hold the value of "_gp". For example, if the code is part of a
22531 library that might be used in a boot monitor, programs that call
22532 boot monitor routines pass an unknown value in $gp. (In such
22533 situations, the boot monitor itself is usually compiled with -G0.)
22534
22535 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
22536
22537 -membedded-data
22538 -mno-embedded-data
22539 Allocate variables to the read-only data section first if possible,
22540 then next in the small data section if possible, otherwise in data.
22541 This gives slightly slower code than the default, but reduces the
22542 amount of RAM required when executing, and thus may be preferred
22543 for some embedded systems.
22544
22545 -muninit-const-in-rodata
22546 -mno-uninit-const-in-rodata
22547 Put uninitialized "const" variables in the read-only data section.
22548 This option is only meaningful in conjunction with -membedded-data.
22549
22550 -mcode-readable=setting
22551 Specify whether GCC may generate code that reads from executable
22552 sections. There are three possible settings:
22553
22554 -mcode-readable=yes
22555 Instructions may freely access executable sections. This is
22556 the default setting.
22557
22558 -mcode-readable=pcrel
22559 MIPS16 PC-relative load instructions can access executable
22560 sections, but other instructions must not do so. This option
22561 is useful on 4KSc and 4KSd processors when the code TLBs have
22562 the Read Inhibit bit set. It is also useful on processors that
22563 can be configured to have a dual instruction/data SRAM
22564 interface and that, like the M4K, automatically redirect PC-
22565 relative loads to the instruction RAM.
22566
22567 -mcode-readable=no
22568 Instructions must not access executable sections. This option
22569 can be useful on targets that are configured to have a dual
22570 instruction/data SRAM interface but that (unlike the M4K) do
22571 not automatically redirect PC-relative loads to the instruction
22572 RAM.
22573
22574 -msplit-addresses
22575 -mno-split-addresses
22576 Enable (disable) use of the "%hi()" and "%lo()" assembler
22577 relocation operators. This option has been superseded by
22578 -mexplicit-relocs but is retained for backwards compatibility.
22579
22580 -mexplicit-relocs
22581 -mno-explicit-relocs
22582 Use (do not use) assembler relocation operators when dealing with
22583 symbolic addresses. The alternative, selected by
22584 -mno-explicit-relocs, is to use assembler macros instead.
22585
22586 -mexplicit-relocs is the default if GCC was configured to use an
22587 assembler that supports relocation operators.
22588
22589 -mcheck-zero-division
22590 -mno-check-zero-division
22591 Trap (do not trap) on integer division by zero.
22592
22593 The default is -mcheck-zero-division.
22594
22595 -mdivide-traps
22596 -mdivide-breaks
22597 MIPS systems check for division by zero by generating either a
22598 conditional trap or a break instruction. Using traps results in
22599 smaller code, but is only supported on MIPS II and later. Also,
22600 some versions of the Linux kernel have a bug that prevents trap
22601 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
22602 to allow conditional traps on architectures that support them and
22603 -mdivide-breaks to force the use of breaks.
22604
22605 The default is usually -mdivide-traps, but this can be overridden
22606 at configure time using --with-divide=breaks. Divide-by-zero
22607 checks can be completely disabled using -mno-check-zero-division.
22608
22609 -mload-store-pairs
22610 -mno-load-store-pairs
22611 Enable (disable) an optimization that pairs consecutive load or
22612 store instructions to enable load/store bonding. This option is
22613 enabled by default but only takes effect when the selected
22614 architecture is known to support bonding.
22615
22616 -munaligned-access
22617 -mno-unaligned-access
22618 Enable (disable) direct unaligned access for MIPS Release 6.
22619 MIPSr6 requires load/store unaligned-access support, by hardware or
22620 trap&emulate. So -mno-unaligned-access may be needed by kernel.
22621
22622 -mmemcpy
22623 -mno-memcpy
22624 Force (do not force) the use of "memcpy" for non-trivial block
22625 moves. The default is -mno-memcpy, which allows GCC to inline most
22626 constant-sized copies.
22627
22628 -mlong-calls
22629 -mno-long-calls
22630 Disable (do not disable) use of the "jal" instruction. Calling
22631 functions using "jal" is more efficient but requires the caller and
22632 callee to be in the same 256 megabyte segment.
22633
22634 This option has no effect on abicalls code. The default is
22635 -mno-long-calls.
22636
22637 -mmad
22638 -mno-mad
22639 Enable (disable) use of the "mad", "madu" and "mul" instructions,
22640 as provided by the R4650 ISA.
22641
22642 -mimadd
22643 -mno-imadd
22644 Enable (disable) use of the "madd" and "msub" integer instructions.
22645 The default is -mimadd on architectures that support "madd" and
22646 "msub" except for the 74k architecture where it was found to
22647 generate slower code.
22648
22649 -mfused-madd
22650 -mno-fused-madd
22651 Enable (disable) use of the floating-point multiply-accumulate
22652 instructions, when they are available. The default is
22653 -mfused-madd.
22654
22655 On the R8000 CPU when multiply-accumulate instructions are used,
22656 the intermediate product is calculated to infinite precision and is
22657 not subject to the FCSR Flush to Zero bit. This may be undesirable
22658 in some circumstances. On other processors the result is
22659 numerically identical to the equivalent computation using separate
22660 multiply, add, subtract and negate instructions.
22661
22662 -nocpp
22663 Tell the MIPS assembler to not run its preprocessor over user
22664 assembler files (with a .s suffix) when assembling them.
22665
22666 -mfix-24k
22667 -mno-fix-24k
22668 Work around the 24K E48 (lost data on stores during refill) errata.
22669 The workarounds are implemented by the assembler rather than by
22670 GCC.
22671
22672 -mfix-r4000
22673 -mno-fix-r4000
22674 Work around certain R4000 CPU errata:
22675
22676 - A double-word or a variable shift may give an incorrect result
22677 if executed immediately after starting an integer division.
22678
22679 - A double-word or a variable shift may give an incorrect result
22680 if executed while an integer multiplication is in progress.
22681
22682 - An integer division may give an incorrect result if started in
22683 a delay slot of a taken branch or a jump.
22684
22685 -mfix-r4400
22686 -mno-fix-r4400
22687 Work around certain R4400 CPU errata:
22688
22689 - A double-word or a variable shift may give an incorrect result
22690 if executed immediately after starting an integer division.
22691
22692 -mfix-r10000
22693 -mno-fix-r10000
22694 Work around certain R10000 errata:
22695
22696 - "ll"/"sc" sequences may not behave atomically on revisions
22697 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22698
22699 This option can only be used if the target architecture supports
22700 branch-likely instructions. -mfix-r10000 is the default when
22701 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
22702
22703 -mfix-r5900
22704 -mno-fix-r5900
22705 Do not attempt to schedule the preceding instruction into the delay
22706 slot of a branch instruction placed at the end of a short loop of
22707 six instructions or fewer and always schedule a "nop" instruction
22708 there instead. The short loop bug under certain conditions causes
22709 loops to execute only once or twice, due to a hardware bug in the
22710 R5900 chip. The workaround is implemented by the assembler rather
22711 than by GCC.
22712
22713 -mfix-rm7000
22714 -mno-fix-rm7000
22715 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
22716 are implemented by the assembler rather than by GCC.
22717
22718 -mfix-vr4120
22719 -mno-fix-vr4120
22720 Work around certain VR4120 errata:
22721
22722 - "dmultu" does not always produce the correct result.
22723
22724 - "div" and "ddiv" do not always produce the correct result if
22725 one of the operands is negative.
22726
22727 The workarounds for the division errata rely on special functions
22728 in libgcc.a. At present, these functions are only provided by the
22729 "mips64vr*-elf" configurations.
22730
22731 Other VR4120 errata require a NOP to be inserted between certain
22732 pairs of instructions. These errata are handled by the assembler,
22733 not by GCC itself.
22734
22735 -mfix-vr4130
22736 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
22737 implemented by the assembler rather than by GCC, although GCC
22738 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
22739 "dmacc" and "dmacchi" instructions are available instead.
22740
22741 -mfix-sb1
22742 -mno-fix-sb1
22743 Work around certain SB-1 CPU core errata. (This flag currently
22744 works around the SB-1 revision 2 "F1" and "F2" floating-point
22745 errata.)
22746
22747 -mr10k-cache-barrier=setting
22748 Specify whether GCC should insert cache barriers to avoid the side
22749 effects of speculation on R10K processors.
22750
22751 In common with many processors, the R10K tries to predict the
22752 outcome of a conditional branch and speculatively executes
22753 instructions from the "taken" branch. It later aborts these
22754 instructions if the predicted outcome is wrong. However, on the
22755 R10K, even aborted instructions can have side effects.
22756
22757 This problem only affects kernel stores and, depending on the
22758 system, kernel loads. As an example, a speculatively-executed
22759 store may load the target memory into cache and mark the cache line
22760 as dirty, even if the store itself is later aborted. If a DMA
22761 operation writes to the same area of memory before the "dirty" line
22762 is flushed, the cached data overwrites the DMA-ed data. See the
22763 R10K processor manual for a full description, including other
22764 potential problems.
22765
22766 One workaround is to insert cache barrier instructions before every
22767 memory access that might be speculatively executed and that might
22768 have side effects even if aborted. -mr10k-cache-barrier=setting
22769 controls GCC's implementation of this workaround. It assumes that
22770 aborted accesses to any byte in the following regions does not have
22771 side effects:
22772
22773 1. the memory occupied by the current function's stack frame;
22774
22775 2. the memory occupied by an incoming stack argument;
22776
22777 3. the memory occupied by an object with a link-time-constant
22778 address.
22779
22780 It is the kernel's responsibility to ensure that speculative
22781 accesses to these regions are indeed safe.
22782
22783 If the input program contains a function declaration such as:
22784
22785 void foo (void);
22786
22787 then the implementation of "foo" must allow "j foo" and "jal foo"
22788 to be executed speculatively. GCC honors this restriction for
22789 functions it compiles itself. It expects non-GCC functions (such
22790 as hand-written assembly code) to do the same.
22791
22792 The option has three forms:
22793
22794 -mr10k-cache-barrier=load-store
22795 Insert a cache barrier before a load or store that might be
22796 speculatively executed and that might have side effects even if
22797 aborted.
22798
22799 -mr10k-cache-barrier=store
22800 Insert a cache barrier before a store that might be
22801 speculatively executed and that might have side effects even if
22802 aborted.
22803
22804 -mr10k-cache-barrier=none
22805 Disable the insertion of cache barriers. This is the default
22806 setting.
22807
22808 -mflush-func=func
22809 -mno-flush-func
22810 Specifies the function to call to flush the I and D caches, or to
22811 not call any such function. If called, the function must take the
22812 same arguments as the common "_flush_func", that is, the address of
22813 the memory range for which the cache is being flushed, the size of
22814 the memory range, and the number 3 (to flush both caches). The
22815 default depends on the target GCC was configured for, but commonly
22816 is either "_flush_func" or "__cpu_flush".
22817
22818 mbranch-cost=num
22819 Set the cost of branches to roughly num "simple" instructions.
22820 This cost is only a heuristic and is not guaranteed to produce
22821 consistent results across releases. A zero cost redundantly
22822 selects the default, which is based on the -mtune setting.
22823
22824 -mbranch-likely
22825 -mno-branch-likely
22826 Enable or disable use of Branch Likely instructions, regardless of
22827 the default for the selected architecture. By default, Branch
22828 Likely instructions may be generated if they are supported by the
22829 selected architecture. An exception is for the MIPS32 and MIPS64
22830 architectures and processors that implement those architectures;
22831 for those, Branch Likely instructions are not be generated by
22832 default because the MIPS32 and MIPS64 architectures specifically
22833 deprecate their use.
22834
22835 -mcompact-branches=never
22836 -mcompact-branches=optimal
22837 -mcompact-branches=always
22838 These options control which form of branches will be generated.
22839 The default is -mcompact-branches=optimal.
22840
22841 The -mcompact-branches=never option ensures that compact branch
22842 instructions will never be generated.
22843
22844 The -mcompact-branches=always option ensures that a compact branch
22845 instruction will be generated if available. If a compact branch
22846 instruction is not available, a delay slot form of the branch will
22847 be used instead.
22848
22849 This option is supported from MIPS Release 6 onwards.
22850
22851 The -mcompact-branches=optimal option will cause a delay slot
22852 branch to be used if one is available in the current ISA and the
22853 delay slot is successfully filled. If the delay slot is not
22854 filled, a compact branch will be chosen if one is available.
22855
22856 -mfp-exceptions
22857 -mno-fp-exceptions
22858 Specifies whether FP exceptions are enabled. This affects how FP
22859 instructions are scheduled for some processors. The default is
22860 that FP exceptions are enabled.
22861
22862 For instance, on the SB-1, if FP exceptions are disabled, and we
22863 are emitting 64-bit code, then we can use both FP pipes.
22864 Otherwise, we can only use one FP pipe.
22865
22866 -mvr4130-align
22867 -mno-vr4130-align
22868 The VR4130 pipeline is two-way superscalar, but can only issue two
22869 instructions together if the first one is 8-byte aligned. When
22870 this option is enabled, GCC aligns pairs of instructions that it
22871 thinks should execute in parallel.
22872
22873 This option only has an effect when optimizing for the VR4130. It
22874 normally makes code faster, but at the expense of making it bigger.
22875 It is enabled by default at optimization level -O3.
22876
22877 -msynci
22878 -mno-synci
22879 Enable (disable) generation of "synci" instructions on
22880 architectures that support it. The "synci" instructions (if
22881 enabled) are generated when "__builtin___clear_cache" is compiled.
22882
22883 This option defaults to -mno-synci, but the default can be
22884 overridden by configuring GCC with --with-synci.
22885
22886 When compiling code for single processor systems, it is generally
22887 safe to use "synci". However, on many multi-core (SMP) systems, it
22888 does not invalidate the instruction caches on all cores and may
22889 lead to undefined behavior.
22890
22891 -mrelax-pic-calls
22892 -mno-relax-pic-calls
22893 Try to turn PIC calls that are normally dispatched via register $25
22894 into direct calls. This is only possible if the linker can resolve
22895 the destination at link time and if the destination is within range
22896 for a direct call.
22897
22898 -mrelax-pic-calls is the default if GCC was configured to use an
22899 assembler and a linker that support the ".reloc" assembly directive
22900 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
22901 this optimization can be performed by the assembler and the linker
22902 alone without help from the compiler.
22903
22904 -mmcount-ra-address
22905 -mno-mcount-ra-address
22906 Emit (do not emit) code that allows "_mcount" to modify the calling
22907 function's return address. When enabled, this option extends the
22908 usual "_mcount" interface with a new ra-address parameter, which
22909 has type "intptr_t *" and is passed in register $12. "_mcount" can
22910 then modify the return address by doing both of the following:
22911
22912 * Returning the new address in register $31.
22913
22914 * Storing the new address in "*ra-address", if ra-address is
22915 nonnull.
22916
22917 The default is -mno-mcount-ra-address.
22918
22919 -mframe-header-opt
22920 -mno-frame-header-opt
22921 Enable (disable) frame header optimization in the o32 ABI. When
22922 using the o32 ABI, calling functions will allocate 16 bytes on the
22923 stack for the called function to write out register arguments.
22924 When enabled, this optimization will suppress the allocation of the
22925 frame header if it can be determined that it is unused.
22926
22927 This optimization is off by default at all optimization levels.
22928
22929 -mlxc1-sxc1
22930 -mno-lxc1-sxc1
22931 When applicable, enable (disable) the generation of "lwxc1",
22932 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
22933
22934 -mmadd4
22935 -mno-madd4
22936 When applicable, enable (disable) the generation of 4-operand
22937 "madd.s", "madd.d" and related instructions. Enabled by default.
22938
22939 MMIX Options
22940
22941 These options are defined for the MMIX:
22942
22943 -mlibfuncs
22944 -mno-libfuncs
22945 Specify that intrinsic library functions are being compiled,
22946 passing all values in registers, no matter the size.
22947
22948 -mepsilon
22949 -mno-epsilon
22950 Generate floating-point comparison instructions that compare with
22951 respect to the "rE" epsilon register.
22952
22953 -mabi=mmixware
22954 -mabi=gnu
22955 Generate code that passes function parameters and return values
22956 that (in the called function) are seen as registers $0 and up, as
22957 opposed to the GNU ABI which uses global registers $231 and up.
22958
22959 -mzero-extend
22960 -mno-zero-extend
22961 When reading data from memory in sizes shorter than 64 bits, use
22962 (do not use) zero-extending load instructions by default, rather
22963 than sign-extending ones.
22964
22965 -mknuthdiv
22966 -mno-knuthdiv
22967 Make the result of a division yielding a remainder have the same
22968 sign as the divisor. With the default, -mno-knuthdiv, the sign of
22969 the remainder follows the sign of the dividend. Both methods are
22970 arithmetically valid, the latter being almost exclusively used.
22971
22972 -mtoplevel-symbols
22973 -mno-toplevel-symbols
22974 Prepend (do not prepend) a : to all global symbols, so the assembly
22975 code can be used with the "PREFIX" assembly directive.
22976
22977 -melf
22978 Generate an executable in the ELF format, rather than the default
22979 mmo format used by the mmix simulator.
22980
22981 -mbranch-predict
22982 -mno-branch-predict
22983 Use (do not use) the probable-branch instructions, when static
22984 branch prediction indicates a probable branch.
22985
22986 -mbase-addresses
22987 -mno-base-addresses
22988 Generate (do not generate) code that uses base addresses. Using a
22989 base address automatically generates a request (handled by the
22990 assembler and the linker) for a constant to be set up in a global
22991 register. The register is used for one or more base address
22992 requests within the range 0 to 255 from the value held in the
22993 register. The generally leads to short and fast code, but the
22994 number of different data items that can be addressed is limited.
22995 This means that a program that uses lots of static data may require
22996 -mno-base-addresses.
22997
22998 -msingle-exit
22999 -mno-single-exit
23000 Force (do not force) generated code to have a single exit point in
23001 each function.
23002
23003 MN10300 Options
23004
23005 These -m options are defined for Matsushita MN10300 architectures:
23006
23007 -mmult-bug
23008 Generate code to avoid bugs in the multiply instructions for the
23009 MN10300 processors. This is the default.
23010
23011 -mno-mult-bug
23012 Do not generate code to avoid bugs in the multiply instructions for
23013 the MN10300 processors.
23014
23015 -mam33
23016 Generate code using features specific to the AM33 processor.
23017
23018 -mno-am33
23019 Do not generate code using features specific to the AM33 processor.
23020 This is the default.
23021
23022 -mam33-2
23023 Generate code using features specific to the AM33/2.0 processor.
23024
23025 -mam34
23026 Generate code using features specific to the AM34 processor.
23027
23028 -mtune=cpu-type
23029 Use the timing characteristics of the indicated CPU type when
23030 scheduling instructions. This does not change the targeted
23031 processor type. The CPU type must be one of mn10300, am33, am33-2
23032 or am34.
23033
23034 -mreturn-pointer-on-d0
23035 When generating a function that returns a pointer, return the
23036 pointer in both "a0" and "d0". Otherwise, the pointer is returned
23037 only in "a0", and attempts to call such functions without a
23038 prototype result in errors. Note that this option is on by
23039 default; use -mno-return-pointer-on-d0 to disable it.
23040
23041 -mno-crt0
23042 Do not link in the C run-time initialization object file.
23043
23044 -mrelax
23045 Indicate to the linker that it should perform a relaxation
23046 optimization pass to shorten branches, calls and absolute memory
23047 addresses. This option only has an effect when used on the command
23048 line for the final link step.
23049
23050 This option makes symbolic debugging impossible.
23051
23052 -mliw
23053 Allow the compiler to generate Long Instruction Word instructions
23054 if the target is the AM33 or later. This is the default. This
23055 option defines the preprocessor macro "__LIW__".
23056
23057 -mno-liw
23058 Do not allow the compiler to generate Long Instruction Word
23059 instructions. This option defines the preprocessor macro
23060 "__NO_LIW__".
23061
23062 -msetlb
23063 Allow the compiler to generate the SETLB and Lcc instructions if
23064 the target is the AM33 or later. This is the default. This option
23065 defines the preprocessor macro "__SETLB__".
23066
23067 -mno-setlb
23068 Do not allow the compiler to generate SETLB or Lcc instructions.
23069 This option defines the preprocessor macro "__NO_SETLB__".
23070
23071 Moxie Options
23072
23073 -meb
23074 Generate big-endian code. This is the default for moxie-*-*
23075 configurations.
23076
23077 -mel
23078 Generate little-endian code.
23079
23080 -mmul.x
23081 Generate mul.x and umul.x instructions. This is the default for
23082 moxiebox-*-* configurations.
23083
23084 -mno-crt0
23085 Do not link in the C run-time initialization object file.
23086
23087 MSP430 Options
23088
23089 These options are defined for the MSP430:
23090
23091 -masm-hex
23092 Force assembly output to always use hex constants. Normally such
23093 constants are signed decimals, but this option is available for
23094 testsuite and/or aesthetic purposes.
23095
23096 -mmcu=
23097 Select the MCU to target. This is used to create a C preprocessor
23098 symbol based upon the MCU name, converted to upper case and pre-
23099 and post-fixed with __. This in turn is used by the msp430.h
23100 header file to select an MCU-specific supplementary header file.
23101
23102 The option also sets the ISA to use. If the MCU name is one that
23103 is known to only support the 430 ISA then that is selected,
23104 otherwise the 430X ISA is selected. A generic MCU name of msp430
23105 can also be used to select the 430 ISA. Similarly the generic
23106 msp430x MCU name selects the 430X ISA.
23107
23108 In addition an MCU-specific linker script is added to the linker
23109 command line. The script's name is the name of the MCU with .ld
23110 appended. Thus specifying -mmcu=xxx on the gcc command line
23111 defines the C preprocessor symbol "__XXX__" and cause the linker to
23112 search for a script called xxx.ld.
23113
23114 The ISA and hardware multiply supported for the different MCUs is
23115 hard-coded into GCC. However, an external devices.csv file can be
23116 used to extend device support beyond those that have been hard-
23117 coded.
23118
23119 GCC searches for the devices.csv file using the following methods
23120 in the given precedence order, where the first method takes
23121 precendence over the second which takes precedence over the third.
23122
23123 Include path specified with "-I" and "-L"
23124 devices.csv will be searched for in each of the directories
23125 specified by include paths and linker library search paths.
23126
23127 Path specified by the environment variable MSP430_GCC_INCLUDE_DIR
23128 Define the value of the global environment variable
23129 MSP430_GCC_INCLUDE_DIR to the full path to the directory
23130 containing devices.csv, and GCC will search this directory for
23131 devices.csv. If devices.csv is found, this directory will also
23132 be registered as an include path, and linker library path.
23133 Header files and linker scripts in this directory can therefore
23134 be used without manually specifying "-I" and "-L" on the
23135 command line.
23136
23137 The msp430-elf{,bare}/include/devices directory
23138 Finally, GCC will examine msp430-elf{,bare}/include/devices
23139 from the toolchain root directory. This directory does not
23140 exist in a default installation, but if the user has created it
23141 and copied devices.csv there, then the MCU data will be read.
23142 As above, this directory will also be registered as an include
23143 path, and linker library path.
23144
23145 If none of the above search methods find devices.csv, then the
23146 hard-coded MCU data is used.
23147
23148 -mwarn-mcu
23149 -mno-warn-mcu
23150 This option enables or disables warnings about conflicts between
23151 the MCU name specified by the -mmcu option and the ISA set by the
23152 -mcpu option and/or the hardware multiply support set by the
23153 -mhwmult option. It also toggles warnings about unrecognized MCU
23154 names. This option is on by default.
23155
23156 -mcpu=
23157 Specifies the ISA to use. Accepted values are msp430, msp430x and
23158 msp430xv2. This option is deprecated. The -mmcu= option should be
23159 used to select the ISA.
23160
23161 -msim
23162 Link to the simulator runtime libraries and linker script.
23163 Overrides any scripts that would be selected by the -mmcu= option.
23164
23165 -mlarge
23166 Use large-model addressing (20-bit pointers, 20-bit "size_t").
23167
23168 -msmall
23169 Use small-model addressing (16-bit pointers, 16-bit "size_t").
23170
23171 -mrelax
23172 This option is passed to the assembler and linker, and allows the
23173 linker to perform certain optimizations that cannot be done until
23174 the final link.
23175
23176 mhwmult=
23177 Describes the type of hardware multiply supported by the target.
23178 Accepted values are none for no hardware multiply, 16bit for the
23179 original 16-bit-only multiply supported by early MCUs. 32bit for
23180 the 16/32-bit multiply supported by later MCUs and f5series for the
23181 16/32-bit multiply supported by F5-series MCUs. A value of auto
23182 can also be given. This tells GCC to deduce the hardware multiply
23183 support based upon the MCU name provided by the -mmcu option. If
23184 no -mmcu option is specified or if the MCU name is not recognized
23185 then no hardware multiply support is assumed. "auto" is the
23186 default setting.
23187
23188 Hardware multiplies are normally performed by calling a library
23189 routine. This saves space in the generated code. When compiling
23190 at -O3 or higher however the hardware multiplier is invoked inline.
23191 This makes for bigger, but faster code.
23192
23193 The hardware multiply routines disable interrupts whilst running
23194 and restore the previous interrupt state when they finish. This
23195 makes them safe to use inside interrupt handlers as well as in
23196 normal code.
23197
23198 -minrt
23199 Enable the use of a minimum runtime environment - no static
23200 initializers or constructors. This is intended for memory-
23201 constrained devices. The compiler includes special symbols in some
23202 objects that tell the linker and runtime which code fragments are
23203 required.
23204
23205 -mtiny-printf
23206 Enable reduced code size "printf" and "puts" library functions.
23207 The tiny implementations of these functions are not reentrant, so
23208 must be used with caution in multi-threaded applications.
23209
23210 Support for streams has been removed and the string to be printed
23211 will always be sent to stdout via the "write" syscall. The string
23212 is not buffered before it is sent to write.
23213
23214 This option requires Newlib Nano IO, so GCC must be configured with
23215 --enable-newlib-nano-formatted-io.
23216
23217 -mmax-inline-shift=
23218 This option takes an integer between 0 and 64 inclusive, and sets
23219 the maximum number of inline shift instructions which should be
23220 emitted to perform a shift operation by a constant amount. When
23221 this value needs to be exceeded, an mspabi helper function is used
23222 instead. The default value is 4.
23223
23224 This only affects cases where a shift by multiple positions cannot
23225 be completed with a single instruction (e.g. all shifts >1 on the
23226 430 ISA).
23227
23228 Shifts of a 32-bit value are at least twice as costly, so the value
23229 passed for this option is divided by 2 and the resulting value used
23230 instead.
23231
23232 -mcode-region=
23233 -mdata-region=
23234 These options tell the compiler where to place functions and data
23235 that do not have one of the "lower", "upper", "either" or "section"
23236 attributes. Possible values are "lower", "upper", "either" or
23237 "any". The first three behave like the corresponding attribute.
23238 The fourth possible value - "any" - is the default. It leaves
23239 placement entirely up to the linker script and how it assigns the
23240 standard sections (".text", ".data", etc) to the memory regions.
23241
23242 -msilicon-errata=
23243 This option passes on a request to assembler to enable the fixes
23244 for the named silicon errata.
23245
23246 -msilicon-errata-warn=
23247 This option passes on a request to the assembler to enable warning
23248 messages when a silicon errata might need to be applied.
23249
23250 -mwarn-devices-csv
23251 -mno-warn-devices-csv
23252 Warn if devices.csv is not found or there are problem parsing it
23253 (default: on).
23254
23255 NDS32 Options
23256
23257 These options are defined for NDS32 implementations:
23258
23259 -mbig-endian
23260 Generate code in big-endian mode.
23261
23262 -mlittle-endian
23263 Generate code in little-endian mode.
23264
23265 -mreduced-regs
23266 Use reduced-set registers for register allocation.
23267
23268 -mfull-regs
23269 Use full-set registers for register allocation.
23270
23271 -mcmov
23272 Generate conditional move instructions.
23273
23274 -mno-cmov
23275 Do not generate conditional move instructions.
23276
23277 -mext-perf
23278 Generate performance extension instructions.
23279
23280 -mno-ext-perf
23281 Do not generate performance extension instructions.
23282
23283 -mext-perf2
23284 Generate performance extension 2 instructions.
23285
23286 -mno-ext-perf2
23287 Do not generate performance extension 2 instructions.
23288
23289 -mext-string
23290 Generate string extension instructions.
23291
23292 -mno-ext-string
23293 Do not generate string extension instructions.
23294
23295 -mv3push
23296 Generate v3 push25/pop25 instructions.
23297
23298 -mno-v3push
23299 Do not generate v3 push25/pop25 instructions.
23300
23301 -m16-bit
23302 Generate 16-bit instructions.
23303
23304 -mno-16-bit
23305 Do not generate 16-bit instructions.
23306
23307 -misr-vector-size=num
23308 Specify the size of each interrupt vector, which must be 4 or 16.
23309
23310 -mcache-block-size=num
23311 Specify the size of each cache block, which must be a power of 2
23312 between 4 and 512.
23313
23314 -march=arch
23315 Specify the name of the target architecture.
23316
23317 -mcmodel=code-model
23318 Set the code model to one of
23319
23320 small
23321 All the data and read-only data segments must be within 512KB
23322 addressing space. The text segment must be within 16MB
23323 addressing space.
23324
23325 medium
23326 The data segment must be within 512KB while the read-only data
23327 segment can be within 4GB addressing space. The text segment
23328 should be still within 16MB addressing space.
23329
23330 large
23331 All the text and data segments can be within 4GB addressing
23332 space.
23333
23334 -mctor-dtor
23335 Enable constructor/destructor feature.
23336
23337 -mrelax
23338 Guide linker to relax instructions.
23339
23340 Nios II Options
23341
23342 These are the options defined for the Altera Nios II processor.
23343
23344 -G num
23345 Put global and static objects less than or equal to num bytes into
23346 the small data or BSS sections instead of the normal data or BSS
23347 sections. The default value of num is 8.
23348
23349 -mgpopt=option
23350 -mgpopt
23351 -mno-gpopt
23352 Generate (do not generate) GP-relative accesses. The following
23353 option names are recognized:
23354
23355 none
23356 Do not generate GP-relative accesses.
23357
23358 local
23359 Generate GP-relative accesses for small data objects that are
23360 not external, weak, or uninitialized common symbols. Also use
23361 GP-relative addressing for objects that have been explicitly
23362 placed in a small data section via a "section" attribute.
23363
23364 global
23365 As for local, but also generate GP-relative accesses for small
23366 data objects that are external, weak, or common. If you use
23367 this option, you must ensure that all parts of your program
23368 (including libraries) are compiled with the same -G setting.
23369
23370 data
23371 Generate GP-relative accesses for all data objects in the
23372 program. If you use this option, the entire data and BSS
23373 segments of your program must fit in 64K of memory and you must
23374 use an appropriate linker script to allocate them within the
23375 addressable range of the global pointer.
23376
23377 all Generate GP-relative addresses for function pointers as well as
23378 data pointers. If you use this option, the entire text, data,
23379 and BSS segments of your program must fit in 64K of memory and
23380 you must use an appropriate linker script to allocate them
23381 within the addressable range of the global pointer.
23382
23383 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
23384 equivalent to -mgpopt=none.
23385
23386 The default is -mgpopt except when -fpic or -fPIC is specified to
23387 generate position-independent code. Note that the Nios II ABI does
23388 not permit GP-relative accesses from shared libraries.
23389
23390 You may need to specify -mno-gpopt explicitly when building
23391 programs that include large amounts of small data, including large
23392 GOT data sections. In this case, the 16-bit offset for GP-relative
23393 addressing may not be large enough to allow access to the entire
23394 small data section.
23395
23396 -mgprel-sec=regexp
23397 This option specifies additional section names that can be accessed
23398 via GP-relative addressing. It is most useful in conjunction with
23399 "section" attributes on variable declarations and a custom linker
23400 script. The regexp is a POSIX Extended Regular Expression.
23401
23402 This option does not affect the behavior of the -G option, and the
23403 specified sections are in addition to the standard ".sdata" and
23404 ".sbss" small-data sections that are recognized by -mgpopt.
23405
23406 -mr0rel-sec=regexp
23407 This option specifies names of sections that can be accessed via a
23408 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
23409 32-bit address space. It is most useful in conjunction with
23410 "section" attributes on variable declarations and a custom linker
23411 script. The regexp is a POSIX Extended Regular Expression.
23412
23413 In contrast to the use of GP-relative addressing for small data,
23414 zero-based addressing is never generated by default and there are
23415 no conventional section names used in standard linker scripts for
23416 sections in the low or high areas of memory.
23417
23418 -mel
23419 -meb
23420 Generate little-endian (default) or big-endian (experimental) code,
23421 respectively.
23422
23423 -march=arch
23424 This specifies the name of the target Nios II architecture. GCC
23425 uses this name to determine what kind of instructions it can emit
23426 when generating assembly code. Permissible names are: r1, r2.
23427
23428 The preprocessor macro "__nios2_arch__" is available to programs,
23429 with value 1 or 2, indicating the targeted ISA level.
23430
23431 -mbypass-cache
23432 -mno-bypass-cache
23433 Force all load and store instructions to always bypass cache by
23434 using I/O variants of the instructions. The default is not to
23435 bypass the cache.
23436
23437 -mno-cache-volatile
23438 -mcache-volatile
23439 Volatile memory access bypass the cache using the I/O variants of
23440 the load and store instructions. The default is not to bypass the
23441 cache.
23442
23443 -mno-fast-sw-div
23444 -mfast-sw-div
23445 Do not use table-based fast divide for small numbers. The default
23446 is to use the fast divide at -O3 and above.
23447
23448 -mno-hw-mul
23449 -mhw-mul
23450 -mno-hw-mulx
23451 -mhw-mulx
23452 -mno-hw-div
23453 -mhw-div
23454 Enable or disable emitting "mul", "mulx" and "div" family of
23455 instructions by the compiler. The default is to emit "mul" and not
23456 emit "div" and "mulx".
23457
23458 -mbmx
23459 -mno-bmx
23460 -mcdx
23461 -mno-cdx
23462 Enable or disable generation of Nios II R2 BMX (bit manipulation)
23463 and CDX (code density) instructions. Enabling these instructions
23464 also requires -march=r2. Since these instructions are optional
23465 extensions to the R2 architecture, the default is not to emit them.
23466
23467 -mcustom-insn=N
23468 -mno-custom-insn
23469 Each -mcustom-insn=N option enables use of a custom instruction
23470 with encoding N when generating code that uses insn. For example,
23471 -mcustom-fadds=253 generates custom instruction 253 for single-
23472 precision floating-point add operations instead of the default
23473 behavior of using a library call.
23474
23475 The following values of insn are supported. Except as otherwise
23476 noted, floating-point operations are expected to be implemented
23477 with normal IEEE 754 semantics and correspond directly to the C
23478 operators or the equivalent GCC built-in functions.
23479
23480 Single-precision floating point:
23481
23482 fadds, fsubs, fdivs, fmuls
23483 Binary arithmetic operations.
23484
23485 fnegs
23486 Unary negation.
23487
23488 fabss
23489 Unary absolute value.
23490
23491 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
23492 Comparison operations.
23493
23494 fmins, fmaxs
23495 Floating-point minimum and maximum. These instructions are
23496 only generated if -ffinite-math-only is specified.
23497
23498 fsqrts
23499 Unary square root operation.
23500
23501 fcoss, fsins, ftans, fatans, fexps, flogs
23502 Floating-point trigonometric and exponential functions. These
23503 instructions are only generated if -funsafe-math-optimizations
23504 is also specified.
23505
23506 Double-precision floating point:
23507
23508 faddd, fsubd, fdivd, fmuld
23509 Binary arithmetic operations.
23510
23511 fnegd
23512 Unary negation.
23513
23514 fabsd
23515 Unary absolute value.
23516
23517 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
23518 Comparison operations.
23519
23520 fmind, fmaxd
23521 Double-precision minimum and maximum. These instructions are
23522 only generated if -ffinite-math-only is specified.
23523
23524 fsqrtd
23525 Unary square root operation.
23526
23527 fcosd, fsind, ftand, fatand, fexpd, flogd
23528 Double-precision trigonometric and exponential functions.
23529 These instructions are only generated if
23530 -funsafe-math-optimizations is also specified.
23531
23532 Conversions:
23533
23534 fextsd
23535 Conversion from single precision to double precision.
23536
23537 ftruncds
23538 Conversion from double precision to single precision.
23539
23540 fixsi, fixsu, fixdi, fixdu
23541 Conversion from floating point to signed or unsigned integer
23542 types, with truncation towards zero.
23543
23544 round
23545 Conversion from single-precision floating point to signed
23546 integer, rounding to the nearest integer and ties away from
23547 zero. This corresponds to the "__builtin_lroundf" function
23548 when -fno-math-errno is used.
23549
23550 floatis, floatus, floatid, floatud
23551 Conversion from signed or unsigned integer types to floating-
23552 point types.
23553
23554 In addition, all of the following transfer instructions for
23555 internal registers X and Y must be provided to use any of the
23556 double-precision floating-point instructions. Custom instructions
23557 taking two double-precision source operands expect the first
23558 operand in the 64-bit register X. The other operand (or only
23559 operand of a unary operation) is given to the custom arithmetic
23560 instruction with the least significant half in source register src1
23561 and the most significant half in src2. A custom instruction that
23562 returns a double-precision result returns the most significant 32
23563 bits in the destination register and the other half in 32-bit
23564 register Y. GCC automatically generates the necessary code
23565 sequences to write register X and/or read register Y when double-
23566 precision floating-point instructions are used.
23567
23568 fwrx
23569 Write src1 into the least significant half of X and src2 into
23570 the most significant half of X.
23571
23572 fwry
23573 Write src1 into Y.
23574
23575 frdxhi, frdxlo
23576 Read the most or least (respectively) significant half of X and
23577 store it in dest.
23578
23579 frdy
23580 Read the value of Y and store it into dest.
23581
23582 Note that you can gain more local control over generation of Nios
23583 II custom instructions by using the "target("custom-insn=N")" and
23584 "target("no-custom-insn")" function attributes or pragmas.
23585
23586 -mcustom-fpu-cfg=name
23587 This option enables a predefined, named set of custom instruction
23588 encodings (see -mcustom-insn above). Currently, the following sets
23589 are defined:
23590
23591 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
23592 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
23593
23594 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
23595 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
23596 -fsingle-precision-constant
23597
23598 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
23599 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
23600 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
23601 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
23602 -mcustom-fdivs=255 -fsingle-precision-constant
23603
23604 -mcustom-fpu-cfg=fph2 is equivalent to: -mcustom-fabss=224
23605 -mcustom-fnegs=225 -mcustom-fcmpnes=226 -mcustom-fcmpeqs=227
23606 -mcustom-fcmpges=228 -mcustom-fcmpgts=229 -mcustom-fcmples=230
23607 -mcustom-fcmplts=231 -mcustom-fmaxs=232 -mcustom-fmins=233
23608 -mcustom-round=248 -mcustom-fixsi=249 -mcustom-floatis=250
23609 -mcustom-fsqrts=251 -mcustom-fmuls=252 -mcustom-fadds=253
23610 -mcustom-fsubs=254 -mcustom-fdivs=255
23611
23612 Custom instruction assignments given by individual -mcustom-insn=
23613 options override those given by -mcustom-fpu-cfg=, regardless of
23614 the order of the options on the command line.
23615
23616 Note that you can gain more local control over selection of a FPU
23617 configuration by using the "target("custom-fpu-cfg=name")" function
23618 attribute or pragma.
23619
23620 The name fph2 is an abbreviation for Nios II Floating Point
23621 Hardware 2 Component. Please note that the custom instructions
23622 enabled by -mcustom-fmins=233 and -mcustom-fmaxs=234 are only
23623 generated if -ffinite-math-only is specified. The custom
23624 instruction enabled by -mcustom-round=248 is only generated if
23625 -fno-math-errno is specified. In contrast to the other
23626 configurations, -fsingle-precision-constant is not set.
23627
23628 These additional -m options are available for the Altera Nios II ELF
23629 (bare-metal) target:
23630
23631 -mhal
23632 Link with HAL BSP. This suppresses linking with the GCC-provided C
23633 runtime startup and termination code, and is typically used in
23634 conjunction with -msys-crt0= to specify the location of the
23635 alternate startup code provided by the HAL BSP.
23636
23637 -msmallc
23638 Link with a limited version of the C library, -lsmallc, rather than
23639 Newlib.
23640
23641 -msys-crt0=startfile
23642 startfile is the file name of the startfile (crt0) to use when
23643 linking. This option is only useful in conjunction with -mhal.
23644
23645 -msys-lib=systemlib
23646 systemlib is the library name of the library that provides low-
23647 level system calls required by the C library, e.g. "read" and
23648 "write". This option is typically used to link with a library
23649 provided by a HAL BSP.
23650
23651 Nvidia PTX Options
23652
23653 These options are defined for Nvidia PTX:
23654
23655 -m64
23656 Ignored, but preserved for backward compatibility. Only 64-bit ABI
23657 is supported.
23658
23659 -march=architecture-string
23660 Generate code for the specified PTX ISA target architecture (e.g.
23661 sm_35). Valid architecture strings are sm_30, sm_35, sm_53, sm_70,
23662 sm_75 and sm_80. The default target architecture is sm_30.
23663
23664 This option sets the value of the preprocessor macro "__PTX_SM__";
23665 for instance, for sm_35, it has the value 350.
23666
23667 -misa=architecture-string
23668 Alias of -march=.
23669
23670 -march-map=architecture-string
23671 Select the closest available -march= value that is not more
23672 capable. For instance, for -march-map=sm_50 select -march=sm_35,
23673 and for -march-map=sm_53 select -march=sm_53.
23674
23675 -mptx=version-string
23676 Generate code for the specified PTX ISA version (e.g. 7.0). Valid
23677 version strings include 3.1, 6.0, 6.3, and 7.0. The default PTX
23678 ISA version is 6.0, unless a higher version is required for
23679 specified PTX ISA target architecture via option -march=.
23680
23681 This option sets the values of the preprocessor macros
23682 "__PTX_ISA_VERSION_MAJOR__" and "__PTX_ISA_VERSION_MINOR__"; for
23683 instance, for 3.1 the macros have the values 3 and 1, respectively.
23684
23685 -mmainkernel
23686 Link in code for a __main kernel. This is for stand-alone instead
23687 of offloading execution.
23688
23689 -moptimize
23690 Apply partitioned execution optimizations. This is the default
23691 when any level of optimization is selected.
23692
23693 -msoft-stack
23694 Generate code that does not use ".local" memory directly for stack
23695 storage. Instead, a per-warp stack pointer is maintained
23696 explicitly. This enables variable-length stack allocation (with
23697 variable-length arrays or "alloca"), and when global memory is used
23698 for underlying storage, makes it possible to access automatic
23699 variables from other threads, or with atomic instructions. This
23700 code generation variant is used for OpenMP offloading, but the
23701 option is exposed on its own for the purpose of testing the
23702 compiler; to generate code suitable for linking into programs using
23703 OpenMP offloading, use option -mgomp.
23704
23705 -muniform-simt
23706 Switch to code generation variant that allows to execute all
23707 threads in each warp, while maintaining memory state and side
23708 effects as if only one thread in each warp was active outside of
23709 OpenMP SIMD regions. All atomic operations and calls to runtime
23710 (malloc, free, vprintf) are conditionally executed (iff current
23711 lane index equals the master lane index), and the register being
23712 assigned is copied via a shuffle instruction from the master lane.
23713 Outside of SIMD regions lane 0 is the master; inside, each thread
23714 sees itself as the master. Shared memory array "int __nvptx_uni[]"
23715 stores all-zeros or all-ones bitmasks for each warp, indicating
23716 current mode (0 outside of SIMD regions). Each thread can bitwise-
23717 and the bitmask at position "tid.y" with current lane index to
23718 compute the master lane index.
23719
23720 -mgomp
23721 Generate code for use in OpenMP offloading: enables -msoft-stack
23722 and -muniform-simt options, and selects corresponding multilib
23723 variant.
23724
23725 OpenRISC Options
23726
23727 These options are defined for OpenRISC:
23728
23729 -mboard=name
23730 Configure a board specific runtime. This will be passed to the
23731 linker for newlib board library linking. The default is "or1ksim".
23732
23733 -mnewlib
23734 This option is ignored; it is for compatibility purposes only.
23735 This used to select linker and preprocessor options for use with
23736 newlib.
23737
23738 -msoft-div
23739 -mhard-div
23740 Select software or hardware divide ("l.div", "l.divu")
23741 instructions. This default is hardware divide.
23742
23743 -msoft-mul
23744 -mhard-mul
23745 Select software or hardware multiply ("l.mul", "l.muli")
23746 instructions. This default is hardware multiply.
23747
23748 -msoft-float
23749 -mhard-float
23750 Select software or hardware for floating point operations. The
23751 default is software.
23752
23753 -mdouble-float
23754 When -mhard-float is selected, enables generation of double-
23755 precision floating point instructions. By default functions from
23756 libgcc are used to perform double-precision floating point
23757 operations.
23758
23759 -munordered-float
23760 When -mhard-float is selected, enables generation of unordered
23761 floating point compare and set flag ("lf.sfun*") instructions. By
23762 default functions from libgcc are used to perform unordered
23763 floating point compare and set flag operations.
23764
23765 -mcmov
23766 Enable generation of conditional move ("l.cmov") instructions. By
23767 default the equivalent will be generated using set and branch.
23768
23769 -mror
23770 Enable generation of rotate right ("l.ror") instructions. By
23771 default functions from libgcc are used to perform rotate right
23772 operations.
23773
23774 -mrori
23775 Enable generation of rotate right with immediate ("l.rori")
23776 instructions. By default functions from libgcc are used to perform
23777 rotate right with immediate operations.
23778
23779 -msext
23780 Enable generation of sign extension ("l.ext*") instructions. By
23781 default memory loads are used to perform sign extension.
23782
23783 -msfimm
23784 Enable generation of compare and set flag with immediate ("l.sf*i")
23785 instructions. By default extra instructions will be generated to
23786 store the immediate to a register first.
23787
23788 -mshftimm
23789 Enable generation of shift with immediate ("l.srai", "l.srli",
23790 "l.slli") instructions. By default extra instructions will be
23791 generated to store the immediate to a register first.
23792
23793 -mcmodel=small
23794 Generate OpenRISC code for the small model: The GOT is limited to
23795 64k. This is the default model.
23796
23797 -mcmodel=large
23798 Generate OpenRISC code for the large model: The GOT may grow up to
23799 4G in size.
23800
23801 PDP-11 Options
23802
23803 These options are defined for the PDP-11:
23804
23805 -mfpu
23806 Use hardware FPP floating point. This is the default. (FIS
23807 floating point on the PDP-11/40 is not supported.) Implies -m45.
23808
23809 -msoft-float
23810 Do not use hardware floating point.
23811
23812 -mac0
23813 Return floating-point results in ac0 (fr0 in Unix assembler
23814 syntax).
23815
23816 -mno-ac0
23817 Return floating-point results in memory. This is the default.
23818
23819 -m40
23820 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23821
23822 -m45
23823 Generate code for a PDP-11/45. This is the default.
23824
23825 -m10
23826 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23827
23828 -mint16
23829 -mno-int32
23830 Use 16-bit "int". This is the default.
23831
23832 -mint32
23833 -mno-int16
23834 Use 32-bit "int".
23835
23836 -msplit
23837 Target has split instruction and data space. Implies -m45.
23838
23839 -munix-asm
23840 Use Unix assembler syntax.
23841
23842 -mdec-asm
23843 Use DEC assembler syntax.
23844
23845 -mgnu-asm
23846 Use GNU assembler syntax. This is the default.
23847
23848 -mlra
23849 Use the new LRA register allocator. By default, the old "reload"
23850 allocator is used.
23851
23852 picoChip Options
23853
23854 These -m options are defined for picoChip implementations:
23855
23856 -mae=ae_type
23857 Set the instruction set, register set, and instruction scheduling
23858 parameters for array element type ae_type. Supported values for
23859 ae_type are ANY, MUL, and MAC.
23860
23861 -mae=ANY selects a completely generic AE type. Code generated with
23862 this option runs on any of the other AE types. The code is not as
23863 efficient as it would be if compiled for a specific AE type, and
23864 some types of operation (e.g., multiplication) do not work properly
23865 on all types of AE.
23866
23867 -mae=MUL selects a MUL AE type. This is the most useful AE type
23868 for compiled code, and is the default.
23869
23870 -mae=MAC selects a DSP-style MAC AE. Code compiled with this
23871 option may suffer from poor performance of byte (char)
23872 manipulation, since the DSP AE does not provide hardware support
23873 for byte load/stores.
23874
23875 -msymbol-as-address
23876 Enable the compiler to directly use a symbol name as an address in
23877 a load/store instruction, without first loading it into a register.
23878 Typically, the use of this option generates larger programs, which
23879 run faster than when the option isn't used. However, the results
23880 vary from program to program, so it is left as a user option,
23881 rather than being permanently enabled.
23882
23883 -mno-inefficient-warnings
23884 Disables warnings about the generation of inefficient code. These
23885 warnings can be generated, for example, when compiling code that
23886 performs byte-level memory operations on the MAC AE type. The MAC
23887 AE has no hardware support for byte-level memory operations, so all
23888 byte load/stores must be synthesized from word load/store
23889 operations. This is inefficient and a warning is generated to
23890 indicate that you should rewrite the code to avoid byte operations,
23891 or to target an AE type that has the necessary hardware support.
23892 This option disables these warnings.
23893
23894 PowerPC Options
23895
23896 These are listed under
23897
23898 PRU Options
23899
23900 These command-line options are defined for PRU target:
23901
23902 -minrt
23903 Link with a minimum runtime environment, with no support for static
23904 initializers and constructors. Using this option can significantly
23905 reduce the size of the final ELF binary. Beware that the compiler
23906 could still generate code with static initializers and
23907 constructors. It is up to the programmer to ensure that the source
23908 program will not use those features.
23909
23910 -mmcu=mcu
23911 Specify the PRU MCU variant to use. Check Newlib for the exact
23912 list of supported MCUs.
23913
23914 -mno-relax
23915 Make GCC pass the --no-relax command-line option to the linker
23916 instead of the --relax option.
23917
23918 -mloop
23919 Allow (or do not allow) GCC to use the LOOP instruction.
23920
23921 -mabi=variant
23922 Specify the ABI variant to output code for. -mabi=ti selects the
23923 unmodified TI ABI while -mabi=gnu selects a GNU variant that copes
23924 more naturally with certain GCC assumptions. These are the
23925 differences:
23926
23927 Function Pointer Size
23928 TI ABI specifies that function (code) pointers are 16-bit,
23929 whereas GNU supports only 32-bit data and code pointers.
23930
23931 Optional Return Value Pointer
23932 Function return values larger than 64 bits are passed by using
23933 a hidden pointer as the first argument of the function. TI
23934 ABI, though, mandates that the pointer can be NULL in case the
23935 caller is not using the returned value. GNU always passes and
23936 expects a valid return value pointer.
23937
23938 The current -mabi=ti implementation simply raises a compile error
23939 when any of the above code constructs is detected. As a
23940 consequence the standard C library cannot be built and it is
23941 omitted when linking with -mabi=ti.
23942
23943 Relaxation is a GNU feature and for safety reasons is disabled when
23944 using -mabi=ti. The TI toolchain does not emit relocations for
23945 QBBx instructions, so the GNU linker cannot adjust them when
23946 shortening adjacent LDI32 pseudo instructions.
23947
23948 RISC-V Options
23949
23950 These command-line options are defined for RISC-V targets:
23951
23952 -mbranch-cost=n
23953 Set the cost of branches to roughly n instructions.
23954
23955 -mplt
23956 -mno-plt
23957 When generating PIC code, do or don't allow the use of PLTs.
23958 Ignored for non-PIC. The default is -mplt.
23959
23960 -mabi=ABI-string
23961 Specify integer and floating-point calling convention. ABI-string
23962 contains two parts: the size of integer types and the registers
23963 used for floating-point types. For example -march=rv64ifd
23964 -mabi=lp64d means that long and pointers are 64-bit (implicitly
23965 defining int to be 32-bit), and that floating-point values up to 64
23966 bits wide are passed in F registers. Contrast this with
23967 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
23968 generate code that uses the F and D extensions but only allows
23969 floating-point values up to 32 bits long to be passed in registers;
23970 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
23971 will be passed in registers.
23972
23973 The default for this argument is system dependent, users who want a
23974 specific calling convention should specify one explicitly. The
23975 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
23976 and lp64d. Some calling conventions are impossible to implement on
23977 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
23978 because the ABI requires 64-bit values be passed in F registers,
23979 but F registers are only 32 bits wide. There is also the ilp32e
23980 ABI that can only be used with the rv32e architecture. This ABI is
23981 not well specified at present, and is subject to change.
23982
23983 -mfdiv
23984 -mno-fdiv
23985 Do or don't use hardware floating-point divide and square root
23986 instructions. This requires the F or D extensions for floating-
23987 point registers. The default is to use them if the specified
23988 architecture has these instructions.
23989
23990 -mdiv
23991 -mno-div
23992 Do or don't use hardware instructions for integer division. This
23993 requires the M extension. The default is to use them if the
23994 specified architecture has these instructions.
23995
23996 -misa-spec=ISA-spec-string
23997 Specify the version of the RISC-V Unprivileged (formerly User-
23998 Level) ISA specification to produce code conforming to. The
23999 possibilities for ISA-spec-string are:
24000
24001 2.2 Produce code conforming to version 2.2.
24002
24003 20190608
24004 Produce code conforming to version 20190608.
24005
24006 20191213
24007 Produce code conforming to version 20191213.
24008
24009 The default is -misa-spec=20191213 unless GCC has been configured
24010 with --with-isa-spec= specifying a different default version.
24011
24012 -march=ISA-string
24013 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
24014 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
24015
24016 When -march= is not specified, use the setting from -mcpu.
24017
24018 If both -march and -mcpu= are not specified, the default for this
24019 argument is system dependent, users who want a specific
24020 architecture extensions should specify one explicitly.
24021
24022 -mcpu=processor-string
24023 Use architecture of and optimize the output for the given
24024 processor, specified by particular CPU name. Permissible values
24025 for this option are: sifive-e20, sifive-e21, sifive-e24,
24026 sifive-e31, sifive-e34, sifive-e76, sifive-s21, sifive-s51,
24027 sifive-s54, sifive-s76, sifive-u54, and sifive-u74.
24028
24029 -mtune=processor-string
24030 Optimize the output for the given processor, specified by
24031 microarchitecture or particular CPU name. Permissible values for
24032 this option are: rocket, sifive-3-series, sifive-5-series,
24033 sifive-7-series, size, and all valid options for -mcpu=.
24034
24035 When -mtune= is not specified, use the setting from -mcpu, the
24036 default is rocket if both are not specified.
24037
24038 The size choice is not intended for use by end-users. This is used
24039 when -Os is specified. It overrides the instruction cost info
24040 provided by -mtune=, but does not override the pipeline info. This
24041 helps reduce code size while still giving good performance.
24042
24043 -mpreferred-stack-boundary=num
24044 Attempt to keep the stack boundary aligned to a 2 raised to num
24045 byte boundary. If -mpreferred-stack-boundary is not specified, the
24046 default is 4 (16 bytes or 128-bits).
24047
24048 Warning: If you use this switch, then you must build all modules
24049 with the same value, including any libraries. This includes the
24050 system libraries and startup modules.
24051
24052 -msmall-data-limit=n
24053 Put global and static data smaller than n bytes into a special
24054 section (on some targets).
24055
24056 -msave-restore
24057 -mno-save-restore
24058 Do or don't use smaller but slower prologue and epilogue code that
24059 uses library function calls. The default is to use fast inline
24060 prologues and epilogues.
24061
24062 -mshorten-memrefs
24063 -mno-shorten-memrefs
24064 Do or do not attempt to make more use of compressed load/store
24065 instructions by replacing a load/store of 'base register + large
24066 offset' with a new load/store of 'new base + small offset'. If the
24067 new base gets stored in a compressed register, then the new
24068 load/store can be compressed. Currently targets 32-bit integer
24069 load/stores only.
24070
24071 -mstrict-align
24072 -mno-strict-align
24073 Do not or do generate unaligned memory accesses. The default is
24074 set depending on whether the processor we are optimizing for
24075 supports fast unaligned access or not.
24076
24077 -mcmodel=medlow
24078 Generate code for the medium-low code model. The program and its
24079 statically defined symbols must lie within a single 2 GiB address
24080 range and must lie between absolute addresses -2 GiB and +2 GiB.
24081 Programs can be statically or dynamically linked. This is the
24082 default code model.
24083
24084 -mcmodel=medany
24085 Generate code for the medium-any code model. The program and its
24086 statically defined symbols must be within any single 2 GiB address
24087 range. Programs can be statically or dynamically linked.
24088
24089 The code generated by the medium-any code model is position-
24090 independent, but is not guaranteed to function correctly when
24091 linked into position-independent executables or libraries.
24092
24093 -mexplicit-relocs
24094 -mno-exlicit-relocs
24095 Use or do not use assembler relocation operators when dealing with
24096 symbolic addresses. The alternative is to use assembler macros
24097 instead, which may limit optimization.
24098
24099 -mrelax
24100 -mno-relax
24101 Take advantage of linker relaxations to reduce the number of
24102 instructions required to materialize symbol addresses. The default
24103 is to take advantage of linker relaxations.
24104
24105 -memit-attribute
24106 -mno-emit-attribute
24107 Emit (do not emit) RISC-V attribute to record extra information
24108 into ELF objects. This feature requires at least binutils 2.32.
24109
24110 -malign-data=type
24111 Control how GCC aligns variables and constants of array, structure,
24112 or union types. Supported values for type are xlen which uses x
24113 register width as the alignment value, and natural which uses
24114 natural alignment. xlen is the default.
24115
24116 -mbig-endian
24117 Generate big-endian code. This is the default when GCC is
24118 configured for a riscv64be-*-* or riscv32be-*-* target.
24119
24120 -mlittle-endian
24121 Generate little-endian code. This is the default when GCC is
24122 configured for a riscv64-*-* or riscv32-*-* but not a riscv64be-*-*
24123 or riscv32be-*-* target.
24124
24125 -mstack-protector-guard=guard
24126 -mstack-protector-guard-reg=reg
24127 -mstack-protector-guard-offset=offset
24128 Generate stack protection code using canary at guard. Supported
24129 locations are global for a global canary or tls for per-thread
24130 canary in the TLS block.
24131
24132 With the latter choice the options -mstack-protector-guard-reg=reg
24133 and -mstack-protector-guard-offset=offset furthermore specify which
24134 register to use as base register for reading the canary, and from
24135 what offset from that base register. There is no default register
24136 or offset as this is entirely for use within the Linux kernel.
24137
24138 RL78 Options
24139
24140 -msim
24141 Links in additional target libraries to support operation within a
24142 simulator.
24143
24144 -mmul=none
24145 -mmul=g10
24146 -mmul=g13
24147 -mmul=g14
24148 -mmul=rl78
24149 Specifies the type of hardware multiplication and division support
24150 to be used. The simplest is "none", which uses software for both
24151 multiplication and division. This is the default. The "g13" value
24152 is for the hardware multiply/divide peripheral found on the
24153 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
24154 multiplication and division instructions supported by the RL78/G14
24155 (S3 core) parts. The value "rl78" is an alias for "g14" and the
24156 value "mg10" is an alias for "none".
24157
24158 In addition a C preprocessor macro is defined, based upon the
24159 setting of this option. Possible values are: "__RL78_MUL_NONE__",
24160 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
24161
24162 -mcpu=g10
24163 -mcpu=g13
24164 -mcpu=g14
24165 -mcpu=rl78
24166 Specifies the RL78 core to target. The default is the G14 core,
24167 also known as an S3 core or just RL78. The G13 or S2 core does not
24168 have multiply or divide instructions, instead it uses a hardware
24169 peripheral for these operations. The G10 or S1 core does not have
24170 register banks, so it uses a different calling convention.
24171
24172 If this option is set it also selects the type of hardware multiply
24173 support to use, unless this is overridden by an explicit -mmul=none
24174 option on the command line. Thus specifying -mcpu=g13 enables the
24175 use of the G13 hardware multiply peripheral and specifying
24176 -mcpu=g10 disables the use of hardware multiplications altogether.
24177
24178 Note, although the RL78/G14 core is the default target, specifying
24179 -mcpu=g14 or -mcpu=rl78 on the command line does change the
24180 behavior of the toolchain since it also enables G14 hardware
24181 multiply support. If these options are not specified on the
24182 command line then software multiplication routines will be used
24183 even though the code targets the RL78 core. This is for backwards
24184 compatibility with older toolchains which did not have hardware
24185 multiply and divide support.
24186
24187 In addition a C preprocessor macro is defined, based upon the
24188 setting of this option. Possible values are: "__RL78_G10__",
24189 "__RL78_G13__" or "__RL78_G14__".
24190
24191 -mg10
24192 -mg13
24193 -mg14
24194 -mrl78
24195 These are aliases for the corresponding -mcpu= option. They are
24196 provided for backwards compatibility.
24197
24198 -mallregs
24199 Allow the compiler to use all of the available registers. By
24200 default registers "r24..r31" are reserved for use in interrupt
24201 handlers. With this option enabled these registers can be used in
24202 ordinary functions as well.
24203
24204 -m64bit-doubles
24205 -m32bit-doubles
24206 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
24207 (-m32bit-doubles) in size. The default is -m32bit-doubles.
24208
24209 -msave-mduc-in-interrupts
24210 -mno-save-mduc-in-interrupts
24211 Specifies that interrupt handler functions should preserve the MDUC
24212 registers. This is only necessary if normal code might use the
24213 MDUC registers, for example because it performs multiplication and
24214 division operations. The default is to ignore the MDUC registers
24215 as this makes the interrupt handlers faster. The target option
24216 -mg13 needs to be passed for this to work as this feature is only
24217 available on the G13 target (S2 core). The MDUC registers will
24218 only be saved if the interrupt handler performs a multiplication or
24219 division operation or it calls another function.
24220
24221 IBM RS/6000 and PowerPC Options
24222
24223 These -m options are defined for the IBM RS/6000 and PowerPC:
24224
24225 -mpowerpc-gpopt
24226 -mno-powerpc-gpopt
24227 -mpowerpc-gfxopt
24228 -mno-powerpc-gfxopt
24229 -mpowerpc64
24230 -mno-powerpc64
24231 -mmfcrf
24232 -mno-mfcrf
24233 -mpopcntb
24234 -mno-popcntb
24235 -mpopcntd
24236 -mno-popcntd
24237 -mfprnd
24238 -mno-fprnd
24239 -mcmpb
24240 -mno-cmpb
24241 -mhard-dfp
24242 -mno-hard-dfp
24243 You use these options to specify which instructions are available
24244 on the processor you are using. The default value of these options
24245 is determined when configuring GCC. Specifying the -mcpu=cpu_type
24246 overrides the specification of these options. We recommend you use
24247 the -mcpu=cpu_type option rather than the options listed above.
24248
24249 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
24250 architecture instructions in the General Purpose group, including
24251 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
24252 to use the optional PowerPC architecture instructions in the
24253 Graphics group, including floating-point select.
24254
24255 The -mmfcrf option allows GCC to generate the move from condition
24256 register field instruction implemented on the POWER4 processor and
24257 other processors that support the PowerPC V2.01 architecture. The
24258 -mpopcntb option allows GCC to generate the popcount and double-
24259 precision FP reciprocal estimate instruction implemented on the
24260 POWER5 processor and other processors that support the PowerPC
24261 V2.02 architecture. The -mpopcntd option allows GCC to generate
24262 the popcount instruction implemented on the POWER7 processor and
24263 other processors that support the PowerPC V2.06 architecture. The
24264 -mfprnd option allows GCC to generate the FP round to integer
24265 instructions implemented on the POWER5+ processor and other
24266 processors that support the PowerPC V2.03 architecture. The -mcmpb
24267 option allows GCC to generate the compare bytes instruction
24268 implemented on the POWER6 processor and other processors that
24269 support the PowerPC V2.05 architecture. The -mhard-dfp option
24270 allows GCC to generate the decimal floating-point instructions
24271 implemented on some POWER processors.
24272
24273 The -mpowerpc64 option allows GCC to generate the additional 64-bit
24274 instructions that are found in the full PowerPC64 architecture and
24275 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24276 -mno-powerpc64.
24277
24278 -mcpu=cpu_type
24279 Set architecture type, register usage, and instruction scheduling
24280 parameters for machine type cpu_type. Supported values for
24281 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
24282 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
24283 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
24284 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
24285 power4, power5, power5+, power6, power6x, power7, power8, power9,
24286 power10, powerpc, powerpc64, powerpc64le, rs64, and native.
24287
24288 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
24289 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
24290 64-bit little endian PowerPC architecture machine types, with an
24291 appropriate, generic processor model assumed for scheduling
24292 purposes.
24293
24294 Specifying native as cpu type detects and selects the architecture
24295 option that corresponds to the host processor of the system
24296 performing the compilation. -mcpu=native has no effect if GCC does
24297 not recognize the processor.
24298
24299 The other options specify a specific processor. Code generated
24300 under those options runs best on that processor, and may not run at
24301 all on others.
24302
24303 The -mcpu options automatically enable or disable the following
24304 options:
24305
24306 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
24307 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
24308 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
24309 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
24310 -mfloat128-hardware -mprefixed -mpcrel -mmma -mrop-protect
24311
24312 The particular options set for any particular CPU varies between
24313 compiler versions, depending on what setting seems to produce
24314 optimal code for that CPU; it doesn't necessarily reflect the
24315 actual hardware's capabilities. If you wish to set an individual
24316 option to a particular value, you may specify it after the -mcpu
24317 option, like -mcpu=970 -mno-altivec.
24318
24319 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
24320 disabled by the -mcpu option at present because AIX does not have
24321 full support for these options. You may still enable or disable
24322 them individually if you're sure it'll work in your environment.
24323
24324 -mtune=cpu_type
24325 Set the instruction scheduling parameters for machine type
24326 cpu_type, but do not set the architecture type or register usage,
24327 as -mcpu=cpu_type does. The same values for cpu_type are used for
24328 -mtune as for -mcpu. If both are specified, the code generated
24329 uses the architecture and registers set by -mcpu, but the
24330 scheduling parameters set by -mtune.
24331
24332 -mcmodel=small
24333 Generate PowerPC64 code for the small model: The TOC is limited to
24334 64k.
24335
24336 -mcmodel=medium
24337 Generate PowerPC64 code for the medium model: The TOC and other
24338 static data may be up to a total of 4G in size. This is the
24339 default for 64-bit Linux.
24340
24341 -mcmodel=large
24342 Generate PowerPC64 code for the large model: The TOC may be up to
24343 4G in size. Other data and code is only limited by the 64-bit
24344 address space.
24345
24346 -maltivec
24347 -mno-altivec
24348 Generate code that uses (does not use) AltiVec instructions, and
24349 also enable the use of built-in functions that allow more direct
24350 access to the AltiVec instruction set. You may also need to set
24351 -mabi=altivec to adjust the current ABI with AltiVec ABI
24352 enhancements.
24353
24354 When -maltivec is used, the element order for AltiVec intrinsics
24355 such as "vec_splat", "vec_extract", and "vec_insert" match array
24356 element order corresponding to the endianness of the target. That
24357 is, element zero identifies the leftmost element in a vector
24358 register when targeting a big-endian platform, and identifies the
24359 rightmost element in a vector register when targeting a little-
24360 endian platform.
24361
24362 -mvrsave
24363 -mno-vrsave
24364 Generate VRSAVE instructions when generating AltiVec code.
24365
24366 -msecure-plt
24367 Generate code that allows ld and ld.so to build executables and
24368 shared libraries with non-executable ".plt" and ".got" sections.
24369 This is a PowerPC 32-bit SYSV ABI option.
24370
24371 -mbss-plt
24372 Generate code that uses a BSS ".plt" section that ld.so fills in,
24373 and requires ".plt" and ".got" sections that are both writable and
24374 executable. This is a PowerPC 32-bit SYSV ABI option.
24375
24376 -misel
24377 -mno-isel
24378 This switch enables or disables the generation of ISEL
24379 instructions.
24380
24381 -mvsx
24382 -mno-vsx
24383 Generate code that uses (does not use) vector/scalar (VSX)
24384 instructions, and also enable the use of built-in functions that
24385 allow more direct access to the VSX instruction set.
24386
24387 -mcrypto
24388 -mno-crypto
24389 Enable the use (disable) of the built-in functions that allow
24390 direct access to the cryptographic instructions that were added in
24391 version 2.07 of the PowerPC ISA.
24392
24393 -mhtm
24394 -mno-htm
24395 Enable (disable) the use of the built-in functions that allow
24396 direct access to the Hardware Transactional Memory (HTM)
24397 instructions that were added in version 2.07 of the PowerPC ISA.
24398
24399 -mpower8-fusion
24400 -mno-power8-fusion
24401 Generate code that keeps (does not keeps) some integer operations
24402 adjacent so that the instructions can be fused together on power8
24403 and later processors.
24404
24405 -mpower8-vector
24406 -mno-power8-vector
24407 Generate code that uses (does not use) the vector and scalar
24408 instructions that were added in version 2.07 of the PowerPC ISA.
24409 Also enable the use of built-in functions that allow more direct
24410 access to the vector instructions.
24411
24412 -mquad-memory
24413 -mno-quad-memory
24414 Generate code that uses (does not use) the non-atomic quad word
24415 memory instructions. The -mquad-memory option requires use of
24416 64-bit mode.
24417
24418 -mquad-memory-atomic
24419 -mno-quad-memory-atomic
24420 Generate code that uses (does not use) the atomic quad word memory
24421 instructions. The -mquad-memory-atomic option requires use of
24422 64-bit mode.
24423
24424 -mfloat128
24425 -mno-float128
24426 Enable/disable the __float128 keyword for IEEE 128-bit floating
24427 point and use either software emulation for IEEE 128-bit floating
24428 point or hardware instructions.
24429
24430 The VSX instruction set (-mvsx) must be enabled to use the IEEE
24431 128-bit floating point support. The IEEE 128-bit floating point is
24432 only supported on Linux.
24433
24434 The default for -mfloat128 is enabled on PowerPC Linux systems
24435 using the VSX instruction set, and disabled on other systems.
24436
24437 If you use the ISA 3.0 instruction set (-mpower9-vector or
24438 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
24439 support will also enable the generation of ISA 3.0 IEEE 128-bit
24440 floating point instructions. Otherwise, if you do not specify to
24441 generate ISA 3.0 instructions or you are targeting a 32-bit big
24442 endian system, IEEE 128-bit floating point will be done with
24443 software emulation.
24444
24445 -mfloat128-hardware
24446 -mno-float128-hardware
24447 Enable/disable using ISA 3.0 hardware instructions to support the
24448 __float128 data type.
24449
24450 The default for -mfloat128-hardware is enabled on PowerPC Linux
24451 systems using the ISA 3.0 instruction set, and disabled on other
24452 systems.
24453
24454 -m32
24455 -m64
24456 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24457 targets (including GNU/Linux). The 32-bit environment sets int,
24458 long and pointer to 32 bits and generates code that runs on any
24459 PowerPC variant. The 64-bit environment sets int to 32 bits and
24460 long and pointer to 64 bits, and generates code for PowerPC64, as
24461 for -mpowerpc64.
24462
24463 -mfull-toc
24464 -mno-fp-in-toc
24465 -mno-sum-in-toc
24466 -mminimal-toc
24467 Modify generation of the TOC (Table Of Contents), which is created
24468 for every executable file. The -mfull-toc option is selected by
24469 default. In that case, GCC allocates at least one TOC entry for
24470 each unique non-automatic variable reference in your program. GCC
24471 also places floating-point constants in the TOC. However, only
24472 16,384 entries are available in the TOC.
24473
24474 If you receive a linker error message that saying you have
24475 overflowed the available TOC space, you can reduce the amount of
24476 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
24477 -mno-fp-in-toc prevents GCC from putting floating-point constants
24478 in the TOC and -mno-sum-in-toc forces GCC to generate code to
24479 calculate the sum of an address and a constant at run time instead
24480 of putting that sum into the TOC. You may specify one or both of
24481 these options. Each causes GCC to produce very slightly slower and
24482 larger code at the expense of conserving TOC space.
24483
24484 If you still run out of space in the TOC even when you specify both
24485 of these options, specify -mminimal-toc instead. This option
24486 causes GCC to make only one TOC entry for every file. When you
24487 specify this option, GCC produces code that is slower and larger
24488 but which uses extremely little TOC space. You may wish to use
24489 this option only on files that contain less frequently-executed
24490 code.
24491
24492 -maix64
24493 -maix32
24494 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
24495 64-bit "long" type, and the infrastructure needed to support them.
24496 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
24497 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
24498
24499 -mxl-compat
24500 -mno-xl-compat
24501 Produce code that conforms more closely to IBM XL compiler
24502 semantics when using AIX-compatible ABI. Pass floating-point
24503 arguments to prototyped functions beyond the register save area
24504 (RSA) on the stack in addition to argument FPRs. Do not assume
24505 that most significant double in 128-bit long double value is
24506 properly rounded when comparing values and converting to double.
24507 Use XL symbol names for long double support routines.
24508
24509 The AIX calling convention was extended but not initially
24510 documented to handle an obscure K&R C case of calling a function
24511 that takes the address of its arguments with fewer arguments than
24512 declared. IBM XL compilers access floating-point arguments that do
24513 not fit in the RSA from the stack when a subroutine is compiled
24514 without optimization. Because always storing floating-point
24515 arguments on the stack is inefficient and rarely needed, this
24516 option is not enabled by default and only is necessary when calling
24517 subroutines compiled by IBM XL compilers without optimization.
24518
24519 -mpe
24520 Support IBM RS/6000 SP Parallel Environment (PE). Link an
24521 application written to use message passing with special startup
24522 code to enable the application to run. The system must have PE
24523 installed in the standard location (/usr/lpp/ppe.poe/), or the
24524 specs file must be overridden with the -specs= option to specify
24525 the appropriate directory location. The Parallel Environment does
24526 not support threads, so the -mpe option and the -pthread option are
24527 incompatible.
24528
24529 -malign-natural
24530 -malign-power
24531 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24532 -malign-natural overrides the ABI-defined alignment of larger
24533 types, such as floating-point doubles, on their natural size-based
24534 boundary. The option -malign-power instructs GCC to follow the
24535 ABI-specified alignment rules. GCC defaults to the standard
24536 alignment defined in the ABI.
24537
24538 On 64-bit Darwin, natural alignment is the default, and
24539 -malign-power is not supported.
24540
24541 -msoft-float
24542 -mhard-float
24543 Generate code that does not use (uses) the floating-point register
24544 set. Software floating-point emulation is provided if you use the
24545 -msoft-float option, and pass the option to GCC when linking.
24546
24547 -mmultiple
24548 -mno-multiple
24549 Generate code that uses (does not use) the load multiple word
24550 instructions and the store multiple word instructions. These
24551 instructions are generated by default on POWER systems, and not
24552 generated on PowerPC systems. Do not use -mmultiple on little-
24553 endian PowerPC systems, since those instructions do not work when
24554 the processor is in little-endian mode. The exceptions are PPC740
24555 and PPC750 which permit these instructions in little-endian mode.
24556
24557 -mupdate
24558 -mno-update
24559 Generate code that uses (does not use) the load or store
24560 instructions that update the base register to the address of the
24561 calculated memory location. These instructions are generated by
24562 default. If you use -mno-update, there is a small window between
24563 the time that the stack pointer is updated and the address of the
24564 previous frame is stored, which means code that walks the stack
24565 frame across interrupts or signals may get corrupted data.
24566
24567 -mavoid-indexed-addresses
24568 -mno-avoid-indexed-addresses
24569 Generate code that tries to avoid (not avoid) the use of indexed
24570 load or store instructions. These instructions can incur a
24571 performance penalty on Power6 processors in certain situations,
24572 such as when stepping through large arrays that cross a 16M
24573 boundary. This option is enabled by default when targeting Power6
24574 and disabled otherwise.
24575
24576 -mfused-madd
24577 -mno-fused-madd
24578 Generate code that uses (does not use) the floating-point multiply
24579 and accumulate instructions. These instructions are generated by
24580 default if hardware floating point is used. The machine-dependent
24581 -mfused-madd option is now mapped to the machine-independent
24582 -ffp-contract=fast option, and -mno-fused-madd is mapped to
24583 -ffp-contract=off.
24584
24585 -mmulhw
24586 -mno-mulhw
24587 Generate code that uses (does not use) the half-word multiply and
24588 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
24589 processors. These instructions are generated by default when
24590 targeting those processors.
24591
24592 -mdlmzb
24593 -mno-dlmzb
24594 Generate code that uses (does not use) the string-search dlmzb
24595 instruction on the IBM 405, 440, 464 and 476 processors. This
24596 instruction is generated by default when targeting those
24597 processors.
24598
24599 -mno-bit-align
24600 -mbit-align
24601 On System V.4 and embedded PowerPC systems do not (do) force
24602 structures and unions that contain bit-fields to be aligned to the
24603 base type of the bit-field.
24604
24605 For example, by default a structure containing nothing but 8
24606 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
24607 and has a size of 4 bytes. By using -mno-bit-align, the structure
24608 is aligned to a 1-byte boundary and is 1 byte in size.
24609
24610 -mno-strict-align
24611 -mstrict-align
24612 On System V.4 and embedded PowerPC systems do not (do) assume that
24613 unaligned memory references are handled by the system.
24614
24615 -mrelocatable
24616 -mno-relocatable
24617 Generate code that allows (does not allow) a static executable to
24618 be relocated to a different address at run time. A simple embedded
24619 PowerPC system loader should relocate the entire contents of
24620 ".got2" and 4-byte locations listed in the ".fixup" section, a
24621 table of 32-bit addresses generated by this option. For this to
24622 work, all objects linked together must be compiled with
24623 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
24624 stack to an 8-byte boundary.
24625
24626 -mrelocatable-lib
24627 -mno-relocatable-lib
24628 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
24629 to allow static executables to be relocated at run time, but
24630 -mrelocatable-lib does not use the smaller stack alignment of
24631 -mrelocatable. Objects compiled with -mrelocatable-lib may be
24632 linked with objects compiled with any combination of the
24633 -mrelocatable options.
24634
24635 -mno-toc
24636 -mtoc
24637 On System V.4 and embedded PowerPC systems do not (do) assume that
24638 register 2 contains a pointer to a global area pointing to the
24639 addresses used in the program.
24640
24641 -mlittle
24642 -mlittle-endian
24643 On System V.4 and embedded PowerPC systems compile code for the
24644 processor in little-endian mode. The -mlittle-endian option is the
24645 same as -mlittle.
24646
24647 -mbig
24648 -mbig-endian
24649 On System V.4 and embedded PowerPC systems compile code for the
24650 processor in big-endian mode. The -mbig-endian option is the same
24651 as -mbig.
24652
24653 -mdynamic-no-pic
24654 On Darwin and Mac OS X systems, compile code so that it is not
24655 relocatable, but that its external references are relocatable. The
24656 resulting code is suitable for applications, but not shared
24657 libraries.
24658
24659 -msingle-pic-base
24660 Treat the register used for PIC addressing as read-only, rather
24661 than loading it in the prologue for each function. The runtime
24662 system is responsible for initializing this register with an
24663 appropriate value before execution begins.
24664
24665 -mprioritize-restricted-insns=priority
24666 This option controls the priority that is assigned to dispatch-slot
24667 restricted instructions during the second scheduling pass. The
24668 argument priority takes the value 0, 1, or 2 to assign no, highest,
24669 or second-highest (respectively) priority to dispatch-slot
24670 restricted instructions.
24671
24672 -msched-costly-dep=dependence_type
24673 This option controls which dependences are considered costly by the
24674 target during instruction scheduling. The argument dependence_type
24675 takes one of the following values:
24676
24677 no No dependence is costly.
24678
24679 all All dependences are costly.
24680
24681 true_store_to_load
24682 A true dependence from store to load is costly.
24683
24684 store_to_load
24685 Any dependence from store to load is costly.
24686
24687 number
24688 Any dependence for which the latency is greater than or equal
24689 to number is costly.
24690
24691 -minsert-sched-nops=scheme
24692 This option controls which NOP insertion scheme is used during the
24693 second scheduling pass. The argument scheme takes one of the
24694 following values:
24695
24696 no Don't insert NOPs.
24697
24698 pad Pad with NOPs any dispatch group that has vacant issue slots,
24699 according to the scheduler's grouping.
24700
24701 regroup_exact
24702 Insert NOPs to force costly dependent insns into separate
24703 groups. Insert exactly as many NOPs as needed to force an insn
24704 to a new group, according to the estimated processor grouping.
24705
24706 number
24707 Insert NOPs to force costly dependent insns into separate
24708 groups. Insert number NOPs to force an insn to a new group.
24709
24710 -mcall-sysv
24711 On System V.4 and embedded PowerPC systems compile code using
24712 calling conventions that adhere to the March 1995 draft of the
24713 System V Application Binary Interface, PowerPC processor
24714 supplement. This is the default unless you configured GCC using
24715 powerpc-*-eabiaix.
24716
24717 -mcall-sysv-eabi
24718 -mcall-eabi
24719 Specify both -mcall-sysv and -meabi options.
24720
24721 -mcall-sysv-noeabi
24722 Specify both -mcall-sysv and -mno-eabi options.
24723
24724 -mcall-aixdesc
24725 On System V.4 and embedded PowerPC systems compile code for the AIX
24726 operating system.
24727
24728 -mcall-linux
24729 On System V.4 and embedded PowerPC systems compile code for the
24730 Linux-based GNU system.
24731
24732 -mcall-freebsd
24733 On System V.4 and embedded PowerPC systems compile code for the
24734 FreeBSD operating system.
24735
24736 -mcall-netbsd
24737 On System V.4 and embedded PowerPC systems compile code for the
24738 NetBSD operating system.
24739
24740 -mcall-openbsd
24741 On System V.4 and embedded PowerPC systems compile code for the
24742 OpenBSD operating system.
24743
24744 -mtraceback=traceback_type
24745 Select the type of traceback table. Valid values for traceback_type
24746 are full, part, and no.
24747
24748 -maix-struct-return
24749 Return all structures in memory (as specified by the AIX ABI).
24750
24751 -msvr4-struct-return
24752 Return structures smaller than 8 bytes in registers (as specified
24753 by the SVR4 ABI).
24754
24755 -mabi=abi-type
24756 Extend the current ABI with a particular extension, or remove such
24757 extension. Valid values are: altivec, no-altivec, ibmlongdouble,
24758 ieeelongdouble, elfv1, elfv2, and for AIX: vec-extabi, vec-default.
24759
24760 -mabi=ibmlongdouble
24761 Change the current ABI to use IBM extended-precision long double.
24762 This is not likely to work if your system defaults to using IEEE
24763 extended-precision long double. If you change the long double type
24764 from IEEE extended-precision, the compiler will issue a warning
24765 unless you use the -Wno-psabi option. Requires -mlong-double-128
24766 to be enabled.
24767
24768 -mabi=ieeelongdouble
24769 Change the current ABI to use IEEE extended-precision long double.
24770 This is not likely to work if your system defaults to using IBM
24771 extended-precision long double. If you change the long double type
24772 from IBM extended-precision, the compiler will issue a warning
24773 unless you use the -Wno-psabi option. Requires -mlong-double-128
24774 to be enabled.
24775
24776 -mabi=elfv1
24777 Change the current ABI to use the ELFv1 ABI. This is the default
24778 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
24779 ABI requires special system support and is likely to fail in
24780 spectacular ways.
24781
24782 -mabi=elfv2
24783 Change the current ABI to use the ELFv2 ABI. This is the default
24784 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
24785 ABI requires special system support and is likely to fail in
24786 spectacular ways.
24787
24788 -mgnu-attribute
24789 -mno-gnu-attribute
24790 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24791 .gnu.attributes section that specify ABI variations in function
24792 parameters or return values.
24793
24794 -mprototype
24795 -mno-prototype
24796 On System V.4 and embedded PowerPC systems assume that all calls to
24797 variable argument functions are properly prototyped. Otherwise,
24798 the compiler must insert an instruction before every non-prototyped
24799 call to set or clear bit 6 of the condition code register ("CR") to
24800 indicate whether floating-point values are passed in the floating-
24801 point registers in case the function takes variable arguments.
24802 With -mprototype, only calls to prototyped variable argument
24803 functions set or clear the bit.
24804
24805 -msim
24806 On embedded PowerPC systems, assume that the startup module is
24807 called sim-crt0.o and that the standard C libraries are libsim.a
24808 and libc.a. This is the default for powerpc-*-eabisim
24809 configurations.
24810
24811 -mmvme
24812 On embedded PowerPC systems, assume that the startup module is
24813 called crt0.o and the standard C libraries are libmvme.a and
24814 libc.a.
24815
24816 -mads
24817 On embedded PowerPC systems, assume that the startup module is
24818 called crt0.o and the standard C libraries are libads.a and libc.a.
24819
24820 -myellowknife
24821 On embedded PowerPC systems, assume that the startup module is
24822 called crt0.o and the standard C libraries are libyk.a and libc.a.
24823
24824 -mvxworks
24825 On System V.4 and embedded PowerPC systems, specify that you are
24826 compiling for a VxWorks system.
24827
24828 -memb
24829 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
24830 header to indicate that eabi extended relocations are used.
24831
24832 -meabi
24833 -mno-eabi
24834 On System V.4 and embedded PowerPC systems do (do not) adhere to
24835 the Embedded Applications Binary Interface (EABI), which is a set
24836 of modifications to the System V.4 specifications. Selecting
24837 -meabi means that the stack is aligned to an 8-byte boundary, a
24838 function "__eabi" is called from "main" to set up the EABI
24839 environment, and the -msdata option can use both "r2" and "r13" to
24840 point to two separate small data areas. Selecting -mno-eabi means
24841 that the stack is aligned to a 16-byte boundary, no EABI
24842 initialization function is called from "main", and the -msdata
24843 option only uses "r13" to point to a single small data area. The
24844 -meabi option is on by default if you configured GCC using one of
24845 the powerpc*-*-eabi* options.
24846
24847 -msdata=eabi
24848 On System V.4 and embedded PowerPC systems, put small initialized
24849 "const" global and static data in the ".sdata2" section, which is
24850 pointed to by register "r2". Put small initialized non-"const"
24851 global and static data in the ".sdata" section, which is pointed to
24852 by register "r13". Put small uninitialized global and static data
24853 in the ".sbss" section, which is adjacent to the ".sdata" section.
24854 The -msdata=eabi option is incompatible with the -mrelocatable
24855 option. The -msdata=eabi option also sets the -memb option.
24856
24857 -msdata=sysv
24858 On System V.4 and embedded PowerPC systems, put small global and
24859 static data in the ".sdata" section, which is pointed to by
24860 register "r13". Put small uninitialized global and static data in
24861 the ".sbss" section, which is adjacent to the ".sdata" section.
24862 The -msdata=sysv option is incompatible with the -mrelocatable
24863 option.
24864
24865 -msdata=default
24866 -msdata
24867 On System V.4 and embedded PowerPC systems, if -meabi is used,
24868 compile code the same as -msdata=eabi, otherwise compile code the
24869 same as -msdata=sysv.
24870
24871 -msdata=data
24872 On System V.4 and embedded PowerPC systems, put small global data
24873 in the ".sdata" section. Put small uninitialized global data in
24874 the ".sbss" section. Do not use register "r13" to address small
24875 data however. This is the default behavior unless other -msdata
24876 options are used.
24877
24878 -msdata=none
24879 -mno-sdata
24880 On embedded PowerPC systems, put all initialized global and static
24881 data in the ".data" section, and all uninitialized data in the
24882 ".bss" section.
24883
24884 -mreadonly-in-sdata
24885 Put read-only objects in the ".sdata" section as well. This is the
24886 default.
24887
24888 -mblock-move-inline-limit=num
24889 Inline all block moves (such as calls to "memcpy" or structure
24890 copies) less than or equal to num bytes. The minimum value for num
24891 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
24892 default value is target-specific.
24893
24894 -mblock-compare-inline-limit=num
24895 Generate non-looping inline code for all block compares (such as
24896 calls to "memcmp" or structure compares) less than or equal to num
24897 bytes. If num is 0, all inline expansion (non-loop and loop) of
24898 block compare is disabled. The default value is target-specific.
24899
24900 -mblock-compare-inline-loop-limit=num
24901 Generate an inline expansion using loop code for all block compares
24902 that are less than or equal to num bytes, but greater than the
24903 limit for non-loop inline block compare expansion. If the block
24904 length is not constant, at most num bytes will be compared before
24905 "memcmp" is called to compare the remainder of the block. The
24906 default value is target-specific.
24907
24908 -mstring-compare-inline-limit=num
24909 Compare at most num string bytes with inline code. If the
24910 difference or end of string is not found at the end of the inline
24911 compare a call to "strcmp" or "strncmp" will take care of the rest
24912 of the comparison. The default is 64 bytes.
24913
24914 -G num
24915 On embedded PowerPC systems, put global and static items less than
24916 or equal to num bytes into the small data or BSS sections instead
24917 of the normal data or BSS section. By default, num is 8. The -G
24918 num switch is also passed to the linker. All modules should be
24919 compiled with the same -G num value.
24920
24921 -mregnames
24922 -mno-regnames
24923 On System V.4 and embedded PowerPC systems do (do not) emit
24924 register names in the assembly language output using symbolic
24925 forms.
24926
24927 -mlongcall
24928 -mno-longcall
24929 By default assume that all calls are far away so that a longer and
24930 more expensive calling sequence is required. This is required for
24931 calls farther than 32 megabytes (33,554,432 bytes) from the current
24932 location. A short call is generated if the compiler knows the call
24933 cannot be that far away. This setting can be overridden by the
24934 "shortcall" function attribute, or by "#pragma longcall(0)".
24935
24936 Some linkers are capable of detecting out-of-range calls and
24937 generating glue code on the fly. On these systems, long calls are
24938 unnecessary and generate slower code. As of this writing, the AIX
24939 linker can do this, as can the GNU linker for PowerPC/64. It is
24940 planned to add this feature to the GNU linker for 32-bit PowerPC
24941 systems as well.
24942
24943 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
24944 linkers, GCC can generate long calls using an inline PLT call
24945 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
24946 ELFv1 (big-endian) do not support inline PLT calls.
24947
24948 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
24949 L42", plus a branch island (glue code). The two target addresses
24950 represent the callee and the branch island. The Darwin/PPC linker
24951 prefers the first address and generates a "bl callee" if the PPC
24952 "bl" instruction reaches the callee directly; otherwise, the linker
24953 generates "bl L42" to call the branch island. The branch island is
24954 appended to the body of the calling function; it computes the full
24955 32-bit address of the callee and jumps to it.
24956
24957 On Mach-O (Darwin) systems, this option directs the compiler emit
24958 to the glue for every direct call, and the Darwin linker decides
24959 whether to use or discard it.
24960
24961 In the future, GCC may ignore all longcall specifications when the
24962 linker is known to generate glue.
24963
24964 -mpltseq
24965 -mno-pltseq
24966 Implement (do not implement) -fno-plt and long calls using an
24967 inline PLT call sequence that supports lazy linking and long calls
24968 to functions in dlopen'd shared libraries. Inline PLT calls are
24969 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
24970 newer GNU linkers, and are enabled by default if the support is
24971 detected when configuring GCC, and, in the case of 32-bit PowerPC,
24972 if GCC is configured with --enable-secureplt. -mpltseq code and
24973 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
24974 together.
24975
24976 -mtls-markers
24977 -mno-tls-markers
24978 Mark (do not mark) calls to "__tls_get_addr" with a relocation
24979 specifying the function argument. The relocation allows the linker
24980 to reliably associate function call with argument setup
24981 instructions for TLS optimization, which in turn allows GCC to
24982 better schedule the sequence.
24983
24984 -mrecip
24985 -mno-recip
24986 This option enables use of the reciprocal estimate and reciprocal
24987 square root estimate instructions with additional Newton-Raphson
24988 steps to increase precision instead of doing a divide or square
24989 root and divide for floating-point arguments. You should use the
24990 -ffast-math option when using -mrecip (or at least
24991 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
24992 and -fno-trapping-math). Note that while the throughput of the
24993 sequence is generally higher than the throughput of the non-
24994 reciprocal instruction, the precision of the sequence can be
24995 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
24996 0.99999994) for reciprocal square roots.
24997
24998 -mrecip=opt
24999 This option controls which reciprocal estimate instructions may be
25000 used. opt is a comma-separated list of options, which may be
25001 preceded by a "!" to invert the option:
25002
25003 all Enable all estimate instructions.
25004
25005 default
25006 Enable the default instructions, equivalent to -mrecip.
25007
25008 none
25009 Disable all estimate instructions, equivalent to -mno-recip.
25010
25011 div Enable the reciprocal approximation instructions for both
25012 single and double precision.
25013
25014 divf
25015 Enable the single-precision reciprocal approximation
25016 instructions.
25017
25018 divd
25019 Enable the double-precision reciprocal approximation
25020 instructions.
25021
25022 rsqrt
25023 Enable the reciprocal square root approximation instructions
25024 for both single and double precision.
25025
25026 rsqrtf
25027 Enable the single-precision reciprocal square root
25028 approximation instructions.
25029
25030 rsqrtd
25031 Enable the double-precision reciprocal square root
25032 approximation instructions.
25033
25034 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
25035 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
25036 "XVRSQRTEDP" instructions which handle the double-precision
25037 reciprocal square root calculations.
25038
25039 -mrecip-precision
25040 -mno-recip-precision
25041 Assume (do not assume) that the reciprocal estimate instructions
25042 provide higher-precision estimates than is mandated by the PowerPC
25043 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
25044 automatically selects -mrecip-precision. The double-precision
25045 square root estimate instructions are not generated by default on
25046 low-precision machines, since they do not provide an estimate that
25047 converges after three steps.
25048
25049 -mveclibabi=type
25050 Specifies the ABI type to use for vectorizing intrinsics using an
25051 external library. The only type supported at present is mass,
25052 which specifies to use IBM's Mathematical Acceleration Subsystem
25053 (MASS) libraries for vectorizing intrinsics using external
25054 libraries. GCC currently emits calls to "acosd2", "acosf4",
25055 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
25056 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
25057 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
25058 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
25059 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
25060 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
25061 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
25062 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
25063 "tanhf4" when generating code for power7. Both -ftree-vectorize
25064 and -funsafe-math-optimizations must also be enabled. The MASS
25065 libraries must be specified at link time.
25066
25067 -mfriz
25068 -mno-friz
25069 Generate (do not generate) the "friz" instruction when the
25070 -funsafe-math-optimizations option is used to optimize rounding of
25071 floating-point values to 64-bit integer and back to floating point.
25072 The "friz" instruction does not return the same value if the
25073 floating-point number is too large to fit in an integer.
25074
25075 -mpointers-to-nested-functions
25076 -mno-pointers-to-nested-functions
25077 Generate (do not generate) code to load up the static chain
25078 register ("r11") when calling through a pointer on AIX and 64-bit
25079 Linux systems where a function pointer points to a 3-word
25080 descriptor giving the function address, TOC value to be loaded in
25081 register "r2", and static chain value to be loaded in register
25082 "r11". The -mpointers-to-nested-functions is on by default. You
25083 cannot call through pointers to nested functions or pointers to
25084 functions compiled in other languages that use the static chain if
25085 you use -mno-pointers-to-nested-functions.
25086
25087 -msave-toc-indirect
25088 -mno-save-toc-indirect
25089 Generate (do not generate) code to save the TOC value in the
25090 reserved stack location in the function prologue if the function
25091 calls through a pointer on AIX and 64-bit Linux systems. If the
25092 TOC value is not saved in the prologue, it is saved just before the
25093 call through the pointer. The -mno-save-toc-indirect option is the
25094 default.
25095
25096 -mcompat-align-parm
25097 -mno-compat-align-parm
25098 Generate (do not generate) code to pass structure parameters with a
25099 maximum alignment of 64 bits, for compatibility with older versions
25100 of GCC.
25101
25102 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25103 structure parameter on a 128-bit boundary when that structure
25104 contained a member requiring 128-bit alignment. This is corrected
25105 in more recent versions of GCC. This option may be used to
25106 generate code that is compatible with functions compiled with older
25107 versions of GCC.
25108
25109 The -mno-compat-align-parm option is the default.
25110
25111 -mstack-protector-guard=guard
25112 -mstack-protector-guard-reg=reg
25113 -mstack-protector-guard-offset=offset
25114 -mstack-protector-guard-symbol=symbol
25115 Generate stack protection code using canary at guard. Supported
25116 locations are global for global canary or tls for per-thread canary
25117 in the TLS block (the default with GNU libc version 2.4 or later).
25118
25119 With the latter choice the options -mstack-protector-guard-reg=reg
25120 and -mstack-protector-guard-offset=offset furthermore specify which
25121 register to use as base register for reading the canary, and from
25122 what offset from that base register. The default for those is as
25123 specified in the relevant ABI.
25124 -mstack-protector-guard-symbol=symbol overrides the offset with a
25125 symbol reference to a canary in the TLS block.
25126
25127 -mpcrel
25128 -mno-pcrel
25129 Generate (do not generate) pc-relative addressing. The -mpcrel
25130 option requires that the medium code model (-mcmodel=medium) and
25131 prefixed addressing (-mprefixed) options are enabled.
25132
25133 -mprefixed
25134 -mno-prefixed
25135 Generate (do not generate) addressing modes using prefixed load and
25136 store instructions. The -mprefixed option requires that the option
25137 -mcpu=power10 (or later) is enabled.
25138
25139 -mmma
25140 -mno-mma
25141 Generate (do not generate) the MMA instructions. The -mma option
25142 requires that the option -mcpu=power10 (or later) is enabled.
25143
25144 -mrop-protect
25145 -mno-rop-protect
25146 Generate (do not generate) ROP protection instructions when the
25147 target processor supports them. Currently this option disables the
25148 shrink-wrap optimization (-fshrink-wrap).
25149
25150 -mprivileged
25151 -mno-privileged
25152 Generate (do not generate) code that will run in privileged state.
25153
25154 -mblock-ops-unaligned-vsx
25155 -mno-block-ops-unaligned-vsx
25156 Generate (do not generate) unaligned vsx loads and stores for
25157 inline expansion of "memcpy" and "memmove".
25158
25159 RX Options
25160
25161 These command-line options are defined for RX targets:
25162
25163 -m64bit-doubles
25164 -m32bit-doubles
25165 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
25166 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
25167 RX floating-point hardware only works on 32-bit values, which is
25168 why the default is -m32bit-doubles.
25169
25170 -fpu
25171 -nofpu
25172 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
25173 hardware. The default is enabled for the RX600 series and disabled
25174 for the RX200 series.
25175
25176 Floating-point instructions are only generated for 32-bit floating-
25177 point values, however, so the FPU hardware is not used for doubles
25178 if the -m64bit-doubles option is used.
25179
25180 Note If the -fpu option is enabled then -funsafe-math-optimizations
25181 is also enabled automatically. This is because the RX FPU
25182 instructions are themselves unsafe.
25183
25184 -mcpu=name
25185 Selects the type of RX CPU to be targeted. Currently three types
25186 are supported, the generic RX600 and RX200 series hardware and the
25187 specific RX610 CPU. The default is RX600.
25188
25189 The only difference between RX600 and RX610 is that the RX610 does
25190 not support the "MVTIPL" instruction.
25191
25192 The RX200 series does not have a hardware floating-point unit and
25193 so -nofpu is enabled by default when this type is selected.
25194
25195 -mbig-endian-data
25196 -mlittle-endian-data
25197 Store data (but not code) in the big-endian format. The default is
25198 -mlittle-endian-data, i.e. to store data in the little-endian
25199 format.
25200
25201 -msmall-data-limit=N
25202 Specifies the maximum size in bytes of global and static variables
25203 which can be placed into the small data area. Using the small data
25204 area can lead to smaller and faster code, but the size of area is
25205 limited and it is up to the programmer to ensure that the area does
25206 not overflow. Also when the small data area is used one of the
25207 RX's registers (usually "r13") is reserved for use pointing to this
25208 area, so it is no longer available for use by the compiler. This
25209 could result in slower and/or larger code if variables are pushed
25210 onto the stack instead of being held in this register.
25211
25212 Note, common variables (variables that have not been initialized)
25213 and constants are not placed into the small data area as they are
25214 assigned to other sections in the output executable.
25215
25216 The default value is zero, which disables this feature. Note, this
25217 feature is not enabled by default with higher optimization levels
25218 (-O2 etc) because of the potentially detrimental effects of
25219 reserving a register. It is up to the programmer to experiment and
25220 discover whether this feature is of benefit to their program. See
25221 the description of the -mpid option for a description of how the
25222 actual register to hold the small data area pointer is chosen.
25223
25224 -msim
25225 -mno-sim
25226 Use the simulator runtime. The default is to use the libgloss
25227 board-specific runtime.
25228
25229 -mas100-syntax
25230 -mno-as100-syntax
25231 When generating assembler output use a syntax that is compatible
25232 with Renesas's AS100 assembler. This syntax can also be handled by
25233 the GAS assembler, but it has some restrictions so it is not
25234 generated by default.
25235
25236 -mmax-constant-size=N
25237 Specifies the maximum size, in bytes, of a constant that can be
25238 used as an operand in a RX instruction. Although the RX
25239 instruction set does allow constants of up to 4 bytes in length to
25240 be used in instructions, a longer value equates to a longer
25241 instruction. Thus in some circumstances it can be beneficial to
25242 restrict the size of constants that are used in instructions.
25243 Constants that are too big are instead placed into a constant pool
25244 and referenced via register indirection.
25245
25246 The value N can be between 0 and 4. A value of 0 (the default) or
25247 4 means that constants of any size are allowed.
25248
25249 -mrelax
25250 Enable linker relaxation. Linker relaxation is a process whereby
25251 the linker attempts to reduce the size of a program by finding
25252 shorter versions of various instructions. Disabled by default.
25253
25254 -mint-register=N
25255 Specify the number of registers to reserve for fast interrupt
25256 handler functions. The value N can be between 0 and 4. A value of
25257 1 means that register "r13" is reserved for the exclusive use of
25258 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
25259 value of 3 reserves "r13", "r12" and "r11", and a value of 4
25260 reserves "r13" through "r10". A value of 0, the default, does not
25261 reserve any registers.
25262
25263 -msave-acc-in-interrupts
25264 Specifies that interrupt handler functions should preserve the
25265 accumulator register. This is only necessary if normal code might
25266 use the accumulator register, for example because it performs
25267 64-bit multiplications. The default is to ignore the accumulator
25268 as this makes the interrupt handlers faster.
25269
25270 -mpid
25271 -mno-pid
25272 Enables the generation of position independent data. When enabled
25273 any access to constant data is done via an offset from a base
25274 address held in a register. This allows the location of constant
25275 data to be determined at run time without requiring the executable
25276 to be relocated, which is a benefit to embedded applications with
25277 tight memory constraints. Data that can be modified is not
25278 affected by this option.
25279
25280 Note, using this feature reserves a register, usually "r13", for
25281 the constant data base address. This can result in slower and/or
25282 larger code, especially in complicated functions.
25283
25284 The actual register chosen to hold the constant data base address
25285 depends upon whether the -msmall-data-limit and/or the
25286 -mint-register command-line options are enabled. Starting with
25287 register "r13" and proceeding downwards, registers are allocated
25288 first to satisfy the requirements of -mint-register, then -mpid and
25289 finally -msmall-data-limit. Thus it is possible for the small data
25290 area register to be "r8" if both -mint-register=4 and -mpid are
25291 specified on the command line.
25292
25293 By default this feature is not enabled. The default can be
25294 restored via the -mno-pid command-line option.
25295
25296 -mno-warn-multiple-fast-interrupts
25297 -mwarn-multiple-fast-interrupts
25298 Prevents GCC from issuing a warning message if it finds more than
25299 one fast interrupt handler when it is compiling a file. The
25300 default is to issue a warning for each extra fast interrupt handler
25301 found, as the RX only supports one such interrupt.
25302
25303 -mallow-string-insns
25304 -mno-allow-string-insns
25305 Enables or disables the use of the string manipulation instructions
25306 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
25307 "RMPA" instruction. These instructions may prefetch data, which is
25308 not safe to do if accessing an I/O register. (See section 12.2.7
25309 of the RX62N Group User's Manual for more information).
25310
25311 The default is to allow these instructions, but it is not possible
25312 for GCC to reliably detect all circumstances where a string
25313 instruction might be used to access an I/O register, so their use
25314 cannot be disabled automatically. Instead it is reliant upon the
25315 programmer to use the -mno-allow-string-insns option if their
25316 program accesses I/O space.
25317
25318 When the instructions are enabled GCC defines the C preprocessor
25319 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
25320 "__RX_DISALLOW_STRING_INSNS__".
25321
25322 -mjsr
25323 -mno-jsr
25324 Use only (or not only) "JSR" instructions to access functions.
25325 This option can be used when code size exceeds the range of "BSR"
25326 instructions. Note that -mno-jsr does not mean to not use "JSR"
25327 but instead means that any type of branch may be used.
25328
25329 Note: The generic GCC command-line option -ffixed-reg has special
25330 significance to the RX port when used with the "interrupt" function
25331 attribute. This attribute indicates a function intended to process
25332 fast interrupts. GCC ensures that it only uses the registers "r10",
25333 "r11", "r12" and/or "r13" and only provided that the normal use of the
25334 corresponding registers have been restricted via the -ffixed-reg or
25335 -mint-register command-line options.
25336
25337 S/390 and zSeries Options
25338
25339 These are the -m options defined for the S/390 and zSeries
25340 architecture.
25341
25342 -mhard-float
25343 -msoft-float
25344 Use (do not use) the hardware floating-point instructions and
25345 registers for floating-point operations. When -msoft-float is
25346 specified, functions in libgcc.a are used to perform floating-point
25347 operations. When -mhard-float is specified, the compiler generates
25348 IEEE floating-point instructions. This is the default.
25349
25350 -mhard-dfp
25351 -mno-hard-dfp
25352 Use (do not use) the hardware decimal-floating-point instructions
25353 for decimal-floating-point operations. When -mno-hard-dfp is
25354 specified, functions in libgcc.a are used to perform decimal-
25355 floating-point operations. When -mhard-dfp is specified, the
25356 compiler generates decimal-floating-point hardware instructions.
25357 This is the default for -march=z9-ec or higher.
25358
25359 -mlong-double-64
25360 -mlong-double-128
25361 These switches control the size of "long double" type. A size of 64
25362 bits makes the "long double" type equivalent to the "double" type.
25363 This is the default.
25364
25365 -mbackchain
25366 -mno-backchain
25367 Store (do not store) the address of the caller's frame as backchain
25368 pointer into the callee's stack frame. A backchain may be needed
25369 to allow debugging using tools that do not understand DWARF call
25370 frame information. When -mno-packed-stack is in effect, the
25371 backchain pointer is stored at the bottom of the stack frame; when
25372 -mpacked-stack is in effect, the backchain is placed into the
25373 topmost word of the 96/160 byte register save area.
25374
25375 In general, code compiled with -mbackchain is call-compatible with
25376 code compiled with -mno-backchain; however, use of the backchain
25377 for debugging purposes usually requires that the whole binary is
25378 built with -mbackchain. Note that the combination of -mbackchain,
25379 -mpacked-stack and -mhard-float is not supported. In order to
25380 build a linux kernel use -msoft-float.
25381
25382 The default is to not maintain the backchain.
25383
25384 -mpacked-stack
25385 -mno-packed-stack
25386 Use (do not use) the packed stack layout. When -mno-packed-stack
25387 is specified, the compiler uses the all fields of the 96/160 byte
25388 register save area only for their default purpose; unused fields
25389 still take up stack space. When -mpacked-stack is specified,
25390 register save slots are densely packed at the top of the register
25391 save area; unused space is reused for other purposes, allowing for
25392 more efficient use of the available stack space. However, when
25393 -mbackchain is also in effect, the topmost word of the save area is
25394 always used to store the backchain, and the return address register
25395 is always saved two words below the backchain.
25396
25397 As long as the stack frame backchain is not used, code generated
25398 with -mpacked-stack is call-compatible with code generated with
25399 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
25400 S/390 or zSeries generated code that uses the stack frame backchain
25401 at run time, not just for debugging purposes. Such code is not
25402 call-compatible with code compiled with -mpacked-stack. Also, note
25403 that the combination of -mbackchain, -mpacked-stack and
25404 -mhard-float is not supported. In order to build a linux kernel
25405 use -msoft-float.
25406
25407 The default is to not use the packed stack layout.
25408
25409 -msmall-exec
25410 -mno-small-exec
25411 Generate (or do not generate) code using the "bras" instruction to
25412 do subroutine calls. This only works reliably if the total
25413 executable size does not exceed 64k. The default is to use the
25414 "basr" instruction instead, which does not have this limitation.
25415
25416 -m64
25417 -m31
25418 When -m31 is specified, generate code compliant to the GNU/Linux
25419 for S/390 ABI. When -m64 is specified, generate code compliant to
25420 the GNU/Linux for zSeries ABI. This allows GCC in particular to
25421 generate 64-bit instructions. For the s390 targets, the default is
25422 -m31, while the s390x targets default to -m64.
25423
25424 -mzarch
25425 -mesa
25426 When -mzarch is specified, generate code using the instructions
25427 available on z/Architecture. When -mesa is specified, generate
25428 code using the instructions available on ESA/390. Note that -mesa
25429 is not possible with -m64. When generating code compliant to the
25430 GNU/Linux for S/390 ABI, the default is -mesa. When generating
25431 code compliant to the GNU/Linux for zSeries ABI, the default is
25432 -mzarch.
25433
25434 -mhtm
25435 -mno-htm
25436 The -mhtm option enables a set of builtins making use of
25437 instructions available with the transactional execution facility
25438 introduced with the IBM zEnterprise EC12 machine generation S/390
25439 System z Built-in Functions. -mhtm is enabled by default when
25440 using -march=zEC12.
25441
25442 -mvx
25443 -mno-vx
25444 When -mvx is specified, generate code using the instructions
25445 available with the vector extension facility introduced with the
25446 IBM z13 machine generation. This option changes the ABI for some
25447 vector type values with regard to alignment and calling
25448 conventions. In case vector type values are being used in an ABI-
25449 relevant context a GAS .gnu_attribute command will be added to mark
25450 the resulting binary with the ABI used. -mvx is enabled by default
25451 when using -march=z13.
25452
25453 -mzvector
25454 -mno-zvector
25455 The -mzvector option enables vector language extensions and
25456 builtins using instructions available with the vector extension
25457 facility introduced with the IBM z13 machine generation. This
25458 option adds support for vector to be used as a keyword to define
25459 vector type variables and arguments. vector is only available when
25460 GNU extensions are enabled. It will not be expanded when
25461 requesting strict standard compliance e.g. with -std=c99. In
25462 addition to the GCC low-level builtins -mzvector enables a set of
25463 builtins added for compatibility with AltiVec-style implementations
25464 like Power and Cell. In order to make use of these builtins the
25465 header file vecintrin.h needs to be included. -mzvector is
25466 disabled by default.
25467
25468 -mmvcle
25469 -mno-mvcle
25470 Generate (or do not generate) code using the "mvcle" instruction to
25471 perform block moves. When -mno-mvcle is specified, use a "mvc"
25472 loop instead. This is the default unless optimizing for size.
25473
25474 -mdebug
25475 -mno-debug
25476 Print (or do not print) additional debug information when
25477 compiling. The default is to not print debug information.
25478
25479 -march=cpu-type
25480 Generate code that runs on cpu-type, which is the name of a system
25481 representing a certain processor type. Possible values for cpu-
25482 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
25483 z196/arch9, zEC12, z13/arch11, z14/arch12, z15/arch13, z16/arch14,
25484 and native.
25485
25486 The default is -march=z900.
25487
25488 Specifying native as cpu type can be used to select the best
25489 architecture option for the host processor. -march=native has no
25490 effect if GCC does not recognize the processor.
25491
25492 -mtune=cpu-type
25493 Tune to cpu-type everything applicable about the generated code,
25494 except for the ABI and the set of available instructions. The list
25495 of cpu-type values is the same as for -march. The default is the
25496 value used for -march.
25497
25498 -mtpf-trace
25499 -mno-tpf-trace
25500 Generate code that adds (does not add) in TPF OS specific branches
25501 to trace routines in the operating system. This option is off by
25502 default, even when compiling for the TPF OS.
25503
25504 -mtpf-trace-skip
25505 -mno-tpf-trace-skip
25506 Generate code that changes (does not change) the default branch
25507 targets enabled by -mtpf-trace to point to specialized trace
25508 routines providing the ability of selectively skipping function
25509 trace entries for the TPF OS. This option is off by default, even
25510 when compiling for the TPF OS and specifying -mtpf-trace.
25511
25512 -mfused-madd
25513 -mno-fused-madd
25514 Generate code that uses (does not use) the floating-point multiply
25515 and accumulate instructions. These instructions are generated by
25516 default if hardware floating point is used.
25517
25518 -mwarn-framesize=framesize
25519 Emit a warning if the current function exceeds the given frame
25520 size. Because this is a compile-time check it doesn't need to be a
25521 real problem when the program runs. It is intended to identify
25522 functions that most probably cause a stack overflow. It is useful
25523 to be used in an environment with limited stack size e.g. the linux
25524 kernel.
25525
25526 -mwarn-dynamicstack
25527 Emit a warning if the function calls "alloca" or uses dynamically-
25528 sized arrays. This is generally a bad idea with a limited stack
25529 size.
25530
25531 -mstack-guard=stack-guard
25532 -mstack-size=stack-size
25533 If these options are provided the S/390 back end emits additional
25534 instructions in the function prologue that trigger a trap if the
25535 stack size is stack-guard bytes above the stack-size (remember that
25536 the stack on S/390 grows downward). If the stack-guard option is
25537 omitted the smallest power of 2 larger than the frame size of the
25538 compiled function is chosen. These options are intended to be used
25539 to help debugging stack overflow problems. The additionally
25540 emitted code causes only little overhead and hence can also be used
25541 in production-like systems without greater performance degradation.
25542 The given values have to be exact powers of 2 and stack-size has to
25543 be greater than stack-guard without exceeding 64k. In order to be
25544 efficient the extra code makes the assumption that the stack starts
25545 at an address aligned to the value given by stack-size. The stack-
25546 guard option can only be used in conjunction with stack-size.
25547
25548 -mhotpatch=pre-halfwords,post-halfwords
25549 If the hotpatch option is enabled, a "hot-patching" function
25550 prologue is generated for all functions in the compilation unit.
25551 The funtion label is prepended with the given number of two-byte
25552 NOP instructions (pre-halfwords, maximum 1000000). After the
25553 label, 2 * post-halfwords bytes are appended, using the largest NOP
25554 like instructions the architecture allows (maximum 1000000).
25555
25556 If both arguments are zero, hotpatching is disabled.
25557
25558 This option can be overridden for individual functions with the
25559 "hotpatch" attribute.
25560
25561 Score Options
25562
25563 These options are defined for Score implementations:
25564
25565 -meb
25566 Compile code for big-endian mode. This is the default.
25567
25568 -mel
25569 Compile code for little-endian mode.
25570
25571 -mnhwloop
25572 Disable generation of "bcnz" instructions.
25573
25574 -muls
25575 Enable generation of unaligned load and store instructions.
25576
25577 -mmac
25578 Enable the use of multiply-accumulate instructions. Disabled by
25579 default.
25580
25581 -mscore5
25582 Specify the SCORE5 as the target architecture.
25583
25584 -mscore5u
25585 Specify the SCORE5U of the target architecture.
25586
25587 -mscore7
25588 Specify the SCORE7 as the target architecture. This is the default.
25589
25590 -mscore7d
25591 Specify the SCORE7D as the target architecture.
25592
25593 SH Options
25594
25595 These -m options are defined for the SH implementations:
25596
25597 -m1 Generate code for the SH1.
25598
25599 -m2 Generate code for the SH2.
25600
25601 -m2e
25602 Generate code for the SH2e.
25603
25604 -m2a-nofpu
25605 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
25606 way that the floating-point unit is not used.
25607
25608 -m2a-single-only
25609 Generate code for the SH2a-FPU, in such a way that no double-
25610 precision floating-point operations are used.
25611
25612 -m2a-single
25613 Generate code for the SH2a-FPU assuming the floating-point unit is
25614 in single-precision mode by default.
25615
25616 -m2a
25617 Generate code for the SH2a-FPU assuming the floating-point unit is
25618 in double-precision mode by default.
25619
25620 -m3 Generate code for the SH3.
25621
25622 -m3e
25623 Generate code for the SH3e.
25624
25625 -m4-nofpu
25626 Generate code for the SH4 without a floating-point unit.
25627
25628 -m4-single-only
25629 Generate code for the SH4 with a floating-point unit that only
25630 supports single-precision arithmetic.
25631
25632 -m4-single
25633 Generate code for the SH4 assuming the floating-point unit is in
25634 single-precision mode by default.
25635
25636 -m4 Generate code for the SH4.
25637
25638 -m4-100
25639 Generate code for SH4-100.
25640
25641 -m4-100-nofpu
25642 Generate code for SH4-100 in such a way that the floating-point
25643 unit is not used.
25644
25645 -m4-100-single
25646 Generate code for SH4-100 assuming the floating-point unit is in
25647 single-precision mode by default.
25648
25649 -m4-100-single-only
25650 Generate code for SH4-100 in such a way that no double-precision
25651 floating-point operations are used.
25652
25653 -m4-200
25654 Generate code for SH4-200.
25655
25656 -m4-200-nofpu
25657 Generate code for SH4-200 without in such a way that the floating-
25658 point unit is not used.
25659
25660 -m4-200-single
25661 Generate code for SH4-200 assuming the floating-point unit is in
25662 single-precision mode by default.
25663
25664 -m4-200-single-only
25665 Generate code for SH4-200 in such a way that no double-precision
25666 floating-point operations are used.
25667
25668 -m4-300
25669 Generate code for SH4-300.
25670
25671 -m4-300-nofpu
25672 Generate code for SH4-300 without in such a way that the floating-
25673 point unit is not used.
25674
25675 -m4-300-single
25676 Generate code for SH4-300 in such a way that no double-precision
25677 floating-point operations are used.
25678
25679 -m4-300-single-only
25680 Generate code for SH4-300 in such a way that no double-precision
25681 floating-point operations are used.
25682
25683 -m4-340
25684 Generate code for SH4-340 (no MMU, no FPU).
25685
25686 -m4-500
25687 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
25688 assembler.
25689
25690 -m4a-nofpu
25691 Generate code for the SH4al-dsp, or for a SH4a in such a way that
25692 the floating-point unit is not used.
25693
25694 -m4a-single-only
25695 Generate code for the SH4a, in such a way that no double-precision
25696 floating-point operations are used.
25697
25698 -m4a-single
25699 Generate code for the SH4a assuming the floating-point unit is in
25700 single-precision mode by default.
25701
25702 -m4a
25703 Generate code for the SH4a.
25704
25705 -m4al
25706 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
25707 assembler. GCC doesn't generate any DSP instructions at the
25708 moment.
25709
25710 -mb Compile code for the processor in big-endian mode.
25711
25712 -ml Compile code for the processor in little-endian mode.
25713
25714 -mdalign
25715 Align doubles at 64-bit boundaries. Note that this changes the
25716 calling conventions, and thus some functions from the standard C
25717 library do not work unless you recompile it first with -mdalign.
25718
25719 -mrelax
25720 Shorten some address references at link time, when possible; uses
25721 the linker option -relax.
25722
25723 -mbigtable
25724 Use 32-bit offsets in "switch" tables. The default is to use
25725 16-bit offsets.
25726
25727 -mbitops
25728 Enable the use of bit manipulation instructions on SH2A.
25729
25730 -mfmovd
25731 Enable the use of the instruction "fmovd". Check -mdalign for
25732 alignment constraints.
25733
25734 -mrenesas
25735 Comply with the calling conventions defined by Renesas.
25736
25737 -mno-renesas
25738 Comply with the calling conventions defined for GCC before the
25739 Renesas conventions were available. This option is the default for
25740 all targets of the SH toolchain.
25741
25742 -mnomacsave
25743 Mark the "MAC" register as call-clobbered, even if -mrenesas is
25744 given.
25745
25746 -mieee
25747 -mno-ieee
25748 Control the IEEE compliance of floating-point comparisons, which
25749 affects the handling of cases where the result of a comparison is
25750 unordered. By default -mieee is implicitly enabled. If
25751 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
25752 results in faster floating-point greater-equal and less-equal
25753 comparisons. The implicit settings can be overridden by specifying
25754 either -mieee or -mno-ieee.
25755
25756 -minline-ic_invalidate
25757 Inline code to invalidate instruction cache entries after setting
25758 up nested function trampolines. This option has no effect if
25759 -musermode is in effect and the selected code generation option
25760 (e.g. -m4) does not allow the use of the "icbi" instruction. If
25761 the selected code generation option does not allow the use of the
25762 "icbi" instruction, and -musermode is not in effect, the inlined
25763 code manipulates the instruction cache address array directly with
25764 an associative write. This not only requires privileged mode at
25765 run time, but it also fails if the cache line had been mapped via
25766 the TLB and has become unmapped.
25767
25768 -misize
25769 Dump instruction size and location in the assembly code.
25770
25771 -mpadstruct
25772 This option is deprecated. It pads structures to multiple of 4
25773 bytes, which is incompatible with the SH ABI.
25774
25775 -matomic-model=model
25776 Sets the model of atomic operations and additional parameters as a
25777 comma separated list. For details on the atomic built-in functions
25778 see __atomic Builtins. The following models and parameters are
25779 supported:
25780
25781 none
25782 Disable compiler generated atomic sequences and emit library
25783 calls for atomic operations. This is the default if the target
25784 is not "sh*-*-linux*".
25785
25786 soft-gusa
25787 Generate GNU/Linux compatible gUSA software atomic sequences
25788 for the atomic built-in functions. The generated atomic
25789 sequences require additional support from the
25790 interrupt/exception handling code of the system and are only
25791 suitable for SH3* and SH4* single-core systems. This option is
25792 enabled by default when the target is "sh*-*-linux*" and SH3*
25793 or SH4*. When the target is SH4A, this option also partially
25794 utilizes the hardware atomic instructions "movli.l" and
25795 "movco.l" to create more efficient code, unless strict is
25796 specified.
25797
25798 soft-tcb
25799 Generate software atomic sequences that use a variable in the
25800 thread control block. This is a variation of the gUSA
25801 sequences which can also be used on SH1* and SH2* targets. The
25802 generated atomic sequences require additional support from the
25803 interrupt/exception handling code of the system and are only
25804 suitable for single-core systems. When using this model, the
25805 gbr-offset= parameter has to be specified as well.
25806
25807 soft-imask
25808 Generate software atomic sequences that temporarily disable
25809 interrupts by setting "SR.IMASK = 1111". This model works only
25810 when the program runs in privileged mode and is only suitable
25811 for single-core systems. Additional support from the
25812 interrupt/exception handling code of the system is not
25813 required. This model is enabled by default when the target is
25814 "sh*-*-linux*" and SH1* or SH2*.
25815
25816 hard-llcs
25817 Generate hardware atomic sequences using the "movli.l" and
25818 "movco.l" instructions only. This is only available on SH4A
25819 and is suitable for multi-core systems. Since the hardware
25820 instructions support only 32 bit atomic variables access to 8
25821 or 16 bit variables is emulated with 32 bit accesses. Code
25822 compiled with this option is also compatible with other
25823 software atomic model interrupt/exception handling systems if
25824 executed on an SH4A system. Additional support from the
25825 interrupt/exception handling code of the system is not required
25826 for this model.
25827
25828 gbr-offset=
25829 This parameter specifies the offset in bytes of the variable in
25830 the thread control block structure that should be used by the
25831 generated atomic sequences when the soft-tcb model has been
25832 selected. For other models this parameter is ignored. The
25833 specified value must be an integer multiple of four and in the
25834 range 0-1020.
25835
25836 strict
25837 This parameter prevents mixed usage of multiple atomic models,
25838 even if they are compatible, and makes the compiler generate
25839 atomic sequences of the specified model only.
25840
25841 -mtas
25842 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
25843 that depending on the particular hardware and software
25844 configuration this can degrade overall performance due to the
25845 operand cache line flushes that are implied by the "tas.b"
25846 instruction. On multi-core SH4A processors the "tas.b" instruction
25847 must be used with caution since it can result in data corruption
25848 for certain cache configurations.
25849
25850 -mprefergot
25851 When generating position-independent code, emit function calls
25852 using the Global Offset Table instead of the Procedure Linkage
25853 Table.
25854
25855 -musermode
25856 -mno-usermode
25857 Don't allow (allow) the compiler generating privileged mode code.
25858 Specifying -musermode also implies -mno-inline-ic_invalidate if the
25859 inlined code would not work in user mode. -musermode is the
25860 default when the target is "sh*-*-linux*". If the target is SH1*
25861 or SH2* -musermode has no effect, since there is no user mode.
25862
25863 -multcost=number
25864 Set the cost to assume for a multiply insn.
25865
25866 -mdiv=strategy
25867 Set the division strategy to be used for integer division
25868 operations. strategy can be one of:
25869
25870 call-div1
25871 Calls a library function that uses the single-step division
25872 instruction "div1" to perform the operation. Division by zero
25873 calculates an unspecified result and does not trap. This is
25874 the default except for SH4, SH2A and SHcompact.
25875
25876 call-fp
25877 Calls a library function that performs the operation in double
25878 precision floating point. Division by zero causes a floating-
25879 point exception. This is the default for SHcompact with FPU.
25880 Specifying this for targets that do not have a double precision
25881 FPU defaults to "call-div1".
25882
25883 call-table
25884 Calls a library function that uses a lookup table for small
25885 divisors and the "div1" instruction with case distinction for
25886 larger divisors. Division by zero calculates an unspecified
25887 result and does not trap. This is the default for SH4.
25888 Specifying this for targets that do not have dynamic shift
25889 instructions defaults to "call-div1".
25890
25891 When a division strategy has not been specified the default
25892 strategy is selected based on the current target. For SH2A the
25893 default strategy is to use the "divs" and "divu" instructions
25894 instead of library function calls.
25895
25896 -maccumulate-outgoing-args
25897 Reserve space once for outgoing arguments in the function prologue
25898 rather than around each call. Generally beneficial for performance
25899 and size. Also needed for unwinding to avoid changing the stack
25900 frame around conditional code.
25901
25902 -mdivsi3_libfunc=name
25903 Set the name of the library function used for 32-bit signed
25904 division to name. This only affects the name used in the call
25905 division strategies, and the compiler still expects the same sets
25906 of input/output/clobbered registers as if this option were not
25907 present.
25908
25909 -mfixed-range=register-range
25910 Generate code treating the given register range as fixed registers.
25911 A fixed register is one that the register allocator cannot use.
25912 This is useful when compiling kernel code. A register range is
25913 specified as two registers separated by a dash. Multiple register
25914 ranges can be specified separated by a comma.
25915
25916 -mbranch-cost=num
25917 Assume num to be the cost for a branch instruction. Higher numbers
25918 make the compiler try to generate more branch-free code if
25919 possible. If not specified the value is selected depending on the
25920 processor type that is being compiled for.
25921
25922 -mzdcbranch
25923 -mno-zdcbranch
25924 Assume (do not assume) that zero displacement conditional branch
25925 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
25926 the compiler prefers zero displacement branch code sequences. This
25927 is enabled by default when generating code for SH4 and SH4A. It
25928 can be explicitly disabled by specifying -mno-zdcbranch.
25929
25930 -mcbranch-force-delay-slot
25931 Force the usage of delay slots for conditional branches, which
25932 stuffs the delay slot with a "nop" if a suitable instruction cannot
25933 be found. By default this option is disabled. It can be enabled
25934 to work around hardware bugs as found in the original SH7055.
25935
25936 -mfused-madd
25937 -mno-fused-madd
25938 Generate code that uses (does not use) the floating-point multiply
25939 and accumulate instructions. These instructions are generated by
25940 default if hardware floating point is used. The machine-dependent
25941 -mfused-madd option is now mapped to the machine-independent
25942 -ffp-contract=fast option, and -mno-fused-madd is mapped to
25943 -ffp-contract=off.
25944
25945 -mfsca
25946 -mno-fsca
25947 Allow or disallow the compiler to emit the "fsca" instruction for
25948 sine and cosine approximations. The option -mfsca must be used in
25949 combination with -funsafe-math-optimizations. It is enabled by
25950 default when generating code for SH4A. Using -mno-fsca disables
25951 sine and cosine approximations even if -funsafe-math-optimizations
25952 is in effect.
25953
25954 -mfsrra
25955 -mno-fsrra
25956 Allow or disallow the compiler to emit the "fsrra" instruction for
25957 reciprocal square root approximations. The option -mfsrra must be
25958 used in combination with -funsafe-math-optimizations and
25959 -ffinite-math-only. It is enabled by default when generating code
25960 for SH4A. Using -mno-fsrra disables reciprocal square root
25961 approximations even if -funsafe-math-optimizations and
25962 -ffinite-math-only are in effect.
25963
25964 -mpretend-cmove
25965 Prefer zero-displacement conditional branches for conditional move
25966 instruction patterns. This can result in faster code on the SH4
25967 processor.
25968
25969 -mfdpic
25970 Generate code using the FDPIC ABI.
25971
25972 Solaris 2 Options
25973
25974 These -m options are supported on Solaris 2:
25975
25976 -mclear-hwcap
25977 -mclear-hwcap tells the compiler to remove the hardware
25978 capabilities generated by the Solaris assembler. This is only
25979 necessary when object files use ISA extensions not supported by the
25980 current machine, but check at runtime whether or not to use them.
25981
25982 -mimpure-text
25983 -mimpure-text, used in addition to -shared, tells the compiler to
25984 not pass -z text to the linker when linking a shared object. Using
25985 this option, you can link position-dependent code into a shared
25986 object.
25987
25988 -mimpure-text suppresses the "relocations remain against
25989 allocatable but non-writable sections" linker error message.
25990 However, the necessary relocations trigger copy-on-write, and the
25991 shared object is not actually shared across processes. Instead of
25992 using -mimpure-text, you should compile all source code with -fpic
25993 or -fPIC.
25994
25995 These switches are supported in addition to the above on Solaris 2:
25996
25997 -pthreads
25998 This is a synonym for -pthread.
25999
26000 SPARC Options
26001
26002 These -m options are supported on the SPARC:
26003
26004 -mno-app-regs
26005 -mapp-regs
26006 Specify -mapp-regs to generate output using the global registers 2
26007 through 4, which the SPARC SVR4 ABI reserves for applications.
26008 Like the global register 1, each global register 2 through 4 is
26009 then treated as an allocable register that is clobbered by function
26010 calls. This is the default.
26011
26012 To be fully SVR4 ABI-compliant at the cost of some performance
26013 loss, specify -mno-app-regs. You should compile libraries and
26014 system software with this option.
26015
26016 -mflat
26017 -mno-flat
26018 With -mflat, the compiler does not generate save/restore
26019 instructions and uses a "flat" or single register window model.
26020 This model is compatible with the regular register window model.
26021 The local registers and the input registers (0--5) are still
26022 treated as "call-saved" registers and are saved on the stack as
26023 needed.
26024
26025 With -mno-flat (the default), the compiler generates save/restore
26026 instructions (except for leaf functions). This is the normal
26027 operating mode.
26028
26029 -mfpu
26030 -mhard-float
26031 Generate output containing floating-point instructions. This is
26032 the default.
26033
26034 -mno-fpu
26035 -msoft-float
26036 Generate output containing library calls for floating point.
26037 Warning: the requisite libraries are not available for all SPARC
26038 targets. Normally the facilities of the machine's usual C compiler
26039 are used, but this cannot be done directly in cross-compilation.
26040 You must make your own arrangements to provide suitable library
26041 functions for cross-compilation. The embedded targets sparc-*-aout
26042 and sparclite-*-* do provide software floating-point support.
26043
26044 -msoft-float changes the calling convention in the output file;
26045 therefore, it is only useful if you compile all of a program with
26046 this option. In particular, you need to compile libgcc.a, the
26047 library that comes with GCC, with -msoft-float in order for this to
26048 work.
26049
26050 -mhard-quad-float
26051 Generate output containing quad-word (long double) floating-point
26052 instructions.
26053
26054 -msoft-quad-float
26055 Generate output containing library calls for quad-word (long
26056 double) floating-point instructions. The functions called are
26057 those specified in the SPARC ABI. This is the default.
26058
26059 As of this writing, there are no SPARC implementations that have
26060 hardware support for the quad-word floating-point instructions.
26061 They all invoke a trap handler for one of these instructions, and
26062 then the trap handler emulates the effect of the instruction.
26063 Because of the trap handler overhead, this is much slower than
26064 calling the ABI library routines. Thus the -msoft-quad-float
26065 option is the default.
26066
26067 -mno-unaligned-doubles
26068 -munaligned-doubles
26069 Assume that doubles have 8-byte alignment. This is the default.
26070
26071 With -munaligned-doubles, GCC assumes that doubles have 8-byte
26072 alignment only if they are contained in another type, or if they
26073 have an absolute address. Otherwise, it assumes they have 4-byte
26074 alignment. Specifying this option avoids some rare compatibility
26075 problems with code generated by other compilers. It is not the
26076 default because it results in a performance loss, especially for
26077 floating-point code.
26078
26079 -muser-mode
26080 -mno-user-mode
26081 Do not generate code that can only run in supervisor mode. This is
26082 relevant only for the "casa" instruction emitted for the LEON3
26083 processor. This is the default.
26084
26085 -mfaster-structs
26086 -mno-faster-structs
26087 With -mfaster-structs, the compiler assumes that structures should
26088 have 8-byte alignment. This enables the use of pairs of "ldd" and
26089 "std" instructions for copies in structure assignment, in place of
26090 twice as many "ld" and "st" pairs. However, the use of this
26091 changed alignment directly violates the SPARC ABI. Thus, it's
26092 intended only for use on targets where the developer acknowledges
26093 that their resulting code is not directly in line with the rules of
26094 the ABI.
26095
26096 -mstd-struct-return
26097 -mno-std-struct-return
26098 With -mstd-struct-return, the compiler generates checking code in
26099 functions returning structures or unions to detect size mismatches
26100 between the two sides of function calls, as per the 32-bit ABI.
26101
26102 The default is -mno-std-struct-return. This option has no effect
26103 in 64-bit mode.
26104
26105 -mlra
26106 -mno-lra
26107 Enable Local Register Allocation. This is the default for SPARC
26108 since GCC 7 so -mno-lra needs to be passed to get old Reload.
26109
26110 -mcpu=cpu_type
26111 Set the instruction set, register set, and instruction scheduling
26112 parameters for machine type cpu_type. Supported values for
26113 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
26114 leon3v7, leon5, sparclite, f930, f934, sparclite86x, sparclet,
26115 tsc701, v9, ultrasparc, ultrasparc3, niagara, niagara2, niagara3,
26116 niagara4, niagara7 and m8.
26117
26118 Native Solaris and GNU/Linux toolchains also support the value
26119 native, which selects the best architecture option for the host
26120 processor. -mcpu=native has no effect if GCC does not recognize
26121 the processor.
26122
26123 Default instruction scheduling parameters are used for values that
26124 select an architecture and not an implementation. These are v7,
26125 v8, sparclite, sparclet, v9.
26126
26127 Here is a list of each supported architecture and their supported
26128 implementations.
26129
26130 v7 cypress, leon3v7
26131
26132 v8 supersparc, hypersparc, leon, leon3, leon5
26133
26134 sparclite
26135 f930, f934, sparclite86x
26136
26137 sparclet
26138 tsc701
26139
26140 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26141 niagara7, m8
26142
26143 By default (unless configured otherwise), GCC generates code for
26144 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
26145 compiler additionally optimizes it for the Cypress CY7C602 chip, as
26146 used in the SPARCStation/SPARCServer 3xx series. This is also
26147 appropriate for the older SPARCStation 1, 2, IPX etc.
26148
26149 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
26150 architecture. The only difference from V7 code is that the
26151 compiler emits the integer multiply and integer divide instructions
26152 which exist in SPARC-V8 but not in SPARC-V7. With
26153 -mcpu=supersparc, the compiler additionally optimizes it for the
26154 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
26155 series.
26156
26157 With -mcpu=sparclite, GCC generates code for the SPARClite variant
26158 of the SPARC architecture. This adds the integer multiply, integer
26159 divide step and scan ("ffs") instructions which exist in SPARClite
26160 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
26161 optimizes it for the Fujitsu MB86930 chip, which is the original
26162 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
26163 optimizes it for the Fujitsu MB86934 chip, which is the more recent
26164 SPARClite with FPU.
26165
26166 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
26167 the SPARC architecture. This adds the integer multiply,
26168 multiply/accumulate, integer divide step and scan ("ffs")
26169 instructions which exist in SPARClet but not in SPARC-V7. With
26170 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
26171 SPARClet chip.
26172
26173 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
26174 architecture. This adds 64-bit integer and floating-point move
26175 instructions, 3 additional floating-point condition code registers
26176 and conditional move instructions. With -mcpu=ultrasparc, the
26177 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
26178 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
26179 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26180 -mcpu=niagara, the compiler additionally optimizes it for Sun
26181 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
26182 additionally optimizes it for Sun UltraSPARC T2 chips. With
26183 -mcpu=niagara3, the compiler additionally optimizes it for Sun
26184 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
26185 additionally optimizes it for Sun UltraSPARC T4 chips. With
26186 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
26187 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
26188 it for Oracle M8 chips.
26189
26190 -mtune=cpu_type
26191 Set the instruction scheduling parameters for machine type
26192 cpu_type, but do not set the instruction set or register set that
26193 the option -mcpu=cpu_type does.
26194
26195 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
26196 but the only useful values are those that select a particular CPU
26197 implementation. Those are cypress, supersparc, hypersparc, leon,
26198 leon3, leon3v7, leon5, f930, f934, sparclite86x, tsc701,
26199 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26200 niagara7 and m8. With native Solaris and GNU/Linux toolchains,
26201 native can also be used.
26202
26203 -mv8plus
26204 -mno-v8plus
26205 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
26206 difference from the V8 ABI is that the global and out registers are
26207 considered 64 bits wide. This is enabled by default on Solaris in
26208 32-bit mode for all SPARC-V9 processors.
26209
26210 -mvis
26211 -mno-vis
26212 With -mvis, GCC generates code that takes advantage of the
26213 UltraSPARC Visual Instruction Set extensions. The default is
26214 -mno-vis.
26215
26216 -mvis2
26217 -mno-vis2
26218 With -mvis2, GCC generates code that takes advantage of version 2.0
26219 of the UltraSPARC Visual Instruction Set extensions. The default
26220 is -mvis2 when targeting a cpu that supports such instructions,
26221 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
26222
26223 -mvis3
26224 -mno-vis3
26225 With -mvis3, GCC generates code that takes advantage of version 3.0
26226 of the UltraSPARC Visual Instruction Set extensions. The default
26227 is -mvis3 when targeting a cpu that supports such instructions,
26228 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
26229 -mvis.
26230
26231 -mvis4
26232 -mno-vis4
26233 With -mvis4, GCC generates code that takes advantage of version 4.0
26234 of the UltraSPARC Visual Instruction Set extensions. The default
26235 is -mvis4 when targeting a cpu that supports such instructions,
26236 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
26237 -mvis2 and -mvis.
26238
26239 -mvis4b
26240 -mno-vis4b
26241 With -mvis4b, GCC generates code that takes advantage of version
26242 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
26243 additional VIS instructions introduced in the Oracle SPARC
26244 Architecture 2017. The default is -mvis4b when targeting a cpu
26245 that supports such instructions, such as m8 and later. Setting
26246 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
26247
26248 -mcbcond
26249 -mno-cbcond
26250 With -mcbcond, GCC generates code that takes advantage of the
26251 UltraSPARC Compare-and-Branch-on-Condition instructions. The
26252 default is -mcbcond when targeting a CPU that supports such
26253 instructions, such as Niagara-4 and later.
26254
26255 -mfmaf
26256 -mno-fmaf
26257 With -mfmaf, GCC generates code that takes advantage of the
26258 UltraSPARC Fused Multiply-Add Floating-point instructions. The
26259 default is -mfmaf when targeting a CPU that supports such
26260 instructions, such as Niagara-3 and later.
26261
26262 -mfsmuld
26263 -mno-fsmuld
26264 With -mfsmuld, GCC generates code that takes advantage of the
26265 Floating-point Multiply Single to Double (FsMULd) instruction. The
26266 default is -mfsmuld when targeting a CPU supporting the
26267 architecture versions V8 or V9 with FPU except -mcpu=leon.
26268
26269 -mpopc
26270 -mno-popc
26271 With -mpopc, GCC generates code that takes advantage of the
26272 UltraSPARC Population Count instruction. The default is -mpopc
26273 when targeting a CPU that supports such an instruction, such as
26274 Niagara-2 and later.
26275
26276 -msubxc
26277 -mno-subxc
26278 With -msubxc, GCC generates code that takes advantage of the
26279 UltraSPARC Subtract-Extended-with-Carry instruction. The default
26280 is -msubxc when targeting a CPU that supports such an instruction,
26281 such as Niagara-7 and later.
26282
26283 -mfix-at697f
26284 Enable the documented workaround for the single erratum of the
26285 Atmel AT697F processor (which corresponds to erratum #13 of the
26286 AT697E processor).
26287
26288 -mfix-ut699
26289 Enable the documented workarounds for the floating-point errata and
26290 the data cache nullify errata of the UT699 processor.
26291
26292 -mfix-ut700
26293 Enable the documented workaround for the back-to-back store errata
26294 of the UT699E/UT700 processor.
26295
26296 -mfix-gr712rc
26297 Enable the documented workaround for the back-to-back store errata
26298 of the GR712RC processor.
26299
26300 These -m options are supported in addition to the above on SPARC-V9
26301 processors in 64-bit environments:
26302
26303 -m32
26304 -m64
26305 Generate code for a 32-bit or 64-bit environment. The 32-bit
26306 environment sets int, long and pointer to 32 bits. The 64-bit
26307 environment sets int to 32 bits and long and pointer to 64 bits.
26308
26309 -mcmodel=which
26310 Set the code model to one of
26311
26312 medlow
26313 The Medium/Low code model: 64-bit addresses, programs must be
26314 linked in the low 32 bits of memory. Programs can be
26315 statically or dynamically linked.
26316
26317 medmid
26318 The Medium/Middle code model: 64-bit addresses, programs must
26319 be linked in the low 44 bits of memory, the text and data
26320 segments must be less than 2GB in size and the data segment
26321 must be located within 2GB of the text segment.
26322
26323 medany
26324 The Medium/Anywhere code model: 64-bit addresses, programs may
26325 be linked anywhere in memory, the text and data segments must
26326 be less than 2GB in size and the data segment must be located
26327 within 2GB of the text segment.
26328
26329 embmedany
26330 The Medium/Anywhere code model for embedded systems: 64-bit
26331 addresses, the text and data segments must be less than 2GB in
26332 size, both starting anywhere in memory (determined at link
26333 time). The global register %g4 points to the base of the data
26334 segment. Programs are statically linked and PIC is not
26335 supported.
26336
26337 -mmemory-model=mem-model
26338 Set the memory model in force on the processor to one of
26339
26340 default
26341 The default memory model for the processor and operating
26342 system.
26343
26344 rmo Relaxed Memory Order
26345
26346 pso Partial Store Order
26347
26348 tso Total Store Order
26349
26350 sc Sequential Consistency
26351
26352 These memory models are formally defined in Appendix D of the
26353 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
26354 field.
26355
26356 -mstack-bias
26357 -mno-stack-bias
26358 With -mstack-bias, GCC assumes that the stack pointer, and frame
26359 pointer if present, are offset by -2047 which must be added back
26360 when making stack frame references. This is the default in 64-bit
26361 mode. Otherwise, assume no such offset is present.
26362
26363 Options for System V
26364
26365 These additional options are available on System V Release 4 for
26366 compatibility with other compilers on those systems:
26367
26368 -G Create a shared object. It is recommended that -symbolic or
26369 -shared be used instead.
26370
26371 -Qy Identify the versions of each tool used by the compiler, in a
26372 ".ident" assembler directive in the output.
26373
26374 -Qn Refrain from adding ".ident" directives to the output file (this is
26375 the default).
26376
26377 -YP,dirs
26378 Search the directories dirs, and no others, for libraries specified
26379 with -l.
26380
26381 -Ym,dir
26382 Look in the directory dir to find the M4 preprocessor. The
26383 assembler uses this option.
26384
26385 TILE-Gx Options
26386
26387 These -m options are supported on the TILE-Gx:
26388
26389 -mcmodel=small
26390 Generate code for the small model. The distance for direct calls
26391 is limited to 500M in either direction. PC-relative addresses are
26392 32 bits. Absolute addresses support the full address range.
26393
26394 -mcmodel=large
26395 Generate code for the large model. There is no limitation on call
26396 distance, pc-relative addresses, or absolute addresses.
26397
26398 -mcpu=name
26399 Selects the type of CPU to be targeted. Currently the only
26400 supported type is tilegx.
26401
26402 -m32
26403 -m64
26404 Generate code for a 32-bit or 64-bit environment. The 32-bit
26405 environment sets int, long, and pointer to 32 bits. The 64-bit
26406 environment sets int to 32 bits and long and pointer to 64 bits.
26407
26408 -mbig-endian
26409 -mlittle-endian
26410 Generate code in big/little endian mode, respectively.
26411
26412 TILEPro Options
26413
26414 These -m options are supported on the TILEPro:
26415
26416 -mcpu=name
26417 Selects the type of CPU to be targeted. Currently the only
26418 supported type is tilepro.
26419
26420 -m32
26421 Generate code for a 32-bit environment, which sets int, long, and
26422 pointer to 32 bits. This is the only supported behavior so the
26423 flag is essentially ignored.
26424
26425 V850 Options
26426
26427 These -m options are defined for V850 implementations:
26428
26429 -mlong-calls
26430 -mno-long-calls
26431 Treat all calls as being far away (near). If calls are assumed to
26432 be far away, the compiler always loads the function's address into
26433 a register, and calls indirect through the pointer.
26434
26435 -mno-ep
26436 -mep
26437 Do not optimize (do optimize) basic blocks that use the same index
26438 pointer 4 or more times to copy pointer into the "ep" register, and
26439 use the shorter "sld" and "sst" instructions. The -mep option is
26440 on by default if you optimize.
26441
26442 -mno-prolog-function
26443 -mprolog-function
26444 Do not use (do use) external functions to save and restore
26445 registers at the prologue and epilogue of a function. The external
26446 functions are slower, but use less code space if more than one
26447 function saves the same number of registers. The -mprolog-function
26448 option is on by default if you optimize.
26449
26450 -mspace
26451 Try to make the code as small as possible. At present, this just
26452 turns on the -mep and -mprolog-function options.
26453
26454 -mtda=n
26455 Put static or global variables whose size is n bytes or less into
26456 the tiny data area that register "ep" points to. The tiny data
26457 area can hold up to 256 bytes in total (128 bytes for byte
26458 references).
26459
26460 -msda=n
26461 Put static or global variables whose size is n bytes or less into
26462 the small data area that register "gp" points to. The small data
26463 area can hold up to 64 kilobytes.
26464
26465 -mzda=n
26466 Put static or global variables whose size is n bytes or less into
26467 the first 32 kilobytes of memory.
26468
26469 -mv850
26470 Specify that the target processor is the V850.
26471
26472 -mv850e3v5
26473 Specify that the target processor is the V850E3V5. The
26474 preprocessor constant "__v850e3v5__" is defined if this option is
26475 used.
26476
26477 -mv850e2v4
26478 Specify that the target processor is the V850E3V5. This is an
26479 alias for the -mv850e3v5 option.
26480
26481 -mv850e2v3
26482 Specify that the target processor is the V850E2V3. The
26483 preprocessor constant "__v850e2v3__" is defined if this option is
26484 used.
26485
26486 -mv850e2
26487 Specify that the target processor is the V850E2. The preprocessor
26488 constant "__v850e2__" is defined if this option is used.
26489
26490 -mv850e1
26491 Specify that the target processor is the V850E1. The preprocessor
26492 constants "__v850e1__" and "__v850e__" are defined if this option
26493 is used.
26494
26495 -mv850es
26496 Specify that the target processor is the V850ES. This is an alias
26497 for the -mv850e1 option.
26498
26499 -mv850e
26500 Specify that the target processor is the V850E. The preprocessor
26501 constant "__v850e__" is defined if this option is used.
26502
26503 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
26504 -mv850e2v3 nor -mv850e3v5 are defined then a default target
26505 processor is chosen and the relevant __v850*__ preprocessor
26506 constant is defined.
26507
26508 The preprocessor constants "__v850" and "__v851__" are always
26509 defined, regardless of which processor variant is the target.
26510
26511 -mdisable-callt
26512 -mno-disable-callt
26513 This option suppresses generation of the "CALLT" instruction for
26514 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
26515 v850 architecture.
26516
26517 This option is enabled by default when the RH850 ABI is in use (see
26518 -mrh850-abi), and disabled by default when the GCC ABI is in use.
26519 If "CALLT" instructions are being generated then the C preprocessor
26520 symbol "__V850_CALLT__" is defined.
26521
26522 -mrelax
26523 -mno-relax
26524 Pass on (or do not pass on) the -mrelax command-line option to the
26525 assembler.
26526
26527 -mlong-jumps
26528 -mno-long-jumps
26529 Disable (or re-enable) the generation of PC-relative jump
26530 instructions.
26531
26532 -msoft-float
26533 -mhard-float
26534 Disable (or re-enable) the generation of hardware floating point
26535 instructions. This option is only significant when the target
26536 architecture is V850E2V3 or higher. If hardware floating point
26537 instructions are being generated then the C preprocessor symbol
26538 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
26539 defined.
26540
26541 -mloop
26542 Enables the use of the e3v5 LOOP instruction. The use of this
26543 instruction is not enabled by default when the e3v5 architecture is
26544 selected because its use is still experimental.
26545
26546 -mrh850-abi
26547 -mghs
26548 Enables support for the RH850 version of the V850 ABI. This is the
26549 default. With this version of the ABI the following rules apply:
26550
26551 * Integer sized structures and unions are returned via a memory
26552 pointer rather than a register.
26553
26554 * Large structures and unions (more than 8 bytes in size) are
26555 passed by value.
26556
26557 * Functions are aligned to 16-bit boundaries.
26558
26559 * The -m8byte-align command-line option is supported.
26560
26561 * The -mdisable-callt command-line option is enabled by default.
26562 The -mno-disable-callt command-line option is not supported.
26563
26564 When this version of the ABI is enabled the C preprocessor symbol
26565 "__V850_RH850_ABI__" is defined.
26566
26567 -mgcc-abi
26568 Enables support for the old GCC version of the V850 ABI. With this
26569 version of the ABI the following rules apply:
26570
26571 * Integer sized structures and unions are returned in register
26572 "r10".
26573
26574 * Large structures and unions (more than 8 bytes in size) are
26575 passed by reference.
26576
26577 * Functions are aligned to 32-bit boundaries, unless optimizing
26578 for size.
26579
26580 * The -m8byte-align command-line option is not supported.
26581
26582 * The -mdisable-callt command-line option is supported but not
26583 enabled by default.
26584
26585 When this version of the ABI is enabled the C preprocessor symbol
26586 "__V850_GCC_ABI__" is defined.
26587
26588 -m8byte-align
26589 -mno-8byte-align
26590 Enables support for "double" and "long long" types to be aligned on
26591 8-byte boundaries. The default is to restrict the alignment of all
26592 objects to at most 4-bytes. When -m8byte-align is in effect the C
26593 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
26594
26595 -mbig-switch
26596 Generate code suitable for big switch tables. Use this option only
26597 if the assembler/linker complain about out of range branches within
26598 a switch table.
26599
26600 -mapp-regs
26601 This option causes r2 and r5 to be used in the code generated by
26602 the compiler. This setting is the default.
26603
26604 -mno-app-regs
26605 This option causes r2 and r5 to be treated as fixed registers.
26606
26607 VAX Options
26608
26609 These -m options are defined for the VAX:
26610
26611 -munix
26612 Do not output certain jump instructions ("aobleq" and so on) that
26613 the Unix assembler for the VAX cannot handle across long ranges.
26614
26615 -mgnu
26616 Do output those jump instructions, on the assumption that the GNU
26617 assembler is being used.
26618
26619 -mg Output code for G-format floating-point numbers instead of
26620 D-format.
26621
26622 -mlra
26623 -mno-lra
26624 Enable Local Register Allocation. This is still experimental for
26625 the VAX, so by default the compiler uses standard reload.
26626
26627 Visium Options
26628
26629 -mdebug
26630 A program which performs file I/O and is destined to run on an MCM
26631 target should be linked with this option. It causes the libraries
26632 libc.a and libdebug.a to be linked. The program should be run on
26633 the target under the control of the GDB remote debugging stub.
26634
26635 -msim
26636 A program which performs file I/O and is destined to run on the
26637 simulator should be linked with option. This causes libraries
26638 libc.a and libsim.a to be linked.
26639
26640 -mfpu
26641 -mhard-float
26642 Generate code containing floating-point instructions. This is the
26643 default.
26644
26645 -mno-fpu
26646 -msoft-float
26647 Generate code containing library calls for floating-point.
26648
26649 -msoft-float changes the calling convention in the output file;
26650 therefore, it is only useful if you compile all of a program with
26651 this option. In particular, you need to compile libgcc.a, the
26652 library that comes with GCC, with -msoft-float in order for this to
26653 work.
26654
26655 -mcpu=cpu_type
26656 Set the instruction set, register set, and instruction scheduling
26657 parameters for machine type cpu_type. Supported values for
26658 cpu_type are mcm, gr5 and gr6.
26659
26660 mcm is a synonym of gr5 present for backward compatibility.
26661
26662 By default (unless configured otherwise), GCC generates code for
26663 the GR5 variant of the Visium architecture.
26664
26665 With -mcpu=gr6, GCC generates code for the GR6 variant of the
26666 Visium architecture. The only difference from GR5 code is that the
26667 compiler will generate block move instructions.
26668
26669 -mtune=cpu_type
26670 Set the instruction scheduling parameters for machine type
26671 cpu_type, but do not set the instruction set or register set that
26672 the option -mcpu=cpu_type would.
26673
26674 -msv-mode
26675 Generate code for the supervisor mode, where there are no
26676 restrictions on the access to general registers. This is the
26677 default.
26678
26679 -muser-mode
26680 Generate code for the user mode, where the access to some general
26681 registers is forbidden: on the GR5, registers r24 to r31 cannot be
26682 accessed in this mode; on the GR6, only registers r29 to r31 are
26683 affected.
26684
26685 VMS Options
26686
26687 These -m options are defined for the VMS implementations:
26688
26689 -mvms-return-codes
26690 Return VMS condition codes from "main". The default is to return
26691 POSIX-style condition (e.g. error) codes.
26692
26693 -mdebug-main=prefix
26694 Flag the first routine whose name starts with prefix as the main
26695 routine for the debugger.
26696
26697 -mmalloc64
26698 Default to 64-bit memory allocation routines.
26699
26700 -mpointer-size=size
26701 Set the default size of pointers. Possible options for size are 32
26702 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
26703 no for supporting only 32 bit pointers. The later option disables
26704 "pragma pointer_size".
26705
26706 VxWorks Options
26707
26708 The options in this section are defined for all VxWorks targets.
26709 Options specific to the target hardware are listed with the other
26710 options for that target.
26711
26712 -mrtp
26713 GCC can generate code for both VxWorks kernels and real time
26714 processes (RTPs). This option switches from the former to the
26715 latter. It also defines the preprocessor macro "__RTP__".
26716
26717 -non-static
26718 Link an RTP executable against shared libraries rather than static
26719 libraries. The options -static and -shared can also be used for
26720 RTPs; -static is the default.
26721
26722 -Bstatic
26723 -Bdynamic
26724 These options are passed down to the linker. They are defined for
26725 compatibility with Diab.
26726
26727 -Xbind-lazy
26728 Enable lazy binding of function calls. This option is equivalent
26729 to -Wl,-z,now and is defined for compatibility with Diab.
26730
26731 -Xbind-now
26732 Disable lazy binding of function calls. This option is the default
26733 and is defined for compatibility with Diab.
26734
26735 x86 Options
26736
26737 These -m options are defined for the x86 family of computers.
26738
26739 -march=cpu-type
26740 Generate instructions for the machine type cpu-type. In contrast
26741 to -mtune=cpu-type, which merely tunes the generated code for the
26742 specified cpu-type, -march=cpu-type allows GCC to generate code
26743 that may not run at all on processors other than the one indicated.
26744 Specifying -march=cpu-type implies -mtune=cpu-type, except where
26745 noted otherwise.
26746
26747 The choices for cpu-type are:
26748
26749 native
26750 This selects the CPU to generate code for at compilation time
26751 by determining the processor type of the compiling machine.
26752 Using -march=native enables all instruction subsets supported
26753 by the local machine (hence the result might not run on
26754 different machines). Using -mtune=native produces code
26755 optimized for the local machine under the constraints of the
26756 selected instruction set.
26757
26758 x86-64
26759 A generic CPU with 64-bit extensions.
26760
26761 x86-64-v2
26762 x86-64-v3
26763 x86-64-v4
26764 These choices for cpu-type select the corresponding micro-
26765 architecture level from the x86-64 psABI. On ABIs other than
26766 the x86-64 psABI they select the same CPU features as the
26767 x86-64 psABI documents for the particular micro-architecture
26768 level.
26769
26770 Since these cpu-type values do not have a corresponding -mtune
26771 setting, using -march with these values enables generic tuning.
26772 Specific tuning can be enabled using the -mtune=other-cpu-type
26773 option with an appropriate other-cpu-type value.
26774
26775 i386
26776 Original Intel i386 CPU.
26777
26778 i486
26779 Intel i486 CPU. (No scheduling is implemented for this chip.)
26780
26781 i586
26782 pentium
26783 Intel Pentium CPU with no MMX support.
26784
26785 lakemont
26786 Intel Lakemont MCU, based on Intel Pentium CPU.
26787
26788 pentium-mmx
26789 Intel Pentium MMX CPU, based on Pentium core with MMX
26790 instruction set support.
26791
26792 pentiumpro
26793 Intel Pentium Pro CPU.
26794
26795 i686
26796 When used with -march, the Pentium Pro instruction set is used,
26797 so the code runs on all i686 family chips. When used with
26798 -mtune, it has the same meaning as generic.
26799
26800 pentium2
26801 Intel Pentium II CPU, based on Pentium Pro core with MMX and
26802 FXSR instruction set support.
26803
26804 pentium3
26805 pentium3m
26806 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR
26807 and SSE instruction set support.
26808
26809 pentium-m
26810 Intel Pentium M; low-power version of Intel Pentium III CPU
26811 with MMX, SSE, SSE2 and FXSR instruction set support. Used by
26812 Centrino notebooks.
26813
26814 pentium4
26815 pentium4m
26816 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction
26817 set support.
26818
26819 prescott
26820 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2,
26821 SSE3 and FXSR instruction set support.
26822
26823 nocona
26824 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
26825 MMX, SSE, SSE2, SSE3 and FXSR instruction set support.
26826
26827 core2
26828 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
26829 SSSE3, CX16, SAHF and FXSR instruction set support.
26830
26831 nehalem
26832 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
26833 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction
26834 set support.
26835
26836 westmere
26837 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
26838 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and
26839 PCLMUL instruction set support.
26840
26841 sandybridge
26842 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
26843 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
26844 XSAVE and PCLMUL instruction set support.
26845
26846 ivybridge
26847 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
26848 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
26849 XSAVE, PCLMUL, FSGSBASE, RDRND and F16C instruction set
26850 support.
26851
26852 haswell
26853 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
26854 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26855 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26856 LZCNT, FMA, MOVBE and HLE instruction set support.
26857
26858 broadwell
26859 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
26860 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26861 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26862 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW instruction
26863 set support.
26864
26865 skylake
26866 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26867 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26868 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26869 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26870 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
26871
26872 bonnell
26873 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
26874 SSE2, SSE3 and SSSE3 instruction set support.
26875
26876 silvermont
26877 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
26878 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26879 PCLMUL, PREFETCHW and RDRND instruction set support.
26880
26881 goldmont
26882 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
26883 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26884 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
26885 XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction set
26886 support.
26887
26888 goldmont-plus
26889 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
26890 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26891 FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE,
26892 XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID
26893 and SGX instruction set support.
26894
26895 tremont
26896 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
26897 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26898 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
26899 XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID, SGX,
26900 CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG
26901 instruction set support.
26902
26903 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
26904 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26905 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26906 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
26907 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1
26908 instruction set support.
26909
26910 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
26911 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26912 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26913 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AVX512PF,
26914 AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
26915 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
26916
26917 skylake-avx512
26918 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
26919 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26920 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26921 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26922 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
26923 AVX512BW, AVX512DQ and AVX512CD instruction set support.
26924
26925 cannonlake
26926 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX,
26927 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26928 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26929 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26930 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26931 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA
26932 instruction set support.
26933
26934 icelake-client
26935 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX,
26936 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26937 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26938 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26939 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26940 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
26941 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
26942 RDPID and AVX512VPOPCNTDQ instruction set support.
26943
26944 icelake-server
26945 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
26946 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26947 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26948 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26949 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26950 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
26951 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
26952 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB instruction
26953 set support.
26954
26955 cascadelake
26956 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26957 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26958 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26959 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26960 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
26961 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
26962 support.
26963
26964 cooperlake
26965 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26966 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26967 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26968 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26969 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
26970 AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16
26971 instruction set support.
26972
26973 tigerlake
26974 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26975 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26976 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26977 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26978 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26979 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
26980 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
26981 RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
26982 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
26983
26984 sapphirerapids
26985 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX,
26986 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26987 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26988 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26989 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26990 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
26991 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
26992 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI,
26993 MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE,
26994 TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI,
26995 AVX512FP16 and AVX512BF16 instruction set support.
26996
26997 alderlake
26998 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26999 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
27000 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
27001 PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
27002 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
27003 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
27004 WIDEKL and AVX-VNNI instruction set support.
27005
27006 rocketlake
27007 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27008 SSE2, SSE3, SSSE3 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27009 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27010 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27011 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW,
27012 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
27013 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27014 RDPID and AVX512VPOPCNTDQ instruction set support.
27015
27016 k6 AMD K6 CPU with MMX instruction set support.
27017
27018 k6-2
27019 k6-3
27020 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
27021 set support.
27022
27023 athlon
27024 athlon-tbird
27025 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
27026 prefetch instructions support.
27027
27028 athlon-4
27029 athlon-xp
27030 athlon-mp
27031 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
27032 full SSE instruction set support.
27033
27034 k8
27035 opteron
27036 athlon64
27037 athlon-fx
27038 Processors based on the AMD K8 core with x86-64 instruction set
27039 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
27040 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
27041 3DNow! and 64-bit instruction set extensions.)
27042
27043 k8-sse3
27044 opteron-sse3
27045 athlon64-sse3
27046 Improved versions of AMD K8 cores with SSE3 instruction set
27047 support.
27048
27049 amdfam10
27050 barcelona
27051 CPUs based on AMD Family 10h cores with x86-64 instruction set
27052 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
27053 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
27054
27055 bdver1
27056 CPUs based on AMD Family 15h cores with x86-64 instruction set
27057 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL,
27058 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
27059 and 64-bit instruction set extensions.)
27060
27061 bdver2
27062 AMD Family 15h core based CPUs with x86-64 instruction set
27063 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
27064 LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27065 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27066
27067 bdver3
27068 AMD Family 15h core based CPUs with x86-64 instruction set
27069 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
27070 AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27071 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27072 extensions.)
27073
27074 bdver4
27075 AMD Family 15h core based CPUs with x86-64 instruction set
27076 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
27077 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX,
27078 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
27079 instruction set extensions.)
27080
27081 znver1
27082 AMD Family 17h core based CPUs with x86-64 instruction set
27083 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
27084 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16,
27085 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
27086 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
27087 extensions.)
27088
27089 znver2
27090 AMD Family 17h core based CPUs with x86-64 instruction set
27091 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
27092 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
27093 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27094 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
27095 WBNOINVD, and 64-bit instruction set extensions.)
27096
27097 znver3
27098 AMD Family 19h core based CPUs with x86-64 instruction set
27099 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
27100 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
27101 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27102 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
27103 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set
27104 extensions.)
27105
27106 btver1
27107 CPUs based on AMD Family 14h cores with x86-64 instruction set
27108 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
27109 CX16, ABM and 64-bit instruction set extensions.)
27110
27111 btver2
27112 CPUs based on AMD Family 16h cores with x86-64 instruction set
27113 support. This includes MOVBE, F16C, BMI, AVX, PCLMUL, AES,
27114 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
27115 and 64-bit instruction set extensions.
27116
27117 winchip-c6
27118 IDT WinChip C6 CPU, dealt in same way as i486 with additional
27119 MMX instruction set support.
27120
27121 winchip2
27122 IDT WinChip 2 CPU, dealt in same way as i486 with additional
27123 MMX and 3DNow! instruction set support.
27124
27125 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
27126 scheduling is implemented for this chip.)
27127
27128 c3-2
27129 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
27130 support. (No scheduling is implemented for this chip.)
27131
27132 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
27133 set support. (No scheduling is implemented for this chip.)
27134
27135 samuel-2
27136 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
27137 support. (No scheduling is implemented for this chip.)
27138
27139 nehemiah
27140 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27141 (No scheduling is implemented for this chip.)
27142
27143 esther
27144 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
27145 set support. (No scheduling is implemented for this chip.)
27146
27147 eden-x2
27148 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
27149 instruction set support. (No scheduling is implemented for
27150 this chip.)
27151
27152 eden-x4
27153 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
27154 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
27155 scheduling is implemented for this chip.)
27156
27157 nano
27158 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
27159 SSSE3 instruction set support. (No scheduling is implemented
27160 for this chip.)
27161
27162 nano-1000
27163 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27164 instruction set support. (No scheduling is implemented for
27165 this chip.)
27166
27167 nano-2000
27168 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27169 instruction set support. (No scheduling is implemented for
27170 this chip.)
27171
27172 nano-3000
27173 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
27174 SSE4.1 instruction set support. (No scheduling is implemented
27175 for this chip.)
27176
27177 nano-x2
27178 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
27179 and SSE4.1 instruction set support. (No scheduling is
27180 implemented for this chip.)
27181
27182 nano-x4
27183 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
27184 and SSE4.1 instruction set support. (No scheduling is
27185 implemented for this chip.)
27186
27187 geode
27188 AMD Geode embedded processor with MMX and 3DNow! instruction
27189 set support.
27190
27191 -mtune=cpu-type
27192 Tune to cpu-type everything applicable about the generated code,
27193 except for the ABI and the set of available instructions. While
27194 picking a specific cpu-type schedules things appropriately for that
27195 particular chip, the compiler does not generate any code that
27196 cannot run on the default machine type unless you use a -march=cpu-
27197 type option. For example, if GCC is configured for
27198 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
27199 for Pentium 4 but still runs on i686 machines.
27200
27201 The choices for cpu-type are the same as for -march. In addition,
27202 -mtune supports 2 extra choices for cpu-type:
27203
27204 generic
27205 Produce code optimized for the most common IA32/AMD64/EM64T
27206 processors. If you know the CPU on which your code will run,
27207 then you should use the corresponding -mtune or -march option
27208 instead of -mtune=generic. But, if you do not know exactly
27209 what CPU users of your application will have, then you should
27210 use this option.
27211
27212 As new processors are deployed in the marketplace, the behavior
27213 of this option will change. Therefore, if you upgrade to a
27214 newer version of GCC, code generation controlled by this option
27215 will change to reflect the processors that are most common at
27216 the time that version of GCC is released.
27217
27218 There is no -march=generic option because -march indicates the
27219 instruction set the compiler can use, and there is no generic
27220 instruction set applicable to all processors. In contrast,
27221 -mtune indicates the processor (or, in this case, collection of
27222 processors) for which the code is optimized.
27223
27224 intel
27225 Produce code optimized for the most current Intel processors,
27226 which are Haswell and Silvermont for this version of GCC. If
27227 you know the CPU on which your code will run, then you should
27228 use the corresponding -mtune or -march option instead of
27229 -mtune=intel. But, if you want your application performs
27230 better on both Haswell and Silvermont, then you should use this
27231 option.
27232
27233 As new Intel processors are deployed in the marketplace, the
27234 behavior of this option will change. Therefore, if you upgrade
27235 to a newer version of GCC, code generation controlled by this
27236 option will change to reflect the most current Intel processors
27237 at the time that version of GCC is released.
27238
27239 There is no -march=intel option because -march indicates the
27240 instruction set the compiler can use, and there is no common
27241 instruction set applicable to all processors. In contrast,
27242 -mtune indicates the processor (or, in this case, collection of
27243 processors) for which the code is optimized.
27244
27245 -mcpu=cpu-type
27246 A deprecated synonym for -mtune.
27247
27248 -mfpmath=unit
27249 Generate floating-point arithmetic for selected unit unit. The
27250 choices for unit are:
27251
27252 387 Use the standard 387 floating-point coprocessor present on the
27253 majority of chips and emulated otherwise. Code compiled with
27254 this option runs almost everywhere. The temporary results are
27255 computed in 80-bit precision instead of the precision specified
27256 by the type, resulting in slightly different results compared
27257 to most of other chips. See -ffloat-store for more detailed
27258 description.
27259
27260 This is the default choice for non-Darwin x86-32 targets.
27261
27262 sse Use scalar floating-point instructions present in the SSE
27263 instruction set. This instruction set is supported by Pentium
27264 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
27265 and Athlon MP chips. The earlier version of the SSE
27266 instruction set supports only single-precision arithmetic, thus
27267 the double and extended-precision arithmetic are still done
27268 using 387. A later version, present only in Pentium 4 and AMD
27269 x86-64 chips, supports double-precision arithmetic too.
27270
27271 For the x86-32 compiler, you must use -march=cpu-type, -msse or
27272 -msse2 switches to enable SSE extensions and make this option
27273 effective. For the x86-64 compiler, these extensions are
27274 enabled by default.
27275
27276 The resulting code should be considerably faster in the
27277 majority of cases and avoid the numerical instability problems
27278 of 387 code, but may break some existing code that expects
27279 temporaries to be 80 bits.
27280
27281 This is the default choice for the x86-64 compiler, Darwin
27282 x86-32 targets, and the default choice for x86-32 targets with
27283 the SSE2 instruction set when -ffast-math is enabled.
27284
27285 sse,387
27286 sse+387
27287 both
27288 Attempt to utilize both instruction sets at once. This
27289 effectively doubles the amount of available registers, and on
27290 chips with separate execution units for 387 and SSE the
27291 execution resources too. Use this option with care, as it is
27292 still experimental, because the GCC register allocator does not
27293 model separate functional units well, resulting in unstable
27294 performance.
27295
27296 -masm=dialect
27297 Output assembly instructions using selected dialect. Also affects
27298 which dialect is used for basic "asm" and extended "asm". Supported
27299 choices (in dialect order) are att or intel. The default is att.
27300 Darwin does not support intel.
27301
27302 -mieee-fp
27303 -mno-ieee-fp
27304 Control whether or not the compiler uses IEEE floating-point
27305 comparisons. These correctly handle the case where the result of a
27306 comparison is unordered.
27307
27308 -m80387
27309 -mhard-float
27310 Generate output containing 80387 instructions for floating point.
27311
27312 -mno-80387
27313 -msoft-float
27314 Generate output containing library calls for floating point.
27315
27316 Warning: the requisite libraries are not part of GCC. Normally the
27317 facilities of the machine's usual C compiler are used, but this
27318 cannot be done directly in cross-compilation. You must make your
27319 own arrangements to provide suitable library functions for cross-
27320 compilation.
27321
27322 On machines where a function returns floating-point results in the
27323 80387 register stack, some floating-point opcodes may be emitted
27324 even if -msoft-float is used.
27325
27326 -mno-fp-ret-in-387
27327 Do not use the FPU registers for return values of functions.
27328
27329 The usual calling convention has functions return values of types
27330 "float" and "double" in an FPU register, even if there is no FPU.
27331 The idea is that the operating system should emulate an FPU.
27332
27333 The option -mno-fp-ret-in-387 causes such values to be returned in
27334 ordinary CPU registers instead.
27335
27336 -mno-fancy-math-387
27337 Some 387 emulators do not support the "sin", "cos" and "sqrt"
27338 instructions for the 387. Specify this option to avoid generating
27339 those instructions. This option is overridden when -march
27340 indicates that the target CPU always has an FPU and so the
27341 instruction does not need emulation. These instructions are not
27342 generated unless you also use the -funsafe-math-optimizations
27343 switch.
27344
27345 -malign-double
27346 -mno-align-double
27347 Control whether GCC aligns "double", "long double", and "long long"
27348 variables on a two-word boundary or a one-word boundary. Aligning
27349 "double" variables on a two-word boundary produces code that runs
27350 somewhat faster on a Pentium at the expense of more memory.
27351
27352 On x86-64, -malign-double is enabled by default.
27353
27354 Warning: if you use the -malign-double switch, structures
27355 containing the above types are aligned differently than the
27356 published application binary interface specifications for the
27357 x86-32 and are not binary compatible with structures in code
27358 compiled without that switch.
27359
27360 -m96bit-long-double
27361 -m128bit-long-double
27362 These switches control the size of "long double" type. The x86-32
27363 application binary interface specifies the size to be 96 bits, so
27364 -m96bit-long-double is the default in 32-bit mode.
27365
27366 Modern architectures (Pentium and newer) prefer "long double" to be
27367 aligned to an 8- or 16-byte boundary. In arrays or structures
27368 conforming to the ABI, this is not possible. So specifying
27369 -m128bit-long-double aligns "long double" to a 16-byte boundary by
27370 padding the "long double" with an additional 32-bit zero.
27371
27372 In the x86-64 compiler, -m128bit-long-double is the default choice
27373 as its ABI specifies that "long double" is aligned on 16-byte
27374 boundary.
27375
27376 Notice that neither of these options enable any extra precision
27377 over the x87 standard of 80 bits for a "long double".
27378
27379 Warning: if you override the default value for your target ABI,
27380 this changes the size of structures and arrays containing "long
27381 double" variables, as well as modifying the function calling
27382 convention for functions taking "long double". Hence they are not
27383 binary-compatible with code compiled without that switch.
27384
27385 -mlong-double-64
27386 -mlong-double-80
27387 -mlong-double-128
27388 These switches control the size of "long double" type. A size of 64
27389 bits makes the "long double" type equivalent to the "double" type.
27390 This is the default for 32-bit Bionic C library. A size of 128
27391 bits makes the "long double" type equivalent to the "__float128"
27392 type. This is the default for 64-bit Bionic C library.
27393
27394 Warning: if you override the default value for your target ABI,
27395 this changes the size of structures and arrays containing "long
27396 double" variables, as well as modifying the function calling
27397 convention for functions taking "long double". Hence they are not
27398 binary-compatible with code compiled without that switch.
27399
27400 -malign-data=type
27401 Control how GCC aligns variables. Supported values for type are
27402 compat uses increased alignment value compatible uses GCC 4.8 and
27403 earlier, abi uses alignment value as specified by the psABI, and
27404 cacheline uses increased alignment value to match the cache line
27405 size. compat is the default.
27406
27407 -mlarge-data-threshold=threshold
27408 When -mcmodel=medium is specified, data objects larger than
27409 threshold are placed in the large data section. This value must be
27410 the same across all objects linked into the binary, and defaults to
27411 65535.
27412
27413 -mrtd
27414 Use a different function-calling convention, in which functions
27415 that take a fixed number of arguments return with the "ret num"
27416 instruction, which pops their arguments while returning. This
27417 saves one instruction in the caller since there is no need to pop
27418 the arguments there.
27419
27420 You can specify that an individual function is called with this
27421 calling sequence with the function attribute "stdcall". You can
27422 also override the -mrtd option by using the function attribute
27423 "cdecl".
27424
27425 Warning: this calling convention is incompatible with the one
27426 normally used on Unix, so you cannot use it if you need to call
27427 libraries compiled with the Unix compiler.
27428
27429 Also, you must provide function prototypes for all functions that
27430 take variable numbers of arguments (including "printf"); otherwise
27431 incorrect code is generated for calls to those functions.
27432
27433 In addition, seriously incorrect code results if you call a
27434 function with too many arguments. (Normally, extra arguments are
27435 harmlessly ignored.)
27436
27437 -mregparm=num
27438 Control how many registers are used to pass integer arguments. By
27439 default, no registers are used to pass arguments, and at most 3
27440 registers can be used. You can control this behavior for a
27441 specific function by using the function attribute "regparm".
27442
27443 Warning: if you use this switch, and num is nonzero, then you must
27444 build all modules with the same value, including any libraries.
27445 This includes the system libraries and startup modules.
27446
27447 -msseregparm
27448 Use SSE register passing conventions for float and double arguments
27449 and return values. You can control this behavior for a specific
27450 function by using the function attribute "sseregparm".
27451
27452 Warning: if you use this switch then you must build all modules
27453 with the same value, including any libraries. This includes the
27454 system libraries and startup modules.
27455
27456 -mvect8-ret-in-mem
27457 Return 8-byte vectors in memory instead of MMX registers. This is
27458 the default on VxWorks to match the ABI of the Sun Studio compilers
27459 until version 12. Only use this option if you need to remain
27460 compatible with existing code produced by those previous compiler
27461 versions or older versions of GCC.
27462
27463 -mpc32
27464 -mpc64
27465 -mpc80
27466 Set 80387 floating-point precision to 32, 64 or 80 bits. When
27467 -mpc32 is specified, the significands of results of floating-point
27468 operations are rounded to 24 bits (single precision); -mpc64 rounds
27469 the significands of results of floating-point operations to 53 bits
27470 (double precision) and -mpc80 rounds the significands of results of
27471 floating-point operations to 64 bits (extended double precision),
27472 which is the default. When this option is used, floating-point
27473 operations in higher precisions are not available to the programmer
27474 without setting the FPU control word explicitly.
27475
27476 Setting the rounding of floating-point operations to less than the
27477 default 80 bits can speed some programs by 2% or more. Note that
27478 some mathematical libraries assume that extended-precision (80-bit)
27479 floating-point operations are enabled by default; routines in such
27480 libraries could suffer significant loss of accuracy, typically
27481 through so-called "catastrophic cancellation", when this option is
27482 used to set the precision to less than extended precision.
27483
27484 -mstackrealign
27485 Realign the stack at entry. On the x86, the -mstackrealign option
27486 generates an alternate prologue and epilogue that realigns the run-
27487 time stack if necessary. This supports mixing legacy codes that
27488 keep 4-byte stack alignment with modern codes that keep 16-byte
27489 stack alignment for SSE compatibility. See also the attribute
27490 "force_align_arg_pointer", applicable to individual functions.
27491
27492 -mpreferred-stack-boundary=num
27493 Attempt to keep the stack boundary aligned to a 2 raised to num
27494 byte boundary. If -mpreferred-stack-boundary is not specified, the
27495 default is 4 (16 bytes or 128 bits).
27496
27497 Warning: When generating code for the x86-64 architecture with SSE
27498 extensions disabled, -mpreferred-stack-boundary=3 can be used to
27499 keep the stack boundary aligned to 8 byte boundary. Since x86-64
27500 ABI require 16 byte stack alignment, this is ABI incompatible and
27501 intended to be used in controlled environment where stack space is
27502 important limitation. This option leads to wrong code when
27503 functions compiled with 16 byte stack alignment (such as functions
27504 from a standard library) are called with misaligned stack. In this
27505 case, SSE instructions may lead to misaligned memory access traps.
27506 In addition, variable arguments are handled incorrectly for 16 byte
27507 aligned objects (including x87 long double and __int128), leading
27508 to wrong results. You must build all modules with
27509 -mpreferred-stack-boundary=3, including any libraries. This
27510 includes the system libraries and startup modules.
27511
27512 -mincoming-stack-boundary=num
27513 Assume the incoming stack is aligned to a 2 raised to num byte
27514 boundary. If -mincoming-stack-boundary is not specified, the one
27515 specified by -mpreferred-stack-boundary is used.
27516
27517 On Pentium and Pentium Pro, "double" and "long double" values
27518 should be aligned to an 8-byte boundary (see -malign-double) or
27519 suffer significant run time performance penalties. On Pentium III,
27520 the Streaming SIMD Extension (SSE) data type "__m128" may not work
27521 properly if it is not 16-byte aligned.
27522
27523 To ensure proper alignment of this values on the stack, the stack
27524 boundary must be as aligned as that required by any value stored on
27525 the stack. Further, every function must be generated such that it
27526 keeps the stack aligned. Thus calling a function compiled with a
27527 higher preferred stack boundary from a function compiled with a
27528 lower preferred stack boundary most likely misaligns the stack. It
27529 is recommended that libraries that use callbacks always use the
27530 default setting.
27531
27532 This extra alignment does consume extra stack space, and generally
27533 increases code size. Code that is sensitive to stack space usage,
27534 such as embedded systems and operating system kernels, may want to
27535 reduce the preferred alignment to -mpreferred-stack-boundary=2.
27536
27537 -mmmx
27538 -msse
27539 -msse2
27540 -msse3
27541 -mssse3
27542 -msse4
27543 -msse4a
27544 -msse4.1
27545 -msse4.2
27546 -mavx
27547 -mavx2
27548 -mavx512f
27549 -mavx512pf
27550 -mavx512er
27551 -mavx512cd
27552 -mavx512vl
27553 -mavx512bw
27554 -mavx512dq
27555 -mavx512ifma
27556 -mavx512vbmi
27557 -msha
27558 -maes
27559 -mpclmul
27560 -mclflushopt
27561 -mclwb
27562 -mfsgsbase
27563 -mptwrite
27564 -mrdrnd
27565 -mf16c
27566 -mfma
27567 -mpconfig
27568 -mwbnoinvd
27569 -mfma4
27570 -mprfchw
27571 -mrdpid
27572 -mprefetchwt1
27573 -mrdseed
27574 -msgx
27575 -mxop
27576 -mlwp
27577 -m3dnow
27578 -m3dnowa
27579 -mpopcnt
27580 -mabm
27581 -madx
27582 -mbmi
27583 -mbmi2
27584 -mlzcnt
27585 -mfxsr
27586 -mxsave
27587 -mxsaveopt
27588 -mxsavec
27589 -mxsaves
27590 -mrtm
27591 -mhle
27592 -mtbm
27593 -mmwaitx
27594 -mclzero
27595 -mpku
27596 -mavx512vbmi2
27597 -mavx512bf16
27598 -mavx512fp16
27599 -mgfni
27600 -mvaes
27601 -mwaitpkg
27602 -mvpclmulqdq
27603 -mavx512bitalg
27604 -mmovdiri
27605 -mmovdir64b
27606 -menqcmd
27607 -muintr
27608 -mtsxldtrk
27609 -mavx512vpopcntdq
27610 -mavx512vp2intersect
27611 -mavx5124fmaps
27612 -mavx512vnni
27613 -mavxvnni
27614 -mavx5124vnniw
27615 -mcldemote
27616 -mserialize
27617 -mamx-tile
27618 -mamx-int8
27619 -mamx-bf16
27620 -mhreset
27621 -mkl
27622 -mwidekl
27623 These switches enable the use of instructions in the MMX, SSE,
27624 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
27625 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
27626 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
27627 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
27628 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
27629 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
27630 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
27631 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
27632 MOVDIRI, MOVDIR64B, AVX512BF16, ENQCMD, AVX512VPOPCNTDQ,
27633 AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE, UINTR, HRESET,
27634 AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512FP16 or
27635 CLDEMOTE extended instruction sets. Each has a corresponding -mno-
27636 option to disable use of these instructions.
27637
27638 These extensions are also available as built-in functions: see x86
27639 Built-in Functions, for details of the functions enabled and
27640 disabled by these switches.
27641
27642 To generate SSE/SSE2 instructions automatically from floating-point
27643 code (as opposed to 387 instructions), see -mfpmath=sse.
27644
27645 GCC depresses SSEx instructions when -mavx is used. Instead, it
27646 generates new AVX instructions or AVX equivalence for all SSEx
27647 instructions when needed.
27648
27649 These options enable GCC to use these extended instructions in
27650 generated code, even without -mfpmath=sse. Applications that
27651 perform run-time CPU detection must compile separate files for each
27652 supported architecture, using the appropriate flags. In
27653 particular, the file containing the CPU detection code should be
27654 compiled without these options.
27655
27656 -mdump-tune-features
27657 This option instructs GCC to dump the names of the x86 performance
27658 tuning features and default settings. The names can be used in
27659 -mtune-ctrl=feature-list.
27660
27661 -mtune-ctrl=feature-list
27662 This option is used to do fine grain control of x86 code generation
27663 features. feature-list is a comma separated list of feature names.
27664 See also -mdump-tune-features. When specified, the feature is
27665 turned on if it is not preceded with ^, otherwise, it is turned
27666 off. -mtune-ctrl=feature-list is intended to be used by GCC
27667 developers. Using it may lead to code paths not covered by testing
27668 and can potentially result in compiler ICEs or runtime errors.
27669
27670 -mno-default
27671 This option instructs GCC to turn off all tunable features. See
27672 also -mtune-ctrl=feature-list and -mdump-tune-features.
27673
27674 -mcld
27675 This option instructs GCC to emit a "cld" instruction in the
27676 prologue of functions that use string instructions. String
27677 instructions depend on the DF flag to select between autoincrement
27678 or autodecrement mode. While the ABI specifies the DF flag to be
27679 cleared on function entry, some operating systems violate this
27680 specification by not clearing the DF flag in their exception
27681 dispatchers. The exception handler can be invoked with the DF flag
27682 set, which leads to wrong direction mode when string instructions
27683 are used. This option can be enabled by default on 32-bit x86
27684 targets by configuring GCC with the --enable-cld configure option.
27685 Generation of "cld" instructions can be suppressed with the
27686 -mno-cld compiler option in this case.
27687
27688 -mvzeroupper
27689 This option instructs GCC to emit a "vzeroupper" instruction before
27690 a transfer of control flow out of the function to minimize the AVX
27691 to SSE transition penalty as well as remove unnecessary "zeroupper"
27692 intrinsics.
27693
27694 -mprefer-avx128
27695 This option instructs GCC to use 128-bit AVX instructions instead
27696 of 256-bit AVX instructions in the auto-vectorizer.
27697
27698 -mprefer-vector-width=opt
27699 This option instructs GCC to use opt-bit vector width in
27700 instructions instead of default on the selected platform.
27701
27702 -mmove-max=bits
27703 This option instructs GCC to set the maximum number of bits can be
27704 moved from memory to memory efficiently to bits. The valid bits
27705 are 128, 256 and 512.
27706
27707 -mstore-max=bits
27708 This option instructs GCC to set the maximum number of bits can be
27709 stored to memory efficiently to bits. The valid bits are 128, 256
27710 and 512.
27711
27712 none
27713 No extra limitations applied to GCC other than defined by the
27714 selected platform.
27715
27716 128 Prefer 128-bit vector width for instructions.
27717
27718 256 Prefer 256-bit vector width for instructions.
27719
27720 512 Prefer 512-bit vector width for instructions.
27721
27722 -mcx16
27723 This option enables GCC to generate "CMPXCHG16B" instructions in
27724 64-bit code to implement compare-and-exchange operations on 16-byte
27725 aligned 128-bit objects. This is useful for atomic updates of data
27726 structures exceeding one machine word in size. The compiler uses
27727 this instruction to implement __sync Builtins. However, for
27728 __atomic Builtins operating on 128-bit integers, a library call is
27729 always used.
27730
27731 -msahf
27732 This option enables generation of "SAHF" instructions in 64-bit
27733 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
27734 the introduction of Pentium 4 G1 step in December 2005, lacked the
27735 "LAHF" and "SAHF" instructions which are supported by AMD64. These
27736 are load and store instructions, respectively, for certain status
27737 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
27738 "fmod", "drem", and "remainder" built-in functions; see Other
27739 Builtins for details.
27740
27741 -mmovbe
27742 This option enables use of the "movbe" instruction to implement
27743 "__builtin_bswap32" and "__builtin_bswap64".
27744
27745 -mshstk
27746 The -mshstk option enables shadow stack built-in functions from x86
27747 Control-flow Enforcement Technology (CET).
27748
27749 -mcrc32
27750 This option enables built-in functions "__builtin_ia32_crc32qi",
27751 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
27752 "__builtin_ia32_crc32di" to generate the "crc32" machine
27753 instruction.
27754
27755 -mmwait
27756 This option enables built-in functions "__builtin_ia32_monitor",
27757 and "__builtin_ia32_mwait" to generate the "monitor" and "mwait"
27758 machine instructions.
27759
27760 -mrecip
27761 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
27762 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
27763 Newton-Raphson step to increase precision instead of "DIVSS" and
27764 "SQRTSS" (and their vectorized variants) for single-precision
27765 floating-point arguments. These instructions are generated only
27766 when -funsafe-math-optimizations is enabled together with
27767 -ffinite-math-only and -fno-trapping-math. Note that while the
27768 throughput of the sequence is higher than the throughput of the
27769 non-reciprocal instruction, the precision of the sequence can be
27770 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
27771 0.99999994).
27772
27773 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
27774 "RSQRTPS") already with -ffast-math (or the above option
27775 combination), and doesn't need -mrecip.
27776
27777 Also note that GCC emits the above sequence with additional Newton-
27778 Raphson step for vectorized single-float division and vectorized
27779 "sqrtf(x)" already with -ffast-math (or the above option
27780 combination), and doesn't need -mrecip.
27781
27782 -mrecip=opt
27783 This option controls which reciprocal estimate instructions may be
27784 used. opt is a comma-separated list of options, which may be
27785 preceded by a ! to invert the option:
27786
27787 all Enable all estimate instructions.
27788
27789 default
27790 Enable the default instructions, equivalent to -mrecip.
27791
27792 none
27793 Disable all estimate instructions, equivalent to -mno-recip.
27794
27795 div Enable the approximation for scalar division.
27796
27797 vec-div
27798 Enable the approximation for vectorized division.
27799
27800 sqrt
27801 Enable the approximation for scalar square root.
27802
27803 vec-sqrt
27804 Enable the approximation for vectorized square root.
27805
27806 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
27807 approximations, except for square root.
27808
27809 -mveclibabi=type
27810 Specifies the ABI type to use for vectorizing intrinsics using an
27811 external library. Supported values for type are svml for the Intel
27812 short vector math library and acml for the AMD math core library.
27813 To use this option, both -ftree-vectorize and
27814 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
27815 ABI-compatible library must be specified at link time.
27816
27817 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
27818 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
27819 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
27820 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
27821 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
27822 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
27823 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
27824 and "vmlsAcos4" for corresponding function type when
27825 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
27826 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
27827 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
27828 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
27829 corresponding function type when -mveclibabi=acml is used.
27830
27831 -mabi=name
27832 Generate code for the specified calling convention. Permissible
27833 values are sysv for the ABI used on GNU/Linux and other systems,
27834 and ms for the Microsoft ABI. The default is to use the Microsoft
27835 ABI when targeting Microsoft Windows and the SysV ABI on all other
27836 systems. You can control this behavior for specific functions by
27837 using the function attributes "ms_abi" and "sysv_abi".
27838
27839 -mforce-indirect-call
27840 Force all calls to functions to be indirect. This is useful when
27841 using Intel Processor Trace where it generates more precise timing
27842 information for function calls.
27843
27844 -mmanual-endbr
27845 Insert ENDBR instruction at function entry only via the "cf_check"
27846 function attribute. This is useful when used with the option
27847 -fcf-protection=branch to control ENDBR insertion at the function
27848 entry.
27849
27850 -mcall-ms2sysv-xlogues
27851 Due to differences in 64-bit ABIs, any Microsoft ABI function that
27852 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
27853 clobbered. By default, the code for saving and restoring these
27854 registers is emitted inline, resulting in fairly lengthy prologues
27855 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
27856 epilogues that use stubs in the static portion of libgcc to perform
27857 these saves and restores, thus reducing function size at the cost
27858 of a few extra instructions.
27859
27860 -mtls-dialect=type
27861 Generate code to access thread-local storage using the gnu or gnu2
27862 conventions. gnu is the conservative default; gnu2 is more
27863 efficient, but it may add compile- and run-time requirements that
27864 cannot be satisfied on all systems.
27865
27866 -mpush-args
27867 -mno-push-args
27868 Use PUSH operations to store outgoing parameters. This method is
27869 shorter and usually equally fast as method using SUB/MOV operations
27870 and is enabled by default. In some cases disabling it may improve
27871 performance because of improved scheduling and reduced
27872 dependencies.
27873
27874 -maccumulate-outgoing-args
27875 If enabled, the maximum amount of space required for outgoing
27876 arguments is computed in the function prologue. This is faster on
27877 most modern CPUs because of reduced dependencies, improved
27878 scheduling and reduced stack usage when the preferred stack
27879 boundary is not equal to 2. The drawback is a notable increase in
27880 code size. This switch implies -mno-push-args.
27881
27882 -mthreads
27883 Support thread-safe exception handling on MinGW. Programs that
27884 rely on thread-safe exception handling must compile and link all
27885 code with the -mthreads option. When compiling, -mthreads defines
27886 -D_MT; when linking, it links in a special thread helper library
27887 -lmingwthrd which cleans up per-thread exception-handling data.
27888
27889 -mms-bitfields
27890 -mno-ms-bitfields
27891 Enable/disable bit-field layout compatible with the native
27892 Microsoft Windows compiler.
27893
27894 If "packed" is used on a structure, or if bit-fields are used, it
27895 may be that the Microsoft ABI lays out the structure differently
27896 than the way GCC normally does. Particularly when moving packed
27897 data between functions compiled with GCC and the native Microsoft
27898 compiler (either via function call or as data in a file), it may be
27899 necessary to access either format.
27900
27901 This option is enabled by default for Microsoft Windows targets.
27902 This behavior can also be controlled locally by use of variable or
27903 type attributes. For more information, see x86 Variable Attributes
27904 and x86 Type Attributes.
27905
27906 The Microsoft structure layout algorithm is fairly simple with the
27907 exception of the bit-field packing. The padding and alignment of
27908 members of structures and whether a bit-field can straddle a
27909 storage-unit boundary are determine by these rules:
27910
27911 1. Structure members are stored sequentially in the order in which
27912 they are
27913 declared: the first member has the lowest memory address and
27914 the last member the highest.
27915
27916 2. Every data object has an alignment requirement. The alignment
27917 requirement
27918 for all data except structures, unions, and arrays is either
27919 the size of the object or the current packing size (specified
27920 with either the "aligned" attribute or the "pack" pragma),
27921 whichever is less. For structures, unions, and arrays, the
27922 alignment requirement is the largest alignment requirement of
27923 its members. Every object is allocated an offset so that:
27924
27925 offset % alignment_requirement == 0
27926
27927 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
27928 allocation
27929 unit if the integral types are the same size and if the next
27930 bit-field fits into the current allocation unit without
27931 crossing the boundary imposed by the common alignment
27932 requirements of the bit-fields.
27933
27934 MSVC interprets zero-length bit-fields in the following ways:
27935
27936 1. If a zero-length bit-field is inserted between two bit-fields
27937 that
27938 are normally coalesced, the bit-fields are not coalesced.
27939
27940 For example:
27941
27942 struct
27943 {
27944 unsigned long bf_1 : 12;
27945 unsigned long : 0;
27946 unsigned long bf_2 : 12;
27947 } t1;
27948
27949 The size of "t1" is 8 bytes with the zero-length bit-field. If
27950 the zero-length bit-field were removed, "t1"'s size would be 4
27951 bytes.
27952
27953 2. If a zero-length bit-field is inserted after a bit-field, "foo",
27954 and the
27955 alignment of the zero-length bit-field is greater than the
27956 member that follows it, "bar", "bar" is aligned as the type of
27957 the zero-length bit-field.
27958
27959 For example:
27960
27961 struct
27962 {
27963 char foo : 4;
27964 short : 0;
27965 char bar;
27966 } t2;
27967
27968 struct
27969 {
27970 char foo : 4;
27971 short : 0;
27972 double bar;
27973 } t3;
27974
27975 For "t2", "bar" is placed at offset 2, rather than offset 1.
27976 Accordingly, the size of "t2" is 4. For "t3", the zero-length
27977 bit-field does not affect the alignment of "bar" or, as a
27978 result, the size of the structure.
27979
27980 Taking this into account, it is important to note the
27981 following:
27982
27983 1. If a zero-length bit-field follows a normal bit-field, the
27984 type of the
27985 zero-length bit-field may affect the alignment of the
27986 structure as whole. For example, "t2" has a size of 4
27987 bytes, since the zero-length bit-field follows a normal
27988 bit-field, and is of type short.
27989
27990 2. Even if a zero-length bit-field is not followed by a normal
27991 bit-field, it may
27992 still affect the alignment of the structure:
27993
27994 struct
27995 {
27996 char foo : 6;
27997 long : 0;
27998 } t4;
27999
28000 Here, "t4" takes up 4 bytes.
28001
28002 3. Zero-length bit-fields following non-bit-field members are
28003 ignored:
28004 struct
28005 {
28006 char foo;
28007 long : 0;
28008 char bar;
28009 } t5;
28010
28011 Here, "t5" takes up 2 bytes.
28012
28013 -mno-align-stringops
28014 Do not align the destination of inlined string operations. This
28015 switch reduces code size and improves performance in case the
28016 destination is already aligned, but GCC doesn't know about it.
28017
28018 -minline-all-stringops
28019 By default GCC inlines string operations only when the destination
28020 is known to be aligned to least a 4-byte boundary. This enables
28021 more inlining and increases code size, but may improve performance
28022 of code that depends on fast "memcpy" and "memset" for short
28023 lengths. The option enables inline expansion of "strlen" for all
28024 pointer alignments.
28025
28026 -minline-stringops-dynamically
28027 For string operations of unknown size, use run-time checks with
28028 inline code for small blocks and a library call for large blocks.
28029
28030 -mstringop-strategy=alg
28031 Override the internal decision heuristic for the particular
28032 algorithm to use for inlining string operations. The allowed
28033 values for alg are:
28034
28035 rep_byte
28036 rep_4byte
28037 rep_8byte
28038 Expand using i386 "rep" prefix of the specified size.
28039
28040 byte_loop
28041 loop
28042 unrolled_loop
28043 Expand into an inline loop.
28044
28045 libcall
28046 Always use a library call.
28047
28048 -mmemcpy-strategy=strategy
28049 Override the internal decision heuristic to decide if
28050 "__builtin_memcpy" should be inlined and what inline algorithm to
28051 use when the expected size of the copy operation is known. strategy
28052 is a comma-separated list of alg:max_size:dest_align triplets. alg
28053 is specified in -mstringop-strategy, max_size specifies the max
28054 byte size with which inline algorithm alg is allowed. For the last
28055 triplet, the max_size must be "-1". The max_size of the triplets in
28056 the list must be specified in increasing order. The minimal byte
28057 size for alg is 0 for the first triplet and "max_size + 1" of the
28058 preceding range.
28059
28060 -mmemset-strategy=strategy
28061 The option is similar to -mmemcpy-strategy= except that it is to
28062 control "__builtin_memset" expansion.
28063
28064 -momit-leaf-frame-pointer
28065 Don't keep the frame pointer in a register for leaf functions.
28066 This avoids the instructions to save, set up, and restore frame
28067 pointers and makes an extra register available in leaf functions.
28068 The option -fomit-leaf-frame-pointer removes the frame pointer for
28069 leaf functions, which might make debugging harder.
28070
28071 -mtls-direct-seg-refs
28072 -mno-tls-direct-seg-refs
28073 Controls whether TLS variables may be accessed with offsets from
28074 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
28075 whether the thread base pointer must be added. Whether or not this
28076 is valid depends on the operating system, and whether it maps the
28077 segment to cover the entire TLS area.
28078
28079 For systems that use the GNU C Library, the default is on.
28080
28081 -msse2avx
28082 -mno-sse2avx
28083 Specify that the assembler should encode SSE instructions with VEX
28084 prefix. The option -mavx turns this on by default.
28085
28086 -mfentry
28087 -mno-fentry
28088 If profiling is active (-pg), put the profiling counter call before
28089 the prologue. Note: On x86 architectures the attribute
28090 "ms_hook_prologue" isn't possible at the moment for -mfentry and
28091 -pg.
28092
28093 -mrecord-mcount
28094 -mno-record-mcount
28095 If profiling is active (-pg), generate a __mcount_loc section that
28096 contains pointers to each profiling call. This is useful for
28097 automatically patching and out calls.
28098
28099 -mnop-mcount
28100 -mno-nop-mcount
28101 If profiling is active (-pg), generate the calls to the profiling
28102 functions as NOPs. This is useful when they should be patched in
28103 later dynamically. This is likely only useful together with
28104 -mrecord-mcount.
28105
28106 -minstrument-return=type
28107 Instrument function exit in -pg -mfentry instrumented functions
28108 with call to specified function. This only instruments true returns
28109 ending with ret, but not sibling calls ending with jump. Valid
28110 types are none to not instrument, call to generate a call to
28111 __return__, or nop5 to generate a 5 byte nop.
28112
28113 -mrecord-return
28114 -mno-record-return
28115 Generate a __return_loc section pointing to all return
28116 instrumentation code.
28117
28118 -mfentry-name=name
28119 Set name of __fentry__ symbol called at function entry for -pg
28120 -mfentry functions.
28121
28122 -mfentry-section=name
28123 Set name of section to record -mrecord-mcount calls (default
28124 __mcount_loc).
28125
28126 -mskip-rax-setup
28127 -mno-skip-rax-setup
28128 When generating code for the x86-64 architecture with SSE
28129 extensions disabled, -mskip-rax-setup can be used to skip setting
28130 up RAX register when there are no variable arguments passed in
28131 vector registers.
28132
28133 Warning: Since RAX register is used to avoid unnecessarily saving
28134 vector registers on stack when passing variable arguments, the
28135 impacts of this option are callees may waste some stack space,
28136 misbehave or jump to a random location. GCC 4.4 or newer don't
28137 have those issues, regardless the RAX register value.
28138
28139 -m8bit-idiv
28140 -mno-8bit-idiv
28141 On some processors, like Intel Atom, 8-bit unsigned integer divide
28142 is much faster than 32-bit/64-bit integer divide. This option
28143 generates a run-time check. If both dividend and divisor are
28144 within range of 0 to 255, 8-bit unsigned integer divide is used
28145 instead of 32-bit/64-bit integer divide.
28146
28147 -mavx256-split-unaligned-load
28148 -mavx256-split-unaligned-store
28149 Split 32-byte AVX unaligned load and store.
28150
28151 -mstack-protector-guard=guard
28152 -mstack-protector-guard-reg=reg
28153 -mstack-protector-guard-offset=offset
28154 Generate stack protection code using canary at guard. Supported
28155 locations are global for global canary or tls for per-thread canary
28156 in the TLS block (the default). This option has effect only when
28157 -fstack-protector or -fstack-protector-all is specified.
28158
28159 With the latter choice the options -mstack-protector-guard-reg=reg
28160 and -mstack-protector-guard-offset=offset furthermore specify which
28161 segment register (%fs or %gs) to use as base register for reading
28162 the canary, and from what offset from that base register. The
28163 default for those is as specified in the relevant ABI.
28164
28165 -mgeneral-regs-only
28166 Generate code that uses only the general-purpose registers. This
28167 prevents the compiler from using floating-point, vector, mask and
28168 bound registers.
28169
28170 -mrelax-cmpxchg-loop
28171 Relax cmpxchg loop by emitting an early load and compare before
28172 cmpxchg, execute pause if load value is not expected. This reduces
28173 excessive cachline bouncing when and works for all atomic logic
28174 fetch builtins that generates compare and swap loop.
28175
28176 -mindirect-branch=choice
28177 Convert indirect call and jump with choice. The default is keep,
28178 which keeps indirect call and jump unmodified. thunk converts
28179 indirect call and jump to call and return thunk. thunk-inline
28180 converts indirect call and jump to inlined call and return thunk.
28181 thunk-extern converts indirect call and jump to external call and
28182 return thunk provided in a separate object file. You can control
28183 this behavior for a specific function by using the function
28184 attribute "indirect_branch".
28185
28186 Note that -mcmodel=large is incompatible with
28187 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
28188 the thunk function may not be reachable in the large code model.
28189
28190 Note that -mindirect-branch=thunk-extern is compatible with
28191 -fcf-protection=branch since the external thunk can be made to
28192 enable control-flow check.
28193
28194 -mfunction-return=choice
28195 Convert function return with choice. The default is keep, which
28196 keeps function return unmodified. thunk converts function return
28197 to call and return thunk. thunk-inline converts function return to
28198 inlined call and return thunk. thunk-extern converts function
28199 return to external call and return thunk provided in a separate
28200 object file. You can control this behavior for a specific function
28201 by using the function attribute "function_return".
28202
28203 Note that -mindirect-return=thunk-extern is compatible with
28204 -fcf-protection=branch since the external thunk can be made to
28205 enable control-flow check.
28206
28207 Note that -mcmodel=large is incompatible with
28208 -mfunction-return=thunk and -mfunction-return=thunk-extern since
28209 the thunk function may not be reachable in the large code model.
28210
28211 -mindirect-branch-register
28212 Force indirect call and jump via register.
28213
28214 -mharden-sls=choice
28215 Generate code to mitigate against straight line speculation (SLS)
28216 with choice. The default is none which disables all SLS hardening.
28217 return enables SLS hardening for function returns. indirect-jmp
28218 enables SLS hardening for indirect jumps. all enables all SLS
28219 hardening.
28220
28221 -mindirect-branch-cs-prefix
28222 Add CS prefix to call and jmp to indirect thunk with branch target
28223 in r8-r15 registers so that the call and jmp instruction length is
28224 6 bytes to allow them to be replaced with lfence; call *%r8-r15 or
28225 lfence; jmp *%r8-r15 at run-time.
28226
28227 These -m switches are supported in addition to the above on x86-64
28228 processors in 64-bit environments.
28229
28230 -m32
28231 -m64
28232 -mx32
28233 -m16
28234 -miamcu
28235 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
28236 option sets "int", "long", and pointer types to 32 bits, and
28237 generates code that runs on any i386 system.
28238
28239 The -m64 option sets "int" to 32 bits and "long" and pointer types
28240 to 64 bits, and generates code for the x86-64 architecture. For
28241 Darwin only the -m64 option also turns off the -fno-pic and
28242 -mdynamic-no-pic options.
28243
28244 The -mx32 option sets "int", "long", and pointer types to 32 bits,
28245 and generates code for the x86-64 architecture.
28246
28247 The -m16 option is the same as -m32, except for that it outputs the
28248 ".code16gcc" assembly directive at the beginning of the assembly
28249 output so that the binary can run in 16-bit mode.
28250
28251 The -miamcu option generates code which conforms to Intel MCU
28252 psABI. It requires the -m32 option to be turned on.
28253
28254 -mno-red-zone
28255 Do not use a so-called "red zone" for x86-64 code. The red zone is
28256 mandated by the x86-64 ABI; it is a 128-byte area beyond the
28257 location of the stack pointer that is not modified by signal or
28258 interrupt handlers and therefore can be used for temporary data
28259 without adjusting the stack pointer. The flag -mno-red-zone
28260 disables this red zone.
28261
28262 -mcmodel=small
28263 Generate code for the small code model: the program and its symbols
28264 must be linked in the lower 2 GB of the address space. Pointers
28265 are 64 bits. Programs can be statically or dynamically linked.
28266 This is the default code model.
28267
28268 -mcmodel=kernel
28269 Generate code for the kernel code model. The kernel runs in the
28270 negative 2 GB of the address space. This model has to be used for
28271 Linux kernel code.
28272
28273 -mcmodel=medium
28274 Generate code for the medium model: the program is linked in the
28275 lower 2 GB of the address space. Small symbols are also placed
28276 there. Symbols with sizes larger than -mlarge-data-threshold are
28277 put into large data or BSS sections and can be located above 2GB.
28278 Programs can be statically or dynamically linked.
28279
28280 -mcmodel=large
28281 Generate code for the large model. This model makes no assumptions
28282 about addresses and sizes of sections.
28283
28284 -maddress-mode=long
28285 Generate code for long address mode. This is only supported for
28286 64-bit and x32 environments. It is the default address mode for
28287 64-bit environments.
28288
28289 -maddress-mode=short
28290 Generate code for short address mode. This is only supported for
28291 32-bit and x32 environments. It is the default address mode for
28292 32-bit and x32 environments.
28293
28294 -mneeded
28295 -mno-needed
28296 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
28297 indicate the micro-architecture ISA level required to execute the
28298 binary.
28299
28300 -mno-direct-extern-access
28301 Without -fpic nor -fPIC, always use the GOT pointer to access
28302 external symbols. With -fpic or -fPIC, treat access to protected
28303 symbols as local symbols. The default is -mdirect-extern-access.
28304
28305 Warning: shared libraries compiled with -mno-direct-extern-access
28306 and executable compiled with -mdirect-extern-access may not be
28307 binary compatible if protected symbols are used in shared libraries
28308 and executable.
28309
28310 x86 Windows Options
28311
28312 These additional options are available for Microsoft Windows targets:
28313
28314 -mconsole
28315 This option specifies that a console application is to be
28316 generated, by instructing the linker to set the PE header subsystem
28317 type required for console applications. This option is available
28318 for Cygwin and MinGW targets and is enabled by default on those
28319 targets.
28320
28321 -mdll
28322 This option is available for Cygwin and MinGW targets. It
28323 specifies that a DLL---a dynamic link library---is to be generated,
28324 enabling the selection of the required runtime startup object and
28325 entry point.
28326
28327 -mnop-fun-dllimport
28328 This option is available for Cygwin and MinGW targets. It
28329 specifies that the "dllimport" attribute should be ignored.
28330
28331 -mthreads
28332 This option is available for MinGW targets. It specifies that
28333 MinGW-specific thread support is to be used.
28334
28335 -municode
28336 This option is available for MinGW-w64 targets. It causes the
28337 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
28338 capable runtime startup code.
28339
28340 -mwin32
28341 This option is available for Cygwin and MinGW targets. It
28342 specifies that the typical Microsoft Windows predefined macros are
28343 to be set in the pre-processor, but does not influence the choice
28344 of runtime library/startup code.
28345
28346 -mwindows
28347 This option is available for Cygwin and MinGW targets. It
28348 specifies that a GUI application is to be generated by instructing
28349 the linker to set the PE header subsystem type appropriately.
28350
28351 -fno-set-stack-executable
28352 This option is available for MinGW targets. It specifies that the
28353 executable flag for the stack used by nested functions isn't set.
28354 This is necessary for binaries running in kernel mode of Microsoft
28355 Windows, as there the User32 API, which is used to set executable
28356 privileges, isn't available.
28357
28358 -fwritable-relocated-rdata
28359 This option is available for MinGW and Cygwin targets. It
28360 specifies that relocated-data in read-only section is put into the
28361 ".data" section. This is a necessary for older runtimes not
28362 supporting modification of ".rdata" sections for pseudo-relocation.
28363
28364 -mpe-aligned-commons
28365 This option is available for Cygwin and MinGW targets. It
28366 specifies that the GNU extension to the PE file format that permits
28367 the correct alignment of COMMON variables should be used when
28368 generating code. It is enabled by default if GCC detects that the
28369 target assembler found during configuration supports the feature.
28370
28371 See also under x86 Options for standard options.
28372
28373 Xstormy16 Options
28374
28375 These options are defined for Xstormy16:
28376
28377 -msim
28378 Choose startup files and linker script suitable for the simulator.
28379
28380 Xtensa Options
28381
28382 These options are supported for Xtensa targets:
28383
28384 -mconst16
28385 -mno-const16
28386 Enable or disable use of "CONST16" instructions for loading
28387 constant values. The "CONST16" instruction is currently not a
28388 standard option from Tensilica. When enabled, "CONST16"
28389 instructions are always used in place of the standard "L32R"
28390 instructions. The use of "CONST16" is enabled by default only if
28391 the "L32R" instruction is not available.
28392
28393 -mfused-madd
28394 -mno-fused-madd
28395 Enable or disable use of fused multiply/add and multiply/subtract
28396 instructions in the floating-point option. This has no effect if
28397 the floating-point option is not also enabled. Disabling fused
28398 multiply/add and multiply/subtract instructions forces the compiler
28399 to use separate instructions for the multiply and add/subtract
28400 operations. This may be desirable in some cases where strict IEEE
28401 754-compliant results are required: the fused multiply add/subtract
28402 instructions do not round the intermediate result, thereby
28403 producing results with more bits of precision than specified by the
28404 IEEE standard. Disabling fused multiply add/subtract instructions
28405 also ensures that the program output is not sensitive to the
28406 compiler's ability to combine multiply and add/subtract operations.
28407
28408 -mserialize-volatile
28409 -mno-serialize-volatile
28410 When this option is enabled, GCC inserts "MEMW" instructions before
28411 "volatile" memory references to guarantee sequential consistency.
28412 The default is -mserialize-volatile. Use -mno-serialize-volatile
28413 to omit the "MEMW" instructions.
28414
28415 -mforce-no-pic
28416 For targets, like GNU/Linux, where all user-mode Xtensa code must
28417 be position-independent code (PIC), this option disables PIC for
28418 compiling kernel code.
28419
28420 -mtext-section-literals
28421 -mno-text-section-literals
28422 These options control the treatment of literal pools. The default
28423 is -mno-text-section-literals, which places literals in a separate
28424 section in the output file. This allows the literal pool to be
28425 placed in a data RAM/ROM, and it also allows the linker to combine
28426 literal pools from separate object files to remove redundant
28427 literals and improve code size. With -mtext-section-literals, the
28428 literals are interspersed in the text section in order to keep them
28429 as close as possible to their references. This may be necessary
28430 for large assembly files. Literals for each function are placed
28431 right before that function.
28432
28433 -mauto-litpools
28434 -mno-auto-litpools
28435 These options control the treatment of literal pools. The default
28436 is -mno-auto-litpools, which places literals in a separate section
28437 in the output file unless -mtext-section-literals is used. With
28438 -mauto-litpools the literals are interspersed in the text section
28439 by the assembler. Compiler does not produce explicit ".literal"
28440 directives and loads literals into registers with "MOVI"
28441 instructions instead of "L32R" to let the assembler do relaxation
28442 and place literals as necessary. This option allows assembler to
28443 create several literal pools per function and assemble very big
28444 functions, which may not be possible with -mtext-section-literals.
28445
28446 -mtarget-align
28447 -mno-target-align
28448 When this option is enabled, GCC instructs the assembler to
28449 automatically align instructions to reduce branch penalties at the
28450 expense of some code density. The assembler attempts to widen
28451 density instructions to align branch targets and the instructions
28452 following call instructions. If there are not enough preceding
28453 safe density instructions to align a target, no widening is
28454 performed. The default is -mtarget-align. These options do not
28455 affect the treatment of auto-aligned instructions like "LOOP",
28456 which the assembler always aligns, either by widening density
28457 instructions or by inserting NOP instructions.
28458
28459 -mlongcalls
28460 -mno-longcalls
28461 When this option is enabled, GCC instructs the assembler to
28462 translate direct calls to indirect calls unless it can determine
28463 that the target of a direct call is in the range allowed by the
28464 call instruction. This translation typically occurs for calls to
28465 functions in other source files. Specifically, the assembler
28466 translates a direct "CALL" instruction into an "L32R" followed by a
28467 "CALLX" instruction. The default is -mno-longcalls. This option
28468 should be used in programs where the call target can potentially be
28469 out of range. This option is implemented in the assembler, not the
28470 compiler, so the assembly code generated by GCC still shows direct
28471 call instructions---look at the disassembled object code to see the
28472 actual instructions. Note that the assembler uses an indirect call
28473 for every cross-file call, not just those that really are out of
28474 range.
28475
28476 -mabi=name
28477 Generate code for the specified ABI. Permissible values are:
28478 call0, windowed. Default ABI is chosen by the Xtensa core
28479 configuration.
28480
28481 -mabi=call0
28482 When this option is enabled function parameters are passed in
28483 registers "a2" through "a7", registers "a12" through "a15" are
28484 caller-saved, and register "a15" may be used as a frame pointer.
28485 When this version of the ABI is enabled the C preprocessor symbol
28486 "__XTENSA_CALL0_ABI__" is defined.
28487
28488 -mabi=windowed
28489 When this option is enabled function parameters are passed in
28490 registers "a10" through "a15", and called function rotates register
28491 window by 8 registers on entry so that its arguments are found in
28492 registers "a2" through "a7". Register "a7" may be used as a frame
28493 pointer. Register window is rotated 8 registers back upon return.
28494 When this version of the ABI is enabled the C preprocessor symbol
28495 "__XTENSA_WINDOWED_ABI__" is defined.
28496
28497 zSeries Options
28498
28499 These are listed under
28500
28502 This section describes several environment variables that affect how
28503 GCC operates. Some of them work by specifying directories or prefixes
28504 to use when searching for various kinds of files. Some are used to
28505 specify other aspects of the compilation environment.
28506
28507 Note that you can also specify places to search using options such as
28508 -B, -I and -L. These take precedence over places specified using
28509 environment variables, which in turn take precedence over those
28510 specified by the configuration of GCC.
28511
28512 LANG
28513 LC_CTYPE
28514 LC_MESSAGES
28515 LC_ALL
28516 These environment variables control the way that GCC uses
28517 localization information which allows GCC to work with different
28518 national conventions. GCC inspects the locale categories LC_CTYPE
28519 and LC_MESSAGES if it has been configured to do so. These locale
28520 categories can be set to any value supported by your installation.
28521 A typical value is en_GB.UTF-8 for English in the United Kingdom
28522 encoded in UTF-8.
28523
28524 The LC_CTYPE environment variable specifies character
28525 classification. GCC uses it to determine the character boundaries
28526 in a string; this is needed for some multibyte encodings that
28527 contain quote and escape characters that are otherwise interpreted
28528 as a string end or escape.
28529
28530 The LC_MESSAGES environment variable specifies the language to use
28531 in diagnostic messages.
28532
28533 If the LC_ALL environment variable is set, it overrides the value
28534 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
28535 default to the value of the LANG environment variable. If none of
28536 these variables are set, GCC defaults to traditional C English
28537 behavior.
28538
28539 TMPDIR
28540 If TMPDIR is set, it specifies the directory to use for temporary
28541 files. GCC uses temporary files to hold the output of one stage of
28542 compilation which is to be used as input to the next stage: for
28543 example, the output of the preprocessor, which is the input to the
28544 compiler proper.
28545
28546 GCC_COMPARE_DEBUG
28547 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
28548 -fcompare-debug to the compiler driver. See the documentation of
28549 this option for more details.
28550
28551 GCC_EXEC_PREFIX
28552 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
28553 names of the subprograms executed by the compiler. No slash is
28554 added when this prefix is combined with the name of a subprogram,
28555 but you can specify a prefix that ends with a slash if you wish.
28556
28557 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
28558 appropriate prefix to use based on the pathname it is invoked with.
28559
28560 If GCC cannot find the subprogram using the specified prefix, it
28561 tries looking in the usual places for the subprogram.
28562
28563 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
28564 prefix is the prefix to the installed compiler. In many cases
28565 prefix is the value of "prefix" when you ran the configure script.
28566
28567 Other prefixes specified with -B take precedence over this prefix.
28568
28569 This prefix is also used for finding files such as crt0.o that are
28570 used for linking.
28571
28572 In addition, the prefix is used in an unusual way in finding the
28573 directories to search for header files. For each of the standard
28574 directories whose name normally begins with /usr/local/lib/gcc
28575 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
28576 replacing that beginning with the specified prefix to produce an
28577 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
28578 just before it searches the standard directory /usr/local/lib/bar.
28579 If a standard directory begins with the configured prefix then the
28580 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
28581 header files.
28582
28583 COMPILER_PATH
28584 The value of COMPILER_PATH is a colon-separated list of
28585 directories, much like PATH. GCC tries the directories thus
28586 specified when searching for subprograms, if it cannot find the
28587 subprograms using GCC_EXEC_PREFIX.
28588
28589 LIBRARY_PATH
28590 The value of LIBRARY_PATH is a colon-separated list of directories,
28591 much like PATH. When configured as a native compiler, GCC tries
28592 the directories thus specified when searching for special linker
28593 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
28594 GCC also uses these directories when searching for ordinary
28595 libraries for the -l option (but directories specified with -L come
28596 first).
28597
28598 LANG
28599 This variable is used to pass locale information to the compiler.
28600 One way in which this information is used is to determine the
28601 character set to be used when character literals, string literals
28602 and comments are parsed in C and C++. When the compiler is
28603 configured to allow multibyte characters, the following values for
28604 LANG are recognized:
28605
28606 C-JIS
28607 Recognize JIS characters.
28608
28609 C-SJIS
28610 Recognize SJIS characters.
28611
28612 C-EUCJP
28613 Recognize EUCJP characters.
28614
28615 If LANG is not defined, or if it has some other value, then the
28616 compiler uses "mblen" and "mbtowc" as defined by the default locale
28617 to recognize and translate multibyte characters.
28618
28619 GCC_EXTRA_DIAGNOSTIC_OUTPUT
28620 If GCC_EXTRA_DIAGNOSTIC_OUTPUT is set to one of the following
28621 values, then additional text will be emitted to stderr when fix-it
28622 hints are emitted. -fdiagnostics-parseable-fixits and
28623 -fno-diagnostics-parseable-fixits take precedence over this
28624 environment variable.
28625
28626 fixits-v1
28627 Emit parseable fix-it hints, equivalent to
28628 -fdiagnostics-parseable-fixits. In particular, columns are
28629 expressed as a count of bytes, starting at byte 1 for the
28630 initial column.
28631
28632 fixits-v2
28633 As "fixits-v1", but columns are expressed as display columns,
28634 as per -fdiagnostics-column-unit=display.
28635
28636 Some additional environment variables affect the behavior of the
28637 preprocessor.
28638
28639 CPATH
28640 C_INCLUDE_PATH
28641 CPLUS_INCLUDE_PATH
28642 OBJC_INCLUDE_PATH
28643 Each variable's value is a list of directories separated by a
28644 special character, much like PATH, in which to look for header
28645 files. The special character, "PATH_SEPARATOR", is target-
28646 dependent and determined at GCC build time. For Microsoft Windows-
28647 based targets it is a semicolon, and for almost all other targets
28648 it is a colon.
28649
28650 CPATH specifies a list of directories to be searched as if
28651 specified with -I, but after any paths given with -I options on the
28652 command line. This environment variable is used regardless of
28653 which language is being preprocessed.
28654
28655 The remaining environment variables apply only when preprocessing
28656 the particular language indicated. Each specifies a list of
28657 directories to be searched as if specified with -isystem, but after
28658 any paths given with -isystem options on the command line.
28659
28660 In all these variables, an empty element instructs the compiler to
28661 search its current working directory. Empty elements can appear at
28662 the beginning or end of a path. For instance, if the value of
28663 CPATH is ":/special/include", that has the same effect as
28664 -I. -I/special/include.
28665
28666 DEPENDENCIES_OUTPUT
28667 If this variable is set, its value specifies how to output
28668 dependencies for Make based on the non-system header files
28669 processed by the compiler. System header files are ignored in the
28670 dependency output.
28671
28672 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
28673 case the Make rules are written to that file, guessing the target
28674 name from the source file name. Or the value can have the form
28675 file target, in which case the rules are written to file file using
28676 target as the target name.
28677
28678 In other words, this environment variable is equivalent to
28679 combining the options -MM and -MF, with an optional -MT switch too.
28680
28681 SUNPRO_DEPENDENCIES
28682 This variable is the same as DEPENDENCIES_OUTPUT (see above),
28683 except that system header files are not ignored, so it implies -M
28684 rather than -MM. However, the dependence on the main input file is
28685 omitted.
28686
28687 SOURCE_DATE_EPOCH
28688 If this variable is set, its value specifies a UNIX timestamp to be
28689 used in replacement of the current date and time in the "__DATE__"
28690 and "__TIME__" macros, so that the embedded timestamps become
28691 reproducible.
28692
28693 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
28694 the number of seconds (excluding leap seconds) since 01 Jan 1970
28695 00:00:00 represented in ASCII; identical to the output of "date
28696 +%s" on GNU/Linux and other systems that support the %s extension
28697 in the "date" command.
28698
28699 The value should be a known timestamp such as the last modification
28700 time of the source or package and it should be set by the build
28701 process.
28702
28704 For instructions on reporting bugs, see
28705 <http://bugzilla.redhat.com/bugzilla>.
28706
28708 1. On some systems, gcc -shared needs to build supplementary stub code
28709 for constructors to work. On multi-libbed systems, gcc -shared
28710 must select the correct support libraries to link against. Failing
28711 to supply the correct flags may lead to subtle defects. Supplying
28712 them in cases where they are not necessary is innocuous.
28713
28715 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1),
28716 dbx(1) and the Info entries for gcc, cpp, as, ld, binutils and gdb.
28717
28719 See the Info entry for gcc, or
28720 <https://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for
28721 contributors to GCC.
28722
28724 Copyright (c) 1988-2022 Free Software Foundation, Inc.
28725
28726 Permission is granted to copy, distribute and/or modify this document
28727 under the terms of the GNU Free Documentation License, Version 1.3 or
28728 any later version published by the Free Software Foundation; with the
28729 Invariant Sections being "GNU General Public License" and "Funding Free
28730 Software", the Front-Cover texts being (a) (see below), and with the
28731 Back-Cover Texts being (b) (see below). A copy of the license is
28732 included in the gfdl(7) man page.
28733
28734 (a) The FSF's Front-Cover Text is:
28735
28736 A GNU Manual
28737
28738 (b) The FSF's Back-Cover Text is:
28739
28740 You have freedom to copy and modify this GNU Manual, like GNU
28741 software. Copies published by the Free Software Foundation raise
28742 funds for GNU development.
28743
28744
28745
28746gcc-12.2.1 2022-11-21 GCC(1)