1GCC(1) GNU GCC(1)
2
3
4
6 gcc - GNU project C and C++ compiler
7
9 gcc [-c|-S|-E] [-std=standard]
10 [-g] [-pg] [-Olevel]
11 [-Wwarn...] [-Wpedantic]
12 [-Idir...] [-Ldir...]
13 [-Dmacro[=defn]...] [-Umacro]
14 [-foption...] [-mmachine-option...]
15 [-o outfile] [@file] infile...
16
17 Only the most useful options are listed here; see below for the
18 remainder. g++ accepts mostly the same options as gcc.
19
21 When you invoke GCC, it normally does preprocessing, compilation,
22 assembly and linking. The "overall options" allow you to stop this
23 process at an intermediate stage. For example, the -c option says not
24 to run the linker. Then the output consists of object files output by
25 the assembler.
26
27 Other options are passed on to one or more stages of processing. Some
28 options control the preprocessor and others the compiler itself. Yet
29 other options control the assembler and linker; most of these are not
30 documented here, since you rarely need to use any of them.
31
32 Most of the command-line options that you can use with GCC are useful
33 for C programs; when an option is only useful with another language
34 (usually C++), the explanation says so explicitly. If the description
35 for a particular option does not mention a source language, you can use
36 that option with all supported languages.
37
38 The usual way to run GCC is to run the executable called gcc, or
39 machine-gcc when cross-compiling, or machine-gcc-version to run a
40 specific version of GCC. When you compile C++ programs, you should
41 invoke GCC as g++ instead.
42
43 The gcc program accepts options and file names as operands. Many
44 options have multi-letter names; therefore multiple single-letter
45 options may not be grouped: -dv is very different from -d -v.
46
47 You can mix options and other arguments. For the most part, the order
48 you use doesn't matter. Order does matter when you use several options
49 of the same kind; for example, if you specify -L more than once, the
50 directories are searched in the order specified. Also, the placement
51 of the -l option is significant.
52
53 Many options have long names starting with -f or with -W---for example,
54 -fmove-loop-invariants, -Wformat and so on. Most of these have both
55 positive and negative forms; the negative form of -ffoo is -fno-foo.
56 This manual documents only one of these two forms, whichever one is not
57 the default.
58
59 Some options take one or more arguments typically separated either by a
60 space or by the equals sign (=) from the option name. Unless
61 documented otherwise, an argument can be either numeric or a string.
62 Numeric arguments must typically be small unsigned decimal or
63 hexadecimal integers. Hexadecimal arguments must begin with the 0x
64 prefix. Arguments to options that specify a size threshold of some
65 sort may be arbitrarily large decimal or hexadecimal integers followed
66 by a byte size suffix designating a multiple of bytes such as "kB" and
67 "KiB" for kilobyte and kibibyte, respectively, "MB" and "MiB" for
68 megabyte and mebibyte, "GB" and "GiB" for gigabyte and gigibyte, and so
69 on. Such arguments are designated by byte-size in the following text.
70 Refer to the NIST, IEC, and other relevant national and international
71 standards for the full listing and explanation of the binary and
72 decimal byte size prefixes.
73
75 Option Summary
76 Here is a summary of all the options, grouped by type. Explanations
77 are in the following sections.
78
79 Overall Options
80 -c -S -E -o file -dumpbase dumpbase -dumpbase-ext auxdropsuf
81 -dumpdir dumppfx -x language -v -### --help[=class[,...]]
82 --target-help --version -pass-exit-codes -pipe -specs=file
83 -wrapper @file -ffile-prefix-map=old=new -fplugin=file
84 -fplugin-arg-name=arg -fdump-ada-spec[-slim]
85 -fada-spec-parent=unit -fdump-go-spec=file
86
87 C Language Options
88 -ansi -std=standard -aux-info filename
89 -fallow-parameterless-variadic-functions -fno-asm -fno-builtin
90 -fno-builtin-function -fcond-mismatch -ffreestanding -fgimple
91 -fgnu-tm -fgnu89-inline -fhosted -flax-vector-conversions
92 -fms-extensions -foffload=arg -foffload-options=arg -fopenacc
93 -fopenacc-dim=geom -fopenmp -fopenmp-simd
94 -fpermitted-flt-eval-methods=standard -fplan9-extensions
95 -fsigned-bitfields -funsigned-bitfields -fsigned-char
96 -funsigned-char -fsso-struct=endianness
97
98 C++ Language Options
99 -fabi-version=n -fno-access-control -faligned-new=n
100 -fargs-in-order=n -fchar8_t -fcheck-new -fconstexpr-depth=n
101 -fconstexpr-cache-depth=n -fconstexpr-loop-limit=n
102 -fconstexpr-ops-limit=n -fno-elide-constructors
103 -fno-enforce-eh-specs -fno-gnu-keywords -fno-implicit-templates
104 -fno-implicit-inline-templates -fno-implement-inlines
105 -fmodule-header[=kind] -fmodule-only -fmodules-ts
106 -fmodule-implicit-inline -fno-module-lazy
107 -fmodule-mapper=specification -fmodule-version-ignore
108 -fms-extensions -fnew-inheriting-ctors -fnew-ttp-matching
109 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names
110 -fno-optional-diags -fpermissive -fno-pretty-templates -fno-rtti
111 -fsized-deallocation -ftemplate-backtrace-limit=n
112 -ftemplate-depth=n -fno-threadsafe-statics -fuse-cxa-atexit
113 -fno-weak -nostdinc++ -fvisibility-inlines-hidden
114 -fvisibility-ms-compat -fext-numeric-literals
115 -flang-info-include-translate[=header]
116 -flang-info-include-translate-not -flang-info-module-cmi[=module]
117 -stdlib=libstdc++,libc++ -Wabi-tag -Wcatch-value -Wcatch-value=n
118 -Wno-class-conversion -Wclass-memaccess -Wcomma-subscript
119 -Wconditionally-supported -Wno-conversion-null
120 -Wctad-maybe-unsupported -Wctor-dtor-privacy
121 -Wno-delete-incomplete -Wdelete-non-virtual-dtor
122 -Wno-deprecated-array-compare -Wdeprecated-copy
123 -Wdeprecated-copy-dtor -Wno-deprecated-enum-enum-conversion
124 -Wno-deprecated-enum-float-conversion -Weffc++ -Wno-exceptions
125 -Wextra-semi -Wno-inaccessible-base -Wno-inherited-variadic-ctor
126 -Wno-init-list-lifetime -Winvalid-imported-macros
127 -Wno-invalid-offsetof -Wno-literal-suffix -Wmismatched-new-delete
128 -Wmismatched-tags -Wmultiple-inheritance -Wnamespaces -Wnarrowing
129 -Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor -Wpessimizing-move
130 -Wno-placement-new -Wplacement-new=n -Wrange-loop-construct
131 -Wredundant-move -Wredundant-tags -Wreorder -Wregister
132 -Wstrict-null-sentinel -Wno-subobject-linkage -Wtemplates
133 -Wno-non-template-friend -Wold-style-cast -Woverloaded-virtual
134 -Wno-pmf-conversions -Wsign-promo -Wsized-deallocation
135 -Wsuggest-final-methods -Wsuggest-final-types -Wsuggest-override
136 -Wno-terminate -Wuseless-cast -Wno-vexing-parse
137 -Wvirtual-inheritance -Wno-virtual-move-assign -Wvolatile
138 -Wzero-as-null-pointer-constant
139
140 Objective-C and Objective-C++ Language Options
141 -fconstant-string-class=class-name -fgnu-runtime -fnext-runtime
142 -fno-nil-receivers -fobjc-abi-version=n -fobjc-call-cxx-cdtors
143 -fobjc-direct-dispatch -fobjc-exceptions -fobjc-gc -fobjc-nilcheck
144 -fobjc-std=objc1 -fno-local-ivars
145 -fivar-visibility=[public|protected|private|package]
146 -freplace-objc-classes -fzero-link -gen-decls -Wassign-intercept
147 -Wno-property-assign-default -Wno-protocol -Wobjc-root-class
148 -Wselector -Wstrict-selector-match -Wundeclared-selector
149
150 Diagnostic Message Formatting Options
151 -fmessage-length=n -fdiagnostics-plain-output
152 -fdiagnostics-show-location=[once|every-line]
153 -fdiagnostics-color=[auto|never|always]
154 -fdiagnostics-urls=[auto|never|always]
155 -fdiagnostics-format=[text|json] -fno-diagnostics-show-option
156 -fno-diagnostics-show-caret -fno-diagnostics-show-labels
157 -fno-diagnostics-show-line-numbers -fno-diagnostics-show-cwe
158 -fdiagnostics-minimum-margin-width=width
159 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch
160 -fdiagnostics-show-template-tree -fno-elide-type
161 -fdiagnostics-path-format=[none|separate-events|inline-events]
162 -fdiagnostics-show-path-depths -fno-show-column
163 -fdiagnostics-column-unit=[display|byte]
164 -fdiagnostics-column-origin=origin
165 -fdiagnostics-escape-format=[unicode|bytes]
166
167 Warning Options
168 -fsyntax-only -fmax-errors=n -Wpedantic -pedantic-errors -w
169 -Wextra -Wall -Wabi=n -Waddress -Wno-address-of-packed-member
170 -Waggregate-return -Walloc-size-larger-than=byte-size -Walloc-zero
171 -Walloca -Walloca-larger-than=byte-size
172 -Wno-aggressive-loop-optimizations -Warith-conversion
173 -Warray-bounds -Warray-bounds=n -Warray-compare -Wno-attributes
174 -Wattribute-alias=n -Wno-attribute-alias -Wno-attribute-warning
175 -Wbidi-chars=[none|unpaired|any|ucn] -Wbool-compare
176 -Wbool-operation -Wno-builtin-declaration-mismatch
177 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat
178 -Wc11-c2x-compat -Wc++-compat -Wc++11-compat -Wc++14-compat
179 -Wc++17-compat -Wc++20-compat -Wno-c++11-extensions
180 -Wno-c++14-extensions -Wno-c++17-extensions -Wno-c++20-extensions
181 -Wno-c++23-extensions -Wcast-align -Wcast-align=strict
182 -Wcast-function-type -Wcast-qual -Wchar-subscripts -Wclobbered
183 -Wcomment -Wconversion -Wno-coverage-mismatch -Wno-cpp
184 -Wdangling-else -Wdangling-pointer -Wdangling-pointer=n
185 -Wdate-time -Wno-deprecated -Wno-deprecated-declarations
186 -Wno-designated-init -Wdisabled-optimization
187 -Wno-discarded-array-qualifiers -Wno-discarded-qualifiers
188 -Wno-div-by-zero -Wdouble-promotion -Wduplicated-branches
189 -Wduplicated-cond -Wempty-body -Wno-endif-labels -Wenum-compare
190 -Wenum-conversion -Werror -Werror=* -Wexpansion-to-defined
191 -Wfatal-errors -Wfloat-conversion -Wfloat-equal -Wformat
192 -Wformat=2 -Wno-format-contains-nul -Wno-format-extra-args
193 -Wformat-nonliteral -Wformat-overflow=n -Wformat-security
194 -Wformat-signedness -Wformat-truncation=n -Wformat-y2k
195 -Wframe-address -Wframe-larger-than=byte-size
196 -Wno-free-nonheap-object -Wno-if-not-aligned
197 -Wno-ignored-attributes -Wignored-qualifiers
198 -Wno-incompatible-pointer-types -Wimplicit -Wimplicit-fallthrough
199 -Wimplicit-fallthrough=n -Wno-implicit-function-declaration
200 -Wno-implicit-int -Winfinite-recursion -Winit-self -Winline
201 -Wno-int-conversion -Wint-in-bool-context -Wno-int-to-pointer-cast
202 -Wno-invalid-memory-model -Winvalid-pch -Wjump-misses-init
203 -Wlarger-than=byte-size -Wlogical-not-parentheses -Wlogical-op
204 -Wlong-long -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized
205 -Wmemset-elt-size -Wmemset-transposed-args
206 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces
207 -Wmissing-field-initializers -Wmissing-format-attribute
208 -Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile
209 -Wno-multichar -Wmultistatement-macros -Wnonnull
210 -Wnonnull-compare -Wnormalized=[none|id|nfc|nfkc]
211 -Wnull-dereference -Wno-odr -Wopenacc-parallelism -Wopenmp-simd
212 -Wno-overflow -Woverlength-strings
213 -Wno-override-init-side-effects -Wpacked
214 -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
215 -Wparentheses -Wno-pedantic-ms-format -Wpointer-arith
216 -Wno-pointer-compare -Wno-pointer-to-int-cast -Wno-pragmas
217 -Wno-prio-ctor-dtor -Wredundant-decls -Wrestrict
218 -Wno-return-local-addr -Wreturn-type -Wno-scalar-storage-order
219 -Wsequence-point -Wshadow -Wshadow=global -Wshadow=local
220 -Wshadow=compatible-local -Wno-shadow-ivar
221 -Wno-shift-count-negative -Wno-shift-count-overflow
222 -Wshift-negative-value -Wno-shift-overflow -Wshift-overflow=n
223 -Wsign-compare -Wsign-conversion -Wno-sizeof-array-argument
224 -Wsizeof-array-div -Wsizeof-pointer-div -Wsizeof-pointer-memaccess
225 -Wstack-protector -Wstack-usage=byte-size -Wstrict-aliasing
226 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=n
227 -Wstring-compare -Wno-stringop-overflow -Wno-stringop-overread
228 -Wno-stringop-truncation
229 -Wsuggest-attribute=[pure|const|noreturn|format|malloc] -Wswitch
230 -Wno-switch-bool -Wswitch-default -Wswitch-enum
231 -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand
232 -Wsystem-headers -Wtautological-compare -Wtrampolines
233 -Wtrigraphs -Wtrivial-auto-var-init -Wtsan -Wtype-limits -Wundef
234 -Wuninitialized -Wunknown-pragmas -Wunsuffixed-float-constants
235 -Wunused -Wunused-but-set-parameter -Wunused-but-set-variable
236 -Wunused-const-variable -Wunused-const-variable=n
237 -Wunused-function -Wunused-label -Wunused-local-typedefs
238 -Wunused-macros -Wunused-parameter -Wno-unused-result
239 -Wunused-value -Wunused-variable -Wno-varargs -Wvariadic-macros
240 -Wvector-operation-performance -Wvla -Wvla-larger-than=byte-size
241 -Wno-vla-larger-than -Wvolatile-register-var -Wwrite-strings
242 -Wzero-length-bounds
243
244 Static Analyzer Options
245 -fanalyzer -fanalyzer-call-summaries -fanalyzer-checker=name
246 -fno-analyzer-feasibility -fanalyzer-fine-grained
247 -fno-analyzer-state-merge -fno-analyzer-state-purge
248 -fanalyzer-transitivity -fanalyzer-verbose-edges
249 -fanalyzer-verbose-state-changes -fanalyzer-verbosity=level
250 -fdump-analyzer -fdump-analyzer-callgraph
251 -fdump-analyzer-exploded-graph -fdump-analyzer-exploded-nodes
252 -fdump-analyzer-exploded-nodes-2 -fdump-analyzer-exploded-nodes-3
253 -fdump-analyzer-exploded-paths -fdump-analyzer-feasibility
254 -fdump-analyzer-json -fdump-analyzer-state-purge
255 -fdump-analyzer-stderr -fdump-analyzer-supergraph
256 -fdump-analyzer-untracked -Wno-analyzer-double-fclose
257 -Wno-analyzer-double-free
258 -Wno-analyzer-exposure-through-output-file -Wno-analyzer-file-leak
259 -Wno-analyzer-free-of-non-heap -Wno-analyzer-malloc-leak
260 -Wno-analyzer-mismatching-deallocation -Wno-analyzer-null-argument
261 -Wno-analyzer-null-dereference -Wno-analyzer-possible-null-argument
262 -Wno-analyzer-possible-null-dereference
263 -Wno-analyzer-shift-count-negative
264 -Wno-analyzer-shift-count-overflow
265 -Wno-analyzer-stale-setjmp-buffer
266 -Wno-analyzer-tainted-allocation-size
267 -Wno-analyzer-tainted-array-index -Wno-analyzer-tainted-divisor
268 -Wno-analyzer-tainted-offset -Wno-analyzer-tainted-size
269 -Wanalyzer-too-complex
270 -Wno-analyzer-unsafe-call-within-signal-handler
271 -Wno-analyzer-use-after-free
272 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
273 -Wno-analyzer-use-of-uninitialized-value
274 -Wno-analyzer-write-to-const -Wno-analyzer-write-to-string-literal
275
276 C and Objective-C-only Warning Options
277 -Wbad-function-cast -Wmissing-declarations
278 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs
279 -Wold-style-declaration -Wold-style-definition -Wstrict-prototypes
280 -Wtraditional -Wtraditional-conversion
281 -Wdeclaration-after-statement -Wpointer-sign
282
283 Debugging Options
284 -g -glevel -gdwarf -gdwarf-version -gbtf -gctf -gctflevel -ggdb
285 -grecord-gcc-switches -gno-record-gcc-switches -gstabs -gstabs+
286 -gstrict-dwarf -gno-strict-dwarf -gas-loc-support
287 -gno-as-loc-support -gas-locview-support -gno-as-locview-support
288 -gcolumn-info -gno-column-info -gdwarf32 -gdwarf64
289 -gstatement-frontiers -gno-statement-frontiers
290 -gvariable-location-views -gno-variable-location-views
291 -ginternal-reset-location-views -gno-internal-reset-location-views
292 -ginline-points -gno-inline-points -gvms -gxcoff -gxcoff+
293 -gz[=type] -gsplit-dwarf -gdescribe-dies -gno-describe-dies
294 -fdebug-prefix-map=old=new -fdebug-types-section
295 -fno-eliminate-unused-debug-types -femit-struct-debug-baseonly
296 -femit-struct-debug-reduced -femit-struct-debug-detailed[=spec-
297 list] -fno-eliminate-unused-debug-symbols
298 -femit-class-debug-always -fno-merge-debug-strings
299 -fno-dwarf2-cfi-asm -fvar-tracking -fvar-tracking-assignments
300
301 Optimization Options
302 -faggressive-loop-optimizations -falign-functions[=n[:m:[n2[:m2]]]]
303 -falign-jumps[=n[:m:[n2[:m2]]]] -falign-labels[=n[:m:[n2[:m2]]]]
304 -falign-loops[=n[:m:[n2[:m2]]]] -fno-allocation-dce
305 -fallow-store-data-races -fassociative-math -fauto-profile
306 -fauto-profile[=path] -fauto-inc-dec -fbranch-probabilities
307 -fcaller-saves -fcombine-stack-adjustments -fconserve-stack
308 -fcompare-elim -fcprop-registers -fcrossjumping
309 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules
310 -fcx-limited-range -fdata-sections -fdce -fdelayed-branch
311 -fdelete-null-pointer-checks -fdevirtualize
312 -fdevirtualize-speculatively -fdevirtualize-at-ltrans -fdse
313 -fearly-inlining -fipa-sra -fexpensive-optimizations
314 -ffat-lto-objects -ffast-math -ffinite-math-only -ffloat-store
315 -fexcess-precision=style -ffinite-loops -fforward-propagate
316 -ffp-contract=style -ffunction-sections -fgcse
317 -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity
318 -fgcse-sm -fhoist-adjacent-loads -fif-conversion -fif-conversion2
319 -findirect-inlining -finline-functions
320 -finline-functions-called-once -finline-limit=n
321 -finline-small-functions -fipa-modref -fipa-cp -fipa-cp-clone
322 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const
323 -fipa-reference -fipa-reference-addressable -fipa-stack-alignment
324 -fipa-icf -fira-algorithm=algorithm -flive-patching=level
325 -fira-region=region -fira-hoist-pressure -fira-loop-pressure
326 -fno-ira-share-save-slots -fno-ira-share-spill-slots
327 -fisolate-erroneous-paths-dereference
328 -fisolate-erroneous-paths-attribute -fivopts
329 -fkeep-inline-functions -fkeep-static-functions
330 -fkeep-static-consts -flimit-function-alignment
331 -flive-range-shrinkage -floop-block -floop-interchange
332 -floop-strip-mine -floop-unroll-and-jam -floop-nest-optimize
333 -floop-parallelize-all -flra-remat -flto -flto-compression-level
334 -flto-partition=alg -fmerge-all-constants -fmerge-constants
335 -fmodulo-sched -fmodulo-sched-allow-regmoves
336 -fmove-loop-invariants -fmove-loop-stores -fno-branch-count-reg
337 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse
338 -fno-guess-branch-probability -fno-inline -fno-math-errno
339 -fno-peephole -fno-peephole2 -fno-printf-return-value
340 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros
341 -fno-toplevel-reorder -fno-trapping-math
342 -fno-zero-initialized-in-bss -fomit-frame-pointer
343 -foptimize-sibling-calls -fpartial-inlining -fpeel-loops
344 -fpredictive-commoning -fprefetch-loop-arrays -fprofile-correction
345 -fprofile-use -fprofile-use=path -fprofile-partial-training
346 -fprofile-values -fprofile-reorder-functions -freciprocal-math
347 -free -frename-registers -freorder-blocks
348 -freorder-blocks-algorithm=algorithm -freorder-blocks-and-partition
349 -freorder-functions -frerun-cse-after-loop
350 -freschedule-modulo-scheduled-loops -frounding-math
351 -fsave-optimization-record -fsched2-use-superblocks
352 -fsched-pressure -fsched-spec-load -fsched-spec-load-dangerous
353 -fsched-stalled-insns-dep[=n] -fsched-stalled-insns[=n]
354 -fsched-group-heuristic -fsched-critical-path-heuristic
355 -fsched-spec-insn-heuristic -fsched-rank-heuristic
356 -fsched-last-insn-heuristic -fsched-dep-count-heuristic
357 -fschedule-fusion -fschedule-insns -fschedule-insns2
358 -fsection-anchors -fselective-scheduling -fselective-scheduling2
359 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops
360 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate
361 -fsignaling-nans -fsingle-precision-constant
362 -fsplit-ivs-in-unroller -fsplit-loops -fsplit-paths
363 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop
364 -fssa-phiopt -fstdarg-opt -fstore-merging -fstrict-aliasing
365 -fipa-strict-aliasing -fthread-jumps -ftracer -ftree-bit-ccp
366 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-coalesce-vars
367 -ftree-copy-prop -ftree-dce -ftree-dominator-opts -ftree-dse
368 -ftree-forwprop -ftree-fre -fcode-hoisting -ftree-loop-if-convert
369 -ftree-loop-im -ftree-phiprop -ftree-loop-distribution
370 -ftree-loop-distribute-patterns -ftree-loop-ivcanon
371 -ftree-loop-linear -ftree-loop-optimize -ftree-loop-vectorize
372 -ftree-parallelize-loops=n -ftree-pre -ftree-partial-pre
373 -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-sink
374 -ftree-slsr -ftree-sra -ftree-switch-conversion -ftree-tail-merge
375 -ftree-ter -ftree-vectorize -ftree-vrp -ftrivial-auto-var-init
376 -funconstrained-commons -funit-at-a-time -funroll-all-loops
377 -funroll-loops -funsafe-math-optimizations -funswitch-loops
378 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model
379 -fvpt -fweb -fwhole-program -fwpa -fuse-linker-plugin
380 -fzero-call-used-regs --param name=value -O -O0 -O1 -O2 -O3
381 -Os -Ofast -Og -Oz
382
383 Program Instrumentation Options
384 -p -pg -fprofile-arcs --coverage -ftest-coverage
385 -fprofile-abs-path -fprofile-dir=path -fprofile-generate
386 -fprofile-generate=path -fprofile-info-section
387 -fprofile-info-section=name -fprofile-note=path
388 -fprofile-prefix-path=path -fprofile-update=method
389 -fprofile-filter-files=regex -fprofile-exclude-files=regex
390 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
391 -fsanitize=style -fsanitize-recover -fsanitize-recover=style
392 -fasan-shadow-offset=number -fsanitize-sections=s1,s2,...
393 -fsanitize-undefined-trap-on-error -fbounds-check
394 -fcf-protection=[full|branch|return|none|check] -fharden-compares
395 -fharden-conditional-branches -fstack-protector
396 -fstack-protector-all -fstack-protector-strong
397 -fstack-protector-explicit -fstack-check
398 -fstack-limit-register=reg -fstack-limit-symbol=sym
399 -fno-stack-limit -fsplit-stack -fvtable-verify=[std|preinit|none]
400 -fvtv-counts -fvtv-debug -finstrument-functions
401 -finstrument-functions-exclude-function-list=sym,sym,...
402 -finstrument-functions-exclude-file-list=file,file,...
403 -fprofile-prefix-map=old=new
404
405 Preprocessor Options
406 -Aquestion=answer -A-question[=answer] -C -CC -Dmacro[=defn] -dD
407 -dI -dM -dN -dU -fdebug-cpp -fdirectives-only
408 -fdollars-in-identifiers -fexec-charset=charset
409 -fextended-identifiers -finput-charset=charset
410 -flarge-source-files -fmacro-prefix-map=old=new
411 -fmax-include-depth=depth -fno-canonical-system-headers -fpch-deps
412 -fpch-preprocess -fpreprocessed -ftabstop=width
413 -ftrack-macro-expansion -fwide-exec-charset=charset
414 -fworking-directory -H -imacros file -include file -M -MD -MF
415 -MG -MM -MMD -MP -MQ -MT -Mno-modules -no-integrated-cpp -P
416 -pthread -remap -traditional -traditional-cpp -trigraphs -Umacro
417 -undef -Wp,option -Xpreprocessor option
418
419 Assembler Options
420 -Wa,option -Xassembler option
421
422 Linker Options
423 object-file-name -fuse-ld=linker -llibrary -nostartfiles
424 -nodefaultlibs -nolibc -nostdlib -e entry --entry=entry -pie
425 -pthread -r -rdynamic -s -static -static-pie -static-libgcc
426 -static-libstdc++ -static-libasan -static-libtsan -static-liblsan
427 -static-libubsan -shared -shared-libgcc -symbolic -T script
428 -Wl,option -Xlinker option -u symbol -z keyword
429
430 Directory Options
431 -Bprefix -Idir -I- -idirafter dir -imacros file -imultilib dir
432 -iplugindir=dir -iprefix file -iquote dir -isysroot dir -isystem
433 dir -iwithprefix dir -iwithprefixbefore dir -Ldir
434 -no-canonical-prefixes --no-sysroot-suffix -nostdinc -nostdinc++
435 --sysroot=dir
436
437 Code Generation Options
438 -fcall-saved-reg -fcall-used-reg -ffixed-reg -fexceptions
439 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables
440 -fasynchronous-unwind-tables -fno-gnu-unique
441 -finhibit-size-directive -fcommon -fno-ident -fpcc-struct-return
442 -fpic -fPIC -fpie -fPIE -fno-plt -fno-jump-tables
443 -fno-bit-tests -frecord-gcc-switches -freg-struct-return
444 -fshort-enums -fshort-wchar -fverbose-asm -fpack-struct[=n]
445 -fleading-underscore -ftls-model=model -fstack-reuse=reuse_level
446 -ftrampolines -ftrapv -fwrapv
447 -fvisibility=[default|internal|hidden|protected]
448 -fstrict-volatile-bitfields -fsync-libcalls
449
450 Developer Options
451 -dletters -dumpspecs -dumpmachine -dumpversion -dumpfullversion
452 -fcallgraph-info[=su,da] -fchecking -fchecking=n -fdbg-cnt-list
453 -fdbg-cnt=counter-value-list -fdisable-ipa-pass_name
454 -fdisable-rtl-pass_name -fdisable-rtl-pass-name=range-list
455 -fdisable-tree-pass_name -fdisable-tree-pass-name=range-list
456 -fdump-debug -fdump-earlydebug -fdump-noaddr -fdump-unnumbered
457 -fdump-unnumbered-links -fdump-final-insns[=file] -fdump-ipa-all
458 -fdump-ipa-cgraph -fdump-ipa-inline -fdump-lang-all
459 -fdump-lang-switch -fdump-lang-switch-options
460 -fdump-lang-switch-options=filename -fdump-passes -fdump-rtl-pass
461 -fdump-rtl-pass=filename -fdump-statistics -fdump-tree-all
462 -fdump-tree-switch -fdump-tree-switch-options
463 -fdump-tree-switch-options=filename -fcompare-debug[=opts]
464 -fcompare-debug-second -fenable-kind-pass -fenable-kind-pass=range-
465 list -fira-verbose=n -flto-report -flto-report-wpa
466 -fmem-report-wpa -fmem-report -fpre-ipa-mem-report
467 -fpost-ipa-mem-report -fopt-info -fopt-info-options[=file]
468 -fprofile-report -frandom-seed=string -fsched-verbose=n
469 -fsel-sched-verbose -fsel-sched-dump-cfg
470 -fsel-sched-pipelining-verbose -fstats -fstack-usage
471 -ftime-report -ftime-report-details
472 -fvar-tracking-assignments-toggle -gtoggle
473 -print-file-name=library -print-libgcc-file-name
474 -print-multi-directory -print-multi-lib -print-multi-os-directory
475 -print-prog-name=program -print-search-dirs -Q -print-sysroot
476 -print-sysroot-headers-suffix -save-temps -save-temps=cwd
477 -save-temps=obj -time[=file]
478
479 Machine-Dependent Options
480 AArch64 Options -mabi=name -mbig-endian -mlittle-endian
481 -mgeneral-regs-only -mcmodel=tiny -mcmodel=small -mcmodel=large
482 -mstrict-align -mno-strict-align -momit-leaf-frame-pointer
483 -mtls-dialect=desc -mtls-dialect=traditional -mtls-size=size
484 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419
485 -mlow-precision-recip-sqrt -mlow-precision-sqrt
486 -mlow-precision-div -mpc-relative-literal-loads
487 -msign-return-address=scope -mbranch-protection=none|standard|pac-
488 ret[+leaf +b-key]|bti -mharden-sls=opts -march=name -mcpu=name
489 -mtune=name -moverride=string -mverbose-cost-dump
490 -mstack-protector-guard=guard -mstack-protector-guard-reg=sysreg
491 -mstack-protector-guard-offset=offset -mtrack-speculation
492 -moutline-atomics
493
494 Adapteva Epiphany Options -mhalf-reg-file -mprefer-short-insn-regs
495 -mbranch-cost=num -mcmove -mnops=num -msoft-cmpsf -msplit-lohi
496 -mpost-inc -mpost-modify -mstack-offset=num -mround-nearest
497 -mlong-calls -mshort-calls -msmall16 -mfp-mode=mode
498 -mvect-double -max-vect-align=num -msplit-vecmove-early
499 -m1reg-reg
500
501 AMD GCN Options -march=gpu -mtune=gpu -mstack-size=bytes
502
503 ARC Options -mbarrel-shifter -mjli-always -mcpu=cpu -mA6
504 -mARC600 -mA7 -mARC700 -mdpfp -mdpfp-compact -mdpfp-fast
505 -mno-dpfp-lrsr -mea -mno-mpy -mmul32x16 -mmul64 -matomic -mnorm
506 -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap
507 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc
508 -mswape -mtelephony -mxy -misize -mannotate-align -marclinux
509 -marclinux_prof -mlong-calls -mmedium-calls -msdata
510 -mirq-ctrl-saved -mrgf-banked-regs -mlpc-width=width -G num
511 -mvolatile-cache -mtp-regno=regno -malign-call -mauto-modify-reg
512 -mbbit-peephole -mno-brcc -mcase-vector-pcrel -mcompact-casesi
513 -mno-cond-exec -mearly-cbranchsi -mexpand-adddi -mindexed-loads
514 -mlra -mlra-priority-none -mlra-priority-compact
515 -mlra-priority-noncompact -mmillicode -mmixed-code -mq-class
516 -mRcq -mRcw -msize-level=level -mtune=cpu -mmultcost=num
517 -mcode-density-frame -munalign-prob-threshold=probability
518 -mmpy-option=multo -mdiv-rem -mcode-density -mll64 -mfpu=fpu
519 -mrf16 -mbranch-index
520
521 ARM Options -mapcs-frame -mno-apcs-frame -mabi=name
522 -mapcs-stack-check -mno-apcs-stack-check -mapcs-reentrant
523 -mno-apcs-reentrant -mgeneral-regs-only -msched-prolog
524 -mno-sched-prolog -mlittle-endian -mbig-endian -mbe8 -mbe32
525 -mfloat-abi=name -mfp16-format=name -mthumb-interwork
526 -mno-thumb-interwork -mcpu=name -march=name -mfpu=name
527 -mtune=name -mprint-tune-info -mstructure-size-boundary=n
528 -mabort-on-noreturn -mlong-calls -mno-long-calls -msingle-pic-base
529 -mno-single-pic-base -mpic-register=reg -mnop-fun-dllimport
530 -mpoke-function-name -mthumb -marm -mflip-thumb -mtpcs-frame
531 -mtpcs-leaf-frame -mcaller-super-interworking
532 -mcallee-super-interworking -mtp=name -mtls-dialect=dialect
533 -mword-relocations -mfix-cortex-m3-ldrd
534 -mfix-cortex-a57-aes-1742098 -mfix-cortex-a72-aes-1655431
535 -munaligned-access -mneon-for-64bits -mslow-flash-data
536 -masm-syntax-unified -mrestrict-it -mverbose-cost-dump -mpure-code
537 -mcmse -mfix-cmse-cve-2021-35465 -mstack-protector-guard=guard
538 -mstack-protector-guard-offset=offset -mfdpic
539
540 AVR Options -mmcu=mcu -mabsdata -maccumulate-args
541 -mbranch-cost=cost -mcall-prologues -mgas-isr-prologues -mint8
542 -mdouble=bits -mlong-double=bits -mn_flash=size -mno-interrupts
543 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack
544 -mfract-convert-truncate -mshort-calls -nodevicelib
545 -nodevicespecs -Waddr-space-convert -Wmisspelled-isr
546
547 Blackfin Options -mcpu=cpu[-sirevision] -msim
548 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer
549 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly
550 -mno-csync-anomaly -mlow-64k -mno-low64k -mstack-check-l1
551 -mid-shared-library -mno-id-shared-library -mshared-library-id=n
552 -mleaf-id-shared-library -mno-leaf-id-shared-library -msep-data
553 -mno-sep-data -mlong-calls -mno-long-calls -mfast-fp
554 -minline-plt -mmulticore -mcorea -mcoreb -msdram -micplb
555
556 C6X Options -mbig-endian -mlittle-endian -march=cpu -msim
557 -msdata=sdata-type
558
559 CRIS Options -mcpu=cpu -march=cpu -mtune=cpu -mmax-stack-frame=n
560 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects
561 -mstack-align -mdata-align -mconst-align -m32-bit -m16-bit
562 -m8-bit -mno-prologue-epilogue -melf -maout -sim -sim2
563 -mmul-bug-workaround -mno-mul-bug-workaround
564
565 CR16 Options -mmac -mcr16cplus -mcr16c -msim -mint32 -mbit-ops
566 -mdata-model=model
567
568 C-SKY Options -march=arch -mcpu=cpu -mbig-endian -EB
569 -mlittle-endian -EL -mhard-float -msoft-float -mfpu=fpu
570 -mdouble-float -mfdivdu -mfloat-abi=name -melrw -mistack -mmp
571 -mcp -mcache -msecurity -mtrust -mdsp -medsp -mvdsp -mdiv
572 -msmart -mhigh-registers -manchor -mpushpop -mmultiple-stld
573 -mconstpool -mstack-size -mccrt -mbranch-cost=n -mcse-cc
574 -msched-prolog -msim
575
576 Darwin Options -all_load -allowable_client -arch
577 -arch_errors_fatal -arch_only -bind_at_load -bundle
578 -bundle_loader -client_name -compatibility_version
579 -current_version -dead_strip -dependency-file -dylib_file
580 -dylinker_install_name -dynamic -dynamiclib
581 -exported_symbols_list -filelist -flat_namespace
582 -force_cpusubtype_ALL -force_flat_namespace
583 -headerpad_max_install_names -iframework -image_base -init
584 -install_name -keep_private_externs -multi_module
585 -multiply_defined -multiply_defined_unused -noall_load
586 -no_dead_strip_inits_and_terms -nofixprebinding -nomultidefs
587 -noprebind -noseglinkedit -pagezero_size -prebind
588 -prebind_all_twolevel_modules -private_bundle -read_only_relocs
589 -sectalign -sectobjectsymbols -whyload -seg1addr -sectcreate
590 -sectobjectsymbols -sectorder -segaddr -segs_read_only_addr
591 -segs_read_write_addr -seg_addr_table -seg_addr_table_filename
592 -seglinkedit -segprot -segs_read_only_addr -segs_read_write_addr
593 -single_module -static -sub_library -sub_umbrella
594 -twolevel_namespace -umbrella -undefined -unexported_symbols_list
595 -weak_reference_mismatches -whatsloaded -F -gused -gfull
596 -mmacosx-version-min=version -mkernel -mone-byte-bool
597
598 DEC Alpha Options -mno-fp-regs -msoft-float -mieee
599 -mieee-with-inexact -mieee-conformant -mfp-trap-mode=mode
600 -mfp-rounding-mode=mode -mtrap-precision=mode -mbuild-constants
601 -mcpu=cpu-type -mtune=cpu-type -mbwx -mmax -mfix -mcix
602 -mfloat-vax -mfloat-ieee -mexplicit-relocs -msmall-data
603 -mlarge-data -msmall-text -mlarge-text -mmemory-latency=time
604
605 eBPF Options -mbig-endian -mlittle-endian -mkernel=version
606 -mframe-limit=bytes -mxbpf -mco-re -mno-co-re -mjmpext -mjmp32
607 -malu32 -mcpu=version
608
609 FR30 Options -msmall-model -mno-lsim
610
611 FT32 Options -msim -mlra -mnodiv -mft32b -mcompress -mnopm
612
613 FRV Options -mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 -mhard-float
614 -msoft-float -malloc-cc -mfixed-cc -mdword -mno-dword -mdouble
615 -mno-double -mmedia -mno-media -mmuladd -mno-muladd -mfdpic
616 -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp
617 -mlong-calls -malign-labels -mlibrary-pic -macc-4 -macc-8 -mpack
618 -mno-pack -mno-eflags -mcond-move -mno-cond-move
619 -moptimize-membar -mno-optimize-membar -mscc -mno-scc
620 -mcond-exec -mno-cond-exec -mvliw-branch -mno-vliw-branch
621 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec
622 -mno-nested-cond-exec -mtomcat-stats -mTLS -mtls -mcpu=cpu
623
624 GNU/Linux Options -mglibc -muclibc -mmusl -mbionic -mandroid
625 -tno-android-cc -tno-android-ld
626
627 H8/300 Options -mrelax -mh -ms -mn -mexr -mno-exr -mint32
628 -malign-300
629
630 HPPA Options -march=architecture-type -mcaller-copies
631 -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls -mgas
632 -mgnu-ld -mhp-ld -mfixed-range=register-range -mjump-in-delay
633 -mlinker-opt -mlong-calls -mlong-load-store -mno-disable-fpregs
634 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas
635 -mno-jump-in-delay -mno-long-load-store -mno-portable-runtime
636 -mno-soft-float -mno-space-regs -msoft-float -mpa-risc-1-0
637 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime -mschedule=cpu-
638 type -mspace-regs -msio -mwsio -munix=unix-std -nolibdld
639 -static -threads
640
641 IA-64 Options -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld
642 -mno-pic -mvolatile-asm-stop -mregister-names -msdata -mno-sdata
643 -mconstant-gp -mauto-pic -mfused-madd
644 -minline-float-divide-min-latency
645 -minline-float-divide-max-throughput -mno-inline-float-divide
646 -minline-int-divide-min-latency -minline-int-divide-max-throughput
647 -mno-inline-int-divide -minline-sqrt-min-latency
648 -minline-sqrt-max-throughput -mno-inline-sqrt -mdwarf2-asm
649 -mearly-stop-bits -mfixed-range=register-range -mtls-size=tls-size
650 -mtune=cpu-type -milp32 -mlp64 -msched-br-data-spec
651 -msched-ar-data-spec -msched-control-spec -msched-br-in-data-spec
652 -msched-ar-in-data-spec -msched-in-control-spec -msched-spec-ldc
653 -msched-spec-control-ldc -msched-prefer-non-data-spec-insns
654 -msched-prefer-non-control-spec-insns
655 -msched-stop-bits-after-every-cycle
656 -msched-count-spec-in-critical-path
657 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost
658 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=max-
659 insns
660
661 LM32 Options -mbarrel-shift-enabled -mdivide-enabled
662 -mmultiply-enabled -msign-extend-enabled -muser-enabled
663
664 LoongArch Options -march=cpu-type -mtune=cpu-type -mabi=base-abi-
665 type -mfpu=fpu-type -msoft-float -msingle-float -mdouble-float
666 -mbranch-cost=n -mcheck-zero-division -mno-check-zero-division
667 -mcond-move-int -mno-cond-move-int -mcond-move-float
668 -mno-cond-move-float -memcpy -mno-memcpy -mstrict-align
669 -mno-strict-align -mmax-inline-memcpy-size=n -mcmodel=code-model
670
671 M32R/D Options -m32r2 -m32rx -m32r -mdebug -malign-loops
672 -mno-align-loops -missue-rate=number -mbranch-cost=number
673 -mmodel=code-size-model-type -msdata=sdata-type -mno-flush-func
674 -mflush-func=name -mno-flush-trap -mflush-trap=number -G num
675
676 M32C Options -mcpu=cpu -msim -memregs=number
677
678 M680x0 Options -march=arch -mcpu=cpu -mtune=tune -m68000 -m68020
679 -m68020-40 -m68020-60 -m68030 -m68040 -m68060 -mcpu32 -m5200
680 -m5206e -m528x -m5307 -m5407 -mcfv4e -mbitfield -mno-bitfield
681 -mc68000 -mc68020 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div
682 -mshort -mno-short -mhard-float -m68881 -msoft-float -mpcrel
683 -malign-int -mstrict-align -msep-data -mno-sep-data
684 -mshared-library-id=n -mid-shared-library -mno-id-shared-library
685 -mxgot -mno-xgot -mlong-jump-table-offsets
686
687 MCore Options -mhardlit -mno-hardlit -mdiv -mno-div
688 -mrelax-immediates -mno-relax-immediates -mwide-bitfields
689 -mno-wide-bitfields -m4byte-functions -mno-4byte-functions
690 -mcallgraph-data -mno-callgraph-data -mslow-bytes -mno-slow-bytes
691 -mno-lsim -mlittle-endian -mbig-endian -m210 -m340
692 -mstack-increment
693
694 MeP Options -mabsdiff -mall-opts -maverage -mbased=n -mbitops
695 -mc=n -mclip -mconfig=name -mcop -mcop32 -mcop64 -mivc2 -mdc
696 -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax
697 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim
698 -msimnovec -mtf -mtiny=n
699
700 MicroBlaze Options -msoft-float -mhard-float -msmall-divides
701 -mcpu=cpu -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift
702 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss
703 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt
704 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-app-model
705 -mpic-data-is-text-relative
706
707 MIPS Options -EL -EB -march=arch -mtune=arch -mips1 -mips2
708 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 -mips32r6
709 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 -mips16
710 -mno-mips16 -mflip-mips16 -minterlink-compressed
711 -mno-interlink-compressed -minterlink-mips16 -mno-interlink-mips16
712 -mabi=abi -mabicalls -mno-abicalls -mshared -mno-shared -mplt
713 -mno-plt -mxgot -mno-xgot -mgp32 -mgp64 -mfp32 -mfpxx -mfp64
714 -mhard-float -msoft-float -mno-float -msingle-float
715 -mdouble-float -modd-spreg -mno-odd-spreg -mabs=mode
716 -mnan=encoding -mdsp -mno-dsp -mdspr2 -mno-dspr2 -mmcu
717 -mmno-mcu -meva -mno-eva -mvirt -mno-virt -mxpa -mno-xpa -mcrc
718 -mno-crc -mginv -mno-ginv -mmicromips -mno-micromips -mmsa
719 -mno-msa -mloongson-mmi -mno-loongson-mmi -mloongson-ext
720 -mno-loongson-ext -mloongson-ext2 -mno-loongson-ext2 -mfpu=fpu-
721 type -msmartmips -mno-smartmips -mpaired-single
722 -mno-paired-single -mdmx -mno-mdmx -mips3d -mno-mips3d -mmt
723 -mno-mt -mllsc -mno-llsc -mlong64 -mlong32 -msym32 -mno-sym32
724 -Gnum -mlocal-sdata -mno-local-sdata -mextern-sdata
725 -mno-extern-sdata -mgpopt -mno-gopt -membedded-data
726 -mno-embedded-data -muninit-const-in-rodata
727 -mno-uninit-const-in-rodata -mcode-readable=setting
728 -msplit-addresses -mno-split-addresses -mexplicit-relocs
729 -mno-explicit-relocs -mcheck-zero-division
730 -mno-check-zero-division -mdivide-traps -mdivide-breaks
731 -mload-store-pairs -mno-load-store-pairs -munaligned-access
732 -mno-unaligned-access -mmemcpy -mno-memcpy -mlong-calls
733 -mno-long-calls -mmad -mno-mad -mimadd -mno-imadd -mfused-madd
734 -mno-fused-madd -nocpp -mfix-24k -mno-fix-24k -mfix-r4000
735 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 -mfix-r5900
736 -mno-fix-r5900 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000
737 -mno-fix-rm7000 -mfix-vr4120 -mno-fix-vr4120 -mfix-vr4130
738 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 -mflush-func=func
739 -mno-flush-func -mbranch-cost=num -mbranch-likely
740 -mno-branch-likely -mcompact-branches=policy -mfp-exceptions
741 -mno-fp-exceptions -mvr4130-align -mno-vr4130-align -msynci
742 -mno-synci -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4
743 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address
744 -mframe-header-opt -mno-frame-header-opt
745
746 MMIX Options -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon
747 -mabi=gnu -mabi=mmixware -mzero-extend -mknuthdiv
748 -mtoplevel-symbols -melf -mbranch-predict -mno-branch-predict
749 -mbase-addresses -mno-base-addresses -msingle-exit
750 -mno-single-exit
751
752 MN10300 Options -mmult-bug -mno-mult-bug -mno-am33 -mam33
753 -mam33-2 -mam34 -mtune=cpu-type -mreturn-pointer-on-d0 -mno-crt0
754 -mrelax -mliw -msetlb
755
756 Moxie Options -meb -mel -mmul.x -mno-crt0
757
758 MSP430 Options -msim -masm-hex -mmcu= -mcpu= -mlarge -msmall
759 -mrelax -mwarn-mcu -mcode-region= -mdata-region= -msilicon-errata=
760 -msilicon-errata-warn= -mhwmult= -minrt -mtiny-printf
761 -mmax-inline-shift=
762
763 NDS32 Options -mbig-endian -mlittle-endian -mreduced-regs
764 -mfull-regs -mcmov -mno-cmov -mext-perf -mno-ext-perf -mext-perf2
765 -mno-ext-perf2 -mext-string -mno-ext-string -mv3push -mno-v3push
766 -m16bit -mno-16bit -misr-vector-size=num -mcache-block-size=num
767 -march=arch -mcmodel=code-model -mctor-dtor -mrelax
768
769 Nios II Options -G num -mgpopt=option -mgpopt -mno-gpopt
770 -mgprel-sec=regexp -mr0rel-sec=regexp -mel -meb -mno-bypass-cache
771 -mbypass-cache -mno-cache-volatile -mcache-volatile
772 -mno-fast-sw-div -mfast-sw-div -mhw-mul -mno-hw-mul -mhw-mulx
773 -mno-hw-mulx -mno-hw-div -mhw-div -mcustom-insn=N
774 -mno-custom-insn -mcustom-fpu-cfg=name -mhal -msmallc
775 -msys-crt0=name -msys-lib=name -march=arch -mbmx -mno-bmx -mcdx
776 -mno-cdx
777
778 Nvidia PTX Options -m64 -mmainkernel -moptimize
779
780 OpenRISC Options -mboard=name -mnewlib -mhard-mul -mhard-div
781 -msoft-mul -msoft-div -msoft-float -mhard-float -mdouble-float
782 -munordered-float -mcmov -mror -mrori -msext -msfimm -mshftimm
783 -mcmodel=code-model
784
785 PDP-11 Options -mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45
786 -m10 -mint32 -mno-int16 -mint16 -mno-int32 -msplit -munix-asm
787 -mdec-asm -mgnu-asm -mlra
788
789 picoChip Options -mae=ae_type -mvliw-lookahead=N
790 -msymbol-as-address -mno-inefficient-warnings
791
792 PowerPC Options See RS/6000 and PowerPC Options.
793
794 PRU Options -mmcu=mcu -minrt -mno-relax -mloop -mabi=variant
795
796 RISC-V Options -mbranch-cost=N-instruction -mplt -mno-plt
797 -mabi=ABI-string -mfdiv -mno-fdiv -mdiv -mno-div -misa-spec=ISA-
798 spec-string -march=ISA-string -mtune=processor-string
799 -mpreferred-stack-boundary=num -msmall-data-limit=N-bytes
800 -msave-restore -mno-save-restore -mshorten-memrefs
801 -mno-shorten-memrefs -mstrict-align -mno-strict-align
802 -mcmodel=medlow -mcmodel=medany -mexplicit-relocs
803 -mno-explicit-relocs -mrelax -mno-relax -mriscv-attribute
804 -mmo-riscv-attribute -malign-data=type -mbig-endian
805 -mlittle-endian -mstack-protector-guard=guard
806 -mstack-protector-guard-reg=reg
807 -mstack-protector-guard-offset=offset
808
809 RL78 Options -msim -mmul=none -mmul=g13 -mmul=g14 -mallregs
810 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14
811 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts
812
813 RS/6000 and PowerPC Options -mcpu=cpu-type -mtune=cpu-type
814 -mcmodel=code-model -mpowerpc64 -maltivec -mno-altivec
815 -mpowerpc-gpopt -mno-powerpc-gpopt -mpowerpc-gfxopt
816 -mno-powerpc-gfxopt -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb
817 -mpopcntd -mno-popcntd -mfprnd -mno-fprnd -mcmpb -mno-cmpb
818 -mhard-dfp -mno-hard-dfp -mfull-toc -mminimal-toc
819 -mno-fp-in-toc -mno-sum-in-toc -m64 -m32 -mxl-compat
820 -mno-xl-compat -mpe -malign-power -malign-natural -msoft-float
821 -mhard-float -mmultiple -mno-multiple -mupdate -mno-update
822 -mavoid-indexed-addresses -mno-avoid-indexed-addresses
823 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align
824 -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
825 -mrelocatable-lib -mno-relocatable-lib -mtoc -mno-toc -mlittle
826 -mlittle-endian -mbig -mbig-endian -mdynamic-no-pic -mswdiv
827 -msingle-pic-base -mprioritize-restricted-insns=priority
828 -msched-costly-dep=dependence_type -minsert-sched-nops=scheme
829 -mcall-aixdesc -mcall-eabi -mcall-freebsd -mcall-linux
830 -mcall-netbsd -mcall-openbsd -mcall-sysv -mcall-sysv-eabi
831 -mcall-sysv-noeabi -mtraceback=traceback_type -maix-struct-return
832 -msvr4-struct-return -mabi=abi-type -msecure-plt -mbss-plt
833 -mlongcall -mno-longcall -mpltseq -mno-pltseq
834 -mblock-move-inline-limit=num -mblock-compare-inline-limit=num
835 -mblock-compare-inline-loop-limit=num -mno-block-ops-unaligned-vsx
836 -mstring-compare-inline-limit=num -misel -mno-isel -mvrsave
837 -mno-vrsave -mmulhw -mno-mulhw -mdlmzb -mno-dlmzb -mprototype
838 -mno-prototype -msim -mmvme -mads -myellowknife -memb -msdata
839 -msdata=opt -mreadonly-in-sdata -mvxworks -G num -mrecip
840 -mrecip=opt -mno-recip -mrecip-precision -mno-recip-precision
841 -mveclibabi=type -mfriz -mno-friz -mpointers-to-nested-functions
842 -mno-pointers-to-nested-functions -msave-toc-indirect
843 -mno-save-toc-indirect -mpower8-fusion -mno-mpower8-fusion
844 -mpower8-vector -mno-power8-vector -mcrypto -mno-crypto -mhtm
845 -mno-htm -mquad-memory -mno-quad-memory -mquad-memory-atomic
846 -mno-quad-memory-atomic -mcompat-align-parm -mno-compat-align-parm
847 -mfloat128 -mno-float128 -mfloat128-hardware
848 -mno-float128-hardware -mgnu-attribute -mno-gnu-attribute
849 -mstack-protector-guard=guard -mstack-protector-guard-reg=reg
850 -mstack-protector-guard-offset=offset -mprefixed -mno-prefixed
851 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
852 -mprivileged -mno-privileged
853
854 RX Options -m64bit-doubles -m32bit-doubles -fpu -nofpu -mcpu=
855 -mbig-endian-data -mlittle-endian-data -msmall-data -msim
856 -mno-sim -mas100-syntax -mno-as100-syntax -mrelax
857 -mmax-constant-size= -mint-register= -mpid -mallow-string-insns
858 -mno-allow-string-insns -mjsr -mno-warn-multiple-fast-interrupts
859 -msave-acc-in-interrupts
860
861 S/390 and zSeries Options -mtune=cpu-type -march=cpu-type
862 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp
863 -mlong-double-64 -mlong-double-128 -mbackchain -mno-backchain
864 -mpacked-stack -mno-packed-stack -msmall-exec -mno-small-exec
865 -mmvcle -mno-mvcle -m64 -m31 -mdebug -mno-debug -mesa -mzarch
866 -mhtm -mvx -mzvector -mtpf-trace -mno-tpf-trace
867 -mtpf-trace-skip -mno-tpf-trace-skip -mfused-madd -mno-fused-madd
868 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard
869 -mhotpatch=halfwords,halfwords
870
871 Score Options -meb -mel -mnhwloop -muls -mmac -mscore5 -mscore5u
872 -mscore7 -mscore7d
873
874 SH Options -m1 -m2 -m2e -m2a-nofpu -m2a-single-only -m2a-single
875 -m2a -m3 -m3e -m4-nofpu -m4-single-only -m4-single -m4
876 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al -mb -ml
877 -mdalign -mrelax -mbigtable -mfmovd -mrenesas -mno-renesas
878 -mnomacsave -mieee -mno-ieee -mbitops -misize
879 -minline-ic_invalidate -mpadstruct -mprefergot -musermode
880 -multcost=number -mdiv=strategy -mdivsi3_libfunc=name
881 -mfixed-range=register-range -maccumulate-outgoing-args
882 -matomic-model=atomic-model -mbranch-cost=num -mzdcbranch
883 -mno-zdcbranch -mcbranch-force-delay-slot -mfused-madd
884 -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra
885 -mpretend-cmove -mtas
886
887 Solaris 2 Options -mclear-hwcap -mno-clear-hwcap -mimpure-text
888 -mno-impure-text -pthreads
889
890 SPARC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model
891 -mmemory-model=mem-model -m32 -m64 -mapp-regs -mno-app-regs
892 -mfaster-structs -mno-faster-structs -mflat -mno-flat -mfpu
893 -mno-fpu -mhard-float -msoft-float -mhard-quad-float
894 -msoft-quad-float -mstack-bias -mno-stack-bias -mstd-struct-return
895 -mno-std-struct-return -munaligned-doubles -mno-unaligned-doubles
896 -muser-mode -mno-user-mode -mv8plus -mno-v8plus -mvis -mno-vis
897 -mvis2 -mno-vis2 -mvis3 -mno-vis3 -mvis4 -mno-vis4 -mvis4b
898 -mno-vis4b -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld
899 -mno-fsmuld -mpopc -mno-popc -msubxc -mno-subxc -mfix-at697f
900 -mfix-ut699 -mfix-ut700 -mfix-gr712rc -mlra -mno-lra
901
902 System V Options -Qy -Qn -YP,paths -Ym,dir
903
904 TILE-Gx Options -mcpu=CPU -m32 -m64 -mbig-endian
905 -mlittle-endian -mcmodel=code-model
906
907 TILEPro Options -mcpu=cpu -m32
908
909 V850 Options -mlong-calls -mno-long-calls -mep -mno-ep
910 -mprolog-function -mno-prolog-function -mspace -mtda=n -msda=n
911 -mzda=n -mapp-regs -mno-app-regs -mdisable-callt
912 -mno-disable-callt -mv850e2v3 -mv850e2 -mv850e1 -mv850es -mv850e
913 -mv850 -mv850e3v5 -mloop -mrelax -mlong-jumps -msoft-float
914 -mhard-float -mgcc-abi -mrh850-abi -mbig-switch
915
916 VAX Options -mg -mgnu -munix -mlra
917
918 Visium Options -mdebug -msim -mfpu -mno-fpu -mhard-float
919 -msoft-float -mcpu=cpu-type -mtune=cpu-type -msv-mode
920 -muser-mode
921
922 VMS Options -mvms-return-codes -mdebug-main=prefix -mmalloc64
923 -mpointer-size=size
924
925 VxWorks Options -mrtp -non-static -Bstatic -Bdynamic -Xbind-lazy
926 -Xbind-now
927
928 x86 Options -mtune=cpu-type -march=cpu-type -mtune-ctrl=feature-
929 list -mdump-tune-features -mno-default -mfpmath=unit
930 -masm=dialect -mno-fancy-math-387 -mno-fp-ret-in-387 -m80387
931 -mhard-float -msoft-float -mno-wide-multiply -mrtd
932 -malign-double -mpreferred-stack-boundary=num
933 -mincoming-stack-boundary=num -mcld -mcx16 -msahf -mmovbe
934 -mcrc32 -mmwait -mrecip -mrecip=opt -mvzeroupper -mprefer-avx128
935 -mprefer-vector-width=opt -mmove-max=bits -mstore-max=bits -mmmx
936 -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx
937 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl
938 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes
939 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd
940 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves
941 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4
942 -mxop -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm
943 -mhle -mlwp -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes
944 -mwaitpkg -mshstk -mmanual-endbr -mforce-indirect-call
945 -mavx512vbmi2 -mavx512bf16 -menqcmd -mvpclmulqdq -mavx512bitalg
946 -mmovdiri -mmovdir64b -mavx512vpopcntdq -mavx5124fmaps
947 -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid -mrdseed -msgx
948 -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8
949 -mamx-bf16 -muintr -mhreset -mavxvnni -mavx512fp16 -mcldemote
950 -mms-bitfields -mno-align-stringops -minline-all-stringops
951 -minline-stringops-dynamically -mstringop-strategy=alg -mkl
952 -mwidekl -mmemcpy-strategy=strategy -mmemset-strategy=strategy
953 -mpush-args -maccumulate-outgoing-args -m128bit-long-double
954 -m96bit-long-double -mlong-double-64 -mlong-double-80
955 -mlong-double-128 -mregparm=num -msseregparm -mveclibabi=type
956 -mvect8-ret-in-mem -mpc32 -mpc64 -mpc80 -mstackrealign
957 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs
958 -mcmodel=code-model -mabi=name -maddress-mode=mode -m32 -m64
959 -mx32 -m16 -miamcu -mlarge-data-threshold=num -msse2avx
960 -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv
961 -minstrument-return=type -mfentry-name=name -mfentry-section=name
962 -mavx256-split-unaligned-load -mavx256-split-unaligned-store
963 -malign-data=type -mstack-protector-guard=guard
964 -mstack-protector-guard-reg=reg
965 -mstack-protector-guard-offset=offset
966 -mstack-protector-guard-symbol=symbol -mgeneral-regs-only
967 -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop
968 -mindirect-branch=choice -mfunction-return=choice
969 -mindirect-branch-register -mharden-sls=choice
970 -mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access
971
972 x86 Windows Options -mconsole -mcygwin -mno-cygwin -mdll
973 -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows
974 -fno-set-stack-executable
975
976 Xstormy16 Options -msim
977
978 Xtensa Options -mconst16 -mno-const16 -mfused-madd
979 -mno-fused-madd -mforce-no-pic -mserialize-volatile
980 -mno-serialize-volatile -mtext-section-literals
981 -mno-text-section-literals -mauto-litpools -mno-auto-litpools
982 -mtarget-align -mno-target-align -mlongcalls -mno-longcalls
983 -mabi=abi-type
984
985 zSeries Options See S/390 and zSeries Options.
986
987 Options Controlling the Kind of Output
988 Compilation can involve up to four stages: preprocessing, compilation
989 proper, assembly and linking, always in that order. GCC is capable of
990 preprocessing and compiling several files either into several assembler
991 input files, or into one assembler input file; then each assembler
992 input file produces an object file, and linking combines all the object
993 files (those newly compiled, and those specified as input) into an
994 executable file.
995
996 For any given input file, the file name suffix determines what kind of
997 compilation is done:
998
999 file.c
1000 C source code that must be preprocessed.
1001
1002 file.i
1003 C source code that should not be preprocessed.
1004
1005 file.ii
1006 C++ source code that should not be preprocessed.
1007
1008 file.m
1009 Objective-C source code. Note that you must link with the libobjc
1010 library to make an Objective-C program work.
1011
1012 file.mi
1013 Objective-C source code that should not be preprocessed.
1014
1015 file.mm
1016 file.M
1017 Objective-C++ source code. Note that you must link with the
1018 libobjc library to make an Objective-C++ program work. Note that
1019 .M refers to a literal capital M.
1020
1021 file.mii
1022 Objective-C++ source code that should not be preprocessed.
1023
1024 file.h
1025 C, C++, Objective-C or Objective-C++ header file to be turned into
1026 a precompiled header (default), or C, C++ header file to be turned
1027 into an Ada spec (via the -fdump-ada-spec switch).
1028
1029 file.cc
1030 file.cp
1031 file.cxx
1032 file.cpp
1033 file.CPP
1034 file.c++
1035 file.C
1036 C++ source code that must be preprocessed. Note that in .cxx, the
1037 last two letters must both be literally x. Likewise, .C refers to
1038 a literal capital C.
1039
1040 file.mm
1041 file.M
1042 Objective-C++ source code that must be preprocessed.
1043
1044 file.mii
1045 Objective-C++ source code that should not be preprocessed.
1046
1047 file.hh
1048 file.H
1049 file.hp
1050 file.hxx
1051 file.hpp
1052 file.HPP
1053 file.h++
1054 file.tcc
1055 C++ header file to be turned into a precompiled header or Ada spec.
1056
1057 file.f
1058 file.for
1059 file.ftn
1060 Fixed form Fortran source code that should not be preprocessed.
1061
1062 file.F
1063 file.FOR
1064 file.fpp
1065 file.FPP
1066 file.FTN
1067 Fixed form Fortran source code that must be preprocessed (with the
1068 traditional preprocessor).
1069
1070 file.f90
1071 file.f95
1072 file.f03
1073 file.f08
1074 Free form Fortran source code that should not be preprocessed.
1075
1076 file.F90
1077 file.F95
1078 file.F03
1079 file.F08
1080 Free form Fortran source code that must be preprocessed (with the
1081 traditional preprocessor).
1082
1083 file.go
1084 Go source code.
1085
1086 file.d
1087 D source code.
1088
1089 file.di
1090 D interface file.
1091
1092 file.dd
1093 D documentation code (Ddoc).
1094
1095 file.ads
1096 Ada source code file that contains a library unit declaration (a
1097 declaration of a package, subprogram, or generic, or a generic
1098 instantiation), or a library unit renaming declaration (a package,
1099 generic, or subprogram renaming declaration). Such files are also
1100 called specs.
1101
1102 file.adb
1103 Ada source code file containing a library unit body (a subprogram
1104 or package body). Such files are also called bodies.
1105
1106 file.s
1107 Assembler code.
1108
1109 file.S
1110 file.sx
1111 Assembler code that must be preprocessed.
1112
1113 other
1114 An object file to be fed straight into linking. Any file name with
1115 no recognized suffix is treated this way.
1116
1117 You can specify the input language explicitly with the -x option:
1118
1119 -x language
1120 Specify explicitly the language for the following input files
1121 (rather than letting the compiler choose a default based on the
1122 file name suffix). This option applies to all following input
1123 files until the next -x option. Possible values for language are:
1124
1125 c c-header cpp-output
1126 c++ c++-header c++-system-header c++-user-header c++-cpp-output
1127 objective-c objective-c-header objective-c-cpp-output
1128 objective-c++ objective-c++-header objective-c++-cpp-output
1129 assembler assembler-with-cpp
1130 ada
1131 d
1132 f77 f77-cpp-input f95 f95-cpp-input
1133 go
1134
1135 -x none
1136 Turn off any specification of a language, so that subsequent files
1137 are handled according to their file name suffixes (as they are if
1138 -x has not been used at all).
1139
1140 If you only want some of the stages of compilation, you can use -x (or
1141 filename suffixes) to tell gcc where to start, and one of the options
1142 -c, -S, or -E to say where gcc is to stop. Note that some combinations
1143 (for example, -x cpp-output -E) instruct gcc to do nothing at all.
1144
1145 -c Compile or assemble the source files, but do not link. The linking
1146 stage simply is not done. The ultimate output is in the form of an
1147 object file for each source file.
1148
1149 By default, the object file name for a source file is made by
1150 replacing the suffix .c, .i, .s, etc., with .o.
1151
1152 Unrecognized input files, not requiring compilation or assembly,
1153 are ignored.
1154
1155 -S Stop after the stage of compilation proper; do not assemble. The
1156 output is in the form of an assembler code file for each non-
1157 assembler input file specified.
1158
1159 By default, the assembler file name for a source file is made by
1160 replacing the suffix .c, .i, etc., with .s.
1161
1162 Input files that don't require compilation are ignored.
1163
1164 -E Stop after the preprocessing stage; do not run the compiler proper.
1165 The output is in the form of preprocessed source code, which is
1166 sent to the standard output.
1167
1168 Input files that don't require preprocessing are ignored.
1169
1170 -o file
1171 Place the primary output in file file. This applies to whatever
1172 sort of output is being produced, whether it be an executable file,
1173 an object file, an assembler file or preprocessed C code.
1174
1175 If -o is not specified, the default is to put an executable file in
1176 a.out, the object file for source.suffix in source.o, its assembler
1177 file in source.s, a precompiled header file in source.suffix.gch,
1178 and all preprocessed C source on standard output.
1179
1180 Though -o names only the primary output, it also affects the naming
1181 of auxiliary and dump outputs. See the examples below. Unless
1182 overridden, both auxiliary outputs and dump outputs are placed in
1183 the same directory as the primary output. In auxiliary outputs,
1184 the suffix of the input file is replaced with that of the auxiliary
1185 output file type; in dump outputs, the suffix of the dump file is
1186 appended to the input file suffix. In compilation commands, the
1187 base name of both auxiliary and dump outputs is that of the primary
1188 output; in compile and link commands, the primary output name,
1189 minus the executable suffix, is combined with the input file name.
1190 If both share the same base name, disregarding the suffix, the
1191 result of the combination is that base name, otherwise, they are
1192 concatenated, separated by a dash.
1193
1194 gcc -c foo.c ...
1195
1196 will use foo.o as the primary output, and place aux outputs and
1197 dumps next to it, e.g., aux file foo.dwo for -gsplit-dwarf, and
1198 dump file foo.c.???r.final for -fdump-rtl-final.
1199
1200 If a non-linker output file is explicitly specified, aux and dump
1201 files by default take the same base name:
1202
1203 gcc -c foo.c -o dir/foobar.o ...
1204
1205 will name aux outputs dir/foobar.* and dump outputs dir/foobar.c.*.
1206
1207 A linker output will instead prefix aux and dump outputs:
1208
1209 gcc foo.c bar.c -o dir/foobar ...
1210
1211 will generally name aux outputs dir/foobar-foo.* and
1212 dir/foobar-bar.*, and dump outputs dir/foobar-foo.c.* and
1213 dir/foobar-bar.c.*.
1214
1215 The one exception to the above is when the executable shares the
1216 base name with the single input:
1217
1218 gcc foo.c -o dir/foo ...
1219
1220 in which case aux outputs are named dir/foo.* and dump outputs
1221 named dir/foo.c.*.
1222
1223 The location and the names of auxiliary and dump outputs can be
1224 adjusted by the options -dumpbase, -dumpbase-ext, -dumpdir,
1225 -save-temps=cwd, and -save-temps=obj.
1226
1227 -dumpbase dumpbase
1228 This option sets the base name for auxiliary and dump output files.
1229 It does not affect the name of the primary output file.
1230 Intermediate outputs, when preserved, are not regarded as primary
1231 outputs, but as auxiliary outputs:
1232
1233 gcc -save-temps -S foo.c
1234
1235 saves the (no longer) temporary preprocessed file in foo.i, and
1236 then compiles to the (implied) output file foo.s, whereas:
1237
1238 gcc -save-temps -dumpbase save-foo -c foo.c
1239
1240 preprocesses to in save-foo.i, compiles to save-foo.s (now an
1241 intermediate, thus auxiliary output), and then assembles to the
1242 (implied) output file foo.o.
1243
1244 Absent this option, dump and aux files take their names from the
1245 input file, or from the (non-linker) output file, if one is
1246 explicitly specified: dump output files (e.g. those requested by
1247 -fdump-* options) with the input name suffix, and aux output files
1248 (those requested by other non-dump options, e.g. "-save-temps",
1249 "-gsplit-dwarf", "-fcallgraph-info") without it.
1250
1251 Similar suffix differentiation of dump and aux outputs can be
1252 attained for explicitly-given -dumpbase basename.suf by also
1253 specifying -dumpbase-ext .suf.
1254
1255 If dumpbase is explicitly specified with any directory component,
1256 any dumppfx specification (e.g. -dumpdir or -save-temps=*) is
1257 ignored, and instead of appending to it, dumpbase fully overrides
1258 it:
1259
1260 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1261 -dumpdir pfx- -save-temps=cwd ...
1262
1263 creates auxiliary and dump outputs named alt/foo.*, disregarding
1264 dir/ in -o, the ./ prefix implied by -save-temps=cwd, and pfx- in
1265 -dumpdir.
1266
1267 When -dumpbase is specified in a command that compiles multiple
1268 inputs, or that compiles and then links, it may be combined with
1269 dumppfx, as specified under -dumpdir. Then, each input file is
1270 compiled using the combined dumppfx, and default values for
1271 dumpbase and auxdropsuf are computed for each input file:
1272
1273 gcc foo.c bar.c -c -dumpbase main ...
1274
1275 creates foo.o and bar.o as primary outputs, and avoids overwriting
1276 the auxiliary and dump outputs by using the dumpbase as a prefix,
1277 creating auxiliary and dump outputs named main-foo.* and
1278 main-bar.*.
1279
1280 An empty string specified as dumpbase avoids the influence of the
1281 output basename in the naming of auxiliary and dump outputs during
1282 compilation, computing default values :
1283
1284 gcc -c foo.c -o dir/foobar.o -dumpbase " ...
1285
1286 will name aux outputs dir/foo.* and dump outputs dir/foo.c.*. Note
1287 how their basenames are taken from the input name, but the
1288 directory still defaults to that of the output.
1289
1290 The empty-string dumpbase does not prevent the use of the output
1291 basename for outputs during linking:
1292
1293 gcc foo.c bar.c -o dir/foobar -dumpbase " -flto ...
1294
1295 The compilation of the source files will name auxiliary outputs
1296 dir/foo.* and dir/bar.*, and dump outputs dir/foo.c.* and
1297 dir/bar.c.*. LTO recompilation during linking will use dir/foobar.
1298 as the prefix for dumps and auxiliary files.
1299
1300 -dumpbase-ext auxdropsuf
1301 When forming the name of an auxiliary (but not a dump) output file,
1302 drop trailing auxdropsuf from dumpbase before appending any
1303 suffixes. If not specified, this option defaults to the suffix of
1304 a default dumpbase, i.e., the suffix of the input file when
1305 -dumpbase is not present in the command line, or dumpbase is
1306 combined with dumppfx.
1307
1308 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1309
1310 creates dir/foo.o as the main output, and generates auxiliary
1311 outputs in dir/x-foo.*, taking the location of the primary output,
1312 and dropping the .c suffix from the dumpbase. Dump outputs retain
1313 the suffix: dir/x-foo.c.*.
1314
1315 This option is disregarded if it does not match the suffix of a
1316 specified dumpbase, except as an alternative to the executable
1317 suffix when appending the linker output base name to dumppfx, as
1318 specified below:
1319
1320 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1321
1322 creates main.out as the primary output, and avoids overwriting the
1323 auxiliary and dump outputs by using the executable name minus
1324 auxdropsuf as a prefix, creating auxiliary outputs named main-foo.*
1325 and main-bar.* and dump outputs named main-foo.c.* and
1326 main-bar.c.*.
1327
1328 -dumpdir dumppfx
1329 When forming the name of an auxiliary or dump output file, use
1330 dumppfx as a prefix:
1331
1332 gcc -dumpdir pfx- -c foo.c ...
1333
1334 creates foo.o as the primary output, and auxiliary outputs named
1335 pfx-foo.*, combining the given dumppfx with the default dumpbase
1336 derived from the default primary output, derived in turn from the
1337 input name. Dump outputs also take the input name suffix:
1338 pfx-foo.c.*.
1339
1340 If dumppfx is to be used as a directory name, it must end with a
1341 directory separator:
1342
1343 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1344
1345 creates obj/bar.o as the primary output, and auxiliary outputs
1346 named dir/bar.*, combining the given dumppfx with the default
1347 dumpbase derived from the primary output name. Dump outputs also
1348 take the input name suffix: dir/bar.c.*.
1349
1350 It defaults to the location of the output file, unless the output
1351 file is a special file like "/dev/null". Options -save-temps=cwd
1352 and -save-temps=obj override this default, just like an explicit
1353 -dumpdir option. In case multiple such options are given, the last
1354 one prevails:
1355
1356 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1357
1358 outputs foo.o, with auxiliary outputs named foo.* because
1359 -save-temps=* overrides the dumppfx given by the earlier -dumpdir
1360 option. It does not matter that =obj is the default for
1361 -save-temps, nor that the output directory is implicitly the
1362 current directory. Dump outputs are named foo.c.*.
1363
1364 When compiling from multiple input files, if -dumpbase is
1365 specified, dumpbase, minus a auxdropsuf suffix, and a dash are
1366 appended to (or override, if containing any directory components)
1367 an explicit or defaulted dumppfx, so that each of the multiple
1368 compilations gets differently-named aux and dump outputs.
1369
1370 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1371
1372 outputs auxiliary dumps to dir/pfx-main-foo.* and
1373 dir/pfx-main-bar.*, appending dumpbase- to dumppfx. Dump outputs
1374 retain the input file suffix: dir/pfx-main-foo.c.* and
1375 dir/pfx-main-bar.c.*, respectively. Contrast with the single-input
1376 compilation:
1377
1378 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1379
1380 that, applying -dumpbase to a single source, does not compute and
1381 append a separate dumpbase per input file. Its auxiliary and dump
1382 outputs go in dir/pfx-main.*.
1383
1384 When compiling and then linking from multiple input files, a
1385 defaulted or explicitly specified dumppfx also undergoes the
1386 dumpbase- transformation above (e.g. the compilation of foo.c and
1387 bar.c above, but without -c). If neither -dumpdir nor -dumpbase
1388 are given, the linker output base name, minus auxdropsuf, if
1389 specified, or the executable suffix otherwise, plus a dash is
1390 appended to the default dumppfx instead. Note, however, that
1391 unlike earlier cases of linking:
1392
1393 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1394
1395 does not append the output name main to dumppfx, because -dumpdir
1396 is explicitly specified. The goal is that the explicitly-specified
1397 dumppfx may contain the specified output name as part of the
1398 prefix, if desired; only an explicitly-specified -dumpbase would be
1399 combined with it, in order to avoid simply discarding a meaningful
1400 option.
1401
1402 When compiling and then linking from a single input file, the
1403 linker output base name will only be appended to the default
1404 dumppfx as above if it does not share the base name with the single
1405 input file name. This has been covered in single-input linking
1406 cases above, but not with an explicit -dumpdir that inhibits the
1407 combination, even if overridden by -save-temps=*:
1408
1409 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1410
1411 Auxiliary outputs are named foo.*, and dump outputs foo.c.*, in the
1412 current working directory as ultimately requested by
1413 -save-temps=cwd.
1414
1415 Summing it all up for an intuitive though slightly imprecise data
1416 flow: the primary output name is broken into a directory part and a
1417 basename part; dumppfx is set to the former, unless overridden by
1418 -dumpdir or -save-temps=*, and dumpbase is set to the latter,
1419 unless overriden by -dumpbase. If there are multiple inputs or
1420 linking, this dumpbase may be combined with dumppfx and taken from
1421 each input file. Auxiliary output names for each input are formed
1422 by combining dumppfx, dumpbase minus suffix, and the auxiliary
1423 output suffix; dump output names are only different in that the
1424 suffix from dumpbase is retained.
1425
1426 When it comes to auxiliary and dump outputs created during LTO
1427 recompilation, a combination of dumppfx and dumpbase, as given or
1428 as derived from the linker output name but not from inputs, even in
1429 cases in which this combination would not otherwise be used as
1430 such, is passed down with a trailing period replacing the compiler-
1431 added dash, if any, as a -dumpdir option to lto-wrapper; being
1432 involved in linking, this program does not normally get any
1433 -dumpbase and -dumpbase-ext, and it ignores them.
1434
1435 When running sub-compilers, lto-wrapper appends LTO stage names to
1436 the received dumppfx, ensures it contains a directory component so
1437 that it overrides any -dumpdir, and passes that as -dumpbase to
1438 sub-compilers.
1439
1440 -v Print (on standard error output) the commands executed to run the
1441 stages of compilation. Also print the version number of the
1442 compiler driver program and of the preprocessor and the compiler
1443 proper.
1444
1445 -###
1446 Like -v except the commands are not executed and arguments are
1447 quoted unless they contain only alphanumeric characters or "./-_".
1448 This is useful for shell scripts to capture the driver-generated
1449 command lines.
1450
1451 --help
1452 Print (on the standard output) a description of the command-line
1453 options understood by gcc. If the -v option is also specified then
1454 --help is also passed on to the various processes invoked by gcc,
1455 so that they can display the command-line options they accept. If
1456 the -Wextra option has also been specified (prior to the --help
1457 option), then command-line options that have no documentation
1458 associated with them are also displayed.
1459
1460 --target-help
1461 Print (on the standard output) a description of target-specific
1462 command-line options for each tool. For some targets extra target-
1463 specific information may also be printed.
1464
1465 --help={class|[^]qualifier}[,...]
1466 Print (on the standard output) a description of the command-line
1467 options understood by the compiler that fit into all specified
1468 classes and qualifiers. These are the supported classes:
1469
1470 optimizers
1471 Display all of the optimization options supported by the
1472 compiler.
1473
1474 warnings
1475 Display all of the options controlling warning messages
1476 produced by the compiler.
1477
1478 target
1479 Display target-specific options. Unlike the --target-help
1480 option however, target-specific options of the linker and
1481 assembler are not displayed. This is because those tools do
1482 not currently support the extended --help= syntax.
1483
1484 params
1485 Display the values recognized by the --param option.
1486
1487 language
1488 Display the options supported for language, where language is
1489 the name of one of the languages supported in this version of
1490 GCC. If an option is supported by all languages, one needs to
1491 select common class.
1492
1493 common
1494 Display the options that are common to all languages.
1495
1496 These are the supported qualifiers:
1497
1498 undocumented
1499 Display only those options that are undocumented.
1500
1501 joined
1502 Display options taking an argument that appears after an equal
1503 sign in the same continuous piece of text, such as:
1504 --help=target.
1505
1506 separate
1507 Display options taking an argument that appears as a separate
1508 word following the original option, such as: -o output-file.
1509
1510 Thus for example to display all the undocumented target-specific
1511 switches supported by the compiler, use:
1512
1513 --help=target,undocumented
1514
1515 The sense of a qualifier can be inverted by prefixing it with the ^
1516 character, so for example to display all binary warning options
1517 (i.e., ones that are either on or off and that do not take an
1518 argument) that have a description, use:
1519
1520 --help=warnings,^joined,^undocumented
1521
1522 The argument to --help= should not consist solely of inverted
1523 qualifiers.
1524
1525 Combining several classes is possible, although this usually
1526 restricts the output so much that there is nothing to display. One
1527 case where it does work, however, is when one of the classes is
1528 target. For example, to display all the target-specific
1529 optimization options, use:
1530
1531 --help=target,optimizers
1532
1533 The --help= option can be repeated on the command line. Each
1534 successive use displays its requested class of options, skipping
1535 those that have already been displayed. If --help is also
1536 specified anywhere on the command line then this takes precedence
1537 over any --help= option.
1538
1539 If the -Q option appears on the command line before the --help=
1540 option, then the descriptive text displayed by --help= is changed.
1541 Instead of describing the displayed options, an indication is given
1542 as to whether the option is enabled, disabled or set to a specific
1543 value (assuming that the compiler knows this at the point where the
1544 --help= option is used).
1545
1546 Here is a truncated example from the ARM port of gcc:
1547
1548 % gcc -Q -mabi=2 --help=target -c
1549 The following options are target specific:
1550 -mabi= 2
1551 -mabort-on-noreturn [disabled]
1552 -mapcs [disabled]
1553
1554 The output is sensitive to the effects of previous command-line
1555 options, so for example it is possible to find out which
1556 optimizations are enabled at -O2 by using:
1557
1558 -Q -O2 --help=optimizers
1559
1560 Alternatively you can discover which binary optimizations are
1561 enabled by -O3 by using:
1562
1563 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1564 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1565 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1566
1567 --version
1568 Display the version number and copyrights of the invoked GCC.
1569
1570 -pass-exit-codes
1571 Normally the gcc program exits with the code of 1 if any phase of
1572 the compiler returns a non-success return code. If you specify
1573 -pass-exit-codes, the gcc program instead returns with the
1574 numerically highest error produced by any phase returning an error
1575 indication. The C, C++, and Fortran front ends return 4 if an
1576 internal compiler error is encountered.
1577
1578 -pipe
1579 Use pipes rather than temporary files for communication between the
1580 various stages of compilation. This fails to work on some systems
1581 where the assembler is unable to read from a pipe; but the GNU
1582 assembler has no trouble.
1583
1584 -specs=file
1585 Process file after the compiler reads in the standard specs file,
1586 in order to override the defaults which the gcc driver program uses
1587 when determining what switches to pass to cc1, cc1plus, as, ld,
1588 etc. More than one -specs=file can be specified on the command
1589 line, and they are processed in order, from left to right.
1590
1591 -wrapper
1592 Invoke all subcommands under a wrapper program. The name of the
1593 wrapper program and its parameters are passed as a comma separated
1594 list.
1595
1596 gcc -c t.c -wrapper gdb,--args
1597
1598 This invokes all subprograms of gcc under gdb --args, thus the
1599 invocation of cc1 is gdb --args cc1 ....
1600
1601 -ffile-prefix-map=old=new
1602 When compiling files residing in directory old, record any
1603 references to them in the result of the compilation as if the files
1604 resided in directory new instead. Specifying this option is
1605 equivalent to specifying all the individual -f*-prefix-map options.
1606 This can be used to make reproducible builds that are location
1607 independent. See also -fmacro-prefix-map, -fdebug-prefix-map and
1608 -fprofile-prefix-map.
1609
1610 -fplugin=name.so
1611 Load the plugin code in file name.so, assumed to be a shared object
1612 to be dlopen'd by the compiler. The base name of the shared object
1613 file is used to identify the plugin for the purposes of argument
1614 parsing (See -fplugin-arg-name-key=value below). Each plugin
1615 should define the callback functions specified in the Plugins API.
1616
1617 -fplugin-arg-name-key=value
1618 Define an argument called key with a value of value for the plugin
1619 called name.
1620
1621 -fdump-ada-spec[-slim]
1622 For C and C++ source and include files, generate corresponding Ada
1623 specs.
1624
1625 -fada-spec-parent=unit
1626 In conjunction with -fdump-ada-spec[-slim] above, generate Ada
1627 specs as child units of parent unit.
1628
1629 -fdump-go-spec=file
1630 For input files in any language, generate corresponding Go
1631 declarations in file. This generates Go "const", "type", "var",
1632 and "func" declarations which may be a useful way to start writing
1633 a Go interface to code written in some other language.
1634
1635 @file
1636 Read command-line options from file. The options read are inserted
1637 in place of the original @file option. If file does not exist, or
1638 cannot be read, then the option will be treated literally, and not
1639 removed.
1640
1641 Options in file are separated by whitespace. A whitespace
1642 character may be included in an option by surrounding the entire
1643 option in either single or double quotes. Any character (including
1644 a backslash) may be included by prefixing the character to be
1645 included with a backslash. The file may itself contain additional
1646 @file options; any such options will be processed recursively.
1647
1648 Compiling C++ Programs
1649 C++ source files conventionally use one of the suffixes .C, .cc, .cpp,
1650 .CPP, .c++, .cp, or .cxx; C++ header files often use .hh, .hpp, .H, or
1651 (for shared template code) .tcc; and preprocessed C++ files use the
1652 suffix .ii. GCC recognizes files with these names and compiles them as
1653 C++ programs even if you call the compiler the same way as for
1654 compiling C programs (usually with the name gcc).
1655
1656 However, the use of gcc does not add the C++ library. g++ is a program
1657 that calls GCC and automatically specifies linking against the C++
1658 library. It treats .c, .h and .i files as C++ source files instead of
1659 C source files unless -x is used. This program is also useful when
1660 precompiling a C header file with a .h extension for use in C++
1661 compilations. On many systems, g++ is also installed with the name
1662 c++.
1663
1664 When you compile C++ programs, you may specify many of the same
1665 command-line options that you use for compiling programs in any
1666 language; or command-line options meaningful for C and related
1667 languages; or options that are meaningful only for C++ programs.
1668
1669 Options Controlling C Dialect
1670 The following options control the dialect of C (or languages derived
1671 from C, such as C++, Objective-C and Objective-C++) that the compiler
1672 accepts:
1673
1674 -ansi
1675 In C mode, this is equivalent to -std=c90. In C++ mode, it is
1676 equivalent to -std=c++98.
1677
1678 This turns off certain features of GCC that are incompatible with
1679 ISO C90 (when compiling C code), or of standard C++ (when compiling
1680 C++ code), such as the "asm" and "typeof" keywords, and predefined
1681 macros such as "unix" and "vax" that identify the type of system
1682 you are using. It also enables the undesirable and rarely used ISO
1683 trigraph feature. For the C compiler, it disables recognition of
1684 C++ style // comments as well as the "inline" keyword.
1685
1686 The alternate keywords "__asm__", "__extension__", "__inline__" and
1687 "__typeof__" continue to work despite -ansi. You would not want to
1688 use them in an ISO C program, of course, but it is useful to put
1689 them in header files that might be included in compilations done
1690 with -ansi. Alternate predefined macros such as "__unix__" and
1691 "__vax__" are also available, with or without -ansi.
1692
1693 The -ansi option does not cause non-ISO programs to be rejected
1694 gratuitously. For that, -Wpedantic is required in addition to
1695 -ansi.
1696
1697 The macro "__STRICT_ANSI__" is predefined when the -ansi option is
1698 used. Some header files may notice this macro and refrain from
1699 declaring certain functions or defining certain macros that the ISO
1700 standard doesn't call for; this is to avoid interfering with any
1701 programs that might use these names for other things.
1702
1703 Functions that are normally built in but do not have semantics
1704 defined by ISO C (such as "alloca" and "ffs") are not built-in
1705 functions when -ansi is used.
1706
1707 -std=
1708 Determine the language standard. This option is currently only
1709 supported when compiling C or C++.
1710
1711 The compiler can accept several base standards, such as c90 or
1712 c++98, and GNU dialects of those standards, such as gnu90 or
1713 gnu++98. When a base standard is specified, the compiler accepts
1714 all programs following that standard plus those using GNU
1715 extensions that do not contradict it. For example, -std=c90 turns
1716 off certain features of GCC that are incompatible with ISO C90,
1717 such as the "asm" and "typeof" keywords, but not other GNU
1718 extensions that do not have a meaning in ISO C90, such as omitting
1719 the middle term of a "?:" expression. On the other hand, when a GNU
1720 dialect of a standard is specified, all features supported by the
1721 compiler are enabled, even when those features change the meaning
1722 of the base standard. As a result, some strict-conforming programs
1723 may be rejected. The particular standard is used by -Wpedantic to
1724 identify which features are GNU extensions given that version of
1725 the standard. For example -std=gnu90 -Wpedantic warns about C++
1726 style // comments, while -std=gnu99 -Wpedantic does not.
1727
1728 A value for this option must be provided; possible values are
1729
1730 c90
1731 c89
1732 iso9899:1990
1733 Support all ISO C90 programs (certain GNU extensions that
1734 conflict with ISO C90 are disabled). Same as -ansi for C code.
1735
1736 iso9899:199409
1737 ISO C90 as modified in amendment 1.
1738
1739 c99
1740 c9x
1741 iso9899:1999
1742 iso9899:199x
1743 ISO C99. This standard is substantially completely supported,
1744 modulo bugs and floating-point issues (mainly but not entirely
1745 relating to optional C99 features from Annexes F and G). See
1746 <https://gcc.gnu.org/c99status.html> for more information. The
1747 names c9x and iso9899:199x are deprecated.
1748
1749 c11
1750 c1x
1751 iso9899:2011
1752 ISO C11, the 2011 revision of the ISO C standard. This
1753 standard is substantially completely supported, modulo bugs,
1754 floating-point issues (mainly but not entirely relating to
1755 optional C11 features from Annexes F and G) and the optional
1756 Annexes K (Bounds-checking interfaces) and L (Analyzability).
1757 The name c1x is deprecated.
1758
1759 c17
1760 c18
1761 iso9899:2017
1762 iso9899:2018
1763 ISO C17, the 2017 revision of the ISO C standard (published in
1764 2018). This standard is same as C11 except for corrections of
1765 defects (all of which are also applied with -std=c11) and a new
1766 value of "__STDC_VERSION__", and so is supported to the same
1767 extent as C11.
1768
1769 c2x The next version of the ISO C standard, still under
1770 development. The support for this version is experimental and
1771 incomplete.
1772
1773 gnu90
1774 gnu89
1775 GNU dialect of ISO C90 (including some C99 features).
1776
1777 gnu99
1778 gnu9x
1779 GNU dialect of ISO C99. The name gnu9x is deprecated.
1780
1781 gnu11
1782 gnu1x
1783 GNU dialect of ISO C11. The name gnu1x is deprecated.
1784
1785 gnu17
1786 gnu18
1787 GNU dialect of ISO C17. This is the default for C code.
1788
1789 gnu2x
1790 The next version of the ISO C standard, still under
1791 development, plus GNU extensions. The support for this version
1792 is experimental and incomplete.
1793
1794 c++98
1795 c++03
1796 The 1998 ISO C++ standard plus the 2003 technical corrigendum
1797 and some additional defect reports. Same as -ansi for C++ code.
1798
1799 gnu++98
1800 gnu++03
1801 GNU dialect of -std=c++98.
1802
1803 c++11
1804 c++0x
1805 The 2011 ISO C++ standard plus amendments. The name c++0x is
1806 deprecated.
1807
1808 gnu++11
1809 gnu++0x
1810 GNU dialect of -std=c++11. The name gnu++0x is deprecated.
1811
1812 c++14
1813 c++1y
1814 The 2014 ISO C++ standard plus amendments. The name c++1y is
1815 deprecated.
1816
1817 gnu++14
1818 gnu++1y
1819 GNU dialect of -std=c++14. The name gnu++1y is deprecated.
1820
1821 c++17
1822 c++1z
1823 The 2017 ISO C++ standard plus amendments. The name c++1z is
1824 deprecated.
1825
1826 gnu++17
1827 gnu++1z
1828 GNU dialect of -std=c++17. This is the default for C++ code.
1829 The name gnu++1z is deprecated.
1830
1831 c++20
1832 c++2a
1833 The 2020 ISO C++ standard plus amendments. Support is
1834 experimental, and could change in incompatible ways in future
1835 releases. The name c++2a is deprecated.
1836
1837 gnu++20
1838 gnu++2a
1839 GNU dialect of -std=c++20. Support is experimental, and could
1840 change in incompatible ways in future releases. The name
1841 gnu++2a is deprecated.
1842
1843 c++2b
1844 c++23
1845 The next revision of the ISO C++ standard, planned for 2023.
1846 Support is highly experimental, and will almost certainly
1847 change in incompatible ways in future releases.
1848
1849 gnu++2b
1850 gnu++23
1851 GNU dialect of -std=c++2b. Support is highly experimental, and
1852 will almost certainly change in incompatible ways in future
1853 releases.
1854
1855 -aux-info filename
1856 Output to the given filename prototyped declarations for all
1857 functions declared and/or defined in a translation unit, including
1858 those in header files. This option is silently ignored in any
1859 language other than C.
1860
1861 Besides declarations, the file indicates, in comments, the origin
1862 of each declaration (source file and line), whether the declaration
1863 was implicit, prototyped or unprototyped (I, N for new or O for
1864 old, respectively, in the first character after the line number and
1865 the colon), and whether it came from a declaration or a definition
1866 (C or F, respectively, in the following character). In the case of
1867 function definitions, a K&R-style list of arguments followed by
1868 their declarations is also provided, inside comments, after the
1869 declaration.
1870
1871 -fallow-parameterless-variadic-functions
1872 Accept variadic functions without named parameters.
1873
1874 Although it is possible to define such a function, this is not very
1875 useful as it is not possible to read the arguments. This is only
1876 supported for C as this construct is allowed by C++.
1877
1878 -fno-asm
1879 Do not recognize "asm", "inline" or "typeof" as a keyword, so that
1880 code can use these words as identifiers. You can use the keywords
1881 "__asm__", "__inline__" and "__typeof__" instead. In C, -ansi
1882 implies -fno-asm.
1883
1884 In C++, "inline" is a standard keyword and is not affected by this
1885 switch. You may want to use the -fno-gnu-keywords flag instead,
1886 which disables "typeof" but not "asm" and "inline". In C99 mode
1887 (-std=c99 or -std=gnu99), this switch only affects the "asm" and
1888 "typeof" keywords, since "inline" is a standard keyword in ISO C99.
1889
1890 -fno-builtin
1891 -fno-builtin-function
1892 Don't recognize built-in functions that do not begin with
1893 __builtin_ as prefix.
1894
1895 GCC normally generates special code to handle certain built-in
1896 functions more efficiently; for instance, calls to "alloca" may
1897 become single instructions which adjust the stack directly, and
1898 calls to "memcpy" may become inline copy loops. The resulting code
1899 is often both smaller and faster, but since the function calls no
1900 longer appear as such, you cannot set a breakpoint on those calls,
1901 nor can you change the behavior of the functions by linking with a
1902 different library. In addition, when a function is recognized as a
1903 built-in function, GCC may use information about that function to
1904 warn about problems with calls to that function, or to generate
1905 more efficient code, even if the resulting code still contains
1906 calls to that function. For example, warnings are given with
1907 -Wformat for bad calls to "printf" when "printf" is built in and
1908 "strlen" is known not to modify global memory.
1909
1910 With the -fno-builtin-function option only the built-in function
1911 function is disabled. function must not begin with __builtin_. If
1912 a function is named that is not built-in in this version of GCC,
1913 this option is ignored. There is no corresponding
1914 -fbuiltin-function option; if you wish to enable built-in functions
1915 selectively when using -fno-builtin or -ffreestanding, you may
1916 define macros such as:
1917
1918 #define abs(n) __builtin_abs ((n))
1919 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1920
1921 -fcond-mismatch
1922 Allow conditional expressions with mismatched types in the second
1923 and third arguments. The value of such an expression is void.
1924 This option is not supported for C++.
1925
1926 -ffreestanding
1927 Assert that compilation targets a freestanding environment. This
1928 implies -fno-builtin. A freestanding environment is one in which
1929 the standard library may not exist, and program startup may not
1930 necessarily be at "main". The most obvious example is an OS
1931 kernel. This is equivalent to -fno-hosted.
1932
1933 -fgimple
1934 Enable parsing of function definitions marked with "__GIMPLE".
1935 This is an experimental feature that allows unit testing of GIMPLE
1936 passes.
1937
1938 -fgnu-tm
1939 When the option -fgnu-tm is specified, the compiler generates code
1940 for the Linux variant of Intel's current Transactional Memory ABI
1941 specification document (Revision 1.1, May 6 2009). This is an
1942 experimental feature whose interface may change in future versions
1943 of GCC, as the official specification changes. Please note that
1944 not all architectures are supported for this feature.
1945
1946 For more information on GCC's support for transactional memory,
1947
1948 Note that the transactional memory feature is not supported with
1949 non-call exceptions (-fnon-call-exceptions).
1950
1951 -fgnu89-inline
1952 The option -fgnu89-inline tells GCC to use the traditional GNU
1953 semantics for "inline" functions when in C99 mode.
1954
1955 Using this option is roughly equivalent to adding the "gnu_inline"
1956 function attribute to all inline functions.
1957
1958 The option -fno-gnu89-inline explicitly tells GCC to use the C99
1959 semantics for "inline" when in C99 or gnu99 mode (i.e., it
1960 specifies the default behavior). This option is not supported in
1961 -std=c90 or -std=gnu90 mode.
1962
1963 The preprocessor macros "__GNUC_GNU_INLINE__" and
1964 "__GNUC_STDC_INLINE__" may be used to check which semantics are in
1965 effect for "inline" functions.
1966
1967 -fhosted
1968 Assert that compilation targets a hosted environment. This implies
1969 -fbuiltin. A hosted environment is one in which the entire
1970 standard library is available, and in which "main" has a return
1971 type of "int". Examples are nearly everything except a kernel.
1972 This is equivalent to -fno-freestanding.
1973
1974 -flax-vector-conversions
1975 Allow implicit conversions between vectors with differing numbers
1976 of elements and/or incompatible element types. This option should
1977 not be used for new code.
1978
1979 -fms-extensions
1980 Accept some non-standard constructs used in Microsoft header files.
1981
1982 In C++ code, this allows member names in structures to be similar
1983 to previous types declarations.
1984
1985 typedef int UOW;
1986 struct ABC {
1987 UOW UOW;
1988 };
1989
1990 Some cases of unnamed fields in structures and unions are only
1991 accepted with this option.
1992
1993 Note that this option is off for all targets except for x86 targets
1994 using ms-abi.
1995
1996 -foffload=disable
1997 -foffload=default
1998 -foffload=target-list
1999 Specify for which OpenMP and OpenACC offload targets code should be
2000 generated. The default behavior, equivalent to -foffload=default,
2001 is to generate code for all supported offload targets. The
2002 -foffload=disable form generates code only for the host fallback,
2003 while -foffload=target-list generates code only for the specified
2004 comma-separated list of offload targets.
2005
2006 Offload targets are specified in GCC's internal target-triplet
2007 format. You can run the compiler with -v to show the list of
2008 configured offload targets under "OFFLOAD_TARGET_NAMES".
2009
2010 -foffload-options=options
2011 -foffload-options=target-triplet-list=options
2012 With -foffload-options=options, GCC passes the specified options to
2013 the compilers for all enabled offloading targets. You can specify
2014 options that apply only to a specific target or targets by using
2015 the -foffload-options=target-list=options form. The target-list is
2016 a comma-separated list in the same format as for the -foffload=
2017 option.
2018
2019 Typical command lines are
2020
2021 -foffload-options=-lgfortran -foffload-options=-lm
2022 -foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic
2023 -foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm
2024
2025 -fopenacc
2026 Enable handling of OpenACC directives "#pragma acc" in C/C++ and
2027 "!$acc" in Fortran. When -fopenacc is specified, the compiler
2028 generates accelerated code according to the OpenACC Application
2029 Programming Interface v2.6 <https://www.openacc.org>. This option
2030 implies -pthread, and thus is only supported on targets that have
2031 support for -pthread.
2032
2033 -fopenacc-dim=geom
2034 Specify default compute dimensions for parallel offload regions
2035 that do not explicitly specify. The geom value is a triple of
2036 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A
2037 size can be omitted, to use a target-specific default value.
2038
2039 -fopenmp
2040 Enable handling of OpenMP directives "#pragma omp" in C/C++ and
2041 "!$omp" in Fortran. When -fopenmp is specified, the compiler
2042 generates parallel code according to the OpenMP Application Program
2043 Interface v4.5 <https://www.openmp.org>. This option implies
2044 -pthread, and thus is only supported on targets that have support
2045 for -pthread. -fopenmp implies -fopenmp-simd.
2046
2047 -fopenmp-simd
2048 Enable handling of OpenMP's SIMD directives with "#pragma omp" in
2049 C/C++ and "!$omp" in Fortran. Other OpenMP directives are ignored.
2050
2051 -fpermitted-flt-eval-methods=style
2052 ISO/IEC TS 18661-3 defines new permissible values for
2053 "FLT_EVAL_METHOD" that indicate that operations and constants with
2054 a semantic type that is an interchange or extended format should be
2055 evaluated to the precision and range of that type. These new
2056 values are a superset of those permitted under C99/C11, which does
2057 not specify the meaning of other positive values of
2058 "FLT_EVAL_METHOD". As such, code conforming to C11 may not have
2059 been written expecting the possibility of the new values.
2060
2061 -fpermitted-flt-eval-methods specifies whether the compiler should
2062 allow only the values of "FLT_EVAL_METHOD" specified in C99/C11, or
2063 the extended set of values specified in ISO/IEC TS 18661-3.
2064
2065 style is either "c11" or "ts-18661-3" as appropriate.
2066
2067 The default when in a standards compliant mode (-std=c11 or
2068 similar) is -fpermitted-flt-eval-methods=c11. The default when in
2069 a GNU dialect (-std=gnu11 or similar) is
2070 -fpermitted-flt-eval-methods=ts-18661-3.
2071
2072 -fplan9-extensions
2073 Accept some non-standard constructs used in Plan 9 code.
2074
2075 This enables -fms-extensions, permits passing pointers to
2076 structures with anonymous fields to functions that expect pointers
2077 to elements of the type of the field, and permits referring to
2078 anonymous fields declared using a typedef. This is only
2079 supported for C, not C++.
2080
2081 -fsigned-bitfields
2082 -funsigned-bitfields
2083 -fno-signed-bitfields
2084 -fno-unsigned-bitfields
2085 These options control whether a bit-field is signed or unsigned,
2086 when the declaration does not use either "signed" or "unsigned".
2087 By default, such a bit-field is signed, because this is consistent:
2088 the basic integer types such as "int" are signed types.
2089
2090 -fsigned-char
2091 Let the type "char" be signed, like "signed char".
2092
2093 Note that this is equivalent to -fno-unsigned-char, which is the
2094 negative form of -funsigned-char. Likewise, the option
2095 -fno-signed-char is equivalent to -funsigned-char.
2096
2097 -funsigned-char
2098 Let the type "char" be unsigned, like "unsigned char".
2099
2100 Each kind of machine has a default for what "char" should be. It
2101 is either like "unsigned char" by default or like "signed char" by
2102 default.
2103
2104 Ideally, a portable program should always use "signed char" or
2105 "unsigned char" when it depends on the signedness of an object.
2106 But many programs have been written to use plain "char" and expect
2107 it to be signed, or expect it to be unsigned, depending on the
2108 machines they were written for. This option, and its inverse, let
2109 you make such a program work with the opposite default.
2110
2111 The type "char" is always a distinct type from each of "signed
2112 char" or "unsigned char", even though its behavior is always just
2113 like one of those two.
2114
2115 -fsso-struct=endianness
2116 Set the default scalar storage order of structures and unions to
2117 the specified endianness. The accepted values are big-endian,
2118 little-endian and native for the native endianness of the target
2119 (the default). This option is not supported for C++.
2120
2121 Warning: the -fsso-struct switch causes GCC to generate code that
2122 is not binary compatible with code generated without it if the
2123 specified endianness is not the native endianness of the target.
2124
2125 Options Controlling C++ Dialect
2126 This section describes the command-line options that are only
2127 meaningful for C++ programs. You can also use most of the GNU compiler
2128 options regardless of what language your program is in. For example,
2129 you might compile a file firstClass.C like this:
2130
2131 g++ -g -fstrict-enums -O -c firstClass.C
2132
2133 In this example, only -fstrict-enums is an option meant only for C++
2134 programs; you can use the other options with any language supported by
2135 GCC.
2136
2137 Some options for compiling C programs, such as -std, are also relevant
2138 for C++ programs.
2139
2140 Here is a list of options that are only for compiling C++ programs:
2141
2142 -fabi-version=n
2143 Use version n of the C++ ABI. The default is version 0.
2144
2145 Version 0 refers to the version conforming most closely to the C++
2146 ABI specification. Therefore, the ABI obtained using version 0
2147 will change in different versions of G++ as ABI bugs are fixed.
2148
2149 Version 1 is the version of the C++ ABI that first appeared in G++
2150 3.2.
2151
2152 Version 2 is the version of the C++ ABI that first appeared in G++
2153 3.4, and was the default through G++ 4.9.
2154
2155 Version 3 corrects an error in mangling a constant address as a
2156 template argument.
2157
2158 Version 4, which first appeared in G++ 4.5, implements a standard
2159 mangling for vector types.
2160
2161 Version 5, which first appeared in G++ 4.6, corrects the mangling
2162 of attribute const/volatile on function pointer types, decltype of
2163 a plain decl, and use of a function parameter in the declaration of
2164 another parameter.
2165
2166 Version 6, which first appeared in G++ 4.7, corrects the promotion
2167 behavior of C++11 scoped enums and the mangling of template
2168 argument packs, const/static_cast, prefix ++ and --, and a class
2169 scope function used as a template argument.
2170
2171 Version 7, which first appeared in G++ 4.8, that treats nullptr_t
2172 as a builtin type and corrects the mangling of lambdas in default
2173 argument scope.
2174
2175 Version 8, which first appeared in G++ 4.9, corrects the
2176 substitution behavior of function types with function-cv-
2177 qualifiers.
2178
2179 Version 9, which first appeared in G++ 5.2, corrects the alignment
2180 of "nullptr_t".
2181
2182 Version 10, which first appeared in G++ 6.1, adds mangling of
2183 attributes that affect type identity, such as ia32 calling
2184 convention attributes (e.g. stdcall).
2185
2186 Version 11, which first appeared in G++ 7, corrects the mangling of
2187 sizeof... expressions and operator names. For multiple entities
2188 with the same name within a function, that are declared in
2189 different scopes, the mangling now changes starting with the
2190 twelfth occurrence. It also implies -fnew-inheriting-ctors.
2191
2192 Version 12, which first appeared in G++ 8, corrects the calling
2193 conventions for empty classes on the x86_64 target and for classes
2194 with only deleted copy/move constructors. It accidentally changes
2195 the calling convention for classes with a deleted copy constructor
2196 and a trivial move constructor.
2197
2198 Version 13, which first appeared in G++ 8.2, fixes the accidental
2199 change in version 12.
2200
2201 Version 14, which first appeared in G++ 10, corrects the mangling
2202 of the nullptr expression.
2203
2204 Version 15, which first appeared in G++ 11, changes the mangling of
2205 "__alignof__" to be distinct from that of "alignof", and dependent
2206 operator names.
2207
2208 See also -Wabi.
2209
2210 -fabi-compat-version=n
2211 On targets that support strong aliases, G++ works around mangling
2212 changes by creating an alias with the correct mangled name when
2213 defining a symbol with an incorrect mangled name. This switch
2214 specifies which ABI version to use for the alias.
2215
2216 With -fabi-version=0 (the default), this defaults to 11 (GCC 7
2217 compatibility). If another ABI version is explicitly selected,
2218 this defaults to 0. For compatibility with GCC versions 3.2
2219 through 4.9, use -fabi-compat-version=2.
2220
2221 If this option is not provided but -Wabi=n is, that version is used
2222 for compatibility aliases. If this option is provided along with
2223 -Wabi (without the version), the version from this option is used
2224 for the warning.
2225
2226 -fno-access-control
2227 Turn off all access checking. This switch is mainly useful for
2228 working around bugs in the access control code.
2229
2230 -faligned-new
2231 Enable support for C++17 "new" of types that require more alignment
2232 than "void* ::operator new(std::size_t)" provides. A numeric
2233 argument such as "-faligned-new=32" can be used to specify how much
2234 alignment (in bytes) is provided by that function, but few users
2235 will need to override the default of "alignof(std::max_align_t)".
2236
2237 This flag is enabled by default for -std=c++17.
2238
2239 -fchar8_t
2240 -fno-char8_t
2241 Enable support for "char8_t" as adopted for C++20. This includes
2242 the addition of a new "char8_t" fundamental type, changes to the
2243 types of UTF-8 string and character literals, new signatures for
2244 user-defined literals, associated standard library updates, and new
2245 "__cpp_char8_t" and "__cpp_lib_char8_t" feature test macros.
2246
2247 This option enables functions to be overloaded for ordinary and
2248 UTF-8 strings:
2249
2250 int f(const char *); // #1
2251 int f(const char8_t *); // #2
2252 int v1 = f("text"); // Calls #1
2253 int v2 = f(u8"text"); // Calls #2
2254
2255 and introduces new signatures for user-defined literals:
2256
2257 int operator""_udl1(char8_t);
2258 int v3 = u8'x'_udl1;
2259 int operator""_udl2(const char8_t*, std::size_t);
2260 int v4 = u8"text"_udl2;
2261 template<typename T, T...> int operator""_udl3();
2262 int v5 = u8"text"_udl3;
2263
2264 The change to the types of UTF-8 string and character literals
2265 introduces incompatibilities with ISO C++11 and later standards.
2266 For example, the following code is well-formed under ISO C++11, but
2267 is ill-formed when -fchar8_t is specified.
2268
2269 char ca[] = u8"xx"; // error: char-array initialized from wide
2270 // string
2271 const char *cp = u8"xx";// error: invalid conversion from
2272 // `const char8_t*' to `const char*'
2273 int f(const char*);
2274 auto v = f(u8"xx"); // error: invalid conversion from
2275 // `const char8_t*' to `const char*'
2276 std::string s{u8"xx"}; // error: no matching function for call to
2277 // `std::basic_string<char>::basic_string()'
2278 using namespace std::literals;
2279 s = u8"xx"s; // error: conversion from
2280 // `basic_string<char8_t>' to non-scalar
2281 // type `basic_string<char>' requested
2282
2283 -fcheck-new
2284 Check that the pointer returned by "operator new" is non-null
2285 before attempting to modify the storage allocated. This check is
2286 normally unnecessary because the C++ standard specifies that
2287 "operator new" only returns 0 if it is declared "throw()", in which
2288 case the compiler always checks the return value even without this
2289 option. In all other cases, when "operator new" has a non-empty
2290 exception specification, memory exhaustion is signalled by throwing
2291 "std::bad_alloc". See also new (nothrow).
2292
2293 -fconcepts
2294 -fconcepts-ts
2295 Below -std=c++20, -fconcepts enables support for the C++ Extensions
2296 for Concepts Technical Specification, ISO 19217 (2015).
2297
2298 With -std=c++20 and above, Concepts are part of the language
2299 standard, so -fconcepts defaults to on. But the standard
2300 specification of Concepts differs significantly from the TS, so
2301 some constructs that were allowed in the TS but didn't make it into
2302 the standard can still be enabled by -fconcepts-ts.
2303
2304 -fconstexpr-depth=n
2305 Set the maximum nested evaluation depth for C++11 constexpr
2306 functions to n. A limit is needed to detect endless recursion
2307 during constant expression evaluation. The minimum specified by
2308 the standard is 512.
2309
2310 -fconstexpr-cache-depth=n
2311 Set the maximum level of nested evaluation depth for C++11
2312 constexpr functions that will be cached to n. This is a heuristic
2313 that trades off compilation speed (when the cache avoids repeated
2314 calculations) against memory consumption (when the cache grows very
2315 large from highly recursive evaluations). The default is 8. Very
2316 few users are likely to want to adjust it, but if your code does
2317 heavy constexpr calculations you might want to experiment to find
2318 which value works best for you.
2319
2320 -fconstexpr-fp-except
2321 Annex F of the C standard specifies that IEC559 floating point
2322 exceptions encountered at compile time should not stop compilation.
2323 C++ compilers have historically not followed this guidance, instead
2324 treating floating point division by zero as non-constant even
2325 though it has a well defined value. This flag tells the compiler
2326 to give Annex F priority over other rules saying that a particular
2327 operation is undefined.
2328
2329 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
2330
2331 -fconstexpr-loop-limit=n
2332 Set the maximum number of iterations for a loop in C++14 constexpr
2333 functions to n. A limit is needed to detect infinite loops during
2334 constant expression evaluation. The default is 262144 (1<<18).
2335
2336 -fconstexpr-ops-limit=n
2337 Set the maximum number of operations during a single constexpr
2338 evaluation. Even when number of iterations of a single loop is
2339 limited with the above limit, if there are several nested loops and
2340 each of them has many iterations but still smaller than the above
2341 limit, or if in a body of some loop or even outside of a loop too
2342 many expressions need to be evaluated, the resulting constexpr
2343 evaluation might take too long. The default is 33554432 (1<<25).
2344
2345 -fcoroutines
2346 Enable support for the C++ coroutines extension (experimental).
2347
2348 -fno-elide-constructors
2349 The C++ standard allows an implementation to omit creating a
2350 temporary that is only used to initialize another object of the
2351 same type. Specifying this option disables that optimization, and
2352 forces G++ to call the copy constructor in all cases. This option
2353 also causes G++ to call trivial member functions which otherwise
2354 would be expanded inline.
2355
2356 In C++17, the compiler is required to omit these temporaries, but
2357 this option still affects trivial member functions.
2358
2359 -fno-enforce-eh-specs
2360 Don't generate code to check for violation of exception
2361 specifications at run time. This option violates the C++ standard,
2362 but may be useful for reducing code size in production builds, much
2363 like defining "NDEBUG". This does not give user code permission to
2364 throw exceptions in violation of the exception specifications; the
2365 compiler still optimizes based on the specifications, so throwing
2366 an unexpected exception results in undefined behavior at run time.
2367
2368 -fextern-tls-init
2369 -fno-extern-tls-init
2370 The C++11 and OpenMP standards allow "thread_local" and
2371 "threadprivate" variables to have dynamic (runtime) initialization.
2372 To support this, any use of such a variable goes through a wrapper
2373 function that performs any necessary initialization. When the use
2374 and definition of the variable are in the same translation unit,
2375 this overhead can be optimized away, but when the use is in a
2376 different translation unit there is significant overhead even if
2377 the variable doesn't actually need dynamic initialization. If the
2378 programmer can be sure that no use of the variable in a non-
2379 defining TU needs to trigger dynamic initialization (either because
2380 the variable is statically initialized, or a use of the variable in
2381 the defining TU will be executed before any uses in another TU),
2382 they can avoid this overhead with the -fno-extern-tls-init option.
2383
2384 On targets that support symbol aliases, the default is
2385 -fextern-tls-init. On targets that do not support symbol aliases,
2386 the default is -fno-extern-tls-init.
2387
2388 -ffold-simple-inlines
2389 -fno-fold-simple-inlines
2390 Permit the C++ frontend to fold calls to "std::move",
2391 "std::forward", "std::addressof" and "std::as_const". In contrast
2392 to inlining, this means no debug information will be generated for
2393 such calls. Since these functions are rarely interesting to debug,
2394 this flag is enabled by default unless -fno-inline is active.
2395
2396 -fno-gnu-keywords
2397 Do not recognize "typeof" as a keyword, so that code can use this
2398 word as an identifier. You can use the keyword "__typeof__"
2399 instead. This option is implied by the strict ISO C++ dialects:
2400 -ansi, -std=c++98, -std=c++11, etc.
2401
2402 -fimplicit-constexpr
2403 Make inline functions implicitly constexpr, if they satisfy the
2404 requirements for a constexpr function. This option can be used in
2405 C++14 mode or later. This can result in initialization changing
2406 from dynamic to static and other optimizations.
2407
2408 -fno-implicit-templates
2409 Never emit code for non-inline templates that are instantiated
2410 implicitly (i.e. by use); only emit code for explicit
2411 instantiations. If you use this option, you must take care to
2412 structure your code to include all the necessary explicit
2413 instantiations to avoid getting undefined symbols at link time.
2414
2415 -fno-implicit-inline-templates
2416 Don't emit code for implicit instantiations of inline templates,
2417 either. The default is to handle inlines differently so that
2418 compiles with and without optimization need the same set of
2419 explicit instantiations.
2420
2421 -fno-implement-inlines
2422 To save space, do not emit out-of-line copies of inline functions
2423 controlled by "#pragma implementation". This causes linker errors
2424 if these functions are not inlined everywhere they are called.
2425
2426 -fmodules-ts
2427 -fno-modules-ts
2428 Enable support for C++20 modules. The -fno-modules-ts is usually
2429 not needed, as that is the default. Even though this is a C++20
2430 feature, it is not currently implicitly enabled by selecting that
2431 standard version.
2432
2433 -fmodule-header
2434 -fmodule-header=user
2435 -fmodule-header=system
2436 Compile a header file to create an importable header unit.
2437
2438 -fmodule-implicit-inline
2439 Member functions defined in their class definitions are not
2440 implicitly inline for modular code. This is different to
2441 traditional C++ behavior, for good reasons. However, it may result
2442 in a difficulty during code porting. This option makes such
2443 function definitions implicitly inline. It does however generate
2444 an ABI incompatibility, so you must use it everywhere or nowhere.
2445 (Such definitions outside of a named module remain implicitly
2446 inline, regardless.)
2447
2448 -fno-module-lazy
2449 Disable lazy module importing and module mapper creation.
2450
2451 -fmodule-mapper=[hostname]:port[?ident]
2452 -fmodule-mapper=|program[?ident] args...
2453 -fmodule-mapper==socket[?ident]
2454 -fmodule-mapper=<>[inout][?ident]
2455 -fmodule-mapper=<in>out[?ident]
2456 -fmodule-mapper=file[?ident]
2457 An oracle to query for module name to filename mappings. If
2458 unspecified the CXX_MODULE_MAPPER environment variable is used, and
2459 if that is unset, an in-process default is provided.
2460
2461 -fmodule-only
2462 Only emit the Compiled Module Interface, inhibiting any object
2463 file.
2464
2465 -fms-extensions
2466 Disable Wpedantic warnings about constructs used in MFC, such as
2467 implicit int and getting a pointer to member function via non-
2468 standard syntax.
2469
2470 -fnew-inheriting-ctors
2471 Enable the P0136 adjustment to the semantics of C++11 constructor
2472 inheritance. This is part of C++17 but also considered to be a
2473 Defect Report against C++11 and C++14. This flag is enabled by
2474 default unless -fabi-version=10 or lower is specified.
2475
2476 -fnew-ttp-matching
2477 Enable the P0522 resolution to Core issue 150, template template
2478 parameters and default arguments: this allows a template with
2479 default template arguments as an argument for a template template
2480 parameter with fewer template parameters. This flag is enabled by
2481 default for -std=c++17.
2482
2483 -fno-nonansi-builtins
2484 Disable built-in declarations of functions that are not mandated by
2485 ANSI/ISO C. These include "ffs", "alloca", "_exit", "index",
2486 "bzero", "conjf", and other related functions.
2487
2488 -fnothrow-opt
2489 Treat a "throw()" exception specification as if it were a
2490 "noexcept" specification to reduce or eliminate the text size
2491 overhead relative to a function with no exception specification.
2492 If the function has local variables of types with non-trivial
2493 destructors, the exception specification actually makes the
2494 function smaller because the EH cleanups for those variables can be
2495 optimized away. The semantic effect is that an exception thrown
2496 out of a function with such an exception specification results in a
2497 call to "terminate" rather than "unexpected".
2498
2499 -fno-operator-names
2500 Do not treat the operator name keywords "and", "bitand", "bitor",
2501 "compl", "not", "or" and "xor" as synonyms as keywords.
2502
2503 -fno-optional-diags
2504 Disable diagnostics that the standard says a compiler does not need
2505 to issue. Currently, the only such diagnostic issued by G++ is the
2506 one for a name having multiple meanings within a class.
2507
2508 -fpermissive
2509 Downgrade some diagnostics about nonconformant code from errors to
2510 warnings. Thus, using -fpermissive allows some nonconforming code
2511 to compile.
2512
2513 -fno-pretty-templates
2514 When an error message refers to a specialization of a function
2515 template, the compiler normally prints the signature of the
2516 template followed by the template arguments and any typedefs or
2517 typenames in the signature (e.g. "void f(T) [with T = int]" rather
2518 than "void f(int)") so that it's clear which template is involved.
2519 When an error message refers to a specialization of a class
2520 template, the compiler omits any template arguments that match the
2521 default template arguments for that template. If either of these
2522 behaviors make it harder to understand the error message rather
2523 than easier, you can use -fno-pretty-templates to disable them.
2524
2525 -fno-rtti
2526 Disable generation of information about every class with virtual
2527 functions for use by the C++ run-time type identification features
2528 ("dynamic_cast" and "typeid"). If you don't use those parts of the
2529 language, you can save some space by using this flag. Note that
2530 exception handling uses the same information, but G++ generates it
2531 as needed. The "dynamic_cast" operator can still be used for casts
2532 that do not require run-time type information, i.e. casts to "void
2533 *" or to unambiguous base classes.
2534
2535 Mixing code compiled with -frtti with that compiled with -fno-rtti
2536 may not work. For example, programs may fail to link if a class
2537 compiled with -fno-rtti is used as a base for a class compiled with
2538 -frtti.
2539
2540 -fsized-deallocation
2541 Enable the built-in global declarations
2542
2543 void operator delete (void *, std::size_t) noexcept;
2544 void operator delete[] (void *, std::size_t) noexcept;
2545
2546 as introduced in C++14. This is useful for user-defined
2547 replacement deallocation functions that, for example, use the size
2548 of the object to make deallocation faster. Enabled by default
2549 under -std=c++14 and above. The flag -Wsized-deallocation warns
2550 about places that might want to add a definition.
2551
2552 -fstrict-enums
2553 Allow the compiler to optimize using the assumption that a value of
2554 enumerated type can only be one of the values of the enumeration
2555 (as defined in the C++ standard; basically, a value that can be
2556 represented in the minimum number of bits needed to represent all
2557 the enumerators). This assumption may not be valid if the program
2558 uses a cast to convert an arbitrary integer value to the enumerated
2559 type.
2560
2561 -fstrong-eval-order
2562 Evaluate member access, array subscripting, and shift expressions
2563 in left-to-right order, and evaluate assignment in right-to-left
2564 order, as adopted for C++17. Enabled by default with -std=c++17.
2565 -fstrong-eval-order=some enables just the ordering of member access
2566 and shift expressions, and is the default without -std=c++17.
2567
2568 -ftemplate-backtrace-limit=n
2569 Set the maximum number of template instantiation notes for a single
2570 warning or error to n. The default value is 10.
2571
2572 -ftemplate-depth=n
2573 Set the maximum instantiation depth for template classes to n. A
2574 limit on the template instantiation depth is needed to detect
2575 endless recursions during template class instantiation. ANSI/ISO
2576 C++ conforming programs must not rely on a maximum depth greater
2577 than 17 (changed to 1024 in C++11). The default value is 900, as
2578 the compiler can run out of stack space before hitting 1024 in some
2579 situations.
2580
2581 -fno-threadsafe-statics
2582 Do not emit the extra code to use the routines specified in the C++
2583 ABI for thread-safe initialization of local statics. You can use
2584 this option to reduce code size slightly in code that doesn't need
2585 to be thread-safe.
2586
2587 -fuse-cxa-atexit
2588 Register destructors for objects with static storage duration with
2589 the "__cxa_atexit" function rather than the "atexit" function.
2590 This option is required for fully standards-compliant handling of
2591 static destructors, but only works if your C library supports
2592 "__cxa_atexit".
2593
2594 -fno-use-cxa-get-exception-ptr
2595 Don't use the "__cxa_get_exception_ptr" runtime routine. This
2596 causes "std::uncaught_exception" to be incorrect, but is necessary
2597 if the runtime routine is not available.
2598
2599 -fvisibility-inlines-hidden
2600 This switch declares that the user does not attempt to compare
2601 pointers to inline functions or methods where the addresses of the
2602 two functions are taken in different shared objects.
2603
2604 The effect of this is that GCC may, effectively, mark inline
2605 methods with "__attribute__ ((visibility ("hidden")))" so that they
2606 do not appear in the export table of a DSO and do not require a PLT
2607 indirection when used within the DSO. Enabling this option can
2608 have a dramatic effect on load and link times of a DSO as it
2609 massively reduces the size of the dynamic export table when the
2610 library makes heavy use of templates.
2611
2612 The behavior of this switch is not quite the same as marking the
2613 methods as hidden directly, because it does not affect static
2614 variables local to the function or cause the compiler to deduce
2615 that the function is defined in only one shared object.
2616
2617 You may mark a method as having a visibility explicitly to negate
2618 the effect of the switch for that method. For example, if you do
2619 want to compare pointers to a particular inline method, you might
2620 mark it as having default visibility. Marking the enclosing class
2621 with explicit visibility has no effect.
2622
2623 Explicitly instantiated inline methods are unaffected by this
2624 option as their linkage might otherwise cross a shared library
2625 boundary.
2626
2627 -fvisibility-ms-compat
2628 This flag attempts to use visibility settings to make GCC's C++
2629 linkage model compatible with that of Microsoft Visual Studio.
2630
2631 The flag makes these changes to GCC's linkage model:
2632
2633 1. It sets the default visibility to "hidden", like
2634 -fvisibility=hidden.
2635
2636 2. Types, but not their members, are not hidden by default.
2637
2638 3. The One Definition Rule is relaxed for types without explicit
2639 visibility specifications that are defined in more than one
2640 shared object: those declarations are permitted if they are
2641 permitted when this option is not used.
2642
2643 In new code it is better to use -fvisibility=hidden and export
2644 those classes that are intended to be externally visible.
2645 Unfortunately it is possible for code to rely, perhaps
2646 accidentally, on the Visual Studio behavior.
2647
2648 Among the consequences of these changes are that static data
2649 members of the same type with the same name but defined in
2650 different shared objects are different, so changing one does not
2651 change the other; and that pointers to function members defined in
2652 different shared objects may not compare equal. When this flag is
2653 given, it is a violation of the ODR to define types with the same
2654 name differently.
2655
2656 -fno-weak
2657 Do not use weak symbol support, even if it is provided by the
2658 linker. By default, G++ uses weak symbols if they are available.
2659 This option exists only for testing, and should not be used by end-
2660 users; it results in inferior code and has no benefits. This
2661 option may be removed in a future release of G++.
2662
2663 -fext-numeric-literals (C++ and Objective-C++ only)
2664 Accept imaginary, fixed-point, or machine-defined literal number
2665 suffixes as GNU extensions. When this option is turned off these
2666 suffixes are treated as C++11 user-defined literal numeric
2667 suffixes. This is on by default for all pre-C++11 dialects and all
2668 GNU dialects: -std=c++98, -std=gnu++98, -std=gnu++11, -std=gnu++14.
2669 This option is off by default for ISO C++11 onwards (-std=c++11,
2670 ...).
2671
2672 -nostdinc++
2673 Do not search for header files in the standard directories specific
2674 to C++, but do still search the other standard directories. (This
2675 option is used when building the C++ library.)
2676
2677 -flang-info-include-translate
2678 -flang-info-include-translate-not
2679 -flang-info-include-translate=header
2680 Inform of include translation events. The first will note accepted
2681 include translations, the second will note declined include
2682 translations. The header form will inform of include translations
2683 relating to that specific header. If header is of the form "user"
2684 or "<system>" it will be resolved to a specific user or system
2685 header using the include path.
2686
2687 -flang-info-module-cmi
2688 -flang-info-module-cmi=module
2689 Inform of Compiled Module Interface pathnames. The first will note
2690 all read CMI pathnames. The module form will not reading a
2691 specific module's CMI. module may be a named module or a header-
2692 unit (the latter indicated by either being a pathname containing
2693 directory separators or enclosed in "<>" or "").
2694
2695 -stdlib=libstdc++,libc++
2696 When G++ is configured to support this option, it allows
2697 specification of alternate C++ runtime libraries. Two options are
2698 available: libstdc++ (the default, native C++ runtime for G++) and
2699 libc++ which is the C++ runtime installed on some operating systems
2700 (e.g. Darwin versions from Darwin11 onwards). The option switches
2701 G++ to use the headers from the specified library and to emit
2702 "-lstdc++" or "-lc++" respectively, when a C++ runtime is required
2703 for linking.
2704
2705 In addition, these warning options have meanings only for C++ programs:
2706
2707 -Wabi-tag (C++ and Objective-C++ only)
2708 Warn when a type with an ABI tag is used in a context that does not
2709 have that ABI tag. See C++ Attributes for more information about
2710 ABI tags.
2711
2712 -Wcomma-subscript (C++ and Objective-C++ only)
2713 Warn about uses of a comma expression within a subscripting
2714 expression. This usage was deprecated in C++20 and is going to be
2715 removed in C++23. However, a comma expression wrapped in "( )" is
2716 not deprecated. Example:
2717
2718 void f(int *a, int b, int c) {
2719 a[b,c]; // deprecated in C++20, invalid in C++23
2720 a[(b,c)]; // OK
2721 }
2722
2723 In C++23 it is valid to have comma separated expressions in a
2724 subscript when an overloaded subscript operator is found and
2725 supports the right number and types of arguments. G++ will accept
2726 the formerly valid syntax for code that is not valid in C++23 but
2727 used to be valid but deprecated in C++20 with a pedantic warning
2728 that can be disabled with -Wno-comma-subscript.
2729
2730 Enabled by default with -std=c++20 unless -Wno-deprecated, and with
2731 -std=c++23 regardless of -Wno-deprecated.
2732
2733 -Wctad-maybe-unsupported (C++ and Objective-C++ only)
2734 Warn when performing class template argument deduction (CTAD) on a
2735 type with no explicitly written deduction guides. This warning
2736 will point out cases where CTAD succeeded only because the compiler
2737 synthesized the implicit deduction guides, which might not be what
2738 the programmer intended. Certain style guides allow CTAD only on
2739 types that specifically "opt-in"; i.e., on types that are designed
2740 to support CTAD. This warning can be suppressed with the following
2741 pattern:
2742
2743 struct allow_ctad_t; // any name works
2744 template <typename T> struct S {
2745 S(T) { }
2746 };
2747 S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered
2748
2749 -Wctor-dtor-privacy (C++ and Objective-C++ only)
2750 Warn when a class seems unusable because all the constructors or
2751 destructors in that class are private, and it has neither friends
2752 nor public static member functions. Also warn if there are no non-
2753 private methods, and there's at least one private member function
2754 that isn't a constructor or destructor.
2755
2756 -Wdelete-non-virtual-dtor (C++ and Objective-C++ only)
2757 Warn when "delete" is used to destroy an instance of a class that
2758 has virtual functions and non-virtual destructor. It is unsafe to
2759 delete an instance of a derived class through a pointer to a base
2760 class if the base class does not have a virtual destructor. This
2761 warning is enabled by -Wall.
2762
2763 -Wdeprecated-copy (C++ and Objective-C++ only)
2764 Warn that the implicit declaration of a copy constructor or copy
2765 assignment operator is deprecated if the class has a user-provided
2766 copy constructor or copy assignment operator, in C++11 and up.
2767 This warning is enabled by -Wextra. With -Wdeprecated-copy-dtor,
2768 also deprecate if the class has a user-provided destructor.
2769
2770 -Wno-deprecated-enum-enum-conversion (C++ and Objective-C++ only)
2771 Disable the warning about the case when the usual arithmetic
2772 conversions are applied on operands where one is of enumeration
2773 type and the other is of a different enumeration type. This
2774 conversion was deprecated in C++20. For example:
2775
2776 enum E1 { e };
2777 enum E2 { f };
2778 int k = f - e;
2779
2780 -Wdeprecated-enum-enum-conversion is enabled by default with
2781 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2782 -Wenum-conversion.
2783
2784 -Wno-deprecated-enum-float-conversion (C++ and Objective-C++ only)
2785 Disable the warning about the case when the usual arithmetic
2786 conversions are applied on operands where one is of enumeration
2787 type and the other is of a floating-point type. This conversion
2788 was deprecated in C++20. For example:
2789
2790 enum E1 { e };
2791 enum E2 { f };
2792 bool b = e <= 3.7;
2793
2794 -Wdeprecated-enum-float-conversion is enabled by default with
2795 -std=c++20. In pre-C++20 dialects, this warning can be enabled by
2796 -Wenum-conversion.
2797
2798 -Wno-init-list-lifetime (C++ and Objective-C++ only)
2799 Do not warn about uses of "std::initializer_list" that are likely
2800 to result in dangling pointers. Since the underlying array for an
2801 "initializer_list" is handled like a normal C++ temporary object,
2802 it is easy to inadvertently keep a pointer to the array past the
2803 end of the array's lifetime. For example:
2804
2805 * If a function returns a temporary "initializer_list", or a
2806 local "initializer_list" variable, the array's lifetime ends at
2807 the end of the return statement, so the value returned has a
2808 dangling pointer.
2809
2810 * If a new-expression creates an "initializer_list", the array
2811 only lives until the end of the enclosing full-expression, so
2812 the "initializer_list" in the heap has a dangling pointer.
2813
2814 * When an "initializer_list" variable is assigned from a brace-
2815 enclosed initializer list, the temporary array created for the
2816 right side of the assignment only lives until the end of the
2817 full-expression, so at the next statement the
2818 "initializer_list" variable has a dangling pointer.
2819
2820 // li's initial underlying array lives as long as li
2821 std::initializer_list<int> li = { 1,2,3 };
2822 // assignment changes li to point to a temporary array
2823 li = { 4, 5 };
2824 // now the temporary is gone and li has a dangling pointer
2825 int i = li.begin()[0] // undefined behavior
2826
2827 * When a list constructor stores the "begin" pointer from the
2828 "initializer_list" argument, this doesn't extend the lifetime
2829 of the array, so if a class variable is constructed from a
2830 temporary "initializer_list", the pointer is left dangling by
2831 the end of the variable declaration statement.
2832
2833 -Winvalid-imported-macros
2834 Verify all imported macro definitions are valid at the end of
2835 compilation. This is not enabled by default, as it requires
2836 additional processing to determine. It may be useful when
2837 preparing sets of header-units to ensure consistent macros.
2838
2839 -Wno-literal-suffix (C++ and Objective-C++ only)
2840 Do not warn when a string or character literal is followed by a ud-
2841 suffix which does not begin with an underscore. As a conforming
2842 extension, GCC treats such suffixes as separate preprocessing
2843 tokens in order to maintain backwards compatibility with code that
2844 uses formatting macros from "<inttypes.h>". For example:
2845
2846 #define __STDC_FORMAT_MACROS
2847 #include <inttypes.h>
2848 #include <stdio.h>
2849
2850 int main() {
2851 int64_t i64 = 123;
2852 printf("My int64: %" PRId64"\n", i64);
2853 }
2854
2855 In this case, "PRId64" is treated as a separate preprocessing
2856 token.
2857
2858 This option also controls warnings when a user-defined literal
2859 operator is declared with a literal suffix identifier that doesn't
2860 begin with an underscore. Literal suffix identifiers that don't
2861 begin with an underscore are reserved for future standardization.
2862
2863 These warnings are enabled by default.
2864
2865 -Wno-narrowing (C++ and Objective-C++ only)
2866 For C++11 and later standards, narrowing conversions are diagnosed
2867 by default, as required by the standard. A narrowing conversion
2868 from a constant produces an error, and a narrowing conversion from
2869 a non-constant produces a warning, but -Wno-narrowing suppresses
2870 the diagnostic. Note that this does not affect the meaning of
2871 well-formed code; narrowing conversions are still considered ill-
2872 formed in SFINAE contexts.
2873
2874 With -Wnarrowing in C++98, warn when a narrowing conversion
2875 prohibited by C++11 occurs within { }, e.g.
2876
2877 int i = { 2.2 }; // error: narrowing from double to int
2878
2879 This flag is included in -Wall and -Wc++11-compat.
2880
2881 -Wnoexcept (C++ and Objective-C++ only)
2882 Warn when a noexcept-expression evaluates to false because of a
2883 call to a function that does not have a non-throwing exception
2884 specification (i.e. "throw()" or "noexcept") but is known by the
2885 compiler to never throw an exception.
2886
2887 -Wnoexcept-type (C++ and Objective-C++ only)
2888 Warn if the C++17 feature making "noexcept" part of a function type
2889 changes the mangled name of a symbol relative to C++14. Enabled by
2890 -Wabi and -Wc++17-compat.
2891
2892 As an example:
2893
2894 template <class T> void f(T t) { t(); };
2895 void g() noexcept;
2896 void h() { f(g); }
2897
2898 In C++14, "f" calls "f<void(*)()>", but in C++17 it calls
2899 "f<void(*)()noexcept>".
2900
2901 -Wclass-memaccess (C++ and Objective-C++ only)
2902 Warn when the destination of a call to a raw memory function such
2903 as "memset" or "memcpy" is an object of class type, and when
2904 writing into such an object might bypass the class non-trivial or
2905 deleted constructor or copy assignment, violate const-correctness
2906 or encapsulation, or corrupt virtual table pointers. Modifying the
2907 representation of such objects may violate invariants maintained by
2908 member functions of the class. For example, the call to "memset"
2909 below is undefined because it modifies a non-trivial class object
2910 and is, therefore, diagnosed. The safe way to either initialize or
2911 clear the storage of objects of such types is by using the
2912 appropriate constructor or assignment operator, if one is
2913 available.
2914
2915 std::string str = "abc";
2916 memset (&str, 0, sizeof str);
2917
2918 The -Wclass-memaccess option is enabled by -Wall. Explicitly
2919 casting the pointer to the class object to "void *" or to a type
2920 that can be safely accessed by the raw memory function suppresses
2921 the warning.
2922
2923 -Wnon-virtual-dtor (C++ and Objective-C++ only)
2924 Warn when a class has virtual functions and an accessible non-
2925 virtual destructor itself or in an accessible polymorphic base
2926 class, in which case it is possible but unsafe to delete an
2927 instance of a derived class through a pointer to the class itself
2928 or base class. This warning is automatically enabled if -Weffc++
2929 is specified.
2930
2931 -Wregister (C++ and Objective-C++ only)
2932 Warn on uses of the "register" storage class specifier, except when
2933 it is part of the GNU Explicit Register Variables extension. The
2934 use of the "register" keyword as storage class specifier has been
2935 deprecated in C++11 and removed in C++17. Enabled by default with
2936 -std=c++17.
2937
2938 -Wreorder (C++ and Objective-C++ only)
2939 Warn when the order of member initializers given in the code does
2940 not match the order in which they must be executed. For instance:
2941
2942 struct A {
2943 int i;
2944 int j;
2945 A(): j (0), i (1) { }
2946 };
2947
2948 The compiler rearranges the member initializers for "i" and "j" to
2949 match the declaration order of the members, emitting a warning to
2950 that effect. This warning is enabled by -Wall.
2951
2952 -Wno-pessimizing-move (C++ and Objective-C++ only)
2953 This warning warns when a call to "std::move" prevents copy
2954 elision. A typical scenario when copy elision can occur is when
2955 returning in a function with a class return type, when the
2956 expression being returned is the name of a non-volatile automatic
2957 object, and is not a function parameter, and has the same type as
2958 the function return type.
2959
2960 struct T {
2961 ...
2962 };
2963 T fn()
2964 {
2965 T t;
2966 ...
2967 return std::move (t);
2968 }
2969
2970 But in this example, the "std::move" call prevents copy elision.
2971
2972 This warning is enabled by -Wall.
2973
2974 -Wno-redundant-move (C++ and Objective-C++ only)
2975 This warning warns about redundant calls to "std::move"; that is,
2976 when a move operation would have been performed even without the
2977 "std::move" call. This happens because the compiler is forced to
2978 treat the object as if it were an rvalue in certain situations such
2979 as returning a local variable, where copy elision isn't applicable.
2980 Consider:
2981
2982 struct T {
2983 ...
2984 };
2985 T fn(T t)
2986 {
2987 ...
2988 return std::move (t);
2989 }
2990
2991 Here, the "std::move" call is redundant. Because G++ implements
2992 Core Issue 1579, another example is:
2993
2994 struct T { // convertible to U
2995 ...
2996 };
2997 struct U {
2998 ...
2999 };
3000 U fn()
3001 {
3002 T t;
3003 ...
3004 return std::move (t);
3005 }
3006
3007 In this example, copy elision isn't applicable because the type of
3008 the expression being returned and the function return type differ,
3009 yet G++ treats the return value as if it were designated by an
3010 rvalue.
3011
3012 This warning is enabled by -Wextra.
3013
3014 -Wrange-loop-construct (C++ and Objective-C++ only)
3015 This warning warns when a C++ range-based for-loop is creating an
3016 unnecessary copy. This can happen when the range declaration is
3017 not a reference, but probably should be. For example:
3018
3019 struct S { char arr[128]; };
3020 void fn () {
3021 S arr[5];
3022 for (const auto x : arr) { ... }
3023 }
3024
3025 It does not warn when the type being copied is a trivially-copyable
3026 type whose size is less than 64 bytes.
3027
3028 This warning also warns when a loop variable in a range-based for-
3029 loop is initialized with a value of a different type resulting in a
3030 copy. For example:
3031
3032 void fn() {
3033 int arr[10];
3034 for (const double &x : arr) { ... }
3035 }
3036
3037 In the example above, in every iteration of the loop a temporary
3038 value of type "double" is created and destroyed, to which the
3039 reference "const double &" is bound.
3040
3041 This warning is enabled by -Wall.
3042
3043 -Wredundant-tags (C++ and Objective-C++ only)
3044 Warn about redundant class-key and enum-key in references to class
3045 types and enumerated types in contexts where the key can be
3046 eliminated without causing an ambiguity. For example:
3047
3048 struct foo;
3049 struct foo *p; // warn that keyword struct can be eliminated
3050
3051 On the other hand, in this example there is no warning:
3052
3053 struct foo;
3054 void foo (); // "hides" struct foo
3055 void bar (struct foo&); // no warning, keyword struct is necessary
3056
3057 -Wno-subobject-linkage (C++ and Objective-C++ only)
3058 Do not warn if a class type has a base or a field whose type uses
3059 the anonymous namespace or depends on a type with no linkage. If a
3060 type A depends on a type B with no or internal linkage, defining it
3061 in multiple translation units would be an ODR violation because the
3062 meaning of B is different in each translation unit. If A only
3063 appears in a single translation unit, the best way to silence the
3064 warning is to give it internal linkage by putting it in an
3065 anonymous namespace as well. The compiler doesn't give this
3066 warning for types defined in the main .C file, as those are
3067 unlikely to have multiple definitions. -Wsubobject-linkage is
3068 enabled by default.
3069
3070 -Weffc++ (C++ and Objective-C++ only)
3071 Warn about violations of the following style guidelines from Scott
3072 Meyers' Effective C++ series of books:
3073
3074 * Define a copy constructor and an assignment operator for
3075 classes with dynamically-allocated memory.
3076
3077 * Prefer initialization to assignment in constructors.
3078
3079 * Have "operator=" return a reference to *this.
3080
3081 * Don't try to return a reference when you must return an object.
3082
3083 * Distinguish between prefix and postfix forms of increment and
3084 decrement operators.
3085
3086 * Never overload "&&", "||", or ",".
3087
3088 This option also enables -Wnon-virtual-dtor, which is also one of
3089 the effective C++ recommendations. However, the check is extended
3090 to warn about the lack of virtual destructor in accessible non-
3091 polymorphic bases classes too.
3092
3093 When selecting this option, be aware that the standard library
3094 headers do not obey all of these guidelines; use grep -v to filter
3095 out those warnings.
3096
3097 -Wno-exceptions (C++ and Objective-C++ only)
3098 Disable the warning about the case when an exception handler is
3099 shadowed by another handler, which can point out a wrong ordering
3100 of exception handlers.
3101
3102 -Wstrict-null-sentinel (C++ and Objective-C++ only)
3103 Warn about the use of an uncasted "NULL" as sentinel. When
3104 compiling only with GCC this is a valid sentinel, as "NULL" is
3105 defined to "__null". Although it is a null pointer constant rather
3106 than a null pointer, it is guaranteed to be of the same size as a
3107 pointer. But this use is not portable across different compilers.
3108
3109 -Wno-non-template-friend (C++ and Objective-C++ only)
3110 Disable warnings when non-template friend functions are declared
3111 within a template. In very old versions of GCC that predate
3112 implementation of the ISO standard, declarations such as friend int
3113 foo(int), where the name of the friend is an unqualified-id, could
3114 be interpreted as a particular specialization of a template
3115 function; the warning exists to diagnose compatibility problems,
3116 and is enabled by default.
3117
3118 -Wold-style-cast (C++ and Objective-C++ only)
3119 Warn if an old-style (C-style) cast to a non-void type is used
3120 within a C++ program. The new-style casts ("dynamic_cast",
3121 "static_cast", "reinterpret_cast", and "const_cast") are less
3122 vulnerable to unintended effects and much easier to search for.
3123
3124 -Woverloaded-virtual (C++ and Objective-C++ only)
3125 Warn when a function declaration hides virtual functions from a
3126 base class. For example, in:
3127
3128 struct A {
3129 virtual void f();
3130 };
3131
3132 struct B: public A {
3133 void f(int);
3134 };
3135
3136 the "A" class version of "f" is hidden in "B", and code like:
3137
3138 B* b;
3139 b->f();
3140
3141 fails to compile.
3142
3143 -Wno-pmf-conversions (C++ and Objective-C++ only)
3144 Disable the diagnostic for converting a bound pointer to member
3145 function to a plain pointer.
3146
3147 -Wsign-promo (C++ and Objective-C++ only)
3148 Warn when overload resolution chooses a promotion from unsigned or
3149 enumerated type to a signed type, over a conversion to an unsigned
3150 type of the same size. Previous versions of G++ tried to preserve
3151 unsignedness, but the standard mandates the current behavior.
3152
3153 -Wtemplates (C++ and Objective-C++ only)
3154 Warn when a primary template declaration is encountered. Some
3155 coding rules disallow templates, and this may be used to enforce
3156 that rule. The warning is inactive inside a system header file,
3157 such as the STL, so one can still use the STL. One may also
3158 instantiate or specialize templates.
3159
3160 -Wmismatched-new-delete (C++ and Objective-C++ only)
3161 Warn for mismatches between calls to "operator new" or "operator
3162 delete" and the corresponding call to the allocation or
3163 deallocation function. This includes invocations of C++ "operator
3164 delete" with pointers returned from either mismatched forms of
3165 "operator new", or from other functions that allocate objects for
3166 which the "operator delete" isn't a suitable deallocator, as well
3167 as calls to other deallocation functions with pointers returned
3168 from "operator new" for which the deallocation function isn't
3169 suitable.
3170
3171 For example, the "delete" expression in the function below is
3172 diagnosed because it doesn't match the array form of the "new"
3173 expression the pointer argument was returned from. Similarly, the
3174 call to "free" is also diagnosed.
3175
3176 void f ()
3177 {
3178 int *a = new int[n];
3179 delete a; // warning: mismatch in array forms of expressions
3180
3181 char *p = new char[n];
3182 free (p); // warning: mismatch between new and free
3183 }
3184
3185 The related option -Wmismatched-dealloc diagnoses mismatches
3186 involving allocation and deallocation functions other than
3187 "operator new" and "operator delete".
3188
3189 -Wmismatched-new-delete is included in -Wall.
3190
3191 -Wmismatched-tags (C++ and Objective-C++ only)
3192 Warn for declarations of structs, classes, and class templates and
3193 their specializations with a class-key that does not match either
3194 the definition or the first declaration if no definition is
3195 provided.
3196
3197 For example, the declaration of "struct Object" in the argument
3198 list of "draw" triggers the warning. To avoid it, either remove
3199 the redundant class-key "struct" or replace it with "class" to
3200 match its definition.
3201
3202 class Object {
3203 public:
3204 virtual ~Object () = 0;
3205 };
3206 void draw (struct Object*);
3207
3208 It is not wrong to declare a class with the class-key "struct" as
3209 the example above shows. The -Wmismatched-tags option is intended
3210 to help achieve a consistent style of class declarations. In code
3211 that is intended to be portable to Windows-based compilers the
3212 warning helps prevent unresolved references due to the difference
3213 in the mangling of symbols declared with different class-keys. The
3214 option can be used either on its own or in conjunction with
3215 -Wredundant-tags.
3216
3217 -Wmultiple-inheritance (C++ and Objective-C++ only)
3218 Warn when a class is defined with multiple direct base classes.
3219 Some coding rules disallow multiple inheritance, and this may be
3220 used to enforce that rule. The warning is inactive inside a system
3221 header file, such as the STL, so one can still use the STL. One
3222 may also define classes that indirectly use multiple inheritance.
3223
3224 -Wvirtual-inheritance
3225 Warn when a class is defined with a virtual direct base class.
3226 Some coding rules disallow multiple inheritance, and this may be
3227 used to enforce that rule. The warning is inactive inside a system
3228 header file, such as the STL, so one can still use the STL. One
3229 may also define classes that indirectly use virtual inheritance.
3230
3231 -Wno-virtual-move-assign
3232 Suppress warnings about inheriting from a virtual base with a non-
3233 trivial C++11 move assignment operator. This is dangerous because
3234 if the virtual base is reachable along more than one path, it is
3235 moved multiple times, which can mean both objects end up in the
3236 moved-from state. If the move assignment operator is written to
3237 avoid moving from a moved-from object, this warning can be
3238 disabled.
3239
3240 -Wnamespaces
3241 Warn when a namespace definition is opened. Some coding rules
3242 disallow namespaces, and this may be used to enforce that rule.
3243 The warning is inactive inside a system header file, such as the
3244 STL, so one can still use the STL. One may also use using
3245 directives and qualified names.
3246
3247 -Wno-terminate (C++ and Objective-C++ only)
3248 Disable the warning about a throw-expression that will immediately
3249 result in a call to "terminate".
3250
3251 -Wno-vexing-parse (C++ and Objective-C++ only)
3252 Warn about the most vexing parse syntactic ambiguity. This warns
3253 about the cases when a declaration looks like a variable
3254 definition, but the C++ language requires it to be interpreted as a
3255 function declaration. For instance:
3256
3257 void f(double a) {
3258 int i(); // extern int i (void);
3259 int n(int(a)); // extern int n (int);
3260 }
3261
3262 Another example:
3263
3264 struct S { S(int); };
3265 void f(double a) {
3266 S x(int(a)); // extern struct S x (int);
3267 S y(int()); // extern struct S y (int (*) (void));
3268 S z(); // extern struct S z (void);
3269 }
3270
3271 The warning will suggest options how to deal with such an
3272 ambiguity; e.g., it can suggest removing the parentheses or using
3273 braces instead.
3274
3275 This warning is enabled by default.
3276
3277 -Wno-class-conversion (C++ and Objective-C++ only)
3278 Do not warn when a conversion function converts an object to the
3279 same type, to a base class of that type, or to void; such a
3280 conversion function will never be called.
3281
3282 -Wvolatile (C++ and Objective-C++ only)
3283 Warn about deprecated uses of the "volatile" qualifier. This
3284 includes postfix and prefix "++" and "--" expressions of
3285 "volatile"-qualified types, using simple assignments where the left
3286 operand is a "volatile"-qualified non-class type for their value,
3287 compound assignments where the left operand is a
3288 "volatile"-qualified non-class type, "volatile"-qualified function
3289 return type, "volatile"-qualified parameter type, and structured
3290 bindings of a "volatile"-qualified type. This usage was deprecated
3291 in C++20.
3292
3293 Enabled by default with -std=c++20.
3294
3295 -Wzero-as-null-pointer-constant (C++ and Objective-C++ only)
3296 Warn when a literal 0 is used as null pointer constant. This can
3297 be useful to facilitate the conversion to "nullptr" in C++11.
3298
3299 -Waligned-new
3300 Warn about a new-expression of a type that requires greater
3301 alignment than the "alignof(std::max_align_t)" but uses an
3302 allocation function without an explicit alignment parameter. This
3303 option is enabled by -Wall.
3304
3305 Normally this only warns about global allocation functions, but
3306 -Waligned-new=all also warns about class member allocation
3307 functions.
3308
3309 -Wno-placement-new
3310 -Wplacement-new=n
3311 Warn about placement new expressions with undefined behavior, such
3312 as constructing an object in a buffer that is smaller than the type
3313 of the object. For example, the placement new expression below is
3314 diagnosed because it attempts to construct an array of 64 integers
3315 in a buffer only 64 bytes large.
3316
3317 char buf [64];
3318 new (buf) int[64];
3319
3320 This warning is enabled by default.
3321
3322 -Wplacement-new=1
3323 This is the default warning level of -Wplacement-new. At this
3324 level the warning is not issued for some strictly undefined
3325 constructs that GCC allows as extensions for compatibility with
3326 legacy code. For example, the following "new" expression is
3327 not diagnosed at this level even though it has undefined
3328 behavior according to the C++ standard because it writes past
3329 the end of the one-element array.
3330
3331 struct S { int n, a[1]; };
3332 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
3333 new (s->a)int [32]();
3334
3335 -Wplacement-new=2
3336 At this level, in addition to diagnosing all the same
3337 constructs as at level 1, a diagnostic is also issued for
3338 placement new expressions that construct an object in the last
3339 member of structure whose type is an array of a single element
3340 and whose size is less than the size of the object being
3341 constructed. While the previous example would be diagnosed,
3342 the following construct makes use of the flexible member array
3343 extension to avoid the warning at level 2.
3344
3345 struct S { int n, a[]; };
3346 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
3347 new (s->a)int [32]();
3348
3349 -Wcatch-value
3350 -Wcatch-value=n (C++ and Objective-C++ only)
3351 Warn about catch handlers that do not catch via reference. With
3352 -Wcatch-value=1 (or -Wcatch-value for short) warn about polymorphic
3353 class types that are caught by value. With -Wcatch-value=2 warn
3354 about all class types that are caught by value. With
3355 -Wcatch-value=3 warn about all types that are not caught by
3356 reference. -Wcatch-value is enabled by -Wall.
3357
3358 -Wconditionally-supported (C++ and Objective-C++ only)
3359 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
3360
3361 -Wno-delete-incomplete (C++ and Objective-C++ only)
3362 Do not warn when deleting a pointer to incomplete type, which may
3363 cause undefined behavior at runtime. This warning is enabled by
3364 default.
3365
3366 -Wextra-semi (C++, Objective-C++ only)
3367 Warn about redundant semicolons after in-class function
3368 definitions.
3369
3370 -Wno-inaccessible-base (C++, Objective-C++ only)
3371 This option controls warnings when a base class is inaccessible in
3372 a class derived from it due to ambiguity. The warning is enabled
3373 by default. Note that the warning for ambiguous virtual bases is
3374 enabled by the -Wextra option.
3375
3376 struct A { int a; };
3377
3378 struct B : A { };
3379
3380 struct C : B, A { };
3381
3382 -Wno-inherited-variadic-ctor
3383 Suppress warnings about use of C++11 inheriting constructors when
3384 the base class inherited from has a C variadic constructor; the
3385 warning is on by default because the ellipsis is not inherited.
3386
3387 -Wno-invalid-offsetof (C++ and Objective-C++ only)
3388 Suppress warnings from applying the "offsetof" macro to a non-POD
3389 type. According to the 2014 ISO C++ standard, applying "offsetof"
3390 to a non-standard-layout type is undefined. In existing C++
3391 implementations, however, "offsetof" typically gives meaningful
3392 results. This flag is for users who are aware that they are
3393 writing nonportable code and who have deliberately chosen to ignore
3394 the warning about it.
3395
3396 The restrictions on "offsetof" may be relaxed in a future version
3397 of the C++ standard.
3398
3399 -Wsized-deallocation (C++ and Objective-C++ only)
3400 Warn about a definition of an unsized deallocation function
3401
3402 void operator delete (void *) noexcept;
3403 void operator delete[] (void *) noexcept;
3404
3405 without a definition of the corresponding sized deallocation
3406 function
3407
3408 void operator delete (void *, std::size_t) noexcept;
3409 void operator delete[] (void *, std::size_t) noexcept;
3410
3411 or vice versa. Enabled by -Wextra along with -fsized-deallocation.
3412
3413 -Wsuggest-final-types
3414 Warn about types with virtual methods where code quality would be
3415 improved if the type were declared with the C++11 "final"
3416 specifier, or, if possible, declared in an anonymous namespace.
3417 This allows GCC to more aggressively devirtualize the polymorphic
3418 calls. This warning is more effective with link-time optimization,
3419 where the information about the class hierarchy graph is more
3420 complete.
3421
3422 -Wsuggest-final-methods
3423 Warn about virtual methods where code quality would be improved if
3424 the method were declared with the C++11 "final" specifier, or, if
3425 possible, its type were declared in an anonymous namespace or with
3426 the "final" specifier. This warning is more effective with link-
3427 time optimization, where the information about the class hierarchy
3428 graph is more complete. It is recommended to first consider
3429 suggestions of -Wsuggest-final-types and then rebuild with new
3430 annotations.
3431
3432 -Wsuggest-override
3433 Warn about overriding virtual functions that are not marked with
3434 the "override" keyword.
3435
3436 -Wuse-after-free
3437 -Wuse-after-free=n
3438 Warn about uses of pointers to dynamically allocated objects that
3439 have been rendered indeterminate by a call to a deallocation
3440 function. The warning is enabled at all optimization levels but
3441 may yield different results with optimization than without.
3442
3443 -Wuse-after-free=1
3444 At level 1 the warning attempts to diagnose only unconditional
3445 uses of pointers made indeterminate by a deallocation call or a
3446 successful call to "realloc", regardless of whether or not the
3447 call resulted in an actual reallocatio of memory. This
3448 includes double-"free" calls as well as uses in arithmetic and
3449 relational expressions. Although undefined, uses of
3450 indeterminate pointers in equality (or inequality) expressions
3451 are not diagnosed at this level.
3452
3453 -Wuse-after-free=2
3454 At level 2, in addition to unconditional uses, the warning also
3455 diagnoses conditional uses of pointers made indeterminate by a
3456 deallocation call. As at level 2, uses in equality (or
3457 inequality) expressions are not diagnosed. For example, the
3458 second call to "free" in the following function is diagnosed at
3459 this level:
3460
3461 struct A { int refcount; void *data; };
3462
3463 void release (struct A *p)
3464 {
3465 int refcount = --p->refcount;
3466 free (p);
3467 if (refcount == 0)
3468 free (p->data); // warning: p may be used after free
3469 }
3470
3471 -Wuse-after-free=3
3472 At level 3, the warning also diagnoses uses of indeterminate
3473 pointers in equality expressions. All uses of indeterminate
3474 pointers are undefined but equality tests sometimes appear
3475 after calls to "realloc" as an attempt to determine whether the
3476 call resulted in relocating the object to a different address.
3477 They are diagnosed at a separate level to aid legacy code
3478 gradually transition to safe alternatives. For example, the
3479 equality test in the function below is diagnosed at this level:
3480
3481 void adjust_pointers (int**, int);
3482
3483 void grow (int **p, int n)
3484 {
3485 int **q = (int**)realloc (p, n *= 2);
3486 if (q == p)
3487 return;
3488 adjust_pointers ((int**)q, n);
3489 }
3490
3491 To avoid the warning at this level, store offsets into
3492 allocated memory instead of pointers. This approach obviates
3493 needing to adjust the stored pointers after reallocation.
3494
3495 -Wuse-after-free=2 is included in -Wall.
3496
3497 -Wuseless-cast (C++ and Objective-C++ only)
3498 Warn when an expression is casted to its own type.
3499
3500 -Wno-conversion-null (C++ and Objective-C++ only)
3501 Do not warn for conversions between "NULL" and non-pointer types.
3502 -Wconversion-null is enabled by default.
3503
3504 Options Controlling Objective-C and Objective-C++ Dialects
3505 (NOTE: This manual does not describe the Objective-C and Objective-C++
3506 languages themselves.
3507
3508 This section describes the command-line options that are only
3509 meaningful for Objective-C and Objective-C++ programs. You can also
3510 use most of the language-independent GNU compiler options. For
3511 example, you might compile a file some_class.m like this:
3512
3513 gcc -g -fgnu-runtime -O -c some_class.m
3514
3515 In this example, -fgnu-runtime is an option meant only for Objective-C
3516 and Objective-C++ programs; you can use the other options with any
3517 language supported by GCC.
3518
3519 Note that since Objective-C is an extension of the C language,
3520 Objective-C compilations may also use options specific to the C front-
3521 end (e.g., -Wtraditional). Similarly, Objective-C++ compilations may
3522 use C++-specific options (e.g., -Wabi).
3523
3524 Here is a list of options that are only for compiling Objective-C and
3525 Objective-C++ programs:
3526
3527 -fconstant-string-class=class-name
3528 Use class-name as the name of the class to instantiate for each
3529 literal string specified with the syntax "@"..."". The default
3530 class name is "NXConstantString" if the GNU runtime is being used,
3531 and "NSConstantString" if the NeXT runtime is being used (see
3532 below). The -fconstant-cfstrings option, if also present,
3533 overrides the -fconstant-string-class setting and cause "@"...""
3534 literals to be laid out as constant CoreFoundation strings.
3535
3536 -fgnu-runtime
3537 Generate object code compatible with the standard GNU Objective-C
3538 runtime. This is the default for most types of systems.
3539
3540 -fnext-runtime
3541 Generate output compatible with the NeXT runtime. This is the
3542 default for NeXT-based systems, including Darwin and Mac OS X. The
3543 macro "__NEXT_RUNTIME__" is predefined if (and only if) this option
3544 is used.
3545
3546 -fno-nil-receivers
3547 Assume that all Objective-C message dispatches ("[receiver
3548 message:arg]") in this translation unit ensure that the receiver is
3549 not "nil". This allows for more efficient entry points in the
3550 runtime to be used. This option is only available in conjunction
3551 with the NeXT runtime and ABI version 0 or 1.
3552
3553 -fobjc-abi-version=n
3554 Use version n of the Objective-C ABI for the selected runtime.
3555 This option is currently supported only for the NeXT runtime. In
3556 that case, Version 0 is the traditional (32-bit) ABI without
3557 support for properties and other Objective-C 2.0 additions.
3558 Version 1 is the traditional (32-bit) ABI with support for
3559 properties and other Objective-C 2.0 additions. Version 2 is the
3560 modern (64-bit) ABI. If nothing is specified, the default is
3561 Version 0 on 32-bit target machines, and Version 2 on 64-bit target
3562 machines.
3563
3564 -fobjc-call-cxx-cdtors
3565 For each Objective-C class, check if any of its instance variables
3566 is a C++ object with a non-trivial default constructor. If so,
3567 synthesize a special "- (id) .cxx_construct" instance method which
3568 runs non-trivial default constructors on any such instance
3569 variables, in order, and then return "self". Similarly, check if
3570 any instance variable is a C++ object with a non-trivial
3571 destructor, and if so, synthesize a special "- (void)
3572 .cxx_destruct" method which runs all such default destructors, in
3573 reverse order.
3574
3575 The "- (id) .cxx_construct" and "- (void) .cxx_destruct" methods
3576 thusly generated only operate on instance variables declared in the
3577 current Objective-C class, and not those inherited from
3578 superclasses. It is the responsibility of the Objective-C runtime
3579 to invoke all such methods in an object's inheritance hierarchy.
3580 The "- (id) .cxx_construct" methods are invoked by the runtime
3581 immediately after a new object instance is allocated; the "- (void)
3582 .cxx_destruct" methods are invoked immediately before the runtime
3583 deallocates an object instance.
3584
3585 As of this writing, only the NeXT runtime on Mac OS X 10.4 and
3586 later has support for invoking the "- (id) .cxx_construct" and "-
3587 (void) .cxx_destruct" methods.
3588
3589 -fobjc-direct-dispatch
3590 Allow fast jumps to the message dispatcher. On Darwin this is
3591 accomplished via the comm page.
3592
3593 -fobjc-exceptions
3594 Enable syntactic support for structured exception handling in
3595 Objective-C, similar to what is offered by C++. This option is
3596 required to use the Objective-C keywords @try, @throw, @catch,
3597 @finally and @synchronized. This option is available with both the
3598 GNU runtime and the NeXT runtime (but not available in conjunction
3599 with the NeXT runtime on Mac OS X 10.2 and earlier).
3600
3601 -fobjc-gc
3602 Enable garbage collection (GC) in Objective-C and Objective-C++
3603 programs. This option is only available with the NeXT runtime; the
3604 GNU runtime has a different garbage collection implementation that
3605 does not require special compiler flags.
3606
3607 -fobjc-nilcheck
3608 For the NeXT runtime with version 2 of the ABI, check for a nil
3609 receiver in method invocations before doing the actual method call.
3610 This is the default and can be disabled using -fno-objc-nilcheck.
3611 Class methods and super calls are never checked for nil in this way
3612 no matter what this flag is set to. Currently this flag does
3613 nothing when the GNU runtime, or an older version of the NeXT
3614 runtime ABI, is used.
3615
3616 -fobjc-std=objc1
3617 Conform to the language syntax of Objective-C 1.0, the language
3618 recognized by GCC 4.0. This only affects the Objective-C additions
3619 to the C/C++ language; it does not affect conformance to C/C++
3620 standards, which is controlled by the separate C/C++ dialect option
3621 flags. When this option is used with the Objective-C or
3622 Objective-C++ compiler, any Objective-C syntax that is not
3623 recognized by GCC 4.0 is rejected. This is useful if you need to
3624 make sure that your Objective-C code can be compiled with older
3625 versions of GCC.
3626
3627 -freplace-objc-classes
3628 Emit a special marker instructing ld(1) not to statically link in
3629 the resulting object file, and allow dyld(1) to load it in at run
3630 time instead. This is used in conjunction with the Fix-and-
3631 Continue debugging mode, where the object file in question may be
3632 recompiled and dynamically reloaded in the course of program
3633 execution, without the need to restart the program itself.
3634 Currently, Fix-and-Continue functionality is only available in
3635 conjunction with the NeXT runtime on Mac OS X 10.3 and later.
3636
3637 -fzero-link
3638 When compiling for the NeXT runtime, the compiler ordinarily
3639 replaces calls to "objc_getClass("...")" (when the name of the
3640 class is known at compile time) with static class references that
3641 get initialized at load time, which improves run-time performance.
3642 Specifying the -fzero-link flag suppresses this behavior and causes
3643 calls to "objc_getClass("...")" to be retained. This is useful in
3644 Zero-Link debugging mode, since it allows for individual class
3645 implementations to be modified during program execution. The GNU
3646 runtime currently always retains calls to "objc_get_class("...")"
3647 regardless of command-line options.
3648
3649 -fno-local-ivars
3650 By default instance variables in Objective-C can be accessed as if
3651 they were local variables from within the methods of the class
3652 they're declared in. This can lead to shadowing between instance
3653 variables and other variables declared either locally inside a
3654 class method or globally with the same name. Specifying the
3655 -fno-local-ivars flag disables this behavior thus avoiding variable
3656 shadowing issues.
3657
3658 -fivar-visibility=[public|protected|private|package]
3659 Set the default instance variable visibility to the specified
3660 option so that instance variables declared outside the scope of any
3661 access modifier directives default to the specified visibility.
3662
3663 -gen-decls
3664 Dump interface declarations for all classes seen in the source file
3665 to a file named sourcename.decl.
3666
3667 -Wassign-intercept (Objective-C and Objective-C++ only)
3668 Warn whenever an Objective-C assignment is being intercepted by the
3669 garbage collector.
3670
3671 -Wno-property-assign-default (Objective-C and Objective-C++ only)
3672 Do not warn if a property for an Objective-C object has no assign
3673 semantics specified.
3674
3675 -Wno-protocol (Objective-C and Objective-C++ only)
3676 If a class is declared to implement a protocol, a warning is issued
3677 for every method in the protocol that is not implemented by the
3678 class. The default behavior is to issue a warning for every method
3679 not explicitly implemented in the class, even if a method
3680 implementation is inherited from the superclass. If you use the
3681 -Wno-protocol option, then methods inherited from the superclass
3682 are considered to be implemented, and no warning is issued for
3683 them.
3684
3685 -Wobjc-root-class (Objective-C and Objective-C++ only)
3686 Warn if a class interface lacks a superclass. Most classes will
3687 inherit from "NSObject" (or "Object") for example. When declaring
3688 classes intended to be root classes, the warning can be suppressed
3689 by marking their interfaces with
3690 "__attribute__((objc_root_class))".
3691
3692 -Wselector (Objective-C and Objective-C++ only)
3693 Warn if multiple methods of different types for the same selector
3694 are found during compilation. The check is performed on the list
3695 of methods in the final stage of compilation. Additionally, a
3696 check is performed for each selector appearing in a
3697 "@selector(...)" expression, and a corresponding method for that
3698 selector has been found during compilation. Because these checks
3699 scan the method table only at the end of compilation, these
3700 warnings are not produced if the final stage of compilation is not
3701 reached, for example because an error is found during compilation,
3702 or because the -fsyntax-only option is being used.
3703
3704 -Wstrict-selector-match (Objective-C and Objective-C++ only)
3705 Warn if multiple methods with differing argument and/or return
3706 types are found for a given selector when attempting to send a
3707 message using this selector to a receiver of type "id" or "Class".
3708 When this flag is off (which is the default behavior), the compiler
3709 omits such warnings if any differences found are confined to types
3710 that share the same size and alignment.
3711
3712 -Wundeclared-selector (Objective-C and Objective-C++ only)
3713 Warn if a "@selector(...)" expression referring to an undeclared
3714 selector is found. A selector is considered undeclared if no
3715 method with that name has been declared before the "@selector(...)"
3716 expression, either explicitly in an @interface or @protocol
3717 declaration, or implicitly in an @implementation section. This
3718 option always performs its checks as soon as a "@selector(...)"
3719 expression is found, while -Wselector only performs its checks in
3720 the final stage of compilation. This also enforces the coding
3721 style convention that methods and selectors must be declared before
3722 being used.
3723
3724 -print-objc-runtime-info
3725 Generate C header describing the largest structure that is passed
3726 by value, if any.
3727
3728 Options to Control Diagnostic Messages Formatting
3729 Traditionally, diagnostic messages have been formatted irrespective of
3730 the output device's aspect (e.g. its width, ...). You can use the
3731 options described below to control the formatting algorithm for
3732 diagnostic messages, e.g. how many characters per line, how often
3733 source location information should be reported. Note that some
3734 language front ends may not honor these options.
3735
3736 -fmessage-length=n
3737 Try to format error messages so that they fit on lines of about n
3738 characters. If n is zero, then no line-wrapping is done; each
3739 error message appears on a single line. This is the default for
3740 all front ends.
3741
3742 Note - this option also affects the display of the #error and
3743 #warning pre-processor directives, and the deprecated
3744 function/type/variable attribute. It does not however affect the
3745 pragma GCC warning and pragma GCC error pragmas.
3746
3747 -fdiagnostics-plain-output
3748 This option requests that diagnostic output look as plain as
3749 possible, which may be useful when running dejagnu or other
3750 utilities that need to parse diagnostics output and prefer that it
3751 remain more stable over time. -fdiagnostics-plain-output is
3752 currently equivalent to the following options:
3753 -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
3754 -fdiagnostics-color=never -fdiagnostics-urls=never
3755 -fdiagnostics-path-format=separate-events In the future, if GCC
3756 changes the default appearance of its diagnostics, the
3757 corresponding option to disable the new behavior will be added to
3758 this list.
3759
3760 -fdiagnostics-show-location=once
3761 Only meaningful in line-wrapping mode. Instructs the diagnostic
3762 messages reporter to emit source location information once; that
3763 is, in case the message is too long to fit on a single physical
3764 line and has to be wrapped, the source location won't be emitted
3765 (as prefix) again, over and over, in subsequent continuation lines.
3766 This is the default behavior.
3767
3768 -fdiagnostics-show-location=every-line
3769 Only meaningful in line-wrapping mode. Instructs the diagnostic
3770 messages reporter to emit the same source location information (as
3771 prefix) for physical lines that result from the process of breaking
3772 a message which is too long to fit on a single line.
3773
3774 -fdiagnostics-color[=WHEN]
3775 -fno-diagnostics-color
3776 Use color in diagnostics. WHEN is never, always, or auto. The
3777 default depends on how the compiler has been configured, it can be
3778 any of the above WHEN options or also never if GCC_COLORS
3779 environment variable isn't present in the environment, and auto
3780 otherwise. auto makes GCC use color only when the standard error
3781 is a terminal, and when not executing in an emacs shell. The forms
3782 -fdiagnostics-color and -fno-diagnostics-color are aliases for
3783 -fdiagnostics-color=always and -fdiagnostics-color=never,
3784 respectively.
3785
3786 The colors are defined by the environment variable GCC_COLORS. Its
3787 value is a colon-separated list of capabilities and Select Graphic
3788 Rendition (SGR) substrings. SGR commands are interpreted by the
3789 terminal or terminal emulator. (See the section in the
3790 documentation of your text terminal for permitted values and their
3791 meanings as character attributes.) These substring values are
3792 integers in decimal representation and can be concatenated with
3793 semicolons. Common values to concatenate include 1 for bold, 4 for
3794 underline, 5 for blink, 7 for inverse, 39 for default foreground
3795 color, 30 to 37 for foreground colors, 90 to 97 for 16-color mode
3796 foreground colors, 38;5;0 to 38;5;255 for 88-color and 256-color
3797 modes foreground colors, 49 for default background color, 40 to 47
3798 for background colors, 100 to 107 for 16-color mode background
3799 colors, and 48;5;0 to 48;5;255 for 88-color and 256-color modes
3800 background colors.
3801
3802 The default GCC_COLORS is
3803
3804 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3805 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
3806 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3807 type-diff=01;32
3808
3809 where 01;31 is bold red, 01;35 is bold magenta, 01;36 is bold cyan,
3810 32 is green, 34 is blue, 01 is bold, and 31 is red. Setting
3811 GCC_COLORS to the empty string disables colors. Supported
3812 capabilities are as follows.
3813
3814 "error="
3815 SGR substring for error: markers.
3816
3817 "warning="
3818 SGR substring for warning: markers.
3819
3820 "note="
3821 SGR substring for note: markers.
3822
3823 "path="
3824 SGR substring for colorizing paths of control-flow events as
3825 printed via -fdiagnostics-path-format=, such as the identifiers
3826 of individual events and lines indicating interprocedural calls
3827 and returns.
3828
3829 "range1="
3830 SGR substring for first additional range.
3831
3832 "range2="
3833 SGR substring for second additional range.
3834
3835 "locus="
3836 SGR substring for location information, file:line or
3837 file:line:column etc.
3838
3839 "quote="
3840 SGR substring for information printed within quotes.
3841
3842 "fixit-insert="
3843 SGR substring for fix-it hints suggesting text to be inserted
3844 or replaced.
3845
3846 "fixit-delete="
3847 SGR substring for fix-it hints suggesting text to be deleted.
3848
3849 "diff-filename="
3850 SGR substring for filename headers within generated patches.
3851
3852 "diff-hunk="
3853 SGR substring for the starts of hunks within generated patches.
3854
3855 "diff-delete="
3856 SGR substring for deleted lines within generated patches.
3857
3858 "diff-insert="
3859 SGR substring for inserted lines within generated patches.
3860
3861 "type-diff="
3862 SGR substring for highlighting mismatching types within
3863 template arguments in the C++ frontend.
3864
3865 -fdiagnostics-urls[=WHEN]
3866 Use escape sequences to embed URLs in diagnostics. For example,
3867 when -fdiagnostics-show-option emits text showing the command-line
3868 option controlling a diagnostic, embed a URL for documentation of
3869 that option.
3870
3871 WHEN is never, always, or auto. auto makes GCC use URL escape
3872 sequences only when the standard error is a terminal, and when not
3873 executing in an emacs shell or any graphical terminal which is
3874 known to be incompatible with this feature, see below.
3875
3876 The default depends on how the compiler has been configured. It
3877 can be any of the above WHEN options.
3878
3879 GCC can also be configured (via the
3880 --with-diagnostics-urls=auto-if-env configure-time option) so that
3881 the default is affected by environment variables. Under such a
3882 configuration, GCC defaults to using auto if either GCC_URLS or
3883 TERM_URLS environment variables are present and non-empty in the
3884 environment of the compiler, or never if neither are.
3885
3886 However, even with -fdiagnostics-urls=always the behavior is
3887 dependent on those environment variables: If GCC_URLS is set to
3888 empty or no, do not embed URLs in diagnostics. If set to st, URLs
3889 use ST escape sequences. If set to bel, the default, URLs use BEL
3890 escape sequences. Any other non-empty value enables the feature.
3891 If GCC_URLS is not set, use TERM_URLS as a fallback. Note: ST is
3892 an ANSI escape sequence, string terminator ESC \, BEL is an ASCII
3893 character, CTRL-G that usually sounds like a beep.
3894
3895 At this time GCC tries to detect also a few terminals that are
3896 known to not implement the URL feature, and have bugs or at least
3897 had bugs in some versions that are still in use, where the URL
3898 escapes are likely to misbehave, i.e. print garbage on the screen.
3899 That list is currently xfce4-terminal, certain known to be buggy
3900 gnome-terminal versions, the linux console, and mingw. This check
3901 can be skipped with the -fdiagnostics-urls=always.
3902
3903 -fno-diagnostics-show-option
3904 By default, each diagnostic emitted includes text indicating the
3905 command-line option that directly controls the diagnostic (if such
3906 an option is known to the diagnostic machinery). Specifying the
3907 -fno-diagnostics-show-option flag suppresses that behavior.
3908
3909 -fno-diagnostics-show-caret
3910 By default, each diagnostic emitted includes the original source
3911 line and a caret ^ indicating the column. This option suppresses
3912 this information. The source line is truncated to n characters, if
3913 the -fmessage-length=n option is given. When the output is done to
3914 the terminal, the width is limited to the width given by the
3915 COLUMNS environment variable or, if not set, to the terminal width.
3916
3917 -fno-diagnostics-show-labels
3918 By default, when printing source code (via
3919 -fdiagnostics-show-caret), diagnostics can label ranges of source
3920 code with pertinent information, such as the types of expressions:
3921
3922 printf ("foo %s bar", long_i + long_j);
3923 ~^ ~~~~~~~~~~~~~~~
3924 | |
3925 char * long int
3926
3927 This option suppresses the printing of these labels (in the example
3928 above, the vertical bars and the "char *" and "long int" text).
3929
3930 -fno-diagnostics-show-cwe
3931 Diagnostic messages can optionally have an associated
3932 @url{https://cwe.mitre.org/index.html, CWE} identifier. GCC itself
3933 only provides such metadata for some of the -fanalyzer diagnostics.
3934 GCC plugins may also provide diagnostics with such metadata. By
3935 default, if this information is present, it will be printed with
3936 the diagnostic. This option suppresses the printing of this
3937 metadata.
3938
3939 -fno-diagnostics-show-line-numbers
3940 By default, when printing source code (via
3941 -fdiagnostics-show-caret), a left margin is printed, showing line
3942 numbers. This option suppresses this left margin.
3943
3944 -fdiagnostics-minimum-margin-width=width
3945 This option controls the minimum width of the left margin printed
3946 by -fdiagnostics-show-line-numbers. It defaults to 6.
3947
3948 -fdiagnostics-parseable-fixits
3949 Emit fix-it hints in a machine-parseable format, suitable for
3950 consumption by IDEs. For each fix-it, a line will be printed after
3951 the relevant diagnostic, starting with the string "fix-it:". For
3952 example:
3953
3954 fix-it:"test.c":{45:3-45:21}:"gtk_widget_show_all"
3955
3956 The location is expressed as a half-open range, expressed as a
3957 count of bytes, starting at byte 1 for the initial column. In the
3958 above example, bytes 3 through 20 of line 45 of "test.c" are to be
3959 replaced with the given string:
3960
3961 00000000011111111112222222222
3962 12345678901234567890123456789
3963 gtk_widget_showall (dlg);
3964 ^^^^^^^^^^^^^^^^^^
3965 gtk_widget_show_all
3966
3967 The filename and replacement string escape backslash as "\\", tab
3968 as "\t", newline as "\n", double quotes as "\"", non-printable
3969 characters as octal (e.g. vertical tab as "\013").
3970
3971 An empty replacement string indicates that the given range is to be
3972 removed. An empty range (e.g. "45:3-45:3") indicates that the
3973 string is to be inserted at the given position.
3974
3975 -fdiagnostics-generate-patch
3976 Print fix-it hints to stderr in unified diff format, after any
3977 diagnostics are printed. For example:
3978
3979 --- test.c
3980 +++ test.c
3981 @ -42,5 +42,5 @
3982
3983 void show_cb(GtkDialog *dlg)
3984 {
3985 - gtk_widget_showall(dlg);
3986 + gtk_widget_show_all(dlg);
3987 }
3988
3989 The diff may or may not be colorized, following the same rules as
3990 for diagnostics (see -fdiagnostics-color).
3991
3992 -fdiagnostics-show-template-tree
3993 In the C++ frontend, when printing diagnostics showing mismatching
3994 template types, such as:
3995
3996 could not convert 'std::map<int, std::vector<double> >()'
3997 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3998
3999 the -fdiagnostics-show-template-tree flag enables printing a tree-
4000 like structure showing the common and differing parts of the types,
4001 such as:
4002
4003 map<
4004 [...],
4005 vector<
4006 [double != float]>>
4007
4008 The parts that differ are highlighted with color ("double" and
4009 "float" in this case).
4010
4011 -fno-elide-type
4012 By default when the C++ frontend prints diagnostics showing
4013 mismatching template types, common parts of the types are printed
4014 as "[...]" to simplify the error message. For example:
4015
4016 could not convert 'std::map<int, std::vector<double> >()'
4017 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4018
4019 Specifying the -fno-elide-type flag suppresses that behavior. This
4020 flag also affects the output of the
4021 -fdiagnostics-show-template-tree flag.
4022
4023 -fdiagnostics-path-format=KIND
4024 Specify how to print paths of control-flow events for diagnostics
4025 that have such a path associated with them.
4026
4027 KIND is none, separate-events, or inline-events, the default.
4028
4029 none means to not print diagnostic paths.
4030
4031 separate-events means to print a separate "note" diagnostic for
4032 each event within the diagnostic. For example:
4033
4034 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
4035 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
4036 test.c:27:3: note: (2) when 'i < count'
4037 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4038
4039 inline-events means to print the events "inline" within the source
4040 code. This view attempts to consolidate the events into runs of
4041 sufficiently-close events, printing them as labelled ranges within
4042 the source.
4043
4044 For example, the same events as above might be printed as:
4045
4046 'test': events 1-3
4047 |
4048 | 25 | list = PyList_New(0);
4049 | | ^~~~~~~~~~~~~
4050 | | |
4051 | | (1) when 'PyList_New' fails, returning NULL
4052 | 26 |
4053 | 27 | for (i = 0; i < count; i++) {
4054 | | ~~~
4055 | | |
4056 | | (2) when 'i < count'
4057 | 28 | item = PyLong_FromLong(random());
4058 | 29 | PyList_Append(list, item);
4059 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
4060 | | |
4061 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4062 |
4063
4064 Interprocedural control flow is shown by grouping the events by
4065 stack frame, and using indentation to show how stack frames are
4066 nested, pushed, and popped.
4067
4068 For example:
4069
4070 'test': events 1-2
4071 |
4072 | 133 | {
4073 | | ^
4074 | | |
4075 | | (1) entering 'test'
4076 | 134 | boxed_int *obj = make_boxed_int (i);
4077 | | ~~~~~~~~~~~~~~~~~~
4078 | | |
4079 | | (2) calling 'make_boxed_int'
4080 |
4081 +--> 'make_boxed_int': events 3-4
4082 |
4083 | 120 | {
4084 | | ^
4085 | | |
4086 | | (3) entering 'make_boxed_int'
4087 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
4088 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4089 | | |
4090 | | (4) calling 'wrapped_malloc'
4091 |
4092 +--> 'wrapped_malloc': events 5-6
4093 |
4094 | 7 | {
4095 | | ^
4096 | | |
4097 | | (5) entering 'wrapped_malloc'
4098 | 8 | return malloc (size);
4099 | | ~~~~~~~~~~~~~
4100 | | |
4101 | | (6) calling 'malloc'
4102 |
4103 <-------------+
4104 |
4105 'test': event 7
4106 |
4107 | 138 | free_boxed_int (obj);
4108 | | ^~~~~~~~~~~~~~~~~~~~
4109 | | |
4110 | | (7) calling 'free_boxed_int'
4111 |
4112 (etc)
4113
4114 -fdiagnostics-show-path-depths
4115 This option provides additional information when printing control-
4116 flow paths associated with a diagnostic.
4117
4118 If this is option is provided then the stack depth will be printed
4119 for each run of events within
4120 -fdiagnostics-path-format=separate-events.
4121
4122 This is intended for use by GCC developers and plugin developers
4123 when debugging diagnostics that report interprocedural control
4124 flow.
4125
4126 -fno-show-column
4127 Do not print column numbers in diagnostics. This may be necessary
4128 if diagnostics are being scanned by a program that does not
4129 understand the column numbers, such as dejagnu.
4130
4131 -fdiagnostics-column-unit=UNIT
4132 Select the units for the column number. This affects traditional
4133 diagnostics (in the absence of -fno-show-column), as well as JSON
4134 format diagnostics if requested.
4135
4136 The default UNIT, display, considers the number of display columns
4137 occupied by each character. This may be larger than the number of
4138 bytes required to encode the character, in the case of tab
4139 characters, or it may be smaller, in the case of multibyte
4140 characters. For example, the character "GREEK SMALL LETTER PI
4141 (U+03C0)" occupies one display column, and its UTF-8 encoding
4142 requires two bytes; the character "SLIGHTLY SMILING FACE (U+1F642)"
4143 occupies two display columns, and its UTF-8 encoding requires four
4144 bytes.
4145
4146 Setting UNIT to byte changes the column number to the raw byte
4147 count in all cases, as was traditionally output by GCC prior to
4148 version 11.1.0.
4149
4150 -fdiagnostics-column-origin=ORIGIN
4151 Select the origin for column numbers, i.e. the column number
4152 assigned to the first column. The default value of 1 corresponds
4153 to traditional GCC behavior and to the GNU style guide. Some
4154 utilities may perform better with an origin of 0; any non-negative
4155 value may be specified.
4156
4157 -fdiagnostics-escape-format=FORMAT
4158 When GCC prints pertinent source lines for a diagnostic it normally
4159 attempts to print the source bytes directly. However, some
4160 diagnostics relate to encoding issues in the source file, such as
4161 malformed UTF-8, or issues with Unicode normalization. These
4162 diagnostics are flagged so that GCC will escape bytes that are not
4163 printable ASCII when printing their pertinent source lines.
4164
4165 This option controls how such bytes should be escaped.
4166
4167 The default FORMAT, unicode displays Unicode characters that are
4168 not printable ASCII in the form <U+XXXX>, and bytes that do not
4169 correspond to a Unicode character validly-encoded in UTF-8-encoded
4170 will be displayed as hexadecimal in the form <XX>.
4171
4172 For example, a source line containing the string before followed by
4173 the Unicode character U+03C0 ("GREEK SMALL LETTER PI", with UTF-8
4174 encoding 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8
4175 trailing byte), followed by the string after will be printed for
4176 such a diagnostic as:
4177
4178 before<U+03C0><BF>after
4179
4180 Setting FORMAT to bytes will display all non-printable-ASCII bytes
4181 in the form <XX>, thus showing the underlying encoding of non-ASCII
4182 Unicode characters. For the example above, the following will be
4183 printed:
4184
4185 before<CF><80><BF>after
4186
4187 -fdiagnostics-format=FORMAT
4188 Select a different format for printing diagnostics. FORMAT is text
4189 or json. The default is text.
4190
4191 The json format consists of a top-level JSON array containing JSON
4192 objects representing the diagnostics.
4193
4194 The JSON is emitted as one line, without formatting; the examples
4195 below have been formatted for clarity.
4196
4197 Diagnostics can have child diagnostics. For example, this error
4198 and note:
4199
4200 misleading-indentation.c:15:3: warning: this 'if' clause does not
4201 guard... [-Wmisleading-indentation]
4202 15 | if (flag)
4203 | ^~
4204 misleading-indentation.c:17:5: note: ...this statement, but the latter
4205 is misleadingly indented as if it were guarded by the 'if'
4206 17 | y = 2;
4207 | ^
4208
4209 might be printed in JSON form (after formatting) like this:
4210
4211 [
4212 {
4213 "kind": "warning",
4214 "locations": [
4215 {
4216 "caret": {
4217 "display-column": 3,
4218 "byte-column": 3,
4219 "column": 3,
4220 "file": "misleading-indentation.c",
4221 "line": 15
4222 },
4223 "finish": {
4224 "display-column": 4,
4225 "byte-column": 4,
4226 "column": 4,
4227 "file": "misleading-indentation.c",
4228 "line": 15
4229 }
4230 }
4231 ],
4232 "message": "this \u2018if\u2019 clause does not guard...",
4233 "option": "-Wmisleading-indentation",
4234 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4235 "children": [
4236 {
4237 "kind": "note",
4238 "locations": [
4239 {
4240 "caret": {
4241 "display-column": 5,
4242 "byte-column": 5,
4243 "column": 5,
4244 "file": "misleading-indentation.c",
4245 "line": 17
4246 }
4247 }
4248 ],
4249 "escape-source": false,
4250 "message": "...this statement, but the latter is ..."
4251 }
4252 ]
4253 "escape-source": false,
4254 "column-origin": 1,
4255 }
4256 ]
4257
4258 where the "note" is a child of the "warning".
4259
4260 A diagnostic has a "kind". If this is "warning", then there is an
4261 "option" key describing the command-line option controlling the
4262 warning.
4263
4264 A diagnostic can contain zero or more locations. Each location has
4265 an optional "label" string and up to three positions within it: a
4266 "caret" position and optional "start" and "finish" positions. A
4267 position is described by a "file" name, a "line" number, and three
4268 numbers indicating a column position:
4269
4270 * "display-column" counts display columns, accounting for tabs
4271 and multibyte characters.
4272
4273 * "byte-column" counts raw bytes.
4274
4275 * "column" is equal to one of the previous two, as dictated by
4276 the -fdiagnostics-column-unit option.
4277
4278 All three columns are relative to the origin specified by
4279 -fdiagnostics-column-origin, which is typically equal to 1 but may
4280 be set, for instance, to 0 for compatibility with other utilities
4281 that number columns from 0. The column origin is recorded in the
4282 JSON output in the "column-origin" tag. In the remaining examples
4283 below, the extra column number outputs have been omitted for
4284 brevity.
4285
4286 For example, this error:
4287
4288 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' {aka
4289 'struct s'} and 'T' {aka 'struct t'})
4290 64 | return callee_4a () + callee_4b ();
4291 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4292 | | |
4293 | | T {aka struct t}
4294 | S {aka struct s}
4295
4296 has three locations. Its primary location is at the "+" token at
4297 column 23. It has two secondary locations, describing the left and
4298 right-hand sides of the expression, which have labels. It might be
4299 printed in JSON form as:
4300
4301 {
4302 "children": [],
4303 "kind": "error",
4304 "locations": [
4305 {
4306 "caret": {
4307 "column": 23, "file": "bad-binary-ops.c", "line": 64
4308 }
4309 },
4310 {
4311 "caret": {
4312 "column": 10, "file": "bad-binary-ops.c", "line": 64
4313 },
4314 "finish": {
4315 "column": 21, "file": "bad-binary-ops.c", "line": 64
4316 },
4317 "label": "S {aka struct s}"
4318 },
4319 {
4320 "caret": {
4321 "column": 25, "file": "bad-binary-ops.c", "line": 64
4322 },
4323 "finish": {
4324 "column": 36, "file": "bad-binary-ops.c", "line": 64
4325 },
4326 "label": "T {aka struct t}"
4327 }
4328 ],
4329 "escape-source": false,
4330 "message": "invalid operands to binary + ..."
4331 }
4332
4333 If a diagnostic contains fix-it hints, it has a "fixits" array,
4334 consisting of half-open intervals, similar to the output of
4335 -fdiagnostics-parseable-fixits. For example, this diagnostic with
4336 a replacement fix-it hint:
4337
4338 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4339 mean 'color'?
4340 8 | return ptr->colour;
4341 | ^~~~~~
4342 | color
4343
4344 might be printed in JSON form as:
4345
4346 {
4347 "children": [],
4348 "fixits": [
4349 {
4350 "next": {
4351 "column": 21,
4352 "file": "demo.c",
4353 "line": 8
4354 },
4355 "start": {
4356 "column": 15,
4357 "file": "demo.c",
4358 "line": 8
4359 },
4360 "string": "color"
4361 }
4362 ],
4363 "kind": "error",
4364 "locations": [
4365 {
4366 "caret": {
4367 "column": 15,
4368 "file": "demo.c",
4369 "line": 8
4370 },
4371 "finish": {
4372 "column": 20,
4373 "file": "demo.c",
4374 "line": 8
4375 }
4376 }
4377 ],
4378 "escape-source": false,
4379 "message": "\u2018struct s\u2019 has no member named ..."
4380 }
4381
4382 where the fix-it hint suggests replacing the text from "start" up
4383 to but not including "next" with "string"'s value. Deletions are
4384 expressed via an empty value for "string", insertions by having
4385 "start" equal "next".
4386
4387 If the diagnostic has a path of control-flow events associated with
4388 it, it has a "path" array of objects representing the events. Each
4389 event object has a "description" string, a "location" object, along
4390 with a "function" string and a "depth" number for representing
4391 interprocedural paths. The "function" represents the current
4392 function at that event, and the "depth" represents the stack depth
4393 relative to some baseline: the higher, the more frames are within
4394 the stack.
4395
4396 For example, the intraprocedural example shown for
4397 -fdiagnostics-path-format= might have this JSON for its path:
4398
4399 "path": [
4400 {
4401 "depth": 0,
4402 "description": "when 'PyList_New' fails, returning NULL",
4403 "function": "test",
4404 "location": {
4405 "column": 10,
4406 "file": "test.c",
4407 "line": 25
4408 }
4409 },
4410 {
4411 "depth": 0,
4412 "description": "when 'i < count'",
4413 "function": "test",
4414 "location": {
4415 "column": 3,
4416 "file": "test.c",
4417 "line": 27
4418 }
4419 },
4420 {
4421 "depth": 0,
4422 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
4423 "function": "test",
4424 "location": {
4425 "column": 5,
4426 "file": "test.c",
4427 "line": 29
4428 }
4429 }
4430 ]
4431
4432 Diagnostics have a boolean attribute "escape-source", hinting
4433 whether non-ASCII bytes should be escaped when printing the
4434 pertinent lines of source code ("true" for diagnostics involving
4435 source encoding issues).
4436
4437 Options to Request or Suppress Warnings
4438 Warnings are diagnostic messages that report constructions that are not
4439 inherently erroneous but that are risky or suggest there may have been
4440 an error.
4441
4442 The following language-independent options do not enable specific
4443 warnings but control the kinds of diagnostics produced by GCC.
4444
4445 -fsyntax-only
4446 Check the code for syntax errors, but don't do anything beyond
4447 that.
4448
4449 -fmax-errors=n
4450 Limits the maximum number of error messages to n, at which point
4451 GCC bails out rather than attempting to continue processing the
4452 source code. If n is 0 (the default), there is no limit on the
4453 number of error messages produced. If -Wfatal-errors is also
4454 specified, then -Wfatal-errors takes precedence over this option.
4455
4456 -w Inhibit all warning messages.
4457
4458 -Werror
4459 Make all warnings into errors.
4460
4461 -Werror=
4462 Make the specified warning into an error. The specifier for a
4463 warning is appended; for example -Werror=switch turns the warnings
4464 controlled by -Wswitch into errors. This switch takes a negative
4465 form, to be used to negate -Werror for specific warnings; for
4466 example -Wno-error=switch makes -Wswitch warnings not be errors,
4467 even when -Werror is in effect.
4468
4469 The warning message for each controllable warning includes the
4470 option that controls the warning. That option can then be used
4471 with -Werror= and -Wno-error= as described above. (Printing of the
4472 option in the warning message can be disabled using the
4473 -fno-diagnostics-show-option flag.)
4474
4475 Note that specifying -Werror=foo automatically implies -Wfoo.
4476 However, -Wno-error=foo does not imply anything.
4477
4478 -Wfatal-errors
4479 This option causes the compiler to abort compilation on the first
4480 error occurred rather than trying to keep going and printing
4481 further error messages.
4482
4483 You can request many specific warnings with options beginning with -W,
4484 for example -Wimplicit to request warnings on implicit declarations.
4485 Each of these specific warning options also has a negative form
4486 beginning -Wno- to turn off warnings; for example, -Wno-implicit. This
4487 manual lists only one of the two forms, whichever is not the default.
4488 For further language-specific options also refer to C++ Dialect Options
4489 and Objective-C and Objective-C++ Dialect Options. Additional warnings
4490 can be produced by enabling the static analyzer;
4491
4492 Some options, such as -Wall and -Wextra, turn on other options, such as
4493 -Wunused, which may turn on further options, such as -Wunused-value.
4494 The combined effect of positive and negative forms is that more
4495 specific options have priority over less specific ones, independently
4496 of their position in the command-line. For options of the same
4497 specificity, the last one takes effect. Options enabled or disabled via
4498 pragmas take effect as if they appeared at the end of the command-line.
4499
4500 When an unrecognized warning option is requested (e.g.,
4501 -Wunknown-warning), GCC emits a diagnostic stating that the option is
4502 not recognized. However, if the -Wno- form is used, the behavior is
4503 slightly different: no diagnostic is produced for -Wno-unknown-warning
4504 unless other diagnostics are being produced. This allows the use of
4505 new -Wno- options with old compilers, but if something goes wrong, the
4506 compiler warns that an unrecognized option is present.
4507
4508 The effectiveness of some warnings depends on optimizations also being
4509 enabled. For example -Wsuggest-final-types is more effective with link-
4510 time optimization and some instances of other warnings may not be
4511 issued at all unless optimization is enabled. While optimization in
4512 general improves the efficacy of control and data flow sensitive
4513 warnings, in some cases it may also cause false positives.
4514
4515 -Wpedantic
4516 -pedantic
4517 Issue all the warnings demanded by strict ISO C and ISO C++; reject
4518 all programs that use forbidden extensions, and some other programs
4519 that do not follow ISO C and ISO C++. For ISO C, follows the
4520 version of the ISO C standard specified by any -std option used.
4521
4522 Valid ISO C and ISO C++ programs should compile properly with or
4523 without this option (though a rare few require -ansi or a -std
4524 option specifying the required version of ISO C). However, without
4525 this option, certain GNU extensions and traditional C and C++
4526 features are supported as well. With this option, they are
4527 rejected.
4528
4529 -Wpedantic does not cause warning messages for use of the alternate
4530 keywords whose names begin and end with __. This alternate format
4531 can also be used to disable warnings for non-ISO __intN types, i.e.
4532 __intN__. Pedantic warnings are also disabled in the expression
4533 that follows "__extension__". However, only system header files
4534 should use these escape routes; application programs should avoid
4535 them.
4536
4537 Some users try to use -Wpedantic to check programs for strict ISO C
4538 conformance. They soon find that it does not do quite what they
4539 want: it finds some non-ISO practices, but not all---only those for
4540 which ISO C requires a diagnostic, and some others for which
4541 diagnostics have been added.
4542
4543 A feature to report any failure to conform to ISO C might be useful
4544 in some instances, but would require considerable additional work
4545 and would be quite different from -Wpedantic. We don't have plans
4546 to support such a feature in the near future.
4547
4548 Where the standard specified with -std represents a GNU extended
4549 dialect of C, such as gnu90 or gnu99, there is a corresponding base
4550 standard, the version of ISO C on which the GNU extended dialect is
4551 based. Warnings from -Wpedantic are given where they are required
4552 by the base standard. (It does not make sense for such warnings to
4553 be given only for features not in the specified GNU C dialect,
4554 since by definition the GNU dialects of C include all features the
4555 compiler supports with the given option, and there would be nothing
4556 to warn about.)
4557
4558 -pedantic-errors
4559 Give an error whenever the base standard (see -Wpedantic) requires
4560 a diagnostic, in some cases where there is undefined behavior at
4561 compile-time and in some other cases that do not prevent
4562 compilation of programs that are valid according to the standard.
4563 This is not equivalent to -Werror=pedantic, since there are errors
4564 enabled by this option and not enabled by the latter and vice
4565 versa.
4566
4567 -Wall
4568 This enables all the warnings about constructions that some users
4569 consider questionable, and that are easy to avoid (or modify to
4570 prevent the warning), even in conjunction with macros. This also
4571 enables some language-specific warnings described in C++ Dialect
4572 Options and Objective-C and Objective-C++ Dialect Options.
4573
4574 -Wall turns on the following warning flags:
4575
4576 -Waddress -Warray-bounds=1 (only with -O2) -Warray-compare
4577 -Warray-parameter=2 (C and Objective-C only) -Wbool-compare
4578 -Wbool-operation -Wc++11-compat -Wc++14-compat -Wcatch-value (C++
4579 and Objective-C++ only) -Wchar-subscripts -Wcomment
4580 -Wdangling-pointer=2 -Wduplicate-decl-specifier (C and Objective-C
4581 only) -Wenum-compare (in C/ObjC; this is on by default in C++)
4582 -Wformat -Wformat-overflow -Wformat-truncation
4583 -Wint-in-bool-context -Wimplicit (C and Objective-C only)
4584 -Wimplicit-int (C and Objective-C only)
4585 -Wimplicit-function-declaration (C and Objective-C only)
4586 -Winit-self (only for C++) -Wlogical-not-parentheses -Wmain (only
4587 for C/ObjC and unless -ffreestanding) -Wmaybe-uninitialized
4588 -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation
4589 (only for C/C++) -Wmismatched-dealloc -Wmismatched-new-delete (only
4590 for C/C++) -Wmissing-attributes -Wmissing-braces (only for C/ObjC)
4591 -Wmultistatement-macros -Wnarrowing (only for C++) -Wnonnull
4592 -Wnonnull-compare -Wopenmp-simd -Wparentheses -Wpessimizing-move
4593 (only for C++) -Wpointer-sign -Wrange-loop-construct (only for C++)
4594 -Wreorder -Wrestrict -Wreturn-type -Wsequence-point -Wsign-compare
4595 (only in C++) -Wsizeof-array-div -Wsizeof-pointer-div
4596 -Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstrict-overflow=1
4597 -Wswitch -Wtautological-compare -Wtrigraphs -Wuninitialized
4598 -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value
4599 -Wunused-variable -Wuse-after-free=3 -Wvla-parameter (C and
4600 Objective-C only) -Wvolatile-register-var -Wzero-length-bounds
4601
4602 Note that some warning flags are not implied by -Wall. Some of
4603 them warn about constructions that users generally do not consider
4604 questionable, but which occasionally you might wish to check for;
4605 others warn about constructions that are necessary or hard to avoid
4606 in some cases, and there is no simple way to modify the code to
4607 suppress the warning. Some of them are enabled by -Wextra but many
4608 of them must be enabled individually.
4609
4610 -Wextra
4611 This enables some extra warning flags that are not enabled by
4612 -Wall. (This option used to be called -W. The older name is still
4613 supported, but the newer name is more descriptive.)
4614
4615 -Wclobbered -Wcast-function-type -Wdeprecated-copy (C++ only)
4616 -Wempty-body -Wenum-conversion (C only) -Wignored-qualifiers
4617 -Wimplicit-fallthrough=3 -Wmissing-field-initializers
4618 -Wmissing-parameter-type (C only) -Wold-style-declaration (C only)
4619 -Woverride-init -Wsign-compare (C only) -Wstring-compare
4620 -Wredundant-move (only for C++) -Wtype-limits -Wuninitialized
4621 -Wshift-negative-value (in C++11 to C++17 and in C99 and newer)
4622 -Wunused-parameter (only with -Wunused or -Wall)
4623 -Wunused-but-set-parameter (only with -Wunused or -Wall)
4624
4625 The option -Wextra also prints warning messages for the following
4626 cases:
4627
4628 * A pointer is compared against integer zero with "<", "<=", ">",
4629 or ">=".
4630
4631 * (C++ only) An enumerator and a non-enumerator both appear in a
4632 conditional expression.
4633
4634 * (C++ only) Ambiguous virtual bases.
4635
4636 * (C++ only) Subscripting an array that has been declared
4637 "register".
4638
4639 * (C++ only) Taking the address of a variable that has been
4640 declared "register".
4641
4642 * (C++ only) A base class is not initialized in the copy
4643 constructor of a derived class.
4644
4645 -Wabi (C, Objective-C, C++ and Objective-C++ only)
4646 Warn about code affected by ABI changes. This includes code that
4647 may not be compatible with the vendor-neutral C++ ABI as well as
4648 the psABI for the particular target.
4649
4650 Since G++ now defaults to updating the ABI with each major release,
4651 normally -Wabi warns only about C++ ABI compatibility problems if
4652 there is a check added later in a release series for an ABI issue
4653 discovered since the initial release. -Wabi warns about more
4654 things if an older ABI version is selected (with -fabi-version=n).
4655
4656 -Wabi can also be used with an explicit version number to warn
4657 about C++ ABI compatibility with a particular -fabi-version level,
4658 e.g. -Wabi=2 to warn about changes relative to -fabi-version=2.
4659
4660 If an explicit version number is provided and -fabi-compat-version
4661 is not specified, the version number from this option is used for
4662 compatibility aliases. If no explicit version number is provided
4663 with this option, but -fabi-compat-version is specified, that
4664 version number is used for C++ ABI warnings.
4665
4666 Although an effort has been made to warn about all such cases,
4667 there are probably some cases that are not warned about, even
4668 though G++ is generating incompatible code. There may also be
4669 cases where warnings are emitted even though the code that is
4670 generated is compatible.
4671
4672 You should rewrite your code to avoid these warnings if you are
4673 concerned about the fact that code generated by G++ may not be
4674 binary compatible with code generated by other compilers.
4675
4676 Known incompatibilities in -fabi-version=2 (which was the default
4677 from GCC 3.4 to 4.9) include:
4678
4679 * A template with a non-type template parameter of reference type
4680 was mangled incorrectly:
4681
4682 extern int N;
4683 template <int &> struct S {};
4684 void n (S<N>) {2}
4685
4686 This was fixed in -fabi-version=3.
4687
4688 * SIMD vector types declared using "__attribute ((vector_size))"
4689 were mangled in a non-standard way that does not allow for
4690 overloading of functions taking vectors of different sizes.
4691
4692 The mangling was changed in -fabi-version=4.
4693
4694 * "__attribute ((const))" and "noreturn" were mangled as type
4695 qualifiers, and "decltype" of a plain declaration was folded
4696 away.
4697
4698 These mangling issues were fixed in -fabi-version=5.
4699
4700 * Scoped enumerators passed as arguments to a variadic function
4701 are promoted like unscoped enumerators, causing "va_arg" to
4702 complain. On most targets this does not actually affect the
4703 parameter passing ABI, as there is no way to pass an argument
4704 smaller than "int".
4705
4706 Also, the ABI changed the mangling of template argument packs,
4707 "const_cast", "static_cast", prefix increment/decrement, and a
4708 class scope function used as a template argument.
4709
4710 These issues were corrected in -fabi-version=6.
4711
4712 * Lambdas in default argument scope were mangled incorrectly, and
4713 the ABI changed the mangling of "nullptr_t".
4714
4715 These issues were corrected in -fabi-version=7.
4716
4717 * When mangling a function type with function-cv-qualifiers, the
4718 un-qualified function type was incorrectly treated as a
4719 substitution candidate.
4720
4721 This was fixed in -fabi-version=8, the default for GCC 5.1.
4722
4723 * "decltype(nullptr)" incorrectly had an alignment of 1, leading
4724 to unaligned accesses. Note that this did not affect the ABI
4725 of a function with a "nullptr_t" parameter, as parameters have
4726 a minimum alignment.
4727
4728 This was fixed in -fabi-version=9, the default for GCC 5.2.
4729
4730 * Target-specific attributes that affect the identity of a type,
4731 such as ia32 calling conventions on a function type (stdcall,
4732 regparm, etc.), did not affect the mangled name, leading to
4733 name collisions when function pointers were used as template
4734 arguments.
4735
4736 This was fixed in -fabi-version=10, the default for GCC 6.1.
4737
4738 This option also enables warnings about psABI-related changes. The
4739 known psABI changes at this point include:
4740
4741 * For SysV/x86-64, unions with "long double" members are passed
4742 in memory as specified in psABI. Prior to GCC 4.4, this was
4743 not the case. For example:
4744
4745 union U {
4746 long double ld;
4747 int i;
4748 };
4749
4750 "union U" is now always passed in memory.
4751
4752 -Wchar-subscripts
4753 Warn if an array subscript has type "char". This is a common cause
4754 of error, as programmers often forget that this type is signed on
4755 some machines. This warning is enabled by -Wall.
4756
4757 -Wno-coverage-mismatch
4758 Warn if feedback profiles do not match when using the -fprofile-use
4759 option. If a source file is changed between compiling with
4760 -fprofile-generate and with -fprofile-use, the files with the
4761 profile feedback can fail to match the source file and GCC cannot
4762 use the profile feedback information. By default, this warning is
4763 enabled and is treated as an error. -Wno-coverage-mismatch can be
4764 used to disable the warning or -Wno-error=coverage-mismatch can be
4765 used to disable the error. Disabling the error for this warning
4766 can result in poorly optimized code and is useful only in the case
4767 of very minor changes such as bug fixes to an existing code-base.
4768 Completely disabling the warning is not recommended.
4769
4770 -Wno-coverage-invalid-line-number
4771 Warn in case a function ends earlier than it begins due to an
4772 invalid linenum macros. The warning is emitted only with
4773 --coverage enabled.
4774
4775 By default, this warning is enabled and is treated as an error.
4776 -Wno-coverage-invalid-line-number can be used to disable the
4777 warning or -Wno-error=coverage-invalid-line-number can be used to
4778 disable the error.
4779
4780 -Wno-cpp (C, Objective-C, C++, Objective-C++ and Fortran only)
4781 Suppress warning messages emitted by "#warning" directives.
4782
4783 -Wdouble-promotion (C, C++, Objective-C and Objective-C++ only)
4784 Give a warning when a value of type "float" is implicitly promoted
4785 to "double". CPUs with a 32-bit "single-precision" floating-point
4786 unit implement "float" in hardware, but emulate "double" in
4787 software. On such a machine, doing computations using "double"
4788 values is much more expensive because of the overhead required for
4789 software emulation.
4790
4791 It is easy to accidentally do computations with "double" because
4792 floating-point literals are implicitly of type "double". For
4793 example, in:
4794
4795 float area(float radius)
4796 {
4797 return 3.14159 * radius * radius;
4798 }
4799
4800 the compiler performs the entire computation with "double" because
4801 the floating-point literal is a "double".
4802
4803 -Wduplicate-decl-specifier (C and Objective-C only)
4804 Warn if a declaration has duplicate "const", "volatile", "restrict"
4805 or "_Atomic" specifier. This warning is enabled by -Wall.
4806
4807 -Wformat
4808 -Wformat=n
4809 Check calls to "printf" and "scanf", etc., to make sure that the
4810 arguments supplied have types appropriate to the format string
4811 specified, and that the conversions specified in the format string
4812 make sense. This includes standard functions, and others specified
4813 by format attributes, in the "printf", "scanf", "strftime" and
4814 "strfmon" (an X/Open extension, not in the C standard) families (or
4815 other target-specific families). Which functions are checked
4816 without format attributes having been specified depends on the
4817 standard version selected, and such checks of functions without the
4818 attribute specified are disabled by -ffreestanding or -fno-builtin.
4819
4820 The formats are checked against the format features supported by
4821 GNU libc version 2.2. These include all ISO C90 and C99 features,
4822 as well as features from the Single Unix Specification and some BSD
4823 and GNU extensions. Other library implementations may not support
4824 all these features; GCC does not support warning about features
4825 that go beyond a particular library's limitations. However, if
4826 -Wpedantic is used with -Wformat, warnings are given about format
4827 features not in the selected standard version (but not for
4828 "strfmon" formats, since those are not in any version of the C
4829 standard).
4830
4831 -Wformat=1
4832 -Wformat
4833 Option -Wformat is equivalent to -Wformat=1, and -Wno-format is
4834 equivalent to -Wformat=0. Since -Wformat also checks for null
4835 format arguments for several functions, -Wformat also implies
4836 -Wnonnull. Some aspects of this level of format checking can
4837 be disabled by the options: -Wno-format-contains-nul,
4838 -Wno-format-extra-args, and -Wno-format-zero-length. -Wformat
4839 is enabled by -Wall.
4840
4841 -Wformat=2
4842 Enable -Wformat plus additional format checks. Currently
4843 equivalent to -Wformat -Wformat-nonliteral -Wformat-security
4844 -Wformat-y2k.
4845
4846 -Wno-format-contains-nul
4847 If -Wformat is specified, do not warn about format strings that
4848 contain NUL bytes.
4849
4850 -Wno-format-extra-args
4851 If -Wformat is specified, do not warn about excess arguments to a
4852 "printf" or "scanf" format function. The C standard specifies that
4853 such arguments are ignored.
4854
4855 Where the unused arguments lie between used arguments that are
4856 specified with $ operand number specifications, normally warnings
4857 are still given, since the implementation could not know what type
4858 to pass to "va_arg" to skip the unused arguments. However, in the
4859 case of "scanf" formats, this option suppresses the warning if the
4860 unused arguments are all pointers, since the Single Unix
4861 Specification says that such unused arguments are allowed.
4862
4863 -Wformat-overflow
4864 -Wformat-overflow=level
4865 Warn about calls to formatted input/output functions such as
4866 "sprintf" and "vsprintf" that might overflow the destination
4867 buffer. When the exact number of bytes written by a format
4868 directive cannot be determined at compile-time it is estimated
4869 based on heuristics that depend on the level argument and on
4870 optimization. While enabling optimization will in most cases
4871 improve the accuracy of the warning, it may also result in false
4872 positives.
4873
4874 -Wformat-overflow
4875 -Wformat-overflow=1
4876 Level 1 of -Wformat-overflow enabled by -Wformat employs a
4877 conservative approach that warns only about calls that most
4878 likely overflow the buffer. At this level, numeric arguments
4879 to format directives with unknown values are assumed to have
4880 the value of one, and strings of unknown length to be empty.
4881 Numeric arguments that are known to be bounded to a subrange of
4882 their type, or string arguments whose output is bounded either
4883 by their directive's precision or by a finite set of string
4884 literals, are assumed to take on the value within the range
4885 that results in the most bytes on output. For example, the
4886 call to "sprintf" below is diagnosed because even with both a
4887 and b equal to zero, the terminating NUL character ('\0')
4888 appended by the function to the destination buffer will be
4889 written past its end. Increasing the size of the buffer by a
4890 single byte is sufficient to avoid the warning, though it may
4891 not be sufficient to avoid the overflow.
4892
4893 void f (int a, int b)
4894 {
4895 char buf [13];
4896 sprintf (buf, "a = %i, b = %i\n", a, b);
4897 }
4898
4899 -Wformat-overflow=2
4900 Level 2 warns also about calls that might overflow the
4901 destination buffer given an argument of sufficient length or
4902 magnitude. At level 2, unknown numeric arguments are assumed
4903 to have the minimum representable value for signed types with a
4904 precision greater than 1, and the maximum representable value
4905 otherwise. Unknown string arguments whose length cannot be
4906 assumed to be bounded either by the directive's precision, or
4907 by a finite set of string literals they may evaluate to, or the
4908 character array they may point to, are assumed to be 1
4909 character long.
4910
4911 At level 2, the call in the example above is again diagnosed,
4912 but this time because with a equal to a 32-bit "INT_MIN" the
4913 first %i directive will write some of its digits beyond the end
4914 of the destination buffer. To make the call safe regardless of
4915 the values of the two variables, the size of the destination
4916 buffer must be increased to at least 34 bytes. GCC includes
4917 the minimum size of the buffer in an informational note
4918 following the warning.
4919
4920 An alternative to increasing the size of the destination buffer
4921 is to constrain the range of formatted values. The maximum
4922 length of string arguments can be bounded by specifying the
4923 precision in the format directive. When numeric arguments of
4924 format directives can be assumed to be bounded by less than the
4925 precision of their type, choosing an appropriate length
4926 modifier to the format specifier will reduce the required
4927 buffer size. For example, if a and b in the example above can
4928 be assumed to be within the precision of the "short int" type
4929 then using either the %hi format directive or casting the
4930 argument to "short" reduces the maximum required size of the
4931 buffer to 24 bytes.
4932
4933 void f (int a, int b)
4934 {
4935 char buf [23];
4936 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4937 }
4938
4939 -Wno-format-zero-length
4940 If -Wformat is specified, do not warn about zero-length formats.
4941 The C standard specifies that zero-length formats are allowed.
4942
4943 -Wformat-nonliteral
4944 If -Wformat is specified, also warn if the format string is not a
4945 string literal and so cannot be checked, unless the format function
4946 takes its format arguments as a "va_list".
4947
4948 -Wformat-security
4949 If -Wformat is specified, also warn about uses of format functions
4950 that represent possible security problems. At present, this warns
4951 about calls to "printf" and "scanf" functions where the format
4952 string is not a string literal and there are no format arguments,
4953 as in "printf (foo);". This may be a security hole if the format
4954 string came from untrusted input and contains %n. (This is
4955 currently a subset of what -Wformat-nonliteral warns about, but in
4956 future warnings may be added to -Wformat-security that are not
4957 included in -Wformat-nonliteral.)
4958
4959 -Wformat-signedness
4960 If -Wformat is specified, also warn if the format string requires
4961 an unsigned argument and the argument is signed and vice versa.
4962
4963 -Wformat-truncation
4964 -Wformat-truncation=level
4965 Warn about calls to formatted input/output functions such as
4966 "snprintf" and "vsnprintf" that might result in output truncation.
4967 When the exact number of bytes written by a format directive cannot
4968 be determined at compile-time it is estimated based on heuristics
4969 that depend on the level argument and on optimization. While
4970 enabling optimization will in most cases improve the accuracy of
4971 the warning, it may also result in false positives. Except as
4972 noted otherwise, the option uses the same logic -Wformat-overflow.
4973
4974 -Wformat-truncation
4975 -Wformat-truncation=1
4976 Level 1 of -Wformat-truncation enabled by -Wformat employs a
4977 conservative approach that warns only about calls to bounded
4978 functions whose return value is unused and that will most
4979 likely result in output truncation.
4980
4981 -Wformat-truncation=2
4982 Level 2 warns also about calls to bounded functions whose
4983 return value is used and that might result in truncation given
4984 an argument of sufficient length or magnitude.
4985
4986 -Wformat-y2k
4987 If -Wformat is specified, also warn about "strftime" formats that
4988 may yield only a two-digit year.
4989
4990 -Wnonnull
4991 Warn about passing a null pointer for arguments marked as requiring
4992 a non-null value by the "nonnull" function attribute.
4993
4994 -Wnonnull is included in -Wall and -Wformat. It can be disabled
4995 with the -Wno-nonnull option.
4996
4997 -Wnonnull-compare
4998 Warn when comparing an argument marked with the "nonnull" function
4999 attribute against null inside the function.
5000
5001 -Wnonnull-compare is included in -Wall. It can be disabled with
5002 the -Wno-nonnull-compare option.
5003
5004 -Wnull-dereference
5005 Warn if the compiler detects paths that trigger erroneous or
5006 undefined behavior due to dereferencing a null pointer. This
5007 option is only active when -fdelete-null-pointer-checks is active,
5008 which is enabled by optimizations in most targets. The precision
5009 of the warnings depends on the optimization options used.
5010
5011 -Winfinite-recursion
5012 Warn about infinitely recursive calls. The warning is effective at
5013 all optimization levels but requires optimization in order to
5014 detect infinite recursion in calls between two or more functions.
5015 -Winfinite-recursion is included in -Wall.
5016
5017 -Winit-self (C, C++, Objective-C and Objective-C++ only)
5018 Warn about uninitialized variables that are initialized with
5019 themselves. Note this option can only be used with the
5020 -Wuninitialized option.
5021
5022 For example, GCC warns about "i" being uninitialized in the
5023 following snippet only when -Winit-self has been specified:
5024
5025 int f()
5026 {
5027 int i = i;
5028 return i;
5029 }
5030
5031 This warning is enabled by -Wall in C++.
5032
5033 -Wno-implicit-int (C and Objective-C only)
5034 This option controls warnings when a declaration does not specify a
5035 type. This warning is enabled by default in C99 and later dialects
5036 of C, and also by -Wall.
5037
5038 -Wno-implicit-function-declaration (C and Objective-C only)
5039 This option controls warnings when a function is used before being
5040 declared. This warning is enabled by default in C99 and later
5041 dialects of C, and also by -Wall. The warning is made into an
5042 error by -pedantic-errors.
5043
5044 -Wimplicit (C and Objective-C only)
5045 Same as -Wimplicit-int and -Wimplicit-function-declaration. This
5046 warning is enabled by -Wall.
5047
5048 -Wimplicit-fallthrough
5049 -Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3 and
5050 -Wno-implicit-fallthrough is the same as -Wimplicit-fallthrough=0.
5051
5052 -Wimplicit-fallthrough=n
5053 Warn when a switch case falls through. For example:
5054
5055 switch (cond)
5056 {
5057 case 1:
5058 a = 1;
5059 break;
5060 case 2:
5061 a = 2;
5062 case 3:
5063 a = 3;
5064 break;
5065 }
5066
5067 This warning does not warn when the last statement of a case cannot
5068 fall through, e.g. when there is a return statement or a call to
5069 function declared with the noreturn attribute.
5070 -Wimplicit-fallthrough= also takes into account control flow
5071 statements, such as ifs, and only warns when appropriate. E.g.
5072
5073 switch (cond)
5074 {
5075 case 1:
5076 if (i > 3) {
5077 bar (5);
5078 break;
5079 } else if (i < 1) {
5080 bar (0);
5081 } else
5082 return;
5083 default:
5084 ...
5085 }
5086
5087 Since there are occasions where a switch case fall through is
5088 desirable, GCC provides an attribute, "__attribute__
5089 ((fallthrough))", that is to be used along with a null statement to
5090 suppress this warning that would normally occur:
5091
5092 switch (cond)
5093 {
5094 case 1:
5095 bar (0);
5096 __attribute__ ((fallthrough));
5097 default:
5098 ...
5099 }
5100
5101 C++17 provides a standard way to suppress the
5102 -Wimplicit-fallthrough warning using "[[fallthrough]];" instead of
5103 the GNU attribute. In C++11 or C++14 users can use
5104 "[[gnu::fallthrough]];", which is a GNU extension. Instead of
5105 these attributes, it is also possible to add a fallthrough comment
5106 to silence the warning. The whole body of the C or C++ style
5107 comment should match the given regular expressions listed below.
5108 The option argument n specifies what kind of comments are accepted:
5109
5110 *<-Wimplicit-fallthrough=0 disables the warning altogether.>
5111 *<-Wimplicit-fallthrough=1 matches ".*" regular>
5112 expression, any comment is used as fallthrough comment.
5113
5114 *<-Wimplicit-fallthrough=2 case insensitively matches>
5115 ".*falls?[ \t-]*thr(ough|u).*" regular expression.
5116
5117 *<-Wimplicit-fallthrough=3 case sensitively matches one of the>
5118 following regular expressions:
5119
5120 *<"-fallthrough">
5121 *<"@fallthrough@">
5122 *<"lint -fallthrough[ \t]*">
5123 *<"[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?FALL(S |
5124 |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?">
5125 *<"[ \t.!]*(Else,? |Intentional(ly)? )?Fall((s |
5126 |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?">
5127 *<"[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?fall(s |
5128 |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?">
5129 *<-Wimplicit-fallthrough=4 case sensitively matches one of the>
5130 following regular expressions:
5131
5132 *<"-fallthrough">
5133 *<"@fallthrough@">
5134 *<"lint -fallthrough[ \t]*">
5135 *<"[ \t]*FALLTHR(OUGH|U)[ \t]*">
5136 *<-Wimplicit-fallthrough=5 doesn't recognize any comments as>
5137 fallthrough comments, only attributes disable the warning.
5138
5139 The comment needs to be followed after optional whitespace and
5140 other comments by "case" or "default" keywords or by a user label
5141 that precedes some "case" or "default" label.
5142
5143 switch (cond)
5144 {
5145 case 1:
5146 bar (0);
5147 /* FALLTHRU */
5148 default:
5149 ...
5150 }
5151
5152 The -Wimplicit-fallthrough=3 warning is enabled by -Wextra.
5153
5154 -Wno-if-not-aligned (C, C++, Objective-C and Objective-C++ only)
5155 Control if warnings triggered by the "warn_if_not_aligned"
5156 attribute should be issued. These warnings are enabled by default.
5157
5158 -Wignored-qualifiers (C and C++ only)
5159 Warn if the return type of a function has a type qualifier such as
5160 "const". For ISO C such a type qualifier has no effect, since the
5161 value returned by a function is not an lvalue. For C++, the
5162 warning is only emitted for scalar types or "void". ISO C
5163 prohibits qualified "void" return types on function definitions, so
5164 such return types always receive a warning even without this
5165 option.
5166
5167 This warning is also enabled by -Wextra.
5168
5169 -Wno-ignored-attributes (C and C++ only)
5170 This option controls warnings when an attribute is ignored. This
5171 is different from the -Wattributes option in that it warns whenever
5172 the compiler decides to drop an attribute, not that the attribute
5173 is either unknown, used in a wrong place, etc. This warning is
5174 enabled by default.
5175
5176 -Wmain
5177 Warn if the type of "main" is suspicious. "main" should be a
5178 function with external linkage, returning int, taking either zero
5179 arguments, two, or three arguments of appropriate types. This
5180 warning is enabled by default in C++ and is enabled by either -Wall
5181 or -Wpedantic.
5182
5183 -Wmisleading-indentation (C and C++ only)
5184 Warn when the indentation of the code does not reflect the block
5185 structure. Specifically, a warning is issued for "if", "else",
5186 "while", and "for" clauses with a guarded statement that does not
5187 use braces, followed by an unguarded statement with the same
5188 indentation.
5189
5190 In the following example, the call to "bar" is misleadingly
5191 indented as if it were guarded by the "if" conditional.
5192
5193 if (some_condition ())
5194 foo ();
5195 bar (); /* Gotcha: this is not guarded by the "if". */
5196
5197 In the case of mixed tabs and spaces, the warning uses the
5198 -ftabstop= option to determine if the statements line up
5199 (defaulting to 8).
5200
5201 The warning is not issued for code involving multiline preprocessor
5202 logic such as the following example.
5203
5204 if (flagA)
5205 foo (0);
5206 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5207 if (flagB)
5208 #endif
5209 foo (1);
5210
5211 The warning is not issued after a "#line" directive, since this
5212 typically indicates autogenerated code, and no assumptions can be
5213 made about the layout of the file that the directive references.
5214
5215 This warning is enabled by -Wall in C and C++.
5216
5217 -Wmissing-attributes
5218 Warn when a declaration of a function is missing one or more
5219 attributes that a related function is declared with and whose
5220 absence may adversely affect the correctness or efficiency of
5221 generated code. For example, the warning is issued for
5222 declarations of aliases that use attributes to specify less
5223 restrictive requirements than those of their targets. This
5224 typically represents a potential optimization opportunity. By
5225 contrast, the -Wattribute-alias=2 option controls warnings issued
5226 when the alias is more restrictive than the target, which could
5227 lead to incorrect code generation. Attributes considered include
5228 "alloc_align", "alloc_size", "cold", "const", "hot", "leaf",
5229 "malloc", "nonnull", "noreturn", "nothrow", "pure",
5230 "returns_nonnull", and "returns_twice".
5231
5232 In C++, the warning is issued when an explicit specialization of a
5233 primary template declared with attribute "alloc_align",
5234 "alloc_size", "assume_aligned", "format", "format_arg", "malloc",
5235 or "nonnull" is declared without it. Attributes "deprecated",
5236 "error", and "warning" suppress the warning..
5237
5238 You can use the "copy" attribute to apply the same set of
5239 attributes to a declaration as that on another declaration without
5240 explicitly enumerating the attributes. This attribute can be
5241 applied to declarations of functions, variables, or types.
5242
5243 -Wmissing-attributes is enabled by -Wall.
5244
5245 For example, since the declaration of the primary function template
5246 below makes use of both attribute "malloc" and "alloc_size" the
5247 declaration of the explicit specialization of the template is
5248 diagnosed because it is missing one of the attributes.
5249
5250 template <class T>
5251 T* __attribute__ ((malloc, alloc_size (1)))
5252 allocate (size_t);
5253
5254 template <>
5255 void* __attribute__ ((malloc)) // missing alloc_size
5256 allocate<void> (size_t);
5257
5258 -Wmissing-braces
5259 Warn if an aggregate or union initializer is not fully bracketed.
5260 In the following example, the initializer for "a" is not fully
5261 bracketed, but that for "b" is fully bracketed.
5262
5263 int a[2][2] = { 0, 1, 2, 3 };
5264 int b[2][2] = { { 0, 1 }, { 2, 3 } };
5265
5266 This warning is enabled by -Wall.
5267
5268 -Wmissing-include-dirs (C, C++, Objective-C, Objective-C++ and Fortran
5269 only)
5270 Warn if a user-supplied include directory does not exist. This
5271 opions is disabled by default for C, C++, Objective-C and
5272 Objective-C++. For Fortran, it is partially enabled by default by
5273 warning for -I and -J, only.
5274
5275 -Wno-missing-profile
5276 This option controls warnings if feedback profiles are missing when
5277 using the -fprofile-use option. This option diagnoses those cases
5278 where a new function or a new file is added between compiling with
5279 -fprofile-generate and with -fprofile-use, without regenerating the
5280 profiles. In these cases, the profile feedback data files do not
5281 contain any profile feedback information for the newly added
5282 function or file respectively. Also, in the case when profile
5283 count data (.gcda) files are removed, GCC cannot use any profile
5284 feedback information. In all these cases, warnings are issued to
5285 inform you that a profile generation step is due. Ignoring the
5286 warning can result in poorly optimized code. -Wno-missing-profile
5287 can be used to disable the warning, but this is not recommended and
5288 should be done only when non-existent profile data is justified.
5289
5290 -Wmismatched-dealloc
5291 Warn for calls to deallocation functions with pointer arguments
5292 returned from from allocations functions for which the former isn't
5293 a suitable deallocator. A pair of functions can be associated as
5294 matching allocators and deallocators by use of attribute "malloc".
5295 Unless disabled by the -fno-builtin option the standard functions
5296 "calloc", "malloc", "realloc", and "free", as well as the
5297 corresponding forms of C++ "operator new" and "operator delete" are
5298 implicitly associated as matching allocators and deallocators. In
5299 the following example "mydealloc" is the deallocator for pointers
5300 returned from "myalloc".
5301
5302 void mydealloc (void*);
5303
5304 __attribute__ ((malloc (mydealloc, 1))) void*
5305 myalloc (size_t);
5306
5307 void f (void)
5308 {
5309 void *p = myalloc (32);
5310 // ...use p...
5311 free (p); // warning: not a matching deallocator for myalloc
5312 mydealloc (p); // ok
5313 }
5314
5315 In C++, the related option -Wmismatched-new-delete diagnoses
5316 mismatches involving either "operator new" or "operator delete".
5317
5318 Option -Wmismatched-dealloc is included in -Wall.
5319
5320 -Wmultistatement-macros
5321 Warn about unsafe multiple statement macros that appear to be
5322 guarded by a clause such as "if", "else", "for", "switch", or
5323 "while", in which only the first statement is actually guarded
5324 after the macro is expanded.
5325
5326 For example:
5327
5328 #define DOIT x++; y++
5329 if (c)
5330 DOIT;
5331
5332 will increment "y" unconditionally, not just when "c" holds. The
5333 can usually be fixed by wrapping the macro in a do-while loop:
5334
5335 #define DOIT do { x++; y++; } while (0)
5336 if (c)
5337 DOIT;
5338
5339 This warning is enabled by -Wall in C and C++.
5340
5341 -Wparentheses
5342 Warn if parentheses are omitted in certain contexts, such as when
5343 there is an assignment in a context where a truth value is
5344 expected, or when operators are nested whose precedence people
5345 often get confused about.
5346
5347 Also warn if a comparison like "x<=y<=z" appears; this is
5348 equivalent to "(x<=y ? 1 : 0) <= z", which is a different
5349 interpretation from that of ordinary mathematical notation.
5350
5351 Also warn for dangerous uses of the GNU extension to "?:" with
5352 omitted middle operand. When the condition in the "?": operator is
5353 a boolean expression, the omitted value is always 1. Often
5354 programmers expect it to be a value computed inside the conditional
5355 expression instead.
5356
5357 For C++ this also warns for some cases of unnecessary parentheses
5358 in declarations, which can indicate an attempt at a function call
5359 instead of a declaration:
5360
5361 {
5362 // Declares a local variable called mymutex.
5363 std::unique_lock<std::mutex> (mymutex);
5364 // User meant std::unique_lock<std::mutex> lock (mymutex);
5365 }
5366
5367 This warning is enabled by -Wall.
5368
5369 -Wsequence-point
5370 Warn about code that may have undefined semantics because of
5371 violations of sequence point rules in the C and C++ standards.
5372
5373 The C and C++ standards define the order in which expressions in a
5374 C/C++ program are evaluated in terms of sequence points, which
5375 represent a partial ordering between the execution of parts of the
5376 program: those executed before the sequence point, and those
5377 executed after it. These occur after the evaluation of a full
5378 expression (one which is not part of a larger expression), after
5379 the evaluation of the first operand of a "&&", "||", "? :" or ","
5380 (comma) operator, before a function is called (but after the
5381 evaluation of its arguments and the expression denoting the called
5382 function), and in certain other places. Other than as expressed by
5383 the sequence point rules, the order of evaluation of subexpressions
5384 of an expression is not specified. All these rules describe only a
5385 partial order rather than a total order, since, for example, if two
5386 functions are called within one expression with no sequence point
5387 between them, the order in which the functions are called is not
5388 specified. However, the standards committee have ruled that
5389 function calls do not overlap.
5390
5391 It is not specified when between sequence points modifications to
5392 the values of objects take effect. Programs whose behavior depends
5393 on this have undefined behavior; the C and C++ standards specify
5394 that "Between the previous and next sequence point an object shall
5395 have its stored value modified at most once by the evaluation of an
5396 expression. Furthermore, the prior value shall be read only to
5397 determine the value to be stored.". If a program breaks these
5398 rules, the results on any particular implementation are entirely
5399 unpredictable.
5400
5401 Examples of code with undefined behavior are "a = a++;", "a[n] =
5402 b[n++]" and "a[i++] = i;". Some more complicated cases are not
5403 diagnosed by this option, and it may give an occasional false
5404 positive result, but in general it has been found fairly effective
5405 at detecting this sort of problem in programs.
5406
5407 The C++17 standard will define the order of evaluation of operands
5408 in more cases: in particular it requires that the right-hand side
5409 of an assignment be evaluated before the left-hand side, so the
5410 above examples are no longer undefined. But this option will still
5411 warn about them, to help people avoid writing code that is
5412 undefined in C and earlier revisions of C++.
5413
5414 The standard is worded confusingly, therefore there is some debate
5415 over the precise meaning of the sequence point rules in subtle
5416 cases. Links to discussions of the problem, including proposed
5417 formal definitions, may be found on the GCC readings page, at
5418 <https://gcc.gnu.org/readings.html>.
5419
5420 This warning is enabled by -Wall for C and C++.
5421
5422 -Wno-return-local-addr
5423 Do not warn about returning a pointer (or in C++, a reference) to a
5424 variable that goes out of scope after the function returns.
5425
5426 -Wreturn-type
5427 Warn whenever a function is defined with a return type that
5428 defaults to "int". Also warn about any "return" statement with no
5429 return value in a function whose return type is not "void" (falling
5430 off the end of the function body is considered returning without a
5431 value).
5432
5433 For C only, warn about a "return" statement with an expression in a
5434 function whose return type is "void", unless the expression type is
5435 also "void". As a GNU extension, the latter case is accepted
5436 without a warning unless -Wpedantic is used. Attempting to use the
5437 return value of a non-"void" function other than "main" that flows
5438 off the end by reaching the closing curly brace that terminates the
5439 function is undefined.
5440
5441 Unlike in C, in C++, flowing off the end of a non-"void" function
5442 other than "main" results in undefined behavior even when the value
5443 of the function is not used.
5444
5445 This warning is enabled by default in C++ and by -Wall otherwise.
5446
5447 -Wno-shift-count-negative
5448 Controls warnings if a shift count is negative. This warning is
5449 enabled by default.
5450
5451 -Wno-shift-count-overflow
5452 Controls warnings if a shift count is greater than or equal to the
5453 bit width of the type. This warning is enabled by default.
5454
5455 -Wshift-negative-value
5456 Warn if left shifting a negative value. This warning is enabled by
5457 -Wextra in C99 (and newer) and C++11 to C++17 modes.
5458
5459 -Wno-shift-overflow
5460 -Wshift-overflow=n
5461 These options control warnings about left shift overflows.
5462
5463 -Wshift-overflow=1
5464 This is the warning level of -Wshift-overflow and is enabled by
5465 default in C99 and C++11 modes (and newer). This warning level
5466 does not warn about left-shifting 1 into the sign bit.
5467 (However, in C, such an overflow is still rejected in contexts
5468 where an integer constant expression is required.) No warning
5469 is emitted in C++20 mode (and newer), as signed left shifts
5470 always wrap.
5471
5472 -Wshift-overflow=2
5473 This warning level also warns about left-shifting 1 into the
5474 sign bit, unless C++14 mode (or newer) is active.
5475
5476 -Wswitch
5477 Warn whenever a "switch" statement has an index of enumerated type
5478 and lacks a "case" for one or more of the named codes of that
5479 enumeration. (The presence of a "default" label prevents this
5480 warning.) "case" labels outside the enumeration range also provoke
5481 warnings when this option is used (even if there is a "default"
5482 label). This warning is enabled by -Wall.
5483
5484 -Wswitch-default
5485 Warn whenever a "switch" statement does not have a "default" case.
5486
5487 -Wswitch-enum
5488 Warn whenever a "switch" statement has an index of enumerated type
5489 and lacks a "case" for one or more of the named codes of that
5490 enumeration. "case" labels outside the enumeration range also
5491 provoke warnings when this option is used. The only difference
5492 between -Wswitch and this option is that this option gives a
5493 warning about an omitted enumeration code even if there is a
5494 "default" label.
5495
5496 -Wno-switch-bool
5497 Do not warn when a "switch" statement has an index of boolean type
5498 and the case values are outside the range of a boolean type. It is
5499 possible to suppress this warning by casting the controlling
5500 expression to a type other than "bool". For example:
5501
5502 switch ((int) (a == 4))
5503 {
5504 ...
5505 }
5506
5507 This warning is enabled by default for C and C++ programs.
5508
5509 -Wno-switch-outside-range
5510 This option controls warnings when a "switch" case has a value that
5511 is outside of its respective type range. This warning is enabled
5512 by default for C and C++ programs.
5513
5514 -Wno-switch-unreachable
5515 Do not warn when a "switch" statement contains statements between
5516 the controlling expression and the first case label, which will
5517 never be executed. For example:
5518
5519 switch (cond)
5520 {
5521 i = 15;
5522 ...
5523 case 5:
5524 ...
5525 }
5526
5527 -Wswitch-unreachable does not warn if the statement between the
5528 controlling expression and the first case label is just a
5529 declaration:
5530
5531 switch (cond)
5532 {
5533 int i;
5534 ...
5535 case 5:
5536 i = 5;
5537 ...
5538 }
5539
5540 This warning is enabled by default for C and C++ programs.
5541
5542 -Wsync-nand (C and C++ only)
5543 Warn when "__sync_fetch_and_nand" and "__sync_nand_and_fetch"
5544 built-in functions are used. These functions changed semantics in
5545 GCC 4.4.
5546
5547 -Wtrivial-auto-var-init
5548 Warn when "-ftrivial-auto-var-init" cannot initialize the automatic
5549 variable. A common situation is an automatic variable that is
5550 declared between the controlling expression and the first case
5551 label of a "switch" statement.
5552
5553 -Wunused-but-set-parameter
5554 Warn whenever a function parameter is assigned to, but otherwise
5555 unused (aside from its declaration).
5556
5557 To suppress this warning use the "unused" attribute.
5558
5559 This warning is also enabled by -Wunused together with -Wextra.
5560
5561 -Wunused-but-set-variable
5562 Warn whenever a local variable is assigned to, but otherwise unused
5563 (aside from its declaration). This warning is enabled by -Wall.
5564
5565 To suppress this warning use the "unused" attribute.
5566
5567 This warning is also enabled by -Wunused, which is enabled by
5568 -Wall.
5569
5570 -Wunused-function
5571 Warn whenever a static function is declared but not defined or a
5572 non-inline static function is unused. This warning is enabled by
5573 -Wall.
5574
5575 -Wunused-label
5576 Warn whenever a label is declared but not used. This warning is
5577 enabled by -Wall.
5578
5579 To suppress this warning use the "unused" attribute.
5580
5581 -Wunused-local-typedefs (C, Objective-C, C++ and Objective-C++ only)
5582 Warn when a typedef locally defined in a function is not used.
5583 This warning is enabled by -Wall.
5584
5585 -Wunused-parameter
5586 Warn whenever a function parameter is unused aside from its
5587 declaration.
5588
5589 To suppress this warning use the "unused" attribute.
5590
5591 -Wno-unused-result
5592 Do not warn if a caller of a function marked with attribute
5593 "warn_unused_result" does not use its return value. The default is
5594 -Wunused-result.
5595
5596 -Wunused-variable
5597 Warn whenever a local or static variable is unused aside from its
5598 declaration. This option implies -Wunused-const-variable=1 for C,
5599 but not for C++. This warning is enabled by -Wall.
5600
5601 To suppress this warning use the "unused" attribute.
5602
5603 -Wunused-const-variable
5604 -Wunused-const-variable=n
5605 Warn whenever a constant static variable is unused aside from its
5606 declaration. -Wunused-const-variable=1 is enabled by
5607 -Wunused-variable for C, but not for C++. In C this declares
5608 variable storage, but in C++ this is not an error since const
5609 variables take the place of "#define"s.
5610
5611 To suppress this warning use the "unused" attribute.
5612
5613 -Wunused-const-variable=1
5614 This is the warning level that is enabled by -Wunused-variable
5615 for C. It warns only about unused static const variables
5616 defined in the main compilation unit, but not about static
5617 const variables declared in any header included.
5618
5619 -Wunused-const-variable=2
5620 This warning level also warns for unused constant static
5621 variables in headers (excluding system headers). This is the
5622 warning level of -Wunused-const-variable and must be explicitly
5623 requested since in C++ this isn't an error and in C it might be
5624 harder to clean up all headers included.
5625
5626 -Wunused-value
5627 Warn whenever a statement computes a result that is explicitly not
5628 used. To suppress this warning cast the unused expression to
5629 "void". This includes an expression-statement or the left-hand side
5630 of a comma expression that contains no side effects. For example,
5631 an expression such as "x[i,j]" causes a warning, while
5632 "x[(void)i,j]" does not.
5633
5634 This warning is enabled by -Wall.
5635
5636 -Wunused
5637 All the above -Wunused options combined.
5638
5639 In order to get a warning about an unused function parameter, you
5640 must either specify -Wextra -Wunused (note that -Wall implies
5641 -Wunused), or separately specify -Wunused-parameter.
5642
5643 -Wuninitialized
5644 Warn if an object with automatic or allocated storage duration is
5645 used without having been initialized. In C++, also warn if a non-
5646 static reference or non-static "const" member appears in a class
5647 without constructors.
5648
5649 In addition, passing a pointer (or in C++, a reference) to an
5650 uninitialized object to a "const"-qualified argument of a built-in
5651 function known to read the object is also diagnosed by this
5652 warning. (-Wmaybe-uninitialized is issued for ordinary functions.)
5653
5654 If you want to warn about code that uses the uninitialized value of
5655 the variable in its own initializer, use the -Winit-self option.
5656
5657 These warnings occur for individual uninitialized elements of
5658 structure, union or array variables as well as for variables that
5659 are uninitialized as a whole. They do not occur for variables or
5660 elements declared "volatile". Because these warnings depend on
5661 optimization, the exact variables or elements for which there are
5662 warnings depend on the precise optimization options and version of
5663 GCC used.
5664
5665 Note that there may be no warning about a variable that is used
5666 only to compute a value that itself is never used, because such
5667 computations may be deleted by data flow analysis before the
5668 warnings are printed.
5669
5670 In C++, this warning also warns about using uninitialized objects
5671 in member-initializer-lists. For example, GCC warns about "b"
5672 being uninitialized in the following snippet:
5673
5674 struct A {
5675 int a;
5676 int b;
5677 A() : a(b) { }
5678 };
5679
5680 -Wno-invalid-memory-model
5681 This option controls warnings for invocations of __atomic Builtins,
5682 __sync Builtins, and the C11 atomic generic functions with a memory
5683 consistency argument that is either invalid for the operation or
5684 outside the range of values of the "memory_order" enumeration. For
5685 example, since the "__atomic_store" and "__atomic_store_n" built-
5686 ins are only defined for the relaxed, release, and sequentially
5687 consistent memory orders the following code is diagnosed:
5688
5689 void store (int *i)
5690 {
5691 __atomic_store_n (i, 0, memory_order_consume);
5692 }
5693
5694 -Winvalid-memory-model is enabled by default.
5695
5696 -Wmaybe-uninitialized
5697 For an object with automatic or allocated storage duration, if
5698 there exists a path from the function entry to a use of the object
5699 that is initialized, but there exist some other paths for which the
5700 object is not initialized, the compiler emits a warning if it
5701 cannot prove the uninitialized paths are not executed at run time.
5702
5703 In addition, passing a pointer (or in C++, a reference) to an
5704 uninitialized object to a "const"-qualified function argument is
5705 also diagnosed by this warning. (-Wuninitialized is issued for
5706 built-in functions known to read the object.) Annotating the
5707 function with attribute "access (none)" indicates that the argument
5708 isn't used to access the object and avoids the warning.
5709
5710 These warnings are only possible in optimizing compilation, because
5711 otherwise GCC does not keep track of the state of variables.
5712
5713 These warnings are made optional because GCC may not be able to
5714 determine when the code is correct in spite of appearing to have an
5715 error. Here is one example of how this can happen:
5716
5717 {
5718 int x;
5719 switch (y)
5720 {
5721 case 1: x = 1;
5722 break;
5723 case 2: x = 4;
5724 break;
5725 case 3: x = 5;
5726 }
5727 foo (x);
5728 }
5729
5730 If the value of "y" is always 1, 2 or 3, then "x" is always
5731 initialized, but GCC doesn't know this. To suppress the warning,
5732 you need to provide a default case with assert(0) or similar code.
5733
5734 This option also warns when a non-volatile automatic variable might
5735 be changed by a call to "longjmp". The compiler sees only the
5736 calls to "setjmp". It cannot know where "longjmp" will be called;
5737 in fact, a signal handler could call it at any point in the code.
5738 As a result, you may get a warning even when there is in fact no
5739 problem because "longjmp" cannot in fact be called at the place
5740 that would cause a problem.
5741
5742 Some spurious warnings can be avoided if you declare all the
5743 functions you use that never return as "noreturn".
5744
5745 This warning is enabled by -Wall or -Wextra.
5746
5747 -Wunknown-pragmas
5748 Warn when a "#pragma" directive is encountered that is not
5749 understood by GCC. If this command-line option is used, warnings
5750 are even issued for unknown pragmas in system header files. This
5751 is not the case if the warnings are only enabled by the -Wall
5752 command-line option.
5753
5754 -Wno-pragmas
5755 Do not warn about misuses of pragmas, such as incorrect parameters,
5756 invalid syntax, or conflicts between pragmas. See also
5757 -Wunknown-pragmas.
5758
5759 -Wno-prio-ctor-dtor
5760 Do not warn if a priority from 0 to 100 is used for constructor or
5761 destructor. The use of constructor and destructor attributes allow
5762 you to assign a priority to the constructor/destructor to control
5763 its order of execution before "main" is called or after it returns.
5764 The priority values must be greater than 100 as the compiler
5765 reserves priority values between 0--100 for the implementation.
5766
5767 -Wstrict-aliasing
5768 This option is only active when -fstrict-aliasing is active. It
5769 warns about code that might break the strict aliasing rules that
5770 the compiler is using for optimization. The warning does not catch
5771 all cases, but does attempt to catch the more common pitfalls. It
5772 is included in -Wall. It is equivalent to -Wstrict-aliasing=3
5773
5774 -Wstrict-aliasing=n
5775 This option is only active when -fstrict-aliasing is active. It
5776 warns about code that might break the strict aliasing rules that
5777 the compiler is using for optimization. Higher levels correspond
5778 to higher accuracy (fewer false positives). Higher levels also
5779 correspond to more effort, similar to the way -O works.
5780 -Wstrict-aliasing is equivalent to -Wstrict-aliasing=3.
5781
5782 Level 1: Most aggressive, quick, least accurate. Possibly useful
5783 when higher levels do not warn but -fstrict-aliasing still breaks
5784 the code, as it has very few false negatives. However, it has many
5785 false positives. Warns for all pointer conversions between
5786 possibly incompatible types, even if never dereferenced. Runs in
5787 the front end only.
5788
5789 Level 2: Aggressive, quick, not too precise. May still have many
5790 false positives (not as many as level 1 though), and few false
5791 negatives (but possibly more than level 1). Unlike level 1, it
5792 only warns when an address is taken. Warns about incomplete types.
5793 Runs in the front end only.
5794
5795 Level 3 (default for -Wstrict-aliasing): Should have very few false
5796 positives and few false negatives. Slightly slower than levels 1
5797 or 2 when optimization is enabled. Takes care of the common
5798 pun+dereference pattern in the front end: "*(int*)&some_float". If
5799 optimization is enabled, it also runs in the back end, where it
5800 deals with multiple statement cases using flow-sensitive points-to
5801 information. Only warns when the converted pointer is
5802 dereferenced. Does not warn about incomplete types.
5803
5804 -Wstrict-overflow
5805 -Wstrict-overflow=n
5806 This option is only active when signed overflow is undefined. It
5807 warns about cases where the compiler optimizes based on the
5808 assumption that signed overflow does not occur. Note that it does
5809 not warn about all cases where the code might overflow: it only
5810 warns about cases where the compiler implements some optimization.
5811 Thus this warning depends on the optimization level.
5812
5813 An optimization that assumes that signed overflow does not occur is
5814 perfectly safe if the values of the variables involved are such
5815 that overflow never does, in fact, occur. Therefore this warning
5816 can easily give a false positive: a warning about code that is not
5817 actually a problem. To help focus on important issues, several
5818 warning levels are defined. No warnings are issued for the use of
5819 undefined signed overflow when estimating how many iterations a
5820 loop requires, in particular when determining whether a loop will
5821 be executed at all.
5822
5823 -Wstrict-overflow=1
5824 Warn about cases that are both questionable and easy to avoid.
5825 For example the compiler simplifies "x + 1 > x" to 1. This
5826 level of -Wstrict-overflow is enabled by -Wall; higher levels
5827 are not, and must be explicitly requested.
5828
5829 -Wstrict-overflow=2
5830 Also warn about other cases where a comparison is simplified to
5831 a constant. For example: "abs (x) >= 0". This can only be
5832 simplified when signed integer overflow is undefined, because
5833 "abs (INT_MIN)" overflows to "INT_MIN", which is less than
5834 zero. -Wstrict-overflow (with no level) is the same as
5835 -Wstrict-overflow=2.
5836
5837 -Wstrict-overflow=3
5838 Also warn about other cases where a comparison is simplified.
5839 For example: "x + 1 > 1" is simplified to "x > 0".
5840
5841 -Wstrict-overflow=4
5842 Also warn about other simplifications not covered by the above
5843 cases. For example: "(x * 10) / 5" is simplified to "x * 2".
5844
5845 -Wstrict-overflow=5
5846 Also warn about cases where the compiler reduces the magnitude
5847 of a constant involved in a comparison. For example: "x + 2 >
5848 y" is simplified to "x + 1 >= y". This is reported only at the
5849 highest warning level because this simplification applies to
5850 many comparisons, so this warning level gives a very large
5851 number of false positives.
5852
5853 -Wstring-compare
5854 Warn for calls to "strcmp" and "strncmp" whose result is determined
5855 to be either zero or non-zero in tests for such equality owing to
5856 the length of one argument being greater than the size of the array
5857 the other argument is stored in (or the bound in the case of
5858 "strncmp"). Such calls could be mistakes. For example, the call
5859 to "strcmp" below is diagnosed because its result is necessarily
5860 non-zero irrespective of the contents of the array "a".
5861
5862 extern char a[4];
5863 void f (char *d)
5864 {
5865 strcpy (d, "string");
5866 ...
5867 if (0 == strcmp (a, d)) // cannot be true
5868 puts ("a and d are the same");
5869 }
5870
5871 -Wstring-compare is enabled by -Wextra.
5872
5873 -Wno-stringop-overflow
5874 -Wstringop-overflow
5875 -Wstringop-overflow=type
5876 Warn for calls to string manipulation functions such as "memcpy"
5877 and "strcpy" that are determined to overflow the destination
5878 buffer. The optional argument is one greater than the type of
5879 Object Size Checking to perform to determine the size of the
5880 destination. The argument is meaningful only for functions that
5881 operate on character arrays but not for raw memory functions like
5882 "memcpy" which always make use of Object Size type-0. The option
5883 also warns for calls that specify a size in excess of the largest
5884 possible object or at most "SIZE_MAX / 2" bytes. The option
5885 produces the best results with optimization enabled but can detect
5886 a small subset of simple buffer overflows even without optimization
5887 in calls to the GCC built-in functions like "__builtin_memcpy" that
5888 correspond to the standard functions. In any case, the option
5889 warns about just a subset of buffer overflows detected by the
5890 corresponding overflow checking built-ins. For example, the option
5891 issues a warning for the "strcpy" call below because it copies at
5892 least 5 characters (the string "blue" including the terminating
5893 NUL) into the buffer of size 4.
5894
5895 enum Color { blue, purple, yellow };
5896 const char* f (enum Color clr)
5897 {
5898 static char buf [4];
5899 const char *str;
5900 switch (clr)
5901 {
5902 case blue: str = "blue"; break;
5903 case purple: str = "purple"; break;
5904 case yellow: str = "yellow"; break;
5905 }
5906
5907 return strcpy (buf, str); // warning here
5908 }
5909
5910 Option -Wstringop-overflow=2 is enabled by default.
5911
5912 -Wstringop-overflow
5913 -Wstringop-overflow=1
5914 The -Wstringop-overflow=1 option uses type-zero Object Size
5915 Checking to determine the sizes of destination objects. At
5916 this setting the option does not warn for writes past the end
5917 of subobjects of larger objects accessed by pointers unless the
5918 size of the largest surrounding object is known. When the
5919 destination may be one of several objects it is assumed to be
5920 the largest one of them. On Linux systems, when optimization
5921 is enabled at this setting the option warns for the same code
5922 as when the "_FORTIFY_SOURCE" macro is defined to a non-zero
5923 value.
5924
5925 -Wstringop-overflow=2
5926 The -Wstringop-overflow=2 option uses type-one Object Size
5927 Checking to determine the sizes of destination objects. At
5928 this setting the option warns about overflows when writing to
5929 members of the largest complete objects whose exact size is
5930 known. However, it does not warn for excessive writes to the
5931 same members of unknown objects referenced by pointers since
5932 they may point to arrays containing unknown numbers of
5933 elements. This is the default setting of the option.
5934
5935 -Wstringop-overflow=3
5936 The -Wstringop-overflow=3 option uses type-two Object Size
5937 Checking to determine the sizes of destination objects. At
5938 this setting the option warns about overflowing the smallest
5939 object or data member. This is the most restrictive setting of
5940 the option that may result in warnings for safe code.
5941
5942 -Wstringop-overflow=4
5943 The -Wstringop-overflow=4 option uses type-three Object Size
5944 Checking to determine the sizes of destination objects. At
5945 this setting the option warns about overflowing any data
5946 members, and when the destination is one of several objects it
5947 uses the size of the largest of them to decide whether to issue
5948 a warning. Similarly to -Wstringop-overflow=3 this setting of
5949 the option may result in warnings for benign code.
5950
5951 -Wno-stringop-overread
5952 Warn for calls to string manipulation functions such as "memchr",
5953 or "strcpy" that are determined to read past the end of the source
5954 sequence.
5955
5956 Option -Wstringop-overread is enabled by default.
5957
5958 -Wno-stringop-truncation
5959 Do not warn for calls to bounded string manipulation functions such
5960 as "strncat", "strncpy", and "stpncpy" that may either truncate the
5961 copied string or leave the destination unchanged.
5962
5963 In the following example, the call to "strncat" specifies a bound
5964 that is less than the length of the source string. As a result,
5965 the copy of the source will be truncated and so the call is
5966 diagnosed. To avoid the warning use "bufsize - strlen (buf) - 1)"
5967 as the bound.
5968
5969 void append (char *buf, size_t bufsize)
5970 {
5971 strncat (buf, ".txt", 3);
5972 }
5973
5974 As another example, the following call to "strncpy" results in
5975 copying to "d" just the characters preceding the terminating NUL,
5976 without appending the NUL to the end. Assuming the result of
5977 "strncpy" is necessarily a NUL-terminated string is a common
5978 mistake, and so the call is diagnosed. To avoid the warning when
5979 the result is not expected to be NUL-terminated, call "memcpy"
5980 instead.
5981
5982 void copy (char *d, const char *s)
5983 {
5984 strncpy (d, s, strlen (s));
5985 }
5986
5987 In the following example, the call to "strncpy" specifies the size
5988 of the destination buffer as the bound. If the length of the
5989 source string is equal to or greater than this size the result of
5990 the copy will not be NUL-terminated. Therefore, the call is also
5991 diagnosed. To avoid the warning, specify "sizeof buf - 1" as the
5992 bound and set the last element of the buffer to "NUL".
5993
5994 void copy (const char *s)
5995 {
5996 char buf[80];
5997 strncpy (buf, s, sizeof buf);
5998 ...
5999 }
6000
6001 In situations where a character array is intended to store a
6002 sequence of bytes with no terminating "NUL" such an array may be
6003 annotated with attribute "nonstring" to avoid this warning. Such
6004 arrays, however, are not suitable arguments to functions that
6005 expect "NUL"-terminated strings. To help detect accidental misuses
6006 of such arrays GCC issues warnings unless it can prove that the use
6007 is safe.
6008
6009 -Wsuggest-attribute=[pure|const|noreturn|format|cold|malloc]
6010 Warn for cases where adding an attribute may be beneficial. The
6011 attributes currently supported are listed below.
6012
6013 -Wsuggest-attribute=pure
6014 -Wsuggest-attribute=const
6015 -Wsuggest-attribute=noreturn
6016 -Wmissing-noreturn
6017 -Wsuggest-attribute=malloc
6018 Warn about functions that might be candidates for attributes
6019 "pure", "const" or "noreturn" or "malloc". The compiler only
6020 warns for functions visible in other compilation units or (in
6021 the case of "pure" and "const") if it cannot prove that the
6022 function returns normally. A function returns normally if it
6023 doesn't contain an infinite loop or return abnormally by
6024 throwing, calling "abort" or trapping. This analysis requires
6025 option -fipa-pure-const, which is enabled by default at -O and
6026 higher. Higher optimization levels improve the accuracy of the
6027 analysis.
6028
6029 -Wsuggest-attribute=format
6030 -Wmissing-format-attribute
6031 Warn about function pointers that might be candidates for
6032 "format" attributes. Note these are only possible candidates,
6033 not absolute ones. GCC guesses that function pointers with
6034 "format" attributes that are used in assignment,
6035 initialization, parameter passing or return statements should
6036 have a corresponding "format" attribute in the resulting type.
6037 I.e. the left-hand side of the assignment or initialization,
6038 the type of the parameter variable, or the return type of the
6039 containing function respectively should also have a "format"
6040 attribute to avoid the warning.
6041
6042 GCC also warns about function definitions that might be
6043 candidates for "format" attributes. Again, these are only
6044 possible candidates. GCC guesses that "format" attributes
6045 might be appropriate for any function that calls a function
6046 like "vprintf" or "vscanf", but this might not always be the
6047 case, and some functions for which "format" attributes are
6048 appropriate may not be detected.
6049
6050 -Wsuggest-attribute=cold
6051 Warn about functions that might be candidates for "cold"
6052 attribute. This is based on static detection and generally
6053 only warns about functions which always leads to a call to
6054 another "cold" function such as wrappers of C++ "throw" or
6055 fatal error reporting functions leading to "abort".
6056
6057 -Walloc-zero
6058 Warn about calls to allocation functions decorated with attribute
6059 "alloc_size" that specify zero bytes, including those to the built-
6060 in forms of the functions "aligned_alloc", "alloca", "calloc",
6061 "malloc", and "realloc". Because the behavior of these functions
6062 when called with a zero size differs among implementations (and in
6063 the case of "realloc" has been deprecated) relying on it may result
6064 in subtle portability bugs and should be avoided.
6065
6066 -Walloc-size-larger-than=byte-size
6067 Warn about calls to functions decorated with attribute "alloc_size"
6068 that attempt to allocate objects larger than the specified number
6069 of bytes, or where the result of the size computation in an integer
6070 type with infinite precision would exceed the value of PTRDIFF_MAX
6071 on the target. -Walloc-size-larger-than=PTRDIFF_MAX is enabled by
6072 default. Warnings controlled by the option can be disabled either
6073 by specifying byte-size of SIZE_MAX or more or by
6074 -Wno-alloc-size-larger-than.
6075
6076 -Wno-alloc-size-larger-than
6077 Disable -Walloc-size-larger-than= warnings. The option is
6078 equivalent to -Walloc-size-larger-than=SIZE_MAX or larger.
6079
6080 -Walloca
6081 This option warns on all uses of "alloca" in the source.
6082
6083 -Walloca-larger-than=byte-size
6084 This option warns on calls to "alloca" with an integer argument
6085 whose value is either zero, or that is not bounded by a controlling
6086 predicate that limits its value to at most byte-size. It also
6087 warns for calls to "alloca" where the bound value is unknown.
6088 Arguments of non-integer types are considered unbounded even if
6089 they appear to be constrained to the expected range.
6090
6091 For example, a bounded case of "alloca" could be:
6092
6093 void func (size_t n)
6094 {
6095 void *p;
6096 if (n <= 1000)
6097 p = alloca (n);
6098 else
6099 p = malloc (n);
6100 f (p);
6101 }
6102
6103 In the above example, passing "-Walloca-larger-than=1000" would not
6104 issue a warning because the call to "alloca" is known to be at most
6105 1000 bytes. However, if "-Walloca-larger-than=500" were passed,
6106 the compiler would emit a warning.
6107
6108 Unbounded uses, on the other hand, are uses of "alloca" with no
6109 controlling predicate constraining its integer argument. For
6110 example:
6111
6112 void func ()
6113 {
6114 void *p = alloca (n);
6115 f (p);
6116 }
6117
6118 If "-Walloca-larger-than=500" were passed, the above would trigger
6119 a warning, but this time because of the lack of bounds checking.
6120
6121 Note, that even seemingly correct code involving signed integers
6122 could cause a warning:
6123
6124 void func (signed int n)
6125 {
6126 if (n < 500)
6127 {
6128 p = alloca (n);
6129 f (p);
6130 }
6131 }
6132
6133 In the above example, n could be negative, causing a larger than
6134 expected argument to be implicitly cast into the "alloca" call.
6135
6136 This option also warns when "alloca" is used in a loop.
6137
6138 -Walloca-larger-than=PTRDIFF_MAX is enabled by default but is
6139 usually only effective when -ftree-vrp is active (default for -O2
6140 and above).
6141
6142 See also -Wvla-larger-than=byte-size.
6143
6144 -Wno-alloca-larger-than
6145 Disable -Walloca-larger-than= warnings. The option is equivalent
6146 to -Walloca-larger-than=SIZE_MAX or larger.
6147
6148 -Warith-conversion
6149 Do warn about implicit conversions from arithmetic operations even
6150 when conversion of the operands to the same type cannot change
6151 their values. This affects warnings from -Wconversion,
6152 -Wfloat-conversion, and -Wsign-conversion.
6153
6154 void f (char c, int i)
6155 {
6156 c = c + i; // warns with B<-Wconversion>
6157 c = c + 1; // only warns with B<-Warith-conversion>
6158 }
6159
6160 -Warray-bounds
6161 -Warray-bounds=n
6162 Warn about out of bounds subscripts or offsets into arrays. This
6163 warning is enabled by -Wall. It is more effective when -ftree-vrp
6164 is active (the default for -O2 and above) but a subset of instances
6165 are issued even without optimization.
6166
6167 -Warray-bounds=1
6168 This is the default warning level of -Warray-bounds and is
6169 enabled by -Wall; higher levels are not, and must be explicitly
6170 requested.
6171
6172 -Warray-bounds=2
6173 This warning level also warns about out of bounds accesses to
6174 trailing struct members of one-element array types and about
6175 the intermediate results of pointer arithmetic that may yield
6176 out of bounds values. This warning level may give a larger
6177 number of false positives and is deactivated by default.
6178
6179 -Warray-compare
6180 Warn about equality and relational comparisons between two operands
6181 of array type. This comparison was deprecated in C++20. For
6182 example:
6183
6184 int arr1[5];
6185 int arr2[5];
6186 bool same = arr1 == arr2;
6187
6188 -Warray-compare is enabled by -Wall.
6189
6190 -Warray-parameter
6191 -Warray-parameter=n
6192 Warn about redeclarations of functions involving arguments of array
6193 or pointer types of inconsistent kinds or forms, and enable the
6194 detection of out-of-bounds accesses to such parameters by warnings
6195 such as -Warray-bounds.
6196
6197 If the first function declaration uses the array form the bound
6198 specified in the array is assumed to be the minimum number of
6199 elements expected to be provided in calls to the function and the
6200 maximum number of elements accessed by it. Failing to provide
6201 arguments of sufficient size or accessing more than the maximum
6202 number of elements may be diagnosed by warnings such as
6203 -Warray-bounds. At level 1 the warning diagnoses inconsistencies
6204 involving array parameters declared using the "T[static N]" form.
6205
6206 For example, the warning triggers for the following redeclarations
6207 because the first one allows an array of any size to be passed to
6208 "f" while the second one with the keyword "static" specifies that
6209 the array argument must have at least four elements.
6210
6211 void f (int[static 4]);
6212 void f (int[]); // warning (inconsistent array form)
6213
6214 void g (void)
6215 {
6216 int *p = (int *)malloc (4);
6217 f (p); // warning (array too small)
6218 ...
6219 }
6220
6221 At level 2 the warning also triggers for redeclarations involving
6222 any other inconsistency in array or pointer argument forms denoting
6223 array sizes. Pointers and arrays of unspecified bound are
6224 considered equivalent and do not trigger a warning.
6225
6226 void g (int*);
6227 void g (int[]); // no warning
6228 void g (int[8]); // warning (inconsistent array bound)
6229
6230 -Warray-parameter=2 is included in -Wall. The -Wvla-parameter
6231 option triggers warnings for similar inconsistencies involving
6232 Variable Length Array arguments.
6233
6234 -Wattribute-alias=n
6235 -Wno-attribute-alias
6236 Warn about declarations using the "alias" and similar attributes
6237 whose target is incompatible with the type of the alias.
6238
6239 -Wattribute-alias=1
6240 The default warning level of the -Wattribute-alias option
6241 diagnoses incompatibilities between the type of the alias
6242 declaration and that of its target. Such incompatibilities are
6243 typically indicative of bugs.
6244
6245 -Wattribute-alias=2
6246 At this level -Wattribute-alias also diagnoses cases where the
6247 attributes of the alias declaration are more restrictive than
6248 the attributes applied to its target. These mismatches can
6249 potentially result in incorrect code generation. In other
6250 cases they may be benign and could be resolved simply by adding
6251 the missing attribute to the target. For comparison, see the
6252 -Wmissing-attributes option, which controls diagnostics when
6253 the alias declaration is less restrictive than the target,
6254 rather than more restrictive.
6255
6256 Attributes considered include "alloc_align", "alloc_size",
6257 "cold", "const", "hot", "leaf", "malloc", "nonnull",
6258 "noreturn", "nothrow", "pure", "returns_nonnull", and
6259 "returns_twice".
6260
6261 -Wattribute-alias is equivalent to -Wattribute-alias=1. This is
6262 the default. You can disable these warnings with either
6263 -Wno-attribute-alias or -Wattribute-alias=0.
6264
6265 -Wbidi-chars=[none|unpaired|any|ucn]
6266 Warn about possibly misleading UTF-8 bidirectional control
6267 characters in comments, string literals, character constants, and
6268 identifiers. Such characters can change left-to-right writing
6269 direction into right-to-left (and vice versa), which can cause
6270 confusion between the logical order and visual order. This may be
6271 dangerous; for instance, it may seem that a piece of code is not
6272 commented out, whereas it in fact is.
6273
6274 There are three levels of warning supported by GCC. The default is
6275 -Wbidi-chars=unpaired, which warns about improperly terminated bidi
6276 contexts. -Wbidi-chars=none turns the warning off.
6277 -Wbidi-chars=any warns about any use of bidirectional control
6278 characters.
6279
6280 By default, this warning does not warn about UCNs. It is, however,
6281 possible to turn on such checking by using
6282 -Wbidi-chars=unpaired,ucn or -Wbidi-chars=any,ucn. Using
6283 -Wbidi-chars=ucn is valid, and is equivalent to
6284 -Wbidi-chars=unpaired,ucn, if no previous -Wbidi-chars=any was
6285 specified.
6286
6287 -Wbool-compare
6288 Warn about boolean expression compared with an integer value
6289 different from "true"/"false". For instance, the following
6290 comparison is always false:
6291
6292 int n = 5;
6293 ...
6294 if ((n > 1) == 2) { ... }
6295
6296 This warning is enabled by -Wall.
6297
6298 -Wbool-operation
6299 Warn about suspicious operations on expressions of a boolean type.
6300 For instance, bitwise negation of a boolean is very likely a bug in
6301 the program. For C, this warning also warns about incrementing or
6302 decrementing a boolean, which rarely makes sense. (In C++,
6303 decrementing a boolean is always invalid. Incrementing a boolean
6304 is invalid in C++17, and deprecated otherwise.)
6305
6306 This warning is enabled by -Wall.
6307
6308 -Wduplicated-branches
6309 Warn when an if-else has identical branches. This warning detects
6310 cases like
6311
6312 if (p != NULL)
6313 return 0;
6314 else
6315 return 0;
6316
6317 It doesn't warn when both branches contain just a null statement.
6318 This warning also warn for conditional operators:
6319
6320 int i = x ? *p : *p;
6321
6322 -Wduplicated-cond
6323 Warn about duplicated conditions in an if-else-if chain. For
6324 instance, warn for the following code:
6325
6326 if (p->q != NULL) { ... }
6327 else if (p->q != NULL) { ... }
6328
6329 -Wframe-address
6330 Warn when the __builtin_frame_address or __builtin_return_address
6331 is called with an argument greater than 0. Such calls may return
6332 indeterminate values or crash the program. The warning is included
6333 in -Wall.
6334
6335 -Wno-discarded-qualifiers (C and Objective-C only)
6336 Do not warn if type qualifiers on pointers are being discarded.
6337 Typically, the compiler warns if a "const char *" variable is
6338 passed to a function that takes a "char *" parameter. This option
6339 can be used to suppress such a warning.
6340
6341 -Wno-discarded-array-qualifiers (C and Objective-C only)
6342 Do not warn if type qualifiers on arrays which are pointer targets
6343 are being discarded. Typically, the compiler warns if a "const int
6344 (*)[]" variable is passed to a function that takes a "int (*)[]"
6345 parameter. This option can be used to suppress such a warning.
6346
6347 -Wno-incompatible-pointer-types (C and Objective-C only)
6348 Do not warn when there is a conversion between pointers that have
6349 incompatible types. This warning is for cases not covered by
6350 -Wno-pointer-sign, which warns for pointer argument passing or
6351 assignment with different signedness.
6352
6353 -Wno-int-conversion (C and Objective-C only)
6354 Do not warn about incompatible integer to pointer and pointer to
6355 integer conversions. This warning is about implicit conversions;
6356 for explicit conversions the warnings -Wno-int-to-pointer-cast and
6357 -Wno-pointer-to-int-cast may be used.
6358
6359 -Wzero-length-bounds
6360 Warn about accesses to elements of zero-length array members that
6361 might overlap other members of the same object. Declaring interior
6362 zero-length arrays is discouraged because accesses to them are
6363 undefined. See
6364
6365 For example, the first two stores in function "bad" are diagnosed
6366 because the array elements overlap the subsequent members "b" and
6367 "c". The third store is diagnosed by -Warray-bounds because it is
6368 beyond the bounds of the enclosing object.
6369
6370 struct X { int a[0]; int b, c; };
6371 struct X x;
6372
6373 void bad (void)
6374 {
6375 x.a[0] = 0; // -Wzero-length-bounds
6376 x.a[1] = 1; // -Wzero-length-bounds
6377 x.a[2] = 2; // -Warray-bounds
6378 }
6379
6380 Option -Wzero-length-bounds is enabled by -Warray-bounds.
6381
6382 -Wno-div-by-zero
6383 Do not warn about compile-time integer division by zero. Floating-
6384 point division by zero is not warned about, as it can be a
6385 legitimate way of obtaining infinities and NaNs.
6386
6387 -Wsystem-headers
6388 Print warning messages for constructs found in system header files.
6389 Warnings from system headers are normally suppressed, on the
6390 assumption that they usually do not indicate real problems and
6391 would only make the compiler output harder to read. Using this
6392 command-line option tells GCC to emit warnings from system headers
6393 as if they occurred in user code. However, note that using -Wall
6394 in conjunction with this option does not warn about unknown pragmas
6395 in system headers---for that, -Wunknown-pragmas must also be used.
6396
6397 -Wtautological-compare
6398 Warn if a self-comparison always evaluates to true or false. This
6399 warning detects various mistakes such as:
6400
6401 int i = 1;
6402 ...
6403 if (i > i) { ... }
6404
6405 This warning also warns about bitwise comparisons that always
6406 evaluate to true or false, for instance:
6407
6408 if ((a & 16) == 10) { ... }
6409
6410 will always be false.
6411
6412 This warning is enabled by -Wall.
6413
6414 -Wtrampolines
6415 Warn about trampolines generated for pointers to nested functions.
6416 A trampoline is a small piece of data or code that is created at
6417 run time on the stack when the address of a nested function is
6418 taken, and is used to call the nested function indirectly. For
6419 some targets, it is made up of data only and thus requires no
6420 special treatment. But, for most targets, it is made up of code
6421 and thus requires the stack to be made executable in order for the
6422 program to work properly.
6423
6424 -Wfloat-equal
6425 Warn if floating-point values are used in equality comparisons.
6426
6427 The idea behind this is that sometimes it is convenient (for the
6428 programmer) to consider floating-point values as approximations to
6429 infinitely precise real numbers. If you are doing this, then you
6430 need to compute (by analyzing the code, or in some other way) the
6431 maximum or likely maximum error that the computation introduces,
6432 and allow for it when performing comparisons (and when producing
6433 output, but that's a different problem). In particular, instead of
6434 testing for equality, you should check to see whether the two
6435 values have ranges that overlap; and this is done with the
6436 relational operators, so equality comparisons are probably
6437 mistaken.
6438
6439 -Wtraditional (C and Objective-C only)
6440 Warn about certain constructs that behave differently in
6441 traditional and ISO C. Also warn about ISO C constructs that have
6442 no traditional C equivalent, and/or problematic constructs that
6443 should be avoided.
6444
6445 * Macro parameters that appear within string literals in the
6446 macro body. In traditional C macro replacement takes place
6447 within string literals, but in ISO C it does not.
6448
6449 * In traditional C, some preprocessor directives did not exist.
6450 Traditional preprocessors only considered a line to be a
6451 directive if the # appeared in column 1 on the line. Therefore
6452 -Wtraditional warns about directives that traditional C
6453 understands but ignores because the # does not appear as the
6454 first character on the line. It also suggests you hide
6455 directives like "#pragma" not understood by traditional C by
6456 indenting them. Some traditional implementations do not
6457 recognize "#elif", so this option suggests avoiding it
6458 altogether.
6459
6460 * A function-like macro that appears without arguments.
6461
6462 * The unary plus operator.
6463
6464 * The U integer constant suffix, or the F or L floating-point
6465 constant suffixes. (Traditional C does support the L suffix on
6466 integer constants.) Note, these suffixes appear in macros
6467 defined in the system headers of most modern systems, e.g. the
6468 _MIN/_MAX macros in "<limits.h>". Use of these macros in user
6469 code might normally lead to spurious warnings, however GCC's
6470 integrated preprocessor has enough context to avoid warning in
6471 these cases.
6472
6473 * A function declared external in one block and then used after
6474 the end of the block.
6475
6476 * A "switch" statement has an operand of type "long".
6477
6478 * A non-"static" function declaration follows a "static" one.
6479 This construct is not accepted by some traditional C compilers.
6480
6481 * The ISO type of an integer constant has a different width or
6482 signedness from its traditional type. This warning is only
6483 issued if the base of the constant is ten. I.e. hexadecimal or
6484 octal values, which typically represent bit patterns, are not
6485 warned about.
6486
6487 * Usage of ISO string concatenation is detected.
6488
6489 * Initialization of automatic aggregates.
6490
6491 * Identifier conflicts with labels. Traditional C lacks a
6492 separate namespace for labels.
6493
6494 * Initialization of unions. If the initializer is zero, the
6495 warning is omitted. This is done under the assumption that the
6496 zero initializer in user code appears conditioned on e.g.
6497 "__STDC__" to avoid missing initializer warnings and relies on
6498 default initialization to zero in the traditional C case.
6499
6500 * Conversions by prototypes between fixed/floating-point values
6501 and vice versa. The absence of these prototypes when compiling
6502 with traditional C causes serious problems. This is a subset
6503 of the possible conversion warnings; for the full set use
6504 -Wtraditional-conversion.
6505
6506 * Use of ISO C style function definitions. This warning
6507 intentionally is not issued for prototype declarations or
6508 variadic functions because these ISO C features appear in your
6509 code when using libiberty's traditional C compatibility macros,
6510 "PARAMS" and "VPARAMS". This warning is also bypassed for
6511 nested functions because that feature is already a GCC
6512 extension and thus not relevant to traditional C compatibility.
6513
6514 -Wtraditional-conversion (C and Objective-C only)
6515 Warn if a prototype causes a type conversion that is different from
6516 what would happen to the same argument in the absence of a
6517 prototype. This includes conversions of fixed point to floating
6518 and vice versa, and conversions changing the width or signedness of
6519 a fixed-point argument except when the same as the default
6520 promotion.
6521
6522 -Wdeclaration-after-statement (C and Objective-C only)
6523 Warn when a declaration is found after a statement in a block.
6524 This construct, known from C++, was introduced with ISO C99 and is
6525 by default allowed in GCC. It is not supported by ISO C90.
6526
6527 -Wshadow
6528 Warn whenever a local variable or type declaration shadows another
6529 variable, parameter, type, class member (in C++), or instance
6530 variable (in Objective-C) or whenever a built-in function is
6531 shadowed. Note that in C++, the compiler warns if a local variable
6532 shadows an explicit typedef, but not if it shadows a
6533 struct/class/enum. If this warning is enabled, it includes also
6534 all instances of local shadowing. This means that
6535 -Wno-shadow=local and -Wno-shadow=compatible-local are ignored when
6536 -Wshadow is used. Same as -Wshadow=global.
6537
6538 -Wno-shadow-ivar (Objective-C only)
6539 Do not warn whenever a local variable shadows an instance variable
6540 in an Objective-C method.
6541
6542 -Wshadow=global
6543 Warn for any shadowing. Same as -Wshadow.
6544
6545 -Wshadow=local
6546 Warn when a local variable shadows another local variable or
6547 parameter.
6548
6549 -Wshadow=compatible-local
6550 Warn when a local variable shadows another local variable or
6551 parameter whose type is compatible with that of the shadowing
6552 variable. In C++, type compatibility here means the type of the
6553 shadowing variable can be converted to that of the shadowed
6554 variable. The creation of this flag (in addition to
6555 -Wshadow=local) is based on the idea that when a local variable
6556 shadows another one of incompatible type, it is most likely
6557 intentional, not a bug or typo, as shown in the following example:
6558
6559 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6560 {
6561 for (int i = 0; i < N; ++i)
6562 {
6563 ...
6564 }
6565 ...
6566 }
6567
6568 Since the two variable "i" in the example above have incompatible
6569 types, enabling only -Wshadow=compatible-local does not emit a
6570 warning. Because their types are incompatible, if a programmer
6571 accidentally uses one in place of the other, type checking is
6572 expected to catch that and emit an error or warning. Use of this
6573 flag instead of -Wshadow=local can possibly reduce the number of
6574 warnings triggered by intentional shadowing. Note that this also
6575 means that shadowing "const char *i" by "char *i" does not emit a
6576 warning.
6577
6578 This warning is also enabled by -Wshadow=local.
6579
6580 -Wlarger-than=byte-size
6581 Warn whenever an object is defined whose size exceeds byte-size.
6582 -Wlarger-than=PTRDIFF_MAX is enabled by default. Warnings
6583 controlled by the option can be disabled either by specifying byte-
6584 size of SIZE_MAX or more or by -Wno-larger-than.
6585
6586 Also warn for calls to bounded functions such as "memchr" or
6587 "strnlen" that specify a bound greater than the largest possible
6588 object, which is PTRDIFF_MAX bytes by default. These warnings can
6589 only be disabled by -Wno-larger-than.
6590
6591 -Wno-larger-than
6592 Disable -Wlarger-than= warnings. The option is equivalent to
6593 -Wlarger-than=SIZE_MAX or larger.
6594
6595 -Wframe-larger-than=byte-size
6596 Warn if the size of a function frame exceeds byte-size. The
6597 computation done to determine the stack frame size is approximate
6598 and not conservative. The actual requirements may be somewhat
6599 greater than byte-size even if you do not get a warning. In
6600 addition, any space allocated via "alloca", variable-length arrays,
6601 or related constructs is not included by the compiler when
6602 determining whether or not to issue a warning.
6603 -Wframe-larger-than=PTRDIFF_MAX is enabled by default. Warnings
6604 controlled by the option can be disabled either by specifying byte-
6605 size of SIZE_MAX or more or by -Wno-frame-larger-than.
6606
6607 -Wno-frame-larger-than
6608 Disable -Wframe-larger-than= warnings. The option is equivalent to
6609 -Wframe-larger-than=SIZE_MAX or larger.
6610
6611 -Wfree-nonheap-object
6612 Warn when attempting to deallocate an object that was either not
6613 allocated on the heap, or by using a pointer that was not returned
6614 from a prior call to the corresponding allocation function. For
6615 example, because the call to "stpcpy" returns a pointer to the
6616 terminating nul character and not to the beginning of the object,
6617 the call to "free" below is diagnosed.
6618
6619 void f (char *p)
6620 {
6621 p = stpcpy (p, "abc");
6622 // ...
6623 free (p); // warning
6624 }
6625
6626 -Wfree-nonheap-object is included in -Wall.
6627
6628 -Wstack-usage=byte-size
6629 Warn if the stack usage of a function might exceed byte-size. The
6630 computation done to determine the stack usage is conservative. Any
6631 space allocated via "alloca", variable-length arrays, or related
6632 constructs is included by the compiler when determining whether or
6633 not to issue a warning.
6634
6635 The message is in keeping with the output of -fstack-usage.
6636
6637 * If the stack usage is fully static but exceeds the specified
6638 amount, it's:
6639
6640 warning: stack usage is 1120 bytes
6641
6642 * If the stack usage is (partly) dynamic but bounded, it's:
6643
6644 warning: stack usage might be 1648 bytes
6645
6646 * If the stack usage is (partly) dynamic and not bounded, it's:
6647
6648 warning: stack usage might be unbounded
6649
6650 -Wstack-usage=PTRDIFF_MAX is enabled by default. Warnings
6651 controlled by the option can be disabled either by specifying byte-
6652 size of SIZE_MAX or more or by -Wno-stack-usage.
6653
6654 -Wno-stack-usage
6655 Disable -Wstack-usage= warnings. The option is equivalent to
6656 -Wstack-usage=SIZE_MAX or larger.
6657
6658 -Wunsafe-loop-optimizations
6659 Warn if the loop cannot be optimized because the compiler cannot
6660 assume anything on the bounds of the loop indices. With
6661 -funsafe-loop-optimizations warn if the compiler makes such
6662 assumptions.
6663
6664 -Wno-pedantic-ms-format (MinGW targets only)
6665 When used in combination with -Wformat and -pedantic without GNU
6666 extensions, this option disables the warnings about non-ISO
6667 "printf" / "scanf" format width specifiers "I32", "I64", and "I"
6668 used on Windows targets, which depend on the MS runtime.
6669
6670 -Wpointer-arith
6671 Warn about anything that depends on the "size of" a function type
6672 or of "void". GNU C assigns these types a size of 1, for
6673 convenience in calculations with "void *" pointers and pointers to
6674 functions. In C++, warn also when an arithmetic operation involves
6675 "NULL". This warning is also enabled by -Wpedantic.
6676
6677 -Wno-pointer-compare
6678 Do not warn if a pointer is compared with a zero character
6679 constant. This usually means that the pointer was meant to be
6680 dereferenced. For example:
6681
6682 const char *p = foo ();
6683 if (p == '\0')
6684 return 42;
6685
6686 Note that the code above is invalid in C++11.
6687
6688 This warning is enabled by default.
6689
6690 -Wtsan
6691 Warn about unsupported features in ThreadSanitizer.
6692
6693 ThreadSanitizer does not support "std::atomic_thread_fence" and can
6694 report false positives.
6695
6696 This warning is enabled by default.
6697
6698 -Wtype-limits
6699 Warn if a comparison is always true or always false due to the
6700 limited range of the data type, but do not warn for constant
6701 expressions. For example, warn if an unsigned variable is compared
6702 against zero with "<" or ">=". This warning is also enabled by
6703 -Wextra.
6704
6705 -Wabsolute-value (C and Objective-C only)
6706 Warn for calls to standard functions that compute the absolute
6707 value of an argument when a more appropriate standard function is
6708 available. For example, calling "abs(3.14)" triggers the warning
6709 because the appropriate function to call to compute the absolute
6710 value of a double argument is "fabs". The option also triggers
6711 warnings when the argument in a call to such a function has an
6712 unsigned type. This warning can be suppressed with an explicit
6713 type cast and it is also enabled by -Wextra.
6714
6715 -Wcomment
6716 -Wcomments
6717 Warn whenever a comment-start sequence /* appears in a /* comment,
6718 or whenever a backslash-newline appears in a // comment. This
6719 warning is enabled by -Wall.
6720
6721 -Wtrigraphs
6722 Warn if any trigraphs are encountered that might change the meaning
6723 of the program. Trigraphs within comments are not warned about,
6724 except those that would form escaped newlines.
6725
6726 This option is implied by -Wall. If -Wall is not given, this
6727 option is still enabled unless trigraphs are enabled. To get
6728 trigraph conversion without warnings, but get the other -Wall
6729 warnings, use -trigraphs -Wall -Wno-trigraphs.
6730
6731 -Wundef
6732 Warn if an undefined identifier is evaluated in an "#if" directive.
6733 Such identifiers are replaced with zero.
6734
6735 -Wexpansion-to-defined
6736 Warn whenever defined is encountered in the expansion of a macro
6737 (including the case where the macro is expanded by an #if
6738 directive). Such usage is not portable. This warning is also
6739 enabled by -Wpedantic and -Wextra.
6740
6741 -Wunused-macros
6742 Warn about macros defined in the main file that are unused. A
6743 macro is used if it is expanded or tested for existence at least
6744 once. The preprocessor also warns if the macro has not been used
6745 at the time it is redefined or undefined.
6746
6747 Built-in macros, macros defined on the command line, and macros
6748 defined in include files are not warned about.
6749
6750 Note: If a macro is actually used, but only used in skipped
6751 conditional blocks, then the preprocessor reports it as unused. To
6752 avoid the warning in such a case, you might improve the scope of
6753 the macro's definition by, for example, moving it into the first
6754 skipped block. Alternatively, you could provide a dummy use with
6755 something like:
6756
6757 #if defined the_macro_causing_the_warning
6758 #endif
6759
6760 -Wno-endif-labels
6761 Do not warn whenever an "#else" or an "#endif" are followed by
6762 text. This sometimes happens in older programs with code of the
6763 form
6764
6765 #if FOO
6766 ...
6767 #else FOO
6768 ...
6769 #endif FOO
6770
6771 The second and third "FOO" should be in comments. This warning is
6772 on by default.
6773
6774 -Wbad-function-cast (C and Objective-C only)
6775 Warn when a function call is cast to a non-matching type. For
6776 example, warn if a call to a function returning an integer type is
6777 cast to a pointer type.
6778
6779 -Wc90-c99-compat (C and Objective-C only)
6780 Warn about features not present in ISO C90, but present in ISO C99.
6781 For instance, warn about use of variable length arrays, "long long"
6782 type, "bool" type, compound literals, designated initializers, and
6783 so on. This option is independent of the standards mode. Warnings
6784 are disabled in the expression that follows "__extension__".
6785
6786 -Wc99-c11-compat (C and Objective-C only)
6787 Warn about features not present in ISO C99, but present in ISO C11.
6788 For instance, warn about use of anonymous structures and unions,
6789 "_Atomic" type qualifier, "_Thread_local" storage-class specifier,
6790 "_Alignas" specifier, "Alignof" operator, "_Generic" keyword, and
6791 so on. This option is independent of the standards mode. Warnings
6792 are disabled in the expression that follows "__extension__".
6793
6794 -Wc11-c2x-compat (C and Objective-C only)
6795 Warn about features not present in ISO C11, but present in ISO C2X.
6796 For instance, warn about omitting the string in "_Static_assert",
6797 use of [[]] syntax for attributes, use of decimal floating-point
6798 types, and so on. This option is independent of the standards
6799 mode. Warnings are disabled in the expression that follows
6800 "__extension__".
6801
6802 -Wc++-compat (C and Objective-C only)
6803 Warn about ISO C constructs that are outside of the common subset
6804 of ISO C and ISO C++, e.g. request for implicit conversion from
6805 "void *" to a pointer to non-"void" type.
6806
6807 -Wc++11-compat (C++ and Objective-C++ only)
6808 Warn about C++ constructs whose meaning differs between ISO C++
6809 1998 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are
6810 keywords in ISO C++ 2011. This warning turns on -Wnarrowing and is
6811 enabled by -Wall.
6812
6813 -Wc++14-compat (C++ and Objective-C++ only)
6814 Warn about C++ constructs whose meaning differs between ISO C++
6815 2011 and ISO C++ 2014. This warning is enabled by -Wall.
6816
6817 -Wc++17-compat (C++ and Objective-C++ only)
6818 Warn about C++ constructs whose meaning differs between ISO C++
6819 2014 and ISO C++ 2017. This warning is enabled by -Wall.
6820
6821 -Wc++20-compat (C++ and Objective-C++ only)
6822 Warn about C++ constructs whose meaning differs between ISO C++
6823 2017 and ISO C++ 2020. This warning is enabled by -Wall.
6824
6825 -Wno-c++11-extensions (C++ and Objective-C++ only)
6826 Do not warn about C++11 constructs in code being compiled using an
6827 older C++ standard. Even without this option, some C++11
6828 constructs will only be diagnosed if -Wpedantic is used.
6829
6830 -Wno-c++14-extensions (C++ and Objective-C++ only)
6831 Do not warn about C++14 constructs in code being compiled using an
6832 older C++ standard. Even without this option, some C++14
6833 constructs will only be diagnosed if -Wpedantic is used.
6834
6835 -Wno-c++17-extensions (C++ and Objective-C++ only)
6836 Do not warn about C++17 constructs in code being compiled using an
6837 older C++ standard. Even without this option, some C++17
6838 constructs will only be diagnosed if -Wpedantic is used.
6839
6840 -Wno-c++20-extensions (C++ and Objective-C++ only)
6841 Do not warn about C++20 constructs in code being compiled using an
6842 older C++ standard. Even without this option, some C++20
6843 constructs will only be diagnosed if -Wpedantic is used.
6844
6845 -Wno-c++23-extensions (C++ and Objective-C++ only)
6846 Do not warn about C++23 constructs in code being compiled using an
6847 older C++ standard. Even without this option, some C++23
6848 constructs will only be diagnosed if -Wpedantic is used.
6849
6850 -Wcast-qual
6851 Warn whenever a pointer is cast so as to remove a type qualifier
6852 from the target type. For example, warn if a "const char *" is
6853 cast to an ordinary "char *".
6854
6855 Also warn when making a cast that introduces a type qualifier in an
6856 unsafe way. For example, casting "char **" to "const char **" is
6857 unsafe, as in this example:
6858
6859 /* p is char ** value. */
6860 const char **q = (const char **) p;
6861 /* Assignment of readonly string to const char * is OK. */
6862 *q = "string";
6863 /* Now char** pointer points to read-only memory. */
6864 **p = 'b';
6865
6866 -Wcast-align
6867 Warn whenever a pointer is cast such that the required alignment of
6868 the target is increased. For example, warn if a "char *" is cast
6869 to an "int *" on machines where integers can only be accessed at
6870 two- or four-byte boundaries.
6871
6872 -Wcast-align=strict
6873 Warn whenever a pointer is cast such that the required alignment of
6874 the target is increased. For example, warn if a "char *" is cast
6875 to an "int *" regardless of the target machine.
6876
6877 -Wcast-function-type
6878 Warn when a function pointer is cast to an incompatible function
6879 pointer. In a cast involving function types with a variable
6880 argument list only the types of initial arguments that are provided
6881 are considered. Any parameter of pointer-type matches any other
6882 pointer-type. Any benign differences in integral types are
6883 ignored, like "int" vs. "long" on ILP32 targets. Likewise type
6884 qualifiers are ignored. The function type "void (*) (void)" is
6885 special and matches everything, which can be used to suppress this
6886 warning. In a cast involving pointer to member types this warning
6887 warns whenever the type cast is changing the pointer to member
6888 type. This warning is enabled by -Wextra.
6889
6890 -Wwrite-strings
6891 When compiling C, give string constants the type "const
6892 char[length]" so that copying the address of one into a non-"const"
6893 "char *" pointer produces a warning. These warnings help you find
6894 at compile time code that can try to write into a string constant,
6895 but only if you have been very careful about using "const" in
6896 declarations and prototypes. Otherwise, it is just a nuisance.
6897 This is why we did not make -Wall request these warnings.
6898
6899 When compiling C++, warn about the deprecated conversion from
6900 string literals to "char *". This warning is enabled by default
6901 for C++ programs.
6902
6903 -Wclobbered
6904 Warn for variables that might be changed by "longjmp" or "vfork".
6905 This warning is also enabled by -Wextra.
6906
6907 -Wconversion
6908 Warn for implicit conversions that may alter a value. This includes
6909 conversions between real and integer, like "abs (x)" when "x" is
6910 "double"; conversions between signed and unsigned, like "unsigned
6911 ui = -1"; and conversions to smaller types, like "sqrtf (M_PI)". Do
6912 not warn for explicit casts like "abs ((int) x)" and "ui =
6913 (unsigned) -1", or if the value is not changed by the conversion
6914 like in "abs (2.0)". Warnings about conversions between signed and
6915 unsigned integers can be disabled by using -Wno-sign-conversion.
6916
6917 For C++, also warn for confusing overload resolution for user-
6918 defined conversions; and conversions that never use a type
6919 conversion operator: conversions to "void", the same type, a base
6920 class or a reference to them. Warnings about conversions between
6921 signed and unsigned integers are disabled by default in C++ unless
6922 -Wsign-conversion is explicitly enabled.
6923
6924 Warnings about conversion from arithmetic on a small type back to
6925 that type are only given with -Warith-conversion.
6926
6927 -Wdangling-else
6928 Warn about constructions where there may be confusion to which "if"
6929 statement an "else" branch belongs. Here is an example of such a
6930 case:
6931
6932 {
6933 if (a)
6934 if (b)
6935 foo ();
6936 else
6937 bar ();
6938 }
6939
6940 In C/C++, every "else" branch belongs to the innermost possible
6941 "if" statement, which in this example is "if (b)". This is often
6942 not what the programmer expected, as illustrated in the above
6943 example by indentation the programmer chose. When there is the
6944 potential for this confusion, GCC issues a warning when this flag
6945 is specified. To eliminate the warning, add explicit braces around
6946 the innermost "if" statement so there is no way the "else" can
6947 belong to the enclosing "if". The resulting code looks like this:
6948
6949 {
6950 if (a)
6951 {
6952 if (b)
6953 foo ();
6954 else
6955 bar ();
6956 }
6957 }
6958
6959 This warning is enabled by -Wparentheses.
6960
6961 -Wdangling-pointer
6962 -Wdangling-pointer=n
6963 Warn about uses of pointers (or C++ references) to objects with
6964 automatic storage duration after their lifetime has ended. This
6965 includes local variables declared in nested blocks, compound
6966 literals and other unnamed temporary objects. In addition, warn
6967 about storing the address of such objects in escaped pointers. The
6968 warning is enabled at all optimization levels but may yield
6969 different results with optimization than without.
6970
6971 -Wdangling-pointer=1
6972 At level 1 the warning diagnoses only unconditional uses of
6973 dangling pointers. For example
6974
6975 int f (int c1, int c2, x)
6976 {
6977 char *p = strchr ((char[]){ c1, c2 }, c3);
6978 return p ? *p : 'x'; // warning: dangling pointer to a compound literal
6979 }
6980
6981 In the following function the store of the address of the local
6982 variable "x" in the escaped pointer *p also triggers the
6983 warning.
6984
6985 void g (int **p)
6986 {
6987 int x = 7;
6988 *p = &x; // warning: storing the address of a local variable in *p
6989 }
6990
6991 -Wdangling-pointer=2
6992 At level 2, in addition to unconditional uses the warning also
6993 diagnoses conditional uses of dangling pointers.
6994
6995 For example, because the array a in the following function is
6996 out of scope when the pointer s that was set to point is used,
6997 the warning triggers at this level.
6998
6999 void f (char *s)
7000 {
7001 if (!s)
7002 {
7003 char a[12] = "tmpname";
7004 s = a;
7005 }
7006 strcat (s, ".tmp"); // warning: dangling pointer to a may be used
7007 ...
7008 }
7009
7010 -Wdangling-pointer=2 is included in -Wall.
7011
7012 -Wdate-time
7013 Warn when macros "__TIME__", "__DATE__" or "__TIMESTAMP__" are
7014 encountered as they might prevent bit-wise-identical reproducible
7015 compilations.
7016
7017 -Wempty-body
7018 Warn if an empty body occurs in an "if", "else" or "do while"
7019 statement. This warning is also enabled by -Wextra.
7020
7021 -Wno-endif-labels
7022 Do not warn about stray tokens after "#else" and "#endif".
7023
7024 -Wenum-compare
7025 Warn about a comparison between values of different enumerated
7026 types. In C++ enumerated type mismatches in conditional
7027 expressions are also diagnosed and the warning is enabled by
7028 default. In C this warning is enabled by -Wall.
7029
7030 -Wenum-conversion
7031 Warn when a value of enumerated type is implicitly converted to a
7032 different enumerated type. This warning is enabled by -Wextra in
7033 C.
7034
7035 -Wjump-misses-init (C, Objective-C only)
7036 Warn if a "goto" statement or a "switch" statement jumps forward
7037 across the initialization of a variable, or jumps backward to a
7038 label after the variable has been initialized. This only warns
7039 about variables that are initialized when they are declared. This
7040 warning is only supported for C and Objective-C; in C++ this sort
7041 of branch is an error in any case.
7042
7043 -Wjump-misses-init is included in -Wc++-compat. It can be disabled
7044 with the -Wno-jump-misses-init option.
7045
7046 -Wsign-compare
7047 Warn when a comparison between signed and unsigned values could
7048 produce an incorrect result when the signed value is converted to
7049 unsigned. In C++, this warning is also enabled by -Wall. In C, it
7050 is also enabled by -Wextra.
7051
7052 -Wsign-conversion
7053 Warn for implicit conversions that may change the sign of an
7054 integer value, like assigning a signed integer expression to an
7055 unsigned integer variable. An explicit cast silences the warning.
7056 In C, this option is enabled also by -Wconversion.
7057
7058 -Wfloat-conversion
7059 Warn for implicit conversions that reduce the precision of a real
7060 value. This includes conversions from real to integer, and from
7061 higher precision real to lower precision real values. This option
7062 is also enabled by -Wconversion.
7063
7064 -Wno-scalar-storage-order
7065 Do not warn on suspicious constructs involving reverse scalar
7066 storage order.
7067
7068 -Wsizeof-array-div
7069 Warn about divisions of two sizeof operators when the first one is
7070 applied to an array and the divisor does not equal the size of the
7071 array element. In such a case, the computation will not yield the
7072 number of elements in the array, which is likely what the user
7073 intended. This warning warns e.g. about
7074
7075 int fn ()
7076 {
7077 int arr[10];
7078 return sizeof (arr) / sizeof (short);
7079 }
7080
7081 This warning is enabled by -Wall.
7082
7083 -Wsizeof-pointer-div
7084 Warn for suspicious divisions of two sizeof expressions that divide
7085 the pointer size by the element size, which is the usual way to
7086 compute the array size but won't work out correctly with pointers.
7087 This warning warns e.g. about "sizeof (ptr) / sizeof (ptr[0])" if
7088 "ptr" is not an array, but a pointer. This warning is enabled by
7089 -Wall.
7090
7091 -Wsizeof-pointer-memaccess
7092 Warn for suspicious length parameters to certain string and memory
7093 built-in functions if the argument uses "sizeof". This warning
7094 triggers for example for "memset (ptr, 0, sizeof (ptr));" if "ptr"
7095 is not an array, but a pointer, and suggests a possible fix, or
7096 about "memcpy (&foo, ptr, sizeof (&foo));".
7097 -Wsizeof-pointer-memaccess also warns about calls to bounded string
7098 copy functions like "strncat" or "strncpy" that specify as the
7099 bound a "sizeof" expression of the source array. For example, in
7100 the following function the call to "strncat" specifies the size of
7101 the source string as the bound. That is almost certainly a mistake
7102 and so the call is diagnosed.
7103
7104 void make_file (const char *name)
7105 {
7106 char path[PATH_MAX];
7107 strncpy (path, name, sizeof path - 1);
7108 strncat (path, ".text", sizeof ".text");
7109 ...
7110 }
7111
7112 The -Wsizeof-pointer-memaccess option is enabled by -Wall.
7113
7114 -Wno-sizeof-array-argument
7115 Do not warn when the "sizeof" operator is applied to a parameter
7116 that is declared as an array in a function definition. This
7117 warning is enabled by default for C and C++ programs.
7118
7119 -Wmemset-elt-size
7120 Warn for suspicious calls to the "memset" built-in function, if the
7121 first argument references an array, and the third argument is a
7122 number equal to the number of elements, but not equal to the size
7123 of the array in memory. This indicates that the user has omitted a
7124 multiplication by the element size. This warning is enabled by
7125 -Wall.
7126
7127 -Wmemset-transposed-args
7128 Warn for suspicious calls to the "memset" built-in function where
7129 the second argument is not zero and the third argument is zero.
7130 For example, the call "memset (buf, sizeof buf, 0)" is diagnosed
7131 because "memset (buf, 0, sizeof buf)" was meant instead. The
7132 diagnostic is only emitted if the third argument is a literal zero.
7133 Otherwise, if it is an expression that is folded to zero, or a cast
7134 of zero to some type, it is far less likely that the arguments have
7135 been mistakenly transposed and no warning is emitted. This warning
7136 is enabled by -Wall.
7137
7138 -Waddress
7139 Warn about suspicious uses of address expressions. These include
7140 comparing the address of a function or a declared object to the
7141 null pointer constant such as in
7142
7143 void f (void);
7144 void g (void)
7145 {
7146 if (!func) // warning: expression evaluates to false
7147 abort ();
7148 }
7149
7150 comparisons of a pointer to a string literal, such as in
7151
7152 void f (const char *x)
7153 {
7154 if (x == "abc") // warning: expression evaluates to false
7155 puts ("equal");
7156 }
7157
7158 and tests of the results of pointer addition or subtraction for
7159 equality to null, such as in
7160
7161 void f (const int *p, int i)
7162 {
7163 return p + i == NULL;
7164 }
7165
7166 Such uses typically indicate a programmer error: the address of
7167 most functions and objects necessarily evaluates to true (the
7168 exception are weak symbols), so their use in a conditional might
7169 indicate missing parentheses in a function call or a missing
7170 dereference in an array expression. The subset of the warning for
7171 object pointers can be suppressed by casting the pointer operand to
7172 an integer type such as "inptr_t" or "uinptr_t". Comparisons
7173 against string literals result in unspecified behavior and are not
7174 portable, and suggest the intent was to call "strcmp". The warning
7175 is suppressed if the suspicious expression is the result of macro
7176 expansion. -Waddress warning is enabled by -Wall.
7177
7178 -Wno-address-of-packed-member
7179 Do not warn when the address of packed member of struct or union is
7180 taken, which usually results in an unaligned pointer value. This
7181 is enabled by default.
7182
7183 -Wlogical-op
7184 Warn about suspicious uses of logical operators in expressions.
7185 This includes using logical operators in contexts where a bit-wise
7186 operator is likely to be expected. Also warns when the operands of
7187 a logical operator are the same:
7188
7189 extern int a;
7190 if (a < 0 && a < 0) { ... }
7191
7192 -Wlogical-not-parentheses
7193 Warn about logical not used on the left hand side operand of a
7194 comparison. This option does not warn if the right operand is
7195 considered to be a boolean expression. Its purpose is to detect
7196 suspicious code like the following:
7197
7198 int a;
7199 ...
7200 if (!a > 1) { ... }
7201
7202 It is possible to suppress the warning by wrapping the LHS into
7203 parentheses:
7204
7205 if ((!a) > 1) { ... }
7206
7207 This warning is enabled by -Wall.
7208
7209 -Waggregate-return
7210 Warn if any functions that return structures or unions are defined
7211 or called. (In languages where you can return an array, this also
7212 elicits a warning.)
7213
7214 -Wno-aggressive-loop-optimizations
7215 Warn if in a loop with constant number of iterations the compiler
7216 detects undefined behavior in some statement during one or more of
7217 the iterations.
7218
7219 -Wno-attributes
7220 Do not warn if an unexpected "__attribute__" is used, such as
7221 unrecognized attributes, function attributes applied to variables,
7222 etc. This does not stop errors for incorrect use of supported
7223 attributes.
7224
7225 Additionally, using -Wno-attributes=, it is possible to suppress
7226 warnings about unknown scoped attributes (in C++11 and C2X). For
7227 example, -Wno-attributes=vendor::attr disables warning about the
7228 following declaration:
7229
7230 [[vendor::attr]] void f();
7231
7232 It is also possible to disable warning about all attributes in a
7233 namespace using -Wno-attributes=vendor:: which prevents warning
7234 about both of these declarations:
7235
7236 [[vendor::safe]] void f();
7237 [[vendor::unsafe]] void f2();
7238
7239 Note that -Wno-attributes= does not imply -Wno-attributes.
7240
7241 -Wno-builtin-declaration-mismatch
7242 Warn if a built-in function is declared with an incompatible
7243 signature or as a non-function, or when a built-in function
7244 declared with a type that does not include a prototype is called
7245 with arguments whose promoted types do not match those expected by
7246 the function. When -Wextra is specified, also warn when a built-in
7247 function that takes arguments is declared without a prototype. The
7248 -Wbuiltin-declaration-mismatch warning is enabled by default. To
7249 avoid the warning include the appropriate header to bring the
7250 prototypes of built-in functions into scope.
7251
7252 For example, the call to "memset" below is diagnosed by the warning
7253 because the function expects a value of type "size_t" as its
7254 argument but the type of 32 is "int". With -Wextra, the
7255 declaration of the function is diagnosed as well.
7256
7257 extern void* memset ();
7258 void f (void *d)
7259 {
7260 memset (d, '\0', 32);
7261 }
7262
7263 -Wno-builtin-macro-redefined
7264 Do not warn if certain built-in macros are redefined. This
7265 suppresses warnings for redefinition of "__TIMESTAMP__",
7266 "__TIME__", "__DATE__", "__FILE__", and "__BASE_FILE__".
7267
7268 -Wstrict-prototypes (C and Objective-C only)
7269 Warn if a function is declared or defined without specifying the
7270 argument types. (An old-style function definition is permitted
7271 without a warning if preceded by a declaration that specifies the
7272 argument types.)
7273
7274 -Wold-style-declaration (C and Objective-C only)
7275 Warn for obsolescent usages, according to the C Standard, in a
7276 declaration. For example, warn if storage-class specifiers like
7277 "static" are not the first things in a declaration. This warning
7278 is also enabled by -Wextra.
7279
7280 -Wold-style-definition (C and Objective-C only)
7281 Warn if an old-style function definition is used. A warning is
7282 given even if there is a previous prototype. A definition using ()
7283 is not considered an old-style definition in C2X mode, because it
7284 is equivalent to (void) in that case, but is considered an old-
7285 style definition for older standards.
7286
7287 -Wmissing-parameter-type (C and Objective-C only)
7288 A function parameter is declared without a type specifier in
7289 K&R-style functions:
7290
7291 void foo(bar) { }
7292
7293 This warning is also enabled by -Wextra.
7294
7295 -Wmissing-prototypes (C and Objective-C only)
7296 Warn if a global function is defined without a previous prototype
7297 declaration. This warning is issued even if the definition itself
7298 provides a prototype. Use this option to detect global functions
7299 that do not have a matching prototype declaration in a header file.
7300 This option is not valid for C++ because all function declarations
7301 provide prototypes and a non-matching declaration declares an
7302 overload rather than conflict with an earlier declaration. Use
7303 -Wmissing-declarations to detect missing declarations in C++.
7304
7305 -Wmissing-declarations
7306 Warn if a global function is defined without a previous
7307 declaration. Do so even if the definition itself provides a
7308 prototype. Use this option to detect global functions that are not
7309 declared in header files. In C, no warnings are issued for
7310 functions with previous non-prototype declarations; use
7311 -Wmissing-prototypes to detect missing prototypes. In C++, no
7312 warnings are issued for function templates, or for inline
7313 functions, or for functions in anonymous namespaces.
7314
7315 -Wmissing-field-initializers
7316 Warn if a structure's initializer has some fields missing. For
7317 example, the following code causes such a warning, because "x.h" is
7318 implicitly zero:
7319
7320 struct s { int f, g, h; };
7321 struct s x = { 3, 4 };
7322
7323 This option does not warn about designated initializers, so the
7324 following modification does not trigger a warning:
7325
7326 struct s { int f, g, h; };
7327 struct s x = { .f = 3, .g = 4 };
7328
7329 In C this option does not warn about the universal zero initializer
7330 { 0 }:
7331
7332 struct s { int f, g, h; };
7333 struct s x = { 0 };
7334
7335 Likewise, in C++ this option does not warn about the empty { }
7336 initializer, for example:
7337
7338 struct s { int f, g, h; };
7339 s x = { };
7340
7341 This warning is included in -Wextra. To get other -Wextra warnings
7342 without this one, use -Wextra -Wno-missing-field-initializers.
7343
7344 -Wno-missing-requires
7345 By default, the compiler warns about a concept-id appearing as a
7346 C++20 simple-requirement:
7347
7348 bool satisfied = requires { C<T> };
7349
7350 Here satisfied will be true if C<T> is a valid expression, which it
7351 is for all T. Presumably the user meant to write
7352
7353 bool satisfied = requires { requires C<T> };
7354
7355 so satisfied is only true if concept C is satisfied for type T.
7356
7357 This warning can be disabled with -Wno-missing-requires.
7358
7359 -Wno-missing-template-keyword
7360 The member access tokens ., -> and :: must be followed by the
7361 "template" keyword if the parent object is dependent and the member
7362 being named is a template.
7363
7364 template <class X>
7365 void DoStuff (X x)
7366 {
7367 x.template DoSomeOtherStuff<X>(); // Good.
7368 x.DoMoreStuff<X>(); // Warning, x is dependent.
7369 }
7370
7371 In rare cases it is possible to get false positives. To silence
7372 this, wrap the expression in parentheses. For example, the
7373 following is treated as a template, even where m and N are
7374 integers:
7375
7376 void NotATemplate (my_class t)
7377 {
7378 int N = 5;
7379
7380 bool test = t.m < N > (0); // Treated as a template.
7381 test = (t.m < N) > (0); // Same meaning, but not treated as a template.
7382 }
7383
7384 This warning can be disabled with -Wno-missing-template-keyword.
7385
7386 -Wno-multichar
7387 Do not warn if a multicharacter constant ('FOOF') is used. Usually
7388 they indicate a typo in the user's code, as they have
7389 implementation-defined values, and should not be used in portable
7390 code.
7391
7392 -Wnormalized=[none|id|nfc|nfkc]
7393 In ISO C and ISO C++, two identifiers are different if they are
7394 different sequences of characters. However, sometimes when
7395 characters outside the basic ASCII character set are used, you can
7396 have two different character sequences that look the same. To
7397 avoid confusion, the ISO 10646 standard sets out some normalization
7398 rules which when applied ensure that two sequences that look the
7399 same are turned into the same sequence. GCC can warn you if you
7400 are using identifiers that have not been normalized; this option
7401 controls that warning.
7402
7403 There are four levels of warning supported by GCC. The default is
7404 -Wnormalized=nfc, which warns about any identifier that is not in
7405 the ISO 10646 "C" normalized form, NFC. NFC is the recommended
7406 form for most uses. It is equivalent to -Wnormalized.
7407
7408 Unfortunately, there are some characters allowed in identifiers by
7409 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7410 identifiers. That is, there's no way to use these symbols in
7411 portable ISO C or C++ and have all your identifiers in NFC.
7412 -Wnormalized=id suppresses the warning for these characters. It is
7413 hoped that future versions of the standards involved will correct
7414 this, which is why this option is not the default.
7415
7416 You can switch the warning off for all characters by writing
7417 -Wnormalized=none or -Wno-normalized. You should only do this if
7418 you are using some other normalization scheme (like "D"), because
7419 otherwise you can easily create bugs that are literally impossible
7420 to see.
7421
7422 Some characters in ISO 10646 have distinct meanings but look
7423 identical in some fonts or display methodologies, especially once
7424 formatting has been applied. For instance "\u207F", "SUPERSCRIPT
7425 LATIN SMALL LETTER N", displays just like a regular "n" that has
7426 been placed in a superscript. ISO 10646 defines the NFKC
7427 normalization scheme to convert all these into a standard form as
7428 well, and GCC warns if your code is not in NFKC if you use
7429 -Wnormalized=nfkc. This warning is comparable to warning about
7430 every identifier that contains the letter O because it might be
7431 confused with the digit 0, and so is not the default, but may be
7432 useful as a local coding convention if the programming environment
7433 cannot be fixed to display these characters distinctly.
7434
7435 -Wno-attribute-warning
7436 Do not warn about usage of functions declared with "warning"
7437 attribute. By default, this warning is enabled.
7438 -Wno-attribute-warning can be used to disable the warning or
7439 -Wno-error=attribute-warning can be used to disable the error when
7440 compiled with -Werror flag.
7441
7442 -Wno-deprecated
7443 Do not warn about usage of deprecated features.
7444
7445 -Wno-deprecated-declarations
7446 Do not warn about uses of functions, variables, and types marked as
7447 deprecated by using the "deprecated" attribute.
7448
7449 -Wno-overflow
7450 Do not warn about compile-time overflow in constant expressions.
7451
7452 -Wno-odr
7453 Warn about One Definition Rule violations during link-time
7454 optimization. Enabled by default.
7455
7456 -Wopenacc-parallelism
7457 Warn about potentially suboptimal choices related to OpenACC
7458 parallelism.
7459
7460 -Wopenmp-simd
7461 Warn if the vectorizer cost model overrides the OpenMP simd
7462 directive set by user. The -fsimd-cost-model=unlimited option can
7463 be used to relax the cost model.
7464
7465 -Woverride-init (C and Objective-C only)
7466 Warn if an initialized field without side effects is overridden
7467 when using designated initializers.
7468
7469 This warning is included in -Wextra. To get other -Wextra warnings
7470 without this one, use -Wextra -Wno-override-init.
7471
7472 -Wno-override-init-side-effects (C and Objective-C only)
7473 Do not warn if an initialized field with side effects is overridden
7474 when using designated initializers. This warning is enabled by
7475 default.
7476
7477 -Wpacked
7478 Warn if a structure is given the packed attribute, but the packed
7479 attribute has no effect on the layout or size of the structure.
7480 Such structures may be mis-aligned for little benefit. For
7481 instance, in this code, the variable "f.x" in "struct bar" is
7482 misaligned even though "struct bar" does not itself have the packed
7483 attribute:
7484
7485 struct foo {
7486 int x;
7487 char a, b, c, d;
7488 } __attribute__((packed));
7489 struct bar {
7490 char z;
7491 struct foo f;
7492 };
7493
7494 -Wnopacked-bitfield-compat
7495 The 4.1, 4.2 and 4.3 series of GCC ignore the "packed" attribute on
7496 bit-fields of type "char". This was fixed in GCC 4.4 but the
7497 change can lead to differences in the structure layout. GCC
7498 informs you when the offset of such a field has changed in GCC 4.4.
7499 For example there is no longer a 4-bit padding between field "a"
7500 and "b" in this structure:
7501
7502 struct foo
7503 {
7504 char a:4;
7505 char b:8;
7506 } __attribute__ ((packed));
7507
7508 This warning is enabled by default. Use
7509 -Wno-packed-bitfield-compat to disable this warning.
7510
7511 -Wpacked-not-aligned (C, C++, Objective-C and Objective-C++ only)
7512 Warn if a structure field with explicitly specified alignment in a
7513 packed struct or union is misaligned. For example, a warning will
7514 be issued on "struct S", like, "warning: alignment 1 of 'struct S'
7515 is less than 8", in this code:
7516
7517 struct __attribute__ ((aligned (8))) S8 { char a[8]; };
7518 struct __attribute__ ((packed)) S {
7519 struct S8 s8;
7520 };
7521
7522 This warning is enabled by -Wall.
7523
7524 -Wpadded
7525 Warn if padding is included in a structure, either to align an
7526 element of the structure or to align the whole structure.
7527 Sometimes when this happens it is possible to rearrange the fields
7528 of the structure to reduce the padding and so make the structure
7529 smaller.
7530
7531 -Wredundant-decls
7532 Warn if anything is declared more than once in the same scope, even
7533 in cases where multiple declaration is valid and changes nothing.
7534
7535 -Wrestrict
7536 Warn when an object referenced by a "restrict"-qualified parameter
7537 (or, in C++, a "__restrict"-qualified parameter) is aliased by
7538 another argument, or when copies between such objects overlap. For
7539 example, the call to the "strcpy" function below attempts to
7540 truncate the string by replacing its initial characters with the
7541 last four. However, because the call writes the terminating NUL
7542 into "a[4]", the copies overlap and the call is diagnosed.
7543
7544 void foo (void)
7545 {
7546 char a[] = "abcd1234";
7547 strcpy (a, a + 4);
7548 ...
7549 }
7550
7551 The -Wrestrict option detects some instances of simple overlap even
7552 without optimization but works best at -O2 and above. It is
7553 included in -Wall.
7554
7555 -Wnested-externs (C and Objective-C only)
7556 Warn if an "extern" declaration is encountered within a function.
7557
7558 -Winline
7559 Warn if a function that is declared as inline cannot be inlined.
7560 Even with this option, the compiler does not warn about failures to
7561 inline functions declared in system headers.
7562
7563 The compiler uses a variety of heuristics to determine whether or
7564 not to inline a function. For example, the compiler takes into
7565 account the size of the function being inlined and the amount of
7566 inlining that has already been done in the current function.
7567 Therefore, seemingly insignificant changes in the source program
7568 can cause the warnings produced by -Winline to appear or disappear.
7569
7570 -Winterference-size
7571 Warn about use of C++17
7572 "std::hardware_destructive_interference_size" without specifying
7573 its value with --param destructive-interference-size. Also warn
7574 about questionable values for that option.
7575
7576 This variable is intended to be used for controlling class layout,
7577 to avoid false sharing in concurrent code:
7578
7579 struct independent_fields {
7580 alignas(std::hardware_destructive_interference_size) std::atomic<int> one;
7581 alignas(std::hardware_destructive_interference_size) std::atomic<int> two;
7582 };
7583
7584 Here one and two are intended to be far enough apart that stores to
7585 one won't require accesses to the other to reload the cache line.
7586
7587 By default, --param destructive-interference-size and --param
7588 constructive-interference-size are set based on the current -mtune
7589 option, typically to the L1 cache line size for the particular
7590 target CPU, sometimes to a range if tuning for a generic target.
7591 So all translation units that depend on ABI compatibility for the
7592 use of these variables must be compiled with the same -mtune (or
7593 -mcpu).
7594
7595 If ABI stability is important, such as if the use is in a header
7596 for a library, you should probably not use the hardware
7597 interference size variables at all. Alternatively, you can force a
7598 particular value with --param.
7599
7600 If you are confident that your use of the variable does not affect
7601 ABI outside a single build of your project, you can turn off the
7602 warning with -Wno-interference-size.
7603
7604 -Wint-in-bool-context
7605 Warn for suspicious use of integer values where boolean values are
7606 expected, such as conditional expressions (?:) using non-boolean
7607 integer constants in boolean context, like "if (a <= b ? 2 : 3)".
7608 Or left shifting of signed integers in boolean context, like "for
7609 (a = 0; 1 << a; a++);". Likewise for all kinds of multiplications
7610 regardless of the data type. This warning is enabled by -Wall.
7611
7612 -Wno-int-to-pointer-cast
7613 Suppress warnings from casts to pointer type of an integer of a
7614 different size. In C++, casting to a pointer type of smaller size
7615 is an error. Wint-to-pointer-cast is enabled by default.
7616
7617 -Wno-pointer-to-int-cast (C and Objective-C only)
7618 Suppress warnings from casts from a pointer to an integer type of a
7619 different size.
7620
7621 -Winvalid-pch
7622 Warn if a precompiled header is found in the search path but cannot
7623 be used.
7624
7625 -Wlong-long
7626 Warn if "long long" type is used. This is enabled by either
7627 -Wpedantic or -Wtraditional in ISO C90 and C++98 modes. To inhibit
7628 the warning messages, use -Wno-long-long.
7629
7630 -Wvariadic-macros
7631 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7632 alternate syntax is used in ISO C99 mode. This is enabled by
7633 either -Wpedantic or -Wtraditional. To inhibit the warning
7634 messages, use -Wno-variadic-macros.
7635
7636 -Wno-varargs
7637 Do not warn upon questionable usage of the macros used to handle
7638 variable arguments like "va_start". These warnings are enabled by
7639 default.
7640
7641 -Wvector-operation-performance
7642 Warn if vector operation is not implemented via SIMD capabilities
7643 of the architecture. Mainly useful for the performance tuning.
7644 Vector operation can be implemented "piecewise", which means that
7645 the scalar operation is performed on every vector element; "in
7646 parallel", which means that the vector operation is implemented
7647 using scalars of wider type, which normally is more performance
7648 efficient; and "as a single scalar", which means that vector fits
7649 into a scalar type.
7650
7651 -Wvla
7652 Warn if a variable-length array is used in the code. -Wno-vla
7653 prevents the -Wpedantic warning of the variable-length array.
7654
7655 -Wvla-larger-than=byte-size
7656 If this option is used, the compiler warns for declarations of
7657 variable-length arrays whose size is either unbounded, or bounded
7658 by an argument that allows the array size to exceed byte-size
7659 bytes. This is similar to how -Walloca-larger-than=byte-size
7660 works, but with variable-length arrays.
7661
7662 Note that GCC may optimize small variable-length arrays of a known
7663 value into plain arrays, so this warning may not get triggered for
7664 such arrays.
7665
7666 -Wvla-larger-than=PTRDIFF_MAX is enabled by default but is
7667 typically only effective when -ftree-vrp is active (default for -O2
7668 and above).
7669
7670 See also -Walloca-larger-than=byte-size.
7671
7672 -Wno-vla-larger-than
7673 Disable -Wvla-larger-than= warnings. The option is equivalent to
7674 -Wvla-larger-than=SIZE_MAX or larger.
7675
7676 -Wvla-parameter
7677 Warn about redeclarations of functions involving arguments of
7678 Variable Length Array types of inconsistent kinds or forms, and
7679 enable the detection of out-of-bounds accesses to such parameters
7680 by warnings such as -Warray-bounds.
7681
7682 If the first function declaration uses the VLA form the bound
7683 specified in the array is assumed to be the minimum number of
7684 elements expected to be provided in calls to the function and the
7685 maximum number of elements accessed by it. Failing to provide
7686 arguments of sufficient size or accessing more than the maximum
7687 number of elements may be diagnosed.
7688
7689 For example, the warning triggers for the following redeclarations
7690 because the first one allows an array of any size to be passed to
7691 "f" while the second one specifies that the array argument must
7692 have at least "n" elements. In addition, calling "f" with the
7693 associated VLA bound parameter in excess of the actual VLA bound
7694 triggers a warning as well.
7695
7696 void f (int n, int[n]);
7697 void f (int, int[]); // warning: argument 2 previously declared as a VLA
7698
7699 void g (int n)
7700 {
7701 if (n > 4)
7702 return;
7703 int a[n];
7704 f (sizeof a, a); // warning: access to a by f may be out of bounds
7705 ...
7706 }
7707
7708 -Wvla-parameter is included in -Wall. The -Warray-parameter option
7709 triggers warnings for similar problems involving ordinary array
7710 arguments.
7711
7712 -Wvolatile-register-var
7713 Warn if a register variable is declared volatile. The volatile
7714 modifier does not inhibit all optimizations that may eliminate
7715 reads and/or writes to register variables. This warning is enabled
7716 by -Wall.
7717
7718 -Wdisabled-optimization
7719 Warn if a requested optimization pass is disabled. This warning
7720 does not generally indicate that there is anything wrong with your
7721 code; it merely indicates that GCC's optimizers are unable to
7722 handle the code effectively. Often, the problem is that your code
7723 is too big or too complex; GCC refuses to optimize programs when
7724 the optimization itself is likely to take inordinate amounts of
7725 time.
7726
7727 -Wpointer-sign (C and Objective-C only)
7728 Warn for pointer argument passing or assignment with different
7729 signedness. This option is only supported for C and Objective-C.
7730 It is implied by -Wall and by -Wpedantic, which can be disabled
7731 with -Wno-pointer-sign.
7732
7733 -Wstack-protector
7734 This option is only active when -fstack-protector is active. It
7735 warns about functions that are not protected against stack
7736 smashing.
7737
7738 -Woverlength-strings
7739 Warn about string constants that are longer than the "minimum
7740 maximum" length specified in the C standard. Modern compilers
7741 generally allow string constants that are much longer than the
7742 standard's minimum limit, but very portable programs should avoid
7743 using longer strings.
7744
7745 The limit applies after string constant concatenation, and does not
7746 count the trailing NUL. In C90, the limit was 509 characters; in
7747 C99, it was raised to 4095. C++98 does not specify a normative
7748 minimum maximum, so we do not diagnose overlength strings in C++.
7749
7750 This option is implied by -Wpedantic, and can be disabled with
7751 -Wno-overlength-strings.
7752
7753 -Wunsuffixed-float-constants (C and Objective-C only)
7754 Issue a warning for any floating constant that does not have a
7755 suffix. When used together with -Wsystem-headers it warns about
7756 such constants in system header files. This can be useful when
7757 preparing code to use with the "FLOAT_CONST_DECIMAL64" pragma from
7758 the decimal floating-point extension to C99.
7759
7760 -Wno-lto-type-mismatch
7761 During the link-time optimization, do not warn about type
7762 mismatches in global declarations from different compilation units.
7763 Requires -flto to be enabled. Enabled by default.
7764
7765 -Wno-designated-init (C and Objective-C only)
7766 Suppress warnings when a positional initializer is used to
7767 initialize a structure that has been marked with the
7768 "designated_init" attribute.
7769
7770 Options That Control Static Analysis
7771 -fanalyzer
7772 This option enables an static analysis of program flow which looks
7773 for "interesting" interprocedural paths through the code, and
7774 issues warnings for problems found on them.
7775
7776 This analysis is much more expensive than other GCC warnings.
7777
7778 Enabling this option effectively enables the following warnings:
7779
7780 -Wanalyzer-double-fclose -Wanalyzer-double-free
7781 -Wanalyzer-exposure-through-output-file -Wanalyzer-file-leak
7782 -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak
7783 -Wanalyzer-mismatching-deallocation -Wanalyzer-null-argument
7784 -Wanalyzer-null-dereference -Wanalyzer-possible-null-argument
7785 -Wanalyzer-possible-null-dereference
7786 -Wanalyzer-shift-count-negative -Wanalyzer-shift-count-overflow
7787 -Wanalyzer-stale-setjmp-buffer
7788 -Wanalyzer-unsafe-call-within-signal-handler
7789 -Wanalyzer-use-after-free
7790 -Wanalyzer-use-of-pointer-in-stale-stack-frame
7791 -Wanalyzer-use-of-uninitialized-value -Wanalyzer-write-to-const
7792 -Wanalyzer-write-to-string-literal
7793
7794 This option is only available if GCC was configured with analyzer
7795 support enabled.
7796
7797 -Wanalyzer-too-complex
7798 If -fanalyzer is enabled, the analyzer uses various heuristics to
7799 attempt to explore the control flow and data flow in the program,
7800 but these can be defeated by sufficiently complicated code.
7801
7802 By default, the analysis silently stops if the code is too
7803 complicated for the analyzer to fully explore and it reaches an
7804 internal limit. The -Wanalyzer-too-complex option warns if this
7805 occurs.
7806
7807 -Wno-analyzer-double-fclose
7808 This warning requires -fanalyzer, which enables it; use
7809 -Wno-analyzer-double-fclose to disable it.
7810
7811 This diagnostic warns for paths through the code in which a "FILE
7812 *" can have "fclose" called on it more than once.
7813
7814 -Wno-analyzer-double-free
7815 This warning requires -fanalyzer, which enables it; use
7816 -Wno-analyzer-double-free to disable it.
7817
7818 This diagnostic warns for paths through the code in which a pointer
7819 can have a deallocator called on it more than once, either "free",
7820 or a deallocator referenced by attribute "malloc".
7821
7822 -Wno-analyzer-exposure-through-output-file
7823 This warning requires -fanalyzer, which enables it; use
7824 -Wno-analyzer-exposure-through-output-file to disable it.
7825
7826 This diagnostic warns for paths through the code in which a
7827 security-sensitive value is written to an output file (such as
7828 writing a password to a log file).
7829
7830 -Wno-analyzer-file-leak
7831 This warning requires -fanalyzer, which enables it; use
7832 -Wno-analyzer-file-leak to disable it.
7833
7834 This diagnostic warns for paths through the code in which a
7835 "<stdio.h>" "FILE *" stream object is leaked.
7836
7837 -Wno-analyzer-free-of-non-heap
7838 This warning requires -fanalyzer, which enables it; use
7839 -Wno-analyzer-free-of-non-heap to disable it.
7840
7841 This diagnostic warns for paths through the code in which "free" is
7842 called on a non-heap pointer (e.g. an on-stack buffer, or a
7843 global).
7844
7845 -Wno-analyzer-malloc-leak
7846 This warning requires -fanalyzer, which enables it; use
7847 -Wno-analyzer-malloc-leak to disable it.
7848
7849 This diagnostic warns for paths through the code in which a pointer
7850 allocated via an allocator is leaked: either "malloc", or a
7851 function marked with attribute "malloc".
7852
7853 -Wno-analyzer-mismatching-deallocation
7854 This warning requires -fanalyzer, which enables it; use
7855 -Wno-analyzer-mismatching-deallocation to disable it.
7856
7857 This diagnostic warns for paths through the code in which the wrong
7858 deallocation function is called on a pointer value, based on which
7859 function was used to allocate the pointer value. The diagnostic
7860 will warn about mismatches between "free", scalar "delete" and
7861 vector "delete[]", and those marked as allocator/deallocator pairs
7862 using attribute "malloc".
7863
7864 -Wno-analyzer-possible-null-argument
7865 This warning requires -fanalyzer, which enables it; use
7866 -Wno-analyzer-possible-null-argument to disable it.
7867
7868 This diagnostic warns for paths through the code in which a
7869 possibly-NULL value is passed to a function argument marked with
7870 "__attribute__((nonnull))" as requiring a non-NULL value.
7871
7872 -Wno-analyzer-possible-null-dereference
7873 This warning requires -fanalyzer, which enables it; use
7874 -Wno-analyzer-possible-null-dereference to disable it.
7875
7876 This diagnostic warns for paths through the code in which a
7877 possibly-NULL value is dereferenced.
7878
7879 -Wno-analyzer-null-argument
7880 This warning requires -fanalyzer, which enables it; use
7881 -Wno-analyzer-null-argument to disable it.
7882
7883 This diagnostic warns for paths through the code in which a value
7884 known to be NULL is passed to a function argument marked with
7885 "__attribute__((nonnull))" as requiring a non-NULL value.
7886
7887 -Wno-analyzer-null-dereference
7888 This warning requires -fanalyzer, which enables it; use
7889 -Wno-analyzer-null-dereference to disable it.
7890
7891 This diagnostic warns for paths through the code in which a value
7892 known to be NULL is dereferenced.
7893
7894 -Wno-analyzer-shift-count-negative
7895 This warning requires -fanalyzer, which enables it; use
7896 -Wno-analyzer-shift-count-negative to disable it.
7897
7898 This diagnostic warns for paths through the code in which a shift
7899 is attempted with a negative count. It is analogous to the
7900 -Wshift-count-negative diagnostic implemented in the C/C++ front
7901 ends, but is implemented based on analyzing interprocedural paths,
7902 rather than merely parsing the syntax tree. However, the analyzer
7903 does not prioritize detection of such paths, so false negatives are
7904 more likely relative to other warnings.
7905
7906 -Wno-analyzer-shift-count-overflow
7907 This warning requires -fanalyzer, which enables it; use
7908 -Wno-analyzer-shift-count-overflow to disable it.
7909
7910 This diagnostic warns for paths through the code in which a shift
7911 is attempted with a count greater than or equal to the precision of
7912 the operand's type. It is analogous to the -Wshift-count-overflow
7913 diagnostic implemented in the C/C++ front ends, but is implemented
7914 based on analyzing interprocedural paths, rather than merely
7915 parsing the syntax tree. However, the analyzer does not prioritize
7916 detection of such paths, so false negatives are more likely
7917 relative to other warnings.
7918
7919 -Wno-analyzer-stale-setjmp-buffer
7920 This warning requires -fanalyzer, which enables it; use
7921 -Wno-analyzer-stale-setjmp-buffer to disable it.
7922
7923 This diagnostic warns for paths through the code in which "longjmp"
7924 is called to rewind to a "jmp_buf" relating to a "setjmp" call in a
7925 function that has returned.
7926
7927 When "setjmp" is called on a "jmp_buf" to record a rewind location,
7928 it records the stack frame. The stack frame becomes invalid when
7929 the function containing the "setjmp" call returns. Attempting to
7930 rewind to it via "longjmp" would reference a stack frame that no
7931 longer exists, and likely lead to a crash (or worse).
7932
7933 -Wno-analyzer-tainted-allocation-size
7934 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7935 to enable it; use -Wno-analyzer-tainted-allocation-size to disable
7936 it.
7937
7938 This diagnostic warns for paths through the code in which a value
7939 that could be under an attacker's control is used as the size of an
7940 allocation without being sanitized, so that an attacker could
7941 inject an excessively large allocation and potentially cause a
7942 denial of service attack.
7943
7944 See @url{https://cwe.mitre.org/data/definitions/789.html, CWE-789:
7945 Memory Allocation with Excessive Size Value}.
7946
7947 -Wno-analyzer-tainted-array-index
7948 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7949 to enable it; use -Wno-analyzer-tainted-array-index to disable it.
7950
7951 This diagnostic warns for paths through the code in which a value
7952 that could be under an attacker's control is used as the index of
7953 an array access without being sanitized, so that an attacker could
7954 inject an out-of-bounds access.
7955
7956 See @url{https://cwe.mitre.org/data/definitions/129.html, CWE-129:
7957 Improper Validation of Array Index}.
7958
7959 -Wno-analyzer-tainted-divisor
7960 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7961 to enable it; use -Wno-analyzer-tainted-divisor to disable it.
7962
7963 This diagnostic warns for paths through the code in which a value
7964 that could be under an attacker's control is used as the divisor in
7965 a division or modulus operation without being sanitized, so that an
7966 attacker could inject a division-by-zero.
7967
7968 -Wno-analyzer-tainted-offset
7969 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7970 to enable it; use -Wno-analyzer-tainted-offset to disable it.
7971
7972 This diagnostic warns for paths through the code in which a value
7973 that could be under an attacker's control is used as a pointer
7974 offset without being sanitized, so that an attacker could inject an
7975 out-of-bounds access.
7976
7977 See @url{https://cwe.mitre.org/data/definitions/823.html, CWE-823:
7978 Use of Out-of-range Pointer Offset}.
7979
7980 -Wno-analyzer-tainted-size
7981 This warning requires both -fanalyzer and -fanalyzer-checker=taint
7982 to enable it; use -Wno-analyzer-tainted-size to disable it.
7983
7984 This diagnostic warns for paths through the code in which a value
7985 that could be under an attacker's control is used as the size of an
7986 operation such as "memset" without being sanitized, so that an
7987 attacker could inject an out-of-bounds access.
7988
7989 -Wno-analyzer-unsafe-call-within-signal-handler
7990 This warning requires -fanalyzer, which enables it; use
7991 -Wno-analyzer-unsafe-call-within-signal-handler to disable it.
7992
7993 This diagnostic warns for paths through the code in which a
7994 function known to be async-signal-unsafe (such as "fprintf") is
7995 called from a signal handler.
7996
7997 -Wno-analyzer-use-after-free
7998 This warning requires -fanalyzer, which enables it; use
7999 -Wno-analyzer-use-after-free to disable it.
8000
8001 This diagnostic warns for paths through the code in which a pointer
8002 is used after a deallocator is called on it: either "free", or a
8003 deallocator referenced by attribute "malloc".
8004
8005 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
8006 This warning requires -fanalyzer, which enables it; use
8007 -Wno-analyzer-use-of-pointer-in-stale-stack-frame to disable it.
8008
8009 This diagnostic warns for paths through the code in which a pointer
8010 is dereferenced that points to a variable in a stale stack frame.
8011
8012 -Wno-analyzer-write-to-const
8013 This warning requires -fanalyzer, which enables it; use
8014 -Wno-analyzer-write-to-const to disable it.
8015
8016 This diagnostic warns for paths through the code in which the
8017 analyzer detects an attempt to write through a pointer to a "const"
8018 object. However, the analyzer does not prioritize detection of
8019 such paths, so false negatives are more likely relative to other
8020 warnings.
8021
8022 -Wno-analyzer-write-to-string-literal
8023 This warning requires -fanalyzer, which enables it; use
8024 -Wno-analyzer-write-to-string-literal to disable it.
8025
8026 This diagnostic warns for paths through the code in which the
8027 analyzer detects an attempt to write through a pointer to a string
8028 literal. However, the analyzer does not prioritize detection of
8029 such paths, so false negatives are more likely relative to other
8030 warnings.
8031
8032 -Wno-analyzer-use-of-uninitialized-value
8033 This warning requires -fanalyzer, which enables it; use
8034 -Wno-analyzer-use-of-uninitialized-value to disable it.
8035
8036 This diagnostic warns for paths through the code in which an
8037 uninitialized value is used.
8038
8039 Pertinent parameters for controlling the exploration are: --param
8040 analyzer-bb-explosion-factor=value, --param
8041 analyzer-max-enodes-per-program-point=value, --param
8042 analyzer-max-recursion-depth=value, and --param
8043 analyzer-min-snodes-for-call-summary=value.
8044
8045 The following options control the analyzer.
8046
8047 -fanalyzer-call-summaries
8048 Simplify interprocedural analysis by computing the effect of
8049 certain calls, rather than exploring all paths through the function
8050 from callsite to each possible return.
8051
8052 If enabled, call summaries are only used for functions with more
8053 than one call site, and that are sufficiently complicated (as per
8054 --param analyzer-min-snodes-for-call-summary=value).
8055
8056 -fanalyzer-checker=name
8057 Restrict the analyzer to run just the named checker, and enable it.
8058
8059 Some checkers are disabled by default (even with -fanalyzer), such
8060 as the "taint" checker that implements
8061 -Wanalyzer-tainted-array-index, and this option is required to
8062 enable them.
8063
8064 Note: currently, -fanalyzer-checker=taint disables the following
8065 warnings from -fanalyzer:
8066
8067 -Wanalyzer-double-fclose -Wanalyzer-double-free
8068 -Wanalyzer-exposure-through-output-file -Wanalyzer-file-leak
8069 -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak
8070 -Wanalyzer-mismatching-deallocation -Wanalyzer-null-argument
8071 -Wanalyzer-null-dereference -Wanalyzer-possible-null-argument
8072 -Wanalyzer-possible-null-dereference
8073 -Wanalyzer-unsafe-call-within-signal-handler
8074 -Wanalyzer-use-after-free
8075
8076 -fno-analyzer-feasibility
8077 This option is intended for analyzer developers.
8078
8079 By default the analyzer verifies that there is a feasible control
8080 flow path for each diagnostic it emits: that the conditions that
8081 hold are not mutually exclusive. Diagnostics for which no feasible
8082 path can be found are rejected. This filtering can be suppressed
8083 with -fno-analyzer-feasibility, for debugging issues in this code.
8084
8085 -fanalyzer-fine-grained
8086 This option is intended for analyzer developers.
8087
8088 Internally the analyzer builds an "exploded graph" that combines
8089 control flow graphs with data flow information.
8090
8091 By default, an edge in this graph can contain the effects of a run
8092 of multiple statements within a basic block. With
8093 -fanalyzer-fine-grained, each statement gets its own edge.
8094
8095 -fanalyzer-show-duplicate-count
8096 This option is intended for analyzer developers: if multiple
8097 diagnostics have been detected as being duplicates of each other,
8098 it emits a note when reporting the best diagnostic, giving the
8099 number of additional diagnostics that were suppressed by the
8100 deduplication logic.
8101
8102 -fno-analyzer-state-merge
8103 This option is intended for analyzer developers.
8104
8105 By default the analyzer attempts to simplify analysis by merging
8106 sufficiently similar states at each program point as it builds its
8107 "exploded graph". With -fno-analyzer-state-merge this merging can
8108 be suppressed, for debugging state-handling issues.
8109
8110 -fno-analyzer-state-purge
8111 This option is intended for analyzer developers.
8112
8113 By default the analyzer attempts to simplify analysis by purging
8114 aspects of state at a program point that appear to no longer be
8115 relevant e.g. the values of locals that aren't accessed later in
8116 the function and which aren't relevant to leak analysis.
8117
8118 With -fno-analyzer-state-purge this purging of state can be
8119 suppressed, for debugging state-handling issues.
8120
8121 -fanalyzer-transitivity
8122 This option enables transitivity of constraints within the
8123 analyzer.
8124
8125 -fanalyzer-verbose-edges
8126 This option is intended for analyzer developers. It enables more
8127 verbose, lower-level detail in the descriptions of control flow
8128 within diagnostic paths.
8129
8130 -fanalyzer-verbose-state-changes
8131 This option is intended for analyzer developers. It enables more
8132 verbose, lower-level detail in the descriptions of events relating
8133 to state machines within diagnostic paths.
8134
8135 -fanalyzer-verbosity=level
8136 This option controls the complexity of the control flow paths that
8137 are emitted for analyzer diagnostics.
8138
8139 The level can be one of:
8140
8141 0 At this level, interprocedural call and return events are
8142 displayed, along with the most pertinent state-change events
8143 relating to a diagnostic. For example, for a double-"free"
8144 diagnostic, both calls to "free" will be shown.
8145
8146 1 As per the previous level, but also show events for the entry
8147 to each function.
8148
8149 2 As per the previous level, but also show events relating to
8150 control flow that are significant to triggering the issue (e.g.
8151 "true path taken" at a conditional).
8152
8153 This level is the default.
8154
8155 3 As per the previous level, but show all control flow events,
8156 not just significant ones.
8157
8158 4 This level is intended for analyzer developers; it adds various
8159 other events intended for debugging the analyzer.
8160
8161 -fdump-analyzer
8162 Dump internal details about what the analyzer is doing to
8163 file.analyzer.txt. This option is overridden by
8164 -fdump-analyzer-stderr.
8165
8166 -fdump-analyzer-stderr
8167 Dump internal details about what the analyzer is doing to stderr.
8168 This option overrides -fdump-analyzer.
8169
8170 -fdump-analyzer-callgraph
8171 Dump a representation of the call graph suitable for viewing with
8172 GraphViz to file.callgraph.dot.
8173
8174 -fdump-analyzer-exploded-graph
8175 Dump a representation of the "exploded graph" suitable for viewing
8176 with GraphViz to file.eg.dot. Nodes are color-coded based on
8177 state-machine states to emphasize state changes.
8178
8179 -fdump-analyzer-exploded-nodes
8180 Emit diagnostics showing where nodes in the "exploded graph" are in
8181 relation to the program source.
8182
8183 -fdump-analyzer-exploded-nodes-2
8184 Dump a textual representation of the "exploded graph" to
8185 file.eg.txt.
8186
8187 -fdump-analyzer-exploded-nodes-3
8188 Dump a textual representation of the "exploded graph" to one dump
8189 file per node, to file.eg-id.txt. This is typically a large number
8190 of dump files.
8191
8192 -fdump-analyzer-exploded-paths
8193 Dump a textual representation of the "exploded path" for each
8194 diagnostic to file.idx.kind.epath.txt.
8195
8196 -fdump-analyzer-feasibility
8197 Dump internal details about the analyzer's search for feasible
8198 paths. The details are written in a form suitable for viewing with
8199 GraphViz to filenames of the form file.*.fg.dot and file.*.tg.dot.
8200
8201 -fdump-analyzer-json
8202 Dump a compressed JSON representation of analyzer internals to
8203 file.analyzer.json.gz. The precise format is subject to change.
8204
8205 -fdump-analyzer-state-purge
8206 As per -fdump-analyzer-supergraph, dump a representation of the
8207 "supergraph" suitable for viewing with GraphViz, but annotate the
8208 graph with information on what state will be purged at each node.
8209 The graph is written to file.state-purge.dot.
8210
8211 -fdump-analyzer-supergraph
8212 Dump representations of the "supergraph" suitable for viewing with
8213 GraphViz to file.supergraph.dot and to file.supergraph-eg.dot.
8214 These show all of the control flow graphs in the program, with
8215 interprocedural edges for calls and returns. The second dump
8216 contains annotations showing nodes in the "exploded graph" and
8217 diagnostics associated with them.
8218
8219 -fdump-analyzer-untracked
8220 Emit custom warnings with internal details intended for analyzer
8221 developers.
8222
8223 Options for Debugging Your Program
8224 To tell GCC to emit extra information for use by a debugger, in almost
8225 all cases you need only to add -g to your other options. Some debug
8226 formats can co-exist (like DWARF with CTF) when each of them is enabled
8227 explicitly by adding the respective command line option to your other
8228 options.
8229
8230 GCC allows you to use -g with -O. The shortcuts taken by optimized
8231 code may occasionally be surprising: some variables you declared may
8232 not exist at all; flow of control may briefly move where you did not
8233 expect it; some statements may not be executed because they compute
8234 constant results or their values are already at hand; some statements
8235 may execute in different places because they have been moved out of
8236 loops. Nevertheless it is possible to debug optimized output. This
8237 makes it reasonable to use the optimizer for programs that might have
8238 bugs.
8239
8240 If you are not using some other optimization option, consider using -Og
8241 with -g. With no -O option at all, some compiler passes that collect
8242 information useful for debugging do not run at all, so that -Og may
8243 result in a better debugging experience.
8244
8245 -g Produce debugging information in the operating system's native
8246 format (stabs, COFF, XCOFF, or DWARF). GDB can work with this
8247 debugging information.
8248
8249 On most systems that use stabs format, -g enables use of extra
8250 debugging information that only GDB can use; this extra information
8251 makes debugging work better in GDB but probably makes other
8252 debuggers crash or refuse to read the program. If you want to
8253 control for certain whether to generate the extra information, use
8254 -gstabs+, -gstabs, -gxcoff+, -gxcoff, or -gvms (see below).
8255
8256 -ggdb
8257 Produce debugging information for use by GDB. This means to use
8258 the most expressive format available (DWARF, stabs, or the native
8259 format if neither of those are supported), including GDB extensions
8260 if at all possible.
8261
8262 -gdwarf
8263 -gdwarf-version
8264 Produce debugging information in DWARF format (if that is
8265 supported). The value of version may be either 2, 3, 4 or 5; the
8266 default version for most targets is 5 (with the exception of
8267 VxWorks, TPF and Darwin/Mac OS X, which default to version 2, and
8268 AIX, which defaults to version 4).
8269
8270 Note that with DWARF Version 2, some ports require and always use
8271 some non-conflicting DWARF 3 extensions in the unwind tables.
8272
8273 Version 4 may require GDB 7.0 and -fvar-tracking-assignments for
8274 maximum benefit. Version 5 requires GDB 8.0 or higher.
8275
8276 GCC no longer supports DWARF Version 1, which is substantially
8277 different than Version 2 and later. For historical reasons, some
8278 other DWARF-related options such as -fno-dwarf2-cfi-asm) retain a
8279 reference to DWARF Version 2 in their names, but apply to all
8280 currently-supported versions of DWARF.
8281
8282 -gbtf
8283 Request BTF debug information. BTF is the default debugging format
8284 for the eBPF target. On other targets, like x86, BTF debug
8285 information can be generated along with DWARF debug information
8286 when both of the debug formats are enabled explicitly via their
8287 respective command line options.
8288
8289 -gctf
8290 -gctflevel
8291 Request CTF debug information and use level to specify how much CTF
8292 debug information should be produced. If -gctf is specified
8293 without a value for level, the default level of CTF debug
8294 information is 2.
8295
8296 CTF debug information can be generated along with DWARF debug
8297 information when both of the debug formats are enabled explicitly
8298 via their respective command line options.
8299
8300 Level 0 produces no CTF debug information at all. Thus, -gctf0
8301 negates -gctf.
8302
8303 Level 1 produces CTF information for tracebacks only. This
8304 includes callsite information, but does not include type
8305 information.
8306
8307 Level 2 produces type information for entities (functions, data
8308 objects etc.) at file-scope or global-scope only.
8309
8310 -gstabs
8311 Produce debugging information in stabs format (if that is
8312 supported), without GDB extensions. This is the format used by DBX
8313 on most BSD systems. On MIPS, Alpha and System V Release 4 systems
8314 this option produces stabs debugging output that is not understood
8315 by DBX. On System V Release 4 systems this option requires the GNU
8316 assembler.
8317
8318 -gstabs+
8319 Produce debugging information in stabs format (if that is
8320 supported), using GNU extensions understood only by the GNU
8321 debugger (GDB). The use of these extensions is likely to make
8322 other debuggers crash or refuse to read the program.
8323
8324 -gxcoff
8325 Produce debugging information in XCOFF format (if that is
8326 supported). This is the format used by the DBX debugger on IBM
8327 RS/6000 systems.
8328
8329 -gxcoff+
8330 Produce debugging information in XCOFF format (if that is
8331 supported), using GNU extensions understood only by the GNU
8332 debugger (GDB). The use of these extensions is likely to make
8333 other debuggers crash or refuse to read the program, and may cause
8334 assemblers other than the GNU assembler (GAS) to fail with an
8335 error.
8336
8337 -gvms
8338 Produce debugging information in Alpha/VMS debug format (if that is
8339 supported). This is the format used by DEBUG on Alpha/VMS systems.
8340
8341 -glevel
8342 -ggdblevel
8343 -gstabslevel
8344 -gxcofflevel
8345 -gvmslevel
8346 Request debugging information and also use level to specify how
8347 much information. The default level is 2.
8348
8349 Level 0 produces no debug information at all. Thus, -g0 negates
8350 -g.
8351
8352 Level 1 produces minimal information, enough for making backtraces
8353 in parts of the program that you don't plan to debug. This
8354 includes descriptions of functions and external variables, and line
8355 number tables, but no information about local variables.
8356
8357 Level 3 includes extra information, such as all the macro
8358 definitions present in the program. Some debuggers support macro
8359 expansion when you use -g3.
8360
8361 If you use multiple -g options, with or without level numbers, the
8362 last such option is the one that is effective.
8363
8364 -gdwarf does not accept a concatenated debug level, to avoid
8365 confusion with -gdwarf-level. Instead use an additional -glevel
8366 option to change the debug level for DWARF.
8367
8368 -fno-eliminate-unused-debug-symbols
8369 By default, no debug information is produced for symbols that are
8370 not actually used. Use this option if you want debug information
8371 for all symbols.
8372
8373 -femit-class-debug-always
8374 Instead of emitting debugging information for a C++ class in only
8375 one object file, emit it in all object files using the class. This
8376 option should be used only with debuggers that are unable to handle
8377 the way GCC normally emits debugging information for classes
8378 because using this option increases the size of debugging
8379 information by as much as a factor of two.
8380
8381 -fno-merge-debug-strings
8382 Direct the linker to not merge together strings in the debugging
8383 information that are identical in different object files. Merging
8384 is not supported by all assemblers or linkers. Merging decreases
8385 the size of the debug information in the output file at the cost of
8386 increasing link processing time. Merging is enabled by default.
8387
8388 -fdebug-prefix-map=old=new
8389 When compiling files residing in directory old, record debugging
8390 information describing them as if the files resided in directory
8391 new instead. This can be used to replace a build-time path with an
8392 install-time path in the debug info. It can also be used to change
8393 an absolute path to a relative path by using . for new. This can
8394 give more reproducible builds, which are location independent, but
8395 may require an extra command to tell GDB where to find the source
8396 files. See also -ffile-prefix-map.
8397
8398 -fvar-tracking
8399 Run variable tracking pass. It computes where variables are stored
8400 at each position in code. Better debugging information is then
8401 generated (if the debugging information format supports this
8402 information).
8403
8404 It is enabled by default when compiling with optimization (-Os, -O,
8405 -O2, ...), debugging information (-g) and the debug info format
8406 supports it.
8407
8408 -fvar-tracking-assignments
8409 Annotate assignments to user variables early in the compilation and
8410 attempt to carry the annotations over throughout the compilation
8411 all the way to the end, in an attempt to improve debug information
8412 while optimizing. Use of -gdwarf-4 is recommended along with it.
8413
8414 It can be enabled even if var-tracking is disabled, in which case
8415 annotations are created and maintained, but discarded at the end.
8416 By default, this flag is enabled together with -fvar-tracking,
8417 except when selective scheduling is enabled.
8418
8419 -gsplit-dwarf
8420 If DWARF debugging information is enabled, separate as much
8421 debugging information as possible into a separate output file with
8422 the extension .dwo. This option allows the build system to avoid
8423 linking files with debug information. To be useful, this option
8424 requires a debugger capable of reading .dwo files.
8425
8426 -gdwarf32
8427 -gdwarf64
8428 If DWARF debugging information is enabled, the -gdwarf32 selects
8429 the 32-bit DWARF format and the -gdwarf64 selects the 64-bit DWARF
8430 format. The default is target specific, on most targets it is
8431 -gdwarf32 though. The 32-bit DWARF format is smaller, but can't
8432 support more than 2GiB of debug information in any of the DWARF
8433 debug information sections. The 64-bit DWARF format allows larger
8434 debug information and might not be well supported by all consumers
8435 yet.
8436
8437 -gdescribe-dies
8438 Add description attributes to some DWARF DIEs that have no name
8439 attribute, such as artificial variables, external references and
8440 call site parameter DIEs.
8441
8442 -gpubnames
8443 Generate DWARF ".debug_pubnames" and ".debug_pubtypes" sections.
8444
8445 -ggnu-pubnames
8446 Generate ".debug_pubnames" and ".debug_pubtypes" sections in a
8447 format suitable for conversion into a GDB index. This option is
8448 only useful with a linker that can produce GDB index version 7.
8449
8450 -fdebug-types-section
8451 When using DWARF Version 4 or higher, type DIEs can be put into
8452 their own ".debug_types" section instead of making them part of the
8453 ".debug_info" section. It is more efficient to put them in a
8454 separate comdat section since the linker can then remove
8455 duplicates. But not all DWARF consumers support ".debug_types"
8456 sections yet and on some objects ".debug_types" produces larger
8457 instead of smaller debugging information.
8458
8459 -grecord-gcc-switches
8460 -gno-record-gcc-switches
8461 This switch causes the command-line options used to invoke the
8462 compiler that may affect code generation to be appended to the
8463 DW_AT_producer attribute in DWARF debugging information. The
8464 options are concatenated with spaces separating them from each
8465 other and from the compiler version. It is enabled by default.
8466 See also -frecord-gcc-switches for another way of storing compiler
8467 options into the object file.
8468
8469 -gstrict-dwarf
8470 Disallow using extensions of later DWARF standard version than
8471 selected with -gdwarf-version. On most targets using non-
8472 conflicting DWARF extensions from later standard versions is
8473 allowed.
8474
8475 -gno-strict-dwarf
8476 Allow using extensions of later DWARF standard version than
8477 selected with -gdwarf-version.
8478
8479 -gas-loc-support
8480 Inform the compiler that the assembler supports ".loc" directives.
8481 It may then use them for the assembler to generate DWARF2+ line
8482 number tables.
8483
8484 This is generally desirable, because assembler-generated line-
8485 number tables are a lot more compact than those the compiler can
8486 generate itself.
8487
8488 This option will be enabled by default if, at GCC configure time,
8489 the assembler was found to support such directives.
8490
8491 -gno-as-loc-support
8492 Force GCC to generate DWARF2+ line number tables internally, if
8493 DWARF2+ line number tables are to be generated.
8494
8495 -gas-locview-support
8496 Inform the compiler that the assembler supports "view" assignment
8497 and reset assertion checking in ".loc" directives.
8498
8499 This option will be enabled by default if, at GCC configure time,
8500 the assembler was found to support them.
8501
8502 -gno-as-locview-support
8503 Force GCC to assign view numbers internally, if
8504 -gvariable-location-views are explicitly requested.
8505
8506 -gcolumn-info
8507 -gno-column-info
8508 Emit location column information into DWARF debugging information,
8509 rather than just file and line. This option is enabled by default.
8510
8511 -gstatement-frontiers
8512 -gno-statement-frontiers
8513 This option causes GCC to create markers in the internal
8514 representation at the beginning of statements, and to keep them
8515 roughly in place throughout compilation, using them to guide the
8516 output of "is_stmt" markers in the line number table. This is
8517 enabled by default when compiling with optimization (-Os, -O1, -O2,
8518 ...), and outputting DWARF 2 debug information at the normal level.
8519
8520 -gvariable-location-views
8521 -gvariable-location-views=incompat5
8522 -gno-variable-location-views
8523 Augment variable location lists with progressive view numbers
8524 implied from the line number table. This enables debug information
8525 consumers to inspect state at certain points of the program, even
8526 if no instructions associated with the corresponding source
8527 locations are present at that point. If the assembler lacks
8528 support for view numbers in line number tables, this will cause the
8529 compiler to emit the line number table, which generally makes them
8530 somewhat less compact. The augmented line number tables and
8531 location lists are fully backward-compatible, so they can be
8532 consumed by debug information consumers that are not aware of these
8533 augmentations, but they won't derive any benefit from them either.
8534
8535 This is enabled by default when outputting DWARF 2 debug
8536 information at the normal level, as long as there is assembler
8537 support, -fvar-tracking-assignments is enabled and -gstrict-dwarf
8538 is not. When assembler support is not available, this may still be
8539 enabled, but it will force GCC to output internal line number
8540 tables, and if -ginternal-reset-location-views is not enabled, that
8541 will most certainly lead to silently mismatching location views.
8542
8543 There is a proposed representation for view numbers that is not
8544 backward compatible with the location list format introduced in
8545 DWARF 5, that can be enabled with
8546 -gvariable-location-views=incompat5. This option may be removed in
8547 the future, is only provided as a reference implementation of the
8548 proposed representation. Debug information consumers are not
8549 expected to support this extended format, and they would be
8550 rendered unable to decode location lists using it.
8551
8552 -ginternal-reset-location-views
8553 -gno-internal-reset-location-views
8554 Attempt to determine location views that can be omitted from
8555 location view lists. This requires the compiler to have very
8556 accurate insn length estimates, which isn't always the case, and it
8557 may cause incorrect view lists to be generated silently when using
8558 an assembler that does not support location view lists. The GNU
8559 assembler will flag any such error as a "view number mismatch".
8560 This is only enabled on ports that define a reliable estimation
8561 function.
8562
8563 -ginline-points
8564 -gno-inline-points
8565 Generate extended debug information for inlined functions.
8566 Location view tracking markers are inserted at inlined entry
8567 points, so that address and view numbers can be computed and output
8568 in debug information. This can be enabled independently of
8569 location views, in which case the view numbers won't be output, but
8570 it can only be enabled along with statement frontiers, and it is
8571 only enabled by default if location views are enabled.
8572
8573 -gz[=type]
8574 Produce compressed debug sections in DWARF format, if that is
8575 supported. If type is not given, the default type depends on the
8576 capabilities of the assembler and linker used. type may be one of
8577 none (don't compress debug sections), zlib (use zlib compression in
8578 ELF gABI format), or zlib-gnu (use zlib compression in traditional
8579 GNU format). If the linker doesn't support writing compressed
8580 debug sections, the option is rejected. Otherwise, if the
8581 assembler does not support them, -gz is silently ignored when
8582 producing object files.
8583
8584 -femit-struct-debug-baseonly
8585 Emit debug information for struct-like types only when the base
8586 name of the compilation source file matches the base name of file
8587 in which the struct is defined.
8588
8589 This option substantially reduces the size of debugging
8590 information, but at significant potential loss in type information
8591 to the debugger. See -femit-struct-debug-reduced for a less
8592 aggressive option. See -femit-struct-debug-detailed for more
8593 detailed control.
8594
8595 This option works only with DWARF debug output.
8596
8597 -femit-struct-debug-reduced
8598 Emit debug information for struct-like types only when the base
8599 name of the compilation source file matches the base name of file
8600 in which the type is defined, unless the struct is a template or
8601 defined in a system header.
8602
8603 This option significantly reduces the size of debugging
8604 information, with some potential loss in type information to the
8605 debugger. See -femit-struct-debug-baseonly for a more aggressive
8606 option. See -femit-struct-debug-detailed for more detailed
8607 control.
8608
8609 This option works only with DWARF debug output.
8610
8611 -femit-struct-debug-detailed[=spec-list]
8612 Specify the struct-like types for which the compiler generates
8613 debug information. The intent is to reduce duplicate struct debug
8614 information between different object files within the same program.
8615
8616 This option is a detailed version of -femit-struct-debug-reduced
8617 and -femit-struct-debug-baseonly, which serves for most needs.
8618
8619 A specification has the
8620 syntax[dir:|ind:][ord:|gen:](any|sys|base|none)
8621
8622 The optional first word limits the specification to structs that
8623 are used directly (dir:) or used indirectly (ind:). A struct type
8624 is used directly when it is the type of a variable, member.
8625 Indirect uses arise through pointers to structs. That is, when use
8626 of an incomplete struct is valid, the use is indirect. An example
8627 is struct one direct; struct two * indirect;.
8628
8629 The optional second word limits the specification to ordinary
8630 structs (ord:) or generic structs (gen:). Generic structs are a
8631 bit complicated to explain. For C++, these are non-explicit
8632 specializations of template classes, or non-template classes within
8633 the above. Other programming languages have generics, but
8634 -femit-struct-debug-detailed does not yet implement them.
8635
8636 The third word specifies the source files for those structs for
8637 which the compiler should emit debug information. The values none
8638 and any have the normal meaning. The value base means that the
8639 base of name of the file in which the type declaration appears must
8640 match the base of the name of the main compilation file. In
8641 practice, this means that when compiling foo.c, debug information
8642 is generated for types declared in that file and foo.h, but not
8643 other header files. The value sys means those types satisfying
8644 base or declared in system or compiler headers.
8645
8646 You may need to experiment to determine the best settings for your
8647 application.
8648
8649 The default is -femit-struct-debug-detailed=all.
8650
8651 This option works only with DWARF debug output.
8652
8653 -fno-dwarf2-cfi-asm
8654 Emit DWARF unwind info as compiler generated ".eh_frame" section
8655 instead of using GAS ".cfi_*" directives.
8656
8657 -fno-eliminate-unused-debug-types
8658 Normally, when producing DWARF output, GCC avoids producing debug
8659 symbol output for types that are nowhere used in the source file
8660 being compiled. Sometimes it is useful to have GCC emit debugging
8661 information for all types declared in a compilation unit,
8662 regardless of whether or not they are actually used in that
8663 compilation unit, for example if, in the debugger, you want to cast
8664 a value to a type that is not actually used in your program (but is
8665 declared). More often, however, this results in a significant
8666 amount of wasted space.
8667
8668 Options That Control Optimization
8669 These options control various sorts of optimizations.
8670
8671 Without any optimization option, the compiler's goal is to reduce the
8672 cost of compilation and to make debugging produce the expected results.
8673 Statements are independent: if you stop the program with a breakpoint
8674 between statements, you can then assign a new value to any variable or
8675 change the program counter to any other statement in the function and
8676 get exactly the results you expect from the source code.
8677
8678 Turning on optimization flags makes the compiler attempt to improve the
8679 performance and/or code size at the expense of compilation time and
8680 possibly the ability to debug the program.
8681
8682 The compiler performs optimization based on the knowledge it has of the
8683 program. Compiling multiple files at once to a single output file mode
8684 allows the compiler to use information gained from all of the files
8685 when compiling each of them.
8686
8687 Not all optimizations are controlled directly by a flag. Only
8688 optimizations that have a flag are listed in this section.
8689
8690 Most optimizations are completely disabled at -O0 or if an -O level is
8691 not set on the command line, even if individual optimization flags are
8692 specified. Similarly, -Og suppresses many optimization passes.
8693
8694 Depending on the target and how GCC was configured, a slightly
8695 different set of optimizations may be enabled at each -O level than
8696 those listed here. You can invoke GCC with -Q --help=optimizers to
8697 find out the exact set of optimizations that are enabled at each level.
8698
8699 -O
8700 -O1 Optimize. Optimizing compilation takes somewhat more time, and a
8701 lot more memory for a large function.
8702
8703 With -O, the compiler tries to reduce code size and execution time,
8704 without performing any optimizations that take a great deal of
8705 compilation time.
8706
8707 -O turns on the following optimization flags:
8708
8709 -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments
8710 -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch
8711 -fdse -fforward-propagate -fguess-branch-probability
8712 -fif-conversion -fif-conversion2 -finline-functions-called-once
8713 -fipa-modref -fipa-profile -fipa-pure-const -fipa-reference
8714 -fipa-reference-addressable -fmerge-constants
8715 -fmove-loop-invariants -fmove-loop-stores -fomit-frame-pointer
8716 -freorder-blocks -fshrink-wrap -fshrink-wrap-separate
8717 -fsplit-wide-types -fssa-backprop -fssa-phiopt -ftree-bit-ccp
8718 -ftree-ccp -ftree-ch -ftree-coalesce-vars -ftree-copy-prop
8719 -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-forwprop
8720 -ftree-fre -ftree-phiprop -ftree-pta -ftree-scev-cprop -ftree-sink
8721 -ftree-slsr -ftree-sra -ftree-ter -funit-at-a-time
8722
8723 -O2 Optimize even more. GCC performs nearly all supported
8724 optimizations that do not involve a space-speed tradeoff. As
8725 compared to -O, this option increases both compilation time and the
8726 performance of the generated code.
8727
8728 -O2 turns on all optimization flags specified by -O1. It also
8729 turns on the following optimization flags:
8730
8731 -falign-functions -falign-jumps -falign-labels -falign-loops
8732 -fcaller-saves -fcode-hoisting -fcrossjumping -fcse-follow-jumps
8733 -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize
8734 -fdevirtualize-speculatively -fexpensive-optimizations
8735 -ffinite-loops -fgcse -fgcse-lm -fhoist-adjacent-loads
8736 -finline-functions -finline-small-functions -findirect-inlining
8737 -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fipa-vrp
8738 -fisolate-erroneous-paths-dereference -flra-remat
8739 -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining
8740 -fpeephole2 -freorder-blocks-algorithm=stc
8741 -freorder-blocks-and-partition -freorder-functions
8742 -frerun-cse-after-loop -fschedule-insns -fschedule-insns2
8743 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing
8744 -fthread-jumps -ftree-builtin-call-dce -ftree-loop-vectorize
8745 -ftree-pre -ftree-slp-vectorize -ftree-switch-conversion
8746 -ftree-tail-merge -ftree-vrp -fvect-cost-model=very-cheap
8747
8748 Please note the warning under -fgcse about invoking -O2 on programs
8749 that use computed gotos.
8750
8751 -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2
8752 and also turns on the following optimization flags:
8753
8754 -fgcse-after-reload -fipa-cp-clone -floop-interchange
8755 -floop-unroll-and-jam -fpeel-loops -fpredictive-commoning
8756 -fsplit-loops -fsplit-paths -ftree-loop-distribution
8757 -ftree-partial-pre -funswitch-loops -fvect-cost-model=dynamic
8758 -fversion-loops-for-strides
8759
8760 -O0 Reduce compilation time and make debugging produce the expected
8761 results. This is the default.
8762
8763 -Os Optimize for size. -Os enables all -O2 optimizations except those
8764 that often increase code size:
8765
8766 -falign-functions -falign-jumps -falign-labels -falign-loops
8767 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc
8768
8769 It also enables -finline-functions, causes the compiler to tune for
8770 code size rather than execution speed, and performs further
8771 optimizations designed to reduce code size.
8772
8773 -Ofast
8774 Disregard strict standards compliance. -Ofast enables all -O3
8775 optimizations. It also enables optimizations that are not valid
8776 for all standard-compliant programs. It turns on -ffast-math,
8777 -fallow-store-data-races and the Fortran-specific -fstack-arrays,
8778 unless -fmax-stack-var-size is specified, and -fno-protect-parens.
8779 It turns off -fsemantic-interposition.
8780
8781 -Og Optimize debugging experience. -Og should be the optimization
8782 level of choice for the standard edit-compile-debug cycle, offering
8783 a reasonable level of optimization while maintaining fast
8784 compilation and a good debugging experience. It is a better choice
8785 than -O0 for producing debuggable code because some compiler passes
8786 that collect debug information are disabled at -O0.
8787
8788 Like -O0, -Og completely disables a number of optimization passes
8789 so that individual options controlling them have no effect.
8790 Otherwise -Og enables all -O1 optimization flags except for those
8791 that may interfere with debugging:
8792
8793 -fbranch-count-reg -fdelayed-branch -fdse -fif-conversion
8794 -fif-conversion2 -finline-functions-called-once
8795 -fmove-loop-invariants -fmove-loop-stores -fssa-phiopt
8796 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra
8797
8798 -Oz Optimize aggressively for size rather than speed. This may
8799 increase the number of instructions executed if those instructions
8800 require fewer bytes to encode. -Oz behaves similarly to -Os
8801 including enabling most -O2 optimizations.
8802
8803 If you use multiple -O options, with or without level numbers, the last
8804 such option is the one that is effective.
8805
8806 Options of the form -fflag specify machine-independent flags. Most
8807 flags have both positive and negative forms; the negative form of -ffoo
8808 is -fno-foo. In the table below, only one of the forms is listed---the
8809 one you typically use. You can figure out the other form by either
8810 removing no- or adding it.
8811
8812 The following options control specific optimizations. They are either
8813 activated by -O options or are related to ones that are. You can use
8814 the following flags in the rare cases when "fine-tuning" of
8815 optimizations to be performed is desired.
8816
8817 -fno-defer-pop
8818 For machines that must pop arguments after a function call, always
8819 pop the arguments as soon as each function returns. At levels -O1
8820 and higher, -fdefer-pop is the default; this allows the compiler to
8821 let arguments accumulate on the stack for several function calls
8822 and pop them all at once.
8823
8824 -fforward-propagate
8825 Perform a forward propagation pass on RTL. The pass tries to
8826 combine two instructions and checks if the result can be
8827 simplified. If loop unrolling is active, two passes are performed
8828 and the second is scheduled after loop unrolling.
8829
8830 This option is enabled by default at optimization levels -O1, -O2,
8831 -O3, -Os.
8832
8833 -ffp-contract=style
8834 -ffp-contract=off disables floating-point expression contraction.
8835 -ffp-contract=fast enables floating-point expression contraction
8836 such as forming of fused multiply-add operations if the target has
8837 native support for them. -ffp-contract=on enables floating-point
8838 expression contraction if allowed by the language standard. This
8839 is currently not implemented and treated equal to
8840 -ffp-contract=off.
8841
8842 The default is -ffp-contract=fast.
8843
8844 -fomit-frame-pointer
8845 Omit the frame pointer in functions that don't need one. This
8846 avoids the instructions to save, set up and restore the frame
8847 pointer; on many targets it also makes an extra register available.
8848
8849 On some targets this flag has no effect because the standard
8850 calling sequence always uses a frame pointer, so it cannot be
8851 omitted.
8852
8853 Note that -fno-omit-frame-pointer doesn't guarantee the frame
8854 pointer is used in all functions. Several targets always omit the
8855 frame pointer in leaf functions.
8856
8857 Enabled by default at -O1 and higher.
8858
8859 -foptimize-sibling-calls
8860 Optimize sibling and tail recursive calls.
8861
8862 Enabled at levels -O2, -O3, -Os.
8863
8864 -foptimize-strlen
8865 Optimize various standard C string functions (e.g. "strlen",
8866 "strchr" or "strcpy") and their "_FORTIFY_SOURCE" counterparts into
8867 faster alternatives.
8868
8869 Enabled at levels -O2, -O3.
8870
8871 -fno-inline
8872 Do not expand any functions inline apart from those marked with the
8873 "always_inline" attribute. This is the default when not
8874 optimizing.
8875
8876 Single functions can be exempted from inlining by marking them with
8877 the "noinline" attribute.
8878
8879 -finline-small-functions
8880 Integrate functions into their callers when their body is smaller
8881 than expected function call code (so overall size of program gets
8882 smaller). The compiler heuristically decides which functions are
8883 simple enough to be worth integrating in this way. This inlining
8884 applies to all functions, even those not declared inline.
8885
8886 Enabled at levels -O2, -O3, -Os.
8887
8888 -findirect-inlining
8889 Inline also indirect calls that are discovered to be known at
8890 compile time thanks to previous inlining. This option has any
8891 effect only when inlining itself is turned on by the
8892 -finline-functions or -finline-small-functions options.
8893
8894 Enabled at levels -O2, -O3, -Os.
8895
8896 -finline-functions
8897 Consider all functions for inlining, even if they are not declared
8898 inline. The compiler heuristically decides which functions are
8899 worth integrating in this way.
8900
8901 If all calls to a given function are integrated, and the function
8902 is declared "static", then the function is normally not output as
8903 assembler code in its own right.
8904
8905 Enabled at levels -O2, -O3, -Os. Also enabled by -fprofile-use and
8906 -fauto-profile.
8907
8908 -finline-functions-called-once
8909 Consider all "static" functions called once for inlining into their
8910 caller even if they are not marked "inline". If a call to a given
8911 function is integrated, then the function is not output as
8912 assembler code in its own right.
8913
8914 Enabled at levels -O1, -O2, -O3 and -Os, but not -Og.
8915
8916 -fearly-inlining
8917 Inline functions marked by "always_inline" and functions whose body
8918 seems smaller than the function call overhead early before doing
8919 -fprofile-generate instrumentation and real inlining pass. Doing
8920 so makes profiling significantly cheaper and usually inlining
8921 faster on programs having large chains of nested wrapper functions.
8922
8923 Enabled by default.
8924
8925 -fipa-sra
8926 Perform interprocedural scalar replacement of aggregates, removal
8927 of unused parameters and replacement of parameters passed by
8928 reference by parameters passed by value.
8929
8930 Enabled at levels -O2, -O3 and -Os.
8931
8932 -finline-limit=n
8933 By default, GCC limits the size of functions that can be inlined.
8934 This flag allows coarse control of this limit. n is the size of
8935 functions that can be inlined in number of pseudo instructions.
8936
8937 Inlining is actually controlled by a number of parameters, which
8938 may be specified individually by using --param name=value. The
8939 -finline-limit=n option sets some of these parameters as follows:
8940
8941 max-inline-insns-single
8942 is set to n/2.
8943
8944 max-inline-insns-auto
8945 is set to n/2.
8946
8947 See below for a documentation of the individual parameters
8948 controlling inlining and for the defaults of these parameters.
8949
8950 Note: there may be no value to -finline-limit that results in
8951 default behavior.
8952
8953 Note: pseudo instruction represents, in this particular context, an
8954 abstract measurement of function's size. In no way does it
8955 represent a count of assembly instructions and as such its exact
8956 meaning might change from one release to an another.
8957
8958 -fno-keep-inline-dllexport
8959 This is a more fine-grained version of -fkeep-inline-functions,
8960 which applies only to functions that are declared using the
8961 "dllexport" attribute or declspec.
8962
8963 -fkeep-inline-functions
8964 In C, emit "static" functions that are declared "inline" into the
8965 object file, even if the function has been inlined into all of its
8966 callers. This switch does not affect functions using the "extern
8967 inline" extension in GNU C90. In C++, emit any and all inline
8968 functions into the object file.
8969
8970 -fkeep-static-functions
8971 Emit "static" functions into the object file, even if the function
8972 is never used.
8973
8974 -fkeep-static-consts
8975 Emit variables declared "static const" when optimization isn't
8976 turned on, even if the variables aren't referenced.
8977
8978 GCC enables this option by default. If you want to force the
8979 compiler to check if a variable is referenced, regardless of
8980 whether or not optimization is turned on, use the
8981 -fno-keep-static-consts option.
8982
8983 -fmerge-constants
8984 Attempt to merge identical constants (string constants and
8985 floating-point constants) across compilation units.
8986
8987 This option is the default for optimized compilation if the
8988 assembler and linker support it. Use -fno-merge-constants to
8989 inhibit this behavior.
8990
8991 Enabled at levels -O1, -O2, -O3, -Os.
8992
8993 -fmerge-all-constants
8994 Attempt to merge identical constants and identical variables.
8995
8996 This option implies -fmerge-constants. In addition to
8997 -fmerge-constants this considers e.g. even constant initialized
8998 arrays or initialized constant variables with integral or floating-
8999 point types. Languages like C or C++ require each variable,
9000 including multiple instances of the same variable in recursive
9001 calls, to have distinct locations, so using this option results in
9002 non-conforming behavior.
9003
9004 -fmodulo-sched
9005 Perform swing modulo scheduling immediately before the first
9006 scheduling pass. This pass looks at innermost loops and reorders
9007 their instructions by overlapping different iterations.
9008
9009 -fmodulo-sched-allow-regmoves
9010 Perform more aggressive SMS-based modulo scheduling with register
9011 moves allowed. By setting this flag certain anti-dependences edges
9012 are deleted, which triggers the generation of reg-moves based on
9013 the life-range analysis. This option is effective only with
9014 -fmodulo-sched enabled.
9015
9016 -fno-branch-count-reg
9017 Disable the optimization pass that scans for opportunities to use
9018 "decrement and branch" instructions on a count register instead of
9019 instruction sequences that decrement a register, compare it against
9020 zero, and then branch based upon the result. This option is only
9021 meaningful on architectures that support such instructions, which
9022 include x86, PowerPC, IA-64 and S/390. Note that the
9023 -fno-branch-count-reg option doesn't remove the decrement and
9024 branch instructions from the generated instruction stream
9025 introduced by other optimization passes.
9026
9027 The default is -fbranch-count-reg at -O1 and higher, except for
9028 -Og.
9029
9030 -fno-function-cse
9031 Do not put function addresses in registers; make each instruction
9032 that calls a constant function contain the function's address
9033 explicitly.
9034
9035 This option results in less efficient code, but some strange hacks
9036 that alter the assembler output may be confused by the
9037 optimizations performed when this option is not used.
9038
9039 The default is -ffunction-cse
9040
9041 -fno-zero-initialized-in-bss
9042 If the target supports a BSS section, GCC by default puts variables
9043 that are initialized to zero into BSS. This can save space in the
9044 resulting code.
9045
9046 This option turns off this behavior because some programs
9047 explicitly rely on variables going to the data section---e.g., so
9048 that the resulting executable can find the beginning of that
9049 section and/or make assumptions based on that.
9050
9051 The default is -fzero-initialized-in-bss.
9052
9053 -fthread-jumps
9054 Perform optimizations that check to see if a jump branches to a
9055 location where another comparison subsumed by the first is found.
9056 If so, the first branch is redirected to either the destination of
9057 the second branch or a point immediately following it, depending on
9058 whether the condition is known to be true or false.
9059
9060 Enabled at levels -O1, -O2, -O3, -Os.
9061
9062 -fsplit-wide-types
9063 When using a type that occupies multiple registers, such as "long
9064 long" on a 32-bit system, split the registers apart and allocate
9065 them independently. This normally generates better code for those
9066 types, but may make debugging more difficult.
9067
9068 Enabled at levels -O1, -O2, -O3, -Os.
9069
9070 -fsplit-wide-types-early
9071 Fully split wide types early, instead of very late. This option
9072 has no effect unless -fsplit-wide-types is turned on.
9073
9074 This is the default on some targets.
9075
9076 -fcse-follow-jumps
9077 In common subexpression elimination (CSE), scan through jump
9078 instructions when the target of the jump is not reached by any
9079 other path. For example, when CSE encounters an "if" statement
9080 with an "else" clause, CSE follows the jump when the condition
9081 tested is false.
9082
9083 Enabled at levels -O2, -O3, -Os.
9084
9085 -fcse-skip-blocks
9086 This is similar to -fcse-follow-jumps, but causes CSE to follow
9087 jumps that conditionally skip over blocks. When CSE encounters a
9088 simple "if" statement with no else clause, -fcse-skip-blocks causes
9089 CSE to follow the jump around the body of the "if".
9090
9091 Enabled at levels -O2, -O3, -Os.
9092
9093 -frerun-cse-after-loop
9094 Re-run common subexpression elimination after loop optimizations
9095 are performed.
9096
9097 Enabled at levels -O2, -O3, -Os.
9098
9099 -fgcse
9100 Perform a global common subexpression elimination pass. This pass
9101 also performs global constant and copy propagation.
9102
9103 Note: When compiling a program using computed gotos, a GCC
9104 extension, you may get better run-time performance if you disable
9105 the global common subexpression elimination pass by adding
9106 -fno-gcse to the command line.
9107
9108 Enabled at levels -O2, -O3, -Os.
9109
9110 -fgcse-lm
9111 When -fgcse-lm is enabled, global common subexpression elimination
9112 attempts to move loads that are only killed by stores into
9113 themselves. This allows a loop containing a load/store sequence to
9114 be changed to a load outside the loop, and a copy/store within the
9115 loop.
9116
9117 Enabled by default when -fgcse is enabled.
9118
9119 -fgcse-sm
9120 When -fgcse-sm is enabled, a store motion pass is run after global
9121 common subexpression elimination. This pass attempts to move
9122 stores out of loops. When used in conjunction with -fgcse-lm,
9123 loops containing a load/store sequence can be changed to a load
9124 before the loop and a store after the loop.
9125
9126 Not enabled at any optimization level.
9127
9128 -fgcse-las
9129 When -fgcse-las is enabled, the global common subexpression
9130 elimination pass eliminates redundant loads that come after stores
9131 to the same memory location (both partial and full redundancies).
9132
9133 Not enabled at any optimization level.
9134
9135 -fgcse-after-reload
9136 When -fgcse-after-reload is enabled, a redundant load elimination
9137 pass is performed after reload. The purpose of this pass is to
9138 clean up redundant spilling.
9139
9140 Enabled by -O3, -fprofile-use and -fauto-profile.
9141
9142 -faggressive-loop-optimizations
9143 This option tells the loop optimizer to use language constraints to
9144 derive bounds for the number of iterations of a loop. This assumes
9145 that loop code does not invoke undefined behavior by for example
9146 causing signed integer overflows or out-of-bound array accesses.
9147 The bounds for the number of iterations of a loop are used to guide
9148 loop unrolling and peeling and loop exit test optimizations. This
9149 option is enabled by default.
9150
9151 -funconstrained-commons
9152 This option tells the compiler that variables declared in common
9153 blocks (e.g. Fortran) may later be overridden with longer trailing
9154 arrays. This prevents certain optimizations that depend on knowing
9155 the array bounds.
9156
9157 -fcrossjumping
9158 Perform cross-jumping transformation. This transformation unifies
9159 equivalent code and saves code size. The resulting code may or may
9160 not perform better than without cross-jumping.
9161
9162 Enabled at levels -O2, -O3, -Os.
9163
9164 -fauto-inc-dec
9165 Combine increments or decrements of addresses with memory accesses.
9166 This pass is always skipped on architectures that do not have
9167 instructions to support this. Enabled by default at -O1 and higher
9168 on architectures that support this.
9169
9170 -fdce
9171 Perform dead code elimination (DCE) on RTL. Enabled by default at
9172 -O1 and higher.
9173
9174 -fdse
9175 Perform dead store elimination (DSE) on RTL. Enabled by default at
9176 -O1 and higher.
9177
9178 -fif-conversion
9179 Attempt to transform conditional jumps into branch-less
9180 equivalents. This includes use of conditional moves, min, max, set
9181 flags and abs instructions, and some tricks doable by standard
9182 arithmetics. The use of conditional execution on chips where it is
9183 available is controlled by -fif-conversion2.
9184
9185 Enabled at levels -O1, -O2, -O3, -Os, but not with -Og.
9186
9187 -fif-conversion2
9188 Use conditional execution (where available) to transform
9189 conditional jumps into branch-less equivalents.
9190
9191 Enabled at levels -O1, -O2, -O3, -Os, but not with -Og.
9192
9193 -fdeclone-ctor-dtor
9194 The C++ ABI requires multiple entry points for constructors and
9195 destructors: one for a base subobject, one for a complete object,
9196 and one for a virtual destructor that calls operator delete
9197 afterwards. For a hierarchy with virtual bases, the base and
9198 complete variants are clones, which means two copies of the
9199 function. With this option, the base and complete variants are
9200 changed to be thunks that call a common implementation.
9201
9202 Enabled by -Os.
9203
9204 -fdelete-null-pointer-checks
9205 Assume that programs cannot safely dereference null pointers, and
9206 that no code or data element resides at address zero. This option
9207 enables simple constant folding optimizations at all optimization
9208 levels. In addition, other optimization passes in GCC use this
9209 flag to control global dataflow analyses that eliminate useless
9210 checks for null pointers; these assume that a memory access to
9211 address zero always results in a trap, so that if a pointer is
9212 checked after it has already been dereferenced, it cannot be null.
9213
9214 Note however that in some environments this assumption is not true.
9215 Use -fno-delete-null-pointer-checks to disable this optimization
9216 for programs that depend on that behavior.
9217
9218 This option is enabled by default on most targets. On Nios II ELF,
9219 it defaults to off. On AVR, CR16, and MSP430, this option is
9220 completely disabled.
9221
9222 Passes that use the dataflow information are enabled independently
9223 at different optimization levels.
9224
9225 -fdevirtualize
9226 Attempt to convert calls to virtual functions to direct calls.
9227 This is done both within a procedure and interprocedurally as part
9228 of indirect inlining (-findirect-inlining) and interprocedural
9229 constant propagation (-fipa-cp). Enabled at levels -O2, -O3, -Os.
9230
9231 -fdevirtualize-speculatively
9232 Attempt to convert calls to virtual functions to speculative direct
9233 calls. Based on the analysis of the type inheritance graph,
9234 determine for a given call the set of likely targets. If the set is
9235 small, preferably of size 1, change the call into a conditional
9236 deciding between direct and indirect calls. The speculative calls
9237 enable more optimizations, such as inlining. When they seem
9238 useless after further optimization, they are converted back into
9239 original form.
9240
9241 -fdevirtualize-at-ltrans
9242 Stream extra information needed for aggressive devirtualization
9243 when running the link-time optimizer in local transformation mode.
9244 This option enables more devirtualization but significantly
9245 increases the size of streamed data. For this reason it is disabled
9246 by default.
9247
9248 -fexpensive-optimizations
9249 Perform a number of minor optimizations that are relatively
9250 expensive.
9251
9252 Enabled at levels -O2, -O3, -Os.
9253
9254 -free
9255 Attempt to remove redundant extension instructions. This is
9256 especially helpful for the x86-64 architecture, which implicitly
9257 zero-extends in 64-bit registers after writing to their lower
9258 32-bit half.
9259
9260 Enabled for Alpha, AArch64 and x86 at levels -O2, -O3, -Os.
9261
9262 -fno-lifetime-dse
9263 In C++ the value of an object is only affected by changes within
9264 its lifetime: when the constructor begins, the object has an
9265 indeterminate value, and any changes during the lifetime of the
9266 object are dead when the object is destroyed. Normally dead store
9267 elimination will take advantage of this; if your code relies on the
9268 value of the object storage persisting beyond the lifetime of the
9269 object, you can use this flag to disable this optimization. To
9270 preserve stores before the constructor starts (e.g. because your
9271 operator new clears the object storage) but still treat the object
9272 as dead after the destructor, you can use -flifetime-dse=1. The
9273 default behavior can be explicitly selected with -flifetime-dse=2.
9274 -flifetime-dse=0 is equivalent to -fno-lifetime-dse.
9275
9276 -flive-range-shrinkage
9277 Attempt to decrease register pressure through register live range
9278 shrinkage. This is helpful for fast processors with small or
9279 moderate size register sets.
9280
9281 -fira-algorithm=algorithm
9282 Use the specified coloring algorithm for the integrated register
9283 allocator. The algorithm argument can be priority, which specifies
9284 Chow's priority coloring, or CB, which specifies Chaitin-Briggs
9285 coloring. Chaitin-Briggs coloring is not implemented for all
9286 architectures, but for those targets that do support it, it is the
9287 default because it generates better code.
9288
9289 -fira-region=region
9290 Use specified regions for the integrated register allocator. The
9291 region argument should be one of the following:
9292
9293 all Use all loops as register allocation regions. This can give
9294 the best results for machines with a small and/or irregular
9295 register set.
9296
9297 mixed
9298 Use all loops except for loops with small register pressure as
9299 the regions. This value usually gives the best results in most
9300 cases and for most architectures, and is enabled by default
9301 when compiling with optimization for speed (-O, -O2, ...).
9302
9303 one Use all functions as a single region. This typically results
9304 in the smallest code size, and is enabled by default for -Os or
9305 -O0.
9306
9307 -fira-hoist-pressure
9308 Use IRA to evaluate register pressure in the code hoisting pass for
9309 decisions to hoist expressions. This option usually results in
9310 smaller code, but it can slow the compiler down.
9311
9312 This option is enabled at level -Os for all targets.
9313
9314 -fira-loop-pressure
9315 Use IRA to evaluate register pressure in loops for decisions to
9316 move loop invariants. This option usually results in generation of
9317 faster and smaller code on machines with large register files (>=
9318 32 registers), but it can slow the compiler down.
9319
9320 This option is enabled at level -O3 for some targets.
9321
9322 -fno-ira-share-save-slots
9323 Disable sharing of stack slots used for saving call-used hard
9324 registers living through a call. Each hard register gets a
9325 separate stack slot, and as a result function stack frames are
9326 larger.
9327
9328 -fno-ira-share-spill-slots
9329 Disable sharing of stack slots allocated for pseudo-registers.
9330 Each pseudo-register that does not get a hard register gets a
9331 separate stack slot, and as a result function stack frames are
9332 larger.
9333
9334 -flra-remat
9335 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9336 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9337 values if it is profitable.
9338
9339 Enabled at levels -O2, -O3, -Os.
9340
9341 -fdelayed-branch
9342 If supported for the target machine, attempt to reorder
9343 instructions to exploit instruction slots available after delayed
9344 branch instructions.
9345
9346 Enabled at levels -O1, -O2, -O3, -Os, but not at -Og.
9347
9348 -fschedule-insns
9349 If supported for the target machine, attempt to reorder
9350 instructions to eliminate execution stalls due to required data
9351 being unavailable. This helps machines that have slow floating
9352 point or memory load instructions by allowing other instructions to
9353 be issued until the result of the load or floating-point
9354 instruction is required.
9355
9356 Enabled at levels -O2, -O3.
9357
9358 -fschedule-insns2
9359 Similar to -fschedule-insns, but requests an additional pass of
9360 instruction scheduling after register allocation has been done.
9361 This is especially useful on machines with a relatively small
9362 number of registers and where memory load instructions take more
9363 than one cycle.
9364
9365 Enabled at levels -O2, -O3, -Os.
9366
9367 -fno-sched-interblock
9368 Disable instruction scheduling across basic blocks, which is
9369 normally enabled when scheduling before register allocation, i.e.
9370 with -fschedule-insns or at -O2 or higher.
9371
9372 -fno-sched-spec
9373 Disable speculative motion of non-load instructions, which is
9374 normally enabled when scheduling before register allocation, i.e.
9375 with -fschedule-insns or at -O2 or higher.
9376
9377 -fsched-pressure
9378 Enable register pressure sensitive insn scheduling before register
9379 allocation. This only makes sense when scheduling before register
9380 allocation is enabled, i.e. with -fschedule-insns or at -O2 or
9381 higher. Usage of this option can improve the generated code and
9382 decrease its size by preventing register pressure increase above
9383 the number of available hard registers and subsequent spills in
9384 register allocation.
9385
9386 -fsched-spec-load
9387 Allow speculative motion of some load instructions. This only
9388 makes sense when scheduling before register allocation, i.e. with
9389 -fschedule-insns or at -O2 or higher.
9390
9391 -fsched-spec-load-dangerous
9392 Allow speculative motion of more load instructions. This only
9393 makes sense when scheduling before register allocation, i.e. with
9394 -fschedule-insns or at -O2 or higher.
9395
9396 -fsched-stalled-insns
9397 -fsched-stalled-insns=n
9398 Define how many insns (if any) can be moved prematurely from the
9399 queue of stalled insns into the ready list during the second
9400 scheduling pass. -fno-sched-stalled-insns means that no insns are
9401 moved prematurely, -fsched-stalled-insns=0 means there is no limit
9402 on how many queued insns can be moved prematurely.
9403 -fsched-stalled-insns without a value is equivalent to
9404 -fsched-stalled-insns=1.
9405
9406 -fsched-stalled-insns-dep
9407 -fsched-stalled-insns-dep=n
9408 Define how many insn groups (cycles) are examined for a dependency
9409 on a stalled insn that is a candidate for premature removal from
9410 the queue of stalled insns. This has an effect only during the
9411 second scheduling pass, and only if -fsched-stalled-insns is used.
9412 -fno-sched-stalled-insns-dep is equivalent to
9413 -fsched-stalled-insns-dep=0. -fsched-stalled-insns-dep without a
9414 value is equivalent to -fsched-stalled-insns-dep=1.
9415
9416 -fsched2-use-superblocks
9417 When scheduling after register allocation, use superblock
9418 scheduling. This allows motion across basic block boundaries,
9419 resulting in faster schedules. This option is experimental, as not
9420 all machine descriptions used by GCC model the CPU closely enough
9421 to avoid unreliable results from the algorithm.
9422
9423 This only makes sense when scheduling after register allocation,
9424 i.e. with -fschedule-insns2 or at -O2 or higher.
9425
9426 -fsched-group-heuristic
9427 Enable the group heuristic in the scheduler. This heuristic favors
9428 the instruction that belongs to a schedule group. This is enabled
9429 by default when scheduling is enabled, i.e. with -fschedule-insns
9430 or -fschedule-insns2 or at -O2 or higher.
9431
9432 -fsched-critical-path-heuristic
9433 Enable the critical-path heuristic in the scheduler. This
9434 heuristic favors instructions on the critical path. This is
9435 enabled by default when scheduling is enabled, i.e. with
9436 -fschedule-insns or -fschedule-insns2 or at -O2 or higher.
9437
9438 -fsched-spec-insn-heuristic
9439 Enable the speculative instruction heuristic in the scheduler.
9440 This heuristic favors speculative instructions with greater
9441 dependency weakness. This is enabled by default when scheduling is
9442 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
9443 or higher.
9444
9445 -fsched-rank-heuristic
9446 Enable the rank heuristic in the scheduler. This heuristic favors
9447 the instruction belonging to a basic block with greater size or
9448 frequency. This is enabled by default when scheduling is enabled,
9449 i.e. with -fschedule-insns or -fschedule-insns2 or at -O2 or
9450 higher.
9451
9452 -fsched-last-insn-heuristic
9453 Enable the last-instruction heuristic in the scheduler. This
9454 heuristic favors the instruction that is less dependent on the last
9455 instruction scheduled. This is enabled by default when scheduling
9456 is enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at
9457 -O2 or higher.
9458
9459 -fsched-dep-count-heuristic
9460 Enable the dependent-count heuristic in the scheduler. This
9461 heuristic favors the instruction that has more instructions
9462 depending on it. This is enabled by default when scheduling is
9463 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
9464 or higher.
9465
9466 -freschedule-modulo-scheduled-loops
9467 Modulo scheduling is performed before traditional scheduling. If a
9468 loop is modulo scheduled, later scheduling passes may change its
9469 schedule. Use this option to control that behavior.
9470
9471 -fselective-scheduling
9472 Schedule instructions using selective scheduling algorithm.
9473 Selective scheduling runs instead of the first scheduler pass.
9474
9475 -fselective-scheduling2
9476 Schedule instructions using selective scheduling algorithm.
9477 Selective scheduling runs instead of the second scheduler pass.
9478
9479 -fsel-sched-pipelining
9480 Enable software pipelining of innermost loops during selective
9481 scheduling. This option has no effect unless one of
9482 -fselective-scheduling or -fselective-scheduling2 is turned on.
9483
9484 -fsel-sched-pipelining-outer-loops
9485 When pipelining loops during selective scheduling, also pipeline
9486 outer loops. This option has no effect unless
9487 -fsel-sched-pipelining is turned on.
9488
9489 -fsemantic-interposition
9490 Some object formats, like ELF, allow interposing of symbols by the
9491 dynamic linker. This means that for symbols exported from the DSO,
9492 the compiler cannot perform interprocedural propagation, inlining
9493 and other optimizations in anticipation that the function or
9494 variable in question may change. While this feature is useful, for
9495 example, to rewrite memory allocation functions by a debugging
9496 implementation, it is expensive in the terms of code quality. With
9497 -fno-semantic-interposition the compiler assumes that if
9498 interposition happens for functions the overwriting function will
9499 have precisely the same semantics (and side effects). Similarly if
9500 interposition happens for variables, the constructor of the
9501 variable will be the same. The flag has no effect for functions
9502 explicitly declared inline (where it is never allowed for
9503 interposition to change semantics) and for symbols explicitly
9504 declared weak.
9505
9506 -fshrink-wrap
9507 Emit function prologues only before parts of the function that need
9508 it, rather than at the top of the function. This flag is enabled
9509 by default at -O and higher.
9510
9511 -fshrink-wrap-separate
9512 Shrink-wrap separate parts of the prologue and epilogue separately,
9513 so that those parts are only executed when needed. This option is
9514 on by default, but has no effect unless -fshrink-wrap is also
9515 turned on and the target supports this.
9516
9517 -fcaller-saves
9518 Enable allocation of values to registers that are clobbered by
9519 function calls, by emitting extra instructions to save and restore
9520 the registers around such calls. Such allocation is done only when
9521 it seems to result in better code.
9522
9523 This option is always enabled by default on certain machines,
9524 usually those which have no call-preserved registers to use
9525 instead.
9526
9527 Enabled at levels -O2, -O3, -Os.
9528
9529 -fcombine-stack-adjustments
9530 Tracks stack adjustments (pushes and pops) and stack memory
9531 references and then tries to find ways to combine them.
9532
9533 Enabled by default at -O1 and higher.
9534
9535 -fipa-ra
9536 Use caller save registers for allocation if those registers are not
9537 used by any called function. In that case it is not necessary to
9538 save and restore them around calls. This is only possible if
9539 called functions are part of same compilation unit as current
9540 function and they are compiled before it.
9541
9542 Enabled at levels -O2, -O3, -Os, however the option is disabled if
9543 generated code will be instrumented for profiling (-p, or -pg) or
9544 if callee's register usage cannot be known exactly (this happens on
9545 targets that do not expose prologues and epilogues in RTL).
9546
9547 -fconserve-stack
9548 Attempt to minimize stack usage. The compiler attempts to use less
9549 stack space, even if that makes the program slower. This option
9550 implies setting the large-stack-frame parameter to 100 and the
9551 large-stack-frame-growth parameter to 400.
9552
9553 -ftree-reassoc
9554 Perform reassociation on trees. This flag is enabled by default at
9555 -O1 and higher.
9556
9557 -fcode-hoisting
9558 Perform code hoisting. Code hoisting tries to move the evaluation
9559 of expressions executed on all paths to the function exit as early
9560 as possible. This is especially useful as a code size
9561 optimization, but it often helps for code speed as well. This flag
9562 is enabled by default at -O2 and higher.
9563
9564 -ftree-pre
9565 Perform partial redundancy elimination (PRE) on trees. This flag
9566 is enabled by default at -O2 and -O3.
9567
9568 -ftree-partial-pre
9569 Make partial redundancy elimination (PRE) more aggressive. This
9570 flag is enabled by default at -O3.
9571
9572 -ftree-forwprop
9573 Perform forward propagation on trees. This flag is enabled by
9574 default at -O1 and higher.
9575
9576 -ftree-fre
9577 Perform full redundancy elimination (FRE) on trees. The difference
9578 between FRE and PRE is that FRE only considers expressions that are
9579 computed on all paths leading to the redundant computation. This
9580 analysis is faster than PRE, though it exposes fewer redundancies.
9581 This flag is enabled by default at -O1 and higher.
9582
9583 -ftree-phiprop
9584 Perform hoisting of loads from conditional pointers on trees. This
9585 pass is enabled by default at -O1 and higher.
9586
9587 -fhoist-adjacent-loads
9588 Speculatively hoist loads from both branches of an if-then-else if
9589 the loads are from adjacent locations in the same structure and the
9590 target architecture has a conditional move instruction. This flag
9591 is enabled by default at -O2 and higher.
9592
9593 -ftree-copy-prop
9594 Perform copy propagation on trees. This pass eliminates
9595 unnecessary copy operations. This flag is enabled by default at
9596 -O1 and higher.
9597
9598 -fipa-pure-const
9599 Discover which functions are pure or constant. Enabled by default
9600 at -O1 and higher.
9601
9602 -fipa-reference
9603 Discover which static variables do not escape the compilation unit.
9604 Enabled by default at -O1 and higher.
9605
9606 -fipa-reference-addressable
9607 Discover read-only, write-only and non-addressable static
9608 variables. Enabled by default at -O1 and higher.
9609
9610 -fipa-stack-alignment
9611 Reduce stack alignment on call sites if possible. Enabled by
9612 default.
9613
9614 -fipa-pta
9615 Perform interprocedural pointer analysis and interprocedural
9616 modification and reference analysis. This option can cause
9617 excessive memory and compile-time usage on large compilation units.
9618 It is not enabled by default at any optimization level.
9619
9620 -fipa-profile
9621 Perform interprocedural profile propagation. The functions called
9622 only from cold functions are marked as cold. Also functions
9623 executed once (such as "cold", "noreturn", static constructors or
9624 destructors) are identified. Cold functions and loop less parts of
9625 functions executed once are then optimized for size. Enabled by
9626 default at -O1 and higher.
9627
9628 -fipa-modref
9629 Perform interprocedural mod/ref analysis. This optimization
9630 analyzes the side effects of functions (memory locations that are
9631 modified or referenced) and enables better optimization across the
9632 function call boundary. This flag is enabled by default at -O1 and
9633 higher.
9634
9635 -fipa-cp
9636 Perform interprocedural constant propagation. This optimization
9637 analyzes the program to determine when values passed to functions
9638 are constants and then optimizes accordingly. This optimization
9639 can substantially increase performance if the application has
9640 constants passed to functions. This flag is enabled by default at
9641 -O2, -Os and -O3. It is also enabled by -fprofile-use and
9642 -fauto-profile.
9643
9644 -fipa-cp-clone
9645 Perform function cloning to make interprocedural constant
9646 propagation stronger. When enabled, interprocedural constant
9647 propagation performs function cloning when externally visible
9648 function can be called with constant arguments. Because this
9649 optimization can create multiple copies of functions, it may
9650 significantly increase code size (see --param
9651 ipa-cp-unit-growth=value). This flag is enabled by default at -O3.
9652 It is also enabled by -fprofile-use and -fauto-profile.
9653
9654 -fipa-bit-cp
9655 When enabled, perform interprocedural bitwise constant propagation.
9656 This flag is enabled by default at -O2 and by -fprofile-use and
9657 -fauto-profile. It requires that -fipa-cp is enabled.
9658
9659 -fipa-vrp
9660 When enabled, perform interprocedural propagation of value ranges.
9661 This flag is enabled by default at -O2. It requires that -fipa-cp
9662 is enabled.
9663
9664 -fipa-icf
9665 Perform Identical Code Folding for functions and read-only
9666 variables. The optimization reduces code size and may disturb
9667 unwind stacks by replacing a function by equivalent one with a
9668 different name. The optimization works more effectively with link-
9669 time optimization enabled.
9670
9671 Although the behavior is similar to the Gold Linker's ICF
9672 optimization, GCC ICF works on different levels and thus the
9673 optimizations are not same - there are equivalences that are found
9674 only by GCC and equivalences found only by Gold.
9675
9676 This flag is enabled by default at -O2 and -Os.
9677
9678 -flive-patching=level
9679 Control GCC's optimizations to produce output suitable for live-
9680 patching.
9681
9682 If the compiler's optimization uses a function's body or
9683 information extracted from its body to optimize/change another
9684 function, the latter is called an impacted function of the former.
9685 If a function is patched, its impacted functions should be patched
9686 too.
9687
9688 The impacted functions are determined by the compiler's
9689 interprocedural optimizations. For example, a caller is impacted
9690 when inlining a function into its caller, cloning a function and
9691 changing its caller to call this new clone, or extracting a
9692 function's pureness/constness information to optimize its direct or
9693 indirect callers, etc.
9694
9695 Usually, the more IPA optimizations enabled, the larger the number
9696 of impacted functions for each function. In order to control the
9697 number of impacted functions and more easily compute the list of
9698 impacted function, IPA optimizations can be partially enabled at
9699 two different levels.
9700
9701 The level argument should be one of the following:
9702
9703 inline-clone
9704 Only enable inlining and cloning optimizations, which includes
9705 inlining, cloning, interprocedural scalar replacement of
9706 aggregates and partial inlining. As a result, when patching a
9707 function, all its callers and its clones' callers are impacted,
9708 therefore need to be patched as well.
9709
9710 -flive-patching=inline-clone disables the following
9711 optimization flags: -fwhole-program -fipa-pta -fipa-reference
9712 -fipa-ra -fipa-icf -fipa-icf-functions -fipa-icf-variables
9713 -fipa-bit-cp -fipa-vrp -fipa-pure-const
9714 -fipa-reference-addressable -fipa-stack-alignment -fipa-modref
9715
9716 inline-only-static
9717 Only enable inlining of static functions. As a result, when
9718 patching a static function, all its callers are impacted and so
9719 need to be patched as well.
9720
9721 In addition to all the flags that -flive-patching=inline-clone
9722 disables, -flive-patching=inline-only-static disables the
9723 following additional optimization flags: -fipa-cp-clone
9724 -fipa-sra -fpartial-inlining -fipa-cp
9725
9726 When -flive-patching is specified without any value, the default
9727 value is inline-clone.
9728
9729 This flag is disabled by default.
9730
9731 Note that -flive-patching is not supported with link-time
9732 optimization (-flto).
9733
9734 -fisolate-erroneous-paths-dereference
9735 Detect paths that trigger erroneous or undefined behavior due to
9736 dereferencing a null pointer. Isolate those paths from the main
9737 control flow and turn the statement with erroneous or undefined
9738 behavior into a trap. This flag is enabled by default at -O2 and
9739 higher and depends on -fdelete-null-pointer-checks also being
9740 enabled.
9741
9742 -fisolate-erroneous-paths-attribute
9743 Detect paths that trigger erroneous or undefined behavior due to a
9744 null value being used in a way forbidden by a "returns_nonnull" or
9745 "nonnull" attribute. Isolate those paths from the main control
9746 flow and turn the statement with erroneous or undefined behavior
9747 into a trap. This is not currently enabled, but may be enabled by
9748 -O2 in the future.
9749
9750 -ftree-sink
9751 Perform forward store motion on trees. This flag is enabled by
9752 default at -O1 and higher.
9753
9754 -ftree-bit-ccp
9755 Perform sparse conditional bit constant propagation on trees and
9756 propagate pointer alignment information. This pass only operates
9757 on local scalar variables and is enabled by default at -O1 and
9758 higher, except for -Og. It requires that -ftree-ccp is enabled.
9759
9760 -ftree-ccp
9761 Perform sparse conditional constant propagation (CCP) on trees.
9762 This pass only operates on local scalar variables and is enabled by
9763 default at -O1 and higher.
9764
9765 -fssa-backprop
9766 Propagate information about uses of a value up the definition chain
9767 in order to simplify the definitions. For example, this pass
9768 strips sign operations if the sign of a value never matters. The
9769 flag is enabled by default at -O1 and higher.
9770
9771 -fssa-phiopt
9772 Perform pattern matching on SSA PHI nodes to optimize conditional
9773 code. This pass is enabled by default at -O1 and higher, except
9774 for -Og.
9775
9776 -ftree-switch-conversion
9777 Perform conversion of simple initializations in a switch to
9778 initializations from a scalar array. This flag is enabled by
9779 default at -O2 and higher.
9780
9781 -ftree-tail-merge
9782 Look for identical code sequences. When found, replace one with a
9783 jump to the other. This optimization is known as tail merging or
9784 cross jumping. This flag is enabled by default at -O2 and higher.
9785 The compilation time in this pass can be limited using max-tail-
9786 merge-comparisons parameter and max-tail-merge-iterations
9787 parameter.
9788
9789 -ftree-dce
9790 Perform dead code elimination (DCE) on trees. This flag is enabled
9791 by default at -O1 and higher.
9792
9793 -ftree-builtin-call-dce
9794 Perform conditional dead code elimination (DCE) for calls to built-
9795 in functions that may set "errno" but are otherwise free of side
9796 effects. This flag is enabled by default at -O2 and higher if -Os
9797 is not also specified.
9798
9799 -ffinite-loops
9800 Assume that a loop with an exit will eventually take the exit and
9801 not loop indefinitely. This allows the compiler to remove loops
9802 that otherwise have no side-effects, not considering eventual
9803 endless looping as such.
9804
9805 This option is enabled by default at -O2 for C++ with -std=c++11 or
9806 higher.
9807
9808 -ftree-dominator-opts
9809 Perform a variety of simple scalar cleanups (constant/copy
9810 propagation, redundancy elimination, range propagation and
9811 expression simplification) based on a dominator tree traversal.
9812 This also performs jump threading (to reduce jumps to jumps). This
9813 flag is enabled by default at -O1 and higher.
9814
9815 -ftree-dse
9816 Perform dead store elimination (DSE) on trees. A dead store is a
9817 store into a memory location that is later overwritten by another
9818 store without any intervening loads. In this case the earlier
9819 store can be deleted. This flag is enabled by default at -O1 and
9820 higher.
9821
9822 -ftree-ch
9823 Perform loop header copying on trees. This is beneficial since it
9824 increases effectiveness of code motion optimizations. It also
9825 saves one jump. This flag is enabled by default at -O1 and higher.
9826 It is not enabled for -Os, since it usually increases code size.
9827
9828 -ftree-loop-optimize
9829 Perform loop optimizations on trees. This flag is enabled by
9830 default at -O1 and higher.
9831
9832 -ftree-loop-linear
9833 -floop-strip-mine
9834 -floop-block
9835 Perform loop nest optimizations. Same as -floop-nest-optimize. To
9836 use this code transformation, GCC has to be configured with
9837 --with-isl to enable the Graphite loop transformation
9838 infrastructure.
9839
9840 -fgraphite-identity
9841 Enable the identity transformation for graphite. For every SCoP we
9842 generate the polyhedral representation and transform it back to
9843 gimple. Using -fgraphite-identity we can check the costs or
9844 benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation. Some
9845 minimal optimizations are also performed by the code generator isl,
9846 like index splitting and dead code elimination in loops.
9847
9848 -floop-nest-optimize
9849 Enable the isl based loop nest optimizer. This is a generic loop
9850 nest optimizer based on the Pluto optimization algorithms. It
9851 calculates a loop structure optimized for data-locality and
9852 parallelism. This option is experimental.
9853
9854 -floop-parallelize-all
9855 Use the Graphite data dependence analysis to identify loops that
9856 can be parallelized. Parallelize all the loops that can be
9857 analyzed to not contain loop carried dependences without checking
9858 that it is profitable to parallelize the loops.
9859
9860 -ftree-coalesce-vars
9861 While transforming the program out of the SSA representation,
9862 attempt to reduce copying by coalescing versions of different user-
9863 defined variables, instead of just compiler temporaries. This may
9864 severely limit the ability to debug an optimized program compiled
9865 with -fno-var-tracking-assignments. In the negated form, this flag
9866 prevents SSA coalescing of user variables. This option is enabled
9867 by default if optimization is enabled, and it does very little
9868 otherwise.
9869
9870 -ftree-loop-if-convert
9871 Attempt to transform conditional jumps in the innermost loops to
9872 branch-less equivalents. The intent is to remove control-flow from
9873 the innermost loops in order to improve the ability of the
9874 vectorization pass to handle these loops. This is enabled by
9875 default if vectorization is enabled.
9876
9877 -ftree-loop-distribution
9878 Perform loop distribution. This flag can improve cache performance
9879 on big loop bodies and allow further loop optimizations, like
9880 parallelization or vectorization, to take place. For example, the
9881 loop
9882
9883 DO I = 1, N
9884 A(I) = B(I) + C
9885 D(I) = E(I) * F
9886 ENDDO
9887
9888 is transformed to
9889
9890 DO I = 1, N
9891 A(I) = B(I) + C
9892 ENDDO
9893 DO I = 1, N
9894 D(I) = E(I) * F
9895 ENDDO
9896
9897 This flag is enabled by default at -O3. It is also enabled by
9898 -fprofile-use and -fauto-profile.
9899
9900 -ftree-loop-distribute-patterns
9901 Perform loop distribution of patterns that can be code generated
9902 with calls to a library. This flag is enabled by default at -O2
9903 and higher, and by -fprofile-use and -fauto-profile.
9904
9905 This pass distributes the initialization loops and generates a call
9906 to memset zero. For example, the loop
9907
9908 DO I = 1, N
9909 A(I) = 0
9910 B(I) = A(I) + I
9911 ENDDO
9912
9913 is transformed to
9914
9915 DO I = 1, N
9916 A(I) = 0
9917 ENDDO
9918 DO I = 1, N
9919 B(I) = A(I) + I
9920 ENDDO
9921
9922 and the initialization loop is transformed into a call to memset
9923 zero. This flag is enabled by default at -O3. It is also enabled
9924 by -fprofile-use and -fauto-profile.
9925
9926 -floop-interchange
9927 Perform loop interchange outside of graphite. This flag can
9928 improve cache performance on loop nest and allow further loop
9929 optimizations, like vectorization, to take place. For example, the
9930 loop
9931
9932 for (int i = 0; i < N; i++)
9933 for (int j = 0; j < N; j++)
9934 for (int k = 0; k < N; k++)
9935 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9936
9937 is transformed to
9938
9939 for (int i = 0; i < N; i++)
9940 for (int k = 0; k < N; k++)
9941 for (int j = 0; j < N; j++)
9942 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9943
9944 This flag is enabled by default at -O3. It is also enabled by
9945 -fprofile-use and -fauto-profile.
9946
9947 -floop-unroll-and-jam
9948 Apply unroll and jam transformations on feasible loops. In a loop
9949 nest this unrolls the outer loop by some factor and fuses the
9950 resulting multiple inner loops. This flag is enabled by default at
9951 -O3. It is also enabled by -fprofile-use and -fauto-profile.
9952
9953 -ftree-loop-im
9954 Perform loop invariant motion on trees. This pass moves only
9955 invariants that are hard to handle at RTL level (function calls,
9956 operations that expand to nontrivial sequences of insns). With
9957 -funswitch-loops it also moves operands of conditions that are
9958 invariant out of the loop, so that we can use just trivial
9959 invariantness analysis in loop unswitching. The pass also includes
9960 store motion.
9961
9962 -ftree-loop-ivcanon
9963 Create a canonical counter for number of iterations in loops for
9964 which determining number of iterations requires complicated
9965 analysis. Later optimizations then may determine the number
9966 easily. Useful especially in connection with unrolling.
9967
9968 -ftree-scev-cprop
9969 Perform final value replacement. If a variable is modified in a
9970 loop in such a way that its value when exiting the loop can be
9971 determined using only its initial value and the number of loop
9972 iterations, replace uses of the final value by such a computation,
9973 provided it is sufficiently cheap. This reduces data dependencies
9974 and may allow further simplifications. Enabled by default at -O1
9975 and higher.
9976
9977 -fivopts
9978 Perform induction variable optimizations (strength reduction,
9979 induction variable merging and induction variable elimination) on
9980 trees.
9981
9982 -ftree-parallelize-loops=n
9983 Parallelize loops, i.e., split their iteration space to run in n
9984 threads. This is only possible for loops whose iterations are
9985 independent and can be arbitrarily reordered. The optimization is
9986 only profitable on multiprocessor machines, for loops that are CPU-
9987 intensive, rather than constrained e.g. by memory bandwidth. This
9988 option implies -pthread, and thus is only supported on targets that
9989 have support for -pthread.
9990
9991 -ftree-pta
9992 Perform function-local points-to analysis on trees. This flag is
9993 enabled by default at -O1 and higher, except for -Og.
9994
9995 -ftree-sra
9996 Perform scalar replacement of aggregates. This pass replaces
9997 structure references with scalars to prevent committing structures
9998 to memory too early. This flag is enabled by default at -O1 and
9999 higher, except for -Og.
10000
10001 -fstore-merging
10002 Perform merging of narrow stores to consecutive memory addresses.
10003 This pass merges contiguous stores of immediate values narrower
10004 than a word into fewer wider stores to reduce the number of
10005 instructions. This is enabled by default at -O2 and higher as well
10006 as -Os.
10007
10008 -ftree-ter
10009 Perform temporary expression replacement during the SSA->normal
10010 phase. Single use/single def temporaries are replaced at their use
10011 location with their defining expression. This results in non-
10012 GIMPLE code, but gives the expanders much more complex trees to
10013 work on resulting in better RTL generation. This is enabled by
10014 default at -O1 and higher.
10015
10016 -ftree-slsr
10017 Perform straight-line strength reduction on trees. This recognizes
10018 related expressions involving multiplications and replaces them by
10019 less expensive calculations when possible. This is enabled by
10020 default at -O1 and higher.
10021
10022 -ftree-vectorize
10023 Perform vectorization on trees. This flag enables
10024 -ftree-loop-vectorize and -ftree-slp-vectorize if not explicitly
10025 specified.
10026
10027 -ftree-loop-vectorize
10028 Perform loop vectorization on trees. This flag is enabled by
10029 default at -O2 and by -ftree-vectorize, -fprofile-use, and
10030 -fauto-profile.
10031
10032 -ftree-slp-vectorize
10033 Perform basic block vectorization on trees. This flag is enabled by
10034 default at -O2 and by -ftree-vectorize, -fprofile-use, and
10035 -fauto-profile.
10036
10037 -ftrivial-auto-var-init=choice
10038 Initialize automatic variables with either a pattern or with zeroes
10039 to increase the security and predictability of a program by
10040 preventing uninitialized memory disclosure and use. GCC still
10041 considers an automatic variable that doesn't have an explicit
10042 initializer as uninitialized, -Wuninitialized and
10043 -Wanalyzer-use-of-uninitialized-value will still report warning
10044 messages on such automatic variables. With this option, GCC will
10045 also initialize any padding of automatic variables that have
10046 structure or union types to zeroes. However, the current
10047 implementation cannot initialize automatic variables that are
10048 declared between the controlling expression and the first case of a
10049 "switch" statement. Using -Wtrivial-auto-var-init to report all
10050 such cases.
10051
10052 The three values of choice are:
10053
10054 * uninitialized doesn't initialize any automatic variables. This
10055 is C and C++'s default.
10056
10057 * pattern Initialize automatic variables with values which will
10058 likely transform logic bugs into crashes down the line, are
10059 easily recognized in a crash dump and without being values that
10060 programmers can rely on for useful program semantics. The
10061 current value is byte-repeatable pattern with byte "0xFE". The
10062 values used for pattern initialization might be changed in the
10063 future.
10064
10065 * zero Initialize automatic variables with zeroes.
10066
10067 The default is uninitialized.
10068
10069 You can control this behavior for a specific variable by using the
10070 variable attribute "uninitialized".
10071
10072 -fvect-cost-model=model
10073 Alter the cost model used for vectorization. The model argument
10074 should be one of unlimited, dynamic, cheap or very-cheap. With the
10075 unlimited model the vectorized code-path is assumed to be
10076 profitable while with the dynamic model a runtime check guards the
10077 vectorized code-path to enable it only for iteration counts that
10078 will likely execute faster than when executing the original scalar
10079 loop. The cheap model disables vectorization of loops where doing
10080 so would be cost prohibitive for example due to required runtime
10081 checks for data dependence or alignment but otherwise is equal to
10082 the dynamic model. The very-cheap model only allows vectorization
10083 if the vector code would entirely replace the scalar code that is
10084 being vectorized. For example, if each iteration of a vectorized
10085 loop would only be able to handle exactly four iterations of the
10086 scalar loop, the very-cheap model would only allow vectorization if
10087 the scalar iteration count is known to be a multiple of four.
10088
10089 The default cost model depends on other optimization flags and is
10090 either dynamic or cheap.
10091
10092 -fsimd-cost-model=model
10093 Alter the cost model used for vectorization of loops marked with
10094 the OpenMP simd directive. The model argument should be one of
10095 unlimited, dynamic, cheap. All values of model have the same
10096 meaning as described in -fvect-cost-model and by default a cost
10097 model defined with -fvect-cost-model is used.
10098
10099 -ftree-vrp
10100 Perform Value Range Propagation on trees. This is similar to the
10101 constant propagation pass, but instead of values, ranges of values
10102 are propagated. This allows the optimizers to remove unnecessary
10103 range checks like array bound checks and null pointer checks. This
10104 is enabled by default at -O2 and higher. Null pointer check
10105 elimination is only done if -fdelete-null-pointer-checks is
10106 enabled.
10107
10108 -fsplit-paths
10109 Split paths leading to loop backedges. This can improve dead code
10110 elimination and common subexpression elimination. This is enabled
10111 by default at -O3 and above.
10112
10113 -fsplit-ivs-in-unroller
10114 Enables expression of values of induction variables in later
10115 iterations of the unrolled loop using the value in the first
10116 iteration. This breaks long dependency chains, thus improving
10117 efficiency of the scheduling passes.
10118
10119 A combination of -fweb and CSE is often sufficient to obtain the
10120 same effect. However, that is not reliable in cases where the loop
10121 body is more complicated than a single basic block. It also does
10122 not work at all on some architectures due to restrictions in the
10123 CSE pass.
10124
10125 This optimization is enabled by default.
10126
10127 -fvariable-expansion-in-unroller
10128 With this option, the compiler creates multiple copies of some
10129 local variables when unrolling a loop, which can result in superior
10130 code.
10131
10132 This optimization is enabled by default for PowerPC targets, but
10133 disabled by default otherwise.
10134
10135 -fpartial-inlining
10136 Inline parts of functions. This option has any effect only when
10137 inlining itself is turned on by the -finline-functions or
10138 -finline-small-functions options.
10139
10140 Enabled at levels -O2, -O3, -Os.
10141
10142 -fpredictive-commoning
10143 Perform predictive commoning optimization, i.e., reusing
10144 computations (especially memory loads and stores) performed in
10145 previous iterations of loops.
10146
10147 This option is enabled at level -O3. It is also enabled by
10148 -fprofile-use and -fauto-profile.
10149
10150 -fprefetch-loop-arrays
10151 If supported by the target machine, generate instructions to
10152 prefetch memory to improve the performance of loops that access
10153 large arrays.
10154
10155 This option may generate better or worse code; results are highly
10156 dependent on the structure of loops within the source code.
10157
10158 Disabled at level -Os.
10159
10160 -fno-printf-return-value
10161 Do not substitute constants for known return value of formatted
10162 output functions such as "sprintf", "snprintf", "vsprintf", and
10163 "vsnprintf" (but not "printf" of "fprintf"). This transformation
10164 allows GCC to optimize or even eliminate branches based on the
10165 known return value of these functions called with arguments that
10166 are either constant, or whose values are known to be in a range
10167 that makes determining the exact return value possible. For
10168 example, when -fprintf-return-value is in effect, both the branch
10169 and the body of the "if" statement (but not the call to "snprint")
10170 can be optimized away when "i" is a 32-bit or smaller integer
10171 because the return value is guaranteed to be at most 8.
10172
10173 char buf[9];
10174 if (snprintf (buf, "%08x", i) >= sizeof buf)
10175 ...
10176
10177 The -fprintf-return-value option relies on other optimizations and
10178 yields best results with -O2 and above. It works in tandem with
10179 the -Wformat-overflow and -Wformat-truncation options. The
10180 -fprintf-return-value option is enabled by default.
10181
10182 -fno-peephole
10183 -fno-peephole2
10184 Disable any machine-specific peephole optimizations. The
10185 difference between -fno-peephole and -fno-peephole2 is in how they
10186 are implemented in the compiler; some targets use one, some use the
10187 other, a few use both.
10188
10189 -fpeephole is enabled by default. -fpeephole2 enabled at levels
10190 -O2, -O3, -Os.
10191
10192 -fno-guess-branch-probability
10193 Do not guess branch probabilities using heuristics.
10194
10195 GCC uses heuristics to guess branch probabilities if they are not
10196 provided by profiling feedback (-fprofile-arcs). These heuristics
10197 are based on the control flow graph. If some branch probabilities
10198 are specified by "__builtin_expect", then the heuristics are used
10199 to guess branch probabilities for the rest of the control flow
10200 graph, taking the "__builtin_expect" info into account. The
10201 interactions between the heuristics and "__builtin_expect" can be
10202 complex, and in some cases, it may be useful to disable the
10203 heuristics so that the effects of "__builtin_expect" are easier to
10204 understand.
10205
10206 It is also possible to specify expected probability of the
10207 expression with "__builtin_expect_with_probability" built-in
10208 function.
10209
10210 The default is -fguess-branch-probability at levels -O, -O2, -O3,
10211 -Os.
10212
10213 -freorder-blocks
10214 Reorder basic blocks in the compiled function in order to reduce
10215 number of taken branches and improve code locality.
10216
10217 Enabled at levels -O1, -O2, -O3, -Os.
10218
10219 -freorder-blocks-algorithm=algorithm
10220 Use the specified algorithm for basic block reordering. The
10221 algorithm argument can be simple, which does not increase code size
10222 (except sometimes due to secondary effects like alignment), or stc,
10223 the "software trace cache" algorithm, which tries to put all often
10224 executed code together, minimizing the number of branches executed
10225 by making extra copies of code.
10226
10227 The default is simple at levels -O1, -Os, and stc at levels -O2,
10228 -O3.
10229
10230 -freorder-blocks-and-partition
10231 In addition to reordering basic blocks in the compiled function, in
10232 order to reduce number of taken branches, partitions hot and cold
10233 basic blocks into separate sections of the assembly and .o files,
10234 to improve paging and cache locality performance.
10235
10236 This optimization is automatically turned off in the presence of
10237 exception handling or unwind tables (on targets using
10238 setjump/longjump or target specific scheme), for linkonce sections,
10239 for functions with a user-defined section attribute and on any
10240 architecture that does not support named sections. When
10241 -fsplit-stack is used this option is not enabled by default (to
10242 avoid linker errors), but may be enabled explicitly (if using a
10243 working linker).
10244
10245 Enabled for x86 at levels -O2, -O3, -Os.
10246
10247 -freorder-functions
10248 Reorder functions in the object file in order to improve code
10249 locality. This is implemented by using special subsections
10250 ".text.hot" for most frequently executed functions and
10251 ".text.unlikely" for unlikely executed functions. Reordering is
10252 done by the linker so object file format must support named
10253 sections and linker must place them in a reasonable way.
10254
10255 This option isn't effective unless you either provide profile
10256 feedback (see -fprofile-arcs for details) or manually annotate
10257 functions with "hot" or "cold" attributes.
10258
10259 Enabled at levels -O2, -O3, -Os.
10260
10261 -fstrict-aliasing
10262 Allow the compiler to assume the strictest aliasing rules
10263 applicable to the language being compiled. For C (and C++), this
10264 activates optimizations based on the type of expressions. In
10265 particular, an object of one type is assumed never to reside at the
10266 same address as an object of a different type, unless the types are
10267 almost the same. For example, an "unsigned int" can alias an
10268 "int", but not a "void*" or a "double". A character type may alias
10269 any other type.
10270
10271 Pay special attention to code like this:
10272
10273 union a_union {
10274 int i;
10275 double d;
10276 };
10277
10278 int f() {
10279 union a_union t;
10280 t.d = 3.0;
10281 return t.i;
10282 }
10283
10284 The practice of reading from a different union member than the one
10285 most recently written to (called "type-punning") is common. Even
10286 with -fstrict-aliasing, type-punning is allowed, provided the
10287 memory is accessed through the union type. So, the code above
10288 works as expected. However, this code might not:
10289
10290 int f() {
10291 union a_union t;
10292 int* ip;
10293 t.d = 3.0;
10294 ip = &t.i;
10295 return *ip;
10296 }
10297
10298 Similarly, access by taking the address, casting the resulting
10299 pointer and dereferencing the result has undefined behavior, even
10300 if the cast uses a union type, e.g.:
10301
10302 int f() {
10303 double d = 3.0;
10304 return ((union a_union *) &d)->i;
10305 }
10306
10307 The -fstrict-aliasing option is enabled at levels -O2, -O3, -Os.
10308
10309 -fipa-strict-aliasing
10310 Controls whether rules of -fstrict-aliasing are applied across
10311 function boundaries. Note that if multiple functions gets inlined
10312 into a single function the memory accesses are no longer considered
10313 to be crossing a function boundary.
10314
10315 The -fipa-strict-aliasing option is enabled by default and is
10316 effective only in combination with -fstrict-aliasing.
10317
10318 -falign-functions
10319 -falign-functions=n
10320 -falign-functions=n:m
10321 -falign-functions=n:m:n2
10322 -falign-functions=n:m:n2:m2
10323 Align the start of functions to the next power-of-two greater than
10324 or equal to n, skipping up to m-1 bytes. This ensures that at
10325 least the first m bytes of the function can be fetched by the CPU
10326 without crossing an n-byte alignment boundary.
10327
10328 If m is not specified, it defaults to n.
10329
10330 Examples: -falign-functions=32 aligns functions to the next 32-byte
10331 boundary, -falign-functions=24 aligns to the next 32-byte boundary
10332 only if this can be done by skipping 23 bytes or less,
10333 -falign-functions=32:7 aligns to the next 32-byte boundary only if
10334 this can be done by skipping 6 bytes or less.
10335
10336 The second pair of n2:m2 values allows you to specify a secondary
10337 alignment: -falign-functions=64:7:32:3 aligns to the next 64-byte
10338 boundary if this can be done by skipping 6 bytes or less, otherwise
10339 aligns to the next 32-byte boundary if this can be done by skipping
10340 2 bytes or less. If m2 is not specified, it defaults to n2.
10341
10342 Some assemblers only support this flag when n is a power of two; in
10343 that case, it is rounded up.
10344
10345 -fno-align-functions and -falign-functions=1 are equivalent and
10346 mean that functions are not aligned.
10347
10348 If n is not specified or is zero, use a machine-dependent default.
10349 The maximum allowed n option value is 65536.
10350
10351 Enabled at levels -O2, -O3.
10352
10353 -flimit-function-alignment
10354 If this option is enabled, the compiler tries to avoid
10355 unnecessarily overaligning functions. It attempts to instruct the
10356 assembler to align by the amount specified by -falign-functions,
10357 but not to skip more bytes than the size of the function.
10358
10359 -falign-labels
10360 -falign-labels=n
10361 -falign-labels=n:m
10362 -falign-labels=n:m:n2
10363 -falign-labels=n:m:n2:m2
10364 Align all branch targets to a power-of-two boundary.
10365
10366 Parameters of this option are analogous to the -falign-functions
10367 option. -fno-align-labels and -falign-labels=1 are equivalent and
10368 mean that labels are not aligned.
10369
10370 If -falign-loops or -falign-jumps are applicable and are greater
10371 than this value, then their values are used instead.
10372
10373 If n is not specified or is zero, use a machine-dependent default
10374 which is very likely to be 1, meaning no alignment. The maximum
10375 allowed n option value is 65536.
10376
10377 Enabled at levels -O2, -O3.
10378
10379 -falign-loops
10380 -falign-loops=n
10381 -falign-loops=n:m
10382 -falign-loops=n:m:n2
10383 -falign-loops=n:m:n2:m2
10384 Align loops to a power-of-two boundary. If the loops are executed
10385 many times, this makes up for any execution of the dummy padding
10386 instructions.
10387
10388 If -falign-labels is greater than this value, then its value is
10389 used instead.
10390
10391 Parameters of this option are analogous to the -falign-functions
10392 option. -fno-align-loops and -falign-loops=1 are equivalent and
10393 mean that loops are not aligned. The maximum allowed n option
10394 value is 65536.
10395
10396 If n is not specified or is zero, use a machine-dependent default.
10397
10398 Enabled at levels -O2, -O3.
10399
10400 -falign-jumps
10401 -falign-jumps=n
10402 -falign-jumps=n:m
10403 -falign-jumps=n:m:n2
10404 -falign-jumps=n:m:n2:m2
10405 Align branch targets to a power-of-two boundary, for branch targets
10406 where the targets can only be reached by jumping. In this case, no
10407 dummy operations need be executed.
10408
10409 If -falign-labels is greater than this value, then its value is
10410 used instead.
10411
10412 Parameters of this option are analogous to the -falign-functions
10413 option. -fno-align-jumps and -falign-jumps=1 are equivalent and
10414 mean that loops are not aligned.
10415
10416 If n is not specified or is zero, use a machine-dependent default.
10417 The maximum allowed n option value is 65536.
10418
10419 Enabled at levels -O2, -O3.
10420
10421 -fno-allocation-dce
10422 Do not remove unused C++ allocations in dead code elimination.
10423
10424 -fallow-store-data-races
10425 Allow the compiler to perform optimizations that may introduce new
10426 data races on stores, without proving that the variable cannot be
10427 concurrently accessed by other threads. Does not affect
10428 optimization of local data. It is safe to use this option if it is
10429 known that global data will not be accessed by multiple threads.
10430
10431 Examples of optimizations enabled by -fallow-store-data-races
10432 include hoisting or if-conversions that may cause a value that was
10433 already in memory to be re-written with that same value. Such re-
10434 writing is safe in a single threaded context but may be unsafe in a
10435 multi-threaded context. Note that on some processors, if-
10436 conversions may be required in order to enable vectorization.
10437
10438 Enabled at level -Ofast.
10439
10440 -funit-at-a-time
10441 This option is left for compatibility reasons. -funit-at-a-time has
10442 no effect, while -fno-unit-at-a-time implies -fno-toplevel-reorder
10443 and -fno-section-anchors.
10444
10445 Enabled by default.
10446
10447 -fno-toplevel-reorder
10448 Do not reorder top-level functions, variables, and "asm"
10449 statements. Output them in the same order that they appear in the
10450 input file. When this option is used, unreferenced static
10451 variables are not removed. This option is intended to support
10452 existing code that relies on a particular ordering. For new code,
10453 it is better to use attributes when possible.
10454
10455 -ftoplevel-reorder is the default at -O1 and higher, and also at
10456 -O0 if -fsection-anchors is explicitly requested. Additionally
10457 -fno-toplevel-reorder implies -fno-section-anchors.
10458
10459 -fweb
10460 Constructs webs as commonly used for register allocation purposes
10461 and assign each web individual pseudo register. This allows the
10462 register allocation pass to operate on pseudos directly, but also
10463 strengthens several other optimization passes, such as CSE, loop
10464 optimizer and trivial dead code remover. It can, however, make
10465 debugging impossible, since variables no longer stay in a "home
10466 register".
10467
10468 Enabled by default with -funroll-loops.
10469
10470 -fwhole-program
10471 Assume that the current compilation unit represents the whole
10472 program being compiled. All public functions and variables with
10473 the exception of "main" and those merged by attribute
10474 "externally_visible" become static functions and in effect are
10475 optimized more aggressively by interprocedural optimizers.
10476
10477 This option should not be used in combination with -flto. Instead
10478 relying on a linker plugin should provide safer and more precise
10479 information.
10480
10481 -flto[=n]
10482 This option runs the standard link-time optimizer. When invoked
10483 with source code, it generates GIMPLE (one of GCC's internal
10484 representations) and writes it to special ELF sections in the
10485 object file. When the object files are linked together, all the
10486 function bodies are read from these ELF sections and instantiated
10487 as if they had been part of the same translation unit.
10488
10489 To use the link-time optimizer, -flto and optimization options
10490 should be specified at compile time and during the final link. It
10491 is recommended that you compile all the files participating in the
10492 same link with the same options and also specify those options at
10493 link time. For example:
10494
10495 gcc -c -O2 -flto foo.c
10496 gcc -c -O2 -flto bar.c
10497 gcc -o myprog -flto -O2 foo.o bar.o
10498
10499 The first two invocations to GCC save a bytecode representation of
10500 GIMPLE into special ELF sections inside foo.o and bar.o. The final
10501 invocation reads the GIMPLE bytecode from foo.o and bar.o, merges
10502 the two files into a single internal image, and compiles the result
10503 as usual. Since both foo.o and bar.o are merged into a single
10504 image, this causes all the interprocedural analyses and
10505 optimizations in GCC to work across the two files as if they were a
10506 single one. This means, for example, that the inliner is able to
10507 inline functions in bar.o into functions in foo.o and vice-versa.
10508
10509 Another (simpler) way to enable link-time optimization is:
10510
10511 gcc -o myprog -flto -O2 foo.c bar.c
10512
10513 The above generates bytecode for foo.c and bar.c, merges them
10514 together into a single GIMPLE representation and optimizes them as
10515 usual to produce myprog.
10516
10517 The important thing to keep in mind is that to enable link-time
10518 optimizations you need to use the GCC driver to perform the link
10519 step. GCC automatically performs link-time optimization if any of
10520 the objects involved were compiled with the -flto command-line
10521 option. You can always override the automatic decision to do link-
10522 time optimization by passing -fno-lto to the link command.
10523
10524 To make whole program optimization effective, it is necessary to
10525 make certain whole program assumptions. The compiler needs to know
10526 what functions and variables can be accessed by libraries and
10527 runtime outside of the link-time optimized unit. When supported by
10528 the linker, the linker plugin (see -fuse-linker-plugin) passes
10529 information to the compiler about used and externally visible
10530 symbols. When the linker plugin is not available, -fwhole-program
10531 should be used to allow the compiler to make these assumptions,
10532 which leads to more aggressive optimization decisions.
10533
10534 When a file is compiled with -flto without -fuse-linker-plugin, the
10535 generated object file is larger than a regular object file because
10536 it contains GIMPLE bytecodes and the usual final code (see
10537 -ffat-lto-objects). This means that object files with LTO
10538 information can be linked as normal object files; if -fno-lto is
10539 passed to the linker, no interprocedural optimizations are applied.
10540 Note that when -fno-fat-lto-objects is enabled the compile stage is
10541 faster but you cannot perform a regular, non-LTO link on them.
10542
10543 When producing the final binary, GCC only applies link-time
10544 optimizations to those files that contain bytecode. Therefore, you
10545 can mix and match object files and libraries with GIMPLE bytecodes
10546 and final object code. GCC automatically selects which files to
10547 optimize in LTO mode and which files to link without further
10548 processing.
10549
10550 Generally, options specified at link time override those specified
10551 at compile time, although in some cases GCC attempts to infer link-
10552 time options from the settings used to compile the input files.
10553
10554 If you do not specify an optimization level option -O at link time,
10555 then GCC uses the highest optimization level used when compiling
10556 the object files. Note that it is generally ineffective to specify
10557 an optimization level option only at link time and not at compile
10558 time, for two reasons. First, compiling without optimization
10559 suppresses compiler passes that gather information needed for
10560 effective optimization at link time. Second, some early
10561 optimization passes can be performed only at compile time and not
10562 at link time.
10563
10564 There are some code generation flags preserved by GCC when
10565 generating bytecodes, as they need to be used during the final
10566 link. Currently, the following options and their settings are
10567 taken from the first object file that explicitly specifies them:
10568 -fcommon, -fexceptions, -fnon-call-exceptions, -fgnu-tm and all the
10569 -m target flags.
10570
10571 The following options -fPIC, -fpic, -fpie and -fPIE are combined
10572 based on the following scheme:
10573
10574 B<-fPIC> + B<-fpic> = B<-fpic>
10575 B<-fPIC> + B<-fno-pic> = B<-fno-pic>
10576 B<-fpic/-fPIC> + (no option) = (no option)
10577 B<-fPIC> + B<-fPIE> = B<-fPIE>
10578 B<-fpic> + B<-fPIE> = B<-fpie>
10579 B<-fPIC/-fpic> + B<-fpie> = B<-fpie>
10580
10581 Certain ABI-changing flags are required to match in all compilation
10582 units, and trying to override this at link time with a conflicting
10583 value is ignored. This includes options such as
10584 -freg-struct-return and -fpcc-struct-return.
10585
10586 Other options such as -ffp-contract, -fno-strict-overflow, -fwrapv,
10587 -fno-trapv or -fno-strict-aliasing are passed through to the link
10588 stage and merged conservatively for conflicting translation units.
10589 Specifically -fno-strict-overflow, -fwrapv and -fno-trapv take
10590 precedence; and for example -ffp-contract=off takes precedence over
10591 -ffp-contract=fast. You can override them at link time.
10592
10593 Diagnostic options such as -Wstringop-overflow are passed through
10594 to the link stage and their setting matches that of the compile-
10595 step at function granularity. Note that this matters only for
10596 diagnostics emitted during optimization. Note that code transforms
10597 such as inlining can lead to warnings being enabled or disabled for
10598 regions if code not consistent with the setting at compile time.
10599
10600 When you need to pass options to the assembler via -Wa or
10601 -Xassembler make sure to either compile such translation units with
10602 -fno-lto or consistently use the same assembler options on all
10603 translation units. You can alternatively also specify assembler
10604 options at LTO link time.
10605
10606 To enable debug info generation you need to supply -g at compile
10607 time. If any of the input files at link time were built with debug
10608 info generation enabled the link will enable debug info generation
10609 as well. Any elaborate debug info settings like the dwarf level
10610 -gdwarf-5 need to be explicitly repeated at the linker command line
10611 and mixing different settings in different translation units is
10612 discouraged.
10613
10614 If LTO encounters objects with C linkage declared with incompatible
10615 types in separate translation units to be linked together
10616 (undefined behavior according to ISO C99 6.2.7), a non-fatal
10617 diagnostic may be issued. The behavior is still undefined at run
10618 time. Similar diagnostics may be raised for other languages.
10619
10620 Another feature of LTO is that it is possible to apply
10621 interprocedural optimizations on files written in different
10622 languages:
10623
10624 gcc -c -flto foo.c
10625 g++ -c -flto bar.cc
10626 gfortran -c -flto baz.f90
10627 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10628
10629 Notice that the final link is done with g++ to get the C++ runtime
10630 libraries and -lgfortran is added to get the Fortran runtime
10631 libraries. In general, when mixing languages in LTO mode, you
10632 should use the same link command options as when mixing languages
10633 in a regular (non-LTO) compilation.
10634
10635 If object files containing GIMPLE bytecode are stored in a library
10636 archive, say libfoo.a, it is possible to extract and use them in an
10637 LTO link if you are using a linker with plugin support. To create
10638 static libraries suitable for LTO, use gcc-ar and gcc-ranlib
10639 instead of ar and ranlib; to show the symbols of object files with
10640 GIMPLE bytecode, use gcc-nm. Those commands require that ar,
10641 ranlib and nm have been compiled with plugin support. At link
10642 time, use the flag -fuse-linker-plugin to ensure that the library
10643 participates in the LTO optimization process:
10644
10645 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10646
10647 With the linker plugin enabled, the linker extracts the needed
10648 GIMPLE files from libfoo.a and passes them on to the running GCC to
10649 make them part of the aggregated GIMPLE image to be optimized.
10650
10651 If you are not using a linker with plugin support and/or do not
10652 enable the linker plugin, then the objects inside libfoo.a are
10653 extracted and linked as usual, but they do not participate in the
10654 LTO optimization process. In order to make a static library
10655 suitable for both LTO optimization and usual linkage, compile its
10656 object files with -flto -ffat-lto-objects.
10657
10658 Link-time optimizations do not require the presence of the whole
10659 program to operate. If the program does not require any symbols to
10660 be exported, it is possible to combine -flto and -fwhole-program to
10661 allow the interprocedural optimizers to use more aggressive
10662 assumptions which may lead to improved optimization opportunities.
10663 Use of -fwhole-program is not needed when linker plugin is active
10664 (see -fuse-linker-plugin).
10665
10666 The current implementation of LTO makes no attempt to generate
10667 bytecode that is portable between different types of hosts. The
10668 bytecode files are versioned and there is a strict version check,
10669 so bytecode files generated in one version of GCC do not work with
10670 an older or newer version of GCC.
10671
10672 Link-time optimization does not work well with generation of
10673 debugging information on systems other than those using a
10674 combination of ELF and DWARF.
10675
10676 If you specify the optional n, the optimization and code generation
10677 done at link time is executed in parallel using n parallel jobs by
10678 utilizing an installed make program. The environment variable MAKE
10679 may be used to override the program used.
10680
10681 You can also specify -flto=jobserver to use GNU make's job server
10682 mode to determine the number of parallel jobs. This is useful when
10683 the Makefile calling GCC is already executing in parallel. You
10684 must prepend a + to the command recipe in the parent Makefile for
10685 this to work. This option likely only works if MAKE is GNU make.
10686 Even without the option value, GCC tries to automatically detect a
10687 running GNU make's job server.
10688
10689 Use -flto=auto to use GNU make's job server, if available, or
10690 otherwise fall back to autodetection of the number of CPU threads
10691 present in your system.
10692
10693 -flto-partition=alg
10694 Specify the partitioning algorithm used by the link-time optimizer.
10695 The value is either 1to1 to specify a partitioning mirroring the
10696 original source files or balanced to specify partitioning into
10697 equally sized chunks (whenever possible) or max to create new
10698 partition for every symbol where possible. Specifying none as an
10699 algorithm disables partitioning and streaming completely. The
10700 default value is balanced. While 1to1 can be used as an workaround
10701 for various code ordering issues, the max partitioning is intended
10702 for internal testing only. The value one specifies that exactly
10703 one partition should be used while the value none bypasses
10704 partitioning and executes the link-time optimization step directly
10705 from the WPA phase.
10706
10707 -flto-compression-level=n
10708 This option specifies the level of compression used for
10709 intermediate language written to LTO object files, and is only
10710 meaningful in conjunction with LTO mode (-flto). GCC currently
10711 supports two LTO compression algorithms. For zstd, valid values are
10712 0 (no compression) to 19 (maximum compression), while zlib supports
10713 values from 0 to 9. Values outside this range are clamped to
10714 either minimum or maximum of the supported values. If the option
10715 is not given, a default balanced compression setting is used.
10716
10717 -fuse-linker-plugin
10718 Enables the use of a linker plugin during link-time optimization.
10719 This option relies on plugin support in the linker, which is
10720 available in gold or in GNU ld 2.21 or newer.
10721
10722 This option enables the extraction of object files with GIMPLE
10723 bytecode out of library archives. This improves the quality of
10724 optimization by exposing more code to the link-time optimizer.
10725 This information specifies what symbols can be accessed externally
10726 (by non-LTO object or during dynamic linking). Resulting code
10727 quality improvements on binaries (and shared libraries that use
10728 hidden visibility) are similar to -fwhole-program. See -flto for a
10729 description of the effect of this flag and how to use it.
10730
10731 This option is enabled by default when LTO support in GCC is
10732 enabled and GCC was configured for use with a linker supporting
10733 plugins (GNU ld 2.21 or newer or gold).
10734
10735 -ffat-lto-objects
10736 Fat LTO objects are object files that contain both the intermediate
10737 language and the object code. This makes them usable for both LTO
10738 linking and normal linking. This option is effective only when
10739 compiling with -flto and is ignored at link time.
10740
10741 -fno-fat-lto-objects improves compilation time over plain LTO, but
10742 requires the complete toolchain to be aware of LTO. It requires a
10743 linker with linker plugin support for basic functionality.
10744 Additionally, nm, ar and ranlib need to support linker plugins to
10745 allow a full-featured build environment (capable of building static
10746 libraries etc). GCC provides the gcc-ar, gcc-nm, gcc-ranlib
10747 wrappers to pass the right options to these tools. With non fat LTO
10748 makefiles need to be modified to use them.
10749
10750 Note that modern binutils provide plugin auto-load mechanism.
10751 Installing the linker plugin into $libdir/bfd-plugins has the same
10752 effect as usage of the command wrappers (gcc-ar, gcc-nm and gcc-
10753 ranlib).
10754
10755 The default is -fno-fat-lto-objects on targets with linker plugin
10756 support.
10757
10758 -fcompare-elim
10759 After register allocation and post-register allocation instruction
10760 splitting, identify arithmetic instructions that compute processor
10761 flags similar to a comparison operation based on that arithmetic.
10762 If possible, eliminate the explicit comparison operation.
10763
10764 This pass only applies to certain targets that cannot explicitly
10765 represent the comparison operation before register allocation is
10766 complete.
10767
10768 Enabled at levels -O1, -O2, -O3, -Os.
10769
10770 -fcprop-registers
10771 After register allocation and post-register allocation instruction
10772 splitting, perform a copy-propagation pass to try to reduce
10773 scheduling dependencies and occasionally eliminate the copy.
10774
10775 Enabled at levels -O1, -O2, -O3, -Os.
10776
10777 -fprofile-correction
10778 Profiles collected using an instrumented binary for multi-threaded
10779 programs may be inconsistent due to missed counter updates. When
10780 this option is specified, GCC uses heuristics to correct or smooth
10781 out such inconsistencies. By default, GCC emits an error message
10782 when an inconsistent profile is detected.
10783
10784 This option is enabled by -fauto-profile.
10785
10786 -fprofile-partial-training
10787 With "-fprofile-use" all portions of programs not executed during
10788 train run are optimized agressively for size rather than speed. In
10789 some cases it is not practical to train all possible hot paths in
10790 the program. (For example, program may contain functions specific
10791 for a given hardware and trianing may not cover all hardware
10792 configurations program is run on.) With
10793 "-fprofile-partial-training" profile feedback will be ignored for
10794 all functions not executed during the train run leading them to be
10795 optimized as if they were compiled without profile feedback. This
10796 leads to better performance when train run is not representative
10797 but also leads to significantly bigger code.
10798
10799 -fprofile-use
10800 -fprofile-use=path
10801 Enable profile feedback-directed optimizations, and the following
10802 optimizations, many of which are generally profitable only with
10803 profile feedback available:
10804
10805 -fbranch-probabilities -fprofile-values -funroll-loops
10806 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
10807 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
10808 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
10809 -ftree-slp-vectorize -fvect-cost-model=dynamic
10810 -ftree-loop-distribute-patterns -fprofile-reorder-functions
10811
10812 Before you can use this option, you must first generate profiling
10813 information.
10814
10815 By default, GCC emits an error message if the feedback profiles do
10816 not match the source code. This error can be turned into a warning
10817 by using -Wno-error=coverage-mismatch. Note this may result in
10818 poorly optimized code. Additionally, by default, GCC also emits a
10819 warning message if the feedback profiles do not exist (see
10820 -Wmissing-profile).
10821
10822 If path is specified, GCC looks at the path to find the profile
10823 feedback data files. See -fprofile-dir.
10824
10825 -fauto-profile
10826 -fauto-profile=path
10827 Enable sampling-based feedback-directed optimizations, and the
10828 following optimizations, many of which are generally profitable
10829 only with profile feedback available:
10830
10831 -fbranch-probabilities -fprofile-values -funroll-loops
10832 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
10833 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
10834 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
10835 -ftree-slp-vectorize -fvect-cost-model=dynamic
10836 -ftree-loop-distribute-patterns -fprofile-correction
10837
10838 path is the name of a file containing AutoFDO profile information.
10839 If omitted, it defaults to fbdata.afdo in the current directory.
10840
10841 Producing an AutoFDO profile data file requires running your
10842 program with the perf utility on a supported GNU/Linux target
10843 system. For more information, see <https://perf.wiki.kernel.org/>.
10844
10845 E.g.
10846
10847 perf record -e br_inst_retired:near_taken -b -o perf.data \
10848 -- your_program
10849
10850 Then use the create_gcov tool to convert the raw profile data to a
10851 format that can be used by GCC. You must also supply the
10852 unstripped binary for your program to this tool. See
10853 <https://github.com/google/autofdo>.
10854
10855 E.g.
10856
10857 create_gcov --binary=your_program.unstripped --profile=perf.data \
10858 --gcov=profile.afdo
10859
10860 The following options control compiler behavior regarding floating-
10861 point arithmetic. These options trade off between speed and
10862 correctness. All must be specifically enabled.
10863
10864 -ffloat-store
10865 Do not store floating-point variables in registers, and inhibit
10866 other options that might change whether a floating-point value is
10867 taken from a register or memory.
10868
10869 This option prevents undesirable excess precision on machines such
10870 as the 68000 where the floating registers (of the 68881) keep more
10871 precision than a "double" is supposed to have. Similarly for the
10872 x86 architecture. For most programs, the excess precision does
10873 only good, but a few programs rely on the precise definition of
10874 IEEE floating point. Use -ffloat-store for such programs, after
10875 modifying them to store all pertinent intermediate computations
10876 into variables.
10877
10878 -fexcess-precision=style
10879 This option allows further control over excess precision on
10880 machines where floating-point operations occur in a format with
10881 more precision or range than the IEEE standard and interchange
10882 floating-point types. By default, -fexcess-precision=fast is in
10883 effect; this means that operations may be carried out in a wider
10884 precision than the types specified in the source if that would
10885 result in faster code, and it is unpredictable when rounding to the
10886 types specified in the source code takes place. When compiling C,
10887 if -fexcess-precision=standard is specified then excess precision
10888 follows the rules specified in ISO C99; in particular, both casts
10889 and assignments cause values to be rounded to their semantic types
10890 (whereas -ffloat-store only affects assignments). This option is
10891 enabled by default for C if a strict conformance option such as
10892 -std=c99 is used. -ffast-math enables -fexcess-precision=fast by
10893 default regardless of whether a strict conformance option is used.
10894
10895 -fexcess-precision=standard is not implemented for languages other
10896 than C. On the x86, it has no effect if -mfpmath=sse or
10897 -mfpmath=sse+387 is specified; in the former case, IEEE semantics
10898 apply without excess precision, and in the latter, rounding is
10899 unpredictable.
10900
10901 -ffast-math
10902 Sets the options -fno-math-errno, -funsafe-math-optimizations,
10903 -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans,
10904 -fcx-limited-range and -fexcess-precision=fast.
10905
10906 This option causes the preprocessor macro "__FAST_MATH__" to be
10907 defined.
10908
10909 This option is not turned on by any -O option besides -Ofast since
10910 it can result in incorrect output for programs that depend on an
10911 exact implementation of IEEE or ISO rules/specifications for math
10912 functions. It may, however, yield faster code for programs that do
10913 not require the guarantees of these specifications.
10914
10915 -fno-math-errno
10916 Do not set "errno" after calling math functions that are executed
10917 with a single instruction, e.g., "sqrt". A program that relies on
10918 IEEE exceptions for math error handling may want to use this flag
10919 for speed while maintaining IEEE arithmetic compatibility.
10920
10921 This option is not turned on by any -O option since it can result
10922 in incorrect output for programs that depend on an exact
10923 implementation of IEEE or ISO rules/specifications for math
10924 functions. It may, however, yield faster code for programs that do
10925 not require the guarantees of these specifications.
10926
10927 The default is -fmath-errno.
10928
10929 On Darwin systems, the math library never sets "errno". There is
10930 therefore no reason for the compiler to consider the possibility
10931 that it might, and -fno-math-errno is the default.
10932
10933 -funsafe-math-optimizations
10934 Allow optimizations for floating-point arithmetic that (a) assume
10935 that arguments and results are valid and (b) may violate IEEE or
10936 ANSI standards. When used at link time, it may include libraries
10937 or startup files that change the default FPU control word or other
10938 similar optimizations.
10939
10940 This option is not turned on by any -O option since it can result
10941 in incorrect output for programs that depend on an exact
10942 implementation of IEEE or ISO rules/specifications for math
10943 functions. It may, however, yield faster code for programs that do
10944 not require the guarantees of these specifications. Enables
10945 -fno-signed-zeros, -fno-trapping-math, -fassociative-math and
10946 -freciprocal-math.
10947
10948 The default is -fno-unsafe-math-optimizations.
10949
10950 -fassociative-math
10951 Allow re-association of operands in series of floating-point
10952 operations. This violates the ISO C and C++ language standard by
10953 possibly changing computation result. NOTE: re-ordering may change
10954 the sign of zero as well as ignore NaNs and inhibit or create
10955 underflow or overflow (and thus cannot be used on code that relies
10956 on rounding behavior like "(x + 2**52) - 2**52". May also reorder
10957 floating-point comparisons and thus may not be used when ordered
10958 comparisons are required. This option requires that both
10959 -fno-signed-zeros and -fno-trapping-math be in effect. Moreover,
10960 it doesn't make much sense with -frounding-math. For Fortran the
10961 option is automatically enabled when both -fno-signed-zeros and
10962 -fno-trapping-math are in effect.
10963
10964 The default is -fno-associative-math.
10965
10966 -freciprocal-math
10967 Allow the reciprocal of a value to be used instead of dividing by
10968 the value if this enables optimizations. For example "x / y" can
10969 be replaced with "x * (1/y)", which is useful if "(1/y)" is subject
10970 to common subexpression elimination. Note that this loses
10971 precision and increases the number of flops operating on the value.
10972
10973 The default is -fno-reciprocal-math.
10974
10975 -ffinite-math-only
10976 Allow optimizations for floating-point arithmetic that assume that
10977 arguments and results are not NaNs or +-Infs.
10978
10979 This option is not turned on by any -O option since it can result
10980 in incorrect output for programs that depend on an exact
10981 implementation of IEEE or ISO rules/specifications for math
10982 functions. It may, however, yield faster code for programs that do
10983 not require the guarantees of these specifications.
10984
10985 The default is -fno-finite-math-only.
10986
10987 -fno-signed-zeros
10988 Allow optimizations for floating-point arithmetic that ignore the
10989 signedness of zero. IEEE arithmetic specifies the behavior of
10990 distinct +0.0 and -0.0 values, which then prohibits simplification
10991 of expressions such as x+0.0 or 0.0*x (even with
10992 -ffinite-math-only). This option implies that the sign of a zero
10993 result isn't significant.
10994
10995 The default is -fsigned-zeros.
10996
10997 -fno-trapping-math
10998 Compile code assuming that floating-point operations cannot
10999 generate user-visible traps. These traps include division by zero,
11000 overflow, underflow, inexact result and invalid operation. This
11001 option requires that -fno-signaling-nans be in effect. Setting
11002 this option may allow faster code if one relies on "non-stop" IEEE
11003 arithmetic, for example.
11004
11005 This option should never be turned on by any -O option since it can
11006 result in incorrect output for programs that depend on an exact
11007 implementation of IEEE or ISO rules/specifications for math
11008 functions.
11009
11010 The default is -ftrapping-math.
11011
11012 -frounding-math
11013 Disable transformations and optimizations that assume default
11014 floating-point rounding behavior. This is round-to-zero for all
11015 floating point to integer conversions, and round-to-nearest for all
11016 other arithmetic truncations. This option should be specified for
11017 programs that change the FP rounding mode dynamically, or that may
11018 be executed with a non-default rounding mode. This option disables
11019 constant folding of floating-point expressions at compile time
11020 (which may be affected by rounding mode) and arithmetic
11021 transformations that are unsafe in the presence of sign-dependent
11022 rounding modes.
11023
11024 The default is -fno-rounding-math.
11025
11026 This option is experimental and does not currently guarantee to
11027 disable all GCC optimizations that are affected by rounding mode.
11028 Future versions of GCC may provide finer control of this setting
11029 using C99's "FENV_ACCESS" pragma. This command-line option will be
11030 used to specify the default state for "FENV_ACCESS".
11031
11032 -fsignaling-nans
11033 Compile code assuming that IEEE signaling NaNs may generate user-
11034 visible traps during floating-point operations. Setting this
11035 option disables optimizations that may change the number of
11036 exceptions visible with signaling NaNs. This option implies
11037 -ftrapping-math.
11038
11039 This option causes the preprocessor macro "__SUPPORT_SNAN__" to be
11040 defined.
11041
11042 The default is -fno-signaling-nans.
11043
11044 This option is experimental and does not currently guarantee to
11045 disable all GCC optimizations that affect signaling NaN behavior.
11046
11047 -fno-fp-int-builtin-inexact
11048 Do not allow the built-in functions "ceil", "floor", "round" and
11049 "trunc", and their "float" and "long double" variants, to generate
11050 code that raises the "inexact" floating-point exception for
11051 noninteger arguments. ISO C99 and C11 allow these functions to
11052 raise the "inexact" exception, but ISO/IEC TS 18661-1:2014, the C
11053 bindings to IEEE 754-2008, as integrated into ISO C2X, does not
11054 allow these functions to do so.
11055
11056 The default is -ffp-int-builtin-inexact, allowing the exception to
11057 be raised, unless C2X or a later C standard is selected. This
11058 option does nothing unless -ftrapping-math is in effect.
11059
11060 Even if -fno-fp-int-builtin-inexact is used, if the functions
11061 generate a call to a library function then the "inexact" exception
11062 may be raised if the library implementation does not follow TS
11063 18661.
11064
11065 -fsingle-precision-constant
11066 Treat floating-point constants as single precision instead of
11067 implicitly converting them to double-precision constants.
11068
11069 -fcx-limited-range
11070 When enabled, this option states that a range reduction step is not
11071 needed when performing complex division. Also, there is no
11072 checking whether the result of a complex multiplication or division
11073 is "NaN + I*NaN", with an attempt to rescue the situation in that
11074 case. The default is -fno-cx-limited-range, but is enabled by
11075 -ffast-math.
11076
11077 This option controls the default setting of the ISO C99
11078 "CX_LIMITED_RANGE" pragma. Nevertheless, the option applies to all
11079 languages.
11080
11081 -fcx-fortran-rules
11082 Complex multiplication and division follow Fortran rules. Range
11083 reduction is done as part of complex division, but there is no
11084 checking whether the result of a complex multiplication or division
11085 is "NaN + I*NaN", with an attempt to rescue the situation in that
11086 case.
11087
11088 The default is -fno-cx-fortran-rules.
11089
11090 The following options control optimizations that may improve
11091 performance, but are not enabled by any -O options. This section
11092 includes experimental options that may produce broken code.
11093
11094 -fbranch-probabilities
11095 After running a program compiled with -fprofile-arcs, you can
11096 compile it a second time using -fbranch-probabilities, to improve
11097 optimizations based on the number of times each branch was taken.
11098 When a program compiled with -fprofile-arcs exits, it saves arc
11099 execution counts to a file called sourcename.gcda for each source
11100 file. The information in this data file is very dependent on the
11101 structure of the generated code, so you must use the same source
11102 code and the same optimization options for both compilations. See
11103 details about the file naming in -fprofile-arcs.
11104
11105 With -fbranch-probabilities, GCC puts a REG_BR_PROB note on each
11106 JUMP_INSN and CALL_INSN. These can be used to improve
11107 optimization. Currently, they are only used in one place: in
11108 reorg.cc, instead of guessing which path a branch is most likely to
11109 take, the REG_BR_PROB values are used to exactly determine which
11110 path is taken more often.
11111
11112 Enabled by -fprofile-use and -fauto-profile.
11113
11114 -fprofile-values
11115 If combined with -fprofile-arcs, it adds code so that some data
11116 about values of expressions in the program is gathered.
11117
11118 With -fbranch-probabilities, it reads back the data gathered from
11119 profiling values of expressions for usage in optimizations.
11120
11121 Enabled by -fprofile-generate, -fprofile-use, and -fauto-profile.
11122
11123 -fprofile-reorder-functions
11124 Function reordering based on profile instrumentation collects first
11125 time of execution of a function and orders these functions in
11126 ascending order.
11127
11128 Enabled with -fprofile-use.
11129
11130 -fvpt
11131 If combined with -fprofile-arcs, this option instructs the compiler
11132 to add code to gather information about values of expressions.
11133
11134 With -fbranch-probabilities, it reads back the data gathered and
11135 actually performs the optimizations based on them. Currently the
11136 optimizations include specialization of division operations using
11137 the knowledge about the value of the denominator.
11138
11139 Enabled with -fprofile-use and -fauto-profile.
11140
11141 -frename-registers
11142 Attempt to avoid false dependencies in scheduled code by making use
11143 of registers left over after register allocation. This
11144 optimization most benefits processors with lots of registers.
11145 Depending on the debug information format adopted by the target,
11146 however, it can make debugging impossible, since variables no
11147 longer stay in a "home register".
11148
11149 Enabled by default with -funroll-loops.
11150
11151 -fschedule-fusion
11152 Performs a target dependent pass over the instruction stream to
11153 schedule instructions of same type together because target machine
11154 can execute them more efficiently if they are adjacent to each
11155 other in the instruction flow.
11156
11157 Enabled at levels -O2, -O3, -Os.
11158
11159 -ftracer
11160 Perform tail duplication to enlarge superblock size. This
11161 transformation simplifies the control flow of the function allowing
11162 other optimizations to do a better job.
11163
11164 Enabled by -fprofile-use and -fauto-profile.
11165
11166 -funroll-loops
11167 Unroll loops whose number of iterations can be determined at
11168 compile time or upon entry to the loop. -funroll-loops implies
11169 -frerun-cse-after-loop, -fweb and -frename-registers. It also
11170 turns on complete loop peeling (i.e. complete removal of loops with
11171 a small constant number of iterations). This option makes code
11172 larger, and may or may not make it run faster.
11173
11174 Enabled by -fprofile-use and -fauto-profile.
11175
11176 -funroll-all-loops
11177 Unroll all loops, even if their number of iterations is uncertain
11178 when the loop is entered. This usually makes programs run more
11179 slowly. -funroll-all-loops implies the same options as
11180 -funroll-loops.
11181
11182 -fpeel-loops
11183 Peels loops for which there is enough information that they do not
11184 roll much (from profile feedback or static analysis). It also
11185 turns on complete loop peeling (i.e. complete removal of loops with
11186 small constant number of iterations).
11187
11188 Enabled by -O3, -fprofile-use, and -fauto-profile.
11189
11190 -fmove-loop-invariants
11191 Enables the loop invariant motion pass in the RTL loop optimizer.
11192 Enabled at level -O1 and higher, except for -Og.
11193
11194 -fmove-loop-stores
11195 Enables the loop store motion pass in the GIMPLE loop optimizer.
11196 This moves invariant stores to after the end of the loop in
11197 exchange for carrying the stored value in a register across the
11198 iteration. Note for this option to have an effect -ftree-loop-im
11199 has to be enabled as well. Enabled at level -O1 and higher, except
11200 for -Og.
11201
11202 -fsplit-loops
11203 Split a loop into two if it contains a condition that's always true
11204 for one side of the iteration space and false for the other.
11205
11206 Enabled by -fprofile-use and -fauto-profile.
11207
11208 -funswitch-loops
11209 Move branches with loop invariant conditions out of the loop, with
11210 duplicates of the loop on both branches (modified according to
11211 result of the condition).
11212
11213 Enabled by -fprofile-use and -fauto-profile.
11214
11215 -fversion-loops-for-strides
11216 If a loop iterates over an array with a variable stride, create
11217 another version of the loop that assumes the stride is always one.
11218 For example:
11219
11220 for (int i = 0; i < n; ++i)
11221 x[i * stride] = ...;
11222
11223 becomes:
11224
11225 if (stride == 1)
11226 for (int i = 0; i < n; ++i)
11227 x[i] = ...;
11228 else
11229 for (int i = 0; i < n; ++i)
11230 x[i * stride] = ...;
11231
11232 This is particularly useful for assumed-shape arrays in Fortran
11233 where (for example) it allows better vectorization assuming
11234 contiguous accesses. This flag is enabled by default at -O3. It
11235 is also enabled by -fprofile-use and -fauto-profile.
11236
11237 -ffunction-sections
11238 -fdata-sections
11239 Place each function or data item into its own section in the output
11240 file if the target supports arbitrary sections. The name of the
11241 function or the name of the data item determines the section's name
11242 in the output file.
11243
11244 Use these options on systems where the linker can perform
11245 optimizations to improve locality of reference in the instruction
11246 space. Most systems using the ELF object format have linkers with
11247 such optimizations. On AIX, the linker rearranges sections
11248 (CSECTs) based on the call graph. The performance impact varies.
11249
11250 Together with a linker garbage collection (linker --gc-sections
11251 option) these options may lead to smaller statically-linked
11252 executables (after stripping).
11253
11254 On ELF/DWARF systems these options do not degenerate the quality of
11255 the debug information. There could be issues with other object
11256 files/debug info formats.
11257
11258 Only use these options when there are significant benefits from
11259 doing so. When you specify these options, the assembler and linker
11260 create larger object and executable files and are also slower.
11261 These options affect code generation. They prevent optimizations
11262 by the compiler and assembler using relative locations inside a
11263 translation unit since the locations are unknown until link time.
11264 An example of such an optimization is relaxing calls to short call
11265 instructions.
11266
11267 -fstdarg-opt
11268 Optimize the prologue of variadic argument functions with respect
11269 to usage of those arguments.
11270
11271 -fsection-anchors
11272 Try to reduce the number of symbolic address calculations by using
11273 shared "anchor" symbols to address nearby objects. This
11274 transformation can help to reduce the number of GOT entries and GOT
11275 accesses on some targets.
11276
11277 For example, the implementation of the following function "foo":
11278
11279 static int a, b, c;
11280 int foo (void) { return a + b + c; }
11281
11282 usually calculates the addresses of all three variables, but if you
11283 compile it with -fsection-anchors, it accesses the variables from a
11284 common anchor point instead. The effect is similar to the
11285 following pseudocode (which isn't valid C):
11286
11287 int foo (void)
11288 {
11289 register int *xr = &x;
11290 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11291 }
11292
11293 Not all targets support this option.
11294
11295 -fzero-call-used-regs=choice
11296 Zero call-used registers at function return to increase program
11297 security by either mitigating Return-Oriented Programming (ROP)
11298 attacks or preventing information leakage through registers.
11299
11300 The possible values of choice are the same as for the
11301 "zero_call_used_regs" attribute. The default is skip.
11302
11303 You can control this behavior for a specific function by using the
11304 function attribute "zero_call_used_regs".
11305
11306 --param name=value
11307 In some places, GCC uses various constants to control the amount of
11308 optimization that is done. For example, GCC does not inline
11309 functions that contain more than a certain number of instructions.
11310 You can control some of these constants on the command line using
11311 the --param option.
11312
11313 The names of specific parameters, and the meaning of the values,
11314 are tied to the internals of the compiler, and are subject to
11315 change without notice in future releases.
11316
11317 In order to get minimal, maximal and default value of a parameter,
11318 one can use --help=param -Q options.
11319
11320 In each case, the value is an integer. The following choices of
11321 name are recognized for all targets:
11322
11323 predictable-branch-outcome
11324 When branch is predicted to be taken with probability lower
11325 than this threshold (in percent), then it is considered well
11326 predictable.
11327
11328 max-rtl-if-conversion-insns
11329 RTL if-conversion tries to remove conditional branches around a
11330 block and replace them with conditionally executed
11331 instructions. This parameter gives the maximum number of
11332 instructions in a block which should be considered for if-
11333 conversion. The compiler will also use other heuristics to
11334 decide whether if-conversion is likely to be profitable.
11335
11336 max-rtl-if-conversion-predictable-cost
11337 RTL if-conversion will try to remove conditional branches
11338 around a block and replace them with conditionally executed
11339 instructions. These parameters give the maximum permissible
11340 cost for the sequence that would be generated by if-conversion
11341 depending on whether the branch is statically determined to be
11342 predictable or not. The units for this parameter are the same
11343 as those for the GCC internal seq_cost metric. The compiler
11344 will try to provide a reasonable default for this parameter
11345 using the BRANCH_COST target macro.
11346
11347 max-crossjump-edges
11348 The maximum number of incoming edges to consider for cross-
11349 jumping. The algorithm used by -fcrossjumping is O(N^2) in the
11350 number of edges incoming to each block. Increasing values mean
11351 more aggressive optimization, making the compilation time
11352 increase with probably small improvement in executable size.
11353
11354 min-crossjump-insns
11355 The minimum number of instructions that must be matched at the
11356 end of two blocks before cross-jumping is performed on them.
11357 This value is ignored in the case where all instructions in the
11358 block being cross-jumped from are matched.
11359
11360 max-grow-copy-bb-insns
11361 The maximum code size expansion factor when copying basic
11362 blocks instead of jumping. The expansion is relative to a jump
11363 instruction.
11364
11365 max-goto-duplication-insns
11366 The maximum number of instructions to duplicate to a block that
11367 jumps to a computed goto. To avoid O(N^2) behavior in a number
11368 of passes, GCC factors computed gotos early in the compilation
11369 process, and unfactors them as late as possible. Only computed
11370 jumps at the end of a basic blocks with no more than max-goto-
11371 duplication-insns are unfactored.
11372
11373 max-delay-slot-insn-search
11374 The maximum number of instructions to consider when looking for
11375 an instruction to fill a delay slot. If more than this
11376 arbitrary number of instructions are searched, the time savings
11377 from filling the delay slot are minimal, so stop searching.
11378 Increasing values mean more aggressive optimization, making the
11379 compilation time increase with probably small improvement in
11380 execution time.
11381
11382 max-delay-slot-live-search
11383 When trying to fill delay slots, the maximum number of
11384 instructions to consider when searching for a block with valid
11385 live register information. Increasing this arbitrarily chosen
11386 value means more aggressive optimization, increasing the
11387 compilation time. This parameter should be removed when the
11388 delay slot code is rewritten to maintain the control-flow
11389 graph.
11390
11391 max-gcse-memory
11392 The approximate maximum amount of memory in "kB" that can be
11393 allocated in order to perform the global common subexpression
11394 elimination optimization. If more memory than specified is
11395 required, the optimization is not done.
11396
11397 max-gcse-insertion-ratio
11398 If the ratio of expression insertions to deletions is larger
11399 than this value for any expression, then RTL PRE inserts or
11400 removes the expression and thus leaves partially redundant
11401 computations in the instruction stream.
11402
11403 max-pending-list-length
11404 The maximum number of pending dependencies scheduling allows
11405 before flushing the current state and starting over. Large
11406 functions with few branches or calls can create excessively
11407 large lists which needlessly consume memory and resources.
11408
11409 max-modulo-backtrack-attempts
11410 The maximum number of backtrack attempts the scheduler should
11411 make when modulo scheduling a loop. Larger values can
11412 exponentially increase compilation time.
11413
11414 max-inline-functions-called-once-loop-depth
11415 Maximal loop depth of a call considered by inline heuristics
11416 that tries to inline all functions called once.
11417
11418 max-inline-functions-called-once-insns
11419 Maximal estimated size of functions produced while inlining
11420 functions called once.
11421
11422 max-inline-insns-single
11423 Several parameters control the tree inliner used in GCC. This
11424 number sets the maximum number of instructions (counted in
11425 GCC's internal representation) in a single function that the
11426 tree inliner considers for inlining. This only affects
11427 functions declared inline and methods implemented in a class
11428 declaration (C++).
11429
11430 max-inline-insns-auto
11431 When you use -finline-functions (included in -O3), a lot of
11432 functions that would otherwise not be considered for inlining
11433 by the compiler are investigated. To those functions, a
11434 different (more restrictive) limit compared to functions
11435 declared inline can be applied (--param max-inline-insns-auto).
11436
11437 max-inline-insns-small
11438 This is bound applied to calls which are considered relevant
11439 with -finline-small-functions.
11440
11441 max-inline-insns-size
11442 This is bound applied to calls which are optimized for size.
11443 Small growth may be desirable to anticipate optimization
11444 oppurtunities exposed by inlining.
11445
11446 uninlined-function-insns
11447 Number of instructions accounted by inliner for function
11448 overhead such as function prologue and epilogue.
11449
11450 uninlined-function-time
11451 Extra time accounted by inliner for function overhead such as
11452 time needed to execute function prologue and epilogue.
11453
11454 inline-heuristics-hint-percent
11455 The scale (in percents) applied to inline-insns-single,
11456 inline-insns-single-O2, inline-insns-auto when inline
11457 heuristics hints that inlining is very profitable (will enable
11458 later optimizations).
11459
11460 uninlined-thunk-insns
11461 uninlined-thunk-time
11462 Same as --param uninlined-function-insns and --param uninlined-
11463 function-time but applied to function thunks.
11464
11465 inline-min-speedup
11466 When estimated performance improvement of caller + callee
11467 runtime exceeds this threshold (in percent), the function can
11468 be inlined regardless of the limit on --param max-inline-insns-
11469 single and --param max-inline-insns-auto.
11470
11471 large-function-insns
11472 The limit specifying really large functions. For functions
11473 larger than this limit after inlining, inlining is constrained
11474 by --param large-function-growth. This parameter is useful
11475 primarily to avoid extreme compilation time caused by non-
11476 linear algorithms used by the back end.
11477
11478 large-function-growth
11479 Specifies maximal growth of large function caused by inlining
11480 in percents. For example, parameter value 100 limits large
11481 function growth to 2.0 times the original size.
11482
11483 large-unit-insns
11484 The limit specifying large translation unit. Growth caused by
11485 inlining of units larger than this limit is limited by --param
11486 inline-unit-growth. For small units this might be too tight.
11487 For example, consider a unit consisting of function A that is
11488 inline and B that just calls A three times. If B is small
11489 relative to A, the growth of unit is 300\% and yet such
11490 inlining is very sane. For very large units consisting of
11491 small inlineable functions, however, the overall unit growth
11492 limit is needed to avoid exponential explosion of code size.
11493 Thus for smaller units, the size is increased to --param large-
11494 unit-insns before applying --param inline-unit-growth.
11495
11496 lazy-modules
11497 Maximum number of concurrently open C++ module files when lazy
11498 loading.
11499
11500 inline-unit-growth
11501 Specifies maximal overall growth of the compilation unit caused
11502 by inlining. For example, parameter value 20 limits unit
11503 growth to 1.2 times the original size. Cold functions (either
11504 marked cold via an attribute or by profile feedback) are not
11505 accounted into the unit size.
11506
11507 ipa-cp-unit-growth
11508 Specifies maximal overall growth of the compilation unit caused
11509 by interprocedural constant propagation. For example,
11510 parameter value 10 limits unit growth to 1.1 times the original
11511 size.
11512
11513 ipa-cp-large-unit-insns
11514 The size of translation unit that IPA-CP pass considers large.
11515
11516 large-stack-frame
11517 The limit specifying large stack frames. While inlining the
11518 algorithm is trying to not grow past this limit too much.
11519
11520 large-stack-frame-growth
11521 Specifies maximal growth of large stack frames caused by
11522 inlining in percents. For example, parameter value 1000 limits
11523 large stack frame growth to 11 times the original size.
11524
11525 max-inline-insns-recursive
11526 max-inline-insns-recursive-auto
11527 Specifies the maximum number of instructions an out-of-line
11528 copy of a self-recursive inline function can grow into by
11529 performing recursive inlining.
11530
11531 --param max-inline-insns-recursive applies to functions
11532 declared inline. For functions not declared inline, recursive
11533 inlining happens only when -finline-functions (included in -O3)
11534 is enabled; --param max-inline-insns-recursive-auto applies
11535 instead.
11536
11537 max-inline-recursive-depth
11538 max-inline-recursive-depth-auto
11539 Specifies the maximum recursion depth used for recursive
11540 inlining.
11541
11542 --param max-inline-recursive-depth applies to functions
11543 declared inline. For functions not declared inline, recursive
11544 inlining happens only when -finline-functions (included in -O3)
11545 is enabled; --param max-inline-recursive-depth-auto applies
11546 instead.
11547
11548 min-inline-recursive-probability
11549 Recursive inlining is profitable only for function having deep
11550 recursion in average and can hurt for function having little
11551 recursion depth by increasing the prologue size or complexity
11552 of function body to other optimizers.
11553
11554 When profile feedback is available (see -fprofile-generate) the
11555 actual recursion depth can be guessed from the probability that
11556 function recurses via a given call expression. This parameter
11557 limits inlining only to call expressions whose probability
11558 exceeds the given threshold (in percents).
11559
11560 early-inlining-insns
11561 Specify growth that the early inliner can make. In effect it
11562 increases the amount of inlining for code having a large
11563 abstraction penalty.
11564
11565 max-early-inliner-iterations
11566 Limit of iterations of the early inliner. This basically
11567 bounds the number of nested indirect calls the early inliner
11568 can resolve. Deeper chains are still handled by late inlining.
11569
11570 comdat-sharing-probability
11571 Probability (in percent) that C++ inline function with comdat
11572 visibility are shared across multiple compilation units.
11573
11574 modref-max-bases
11575 modref-max-refs
11576 modref-max-accesses
11577 Specifies the maximal number of base pointers, references and
11578 accesses stored for a single function by mod/ref analysis.
11579
11580 modref-max-tests
11581 Specifies the maxmal number of tests alias oracle can perform
11582 to disambiguate memory locations using the mod/ref information.
11583 This parameter ought to be bigger than --param modref-max-bases
11584 and --param modref-max-refs.
11585
11586 modref-max-depth
11587 Specifies the maximum depth of DFS walk used by modref escape
11588 analysis. Setting to 0 disables the analysis completely.
11589
11590 modref-max-escape-points
11591 Specifies the maximum number of escape points tracked by modref
11592 per SSA-name.
11593
11594 modref-max-adjustments
11595 Specifies the maximum number the access range is enlarged
11596 during modref dataflow analysis.
11597
11598 profile-func-internal-id
11599 A parameter to control whether to use function internal id in
11600 profile database lookup. If the value is 0, the compiler uses
11601 an id that is based on function assembler name and filename,
11602 which makes old profile data more tolerant to source changes
11603 such as function reordering etc.
11604
11605 min-vect-loop-bound
11606 The minimum number of iterations under which loops are not
11607 vectorized when -ftree-vectorize is used. The number of
11608 iterations after vectorization needs to be greater than the
11609 value specified by this option to allow vectorization.
11610
11611 gcse-cost-distance-ratio
11612 Scaling factor in calculation of maximum distance an expression
11613 can be moved by GCSE optimizations. This is currently
11614 supported only in the code hoisting pass. The bigger the
11615 ratio, the more aggressive code hoisting is with simple
11616 expressions, i.e., the expressions that have cost less than
11617 gcse-unrestricted-cost. Specifying 0 disables hoisting of
11618 simple expressions.
11619
11620 gcse-unrestricted-cost
11621 Cost, roughly measured as the cost of a single typical machine
11622 instruction, at which GCSE optimizations do not constrain the
11623 distance an expression can travel. This is currently supported
11624 only in the code hoisting pass. The lesser the cost, the more
11625 aggressive code hoisting is. Specifying 0 allows all
11626 expressions to travel unrestricted distances.
11627
11628 max-hoist-depth
11629 The depth of search in the dominator tree for expressions to
11630 hoist. This is used to avoid quadratic behavior in hoisting
11631 algorithm. The value of 0 does not limit on the search, but
11632 may slow down compilation of huge functions.
11633
11634 max-tail-merge-comparisons
11635 The maximum amount of similar bbs to compare a bb with. This
11636 is used to avoid quadratic behavior in tree tail merging.
11637
11638 max-tail-merge-iterations
11639 The maximum amount of iterations of the pass over the function.
11640 This is used to limit compilation time in tree tail merging.
11641
11642 store-merging-allow-unaligned
11643 Allow the store merging pass to introduce unaligned stores if
11644 it is legal to do so.
11645
11646 max-stores-to-merge
11647 The maximum number of stores to attempt to merge into wider
11648 stores in the store merging pass.
11649
11650 max-store-chains-to-track
11651 The maximum number of store chains to track at the same time in
11652 the attempt to merge them into wider stores in the store
11653 merging pass.
11654
11655 max-stores-to-track
11656 The maximum number of stores to track at the same time in the
11657 attemt to to merge them into wider stores in the store merging
11658 pass.
11659
11660 max-unrolled-insns
11661 The maximum number of instructions that a loop may have to be
11662 unrolled. If a loop is unrolled, this parameter also
11663 determines how many times the loop code is unrolled.
11664
11665 max-average-unrolled-insns
11666 The maximum number of instructions biased by probabilities of
11667 their execution that a loop may have to be unrolled. If a loop
11668 is unrolled, this parameter also determines how many times the
11669 loop code is unrolled.
11670
11671 max-unroll-times
11672 The maximum number of unrollings of a single loop.
11673
11674 max-peeled-insns
11675 The maximum number of instructions that a loop may have to be
11676 peeled. If a loop is peeled, this parameter also determines
11677 how many times the loop code is peeled.
11678
11679 max-peel-times
11680 The maximum number of peelings of a single loop.
11681
11682 max-peel-branches
11683 The maximum number of branches on the hot path through the
11684 peeled sequence.
11685
11686 max-completely-peeled-insns
11687 The maximum number of insns of a completely peeled loop.
11688
11689 max-completely-peel-times
11690 The maximum number of iterations of a loop to be suitable for
11691 complete peeling.
11692
11693 max-completely-peel-loop-nest-depth
11694 The maximum depth of a loop nest suitable for complete peeling.
11695
11696 max-unswitch-insns
11697 The maximum number of insns of an unswitched loop.
11698
11699 max-unswitch-level
11700 The maximum number of branches unswitched in a single loop.
11701
11702 lim-expensive
11703 The minimum cost of an expensive expression in the loop
11704 invariant motion.
11705
11706 min-loop-cond-split-prob
11707 When FDO profile information is available, min-loop-cond-split-
11708 prob specifies minimum threshold for probability of semi-
11709 invariant condition statement to trigger loop split.
11710
11711 iv-consider-all-candidates-bound
11712 Bound on number of candidates for induction variables, below
11713 which all candidates are considered for each use in induction
11714 variable optimizations. If there are more candidates than
11715 this, only the most relevant ones are considered to avoid
11716 quadratic time complexity.
11717
11718 iv-max-considered-uses
11719 The induction variable optimizations give up on loops that
11720 contain more induction variable uses.
11721
11722 iv-always-prune-cand-set-bound
11723 If the number of candidates in the set is smaller than this
11724 value, always try to remove unnecessary ivs from the set when
11725 adding a new one.
11726
11727 avg-loop-niter
11728 Average number of iterations of a loop.
11729
11730 dse-max-object-size
11731 Maximum size (in bytes) of objects tracked bytewise by dead
11732 store elimination. Larger values may result in larger
11733 compilation times.
11734
11735 dse-max-alias-queries-per-store
11736 Maximum number of queries into the alias oracle per store.
11737 Larger values result in larger compilation times and may result
11738 in more removed dead stores.
11739
11740 scev-max-expr-size
11741 Bound on size of expressions used in the scalar evolutions
11742 analyzer. Large expressions slow the analyzer.
11743
11744 scev-max-expr-complexity
11745 Bound on the complexity of the expressions in the scalar
11746 evolutions analyzer. Complex expressions slow the analyzer.
11747
11748 max-tree-if-conversion-phi-args
11749 Maximum number of arguments in a PHI supported by TREE if
11750 conversion unless the loop is marked with simd pragma.
11751
11752 vect-max-version-for-alignment-checks
11753 The maximum number of run-time checks that can be performed
11754 when doing loop versioning for alignment in the vectorizer.
11755
11756 vect-max-version-for-alias-checks
11757 The maximum number of run-time checks that can be performed
11758 when doing loop versioning for alias in the vectorizer.
11759
11760 vect-max-peeling-for-alignment
11761 The maximum number of loop peels to enhance access alignment
11762 for vectorizer. Value -1 means no limit.
11763
11764 max-iterations-to-track
11765 The maximum number of iterations of a loop the brute-force
11766 algorithm for analysis of the number of iterations of the loop
11767 tries to evaluate.
11768
11769 hot-bb-count-fraction
11770 The denominator n of fraction 1/n of the maximal execution
11771 count of a basic block in the entire program that a basic block
11772 needs to at least have in order to be considered hot. The
11773 default is 10000, which means that a basic block is considered
11774 hot if its execution count is greater than 1/10000 of the
11775 maximal execution count. 0 means that it is never considered
11776 hot. Used in non-LTO mode.
11777
11778 hot-bb-count-ws-permille
11779 The number of most executed permilles, ranging from 0 to 1000,
11780 of the profiled execution of the entire program to which the
11781 execution count of a basic block must be part of in order to be
11782 considered hot. The default is 990, which means that a basic
11783 block is considered hot if its execution count contributes to
11784 the upper 990 permilles, or 99.0%, of the profiled execution of
11785 the entire program. 0 means that it is never considered hot.
11786 Used in LTO mode.
11787
11788 hot-bb-frequency-fraction
11789 The denominator n of fraction 1/n of the execution frequency of
11790 the entry block of a function that a basic block of this
11791 function needs to at least have in order to be considered hot.
11792 The default is 1000, which means that a basic block is
11793 considered hot in a function if it is executed more frequently
11794 than 1/1000 of the frequency of the entry block of the
11795 function. 0 means that it is never considered hot.
11796
11797 unlikely-bb-count-fraction
11798 The denominator n of fraction 1/n of the number of profiled
11799 runs of the entire program below which the execution count of a
11800 basic block must be in order for the basic block to be
11801 considered unlikely executed. The default is 20, which means
11802 that a basic block is considered unlikely executed if it is
11803 executed in fewer than 1/20, or 5%, of the runs of the program.
11804 0 means that it is always considered unlikely executed.
11805
11806 max-predicted-iterations
11807 The maximum number of loop iterations we predict statically.
11808 This is useful in cases where a function contains a single loop
11809 with known bound and another loop with unknown bound. The
11810 known number of iterations is predicted correctly, while the
11811 unknown number of iterations average to roughly 10. This means
11812 that the loop without bounds appears artificially cold relative
11813 to the other one.
11814
11815 builtin-expect-probability
11816 Control the probability of the expression having the specified
11817 value. This parameter takes a percentage (i.e. 0 ... 100) as
11818 input.
11819
11820 builtin-string-cmp-inline-length
11821 The maximum length of a constant string for a builtin string
11822 cmp call eligible for inlining.
11823
11824 align-threshold
11825 Select fraction of the maximal frequency of executions of a
11826 basic block in a function to align the basic block.
11827
11828 align-loop-iterations
11829 A loop expected to iterate at least the selected number of
11830 iterations is aligned.
11831
11832 tracer-dynamic-coverage
11833 tracer-dynamic-coverage-feedback
11834 This value is used to limit superblock formation once the given
11835 percentage of executed instructions is covered. This limits
11836 unnecessary code size expansion.
11837
11838 The tracer-dynamic-coverage-feedback parameter is used only
11839 when profile feedback is available. The real profiles (as
11840 opposed to statically estimated ones) are much less balanced
11841 allowing the threshold to be larger value.
11842
11843 tracer-max-code-growth
11844 Stop tail duplication once code growth has reached given
11845 percentage. This is a rather artificial limit, as most of the
11846 duplicates are eliminated later in cross jumping, so it may be
11847 set to much higher values than is the desired code growth.
11848
11849 tracer-min-branch-ratio
11850 Stop reverse growth when the reverse probability of best edge
11851 is less than this threshold (in percent).
11852
11853 tracer-min-branch-probability
11854 tracer-min-branch-probability-feedback
11855 Stop forward growth if the best edge has probability lower than
11856 this threshold.
11857
11858 Similarly to tracer-dynamic-coverage two parameters are
11859 provided. tracer-min-branch-probability-feedback is used for
11860 compilation with profile feedback and tracer-min-branch-
11861 probability compilation without. The value for compilation
11862 with profile feedback needs to be more conservative (higher) in
11863 order to make tracer effective.
11864
11865 stack-clash-protection-guard-size
11866 Specify the size of the operating system provided stack guard
11867 as 2 raised to num bytes. Higher values may reduce the number
11868 of explicit probes, but a value larger than the operating
11869 system provided guard will leave code vulnerable to stack clash
11870 style attacks.
11871
11872 stack-clash-protection-probe-interval
11873 Stack clash protection involves probing stack space as it is
11874 allocated. This param controls the maximum distance between
11875 probes into the stack as 2 raised to num bytes. Higher values
11876 may reduce the number of explicit probes, but a value larger
11877 than the operating system provided guard will leave code
11878 vulnerable to stack clash style attacks.
11879
11880 max-cse-path-length
11881 The maximum number of basic blocks on path that CSE considers.
11882
11883 max-cse-insns
11884 The maximum number of instructions CSE processes before
11885 flushing.
11886
11887 ggc-min-expand
11888 GCC uses a garbage collector to manage its own memory
11889 allocation. This parameter specifies the minimum percentage by
11890 which the garbage collector's heap should be allowed to expand
11891 between collections. Tuning this may improve compilation
11892 speed; it has no effect on code generation.
11893
11894 The default is 30% + 70% * (RAM/1GB) with an upper bound of
11895 100% when RAM >= 1GB. If "getrlimit" is available, the notion
11896 of "RAM" is the smallest of actual RAM and "RLIMIT_DATA" or
11897 "RLIMIT_AS". If GCC is not able to calculate RAM on a
11898 particular platform, the lower bound of 30% is used. Setting
11899 this parameter and ggc-min-heapsize to zero causes a full
11900 collection to occur at every opportunity. This is extremely
11901 slow, but can be useful for debugging.
11902
11903 ggc-min-heapsize
11904 Minimum size of the garbage collector's heap before it begins
11905 bothering to collect garbage. The first collection occurs
11906 after the heap expands by ggc-min-expand% beyond ggc-min-
11907 heapsize. Again, tuning this may improve compilation speed,
11908 and has no effect on code generation.
11909
11910 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit
11911 that tries to ensure that RLIMIT_DATA or RLIMIT_AS are not
11912 exceeded, but with a lower bound of 4096 (four megabytes) and
11913 an upper bound of 131072 (128 megabytes). If GCC is not able
11914 to calculate RAM on a particular platform, the lower bound is
11915 used. Setting this parameter very large effectively disables
11916 garbage collection. Setting this parameter and ggc-min-expand
11917 to zero causes a full collection to occur at every opportunity.
11918
11919 max-reload-search-insns
11920 The maximum number of instruction reload should look backward
11921 for equivalent register. Increasing values mean more
11922 aggressive optimization, making the compilation time increase
11923 with probably slightly better performance.
11924
11925 max-cselib-memory-locations
11926 The maximum number of memory locations cselib should take into
11927 account. Increasing values mean more aggressive optimization,
11928 making the compilation time increase with probably slightly
11929 better performance.
11930
11931 max-sched-ready-insns
11932 The maximum number of instructions ready to be issued the
11933 scheduler should consider at any given time during the first
11934 scheduling pass. Increasing values mean more thorough
11935 searches, making the compilation time increase with probably
11936 little benefit.
11937
11938 max-sched-region-blocks
11939 The maximum number of blocks in a region to be considered for
11940 interblock scheduling.
11941
11942 max-pipeline-region-blocks
11943 The maximum number of blocks in a region to be considered for
11944 pipelining in the selective scheduler.
11945
11946 max-sched-region-insns
11947 The maximum number of insns in a region to be considered for
11948 interblock scheduling.
11949
11950 max-pipeline-region-insns
11951 The maximum number of insns in a region to be considered for
11952 pipelining in the selective scheduler.
11953
11954 min-spec-prob
11955 The minimum probability (in percents) of reaching a source
11956 block for interblock speculative scheduling.
11957
11958 max-sched-extend-regions-iters
11959 The maximum number of iterations through CFG to extend regions.
11960 A value of 0 disables region extensions.
11961
11962 max-sched-insn-conflict-delay
11963 The maximum conflict delay for an insn to be considered for
11964 speculative motion.
11965
11966 sched-spec-prob-cutoff
11967 The minimal probability of speculation success (in percents),
11968 so that speculative insns are scheduled.
11969
11970 sched-state-edge-prob-cutoff
11971 The minimum probability an edge must have for the scheduler to
11972 save its state across it.
11973
11974 sched-mem-true-dep-cost
11975 Minimal distance (in CPU cycles) between store and load
11976 targeting same memory locations.
11977
11978 selsched-max-lookahead
11979 The maximum size of the lookahead window of selective
11980 scheduling. It is a depth of search for available
11981 instructions.
11982
11983 selsched-max-sched-times
11984 The maximum number of times that an instruction is scheduled
11985 during selective scheduling. This is the limit on the number
11986 of iterations through which the instruction may be pipelined.
11987
11988 selsched-insns-to-rename
11989 The maximum number of best instructions in the ready list that
11990 are considered for renaming in the selective scheduler.
11991
11992 sms-min-sc
11993 The minimum value of stage count that swing modulo scheduler
11994 generates.
11995
11996 max-last-value-rtl
11997 The maximum size measured as number of RTLs that can be
11998 recorded in an expression in combiner for a pseudo register as
11999 last known value of that register.
12000
12001 max-combine-insns
12002 The maximum number of instructions the RTL combiner tries to
12003 combine.
12004
12005 integer-share-limit
12006 Small integer constants can use a shared data structure,
12007 reducing the compiler's memory usage and increasing its speed.
12008 This sets the maximum value of a shared integer constant.
12009
12010 ssp-buffer-size
12011 The minimum size of buffers (i.e. arrays) that receive stack
12012 smashing protection when -fstack-protector is used.
12013
12014 min-size-for-stack-sharing
12015 The minimum size of variables taking part in stack slot sharing
12016 when not optimizing.
12017
12018 max-jump-thread-duplication-stmts
12019 Maximum number of statements allowed in a block that needs to
12020 be duplicated when threading jumps.
12021
12022 max-fields-for-field-sensitive
12023 Maximum number of fields in a structure treated in a field
12024 sensitive manner during pointer analysis.
12025
12026 prefetch-latency
12027 Estimate on average number of instructions that are executed
12028 before prefetch finishes. The distance prefetched ahead is
12029 proportional to this constant. Increasing this number may also
12030 lead to less streams being prefetched (see simultaneous-
12031 prefetches).
12032
12033 simultaneous-prefetches
12034 Maximum number of prefetches that can run at the same time.
12035
12036 l1-cache-line-size
12037 The size of cache line in L1 data cache, in bytes.
12038
12039 l1-cache-size
12040 The size of L1 data cache, in kilobytes.
12041
12042 l2-cache-size
12043 The size of L2 data cache, in kilobytes.
12044
12045 prefetch-dynamic-strides
12046 Whether the loop array prefetch pass should issue software
12047 prefetch hints for strides that are non-constant. In some
12048 cases this may be beneficial, though the fact the stride is
12049 non-constant may make it hard to predict when there is clear
12050 benefit to issuing these hints.
12051
12052 Set to 1 if the prefetch hints should be issued for non-
12053 constant strides. Set to 0 if prefetch hints should be issued
12054 only for strides that are known to be constant and below
12055 prefetch-minimum-stride.
12056
12057 prefetch-minimum-stride
12058 Minimum constant stride, in bytes, to start using prefetch
12059 hints for. If the stride is less than this threshold, prefetch
12060 hints will not be issued.
12061
12062 This setting is useful for processors that have hardware
12063 prefetchers, in which case there may be conflicts between the
12064 hardware prefetchers and the software prefetchers. If the
12065 hardware prefetchers have a maximum stride they can handle, it
12066 should be used here to improve the use of software prefetchers.
12067
12068 A value of -1 means we don't have a threshold and therefore
12069 prefetch hints can be issued for any constant stride.
12070
12071 This setting is only useful for strides that are known and
12072 constant.
12073
12074 destructive-interference-size
12075 constructive-interference-size
12076 The values for the C++17 variables
12077 "std::hardware_destructive_interference_size" and
12078 "std::hardware_constructive_interference_size". The
12079 destructive interference size is the minimum recommended offset
12080 between two independent concurrently-accessed objects; the
12081 constructive interference size is the maximum recommended size
12082 of contiguous memory accessed together. Typically both will be
12083 the size of an L1 cache line for the target, in bytes. For a
12084 generic target covering a range of L1 cache line sizes,
12085 typically the constructive interference size will be the small
12086 end of the range and the destructive size will be the large
12087 end.
12088
12089 The destructive interference size is intended to be used for
12090 layout, and thus has ABI impact. The default value is not
12091 expected to be stable, and on some targets varies with -mtune,
12092 so use of this variable in a context where ABI stability is
12093 important, such as the public interface of a library, is
12094 strongly discouraged; if it is used in that context, users can
12095 stabilize the value using this option.
12096
12097 The constructive interference size is less sensitive, as it is
12098 typically only used in a static_assert to make sure that a type
12099 fits within a cache line.
12100
12101 See also -Winterference-size.
12102
12103 loop-interchange-max-num-stmts
12104 The maximum number of stmts in a loop to be interchanged.
12105
12106 loop-interchange-stride-ratio
12107 The minimum ratio between stride of two loops for interchange
12108 to be profitable.
12109
12110 min-insn-to-prefetch-ratio
12111 The minimum ratio between the number of instructions and the
12112 number of prefetches to enable prefetching in a loop.
12113
12114 prefetch-min-insn-to-mem-ratio
12115 The minimum ratio between the number of instructions and the
12116 number of memory references to enable prefetching in a loop.
12117
12118 use-canonical-types
12119 Whether the compiler should use the "canonical" type system.
12120 Should always be 1, which uses a more efficient internal
12121 mechanism for comparing types in C++ and Objective-C++.
12122 However, if bugs in the canonical type system are causing
12123 compilation failures, set this value to 0 to disable canonical
12124 types.
12125
12126 switch-conversion-max-branch-ratio
12127 Switch initialization conversion refuses to create arrays that
12128 are bigger than switch-conversion-max-branch-ratio times the
12129 number of branches in the switch.
12130
12131 max-partial-antic-length
12132 Maximum length of the partial antic set computed during the
12133 tree partial redundancy elimination optimization (-ftree-pre)
12134 when optimizing at -O3 and above. For some sorts of source
12135 code the enhanced partial redundancy elimination optimization
12136 can run away, consuming all of the memory available on the host
12137 machine. This parameter sets a limit on the length of the sets
12138 that are computed, which prevents the runaway behavior.
12139 Setting a value of 0 for this parameter allows an unlimited set
12140 length.
12141
12142 rpo-vn-max-loop-depth
12143 Maximum loop depth that is value-numbered optimistically. When
12144 the limit hits the innermost rpo-vn-max-loop-depth loops and
12145 the outermost loop in the loop nest are value-numbered
12146 optimistically and the remaining ones not.
12147
12148 sccvn-max-alias-queries-per-access
12149 Maximum number of alias-oracle queries we perform when looking
12150 for redundancies for loads and stores. If this limit is hit
12151 the search is aborted and the load or store is not considered
12152 redundant. The number of queries is algorithmically limited to
12153 the number of stores on all paths from the load to the function
12154 entry.
12155
12156 ira-max-loops-num
12157 IRA uses regional register allocation by default. If a
12158 function contains more loops than the number given by this
12159 parameter, only at most the given number of the most
12160 frequently-executed loops form regions for regional register
12161 allocation.
12162
12163 ira-max-conflict-table-size
12164 Although IRA uses a sophisticated algorithm to compress the
12165 conflict table, the table can still require excessive amounts
12166 of memory for huge functions. If the conflict table for a
12167 function could be more than the size in MB given by this
12168 parameter, the register allocator instead uses a faster,
12169 simpler, and lower-quality algorithm that does not require
12170 building a pseudo-register conflict table.
12171
12172 ira-loop-reserved-regs
12173 IRA can be used to evaluate more accurate register pressure in
12174 loops for decisions to move loop invariants (see -O3). The
12175 number of available registers reserved for some other purposes
12176 is given by this parameter. Default of the parameter is the
12177 best found from numerous experiments.
12178
12179 ira-consider-dup-in-all-alts
12180 Make IRA to consider matching constraint (duplicated operand
12181 number) heavily in all available alternatives for preferred
12182 register class. If it is set as zero, it means IRA only
12183 respects the matching constraint when it's in the only
12184 available alternative with an appropriate register class.
12185 Otherwise, it means IRA will check all available alternatives
12186 for preferred register class even if it has found some choice
12187 with an appropriate register class and respect the found
12188 qualified matching constraint.
12189
12190 lra-inheritance-ebb-probability-cutoff
12191 LRA tries to reuse values reloaded in registers in subsequent
12192 insns. This optimization is called inheritance. EBB is used
12193 as a region to do this optimization. The parameter defines a
12194 minimal fall-through edge probability in percentage used to add
12195 BB to inheritance EBB in LRA. The default value was chosen
12196 from numerous runs of SPEC2000 on x86-64.
12197
12198 loop-invariant-max-bbs-in-loop
12199 Loop invariant motion can be very expensive, both in
12200 compilation time and in amount of needed compile-time memory,
12201 with very large loops. Loops with more basic blocks than this
12202 parameter won't have loop invariant motion optimization
12203 performed on them.
12204
12205 loop-max-datarefs-for-datadeps
12206 Building data dependencies is expensive for very large loops.
12207 This parameter limits the number of data references in loops
12208 that are considered for data dependence analysis. These large
12209 loops are no handled by the optimizations using loop data
12210 dependencies.
12211
12212 max-vartrack-size
12213 Sets a maximum number of hash table slots to use during
12214 variable tracking dataflow analysis of any function. If this
12215 limit is exceeded with variable tracking at assignments
12216 enabled, analysis for that function is retried without it,
12217 after removing all debug insns from the function. If the limit
12218 is exceeded even without debug insns, var tracking analysis is
12219 completely disabled for the function. Setting the parameter to
12220 zero makes it unlimited.
12221
12222 max-vartrack-expr-depth
12223 Sets a maximum number of recursion levels when attempting to
12224 map variable names or debug temporaries to value expressions.
12225 This trades compilation time for more complete debug
12226 information. If this is set too low, value expressions that
12227 are available and could be represented in debug information may
12228 end up not being used; setting this higher may enable the
12229 compiler to find more complex debug expressions, but compile
12230 time and memory use may grow.
12231
12232 max-debug-marker-count
12233 Sets a threshold on the number of debug markers (e.g. begin
12234 stmt markers) to avoid complexity explosion at inlining or
12235 expanding to RTL. If a function has more such gimple stmts
12236 than the set limit, such stmts will be dropped from the inlined
12237 copy of a function, and from its RTL expansion.
12238
12239 min-nondebug-insn-uid
12240 Use uids starting at this parameter for nondebug insns. The
12241 range below the parameter is reserved exclusively for debug
12242 insns created by -fvar-tracking-assignments, but debug insns
12243 may get (non-overlapping) uids above it if the reserved range
12244 is exhausted.
12245
12246 ipa-sra-ptr-growth-factor
12247 IPA-SRA replaces a pointer to an aggregate with one or more new
12248 parameters only when their cumulative size is less or equal to
12249 ipa-sra-ptr-growth-factor times the size of the original
12250 pointer parameter.
12251
12252 ipa-sra-max-replacements
12253 Maximum pieces of an aggregate that IPA-SRA tracks. As a
12254 consequence, it is also the maximum number of replacements of a
12255 formal parameter.
12256
12257 sra-max-scalarization-size-Ospeed
12258 sra-max-scalarization-size-Osize
12259 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA)
12260 aim to replace scalar parts of aggregates with uses of
12261 independent scalar variables. These parameters control the
12262 maximum size, in storage units, of aggregate which is
12263 considered for replacement when compiling for speed (sra-max-
12264 scalarization-size-Ospeed) or size (sra-max-scalarization-size-
12265 Osize) respectively.
12266
12267 sra-max-propagations
12268 The maximum number of artificial accesses that Scalar
12269 Replacement of Aggregates (SRA) will track, per one local
12270 variable, in order to facilitate copy propagation.
12271
12272 tm-max-aggregate-size
12273 When making copies of thread-local variables in a transaction,
12274 this parameter specifies the size in bytes after which
12275 variables are saved with the logging functions as opposed to
12276 save/restore code sequence pairs. This option only applies
12277 when using -fgnu-tm.
12278
12279 graphite-max-nb-scop-params
12280 To avoid exponential effects in the Graphite loop transforms,
12281 the number of parameters in a Static Control Part (SCoP) is
12282 bounded. A value of zero can be used to lift the bound. A
12283 variable whose value is unknown at compilation time and defined
12284 outside a SCoP is a parameter of the SCoP.
12285
12286 loop-block-tile-size
12287 Loop blocking or strip mining transforms, enabled with
12288 -floop-block or -floop-strip-mine, strip mine each loop in the
12289 loop nest by a given number of iterations. The strip length
12290 can be changed using the loop-block-tile-size parameter.
12291
12292 ipa-jump-function-lookups
12293 Specifies number of statements visited during jump function
12294 offset discovery.
12295
12296 ipa-cp-value-list-size
12297 IPA-CP attempts to track all possible values and types passed
12298 to a function's parameter in order to propagate them and
12299 perform devirtualization. ipa-cp-value-list-size is the
12300 maximum number of values and types it stores per one formal
12301 parameter of a function.
12302
12303 ipa-cp-eval-threshold
12304 IPA-CP calculates its own score of cloning profitability
12305 heuristics and performs those cloning opportunities with scores
12306 that exceed ipa-cp-eval-threshold.
12307
12308 ipa-cp-max-recursive-depth
12309 Maximum depth of recursive cloning for self-recursive function.
12310
12311 ipa-cp-min-recursive-probability
12312 Recursive cloning only when the probability of call being
12313 executed exceeds the parameter.
12314
12315 ipa-cp-profile-count-base
12316 When using -fprofile-use option, IPA-CP will consider the
12317 measured execution count of a call graph edge at this
12318 percentage position in their histogram as the basis for its
12319 heuristics calculation.
12320
12321 ipa-cp-recursive-freq-factor
12322 The number of times interprocedural copy propagation expects
12323 recursive functions to call themselves.
12324
12325 ipa-cp-recursion-penalty
12326 Percentage penalty the recursive functions will receive when
12327 they are evaluated for cloning.
12328
12329 ipa-cp-single-call-penalty
12330 Percentage penalty functions containing a single call to
12331 another function will receive when they are evaluated for
12332 cloning.
12333
12334 ipa-max-agg-items
12335 IPA-CP is also capable to propagate a number of scalar values
12336 passed in an aggregate. ipa-max-agg-items controls the maximum
12337 number of such values per one parameter.
12338
12339 ipa-cp-loop-hint-bonus
12340 When IPA-CP determines that a cloning candidate would make the
12341 number of iterations of a loop known, it adds a bonus of ipa-
12342 cp-loop-hint-bonus to the profitability score of the candidate.
12343
12344 ipa-max-loop-predicates
12345 The maximum number of different predicates IPA will use to
12346 describe when loops in a function have known properties.
12347
12348 ipa-max-aa-steps
12349 During its analysis of function bodies, IPA-CP employs alias
12350 analysis in order to track values pointed to by function
12351 parameters. In order not spend too much time analyzing huge
12352 functions, it gives up and consider all memory clobbered after
12353 examining ipa-max-aa-steps statements modifying memory.
12354
12355 ipa-max-switch-predicate-bounds
12356 Maximal number of boundary endpoints of case ranges of switch
12357 statement. For switch exceeding this limit, IPA-CP will not
12358 construct cloning cost predicate, which is used to estimate
12359 cloning benefit, for default case of the switch statement.
12360
12361 ipa-max-param-expr-ops
12362 IPA-CP will analyze conditional statement that references some
12363 function parameter to estimate benefit for cloning upon certain
12364 constant value. But if number of operations in a parameter
12365 expression exceeds ipa-max-param-expr-ops, the expression is
12366 treated as complicated one, and is not handled by IPA analysis.
12367
12368 lto-partitions
12369 Specify desired number of partitions produced during WHOPR
12370 compilation. The number of partitions should exceed the number
12371 of CPUs used for compilation.
12372
12373 lto-min-partition
12374 Size of minimal partition for WHOPR (in estimated
12375 instructions). This prevents expenses of splitting very small
12376 programs into too many partitions.
12377
12378 lto-max-partition
12379 Size of max partition for WHOPR (in estimated instructions).
12380 to provide an upper bound for individual size of partition.
12381 Meant to be used only with balanced partitioning.
12382
12383 lto-max-streaming-parallelism
12384 Maximal number of parallel processes used for LTO streaming.
12385
12386 cxx-max-namespaces-for-diagnostic-help
12387 The maximum number of namespaces to consult for suggestions
12388 when C++ name lookup fails for an identifier.
12389
12390 sink-frequency-threshold
12391 The maximum relative execution frequency (in percents) of the
12392 target block relative to a statement's original block to allow
12393 statement sinking of a statement. Larger numbers result in
12394 more aggressive statement sinking. A small positive adjustment
12395 is applied for statements with memory operands as those are
12396 even more profitable so sink.
12397
12398 max-stores-to-sink
12399 The maximum number of conditional store pairs that can be sunk.
12400 Set to 0 if either vectorization (-ftree-vectorize) or if-
12401 conversion (-ftree-loop-if-convert) is disabled.
12402
12403 case-values-threshold
12404 The smallest number of different values for which it is best to
12405 use a jump-table instead of a tree of conditional branches. If
12406 the value is 0, use the default for the machine.
12407
12408 jump-table-max-growth-ratio-for-size
12409 The maximum code size growth ratio when expanding into a jump
12410 table (in percent). The parameter is used when optimizing for
12411 size.
12412
12413 jump-table-max-growth-ratio-for-speed
12414 The maximum code size growth ratio when expanding into a jump
12415 table (in percent). The parameter is used when optimizing for
12416 speed.
12417
12418 tree-reassoc-width
12419 Set the maximum number of instructions executed in parallel in
12420 reassociated tree. This parameter overrides target dependent
12421 heuristics used by default if has non zero value.
12422
12423 sched-pressure-algorithm
12424 Choose between the two available implementations of
12425 -fsched-pressure. Algorithm 1 is the original implementation
12426 and is the more likely to prevent instructions from being
12427 reordered. Algorithm 2 was designed to be a compromise between
12428 the relatively conservative approach taken by algorithm 1 and
12429 the rather aggressive approach taken by the default scheduler.
12430 It relies more heavily on having a regular register file and
12431 accurate register pressure classes. See haifa-sched.cc in the
12432 GCC sources for more details.
12433
12434 The default choice depends on the target.
12435
12436 max-slsr-cand-scan
12437 Set the maximum number of existing candidates that are
12438 considered when seeking a basis for a new straight-line
12439 strength reduction candidate.
12440
12441 asan-globals
12442 Enable buffer overflow detection for global objects. This kind
12443 of protection is enabled by default if you are using
12444 -fsanitize=address option. To disable global objects
12445 protection use --param asan-globals=0.
12446
12447 asan-stack
12448 Enable buffer overflow detection for stack objects. This kind
12449 of protection is enabled by default when using
12450 -fsanitize=address. To disable stack protection use --param
12451 asan-stack=0 option.
12452
12453 asan-instrument-reads
12454 Enable buffer overflow detection for memory reads. This kind
12455 of protection is enabled by default when using
12456 -fsanitize=address. To disable memory reads protection use
12457 --param asan-instrument-reads=0.
12458
12459 asan-instrument-writes
12460 Enable buffer overflow detection for memory writes. This kind
12461 of protection is enabled by default when using
12462 -fsanitize=address. To disable memory writes protection use
12463 --param asan-instrument-writes=0 option.
12464
12465 asan-memintrin
12466 Enable detection for built-in functions. This kind of
12467 protection is enabled by default when using -fsanitize=address.
12468 To disable built-in functions protection use --param
12469 asan-memintrin=0.
12470
12471 asan-use-after-return
12472 Enable detection of use-after-return. This kind of protection
12473 is enabled by default when using the -fsanitize=address option.
12474 To disable it use --param asan-use-after-return=0.
12475
12476 Note: By default the check is disabled at run time. To enable
12477 it, add "detect_stack_use_after_return=1" to the environment
12478 variable ASAN_OPTIONS.
12479
12480 asan-instrumentation-with-call-threshold
12481 If number of memory accesses in function being instrumented is
12482 greater or equal to this number, use callbacks instead of
12483 inline checks. E.g. to disable inline code use --param
12484 asan-instrumentation-with-call-threshold=0.
12485
12486 hwasan-instrument-stack
12487 Enable hwasan instrumentation of statically sized stack-
12488 allocated variables. This kind of instrumentation is enabled
12489 by default when using -fsanitize=hwaddress and disabled by
12490 default when using -fsanitize=kernel-hwaddress. To disable
12491 stack instrumentation use --param hwasan-instrument-stack=0,
12492 and to enable it use --param hwasan-instrument-stack=1.
12493
12494 hwasan-random-frame-tag
12495 When using stack instrumentation, decide tags for stack
12496 variables using a deterministic sequence beginning at a random
12497 tag for each frame. With this parameter unset tags are chosen
12498 using the same sequence but beginning from 1. This is enabled
12499 by default for -fsanitize=hwaddress and unavailable for
12500 -fsanitize=kernel-hwaddress. To disable it use --param
12501 hwasan-random-frame-tag=0.
12502
12503 hwasan-instrument-allocas
12504 Enable hwasan instrumentation of dynamically sized stack-
12505 allocated variables. This kind of instrumentation is enabled
12506 by default when using -fsanitize=hwaddress and disabled by
12507 default when using -fsanitize=kernel-hwaddress. To disable
12508 instrumentation of such variables use --param
12509 hwasan-instrument-allocas=0, and to enable it use --param
12510 hwasan-instrument-allocas=1.
12511
12512 hwasan-instrument-reads
12513 Enable hwasan checks on memory reads. Instrumentation of reads
12514 is enabled by default for both -fsanitize=hwaddress and
12515 -fsanitize=kernel-hwaddress. To disable checking memory reads
12516 use --param hwasan-instrument-reads=0.
12517
12518 hwasan-instrument-writes
12519 Enable hwasan checks on memory writes. Instrumentation of
12520 writes is enabled by default for both -fsanitize=hwaddress and
12521 -fsanitize=kernel-hwaddress. To disable checking memory writes
12522 use --param hwasan-instrument-writes=0.
12523
12524 hwasan-instrument-mem-intrinsics
12525 Enable hwasan instrumentation of builtin functions.
12526 Instrumentation of these builtin functions is enabled by
12527 default for both -fsanitize=hwaddress and
12528 -fsanitize=kernel-hwaddress. To disable instrumentation of
12529 builtin functions use --param
12530 hwasan-instrument-mem-intrinsics=0.
12531
12532 use-after-scope-direct-emission-threshold
12533 If the size of a local variable in bytes is smaller or equal to
12534 this number, directly poison (or unpoison) shadow memory
12535 instead of using run-time callbacks.
12536
12537 tsan-distinguish-volatile
12538 Emit special instrumentation for accesses to volatiles.
12539
12540 tsan-instrument-func-entry-exit
12541 Emit instrumentation calls to __tsan_func_entry() and
12542 __tsan_func_exit().
12543
12544 max-fsm-thread-path-insns
12545 Maximum number of instructions to copy when duplicating blocks
12546 on a finite state automaton jump thread path.
12547
12548 max-fsm-thread-length
12549 Maximum number of basic blocks on a jump thread path.
12550
12551 threader-debug
12552 threader-debug=[none|all] Enables verbose dumping of the
12553 threader solver.
12554
12555 parloops-chunk-size
12556 Chunk size of omp schedule for loops parallelized by parloops.
12557
12558 parloops-schedule
12559 Schedule type of omp schedule for loops parallelized by
12560 parloops (static, dynamic, guided, auto, runtime).
12561
12562 parloops-min-per-thread
12563 The minimum number of iterations per thread of an innermost
12564 parallelized loop for which the parallelized variant is
12565 preferred over the single threaded one. Note that for a
12566 parallelized loop nest the minimum number of iterations of the
12567 outermost loop per thread is two.
12568
12569 max-ssa-name-query-depth
12570 Maximum depth of recursion when querying properties of SSA
12571 names in things like fold routines. One level of recursion
12572 corresponds to following a use-def chain.
12573
12574 max-speculative-devirt-maydefs
12575 The maximum number of may-defs we analyze when looking for a
12576 must-def specifying the dynamic type of an object that invokes
12577 a virtual call we may be able to devirtualize speculatively.
12578
12579 max-vrp-switch-assertions
12580 The maximum number of assertions to add along the default edge
12581 of a switch statement during VRP.
12582
12583 evrp-sparse-threshold
12584 Maximum number of basic blocks before EVRP uses a sparse cache.
12585
12586 evrp-mode
12587 Specifies the mode Early VRP should operate in.
12588
12589 vrp1-mode
12590 Specifies the mode VRP pass 1 should operate in.
12591
12592 vrp2-mode
12593 Specifies the mode VRP pass 2 should operate in.
12594
12595 ranger-debug
12596 Specifies the type of debug output to be issued for ranges.
12597
12598 evrp-switch-limit
12599 Specifies the maximum number of switch cases before EVRP
12600 ignores a switch.
12601
12602 unroll-jam-min-percent
12603 The minimum percentage of memory references that must be
12604 optimized away for the unroll-and-jam transformation to be
12605 considered profitable.
12606
12607 unroll-jam-max-unroll
12608 The maximum number of times the outer loop should be unrolled
12609 by the unroll-and-jam transformation.
12610
12611 max-rtl-if-conversion-unpredictable-cost
12612 Maximum permissible cost for the sequence that would be
12613 generated by the RTL if-conversion pass for a branch that is
12614 considered unpredictable.
12615
12616 max-variable-expansions-in-unroller
12617 If -fvariable-expansion-in-unroller is used, the maximum number
12618 of times that an individual variable will be expanded during
12619 loop unrolling.
12620
12621 partial-inlining-entry-probability
12622 Maximum probability of the entry BB of split region (in percent
12623 relative to entry BB of the function) to make partial inlining
12624 happen.
12625
12626 max-tracked-strlens
12627 Maximum number of strings for which strlen optimization pass
12628 will track string lengths.
12629
12630 gcse-after-reload-partial-fraction
12631 The threshold ratio for performing partial redundancy
12632 elimination after reload.
12633
12634 gcse-after-reload-critical-fraction
12635 The threshold ratio of critical edges execution count that
12636 permit performing redundancy elimination after reload.
12637
12638 max-loop-header-insns
12639 The maximum number of insns in loop header duplicated by the
12640 copy loop headers pass.
12641
12642 vect-epilogues-nomask
12643 Enable loop epilogue vectorization using smaller vector size.
12644
12645 vect-partial-vector-usage
12646 Controls when the loop vectorizer considers using partial
12647 vector loads and stores as an alternative to falling back to
12648 scalar code. 0 stops the vectorizer from ever using partial
12649 vector loads and stores. 1 allows partial vector loads and
12650 stores if vectorization removes the need for the code to
12651 iterate. 2 allows partial vector loads and stores in all
12652 loops. The parameter only has an effect on targets that
12653 support partial vector loads and stores.
12654
12655 vect-inner-loop-cost-factor
12656 The maximum factor which the loop vectorizer applies to the
12657 cost of statements in an inner loop relative to the loop being
12658 vectorized. The factor applied is the maximum of the estimated
12659 number of iterations of the inner loop and this parameter. The
12660 default value of this parameter is 50.
12661
12662 vect-induction-float
12663 Enable loop vectorization of floating point inductions.
12664
12665 avoid-fma-max-bits
12666 Maximum number of bits for which we avoid creating FMAs.
12667
12668 sms-loop-average-count-threshold
12669 A threshold on the average loop count considered by the swing
12670 modulo scheduler.
12671
12672 sms-dfa-history
12673 The number of cycles the swing modulo scheduler considers when
12674 checking conflicts using DFA.
12675
12676 graphite-allow-codegen-errors
12677 Whether codegen errors should be ICEs when -fchecking.
12678
12679 sms-max-ii-factor
12680 A factor for tuning the upper bound that swing modulo scheduler
12681 uses for scheduling a loop.
12682
12683 lra-max-considered-reload-pseudos
12684 The max number of reload pseudos which are considered during
12685 spilling a non-reload pseudo.
12686
12687 max-pow-sqrt-depth
12688 Maximum depth of sqrt chains to use when synthesizing
12689 exponentiation by a real constant.
12690
12691 max-dse-active-local-stores
12692 Maximum number of active local stores in RTL dead store
12693 elimination.
12694
12695 asan-instrument-allocas
12696 Enable asan allocas/VLAs protection.
12697
12698 max-iterations-computation-cost
12699 Bound on the cost of an expression to compute the number of
12700 iterations.
12701
12702 max-isl-operations
12703 Maximum number of isl operations, 0 means unlimited.
12704
12705 graphite-max-arrays-per-scop
12706 Maximum number of arrays per scop.
12707
12708 max-vartrack-reverse-op-size
12709 Max. size of loc list for which reverse ops should be added.
12710
12711 fsm-scale-path-stmts
12712 Scale factor to apply to the number of statements in a
12713 threading path when comparing to the number of (scaled) blocks.
12714
12715 uninit-control-dep-attempts
12716 Maximum number of nested calls to search for control
12717 dependencies during uninitialized variable analysis.
12718
12719 fsm-scale-path-blocks
12720 Scale factor to apply to the number of blocks in a threading
12721 path when comparing to the number of (scaled) statements.
12722
12723 sched-autopref-queue-depth
12724 Hardware autoprefetcher scheduler model control flag. Number
12725 of lookahead cycles the model looks into; at ' ' only enable
12726 instruction sorting heuristic.
12727
12728 loop-versioning-max-inner-insns
12729 The maximum number of instructions that an inner loop can have
12730 before the loop versioning pass considers it too big to copy.
12731
12732 loop-versioning-max-outer-insns
12733 The maximum number of instructions that an outer loop can have
12734 before the loop versioning pass considers it too big to copy,
12735 discounting any instructions in inner loops that directly
12736 benefit from versioning.
12737
12738 ssa-name-def-chain-limit
12739 The maximum number of SSA_NAME assignments to follow in
12740 determining a property of a variable such as its value. This
12741 limits the number of iterations or recursive calls GCC performs
12742 when optimizing certain statements or when determining their
12743 validity prior to issuing diagnostics.
12744
12745 store-merging-max-size
12746 Maximum size of a single store merging region in bytes.
12747
12748 hash-table-verification-limit
12749 The number of elements for which hash table verification is
12750 done for each searched element.
12751
12752 max-find-base-term-values
12753 Maximum number of VALUEs handled during a single find_base_term
12754 call.
12755
12756 analyzer-max-enodes-per-program-point
12757 The maximum number of exploded nodes per program point within
12758 the analyzer, before terminating analysis of that point.
12759
12760 analyzer-max-constraints
12761 The maximum number of constraints per state.
12762
12763 analyzer-min-snodes-for-call-summary
12764 The minimum number of supernodes within a function for the
12765 analyzer to consider summarizing its effects at call sites.
12766
12767 analyzer-max-enodes-for-full-dump
12768 The maximum depth of exploded nodes that should appear in a dot
12769 dump before switching to a less verbose format.
12770
12771 analyzer-max-recursion-depth
12772 The maximum number of times a callsite can appear in a call
12773 stack within the analyzer, before terminating analysis of a
12774 call that would recurse deeper.
12775
12776 analyzer-max-svalue-depth
12777 The maximum depth of a symbolic value, before approximating the
12778 value as unknown.
12779
12780 analyzer-max-infeasible-edges
12781 The maximum number of infeasible edges to reject before
12782 declaring a diagnostic as infeasible.
12783
12784 gimple-fe-computed-hot-bb-threshold
12785 The number of executions of a basic block which is considered
12786 hot. The parameter is used only in GIMPLE FE.
12787
12788 analyzer-bb-explosion-factor
12789 The maximum number of 'after supernode' exploded nodes within
12790 the analyzer per supernode, before terminating analysis.
12791
12792 ranger-logical-depth
12793 Maximum depth of logical expression evaluation ranger will look
12794 through when evaluating outgoing edge ranges.
12795
12796 relation-block-limit
12797 Maximum number of relations the oracle will register in a basic
12798 block.
12799
12800 min-pagesize
12801 Minimum page size for warning purposes.
12802
12803 openacc-kernels
12804 Specify mode of OpenACC `kernels' constructs handling. With
12805 --param=openacc-kernels=decompose, OpenACC `kernels' constructs
12806 are decomposed into parts, a sequence of compute constructs,
12807 each then handled individually. This is work in progress.
12808 With --param=openacc-kernels=parloops, OpenACC `kernels'
12809 constructs are handled by the parloops pass, en bloc. This is
12810 the current default.
12811
12812 openacc-privatization
12813 Specify mode of OpenACC privatization diagnostics for
12814 -fopt-info-omp-note and applicable -fdump-tree-*-details. With
12815 --param=openacc-privatization=quiet, don't diagnose. This is
12816 the current default. With --param=openacc-privatization=noisy,
12817 do diagnose.
12818
12819 The following choices of name are available on AArch64 targets:
12820
12821 aarch64-sve-compare-costs
12822 When vectorizing for SVE, consider using "unpacked" vectors for
12823 smaller elements and use the cost model to pick the cheapest
12824 approach. Also use the cost model to choose between SVE and
12825 Advanced SIMD vectorization.
12826
12827 Using unpacked vectors includes storing smaller elements in
12828 larger containers and accessing elements with extending loads
12829 and truncating stores.
12830
12831 aarch64-float-recp-precision
12832 The number of Newton iterations for calculating the reciprocal
12833 for float type. The precision of division is proportional to
12834 this param when division approximation is enabled. The default
12835 value is 1.
12836
12837 aarch64-double-recp-precision
12838 The number of Newton iterations for calculating the reciprocal
12839 for double type. The precision of division is propotional to
12840 this param when division approximation is enabled. The default
12841 value is 2.
12842
12843 aarch64-autovec-preference
12844 Force an ISA selection strategy for auto-vectorization.
12845 Accepts values from 0 to 4, inclusive.
12846
12847 0 Use the default heuristics.
12848
12849 1 Use only Advanced SIMD for auto-vectorization.
12850
12851 2 Use only SVE for auto-vectorization.
12852
12853 3 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when
12854 the costs are deemed equal.
12855
12856 4 Use both Advanced SIMD and SVE. Prefer SVE when the costs
12857 are deemed equal.
12858
12859 The default value is 0.
12860
12861 aarch64-loop-vect-issue-rate-niters
12862 The tuning for some AArch64 CPUs tries to take both latencies
12863 and issue rates into account when deciding whether a loop
12864 should be vectorized using SVE, vectorized using Advanced SIMD,
12865 or not vectorized at all. If this parameter is set to n, GCC
12866 will not use this heuristic for loops that are known to execute
12867 in fewer than n Advanced SIMD iterations.
12868
12869 aarch64-vect-unroll-limit
12870 The vectorizer will use available tuning information to
12871 determine whether it would be beneficial to unroll the main
12872 vectorized loop and by how much. This parameter set's the
12873 upper bound of how much the vectorizer will unroll the main
12874 loop. The default value is four.
12875
12876 The following choices of name are available on i386 and x86_64
12877 targets:
12878
12879 x86-stlf-window-ninsns
12880 Instructions number above which STFL stall penalty can be
12881 compensated.
12882
12883 Program Instrumentation Options
12884 GCC supports a number of command-line options that control adding run-
12885 time instrumentation to the code it normally generates. For example,
12886 one purpose of instrumentation is collect profiling statistics for use
12887 in finding program hot spots, code coverage analysis, or profile-guided
12888 optimizations. Another class of program instrumentation is adding run-
12889 time checking to detect programming errors like invalid pointer
12890 dereferences or out-of-bounds array accesses, as well as deliberately
12891 hostile attacks such as stack smashing or C++ vtable hijacking. There
12892 is also a general hook which can be used to implement other forms of
12893 tracing or function-level instrumentation for debug or program analysis
12894 purposes.
12895
12896 -p
12897 -pg Generate extra code to write profile information suitable for the
12898 analysis program prof (for -p) or gprof (for -pg). You must use
12899 this option when compiling the source files you want data about,
12900 and you must also use it when linking.
12901
12902 You can use the function attribute "no_instrument_function" to
12903 suppress profiling of individual functions when compiling with
12904 these options.
12905
12906 -fprofile-arcs
12907 Add code so that program flow arcs are instrumented. During
12908 execution the program records how many times each branch and call
12909 is executed and how many times it is taken or returns. On targets
12910 that support constructors with priority support, profiling properly
12911 handles constructors, destructors and C++ constructors (and
12912 destructors) of classes which are used as a type of a global
12913 variable.
12914
12915 When the compiled program exits it saves this data to a file called
12916 auxname.gcda for each source file. The data may be used for
12917 profile-directed optimizations (-fbranch-probabilities), or for
12918 test coverage analysis (-ftest-coverage). Each object file's
12919 auxname is generated from the name of the output file, if
12920 explicitly specified and it is not the final executable, otherwise
12921 it is the basename of the source file. In both cases any suffix is
12922 removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda
12923 for output file specified as -o dir/foo.o).
12924
12925 Note that if a command line directly links source files, the
12926 corresponding .gcda files will be prefixed with the unsuffixed name
12927 of the output file. E.g. "gcc a.c b.c -o binary" would generate
12928 binary-a.gcda and binary-b.gcda files.
12929
12930 --coverage
12931 This option is used to compile and link code instrumented for
12932 coverage analysis. The option is a synonym for -fprofile-arcs
12933 -ftest-coverage (when compiling) and -lgcov (when linking). See
12934 the documentation for those options for more details.
12935
12936 * Compile the source files with -fprofile-arcs plus optimization
12937 and code generation options. For test coverage analysis, use
12938 the additional -ftest-coverage option. You do not need to
12939 profile every source file in a program.
12940
12941 * Compile the source files additionally with -fprofile-abs-path
12942 to create absolute path names in the .gcno files. This allows
12943 gcov to find the correct sources in projects where compilations
12944 occur with different working directories.
12945
12946 * Link your object files with -lgcov or -fprofile-arcs (the
12947 latter implies the former).
12948
12949 * Run the program on a representative workload to generate the
12950 arc profile information. This may be repeated any number of
12951 times. You can run concurrent instances of your program, and
12952 provided that the file system supports locking, the data files
12953 will be correctly updated. Unless a strict ISO C dialect
12954 option is in effect, "fork" calls are detected and correctly
12955 handled without double counting.
12956
12957 Moreover, an object file can be recompiled multiple times and
12958 the corresponding .gcda file merges as long as the source file
12959 and the compiler options are unchanged.
12960
12961 * For profile-directed optimizations, compile the source files
12962 again with the same optimization and code generation options
12963 plus -fbranch-probabilities.
12964
12965 * For test coverage analysis, use gcov to produce human readable
12966 information from the .gcno and .gcda files. Refer to the gcov
12967 documentation for further information.
12968
12969 With -fprofile-arcs, for each function of your program GCC creates
12970 a program flow graph, then finds a spanning tree for the graph.
12971 Only arcs that are not on the spanning tree have to be
12972 instrumented: the compiler adds code to count the number of times
12973 that these arcs are executed. When an arc is the only exit or only
12974 entrance to a block, the instrumentation code can be added to the
12975 block; otherwise, a new basic block must be created to hold the
12976 instrumentation code.
12977
12978 -ftest-coverage
12979 Produce a notes file that the gcov code-coverage utility can use to
12980 show program coverage. Each source file's note file is called
12981 auxname.gcno. Refer to the -fprofile-arcs option above for a
12982 description of auxname and instructions on how to generate test
12983 coverage data. Coverage data matches the source files more closely
12984 if you do not optimize.
12985
12986 -fprofile-abs-path
12987 Automatically convert relative source file names to absolute path
12988 names in the .gcno files. This allows gcov to find the correct
12989 sources in projects where compilations occur with different working
12990 directories.
12991
12992 -fprofile-dir=path
12993 Set the directory to search for the profile data files in to path.
12994 This option affects only the profile data generated by
12995 -fprofile-generate, -ftest-coverage, -fprofile-arcs and used by
12996 -fprofile-use and -fbranch-probabilities and its related options.
12997 Both absolute and relative paths can be used. By default, GCC uses
12998 the current directory as path, thus the profile data file appears
12999 in the same directory as the object file. In order to prevent the
13000 file name clashing, if the object file name is not an absolute
13001 path, we mangle the absolute path of the sourcename.gcda file and
13002 use it as the file name of a .gcda file. See details about the
13003 file naming in -fprofile-arcs. See similar option -fprofile-note.
13004
13005 When an executable is run in a massive parallel environment, it is
13006 recommended to save profile to different folders. That can be done
13007 with variables in path that are exported during run-time:
13008
13009 %p process ID.
13010
13011 %q{VAR}
13012 value of environment variable VAR
13013
13014 -fprofile-generate
13015 -fprofile-generate=path
13016 Enable options usually used for instrumenting application to
13017 produce profile useful for later recompilation with profile
13018 feedback based optimization. You must use -fprofile-generate both
13019 when compiling and when linking your program.
13020
13021 The following options are enabled: -fprofile-arcs,
13022 -fprofile-values, -finline-functions, and -fipa-bit-cp.
13023
13024 If path is specified, GCC looks at the path to find the profile
13025 feedback data files. See -fprofile-dir.
13026
13027 To optimize the program based on the collected profile information,
13028 use -fprofile-use.
13029
13030 -fprofile-info-section
13031 -fprofile-info-section=name
13032 Register the profile information in the specified section instead
13033 of using a constructor/destructor. The section name is name if it
13034 is specified, otherwise the section name defaults to ".gcov_info".
13035 A pointer to the profile information generated by -fprofile-arcs is
13036 placed in the specified section for each translation unit. This
13037 option disables the profile information registration through a
13038 constructor and it disables the profile information processing
13039 through a destructor. This option is not intended to be used in
13040 hosted environments such as GNU/Linux. It targets free-standing
13041 environments (for example embedded systems) with limited resources
13042 which do not support constructors/destructors or the C library file
13043 I/O.
13044
13045 The linker could collect the input sections in a continuous memory
13046 block and define start and end symbols. A GNU linker script
13047 example which defines a linker output section follows:
13048
13049 .gcov_info :
13050 {
13051 PROVIDE (__gcov_info_start = .);
13052 KEEP (*(.gcov_info))
13053 PROVIDE (__gcov_info_end = .);
13054 }
13055
13056 The program could dump the profiling information registered in this
13057 linker set for example like this:
13058
13059 #include <gcov.h>
13060 #include <stdio.h>
13061 #include <stdlib.h>
13062
13063 extern const struct gcov_info *__gcov_info_start[];
13064 extern const struct gcov_info *__gcov_info_end[];
13065
13066 static void
13067 filename (const char *f, void *arg)
13068 {
13069 puts (f);
13070 }
13071
13072 static void
13073 dump (const void *d, unsigned n, void *arg)
13074 {
13075 const unsigned char *c = d;
13076
13077 for (unsigned i = 0; i < n; ++i)
13078 printf ("%02x", c[i]);
13079 }
13080
13081 static void *
13082 allocate (unsigned length, void *arg)
13083 {
13084 return malloc (length);
13085 }
13086
13087 static void
13088 dump_gcov_info (void)
13089 {
13090 const struct gcov_info **info = __gcov_info_start;
13091 const struct gcov_info **end = __gcov_info_end;
13092
13093 /* Obfuscate variable to prevent compiler optimizations. */
13094 __asm__ ("" : "+r" (info));
13095
13096 while (info != end)
13097 {
13098 void *arg = NULL;
13099 __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
13100 putchar ('\n');
13101 ++info;
13102 }
13103 }
13104
13105 int
13106 main()
13107 {
13108 dump_gcov_info();
13109 return 0;
13110 }
13111
13112 -fprofile-note=path
13113 If path is specified, GCC saves .gcno file into path location. If
13114 you combine the option with multiple source files, the .gcno file
13115 will be overwritten.
13116
13117 -fprofile-prefix-path=path
13118 This option can be used in combination with
13119 profile-generate=profile_dir and profile-use=profile_dir to inform
13120 GCC where is the base directory of built source tree. By default
13121 profile_dir will contain files with mangled absolute paths of all
13122 object files in the built project. This is not desirable when
13123 directory used to build the instrumented binary differs from the
13124 directory used to build the binary optimized with profile feedback
13125 because the profile data will not be found during the optimized
13126 build. In such setups -fprofile-prefix-path=path with path
13127 pointing to the base directory of the build can be used to strip
13128 the irrelevant part of the path and keep all file names relative to
13129 the main build directory.
13130
13131 -fprofile-prefix-map=old=new
13132 When compiling files residing in directory old, record profiling
13133 information (with --coverage) describing them as if the files
13134 resided in directory new instead. See also -ffile-prefix-map.
13135
13136 -fprofile-update=method
13137 Alter the update method for an application instrumented for profile
13138 feedback based optimization. The method argument should be one of
13139 single, atomic or prefer-atomic. The first one is useful for
13140 single-threaded applications, while the second one prevents profile
13141 corruption by emitting thread-safe code.
13142
13143 Warning: When an application does not properly join all threads (or
13144 creates an detached thread), a profile file can be still corrupted.
13145
13146 Using prefer-atomic would be transformed either to atomic, when
13147 supported by a target, or to single otherwise. The GCC driver
13148 automatically selects prefer-atomic when -pthread is present in the
13149 command line.
13150
13151 -fprofile-filter-files=regex
13152 Instrument only functions from files whose name matches any of the
13153 regular expressions (separated by semi-colons).
13154
13155 For example, -fprofile-filter-files=main\.c;module.*\.c will
13156 instrument only main.c and all C files starting with 'module'.
13157
13158 -fprofile-exclude-files=regex
13159 Instrument only functions from files whose name does not match any
13160 of the regular expressions (separated by semi-colons).
13161
13162 For example, -fprofile-exclude-files=/usr/.* will prevent
13163 instrumentation of all files that are located in the /usr/ folder.
13164
13165 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
13166 Control level of reproducibility of profile gathered by
13167 "-fprofile-generate". This makes it possible to rebuild program
13168 with same outcome which is useful, for example, for distribution
13169 packages.
13170
13171 With -fprofile-reproducible=serial the profile gathered by
13172 -fprofile-generate is reproducible provided the trained program
13173 behaves the same at each invocation of the train run, it is not
13174 multi-threaded and profile data streaming is always done in the
13175 same order. Note that profile streaming happens at the end of
13176 program run but also before "fork" function is invoked.
13177
13178 Note that it is quite common that execution counts of some part of
13179 programs depends, for example, on length of temporary file names or
13180 memory space randomization (that may affect hash-table collision
13181 rate). Such non-reproducible part of programs may be annotated by
13182 "no_instrument_function" function attribute. gcov-dump with -l can
13183 be used to dump gathered data and verify that they are indeed
13184 reproducible.
13185
13186 With -fprofile-reproducible=parallel-runs collected profile stays
13187 reproducible regardless the order of streaming of the data into
13188 gcda files. This setting makes it possible to run multiple
13189 instances of instrumented program in parallel (such as with "make
13190 -j"). This reduces quality of gathered data, in particular of
13191 indirect call profiling.
13192
13193 -fsanitize=address
13194 Enable AddressSanitizer, a fast memory error detector. Memory
13195 access instructions are instrumented to detect out-of-bounds and
13196 use-after-free bugs. The option enables
13197 -fsanitize-address-use-after-scope. See
13198 <https://github.com/google/sanitizers/wiki/AddressSanitizer> for
13199 more details. The run-time behavior can be influenced using the
13200 ASAN_OPTIONS environment variable. When set to "help=1", the
13201 available options are shown at startup of the instrumented program.
13202 See
13203 <https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags>
13204 for a list of supported options. The option cannot be combined
13205 with -fsanitize=thread or -fsanitize=hwaddress. Note that the only
13206 target -fsanitize=hwaddress is currently supported on is AArch64.
13207
13208 -fsanitize=kernel-address
13209 Enable AddressSanitizer for Linux kernel. See
13210 <https://github.com/google/kasan> for more details.
13211
13212 -fsanitize=hwaddress
13213 Enable Hardware-assisted AddressSanitizer, which uses a hardware
13214 ability to ignore the top byte of a pointer to allow the detection
13215 of memory errors with a low memory overhead. Memory access
13216 instructions are instrumented to detect out-of-bounds and use-
13217 after-free bugs. The option enables
13218 -fsanitize-address-use-after-scope. See
13219 <https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html>
13220 for more details. The run-time behavior can be influenced using
13221 the HWASAN_OPTIONS environment variable. When set to "help=1", the
13222 available options are shown at startup of the instrumented program.
13223 The option cannot be combined with -fsanitize=thread or
13224 -fsanitize=address, and is currently only available on AArch64.
13225
13226 -fsanitize=kernel-hwaddress
13227 Enable Hardware-assisted AddressSanitizer for compilation of the
13228 Linux kernel. Similar to -fsanitize=kernel-address but using an
13229 alternate instrumentation method, and similar to
13230 -fsanitize=hwaddress but with instrumentation differences necessary
13231 for compiling the Linux kernel. These differences are to avoid
13232 hwasan library initialization calls and to account for the stack
13233 pointer having a different value in its top byte.
13234
13235 Note: This option has different defaults to the
13236 -fsanitize=hwaddress. Instrumenting the stack and alloca calls are
13237 not on by default but are still possible by specifying the command-
13238 line options --param hwasan-instrument-stack=1 and --param
13239 hwasan-instrument-allocas=1 respectively. Using a random frame tag
13240 is not implemented for kernel instrumentation.
13241
13242 -fsanitize=pointer-compare
13243 Instrument comparison operation (<, <=, >, >=) with pointer
13244 operands. The option must be combined with either
13245 -fsanitize=kernel-address or -fsanitize=address The option cannot
13246 be combined with -fsanitize=thread. Note: By default the check is
13247 disabled at run time. To enable it, add
13248 "detect_invalid_pointer_pairs=2" to the environment variable
13249 ASAN_OPTIONS. Using "detect_invalid_pointer_pairs=1" detects
13250 invalid operation only when both pointers are non-null.
13251
13252 -fsanitize=pointer-subtract
13253 Instrument subtraction with pointer operands. The option must be
13254 combined with either -fsanitize=kernel-address or
13255 -fsanitize=address The option cannot be combined with
13256 -fsanitize=thread. Note: By default the check is disabled at run
13257 time. To enable it, add "detect_invalid_pointer_pairs=2" to the
13258 environment variable ASAN_OPTIONS. Using
13259 "detect_invalid_pointer_pairs=1" detects invalid operation only
13260 when both pointers are non-null.
13261
13262 -fsanitize=shadow-call-stack
13263 Enable ShadowCallStack, a security enhancement mechanism used to
13264 protect programs against return address overwrites (e.g. stack
13265 buffer overflows.) It works by saving a function's return address
13266 to a separately allocated shadow call stack in the function
13267 prologue and restoring the return address from the shadow call
13268 stack in the function epilogue. Instrumentation only occurs in
13269 functions that need to save the return address to the stack.
13270
13271 Currently it only supports the aarch64 platform. It is
13272 specifically designed for linux kernels that enable the
13273 CONFIG_SHADOW_CALL_STACK option. For the user space programs,
13274 runtime support is not currently provided in libc and libgcc.
13275 Users who want to use this feature in user space need to provide
13276 their own support for the runtime. It should be noted that this
13277 may cause the ABI rules to be broken.
13278
13279 On aarch64, the instrumentation makes use of the platform register
13280 "x18". This generally means that any code that may run on the same
13281 thread as code compiled with ShadowCallStack must be compiled with
13282 the flag -ffixed-x18, otherwise functions compiled without
13283 -ffixed-x18 might clobber "x18" and so corrupt the shadow stack
13284 pointer.
13285
13286 Also, because there is no userspace runtime support, code compiled
13287 with ShadowCallStack cannot use exception handling. Use
13288 -fno-exceptions to turn off exceptions.
13289
13290 See <https://clang.llvm.org/docs/ShadowCallStack.html> for more
13291 details.
13292
13293 -fsanitize=thread
13294 Enable ThreadSanitizer, a fast data race detector. Memory access
13295 instructions are instrumented to detect data race bugs. See
13296 <https://github.com/google/sanitizers/wiki#threadsanitizer> for
13297 more details. The run-time behavior can be influenced using the
13298 TSAN_OPTIONS environment variable; see
13299 <https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags>
13300 for a list of supported options. The option cannot be combined
13301 with -fsanitize=address, -fsanitize=leak.
13302
13303 Note that sanitized atomic builtins cannot throw exceptions when
13304 operating on invalid memory addresses with non-call exceptions
13305 (-fnon-call-exceptions).
13306
13307 -fsanitize=leak
13308 Enable LeakSanitizer, a memory leak detector. This option only
13309 matters for linking of executables and the executable is linked
13310 against a library that overrides "malloc" and other allocator
13311 functions. See
13312 <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
13313 for more details. The run-time behavior can be influenced using
13314 the LSAN_OPTIONS environment variable. The option cannot be
13315 combined with -fsanitize=thread.
13316
13317 -fsanitize=undefined
13318 Enable UndefinedBehaviorSanitizer, a fast undefined behavior
13319 detector. Various computations are instrumented to detect
13320 undefined behavior at runtime. See
13321 <https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html> for
13322 more details. The run-time behavior can be influenced using the
13323 UBSAN_OPTIONS environment variable. Current suboptions are:
13324
13325 -fsanitize=shift
13326 This option enables checking that the result of a shift
13327 operation is not undefined. Note that what exactly is
13328 considered undefined differs slightly between C and C++, as
13329 well as between ISO C90 and C99, etc. This option has two
13330 suboptions, -fsanitize=shift-base and
13331 -fsanitize=shift-exponent.
13332
13333 -fsanitize=shift-exponent
13334 This option enables checking that the second argument of a
13335 shift operation is not negative and is smaller than the
13336 precision of the promoted first argument.
13337
13338 -fsanitize=shift-base
13339 If the second argument of a shift operation is within range,
13340 check that the result of a shift operation is not undefined.
13341 Note that what exactly is considered undefined differs slightly
13342 between C and C++, as well as between ISO C90 and C99, etc.
13343
13344 -fsanitize=integer-divide-by-zero
13345 Detect integer division by zero.
13346
13347 -fsanitize=unreachable
13348 With this option, the compiler turns the
13349 "__builtin_unreachable" call into a diagnostics message call
13350 instead. When reaching the "__builtin_unreachable" call, the
13351 behavior is undefined.
13352
13353 -fsanitize=vla-bound
13354 This option instructs the compiler to check that the size of a
13355 variable length array is positive.
13356
13357 -fsanitize=null
13358 This option enables pointer checking. Particularly, the
13359 application built with this option turned on will issue an
13360 error message when it tries to dereference a NULL pointer, or
13361 if a reference (possibly an rvalue reference) is bound to a
13362 NULL pointer, or if a method is invoked on an object pointed by
13363 a NULL pointer.
13364
13365 -fsanitize=return
13366 This option enables return statement checking. Programs built
13367 with this option turned on will issue an error message when the
13368 end of a non-void function is reached without actually
13369 returning a value. This option works in C++ only.
13370
13371 -fsanitize=signed-integer-overflow
13372 This option enables signed integer overflow checking. We check
13373 that the result of "+", "*", and both unary and binary "-" does
13374 not overflow in the signed arithmetics. This also detects
13375 "INT_MIN / -1" signed division. Note, integer promotion rules
13376 must be taken into account. That is, the following is not an
13377 overflow:
13378
13379 signed char a = SCHAR_MAX;
13380 a++;
13381
13382 -fsanitize=bounds
13383 This option enables instrumentation of array bounds. Various
13384 out of bounds accesses are detected. Flexible array members,
13385 flexible array member-like arrays, and initializers of
13386 variables with static storage are not instrumented.
13387
13388 -fsanitize=bounds-strict
13389 This option enables strict instrumentation of array bounds.
13390 Most out of bounds accesses are detected, including flexible
13391 array members and flexible array member-like arrays.
13392 Initializers of variables with static storage are not
13393 instrumented.
13394
13395 -fsanitize=alignment
13396 This option enables checking of alignment of pointers when they
13397 are dereferenced, or when a reference is bound to
13398 insufficiently aligned target, or when a method or constructor
13399 is invoked on insufficiently aligned object.
13400
13401 -fsanitize=object-size
13402 This option enables instrumentation of memory references using
13403 the "__builtin_object_size" function. Various out of bounds
13404 pointer accesses are detected.
13405
13406 -fsanitize=float-divide-by-zero
13407 Detect floating-point division by zero. Unlike other similar
13408 options, -fsanitize=float-divide-by-zero is not enabled by
13409 -fsanitize=undefined, since floating-point division by zero can
13410 be a legitimate way of obtaining infinities and NaNs.
13411
13412 -fsanitize=float-cast-overflow
13413 This option enables floating-point type to integer conversion
13414 checking. We check that the result of the conversion does not
13415 overflow. Unlike other similar options,
13416 -fsanitize=float-cast-overflow is not enabled by
13417 -fsanitize=undefined. This option does not work well with
13418 "FE_INVALID" exceptions enabled.
13419
13420 -fsanitize=nonnull-attribute
13421 This option enables instrumentation of calls, checking whether
13422 null values are not passed to arguments marked as requiring a
13423 non-null value by the "nonnull" function attribute.
13424
13425 -fsanitize=returns-nonnull-attribute
13426 This option enables instrumentation of return statements in
13427 functions marked with "returns_nonnull" function attribute, to
13428 detect returning of null values from such functions.
13429
13430 -fsanitize=bool
13431 This option enables instrumentation of loads from bool. If a
13432 value other than 0/1 is loaded, a run-time error is issued.
13433
13434 -fsanitize=enum
13435 This option enables instrumentation of loads from an enum type.
13436 If a value outside the range of values for the enum type is
13437 loaded, a run-time error is issued.
13438
13439 -fsanitize=vptr
13440 This option enables instrumentation of C++ member function
13441 calls, member accesses and some conversions between pointers to
13442 base and derived classes, to verify the referenced object has
13443 the correct dynamic type.
13444
13445 -fsanitize=pointer-overflow
13446 This option enables instrumentation of pointer arithmetics. If
13447 the pointer arithmetics overflows, a run-time error is issued.
13448
13449 -fsanitize=builtin
13450 This option enables instrumentation of arguments to selected
13451 builtin functions. If an invalid value is passed to such
13452 arguments, a run-time error is issued. E.g. passing 0 as the
13453 argument to "__builtin_ctz" or "__builtin_clz" invokes
13454 undefined behavior and is diagnosed by this option.
13455
13456 While -ftrapv causes traps for signed overflows to be emitted,
13457 -fsanitize=undefined gives a diagnostic message. This currently
13458 works only for the C family of languages.
13459
13460 -fno-sanitize=all
13461 This option disables all previously enabled sanitizers.
13462 -fsanitize=all is not allowed, as some sanitizers cannot be used
13463 together.
13464
13465 -fasan-shadow-offset=number
13466 This option forces GCC to use custom shadow offset in
13467 AddressSanitizer checks. It is useful for experimenting with
13468 different shadow memory layouts in Kernel AddressSanitizer.
13469
13470 -fsanitize-sections=s1,s2,...
13471 Sanitize global variables in selected user-defined sections. si
13472 may contain wildcards.
13473
13474 -fsanitize-recover[=opts]
13475 -fsanitize-recover= controls error recovery mode for sanitizers
13476 mentioned in comma-separated list of opts. Enabling this option
13477 for a sanitizer component causes it to attempt to continue running
13478 the program as if no error happened. This means multiple runtime
13479 errors can be reported in a single program run, and the exit code
13480 of the program may indicate success even when errors have been
13481 reported. The -fno-sanitize-recover= option can be used to alter
13482 this behavior: only the first detected error is reported and
13483 program then exits with a non-zero exit code.
13484
13485 Currently this feature only works for -fsanitize=undefined (and its
13486 suboptions except for -fsanitize=unreachable and
13487 -fsanitize=return), -fsanitize=float-cast-overflow,
13488 -fsanitize=float-divide-by-zero, -fsanitize=bounds-strict,
13489 -fsanitize=kernel-address and -fsanitize=address. For these
13490 sanitizers error recovery is turned on by default, except
13491 -fsanitize=address, for which this feature is experimental.
13492 -fsanitize-recover=all and -fno-sanitize-recover=all is also
13493 accepted, the former enables recovery for all sanitizers that
13494 support it, the latter disables recovery for all sanitizers that
13495 support it.
13496
13497 Even if a recovery mode is turned on the compiler side, it needs to
13498 be also enabled on the runtime library side, otherwise the failures
13499 are still fatal. The runtime library defaults to "halt_on_error=0"
13500 for ThreadSanitizer and UndefinedBehaviorSanitizer, while default
13501 value for AddressSanitizer is "halt_on_error=1". This can be
13502 overridden through setting the "halt_on_error" flag in the
13503 corresponding environment variable.
13504
13505 Syntax without an explicit opts parameter is deprecated. It is
13506 equivalent to specifying an opts list of:
13507
13508 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
13509
13510 -fsanitize-address-use-after-scope
13511 Enable sanitization of local variables to detect use-after-scope
13512 bugs. The option sets -fstack-reuse to none.
13513
13514 -fsanitize-undefined-trap-on-error
13515 The -fsanitize-undefined-trap-on-error option instructs the
13516 compiler to report undefined behavior using "__builtin_trap" rather
13517 than a "libubsan" library routine. The advantage of this is that
13518 the "libubsan" library is not needed and is not linked in, so this
13519 is usable even in freestanding environments.
13520
13521 -fsanitize-coverage=trace-pc
13522 Enable coverage-guided fuzzing code instrumentation. Inserts a
13523 call to "__sanitizer_cov_trace_pc" into every basic block.
13524
13525 -fsanitize-coverage=trace-cmp
13526 Enable dataflow guided fuzzing code instrumentation. Inserts a
13527 call to "__sanitizer_cov_trace_cmp1", "__sanitizer_cov_trace_cmp2",
13528 "__sanitizer_cov_trace_cmp4" or "__sanitizer_cov_trace_cmp8" for
13529 integral comparison with both operands variable or
13530 "__sanitizer_cov_trace_const_cmp1",
13531 "__sanitizer_cov_trace_const_cmp2",
13532 "__sanitizer_cov_trace_const_cmp4" or
13533 "__sanitizer_cov_trace_const_cmp8" for integral comparison with one
13534 operand constant, "__sanitizer_cov_trace_cmpf" or
13535 "__sanitizer_cov_trace_cmpd" for float or double comparisons and
13536 "__sanitizer_cov_trace_switch" for switch statements.
13537
13538 -fcf-protection=[full|branch|return|none|check]
13539 Enable code instrumentation of control-flow transfers to increase
13540 program security by checking that target addresses of control-flow
13541 transfer instructions (such as indirect function call, function
13542 return, indirect jump) are valid. This prevents diverting the flow
13543 of control to an unexpected target. This is intended to protect
13544 against such threats as Return-oriented Programming (ROP), and
13545 similarly call/jmp-oriented programming (COP/JOP).
13546
13547 The value "branch" tells the compiler to implement checking of
13548 validity of control-flow transfer at the point of indirect branch
13549 instructions, i.e. call/jmp instructions. The value "return"
13550 implements checking of validity at the point of returning from a
13551 function. The value "full" is an alias for specifying both
13552 "branch" and "return". The value "none" turns off instrumentation.
13553
13554 The value "check" is used for the final link with link-time
13555 optimization (LTO). An error is issued if LTO object files are
13556 compiled with different -fcf-protection values. The value "check"
13557 is ignored at the compile time.
13558
13559 The macro "__CET__" is defined when -fcf-protection is used. The
13560 first bit of "__CET__" is set to 1 for the value "branch" and the
13561 second bit of "__CET__" is set to 1 for the "return".
13562
13563 You can also use the "nocf_check" attribute to identify which
13564 functions and calls should be skipped from instrumentation.
13565
13566 Currently the x86 GNU/Linux target provides an implementation based
13567 on Intel Control-flow Enforcement Technology (CET) which works for
13568 i686 processor or newer.
13569
13570 -fharden-compares
13571 For every logical test that survives gimple optimizations and is
13572 not the condition in a conditional branch (for example, conditions
13573 tested for conditional moves, or to store in boolean variables),
13574 emit extra code to compute and verify the reversed condition, and
13575 to call "__builtin_trap" if the results do not match. Use with
13576 -fharden-conditional-branches to cover all conditionals.
13577
13578 -fharden-conditional-branches
13579 For every non-vectorized conditional branch that survives gimple
13580 optimizations, emit extra code to compute and verify the reversed
13581 condition, and to call "__builtin_trap" if the result is
13582 unexpected. Use with -fharden-compares to cover all conditionals.
13583
13584 -fstack-protector
13585 Emit extra code to check for buffer overflows, such as stack
13586 smashing attacks. This is done by adding a guard variable to
13587 functions with vulnerable objects. This includes functions that
13588 call "alloca", and functions with buffers larger than or equal to 8
13589 bytes. The guards are initialized when a function is entered and
13590 then checked when the function exits. If a guard check fails, an
13591 error message is printed and the program exits. Only variables
13592 that are actually allocated on the stack are considered, optimized
13593 away variables or variables allocated in registers don't count.
13594
13595 -fstack-protector-all
13596 Like -fstack-protector except that all functions are protected.
13597
13598 -fstack-protector-strong
13599 Like -fstack-protector but includes additional functions to be
13600 protected --- those that have local array definitions, or have
13601 references to local frame addresses. Only variables that are
13602 actually allocated on the stack are considered, optimized away
13603 variables or variables allocated in registers don't count.
13604
13605 -fstack-protector-explicit
13606 Like -fstack-protector but only protects those functions which have
13607 the "stack_protect" attribute.
13608
13609 -fstack-check
13610 Generate code to verify that you do not go beyond the boundary of
13611 the stack. You should specify this flag if you are running in an
13612 environment with multiple threads, but you only rarely need to
13613 specify it in a single-threaded environment since stack overflow is
13614 automatically detected on nearly all systems if there is only one
13615 stack.
13616
13617 Note that this switch does not actually cause checking to be done;
13618 the operating system or the language runtime must do that. The
13619 switch causes generation of code to ensure that they see the stack
13620 being extended.
13621
13622 You can additionally specify a string parameter: no means no
13623 checking, generic means force the use of old-style checking,
13624 specific means use the best checking method and is equivalent to
13625 bare -fstack-check.
13626
13627 Old-style checking is a generic mechanism that requires no specific
13628 target support in the compiler but comes with the following
13629 drawbacks:
13630
13631 1. Modified allocation strategy for large objects: they are always
13632 allocated dynamically if their size exceeds a fixed threshold.
13633 Note this may change the semantics of some code.
13634
13635 2. Fixed limit on the size of the static frame of functions: when
13636 it is topped by a particular function, stack checking is not
13637 reliable and a warning is issued by the compiler.
13638
13639 3. Inefficiency: because of both the modified allocation strategy
13640 and the generic implementation, code performance is hampered.
13641
13642 Note that old-style stack checking is also the fallback method for
13643 specific if no target support has been added in the compiler.
13644
13645 -fstack-check= is designed for Ada's needs to detect infinite
13646 recursion and stack overflows. specific is an excellent choice
13647 when compiling Ada code. It is not generally sufficient to protect
13648 against stack-clash attacks. To protect against those you want
13649 -fstack-clash-protection.
13650
13651 -fstack-clash-protection
13652 Generate code to prevent stack clash style attacks. When this
13653 option is enabled, the compiler will only allocate one page of
13654 stack space at a time and each page is accessed immediately after
13655 allocation. Thus, it prevents allocations from jumping over any
13656 stack guard page provided by the operating system.
13657
13658 Most targets do not fully support stack clash protection. However,
13659 on those targets -fstack-clash-protection will protect dynamic
13660 stack allocations. -fstack-clash-protection may also provide
13661 limited protection for static stack allocations if the target
13662 supports -fstack-check=specific.
13663
13664 -fstack-limit-register=reg
13665 -fstack-limit-symbol=sym
13666 -fno-stack-limit
13667 Generate code to ensure that the stack does not grow beyond a
13668 certain value, either the value of a register or the address of a
13669 symbol. If a larger stack is required, a signal is raised at run
13670 time. For most targets, the signal is raised before the stack
13671 overruns the boundary, so it is possible to catch the signal
13672 without taking special precautions.
13673
13674 For instance, if the stack starts at absolute address 0x80000000
13675 and grows downwards, you can use the flags
13676 -fstack-limit-symbol=__stack_limit and
13677 -Wl,--defsym,__stack_limit=0x7ffe0000 to enforce a stack limit of
13678 128KB. Note that this may only work with the GNU linker.
13679
13680 You can locally override stack limit checking by using the
13681 "no_stack_limit" function attribute.
13682
13683 -fsplit-stack
13684 Generate code to automatically split the stack before it overflows.
13685 The resulting program has a discontiguous stack which can only
13686 overflow if the program is unable to allocate any more memory.
13687 This is most useful when running threaded programs, as it is no
13688 longer necessary to calculate a good stack size to use for each
13689 thread. This is currently only implemented for the x86 targets
13690 running GNU/Linux.
13691
13692 When code compiled with -fsplit-stack calls code compiled without
13693 -fsplit-stack, there may not be much stack space available for the
13694 latter code to run. If compiling all code, including library code,
13695 with -fsplit-stack is not an option, then the linker can fix up
13696 these calls so that the code compiled without -fsplit-stack always
13697 has a large stack. Support for this is implemented in the gold
13698 linker in GNU binutils release 2.21 and later.
13699
13700 -fvtable-verify=[std|preinit|none]
13701 This option is only available when compiling C++ code. It turns on
13702 (or off, if using -fvtable-verify=none) the security feature that
13703 verifies at run time, for every virtual call, that the vtable
13704 pointer through which the call is made is valid for the type of the
13705 object, and has not been corrupted or overwritten. If an invalid
13706 vtable pointer is detected at run time, an error is reported and
13707 execution of the program is immediately halted.
13708
13709 This option causes run-time data structures to be built at program
13710 startup, which are used for verifying the vtable pointers. The
13711 options std and preinit control the timing of when these data
13712 structures are built. In both cases the data structures are built
13713 before execution reaches "main". Using -fvtable-verify=std causes
13714 the data structures to be built after shared libraries have been
13715 loaded and initialized. -fvtable-verify=preinit causes them to be
13716 built before shared libraries have been loaded and initialized.
13717
13718 If this option appears multiple times in the command line with
13719 different values specified, none takes highest priority over both
13720 std and preinit; preinit takes priority over std.
13721
13722 -fvtv-debug
13723 When used in conjunction with -fvtable-verify=std or
13724 -fvtable-verify=preinit, causes debug versions of the runtime
13725 functions for the vtable verification feature to be called. This
13726 flag also causes the compiler to log information about which vtable
13727 pointers it finds for each class. This information is written to a
13728 file named vtv_set_ptr_data.log in the directory named by the
13729 environment variable VTV_LOGS_DIR if that is defined or the current
13730 working directory otherwise.
13731
13732 Note: This feature appends data to the log file. If you want a
13733 fresh log file, be sure to delete any existing one.
13734
13735 -fvtv-counts
13736 This is a debugging flag. When used in conjunction with
13737 -fvtable-verify=std or -fvtable-verify=preinit, this causes the
13738 compiler to keep track of the total number of virtual calls it
13739 encounters and the number of verifications it inserts. It also
13740 counts the number of calls to certain run-time library functions
13741 that it inserts and logs this information for each compilation
13742 unit. The compiler writes this information to a file named
13743 vtv_count_data.log in the directory named by the environment
13744 variable VTV_LOGS_DIR if that is defined or the current working
13745 directory otherwise. It also counts the size of the vtable pointer
13746 sets for each class, and writes this information to
13747 vtv_class_set_sizes.log in the same directory.
13748
13749 Note: This feature appends data to the log files. To get fresh
13750 log files, be sure to delete any existing ones.
13751
13752 -finstrument-functions
13753 Generate instrumentation calls for entry and exit to functions.
13754 Just after function entry and just before function exit, the
13755 following profiling functions are called with the address of the
13756 current function and its call site. (On some platforms,
13757 "__builtin_return_address" does not work beyond the current
13758 function, so the call site information may not be available to the
13759 profiling functions otherwise.)
13760
13761 void __cyg_profile_func_enter (void *this_fn,
13762 void *call_site);
13763 void __cyg_profile_func_exit (void *this_fn,
13764 void *call_site);
13765
13766 The first argument is the address of the start of the current
13767 function, which may be looked up exactly in the symbol table.
13768
13769 This instrumentation is also done for functions expanded inline in
13770 other functions. The profiling calls indicate where, conceptually,
13771 the inline function is entered and exited. This means that
13772 addressable versions of such functions must be available. If all
13773 your uses of a function are expanded inline, this may mean an
13774 additional expansion of code size. If you use "extern inline" in
13775 your C code, an addressable version of such functions must be
13776 provided. (This is normally the case anyway, but if you get lucky
13777 and the optimizer always expands the functions inline, you might
13778 have gotten away without providing static copies.)
13779
13780 A function may be given the attribute "no_instrument_function", in
13781 which case this instrumentation is not done. This can be used, for
13782 example, for the profiling functions listed above, high-priority
13783 interrupt routines, and any functions from which the profiling
13784 functions cannot safely be called (perhaps signal handlers, if the
13785 profiling routines generate output or allocate memory).
13786
13787 -finstrument-functions-exclude-file-list=file,file,...
13788 Set the list of functions that are excluded from instrumentation
13789 (see the description of -finstrument-functions). If the file that
13790 contains a function definition matches with one of file, then that
13791 function is not instrumented. The match is done on substrings: if
13792 the file parameter is a substring of the file name, it is
13793 considered to be a match.
13794
13795 For example:
13796
13797 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13798
13799 excludes any inline function defined in files whose pathnames
13800 contain /bits/stl or include/sys.
13801
13802 If, for some reason, you want to include letter , in one of sym,
13803 write ,. For example,
13804 -finstrument-functions-exclude-file-list=',,tmp' (note the single
13805 quote surrounding the option).
13806
13807 -finstrument-functions-exclude-function-list=sym,sym,...
13808 This is similar to -finstrument-functions-exclude-file-list, but
13809 this option sets the list of function names to be excluded from
13810 instrumentation. The function name to be matched is its user-
13811 visible name, such as "vector<int> blah(const vector<int> &)", not
13812 the internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The
13813 match is done on substrings: if the sym parameter is a substring of
13814 the function name, it is considered to be a match. For C99 and C++
13815 extended identifiers, the function name must be given in UTF-8, not
13816 using universal character names.
13817
13818 -fpatchable-function-entry=N[,M]
13819 Generate N NOPs right at the beginning of each function, with the
13820 function entry point before the Mth NOP. If M is omitted, it
13821 defaults to 0 so the function entry points to the address just at
13822 the first NOP. The NOP instructions reserve extra space which can
13823 be used to patch in any desired instrumentation at run time,
13824 provided that the code segment is writable. The amount of space is
13825 controllable indirectly via the number of NOPs; the NOP instruction
13826 used corresponds to the instruction emitted by the internal GCC
13827 back-end interface "gen_nop". This behavior is target-specific and
13828 may also depend on the architecture variant and/or other
13829 compilation options.
13830
13831 For run-time identification, the starting addresses of these areas,
13832 which correspond to their respective function entries minus M, are
13833 additionally collected in the "__patchable_function_entries"
13834 section of the resulting binary.
13835
13836 Note that the value of "__attribute__ ((patchable_function_entry
13837 (N,M)))" takes precedence over command-line option
13838 -fpatchable-function-entry=N,M. This can be used to increase the
13839 area size or to remove it completely on a single function. If
13840 "N=0", no pad location is recorded.
13841
13842 The NOP instructions are inserted at---and maybe before, depending
13843 on M---the function entry address, even before the prologue.
13844
13845 The maximum value of N and M is 65535.
13846
13847 Options Controlling the Preprocessor
13848 These options control the C preprocessor, which is run on each C source
13849 file before actual compilation.
13850
13851 If you use the -E option, nothing is done except preprocessing. Some
13852 of these options make sense only together with -E because they cause
13853 the preprocessor output to be unsuitable for actual compilation.
13854
13855 In addition to the options listed here, there are a number of options
13856 to control search paths for include files documented in Directory
13857 Options. Options to control preprocessor diagnostics are listed in
13858 Warning Options.
13859
13860 -D name
13861 Predefine name as a macro, with definition 1.
13862
13863 -D name=definition
13864 The contents of definition are tokenized and processed as if they
13865 appeared during translation phase three in a #define directive. In
13866 particular, the definition is truncated by embedded newline
13867 characters.
13868
13869 If you are invoking the preprocessor from a shell or shell-like
13870 program you may need to use the shell's quoting syntax to protect
13871 characters such as spaces that have a meaning in the shell syntax.
13872
13873 If you wish to define a function-like macro on the command line,
13874 write its argument list with surrounding parentheses before the
13875 equals sign (if any). Parentheses are meaningful to most shells,
13876 so you should quote the option. With sh and csh,
13877 -D'name(args...)=definition' works.
13878
13879 -D and -U options are processed in the order they are given on the
13880 command line. All -imacros file and -include file options are
13881 processed after all -D and -U options.
13882
13883 -U name
13884 Cancel any previous definition of name, either built in or provided
13885 with a -D option.
13886
13887 -include file
13888 Process file as if "#include "file"" appeared as the first line of
13889 the primary source file. However, the first directory searched for
13890 file is the preprocessor's working directory instead of the
13891 directory containing the main source file. If not found there, it
13892 is searched for in the remainder of the "#include "..."" search
13893 chain as normal.
13894
13895 If multiple -include options are given, the files are included in
13896 the order they appear on the command line.
13897
13898 -imacros file
13899 Exactly like -include, except that any output produced by scanning
13900 file is thrown away. Macros it defines remain defined. This
13901 allows you to acquire all the macros from a header without also
13902 processing its declarations.
13903
13904 All files specified by -imacros are processed before all files
13905 specified by -include.
13906
13907 -undef
13908 Do not predefine any system-specific or GCC-specific macros. The
13909 standard predefined macros remain defined.
13910
13911 -pthread
13912 Define additional macros required for using the POSIX threads
13913 library. You should use this option consistently for both
13914 compilation and linking. This option is supported on GNU/Linux
13915 targets, most other Unix derivatives, and also on x86 Cygwin and
13916 MinGW targets.
13917
13918 -M Instead of outputting the result of preprocessing, output a rule
13919 suitable for make describing the dependencies of the main source
13920 file. The preprocessor outputs one make rule containing the object
13921 file name for that source file, a colon, and the names of all the
13922 included files, including those coming from -include or -imacros
13923 command-line options.
13924
13925 Unless specified explicitly (with -MT or -MQ), the object file name
13926 consists of the name of the source file with any suffix replaced
13927 with object file suffix and with any leading directory parts
13928 removed. If there are many included files then the rule is split
13929 into several lines using \-newline. The rule has no commands.
13930
13931 This option does not suppress the preprocessor's debug output, such
13932 as -dM. To avoid mixing such debug output with the dependency
13933 rules you should explicitly specify the dependency output file with
13934 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
13935 Debug output is still sent to the regular output stream as normal.
13936
13937 Passing -M to the driver implies -E, and suppresses warnings with
13938 an implicit -w.
13939
13940 -MM Like -M but do not mention header files that are found in system
13941 header directories, nor header files that are included, directly or
13942 indirectly, from such a header.
13943
13944 This implies that the choice of angle brackets or double quotes in
13945 an #include directive does not in itself determine whether that
13946 header appears in -MM dependency output.
13947
13948 -MF file
13949 When used with -M or -MM, specifies a file to write the
13950 dependencies to. If no -MF switch is given the preprocessor sends
13951 the rules to the same place it would send preprocessed output.
13952
13953 When used with the driver options -MD or -MMD, -MF overrides the
13954 default dependency output file.
13955
13956 If file is -, then the dependencies are written to stdout.
13957
13958 -MG In conjunction with an option such as -M requesting dependency
13959 generation, -MG assumes missing header files are generated files
13960 and adds them to the dependency list without raising an error. The
13961 dependency filename is taken directly from the "#include" directive
13962 without prepending any path. -MG also suppresses preprocessed
13963 output, as a missing header file renders this useless.
13964
13965 This feature is used in automatic updating of makefiles.
13966
13967 -Mno-modules
13968 Disable dependency generation for compiled module interfaces.
13969
13970 -MP This option instructs CPP to add a phony target for each dependency
13971 other than the main file, causing each to depend on nothing. These
13972 dummy rules work around errors make gives if you remove header
13973 files without updating the Makefile to match.
13974
13975 This is typical output:
13976
13977 test.o: test.c test.h
13978
13979 test.h:
13980
13981 -MT target
13982 Change the target of the rule emitted by dependency generation. By
13983 default CPP takes the name of the main input file, deletes any
13984 directory components and any file suffix such as .c, and appends
13985 the platform's usual object suffix. The result is the target.
13986
13987 An -MT option sets the target to be exactly the string you specify.
13988 If you want multiple targets, you can specify them as a single
13989 argument to -MT, or use multiple -MT options.
13990
13991 For example, -MT '$(objpfx)foo.o' might give
13992
13993 $(objpfx)foo.o: foo.c
13994
13995 -MQ target
13996 Same as -MT, but it quotes any characters which are special to
13997 Make. -MQ '$(objpfx)foo.o' gives
13998
13999 $$(objpfx)foo.o: foo.c
14000
14001 The default target is automatically quoted, as if it were given
14002 with -MQ.
14003
14004 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
14005 The driver determines file based on whether an -o option is given.
14006 If it is, the driver uses its argument but with a suffix of .d,
14007 otherwise it takes the name of the input file, removes any
14008 directory components and suffix, and applies a .d suffix.
14009
14010 If -MD is used in conjunction with -E, any -o switch is understood
14011 to specify the dependency output file, but if used without -E, each
14012 -o is understood to specify a target object file.
14013
14014 Since -E is not implied, -MD can be used to generate a dependency
14015 output file as a side effect of the compilation process.
14016
14017 -MMD
14018 Like -MD except mention only user header files, not system header
14019 files.
14020
14021 -fpreprocessed
14022 Indicate to the preprocessor that the input file has already been
14023 preprocessed. This suppresses things like macro expansion,
14024 trigraph conversion, escaped newline splicing, and processing of
14025 most directives. The preprocessor still recognizes and removes
14026 comments, so that you can pass a file preprocessed with -C to the
14027 compiler without problems. In this mode the integrated
14028 preprocessor is little more than a tokenizer for the front ends.
14029
14030 -fpreprocessed is implicit if the input file has one of the
14031 extensions .i, .ii or .mi. These are the extensions that GCC uses
14032 for preprocessed files created by -save-temps.
14033
14034 -fdirectives-only
14035 When preprocessing, handle directives, but do not expand macros.
14036
14037 The option's behavior depends on the -E and -fpreprocessed options.
14038
14039 With -E, preprocessing is limited to the handling of directives
14040 such as "#define", "#ifdef", and "#error". Other preprocessor
14041 operations, such as macro expansion and trigraph conversion are not
14042 performed. In addition, the -dD option is implicitly enabled.
14043
14044 With -fpreprocessed, predefinition of command line and most builtin
14045 macros is disabled. Macros such as "__LINE__", which are
14046 contextually dependent, are handled normally. This enables
14047 compilation of files previously preprocessed with "-E
14048 -fdirectives-only".
14049
14050 With both -E and -fpreprocessed, the rules for -fpreprocessed take
14051 precedence. This enables full preprocessing of files previously
14052 preprocessed with "-E -fdirectives-only".
14053
14054 -fdollars-in-identifiers
14055 Accept $ in identifiers.
14056
14057 -fextended-identifiers
14058 Accept universal character names and extended characters in
14059 identifiers. This option is enabled by default for C99 (and later
14060 C standard versions) and C++.
14061
14062 -fno-canonical-system-headers
14063 When preprocessing, do not shorten system header paths with
14064 canonicalization.
14065
14066 -fmax-include-depth=depth
14067 Set the maximum depth of the nested #include. The default is 200.
14068
14069 -ftabstop=width
14070 Set the distance between tab stops. This helps the preprocessor
14071 report correct column numbers in warnings or errors, even if tabs
14072 appear on the line. If the value is less than 1 or greater than
14073 100, the option is ignored. The default is 8.
14074
14075 -ftrack-macro-expansion[=level]
14076 Track locations of tokens across macro expansions. This allows the
14077 compiler to emit diagnostic about the current macro expansion stack
14078 when a compilation error occurs in a macro expansion. Using this
14079 option makes the preprocessor and the compiler consume more memory.
14080 The level parameter can be used to choose the level of precision of
14081 token location tracking thus decreasing the memory consumption if
14082 necessary. Value 0 of level de-activates this option. Value 1
14083 tracks tokens locations in a degraded mode for the sake of minimal
14084 memory overhead. In this mode all tokens resulting from the
14085 expansion of an argument of a function-like macro have the same
14086 location. Value 2 tracks tokens locations completely. This value is
14087 the most memory hungry. When this option is given no argument, the
14088 default parameter value is 2.
14089
14090 Note that "-ftrack-macro-expansion=2" is activated by default.
14091
14092 -fmacro-prefix-map=old=new
14093 When preprocessing files residing in directory old, expand the
14094 "__FILE__" and "__BASE_FILE__" macros as if the files resided in
14095 directory new instead. This can be used to change an absolute path
14096 to a relative path by using . for new which can result in more
14097 reproducible builds that are location independent. This option
14098 also affects "__builtin_FILE()" during compilation. See also
14099 -ffile-prefix-map.
14100
14101 -fexec-charset=charset
14102 Set the execution character set, used for string and character
14103 constants. The default is UTF-8. charset can be any encoding
14104 supported by the system's "iconv" library routine.
14105
14106 -fwide-exec-charset=charset
14107 Set the wide execution character set, used for wide string and
14108 character constants. The default is UTF-32 or UTF-16, whichever
14109 corresponds to the width of "wchar_t". As with -fexec-charset,
14110 charset can be any encoding supported by the system's "iconv"
14111 library routine; however, you will have problems with encodings
14112 that do not fit exactly in "wchar_t".
14113
14114 -finput-charset=charset
14115 Set the input character set, used for translation from the
14116 character set of the input file to the source character set used by
14117 GCC. If the locale does not specify, or GCC cannot get this
14118 information from the locale, the default is UTF-8. This can be
14119 overridden by either the locale or this command-line option.
14120 Currently the command-line option takes precedence if there's a
14121 conflict. charset can be any encoding supported by the system's
14122 "iconv" library routine.
14123
14124 -fpch-deps
14125 When using precompiled headers, this flag causes the dependency-
14126 output flags to also list the files from the precompiled header's
14127 dependencies. If not specified, only the precompiled header are
14128 listed and not the files that were used to create it, because those
14129 files are not consulted when a precompiled header is used.
14130
14131 -fpch-preprocess
14132 This option allows use of a precompiled header together with -E.
14133 It inserts a special "#pragma", "#pragma GCC pch_preprocess
14134 "filename"" in the output to mark the place where the precompiled
14135 header was found, and its filename. When -fpreprocessed is in use,
14136 GCC recognizes this "#pragma" and loads the PCH.
14137
14138 This option is off by default, because the resulting preprocessed
14139 output is only really suitable as input to GCC. It is switched on
14140 by -save-temps.
14141
14142 You should not write this "#pragma" in your own code, but it is
14143 safe to edit the filename if the PCH file is available in a
14144 different location. The filename may be absolute or it may be
14145 relative to GCC's current directory.
14146
14147 -fworking-directory
14148 Enable generation of linemarkers in the preprocessor output that
14149 let the compiler know the current working directory at the time of
14150 preprocessing. When this option is enabled, the preprocessor
14151 emits, after the initial linemarker, a second linemarker with the
14152 current working directory followed by two slashes. GCC uses this
14153 directory, when it's present in the preprocessed input, as the
14154 directory emitted as the current working directory in some
14155 debugging information formats. This option is implicitly enabled
14156 if debugging information is enabled, but this can be inhibited with
14157 the negated form -fno-working-directory. If the -P flag is present
14158 in the command line, this option has no effect, since no "#line"
14159 directives are emitted whatsoever.
14160
14161 -A predicate=answer
14162 Make an assertion with the predicate predicate and answer answer.
14163 This form is preferred to the older form -A predicate(answer),
14164 which is still supported, because it does not use shell special
14165 characters.
14166
14167 -A -predicate=answer
14168 Cancel an assertion with the predicate predicate and answer answer.
14169
14170 -C Do not discard comments. All comments are passed through to the
14171 output file, except for comments in processed directives, which are
14172 deleted along with the directive.
14173
14174 You should be prepared for side effects when using -C; it causes
14175 the preprocessor to treat comments as tokens in their own right.
14176 For example, comments appearing at the start of what would be a
14177 directive line have the effect of turning that line into an
14178 ordinary source line, since the first token on the line is no
14179 longer a #.
14180
14181 -CC Do not discard comments, including during macro expansion. This is
14182 like -C, except that comments contained within macros are also
14183 passed through to the output file where the macro is expanded.
14184
14185 In addition to the side effects of the -C option, the -CC option
14186 causes all C++-style comments inside a macro to be converted to
14187 C-style comments. This is to prevent later use of that macro from
14188 inadvertently commenting out the remainder of the source line.
14189
14190 The -CC option is generally used to support lint comments.
14191
14192 -P Inhibit generation of linemarkers in the output from the
14193 preprocessor. This might be useful when running the preprocessor
14194 on something that is not C code, and will be sent to a program
14195 which might be confused by the linemarkers.
14196
14197 -traditional
14198 -traditional-cpp
14199 Try to imitate the behavior of pre-standard C preprocessors, as
14200 opposed to ISO C preprocessors. See the GNU CPP manual for
14201 details.
14202
14203 Note that GCC does not otherwise attempt to emulate a pre-standard
14204 C compiler, and these options are only supported with the -E
14205 switch, or when invoking CPP explicitly.
14206
14207 -trigraphs
14208 Support ISO C trigraphs. These are three-character sequences, all
14209 starting with ??, that are defined by ISO C to stand for single
14210 characters. For example, ??/ stands for \, so '??/n' is a
14211 character constant for a newline.
14212
14213 The nine trigraphs and their replacements are
14214
14215 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
14216 Replacement: [ ] { } # \ ^ | ~
14217
14218 By default, GCC ignores trigraphs, but in standard-conforming modes
14219 it converts them. See the -std and -ansi options.
14220
14221 -remap
14222 Enable special code to work around file systems which only permit
14223 very short file names, such as MS-DOS.
14224
14225 -H Print the name of each header file used, in addition to other
14226 normal activities. Each name is indented to show how deep in the
14227 #include stack it is. Precompiled header files are also printed,
14228 even if they are found to be invalid; an invalid precompiled header
14229 file is printed with ...x and a valid one with ...! .
14230
14231 -dletters
14232 Says to make debugging dumps during compilation as specified by
14233 letters. The flags documented here are those relevant to the
14234 preprocessor. Other letters are interpreted by the compiler
14235 proper, or reserved for future versions of GCC, and so are silently
14236 ignored. If you specify letters whose behavior conflicts, the
14237 result is undefined.
14238
14239 -dM Instead of the normal output, generate a list of #define
14240 directives for all the macros defined during the execution of
14241 the preprocessor, including predefined macros. This gives you
14242 a way of finding out what is predefined in your version of the
14243 preprocessor. Assuming you have no file foo.h, the command
14244
14245 touch foo.h; cpp -dM foo.h
14246
14247 shows all the predefined macros.
14248
14249 If you use -dM without the -E option, -dM is interpreted as a
14250 synonym for -fdump-rtl-mach.
14251
14252 -dD Like -dM except in two respects: it does not include the
14253 predefined macros, and it outputs both the #define directives
14254 and the result of preprocessing. Both kinds of output go to
14255 the standard output file.
14256
14257 -dN Like -dD, but emit only the macro names, not their expansions.
14258
14259 -dI Output #include directives in addition to the result of
14260 preprocessing.
14261
14262 -dU Like -dD except that only macros that are expanded, or whose
14263 definedness is tested in preprocessor directives, are output;
14264 the output is delayed until the use or test of the macro; and
14265 #undef directives are also output for macros tested but
14266 undefined at the time.
14267
14268 -fdebug-cpp
14269 This option is only useful for debugging GCC. When used from CPP
14270 or with -E, it dumps debugging information about location maps.
14271 Every token in the output is preceded by the dump of the map its
14272 location belongs to.
14273
14274 When used from GCC without -E, this option has no effect.
14275
14276 -Wp,option
14277 You can use -Wp,option to bypass the compiler driver and pass
14278 option directly through to the preprocessor. If option contains
14279 commas, it is split into multiple options at the commas. However,
14280 many options are modified, translated or interpreted by the
14281 compiler driver before being passed to the preprocessor, and -Wp
14282 forcibly bypasses this phase. The preprocessor's direct interface
14283 is undocumented and subject to change, so whenever possible you
14284 should avoid using -Wp and let the driver handle the options
14285 instead.
14286
14287 -Xpreprocessor option
14288 Pass option as an option to the preprocessor. You can use this to
14289 supply system-specific preprocessor options that GCC does not
14290 recognize.
14291
14292 If you want to pass an option that takes an argument, you must use
14293 -Xpreprocessor twice, once for the option and once for the
14294 argument.
14295
14296 -no-integrated-cpp
14297 Perform preprocessing as a separate pass before compilation. By
14298 default, GCC performs preprocessing as an integrated part of input
14299 tokenization and parsing. If this option is provided, the
14300 appropriate language front end (cc1, cc1plus, or cc1obj for C, C++,
14301 and Objective-C, respectively) is instead invoked twice, once for
14302 preprocessing only and once for actual compilation of the
14303 preprocessed input. This option may be useful in conjunction with
14304 the -B or -wrapper options to specify an alternate preprocessor or
14305 perform additional processing of the program source between normal
14306 preprocessing and compilation.
14307
14308 -flarge-source-files
14309 Adjust GCC to expect large source files, at the expense of slower
14310 compilation and higher memory usage.
14311
14312 Specifically, GCC normally tracks both column numbers and line
14313 numbers within source files and it normally prints both of these
14314 numbers in diagnostics. However, once it has processed a certain
14315 number of source lines, it stops tracking column numbers and only
14316 tracks line numbers. This means that diagnostics for later lines
14317 do not include column numbers. It also means that options like
14318 -Wmisleading-indentation cease to work at that point, although the
14319 compiler prints a note if this happens. Passing
14320 -flarge-source-files significantly increases the number of source
14321 lines that GCC can process before it stops tracking columns.
14322
14323 Passing Options to the Assembler
14324 You can pass options to the assembler.
14325
14326 -Wa,option
14327 Pass option as an option to the assembler. If option contains
14328 commas, it is split into multiple options at the commas.
14329
14330 -Xassembler option
14331 Pass option as an option to the assembler. You can use this to
14332 supply system-specific assembler options that GCC does not
14333 recognize.
14334
14335 If you want to pass an option that takes an argument, you must use
14336 -Xassembler twice, once for the option and once for the argument.
14337
14338 Options for Linking
14339 These options come into play when the compiler links object files into
14340 an executable output file. They are meaningless if the compiler is not
14341 doing a link step.
14342
14343 object-file-name
14344 A file name that does not end in a special recognized suffix is
14345 considered to name an object file or library. (Object files are
14346 distinguished from libraries by the linker according to the file
14347 contents.) If linking is done, these object files are used as
14348 input to the linker.
14349
14350 -c
14351 -S
14352 -E If any of these options is used, then the linker is not run, and
14353 object file names should not be used as arguments.
14354
14355 -flinker-output=type
14356 This option controls code generation of the link-time optimizer.
14357 By default the linker output is automatically determined by the
14358 linker plugin. For debugging the compiler and if incremental
14359 linking with a non-LTO object file is desired, it may be useful to
14360 control the type manually.
14361
14362 If type is exec, code generation produces a static binary. In this
14363 case -fpic and -fpie are both disabled.
14364
14365 If type is dyn, code generation produces a shared library. In this
14366 case -fpic or -fPIC is preserved, but not enabled automatically.
14367 This allows to build shared libraries without position-independent
14368 code on architectures where this is possible, i.e. on x86.
14369
14370 If type is pie, code generation produces an -fpie executable. This
14371 results in similar optimizations as exec except that -fpie is not
14372 disabled if specified at compilation time.
14373
14374 If type is rel, the compiler assumes that incremental linking is
14375 done. The sections containing intermediate code for link-time
14376 optimization are merged, pre-optimized, and output to the resulting
14377 object file. In addition, if -ffat-lto-objects is specified, binary
14378 code is produced for future non-LTO linking. The object file
14379 produced by incremental linking is smaller than a static library
14380 produced from the same object files. At link time the result of
14381 incremental linking also loads faster than a static library
14382 assuming that the majority of objects in the library are used.
14383
14384 Finally nolto-rel configures the compiler for incremental linking
14385 where code generation is forced, a final binary is produced, and
14386 the intermediate code for later link-time optimization is stripped.
14387 When multiple object files are linked together the resulting code
14388 is better optimized than with link-time optimizations disabled (for
14389 example, cross-module inlining happens), but most of benefits of
14390 whole program optimizations are lost.
14391
14392 During the incremental link (by -r) the linker plugin defaults to
14393 rel. With current interfaces to GNU Binutils it is however not
14394 possible to incrementally link LTO objects and non-LTO objects into
14395 a single mixed object file. If any of object files in incremental
14396 link cannot be used for link-time optimization, the linker plugin
14397 issues a warning and uses nolto-rel. To maintain whole program
14398 optimization, it is recommended to link such objects into static
14399 library instead. Alternatively it is possible to use H.J. Lu's
14400 binutils with support for mixed objects.
14401
14402 -fuse-ld=bfd
14403 Use the bfd linker instead of the default linker.
14404
14405 -fuse-ld=gold
14406 Use the gold linker instead of the default linker.
14407
14408 -fuse-ld=lld
14409 Use the LLVM lld linker instead of the default linker.
14410
14411 -fuse-ld=mold
14412 Use the Modern Linker (mold) instead of the default linker.
14413
14414 -llibrary
14415 -l library
14416 Search the library named library when linking. (The second
14417 alternative with the library as a separate argument is only for
14418 POSIX compliance and is not recommended.)
14419
14420 The -l option is passed directly to the linker by GCC. Refer to
14421 your linker documentation for exact details. The general
14422 description below applies to the GNU linker.
14423
14424 The linker searches a standard list of directories for the library.
14425 The directories searched include several standard system
14426 directories plus any that you specify with -L.
14427
14428 Static libraries are archives of object files, and have file names
14429 like liblibrary.a. Some targets also support shared libraries,
14430 which typically have names like liblibrary.so. If both static and
14431 shared libraries are found, the linker gives preference to linking
14432 with the shared library unless the -static option is used.
14433
14434 It makes a difference where in the command you write this option;
14435 the linker searches and processes libraries and object files in the
14436 order they are specified. Thus, foo.o -lz bar.o searches library z
14437 after file foo.o but before bar.o. If bar.o refers to functions in
14438 z, those functions may not be loaded.
14439
14440 -lobjc
14441 You need this special case of the -l option in order to link an
14442 Objective-C or Objective-C++ program.
14443
14444 -nostartfiles
14445 Do not use the standard system startup files when linking. The
14446 standard system libraries are used normally, unless -nostdlib,
14447 -nolibc, or -nodefaultlibs is used.
14448
14449 -nodefaultlibs
14450 Do not use the standard system libraries when linking. Only the
14451 libraries you specify are passed to the linker, and options
14452 specifying linkage of the system libraries, such as -static-libgcc
14453 or -shared-libgcc, are ignored. The standard startup files are
14454 used normally, unless -nostartfiles is used.
14455
14456 The compiler may generate calls to "memcmp", "memset", "memcpy" and
14457 "memmove". These entries are usually resolved by entries in libc.
14458 These entry points should be supplied through some other mechanism
14459 when this option is specified.
14460
14461 -nolibc
14462 Do not use the C library or system libraries tightly coupled with
14463 it when linking. Still link with the startup files, libgcc or
14464 toolchain provided language support libraries such as libgnat,
14465 libgfortran or libstdc++ unless options preventing their inclusion
14466 are used as well. This typically removes -lc from the link command
14467 line, as well as system libraries that normally go with it and
14468 become meaningless when absence of a C library is assumed, for
14469 example -lpthread or -lm in some configurations. This is intended
14470 for bare-board targets when there is indeed no C library available.
14471
14472 -nostdlib
14473 Do not use the standard system startup files or libraries when
14474 linking. No startup files and only the libraries you specify are
14475 passed to the linker, and options specifying linkage of the system
14476 libraries, such as -static-libgcc or -shared-libgcc, are ignored.
14477
14478 The compiler may generate calls to "memcmp", "memset", "memcpy" and
14479 "memmove". These entries are usually resolved by entries in libc.
14480 These entry points should be supplied through some other mechanism
14481 when this option is specified.
14482
14483 One of the standard libraries bypassed by -nostdlib and
14484 -nodefaultlibs is libgcc.a, a library of internal subroutines which
14485 GCC uses to overcome shortcomings of particular machines, or
14486 special needs for some languages.
14487
14488 In most cases, you need libgcc.a even when you want to avoid other
14489 standard libraries. In other words, when you specify -nostdlib or
14490 -nodefaultlibs you should usually specify -lgcc as well. This
14491 ensures that you have no unresolved references to internal GCC
14492 library subroutines. (An example of such an internal subroutine is
14493 "__main", used to ensure C++ constructors are called.)
14494
14495 -e entry
14496 --entry=entry
14497 Specify that the program entry point is entry. The argument is
14498 interpreted by the linker; the GNU linker accepts either a symbol
14499 name or an address.
14500
14501 -pie
14502 Produce a dynamically linked position independent executable on
14503 targets that support it. For predictable results, you must also
14504 specify the same set of options used for compilation (-fpie, -fPIE,
14505 or model suboptions) when you specify this linker option.
14506
14507 -no-pie
14508 Don't produce a dynamically linked position independent executable.
14509
14510 -static-pie
14511 Produce a static position independent executable on targets that
14512 support it. A static position independent executable is similar to
14513 a static executable, but can be loaded at any address without a
14514 dynamic linker. For predictable results, you must also specify the
14515 same set of options used for compilation (-fpie, -fPIE, or model
14516 suboptions) when you specify this linker option.
14517
14518 -pthread
14519 Link with the POSIX threads library. This option is supported on
14520 GNU/Linux targets, most other Unix derivatives, and also on x86
14521 Cygwin and MinGW targets. On some targets this option also sets
14522 flags for the preprocessor, so it should be used consistently for
14523 both compilation and linking.
14524
14525 -r Produce a relocatable object as output. This is also known as
14526 partial linking.
14527
14528 -rdynamic
14529 Pass the flag -export-dynamic to the ELF linker, on targets that
14530 support it. This instructs the linker to add all symbols, not only
14531 used ones, to the dynamic symbol table. This option is needed for
14532 some uses of "dlopen" or to allow obtaining backtraces from within
14533 a program.
14534
14535 -s Remove all symbol table and relocation information from the
14536 executable.
14537
14538 -static
14539 On systems that support dynamic linking, this overrides -pie and
14540 prevents linking with the shared libraries. On other systems, this
14541 option has no effect.
14542
14543 -shared
14544 Produce a shared object which can then be linked with other objects
14545 to form an executable. Not all systems support this option. For
14546 predictable results, you must also specify the same set of options
14547 used for compilation (-fpic, -fPIC, or model suboptions) when you
14548 specify this linker option.[1]
14549
14550 -shared-libgcc
14551 -static-libgcc
14552 On systems that provide libgcc as a shared library, these options
14553 force the use of either the shared or static version, respectively.
14554 If no shared version of libgcc was built when the compiler was
14555 configured, these options have no effect.
14556
14557 There are several situations in which an application should use the
14558 shared libgcc instead of the static version. The most common of
14559 these is when the application wishes to throw and catch exceptions
14560 across different shared libraries. In that case, each of the
14561 libraries as well as the application itself should use the shared
14562 libgcc.
14563
14564 Therefore, the G++ driver automatically adds -shared-libgcc
14565 whenever you build a shared library or a main executable, because
14566 C++ programs typically use exceptions, so this is the right thing
14567 to do.
14568
14569 If, instead, you use the GCC driver to create shared libraries, you
14570 may find that they are not always linked with the shared libgcc.
14571 If GCC finds, at its configuration time, that you have a non-GNU
14572 linker or a GNU linker that does not support option --eh-frame-hdr,
14573 it links the shared version of libgcc into shared libraries by
14574 default. Otherwise, it takes advantage of the linker and optimizes
14575 away the linking with the shared version of libgcc, linking with
14576 the static version of libgcc by default. This allows exceptions to
14577 propagate through such shared libraries, without incurring
14578 relocation costs at library load time.
14579
14580 However, if a library or main executable is supposed to throw or
14581 catch exceptions, you must link it using the G++ driver, or using
14582 the option -shared-libgcc, such that it is linked with the shared
14583 libgcc.
14584
14585 -static-libasan
14586 When the -fsanitize=address option is used to link a program, the
14587 GCC driver automatically links against libasan. If libasan is
14588 available as a shared library, and the -static option is not used,
14589 then this links against the shared version of libasan. The
14590 -static-libasan option directs the GCC driver to link libasan
14591 statically, without necessarily linking other libraries statically.
14592
14593 -static-libtsan
14594 When the -fsanitize=thread option is used to link a program, the
14595 GCC driver automatically links against libtsan. If libtsan is
14596 available as a shared library, and the -static option is not used,
14597 then this links against the shared version of libtsan. The
14598 -static-libtsan option directs the GCC driver to link libtsan
14599 statically, without necessarily linking other libraries statically.
14600
14601 -static-liblsan
14602 When the -fsanitize=leak option is used to link a program, the GCC
14603 driver automatically links against liblsan. If liblsan is
14604 available as a shared library, and the -static option is not used,
14605 then this links against the shared version of liblsan. The
14606 -static-liblsan option directs the GCC driver to link liblsan
14607 statically, without necessarily linking other libraries statically.
14608
14609 -static-libubsan
14610 When the -fsanitize=undefined option is used to link a program, the
14611 GCC driver automatically links against libubsan. If libubsan is
14612 available as a shared library, and the -static option is not used,
14613 then this links against the shared version of libubsan. The
14614 -static-libubsan option directs the GCC driver to link libubsan
14615 statically, without necessarily linking other libraries statically.
14616
14617 -static-libstdc++
14618 When the g++ program is used to link a C++ program, it normally
14619 automatically links against libstdc++. If libstdc++ is available
14620 as a shared library, and the -static option is not used, then this
14621 links against the shared version of libstdc++. That is normally
14622 fine. However, it is sometimes useful to freeze the version of
14623 libstdc++ used by the program without going all the way to a fully
14624 static link. The -static-libstdc++ option directs the g++ driver
14625 to link libstdc++ statically, without necessarily linking other
14626 libraries statically.
14627
14628 -symbolic
14629 Bind references to global symbols when building a shared object.
14630 Warn about any unresolved references (unless overridden by the link
14631 editor option -Xlinker -z -Xlinker defs). Only a few systems
14632 support this option.
14633
14634 -T script
14635 Use script as the linker script. This option is supported by most
14636 systems using the GNU linker. On some targets, such as bare-board
14637 targets without an operating system, the -T option may be required
14638 when linking to avoid references to undefined symbols.
14639
14640 -Xlinker option
14641 Pass option as an option to the linker. You can use this to supply
14642 system-specific linker options that GCC does not recognize.
14643
14644 If you want to pass an option that takes a separate argument, you
14645 must use -Xlinker twice, once for the option and once for the
14646 argument. For example, to pass -assert definitions, you must write
14647 -Xlinker -assert -Xlinker definitions. It does not work to write
14648 -Xlinker "-assert definitions", because this passes the entire
14649 string as a single argument, which is not what the linker expects.
14650
14651 When using the GNU linker, it is usually more convenient to pass
14652 arguments to linker options using the option=value syntax than as
14653 separate arguments. For example, you can specify -Xlinker
14654 -Map=output.map rather than -Xlinker -Map -Xlinker output.map.
14655 Other linkers may not support this syntax for command-line options.
14656
14657 -Wl,option
14658 Pass option as an option to the linker. If option contains commas,
14659 it is split into multiple options at the commas. You can use this
14660 syntax to pass an argument to the option. For example,
14661 -Wl,-Map,output.map passes -Map output.map to the linker. When
14662 using the GNU linker, you can also get the same effect with
14663 -Wl,-Map=output.map.
14664
14665 -u symbol
14666 Pretend the symbol symbol is undefined, to force linking of library
14667 modules to define it. You can use -u multiple times with different
14668 symbols to force loading of additional library modules.
14669
14670 -z keyword
14671 -z is passed directly on to the linker along with the keyword
14672 keyword. See the section in the documentation of your linker for
14673 permitted values and their meanings.
14674
14675 Options for Directory Search
14676 These options specify directories to search for header files, for
14677 libraries and for parts of the compiler:
14678
14679 -I dir
14680 -iquote dir
14681 -isystem dir
14682 -idirafter dir
14683 Add the directory dir to the list of directories to be searched for
14684 header files during preprocessing. If dir begins with = or
14685 $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix;
14686 see --sysroot and -isysroot.
14687
14688 Directories specified with -iquote apply only to the quote form of
14689 the directive, "#include "file"". Directories specified with -I,
14690 -isystem, or -idirafter apply to lookup for both the
14691 "#include "file"" and "#include <file>" directives.
14692
14693 You can specify any number or combination of these options on the
14694 command line to search for header files in several directories.
14695 The lookup order is as follows:
14696
14697 1. For the quote form of the include directive, the directory of
14698 the current file is searched first.
14699
14700 2. For the quote form of the include directive, the directories
14701 specified by -iquote options are searched in left-to-right
14702 order, as they appear on the command line.
14703
14704 3. Directories specified with -I options are scanned in left-to-
14705 right order.
14706
14707 4. Directories specified with -isystem options are scanned in
14708 left-to-right order.
14709
14710 5. Standard system directories are scanned.
14711
14712 6. Directories specified with -idirafter options are scanned in
14713 left-to-right order.
14714
14715 You can use -I to override a system header file, substituting your
14716 own version, since these directories are searched before the
14717 standard system header file directories. However, you should not
14718 use this option to add directories that contain vendor-supplied
14719 system header files; use -isystem for that.
14720
14721 The -isystem and -idirafter options also mark the directory as a
14722 system directory, so that it gets the same special treatment that
14723 is applied to the standard system directories.
14724
14725 If a standard system include directory, or a directory specified
14726 with -isystem, is also specified with -I, the -I option is ignored.
14727 The directory is still searched but as a system directory at its
14728 normal position in the system include chain. This is to ensure
14729 that GCC's procedure to fix buggy system headers and the ordering
14730 for the "#include_next" directive are not inadvertently changed.
14731 If you really need to change the search order for system
14732 directories, use the -nostdinc and/or -isystem options.
14733
14734 -I- Split the include path. This option has been deprecated. Please
14735 use -iquote instead for -I directories before the -I- and remove
14736 the -I- option.
14737
14738 Any directories specified with -I options before -I- are searched
14739 only for headers requested with "#include "file""; they are not
14740 searched for "#include <file>". If additional directories are
14741 specified with -I options after the -I-, those directories are
14742 searched for all #include directives.
14743
14744 In addition, -I- inhibits the use of the directory of the current
14745 file directory as the first search directory for "#include "file"".
14746 There is no way to override this effect of -I-.
14747
14748 -iprefix prefix
14749 Specify prefix as the prefix for subsequent -iwithprefix options.
14750 If the prefix represents a directory, you should include the final
14751 /.
14752
14753 -iwithprefix dir
14754 -iwithprefixbefore dir
14755 Append dir to the prefix specified previously with -iprefix, and
14756 add the resulting directory to the include search path.
14757 -iwithprefixbefore puts it in the same place -I would; -iwithprefix
14758 puts it where -idirafter would.
14759
14760 -isysroot dir
14761 This option is like the --sysroot option, but applies only to
14762 header files (except for Darwin targets, where it applies to both
14763 header files and libraries). See the --sysroot option for more
14764 information.
14765
14766 -imultilib dir
14767 Use dir as a subdirectory of the directory containing target-
14768 specific C++ headers.
14769
14770 -nostdinc
14771 Do not search the standard system directories for header files.
14772 Only the directories explicitly specified with -I, -iquote,
14773 -isystem, and/or -idirafter options (and the directory of the
14774 current file, if appropriate) are searched.
14775
14776 -nostdinc++
14777 Do not search for header files in the C++-specific standard
14778 directories, but do still search the other standard directories.
14779 (This option is used when building the C++ library.)
14780
14781 -iplugindir=dir
14782 Set the directory to search for plugins that are passed by
14783 -fplugin=name instead of -fplugin=path/name.so. This option is not
14784 meant to be used by the user, but only passed by the driver.
14785
14786 -Ldir
14787 Add directory dir to the list of directories to be searched for -l.
14788
14789 -Bprefix
14790 This option specifies where to find the executables, libraries,
14791 include files, and data files of the compiler itself.
14792
14793 The compiler driver program runs one or more of the subprograms
14794 cpp, cc1, as and ld. It tries prefix as a prefix for each program
14795 it tries to run, both with and without machine/version/ for the
14796 corresponding target machine and compiler version.
14797
14798 For each subprogram to be run, the compiler driver first tries the
14799 -B prefix, if any. If that name is not found, or if -B is not
14800 specified, the driver tries two standard prefixes, /usr/lib/gcc/
14801 and /usr/local/lib/gcc/. If neither of those results in a file
14802 name that is found, the unmodified program name is searched for
14803 using the directories specified in your PATH environment variable.
14804
14805 The compiler checks to see if the path provided by -B refers to a
14806 directory, and if necessary it adds a directory separator character
14807 at the end of the path.
14808
14809 -B prefixes that effectively specify directory names also apply to
14810 libraries in the linker, because the compiler translates these
14811 options into -L options for the linker. They also apply to include
14812 files in the preprocessor, because the compiler translates these
14813 options into -isystem options for the preprocessor. In this case,
14814 the compiler appends include to the prefix.
14815
14816 The runtime support file libgcc.a can also be searched for using
14817 the -B prefix, if needed. If it is not found there, the two
14818 standard prefixes above are tried, and that is all. The file is
14819 left out of the link if it is not found by those means.
14820
14821 Another way to specify a prefix much like the -B prefix is to use
14822 the environment variable GCC_EXEC_PREFIX.
14823
14824 As a special kludge, if the path provided by -B is [dir/]stageN/,
14825 where N is a number in the range 0 to 9, then it is replaced by
14826 [dir/]include. This is to help with boot-strapping the compiler.
14827
14828 -no-canonical-prefixes
14829 Do not expand any symbolic links, resolve references to /../ or
14830 /./, or make the path absolute when generating a relative prefix.
14831
14832 --sysroot=dir
14833 Use dir as the logical root directory for headers and libraries.
14834 For example, if the compiler normally searches for headers in
14835 /usr/include and libraries in /usr/lib, it instead searches
14836 dir/usr/include and dir/usr/lib.
14837
14838 If you use both this option and the -isysroot option, then the
14839 --sysroot option applies to libraries, but the -isysroot option
14840 applies to header files.
14841
14842 The GNU linker (beginning with version 2.16) has the necessary
14843 support for this option. If your linker does not support this
14844 option, the header file aspect of --sysroot still works, but the
14845 library aspect does not.
14846
14847 --no-sysroot-suffix
14848 For some targets, a suffix is added to the root directory specified
14849 with --sysroot, depending on the other options used, so that
14850 headers may for example be found in dir/suffix/usr/include instead
14851 of dir/usr/include. This option disables the addition of such a
14852 suffix.
14853
14854 Options for Code Generation Conventions
14855 These machine-independent options control the interface conventions
14856 used in code generation.
14857
14858 Most of them have both positive and negative forms; the negative form
14859 of -ffoo is -fno-foo. In the table below, only one of the forms is
14860 listed---the one that is not the default. You can figure out the other
14861 form by either removing no- or adding it.
14862
14863 -fstack-reuse=reuse-level
14864 This option controls stack space reuse for user declared local/auto
14865 variables and compiler generated temporaries. reuse_level can be
14866 all, named_vars, or none. all enables stack reuse for all local
14867 variables and temporaries, named_vars enables the reuse only for
14868 user defined local variables with names, and none disables stack
14869 reuse completely. The default value is all. The option is needed
14870 when the program extends the lifetime of a scoped local variable or
14871 a compiler generated temporary beyond the end point defined by the
14872 language. When a lifetime of a variable ends, and if the variable
14873 lives in memory, the optimizing compiler has the freedom to reuse
14874 its stack space with other temporaries or scoped local variables
14875 whose live range does not overlap with it. Legacy code extending
14876 local lifetime is likely to break with the stack reuse
14877 optimization.
14878
14879 For example,
14880
14881 int *p;
14882 {
14883 int local1;
14884
14885 p = &local1;
14886 local1 = 10;
14887 ....
14888 }
14889 {
14890 int local2;
14891 local2 = 20;
14892 ...
14893 }
14894
14895 if (*p == 10) // out of scope use of local1
14896 {
14897
14898 }
14899
14900 Another example:
14901
14902 struct A
14903 {
14904 A(int k) : i(k), j(k) { }
14905 int i;
14906 int j;
14907 };
14908
14909 A *ap;
14910
14911 void foo(const A& ar)
14912 {
14913 ap = &ar;
14914 }
14915
14916 void bar()
14917 {
14918 foo(A(10)); // temp object's lifetime ends when foo returns
14919
14920 {
14921 A a(20);
14922 ....
14923 }
14924 ap->i+= 10; // ap references out of scope temp whose space
14925 // is reused with a. What is the value of ap->i?
14926 }
14927
14928 The lifetime of a compiler generated temporary is well defined by
14929 the C++ standard. When a lifetime of a temporary ends, and if the
14930 temporary lives in memory, the optimizing compiler has the freedom
14931 to reuse its stack space with other temporaries or scoped local
14932 variables whose live range does not overlap with it. However some
14933 of the legacy code relies on the behavior of older compilers in
14934 which temporaries' stack space is not reused, the aggressive stack
14935 reuse can lead to runtime errors. This option is used to control
14936 the temporary stack reuse optimization.
14937
14938 -ftrapv
14939 This option generates traps for signed overflow on addition,
14940 subtraction, multiplication operations. The options -ftrapv and
14941 -fwrapv override each other, so using -ftrapv -fwrapv on the
14942 command-line results in -fwrapv being effective. Note that only
14943 active options override, so using -ftrapv -fwrapv -fno-wrapv on the
14944 command-line results in -ftrapv being effective.
14945
14946 -fwrapv
14947 This option instructs the compiler to assume that signed arithmetic
14948 overflow of addition, subtraction and multiplication wraps around
14949 using twos-complement representation. This flag enables some
14950 optimizations and disables others. The options -ftrapv and -fwrapv
14951 override each other, so using -ftrapv -fwrapv on the command-line
14952 results in -fwrapv being effective. Note that only active options
14953 override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
14954 results in -ftrapv being effective.
14955
14956 -fwrapv-pointer
14957 This option instructs the compiler to assume that pointer
14958 arithmetic overflow on addition and subtraction wraps around using
14959 twos-complement representation. This flag disables some
14960 optimizations which assume pointer overflow is invalid.
14961
14962 -fstrict-overflow
14963 This option implies -fno-wrapv -fno-wrapv-pointer and when negated
14964 implies -fwrapv -fwrapv-pointer.
14965
14966 -fexceptions
14967 Enable exception handling. Generates extra code needed to
14968 propagate exceptions. For some targets, this implies GCC generates
14969 frame unwind information for all functions, which can produce
14970 significant data size overhead, although it does not affect
14971 execution. If you do not specify this option, GCC enables it by
14972 default for languages like C++ that normally require exception
14973 handling, and disables it for languages like C that do not normally
14974 require it. However, you may need to enable this option when
14975 compiling C code that needs to interoperate properly with exception
14976 handlers written in C++. You may also wish to disable this option
14977 if you are compiling older C++ programs that don't use exception
14978 handling.
14979
14980 -fnon-call-exceptions
14981 Generate code that allows trapping instructions to throw
14982 exceptions. Note that this requires platform-specific runtime
14983 support that does not exist everywhere. Moreover, it only allows
14984 trapping instructions to throw exceptions, i.e. memory references
14985 or floating-point instructions. It does not allow exceptions to be
14986 thrown from arbitrary signal handlers such as "SIGALRM". This
14987 enables -fexceptions.
14988
14989 -fdelete-dead-exceptions
14990 Consider that instructions that may throw exceptions but don't
14991 otherwise contribute to the execution of the program can be
14992 optimized away. This does not affect calls to functions except
14993 those with the "pure" or "const" attributes. This option is
14994 enabled by default for the Ada and C++ compilers, as permitted by
14995 the language specifications. Optimization passes that cause dead
14996 exceptions to be removed are enabled independently at different
14997 optimization levels.
14998
14999 -funwind-tables
15000 Similar to -fexceptions, except that it just generates any needed
15001 static data, but does not affect the generated code in any other
15002 way. You normally do not need to enable this option; instead, a
15003 language processor that needs this handling enables it on your
15004 behalf.
15005
15006 -fasynchronous-unwind-tables
15007 Generate unwind table in DWARF format, if supported by target
15008 machine. The table is exact at each instruction boundary, so it
15009 can be used for stack unwinding from asynchronous events (such as
15010 debugger or garbage collector).
15011
15012 -fno-gnu-unique
15013 On systems with recent GNU assembler and C library, the C++
15014 compiler uses the "STB_GNU_UNIQUE" binding to make sure that
15015 definitions of template static data members and static local
15016 variables in inline functions are unique even in the presence of
15017 "RTLD_LOCAL"; this is necessary to avoid problems with a library
15018 used by two different "RTLD_LOCAL" plugins depending on a
15019 definition in one of them and therefore disagreeing with the other
15020 one about the binding of the symbol. But this causes "dlclose" to
15021 be ignored for affected DSOs; if your program relies on
15022 reinitialization of a DSO via "dlclose" and "dlopen", you can use
15023 -fno-gnu-unique.
15024
15025 -fpcc-struct-return
15026 Return "short" "struct" and "union" values in memory like longer
15027 ones, rather than in registers. This convention is less efficient,
15028 but it has the advantage of allowing intercallability between GCC-
15029 compiled files and files compiled with other compilers,
15030 particularly the Portable C Compiler (pcc).
15031
15032 The precise convention for returning structures in memory depends
15033 on the target configuration macros.
15034
15035 Short structures and unions are those whose size and alignment
15036 match that of some integer type.
15037
15038 Warning: code compiled with the -fpcc-struct-return switch is not
15039 binary compatible with code compiled with the -freg-struct-return
15040 switch. Use it to conform to a non-default application binary
15041 interface.
15042
15043 -freg-struct-return
15044 Return "struct" and "union" values in registers when possible.
15045 This is more efficient for small structures than
15046 -fpcc-struct-return.
15047
15048 If you specify neither -fpcc-struct-return nor -freg-struct-return,
15049 GCC defaults to whichever convention is standard for the target.
15050 If there is no standard convention, GCC defaults to
15051 -fpcc-struct-return, except on targets where GCC is the principal
15052 compiler. In those cases, we can choose the standard, and we chose
15053 the more efficient register return alternative.
15054
15055 Warning: code compiled with the -freg-struct-return switch is not
15056 binary compatible with code compiled with the -fpcc-struct-return
15057 switch. Use it to conform to a non-default application binary
15058 interface.
15059
15060 -fshort-enums
15061 Allocate to an "enum" type only as many bytes as it needs for the
15062 declared range of possible values. Specifically, the "enum" type
15063 is equivalent to the smallest integer type that has enough room.
15064
15065 Warning: the -fshort-enums switch causes GCC to generate code that
15066 is not binary compatible with code generated without that switch.
15067 Use it to conform to a non-default application binary interface.
15068
15069 -fshort-wchar
15070 Override the underlying type for "wchar_t" to be "short unsigned
15071 int" instead of the default for the target. This option is useful
15072 for building programs to run under WINE.
15073
15074 Warning: the -fshort-wchar switch causes GCC to generate code that
15075 is not binary compatible with code generated without that switch.
15076 Use it to conform to a non-default application binary interface.
15077
15078 -fcommon
15079 In C code, this option controls the placement of global variables
15080 defined without an initializer, known as tentative definitions in
15081 the C standard. Tentative definitions are distinct from
15082 declarations of a variable with the "extern" keyword, which do not
15083 allocate storage.
15084
15085 The default is -fno-common, which specifies that the compiler
15086 places uninitialized global variables in the BSS section of the
15087 object file. This inhibits the merging of tentative definitions by
15088 the linker so you get a multiple-definition error if the same
15089 variable is accidentally defined in more than one compilation unit.
15090
15091 The -fcommon places uninitialized global variables in a common
15092 block. This allows the linker to resolve all tentative definitions
15093 of the same variable in different compilation units to the same
15094 object, or to a non-tentative definition. This behavior is
15095 inconsistent with C++, and on many targets implies a speed and code
15096 size penalty on global variable references. It is mainly useful to
15097 enable legacy code to link without errors.
15098
15099 -fno-ident
15100 Ignore the "#ident" directive.
15101
15102 -finhibit-size-directive
15103 Don't output a ".size" assembler directive, or anything else that
15104 would cause trouble if the function is split in the middle, and the
15105 two halves are placed at locations far apart in memory. This
15106 option is used when compiling crtstuff.c; you should not need to
15107 use it for anything else.
15108
15109 -fverbose-asm
15110 Put extra commentary information in the generated assembly code to
15111 make it more readable. This option is generally only of use to
15112 those who actually need to read the generated assembly code
15113 (perhaps while debugging the compiler itself).
15114
15115 -fno-verbose-asm, the default, causes the extra information to be
15116 omitted and is useful when comparing two assembler files.
15117
15118 The added comments include:
15119
15120 * information on the compiler version and command-line options,
15121
15122 * the source code lines associated with the assembly
15123 instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE,
15124
15125 * hints on which high-level expressions correspond to the various
15126 assembly instruction operands.
15127
15128 For example, given this C source file:
15129
15130 int test (int n)
15131 {
15132 int i;
15133 int total = 0;
15134
15135 for (i = 0; i < n; i++)
15136 total += i * i;
15137
15138 return total;
15139 }
15140
15141 compiling to (x86_64) assembly via -S and emitting the result
15142 direct to stdout via -o -
15143
15144 gcc -S test.c -fverbose-asm -Os -o -
15145
15146 gives output similar to this:
15147
15148 .file "test.c"
15149 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
15150 [...snip...]
15151 # options passed:
15152 [...snip...]
15153
15154 .text
15155 .globl test
15156 .type test, @function
15157 test:
15158 .LFB0:
15159 .cfi_startproc
15160 # test.c:4: int total = 0;
15161 xorl %eax, %eax # <retval>
15162 # test.c:6: for (i = 0; i < n; i++)
15163 xorl %edx, %edx # i
15164 .L2:
15165 # test.c:6: for (i = 0; i < n; i++)
15166 cmpl %edi, %edx # n, i
15167 jge .L5 #,
15168 # test.c:7: total += i * i;
15169 movl %edx, %ecx # i, tmp92
15170 imull %edx, %ecx # i, tmp92
15171 # test.c:6: for (i = 0; i < n; i++)
15172 incl %edx # i
15173 # test.c:7: total += i * i;
15174 addl %ecx, %eax # tmp92, <retval>
15175 jmp .L2 #
15176 .L5:
15177 # test.c:10: }
15178 ret
15179 .cfi_endproc
15180 .LFE0:
15181 .size test, .-test
15182 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
15183 .section .note.GNU-stack,"",@progbits
15184
15185 The comments are intended for humans rather than machines and hence
15186 the precise format of the comments is subject to change.
15187
15188 -frecord-gcc-switches
15189 This switch causes the command line used to invoke the compiler to
15190 be recorded into the object file that is being created. This
15191 switch is only implemented on some targets and the exact format of
15192 the recording is target and binary file format dependent, but it
15193 usually takes the form of a section containing ASCII text. This
15194 switch is related to the -fverbose-asm switch, but that switch only
15195 records information in the assembler output file as comments, so it
15196 never reaches the object file. See also -grecord-gcc-switches for
15197 another way of storing compiler options into the object file.
15198
15199 -fpic
15200 Generate position-independent code (PIC) suitable for use in a
15201 shared library, if supported for the target machine. Such code
15202 accesses all constant addresses through a global offset table
15203 (GOT). The dynamic loader resolves the GOT entries when the
15204 program starts (the dynamic loader is not part of GCC; it is part
15205 of the operating system). If the GOT size for the linked
15206 executable exceeds a machine-specific maximum size, you get an
15207 error message from the linker indicating that -fpic does not work;
15208 in that case, recompile with -fPIC instead. (These maximums are 8k
15209 on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The
15210 x86 has no such limit.)
15211
15212 Position-independent code requires special support, and therefore
15213 works only on certain machines. For the x86, GCC supports PIC for
15214 System V but not for the Sun 386i. Code generated for the IBM
15215 RS/6000 is always position-independent.
15216
15217 When this flag is set, the macros "__pic__" and "__PIC__" are
15218 defined to 1.
15219
15220 -fPIC
15221 If supported for the target machine, emit position-independent
15222 code, suitable for dynamic linking and avoiding any limit on the
15223 size of the global offset table. This option makes a difference on
15224 AArch64, m68k, PowerPC and SPARC.
15225
15226 Position-independent code requires special support, and therefore
15227 works only on certain machines.
15228
15229 When this flag is set, the macros "__pic__" and "__PIC__" are
15230 defined to 2.
15231
15232 -fpie
15233 -fPIE
15234 These options are similar to -fpic and -fPIC, but the generated
15235 position-independent code can be only linked into executables.
15236 Usually these options are used to compile code that will be linked
15237 using the -pie GCC option.
15238
15239 -fpie and -fPIE both define the macros "__pie__" and "__PIE__".
15240 The macros have the value 1 for -fpie and 2 for -fPIE.
15241
15242 -fno-plt
15243 Do not use the PLT for external function calls in position-
15244 independent code. Instead, load the callee address at call sites
15245 from the GOT and branch to it. This leads to more efficient code
15246 by eliminating PLT stubs and exposing GOT loads to optimizations.
15247 On architectures such as 32-bit x86 where PLT stubs expect the GOT
15248 pointer in a specific register, this gives more register allocation
15249 freedom to the compiler. Lazy binding requires use of the PLT;
15250 with -fno-plt all external symbols are resolved at load time.
15251
15252 Alternatively, the function attribute "noplt" can be used to avoid
15253 calls through the PLT for specific external functions.
15254
15255 In position-dependent code, a few targets also convert calls to
15256 functions that are marked to not use the PLT to use the GOT
15257 instead.
15258
15259 -fno-jump-tables
15260 Do not use jump tables for switch statements even where it would be
15261 more efficient than other code generation strategies. This option
15262 is of use in conjunction with -fpic or -fPIC for building code that
15263 forms part of a dynamic linker and cannot reference the address of
15264 a jump table. On some targets, jump tables do not require a GOT
15265 and this option is not needed.
15266
15267 -fno-bit-tests
15268 Do not use bit tests for switch statements even where it would be
15269 more efficient than other code generation strategies.
15270
15271 -ffixed-reg
15272 Treat the register named reg as a fixed register; generated code
15273 should never refer to it (except perhaps as a stack pointer, frame
15274 pointer or in some other fixed role).
15275
15276 reg must be the name of a register. The register names accepted
15277 are machine-specific and are defined in the "REGISTER_NAMES" macro
15278 in the machine description macro file.
15279
15280 This flag does not have a negative form, because it specifies a
15281 three-way choice.
15282
15283 -fcall-used-reg
15284 Treat the register named reg as an allocable register that is
15285 clobbered by function calls. It may be allocated for temporaries
15286 or variables that do not live across a call. Functions compiled
15287 this way do not save and restore the register reg.
15288
15289 It is an error to use this flag with the frame pointer or stack
15290 pointer. Use of this flag for other registers that have fixed
15291 pervasive roles in the machine's execution model produces
15292 disastrous results.
15293
15294 This flag does not have a negative form, because it specifies a
15295 three-way choice.
15296
15297 -fcall-saved-reg
15298 Treat the register named reg as an allocable register saved by
15299 functions. It may be allocated even for temporaries or variables
15300 that live across a call. Functions compiled this way save and
15301 restore the register reg if they use it.
15302
15303 It is an error to use this flag with the frame pointer or stack
15304 pointer. Use of this flag for other registers that have fixed
15305 pervasive roles in the machine's execution model produces
15306 disastrous results.
15307
15308 A different sort of disaster results from the use of this flag for
15309 a register in which function values may be returned.
15310
15311 This flag does not have a negative form, because it specifies a
15312 three-way choice.
15313
15314 -fpack-struct[=n]
15315 Without a value specified, pack all structure members together
15316 without holes. When a value is specified (which must be a small
15317 power of two), pack structure members according to this value,
15318 representing the maximum alignment (that is, objects with default
15319 alignment requirements larger than this are output potentially
15320 unaligned at the next fitting location.
15321
15322 Warning: the -fpack-struct switch causes GCC to generate code that
15323 is not binary compatible with code generated without that switch.
15324 Additionally, it makes the code suboptimal. Use it to conform to a
15325 non-default application binary interface.
15326
15327 -fleading-underscore
15328 This option and its counterpart, -fno-leading-underscore, forcibly
15329 change the way C symbols are represented in the object file. One
15330 use is to help link with legacy assembly code.
15331
15332 Warning: the -fleading-underscore switch causes GCC to generate
15333 code that is not binary compatible with code generated without that
15334 switch. Use it to conform to a non-default application binary
15335 interface. Not all targets provide complete support for this
15336 switch.
15337
15338 -ftls-model=model
15339 Alter the thread-local storage model to be used. The model
15340 argument should be one of global-dynamic, local-dynamic, initial-
15341 exec or local-exec. Note that the choice is subject to
15342 optimization: the compiler may use a more efficient model for
15343 symbols not visible outside of the translation unit, or if -fpic is
15344 not given on the command line.
15345
15346 The default without -fpic is initial-exec; with -fpic the default
15347 is global-dynamic.
15348
15349 -ftrampolines
15350 For targets that normally need trampolines for nested functions,
15351 always generate them instead of using descriptors. Otherwise, for
15352 targets that do not need them, like for example HP-PA or IA-64, do
15353 nothing.
15354
15355 A trampoline is a small piece of code that is created at run time
15356 on the stack when the address of a nested function is taken, and is
15357 used to call the nested function indirectly. Therefore, it
15358 requires the stack to be made executable in order for the program
15359 to work properly.
15360
15361 -fno-trampolines is enabled by default on a language by language
15362 basis to let the compiler avoid generating them, if it computes
15363 that this is safe, and replace them with descriptors. Descriptors
15364 are made up of data only, but the generated code must be prepared
15365 to deal with them. As of this writing, -fno-trampolines is enabled
15366 by default only for Ada.
15367
15368 Moreover, code compiled with -ftrampolines and code compiled with
15369 -fno-trampolines are not binary compatible if nested functions are
15370 present. This option must therefore be used on a program-wide
15371 basis and be manipulated with extreme care.
15372
15373 For languages other than Ada, the "-ftrampolines" and
15374 "-fno-trampolines" options currently have no effect, and
15375 trampolines are always generated on platforms that need them for
15376 nested functions.
15377
15378 -fvisibility=[default|internal|hidden|protected]
15379 Set the default ELF image symbol visibility to the specified
15380 option---all symbols are marked with this unless overridden within
15381 the code. Using this feature can very substantially improve
15382 linking and load times of shared object libraries, produce more
15383 optimized code, provide near-perfect API export and prevent symbol
15384 clashes. It is strongly recommended that you use this in any
15385 shared objects you distribute.
15386
15387 Despite the nomenclature, default always means public; i.e.,
15388 available to be linked against from outside the shared object.
15389 protected and internal are pretty useless in real-world usage so
15390 the only other commonly used option is hidden. The default if
15391 -fvisibility isn't specified is default, i.e., make every symbol
15392 public.
15393
15394 A good explanation of the benefits offered by ensuring ELF symbols
15395 have the correct visibility is given by "How To Write Shared
15396 Libraries" by Ulrich Drepper (which can be found at
15397 <https://www.akkadia.org/drepper/>)---however a superior solution
15398 made possible by this option to marking things hidden when the
15399 default is public is to make the default hidden and mark things
15400 public. This is the norm with DLLs on Windows and with
15401 -fvisibility=hidden and "__attribute__ ((visibility("default")))"
15402 instead of "__declspec(dllexport)" you get almost identical
15403 semantics with identical syntax. This is a great boon to those
15404 working with cross-platform projects.
15405
15406 For those adding visibility support to existing code, you may find
15407 "#pragma GCC visibility" of use. This works by you enclosing the
15408 declarations you wish to set visibility for with (for example)
15409 "#pragma GCC visibility push(hidden)" and "#pragma GCC visibility
15410 pop". Bear in mind that symbol visibility should be viewed as part
15411 of the API interface contract and thus all new code should always
15412 specify visibility when it is not the default; i.e., declarations
15413 only for use within the local DSO should always be marked
15414 explicitly as hidden as so to avoid PLT indirection
15415 overheads---making this abundantly clear also aids readability and
15416 self-documentation of the code. Note that due to ISO C++
15417 specification requirements, "operator new" and "operator delete"
15418 must always be of default visibility.
15419
15420 Be aware that headers from outside your project, in particular
15421 system headers and headers from any other library you use, may not
15422 be expecting to be compiled with visibility other than the default.
15423 You may need to explicitly say "#pragma GCC visibility
15424 push(default)" before including any such headers.
15425
15426 "extern" declarations are not affected by -fvisibility, so a lot of
15427 code can be recompiled with -fvisibility=hidden with no
15428 modifications. However, this means that calls to "extern"
15429 functions with no explicit visibility use the PLT, so it is more
15430 effective to use "__attribute ((visibility))" and/or "#pragma GCC
15431 visibility" to tell the compiler which "extern" declarations should
15432 be treated as hidden.
15433
15434 Note that -fvisibility does affect C++ vague linkage entities. This
15435 means that, for instance, an exception class that is be thrown
15436 between DSOs must be explicitly marked with default visibility so
15437 that the type_info nodes are unified between the DSOs.
15438
15439 An overview of these techniques, their benefits and how to use them
15440 is at <https://gcc.gnu.org/wiki/Visibility>.
15441
15442 -fstrict-volatile-bitfields
15443 This option should be used if accesses to volatile bit-fields (or
15444 other structure fields, although the compiler usually honors those
15445 types anyway) should use a single access of the width of the
15446 field's type, aligned to a natural alignment if possible. For
15447 example, targets with memory-mapped peripheral registers might
15448 require all such accesses to be 16 bits wide; with this flag you
15449 can declare all peripheral bit-fields as "unsigned short" (assuming
15450 short is 16 bits on these targets) to force GCC to use 16-bit
15451 accesses instead of, perhaps, a more efficient 32-bit access.
15452
15453 If this option is disabled, the compiler uses the most efficient
15454 instruction. In the previous example, that might be a 32-bit load
15455 instruction, even though that accesses bytes that do not contain
15456 any portion of the bit-field, or memory-mapped registers unrelated
15457 to the one being updated.
15458
15459 In some cases, such as when the "packed" attribute is applied to a
15460 structure field, it may not be possible to access the field with a
15461 single read or write that is correctly aligned for the target
15462 machine. In this case GCC falls back to generating multiple
15463 accesses rather than code that will fault or truncate the result at
15464 run time.
15465
15466 Note: Due to restrictions of the C/C++11 memory model, write
15467 accesses are not allowed to touch non bit-field members. It is
15468 therefore recommended to define all bits of the field's type as
15469 bit-field members.
15470
15471 The default value of this option is determined by the application
15472 binary interface for the target processor.
15473
15474 -fsync-libcalls
15475 This option controls whether any out-of-line instance of the
15476 "__sync" family of functions may be used to implement the C++11
15477 "__atomic" family of functions.
15478
15479 The default value of this option is enabled, thus the only useful
15480 form of the option is -fno-sync-libcalls. This option is used in
15481 the implementation of the libatomic runtime library.
15482
15483 GCC Developer Options
15484 This section describes command-line options that are primarily of
15485 interest to GCC developers, including options to support compiler
15486 testing and investigation of compiler bugs and compile-time performance
15487 problems. This includes options that produce debug dumps at various
15488 points in the compilation; that print statistics such as memory use and
15489 execution time; and that print information about GCC's configuration,
15490 such as where it searches for libraries. You should rarely need to use
15491 any of these options for ordinary compilation and linking tasks.
15492
15493 Many developer options that cause GCC to dump output to a file take an
15494 optional =filename suffix. You can specify stdout or - to dump to
15495 standard output, and stderr for standard error.
15496
15497 If =filename is omitted, a default dump file name is constructed by
15498 concatenating the base dump file name, a pass number, phase letter, and
15499 pass name. The base dump file name is the name of output file produced
15500 by the compiler if explicitly specified and not an executable;
15501 otherwise it is the source file name. The pass number is determined by
15502 the order passes are registered with the compiler's pass manager. This
15503 is generally the same as the order of execution, but passes registered
15504 by plugins, target-specific passes, or passes that are otherwise
15505 registered late are numbered higher than the pass named final, even if
15506 they are executed earlier. The phase letter is one of i (inter-
15507 procedural analysis), l (language-specific), r (RTL), or t (tree). The
15508 files are created in the directory of the output file.
15509
15510 -fcallgraph-info
15511 -fcallgraph-info=MARKERS
15512 Makes the compiler output callgraph information for the program, on
15513 a per-object-file basis. The information is generated in the
15514 common VCG format. It can be decorated with additional, per-node
15515 and/or per-edge information, if a list of comma-separated markers
15516 is additionally specified. When the "su" marker is specified, the
15517 callgraph is decorated with stack usage information; it is
15518 equivalent to -fstack-usage. When the "da" marker is specified,
15519 the callgraph is decorated with information about dynamically
15520 allocated objects.
15521
15522 When compiling with -flto, no callgraph information is output along
15523 with the object file. At LTO link time, -fcallgraph-info may
15524 generate multiple callgraph information files next to intermediate
15525 LTO output files.
15526
15527 -dletters
15528 -fdump-rtl-pass
15529 -fdump-rtl-pass=filename
15530 Says to make debugging dumps during compilation at times specified
15531 by letters. This is used for debugging the RTL-based passes of the
15532 compiler.
15533
15534 Some -dletters switches have different meaning when -E is used for
15535 preprocessing.
15536
15537 Debug dumps can be enabled with a -fdump-rtl switch or some -d
15538 option letters. Here are the possible letters for use in pass and
15539 letters, and their meanings:
15540
15541 -fdump-rtl-alignments
15542 Dump after branch alignments have been computed.
15543
15544 -fdump-rtl-asmcons
15545 Dump after fixing rtl statements that have unsatisfied in/out
15546 constraints.
15547
15548 -fdump-rtl-auto_inc_dec
15549 Dump after auto-inc-dec discovery. This pass is only run on
15550 architectures that have auto inc or auto dec instructions.
15551
15552 -fdump-rtl-barriers
15553 Dump after cleaning up the barrier instructions.
15554
15555 -fdump-rtl-bbpart
15556 Dump after partitioning hot and cold basic blocks.
15557
15558 -fdump-rtl-bbro
15559 Dump after block reordering.
15560
15561 -fdump-rtl-btl1
15562 -fdump-rtl-btl2
15563 -fdump-rtl-btl1 and -fdump-rtl-btl2 enable dumping after the
15564 two branch target load optimization passes.
15565
15566 -fdump-rtl-bypass
15567 Dump after jump bypassing and control flow optimizations.
15568
15569 -fdump-rtl-combine
15570 Dump after the RTL instruction combination pass.
15571
15572 -fdump-rtl-compgotos
15573 Dump after duplicating the computed gotos.
15574
15575 -fdump-rtl-ce1
15576 -fdump-rtl-ce2
15577 -fdump-rtl-ce3
15578 -fdump-rtl-ce1, -fdump-rtl-ce2, and -fdump-rtl-ce3 enable
15579 dumping after the three if conversion passes.
15580
15581 -fdump-rtl-cprop_hardreg
15582 Dump after hard register copy propagation.
15583
15584 -fdump-rtl-csa
15585 Dump after combining stack adjustments.
15586
15587 -fdump-rtl-cse1
15588 -fdump-rtl-cse2
15589 -fdump-rtl-cse1 and -fdump-rtl-cse2 enable dumping after the
15590 two common subexpression elimination passes.
15591
15592 -fdump-rtl-dce
15593 Dump after the standalone dead code elimination passes.
15594
15595 -fdump-rtl-dbr
15596 Dump after delayed branch scheduling.
15597
15598 -fdump-rtl-dce1
15599 -fdump-rtl-dce2
15600 -fdump-rtl-dce1 and -fdump-rtl-dce2 enable dumping after the
15601 two dead store elimination passes.
15602
15603 -fdump-rtl-eh
15604 Dump after finalization of EH handling code.
15605
15606 -fdump-rtl-eh_ranges
15607 Dump after conversion of EH handling range regions.
15608
15609 -fdump-rtl-expand
15610 Dump after RTL generation.
15611
15612 -fdump-rtl-fwprop1
15613 -fdump-rtl-fwprop2
15614 -fdump-rtl-fwprop1 and -fdump-rtl-fwprop2 enable dumping after
15615 the two forward propagation passes.
15616
15617 -fdump-rtl-gcse1
15618 -fdump-rtl-gcse2
15619 -fdump-rtl-gcse1 and -fdump-rtl-gcse2 enable dumping after
15620 global common subexpression elimination.
15621
15622 -fdump-rtl-init-regs
15623 Dump after the initialization of the registers.
15624
15625 -fdump-rtl-initvals
15626 Dump after the computation of the initial value sets.
15627
15628 -fdump-rtl-into_cfglayout
15629 Dump after converting to cfglayout mode.
15630
15631 -fdump-rtl-ira
15632 Dump after iterated register allocation.
15633
15634 -fdump-rtl-jump
15635 Dump after the second jump optimization.
15636
15637 -fdump-rtl-loop2
15638 -fdump-rtl-loop2 enables dumping after the rtl loop
15639 optimization passes.
15640
15641 -fdump-rtl-mach
15642 Dump after performing the machine dependent reorganization
15643 pass, if that pass exists.
15644
15645 -fdump-rtl-mode_sw
15646 Dump after removing redundant mode switches.
15647
15648 -fdump-rtl-rnreg
15649 Dump after register renumbering.
15650
15651 -fdump-rtl-outof_cfglayout
15652 Dump after converting from cfglayout mode.
15653
15654 -fdump-rtl-peephole2
15655 Dump after the peephole pass.
15656
15657 -fdump-rtl-postreload
15658 Dump after post-reload optimizations.
15659
15660 -fdump-rtl-pro_and_epilogue
15661 Dump after generating the function prologues and epilogues.
15662
15663 -fdump-rtl-sched1
15664 -fdump-rtl-sched2
15665 -fdump-rtl-sched1 and -fdump-rtl-sched2 enable dumping after
15666 the basic block scheduling passes.
15667
15668 -fdump-rtl-ree
15669 Dump after sign/zero extension elimination.
15670
15671 -fdump-rtl-seqabstr
15672 Dump after common sequence discovery.
15673
15674 -fdump-rtl-shorten
15675 Dump after shortening branches.
15676
15677 -fdump-rtl-sibling
15678 Dump after sibling call optimizations.
15679
15680 -fdump-rtl-split1
15681 -fdump-rtl-split2
15682 -fdump-rtl-split3
15683 -fdump-rtl-split4
15684 -fdump-rtl-split5
15685 These options enable dumping after five rounds of instruction
15686 splitting.
15687
15688 -fdump-rtl-sms
15689 Dump after modulo scheduling. This pass is only run on some
15690 architectures.
15691
15692 -fdump-rtl-stack
15693 Dump after conversion from GCC's "flat register file" registers
15694 to the x87's stack-like registers. This pass is only run on
15695 x86 variants.
15696
15697 -fdump-rtl-subreg1
15698 -fdump-rtl-subreg2
15699 -fdump-rtl-subreg1 and -fdump-rtl-subreg2 enable dumping after
15700 the two subreg expansion passes.
15701
15702 -fdump-rtl-unshare
15703 Dump after all rtl has been unshared.
15704
15705 -fdump-rtl-vartrack
15706 Dump after variable tracking.
15707
15708 -fdump-rtl-vregs
15709 Dump after converting virtual registers to hard registers.
15710
15711 -fdump-rtl-web
15712 Dump after live range splitting.
15713
15714 -fdump-rtl-regclass
15715 -fdump-rtl-subregs_of_mode_init
15716 -fdump-rtl-subregs_of_mode_finish
15717 -fdump-rtl-dfinit
15718 -fdump-rtl-dfinish
15719 These dumps are defined but always produce empty files.
15720
15721 -da
15722 -fdump-rtl-all
15723 Produce all the dumps listed above.
15724
15725 -dA Annotate the assembler output with miscellaneous debugging
15726 information.
15727
15728 -dD Dump all macro definitions, at the end of preprocessing, in
15729 addition to normal output.
15730
15731 -dH Produce a core dump whenever an error occurs.
15732
15733 -dp Annotate the assembler output with a comment indicating which
15734 pattern and alternative is used. The length and cost of each
15735 instruction are also printed.
15736
15737 -dP Dump the RTL in the assembler output as a comment before each
15738 instruction. Also turns on -dp annotation.
15739
15740 -dx Just generate RTL for a function instead of compiling it.
15741 Usually used with -fdump-rtl-expand.
15742
15743 -fdump-debug
15744 Dump debugging information generated during the debug generation
15745 phase.
15746
15747 -fdump-earlydebug
15748 Dump debugging information generated during the early debug
15749 generation phase.
15750
15751 -fdump-noaddr
15752 When doing debugging dumps, suppress address output. This makes it
15753 more feasible to use diff on debugging dumps for compiler
15754 invocations with different compiler binaries and/or different text
15755 / bss / data / heap / stack / dso start locations.
15756
15757 -freport-bug
15758 Collect and dump debug information into a temporary file if an
15759 internal compiler error (ICE) occurs.
15760
15761 -fdump-unnumbered
15762 When doing debugging dumps, suppress instruction numbers and
15763 address output. This makes it more feasible to use diff on
15764 debugging dumps for compiler invocations with different options, in
15765 particular with and without -g.
15766
15767 -fdump-unnumbered-links
15768 When doing debugging dumps (see -d option above), suppress
15769 instruction numbers for the links to the previous and next
15770 instructions in a sequence.
15771
15772 -fdump-ipa-switch
15773 -fdump-ipa-switch-options
15774 Control the dumping at various stages of inter-procedural analysis
15775 language tree to a file. The file name is generated by appending a
15776 switch specific suffix to the source file name, and the file is
15777 created in the same directory as the output file. The following
15778 dumps are possible:
15779
15780 all Enables all inter-procedural analysis dumps.
15781
15782 cgraph
15783 Dumps information about call-graph optimization, unused
15784 function removal, and inlining decisions.
15785
15786 inline
15787 Dump after function inlining.
15788
15789 Additionally, the options -optimized, -missed, -note, and -all can
15790 be provided, with the same meaning as for -fopt-info, defaulting to
15791 -optimized.
15792
15793 For example, -fdump-ipa-inline-optimized-missed will emit
15794 information on callsites that were inlined, along with callsites
15795 that were not inlined.
15796
15797 By default, the dump will contain messages about successful
15798 optimizations (equivalent to -optimized) together with low-level
15799 details about the analysis.
15800
15801 -fdump-lang
15802 Dump language-specific information. The file name is made by
15803 appending .lang to the source file name.
15804
15805 -fdump-lang-all
15806 -fdump-lang-switch
15807 -fdump-lang-switch-options
15808 -fdump-lang-switch-options=filename
15809 Control the dumping of language-specific information. The options
15810 and filename portions behave as described in the -fdump-tree
15811 option. The following switch values are accepted:
15812
15813 all Enable all language-specific dumps.
15814
15815 class
15816 Dump class hierarchy information. Virtual table information is
15817 emitted unless 'slim' is specified. This option is applicable
15818 to C++ only.
15819
15820 module
15821 Dump module information. Options lineno (locations), graph
15822 (reachability), blocks (clusters), uid (serialization), alias
15823 (mergeable), asmname (Elrond), eh (mapper) & vops (macros) may
15824 provide additional information. This option is applicable to
15825 C++ only.
15826
15827 raw Dump the raw internal tree data. This option is applicable to
15828 C++ only.
15829
15830 -fdump-passes
15831 Print on stderr the list of optimization passes that are turned on
15832 and off by the current command-line options.
15833
15834 -fdump-statistics-option
15835 Enable and control dumping of pass statistics in a separate file.
15836 The file name is generated by appending a suffix ending in
15837 .statistics to the source file name, and the file is created in the
15838 same directory as the output file. If the -option form is used,
15839 -stats causes counters to be summed over the whole compilation unit
15840 while -details dumps every event as the passes generate them. The
15841 default with no option is to sum counters for each function
15842 compiled.
15843
15844 -fdump-tree-all
15845 -fdump-tree-switch
15846 -fdump-tree-switch-options
15847 -fdump-tree-switch-options=filename
15848 Control the dumping at various stages of processing the
15849 intermediate language tree to a file. If the -options form is
15850 used, options is a list of - separated options which control the
15851 details of the dump. Not all options are applicable to all dumps;
15852 those that are not meaningful are ignored. The following options
15853 are available
15854
15855 address
15856 Print the address of each node. Usually this is not meaningful
15857 as it changes according to the environment and source file.
15858 Its primary use is for tying up a dump file with a debug
15859 environment.
15860
15861 asmname
15862 If "DECL_ASSEMBLER_NAME" has been set for a given decl, use
15863 that in the dump instead of "DECL_NAME". Its primary use is
15864 ease of use working backward from mangled names in the assembly
15865 file.
15866
15867 slim
15868 When dumping front-end intermediate representations, inhibit
15869 dumping of members of a scope or body of a function merely
15870 because that scope has been reached. Only dump such items when
15871 they are directly reachable by some other path.
15872
15873 When dumping pretty-printed trees, this option inhibits dumping
15874 the bodies of control structures.
15875
15876 When dumping RTL, print the RTL in slim (condensed) form
15877 instead of the default LISP-like representation.
15878
15879 raw Print a raw representation of the tree. By default, trees are
15880 pretty-printed into a C-like representation.
15881
15882 details
15883 Enable more detailed dumps (not honored by every dump option).
15884 Also include information from the optimization passes.
15885
15886 stats
15887 Enable dumping various statistics about the pass (not honored
15888 by every dump option).
15889
15890 blocks
15891 Enable showing basic block boundaries (disabled in raw dumps).
15892
15893 graph
15894 For each of the other indicated dump files (-fdump-rtl-pass),
15895 dump a representation of the control flow graph suitable for
15896 viewing with GraphViz to file.passid.pass.dot. Each function
15897 in the file is pretty-printed as a subgraph, so that GraphViz
15898 can render them all in a single plot.
15899
15900 This option currently only works for RTL dumps, and the RTL is
15901 always dumped in slim form.
15902
15903 vops
15904 Enable showing virtual operands for every statement.
15905
15906 lineno
15907 Enable showing line numbers for statements.
15908
15909 uid Enable showing the unique ID ("DECL_UID") for each variable.
15910
15911 verbose
15912 Enable showing the tree dump for each statement.
15913
15914 eh Enable showing the EH region number holding each statement.
15915
15916 scev
15917 Enable showing scalar evolution analysis details.
15918
15919 optimized
15920 Enable showing optimization information (only available in
15921 certain passes).
15922
15923 missed
15924 Enable showing missed optimization information (only available
15925 in certain passes).
15926
15927 note
15928 Enable other detailed optimization information (only available
15929 in certain passes).
15930
15931 all Turn on all options, except raw, slim, verbose and lineno.
15932
15933 optall
15934 Turn on all optimization options, i.e., optimized, missed, and
15935 note.
15936
15937 To determine what tree dumps are available or find the dump for a
15938 pass of interest follow the steps below.
15939
15940 1. Invoke GCC with -fdump-passes and in the stderr output look for
15941 a code that corresponds to the pass you are interested in. For
15942 example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2"
15943 correspond to the three Value Range Propagation passes. The
15944 number at the end distinguishes distinct invocations of the
15945 same pass.
15946
15947 2. To enable the creation of the dump file, append the pass code
15948 to the -fdump- option prefix and invoke GCC with it. For
15949 example, to enable the dump from the Early Value Range
15950 Propagation pass, invoke GCC with the -fdump-tree-evrp option.
15951 Optionally, you may specify the name of the dump file. If you
15952 don't specify one, GCC creates as described below.
15953
15954 3. Find the pass dump in a file whose name is composed of three
15955 components separated by a period: the name of the source file
15956 GCC was invoked to compile, a numeric suffix indicating the
15957 pass number followed by the letter t for tree passes (and the
15958 letter r for RTL passes), and finally the pass code. For
15959 example, the Early VRP pass dump might be in a file named
15960 myfile.c.038t.evrp in the current working directory. Note that
15961 the numeric codes are not stable and may change from one
15962 version of GCC to another.
15963
15964 -fopt-info
15965 -fopt-info-options
15966 -fopt-info-options=filename
15967 Controls optimization dumps from various optimization passes. If
15968 the -options form is used, options is a list of - separated option
15969 keywords to select the dump details and optimizations.
15970
15971 The options can be divided into three groups:
15972
15973 1. options describing what kinds of messages should be emitted,
15974
15975 2. options describing the verbosity of the dump, and
15976
15977 3. options describing which optimizations should be included.
15978
15979 The options from each group can be freely mixed as they are non-
15980 overlapping. However, in case of any conflicts, the later options
15981 override the earlier options on the command line.
15982
15983 The following options control which kinds of messages should be
15984 emitted:
15985
15986 optimized
15987 Print information when an optimization is successfully applied.
15988 It is up to a pass to decide which information is relevant. For
15989 example, the vectorizer passes print the source location of
15990 loops which are successfully vectorized.
15991
15992 missed
15993 Print information about missed optimizations. Individual passes
15994 control which information to include in the output.
15995
15996 note
15997 Print verbose information about optimizations, such as certain
15998 transformations, more detailed messages about decisions etc.
15999
16000 all Print detailed optimization information. This includes
16001 optimized, missed, and note.
16002
16003 The following option controls the dump verbosity:
16004
16005 internals
16006 By default, only "high-level" messages are emitted. This option
16007 enables additional, more detailed, messages, which are likely
16008 to only be of interest to GCC developers.
16009
16010 One or more of the following option keywords can be used to
16011 describe a group of optimizations:
16012
16013 ipa Enable dumps from all interprocedural optimizations.
16014
16015 loop
16016 Enable dumps from all loop optimizations.
16017
16018 inline
16019 Enable dumps from all inlining optimizations.
16020
16021 omp Enable dumps from all OMP (Offloading and Multi Processing)
16022 optimizations.
16023
16024 vec Enable dumps from all vectorization optimizations.
16025
16026 optall
16027 Enable dumps from all optimizations. This is a superset of the
16028 optimization groups listed above.
16029
16030 If options is omitted, it defaults to optimized-optall, which means
16031 to dump messages about successful optimizations from all the
16032 passes, omitting messages that are treated as "internals".
16033
16034 If the filename is provided, then the dumps from all the applicable
16035 optimizations are concatenated into the filename. Otherwise the
16036 dump is output onto stderr. Though multiple -fopt-info options are
16037 accepted, only one of them can include a filename. If other
16038 filenames are provided then all but the first such option are
16039 ignored.
16040
16041 Note that the output filename is overwritten in case of multiple
16042 translation units. If a combined output from multiple translation
16043 units is desired, stderr should be used instead.
16044
16045 In the following example, the optimization info is output to
16046 stderr:
16047
16048 gcc -O3 -fopt-info
16049
16050 This example:
16051
16052 gcc -O3 -fopt-info-missed=missed.all
16053
16054 outputs missed optimization report from all the passes into
16055 missed.all, and this one:
16056
16057 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
16058
16059 prints information about missed optimization opportunities from
16060 vectorization passes on stderr. Note that -fopt-info-vec-missed is
16061 equivalent to -fopt-info-missed-vec. The order of the optimization
16062 group names and message types listed after -fopt-info does not
16063 matter.
16064
16065 As another example,
16066
16067 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
16068
16069 outputs information about missed optimizations as well as optimized
16070 locations from all the inlining passes into inline.txt.
16071
16072 Finally, consider:
16073
16074 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
16075
16076 Here the two output filenames vec.miss and loop.opt are in conflict
16077 since only one output file is allowed. In this case, only the first
16078 option takes effect and the subsequent options are ignored. Thus
16079 only vec.miss is produced which contains dumps from the vectorizer
16080 about missed opportunities.
16081
16082 -fsave-optimization-record
16083 Write a SRCFILE.opt-record.json.gz file detailing what
16084 optimizations were performed, for those optimizations that support
16085 -fopt-info.
16086
16087 This option is experimental and the format of the data within the
16088 compressed JSON file is subject to change.
16089
16090 It is roughly equivalent to a machine-readable version of
16091 -fopt-info-all, as a collection of messages with source file, line
16092 number and column number, with the following additional data for
16093 each message:
16094
16095 * the execution count of the code being optimized, along with
16096 metadata about whether this was from actual profile data, or
16097 just an estimate, allowing consumers to prioritize messages by
16098 code hotness,
16099
16100 * the function name of the code being optimized, where
16101 applicable,
16102
16103 * the "inlining chain" for the code being optimized, so that when
16104 a function is inlined into several different places (which
16105 might themselves be inlined), the reader can distinguish
16106 between the copies,
16107
16108 * objects identifying those parts of the message that refer to
16109 expressions, statements or symbol-table nodes, which of these
16110 categories they are, and, when available, their source code
16111 location,
16112
16113 * the GCC pass that emitted the message, and
16114
16115 * the location in GCC's own code from which the message was
16116 emitted
16117
16118 Additionally, some messages are logically nested within other
16119 messages, reflecting implementation details of the optimization
16120 passes.
16121
16122 -fsched-verbose=n
16123 On targets that use instruction scheduling, this option controls
16124 the amount of debugging output the scheduler prints to the dump
16125 files.
16126
16127 For n greater than zero, -fsched-verbose outputs the same
16128 information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n
16129 greater than one, it also output basic block probabilities,
16130 detailed ready list information and unit/insn info. For n greater
16131 than two, it includes RTL at abort point, control-flow and regions
16132 info. And for n over four, -fsched-verbose also includes
16133 dependence info.
16134
16135 -fenable-kind-pass
16136 -fdisable-kind-pass=range-list
16137 This is a set of options that are used to explicitly disable/enable
16138 optimization passes. These options are intended for use for
16139 debugging GCC. Compiler users should use regular options for
16140 enabling/disabling passes instead.
16141
16142 -fdisable-ipa-pass
16143 Disable IPA pass pass. pass is the pass name. If the same pass
16144 is statically invoked in the compiler multiple times, the pass
16145 name should be appended with a sequential number starting from
16146 1.
16147
16148 -fdisable-rtl-pass
16149 -fdisable-rtl-pass=range-list
16150 Disable RTL pass pass. pass is the pass name. If the same
16151 pass is statically invoked in the compiler multiple times, the
16152 pass name should be appended with a sequential number starting
16153 from 1. range-list is a comma-separated list of function
16154 ranges or assembler names. Each range is a number pair
16155 separated by a colon. The range is inclusive in both ends. If
16156 the range is trivial, the number pair can be simplified as a
16157 single number. If the function's call graph node's uid falls
16158 within one of the specified ranges, the pass is disabled for
16159 that function. The uid is shown in the function header of a
16160 dump file, and the pass names can be dumped by using option
16161 -fdump-passes.
16162
16163 -fdisable-tree-pass
16164 -fdisable-tree-pass=range-list
16165 Disable tree pass pass. See -fdisable-rtl for the description
16166 of option arguments.
16167
16168 -fenable-ipa-pass
16169 Enable IPA pass pass. pass is the pass name. If the same pass
16170 is statically invoked in the compiler multiple times, the pass
16171 name should be appended with a sequential number starting from
16172 1.
16173
16174 -fenable-rtl-pass
16175 -fenable-rtl-pass=range-list
16176 Enable RTL pass pass. See -fdisable-rtl for option argument
16177 description and examples.
16178
16179 -fenable-tree-pass
16180 -fenable-tree-pass=range-list
16181 Enable tree pass pass. See -fdisable-rtl for the description
16182 of option arguments.
16183
16184 Here are some examples showing uses of these options.
16185
16186 # disable ccp1 for all functions
16187 -fdisable-tree-ccp1
16188 # disable complete unroll for function whose cgraph node uid is 1
16189 -fenable-tree-cunroll=1
16190 # disable gcse2 for functions at the following ranges [1,1],
16191 # [300,400], and [400,1000]
16192 # disable gcse2 for functions foo and foo2
16193 -fdisable-rtl-gcse2=foo,foo2
16194 # disable early inlining
16195 -fdisable-tree-einline
16196 # disable ipa inlining
16197 -fdisable-ipa-inline
16198 # enable tree full unroll
16199 -fenable-tree-unroll
16200
16201 -fchecking
16202 -fchecking=n
16203 Enable internal consistency checking. The default depends on the
16204 compiler configuration. -fchecking=2 enables further internal
16205 consistency checking that might affect code generation.
16206
16207 -frandom-seed=string
16208 This option provides a seed that GCC uses in place of random
16209 numbers in generating certain symbol names that have to be
16210 different in every compiled file. It is also used to place unique
16211 stamps in coverage data files and the object files that produce
16212 them. You can use the -frandom-seed option to produce reproducibly
16213 identical object files.
16214
16215 The string can either be a number (decimal, octal or hex) or an
16216 arbitrary string (in which case it's converted to a number by
16217 computing CRC32).
16218
16219 The string should be different for every file you compile.
16220
16221 -save-temps
16222 Store the usual "temporary" intermediate files permanently; name
16223 them as auxiliary output files, as specified described under
16224 -dumpbase and -dumpdir.
16225
16226 When used in combination with the -x command-line option,
16227 -save-temps is sensible enough to avoid overwriting an input source
16228 file with the same extension as an intermediate file. The
16229 corresponding intermediate file may be obtained by renaming the
16230 source file before using -save-temps.
16231
16232 -save-temps=cwd
16233 Equivalent to -save-temps -dumpdir ./.
16234
16235 -save-temps=obj
16236 Equivalent to -save-temps -dumpdir outdir/, where outdir/ is the
16237 directory of the output file specified after the -o option,
16238 including any directory separators. If the -o option is not used,
16239 the -save-temps=obj switch behaves like -save-temps=cwd.
16240
16241 -time[=file]
16242 Report the CPU time taken by each subprocess in the compilation
16243 sequence. For C source files, this is the compiler proper and
16244 assembler (plus the linker if linking is done).
16245
16246 Without the specification of an output file, the output looks like
16247 this:
16248
16249 # cc1 0.12 0.01
16250 # as 0.00 0.01
16251
16252 The first number on each line is the "user time", that is time
16253 spent executing the program itself. The second number is "system
16254 time", time spent executing operating system routines on behalf of
16255 the program. Both numbers are in seconds.
16256
16257 With the specification of an output file, the output is appended to
16258 the named file, and it looks like this:
16259
16260 0.12 0.01 cc1 <options>
16261 0.00 0.01 as <options>
16262
16263 The "user time" and the "system time" are moved before the program
16264 name, and the options passed to the program are displayed, so that
16265 one can later tell what file was being compiled, and with which
16266 options.
16267
16268 -fdump-final-insns[=file]
16269 Dump the final internal representation (RTL) to file. If the
16270 optional argument is omitted (or if file is "."), the name of the
16271 dump file is determined by appending ".gkd" to the dump base name,
16272 see -dumpbase.
16273
16274 -fcompare-debug[=opts]
16275 If no error occurs during compilation, run the compiler a second
16276 time, adding opts and -fcompare-debug-second to the arguments
16277 passed to the second compilation. Dump the final internal
16278 representation in both compilations, and print an error if they
16279 differ.
16280
16281 If the equal sign is omitted, the default -gtoggle is used.
16282
16283 The environment variable GCC_COMPARE_DEBUG, if defined, non-empty
16284 and nonzero, implicitly enables -fcompare-debug. If
16285 GCC_COMPARE_DEBUG is defined to a string starting with a dash, then
16286 it is used for opts, otherwise the default -gtoggle is used.
16287
16288 -fcompare-debug=, with the equal sign but without opts, is
16289 equivalent to -fno-compare-debug, which disables the dumping of the
16290 final representation and the second compilation, preventing even
16291 GCC_COMPARE_DEBUG from taking effect.
16292
16293 To verify full coverage during -fcompare-debug testing, set
16294 GCC_COMPARE_DEBUG to say -fcompare-debug-not-overridden, which GCC
16295 rejects as an invalid option in any actual compilation (rather than
16296 preprocessing, assembly or linking). To get just a warning,
16297 setting GCC_COMPARE_DEBUG to -w%n-fcompare-debug not overridden
16298 will do.
16299
16300 -fcompare-debug-second
16301 This option is implicitly passed to the compiler for the second
16302 compilation requested by -fcompare-debug, along with options to
16303 silence warnings, and omitting other options that would cause the
16304 compiler to produce output to files or to standard output as a side
16305 effect. Dump files and preserved temporary files are renamed so as
16306 to contain the ".gk" additional extension during the second
16307 compilation, to avoid overwriting those generated by the first.
16308
16309 When this option is passed to the compiler driver, it causes the
16310 first compilation to be skipped, which makes it useful for little
16311 other than debugging the compiler proper.
16312
16313 -gtoggle
16314 Turn off generation of debug info, if leaving out this option
16315 generates it, or turn it on at level 2 otherwise. The position of
16316 this argument in the command line does not matter; it takes effect
16317 after all other options are processed, and it does so only once, no
16318 matter how many times it is given. This is mainly intended to be
16319 used with -fcompare-debug.
16320
16321 -fvar-tracking-assignments-toggle
16322 Toggle -fvar-tracking-assignments, in the same way that -gtoggle
16323 toggles -g.
16324
16325 -Q Makes the compiler print out each function name as it is compiled,
16326 and print some statistics about each pass when it finishes.
16327
16328 -ftime-report
16329 Makes the compiler print some statistics about the time consumed by
16330 each pass when it finishes.
16331
16332 -ftime-report-details
16333 Record the time consumed by infrastructure parts separately for
16334 each pass.
16335
16336 -fira-verbose=n
16337 Control the verbosity of the dump file for the integrated register
16338 allocator. The default value is 5. If the value n is greater or
16339 equal to 10, the dump output is sent to stderr using the same
16340 format as n minus 10.
16341
16342 -flto-report
16343 Prints a report with internal details on the workings of the link-
16344 time optimizer. The contents of this report vary from version to
16345 version. It is meant to be useful to GCC developers when
16346 processing object files in LTO mode (via -flto).
16347
16348 Disabled by default.
16349
16350 -flto-report-wpa
16351 Like -flto-report, but only print for the WPA phase of link-time
16352 optimization.
16353
16354 -fmem-report
16355 Makes the compiler print some statistics about permanent memory
16356 allocation when it finishes.
16357
16358 -fmem-report-wpa
16359 Makes the compiler print some statistics about permanent memory
16360 allocation for the WPA phase only.
16361
16362 -fpre-ipa-mem-report
16363 -fpost-ipa-mem-report
16364 Makes the compiler print some statistics about permanent memory
16365 allocation before or after interprocedural optimization.
16366
16367 -fprofile-report
16368 Makes the compiler print some statistics about consistency of the
16369 (estimated) profile and effect of individual passes.
16370
16371 -fstack-usage
16372 Makes the compiler output stack usage information for the program,
16373 on a per-function basis. The filename for the dump is made by
16374 appending .su to the auxname. auxname is generated from the name
16375 of the output file, if explicitly specified and it is not an
16376 executable, otherwise it is the basename of the source file. An
16377 entry is made up of three fields:
16378
16379 * The name of the function.
16380
16381 * A number of bytes.
16382
16383 * One or more qualifiers: "static", "dynamic", "bounded".
16384
16385 The qualifier "static" means that the function manipulates the
16386 stack statically: a fixed number of bytes are allocated for the
16387 frame on function entry and released on function exit; no stack
16388 adjustments are otherwise made in the function. The second field
16389 is this fixed number of bytes.
16390
16391 The qualifier "dynamic" means that the function manipulates the
16392 stack dynamically: in addition to the static allocation described
16393 above, stack adjustments are made in the body of the function, for
16394 example to push/pop arguments around function calls. If the
16395 qualifier "bounded" is also present, the amount of these
16396 adjustments is bounded at compile time and the second field is an
16397 upper bound of the total amount of stack used by the function. If
16398 it is not present, the amount of these adjustments is not bounded
16399 at compile time and the second field only represents the bounded
16400 part.
16401
16402 -fstats
16403 Emit statistics about front-end processing at the end of the
16404 compilation. This option is supported only by the C++ front end,
16405 and the information is generally only useful to the G++ development
16406 team.
16407
16408 -fdbg-cnt-list
16409 Print the name and the counter upper bound for all debug counters.
16410
16411 -fdbg-cnt=counter-value-list
16412 Set the internal debug counter lower and upper bound. counter-
16413 value-list is a comma-separated list of
16414 name:lower_bound1-upper_bound1 [:lower_bound2-upper_bound2...]
16415 tuples which sets the name of the counter and list of closed
16416 intervals. The lower_bound is optional and is zero initialized if
16417 not set. For example, with -fdbg-cnt=dce:2-4:10-11,tail_call:10,
16418 "dbg_cnt(dce)" returns true only for second, third, fourth, tenth
16419 and eleventh invocation. For "dbg_cnt(tail_call)" true is returned
16420 for first 10 invocations.
16421
16422 -print-file-name=library
16423 Print the full absolute name of the library file library that would
16424 be used when linking---and don't do anything else. With this
16425 option, GCC does not compile or link anything; it just prints the
16426 file name.
16427
16428 -print-multi-directory
16429 Print the directory name corresponding to the multilib selected by
16430 any other switches present in the command line. This directory is
16431 supposed to exist in GCC_EXEC_PREFIX.
16432
16433 -print-multi-lib
16434 Print the mapping from multilib directory names to compiler
16435 switches that enable them. The directory name is separated from
16436 the switches by ;, and each switch starts with an @ instead of the
16437 -, without spaces between multiple switches. This is supposed to
16438 ease shell processing.
16439
16440 -print-multi-os-directory
16441 Print the path to OS libraries for the selected multilib, relative
16442 to some lib subdirectory. If OS libraries are present in the lib
16443 subdirectory and no multilibs are used, this is usually just ., if
16444 OS libraries are present in libsuffix sibling directories this
16445 prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are
16446 present in lib/subdir subdirectories it prints e.g. amd64, sparcv9
16447 or ev6.
16448
16449 -print-multiarch
16450 Print the path to OS libraries for the selected multiarch, relative
16451 to some lib subdirectory.
16452
16453 -print-prog-name=program
16454 Like -print-file-name, but searches for a program such as cpp.
16455
16456 -print-libgcc-file-name
16457 Same as -print-file-name=libgcc.a.
16458
16459 This is useful when you use -nostdlib or -nodefaultlibs but you do
16460 want to link with libgcc.a. You can do:
16461
16462 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
16463
16464 -print-search-dirs
16465 Print the name of the configured installation directory and a list
16466 of program and library directories gcc searches---and don't do
16467 anything else.
16468
16469 This is useful when gcc prints the error message installation
16470 problem, cannot exec cpp0: No such file or directory. To resolve
16471 this you either need to put cpp0 and the other compiler components
16472 where gcc expects to find them, or you can set the environment
16473 variable GCC_EXEC_PREFIX to the directory where you installed them.
16474 Don't forget the trailing /.
16475
16476 -print-sysroot
16477 Print the target sysroot directory that is used during compilation.
16478 This is the target sysroot specified either at configure time or
16479 using the --sysroot option, possibly with an extra suffix that
16480 depends on compilation options. If no target sysroot is specified,
16481 the option prints nothing.
16482
16483 -print-sysroot-headers-suffix
16484 Print the suffix added to the target sysroot when searching for
16485 headers, or give an error if the compiler is not configured with
16486 such a suffix---and don't do anything else.
16487
16488 -dumpmachine
16489 Print the compiler's target machine (for example,
16490 i686-pc-linux-gnu)---and don't do anything else.
16491
16492 -dumpversion
16493 Print the compiler version (for example, 3.0, 6.3.0 or 7)---and
16494 don't do anything else. This is the compiler version used in
16495 filesystem paths and specs. Depending on how the compiler has been
16496 configured it can be just a single number (major version), two
16497 numbers separated by a dot (major and minor version) or three
16498 numbers separated by dots (major, minor and patchlevel version).
16499
16500 -dumpfullversion
16501 Print the full compiler version---and don't do anything else. The
16502 output is always three numbers separated by dots, major, minor and
16503 patchlevel version.
16504
16505 -dumpspecs
16506 Print the compiler's built-in specs---and don't do anything else.
16507 (This is used when GCC itself is being built.)
16508
16509 Machine-Dependent Options
16510 Each target machine supported by GCC can have its own options---for
16511 example, to allow you to compile for a particular processor variant or
16512 ABI, or to control optimizations specific to that machine. By
16513 convention, the names of machine-specific options start with -m.
16514
16515 Some configurations of the compiler also support additional target-
16516 specific options, usually for compatibility with other compilers on the
16517 same platform.
16518
16519 AArch64 Options
16520
16521 These options are defined for AArch64 implementations:
16522
16523 -mabi=name
16524 Generate code for the specified data model. Permissible values are
16525 ilp32 for SysV-like data model where int, long int and pointers are
16526 32 bits, and lp64 for SysV-like data model where int is 32 bits,
16527 but long int and pointers are 64 bits.
16528
16529 The default depends on the specific target configuration. Note
16530 that the LP64 and ILP32 ABIs are not link-compatible; you must
16531 compile your entire program with the same ABI, and link with a
16532 compatible set of libraries.
16533
16534 -mbig-endian
16535 Generate big-endian code. This is the default when GCC is
16536 configured for an aarch64_be-*-* target.
16537
16538 -mgeneral-regs-only
16539 Generate code which uses only the general-purpose registers. This
16540 will prevent the compiler from using floating-point and Advanced
16541 SIMD registers but will not impose any restrictions on the
16542 assembler.
16543
16544 -mlittle-endian
16545 Generate little-endian code. This is the default when GCC is
16546 configured for an aarch64-*-* but not an aarch64_be-*-* target.
16547
16548 -mcmodel=tiny
16549 Generate code for the tiny code model. The program and its
16550 statically defined symbols must be within 1MB of each other.
16551 Programs can be statically or dynamically linked.
16552
16553 -mcmodel=small
16554 Generate code for the small code model. The program and its
16555 statically defined symbols must be within 4GB of each other.
16556 Programs can be statically or dynamically linked. This is the
16557 default code model.
16558
16559 -mcmodel=large
16560 Generate code for the large code model. This makes no assumptions
16561 about addresses and sizes of sections. Programs can be statically
16562 linked only. The -mcmodel=large option is incompatible with
16563 -mabi=ilp32, -fpic and -fPIC.
16564
16565 -mstrict-align
16566 -mno-strict-align
16567 Avoid or allow generating memory accesses that may not be aligned
16568 on a natural object boundary as described in the architecture
16569 specification.
16570
16571 -momit-leaf-frame-pointer
16572 -mno-omit-leaf-frame-pointer
16573 Omit or keep the frame pointer in leaf functions. The former
16574 behavior is the default.
16575
16576 -mstack-protector-guard=guard
16577 -mstack-protector-guard-reg=reg
16578 -mstack-protector-guard-offset=offset
16579 Generate stack protection code using canary at guard. Supported
16580 locations are global for a global canary or sysreg for a canary in
16581 an appropriate system register.
16582
16583 With the latter choice the options -mstack-protector-guard-reg=reg
16584 and -mstack-protector-guard-offset=offset furthermore specify which
16585 system register to use as base register for reading the canary, and
16586 from what offset from that base register. There is no default
16587 register or offset as this is entirely for use within the Linux
16588 kernel.
16589
16590 -mtls-dialect=desc
16591 Use TLS descriptors as the thread-local storage mechanism for
16592 dynamic accesses of TLS variables. This is the default.
16593
16594 -mtls-dialect=traditional
16595 Use traditional TLS as the thread-local storage mechanism for
16596 dynamic accesses of TLS variables.
16597
16598 -mtls-size=size
16599 Specify bit size of immediate TLS offsets. Valid values are 12,
16600 24, 32, 48. This option requires binutils 2.26 or newer.
16601
16602 -mfix-cortex-a53-835769
16603 -mno-fix-cortex-a53-835769
16604 Enable or disable the workaround for the ARM Cortex-A53 erratum
16605 number 835769. This involves inserting a NOP instruction between
16606 memory instructions and 64-bit integer multiply-accumulate
16607 instructions.
16608
16609 -mfix-cortex-a53-843419
16610 -mno-fix-cortex-a53-843419
16611 Enable or disable the workaround for the ARM Cortex-A53 erratum
16612 number 843419. This erratum workaround is made at link time and
16613 this will only pass the corresponding flag to the linker.
16614
16615 -mlow-precision-recip-sqrt
16616 -mno-low-precision-recip-sqrt
16617 Enable or disable the reciprocal square root approximation. This
16618 option only has an effect if -ffast-math or
16619 -funsafe-math-optimizations is used as well. Enabling this reduces
16620 precision of reciprocal square root results to about 16 bits for
16621 single precision and to 32 bits for double precision.
16622
16623 -mlow-precision-sqrt
16624 -mno-low-precision-sqrt
16625 Enable or disable the square root approximation. This option only
16626 has an effect if -ffast-math or -funsafe-math-optimizations is used
16627 as well. Enabling this reduces precision of square root results to
16628 about 16 bits for single precision and to 32 bits for double
16629 precision. If enabled, it implies -mlow-precision-recip-sqrt.
16630
16631 -mlow-precision-div
16632 -mno-low-precision-div
16633 Enable or disable the division approximation. This option only has
16634 an effect if -ffast-math or -funsafe-math-optimizations is used as
16635 well. Enabling this reduces precision of division results to about
16636 16 bits for single precision and to 32 bits for double precision.
16637
16638 -mtrack-speculation
16639 -mno-track-speculation
16640 Enable or disable generation of additional code to track
16641 speculative execution through conditional branches. The tracking
16642 state can then be used by the compiler when expanding calls to
16643 "__builtin_speculation_safe_copy" to permit a more efficient code
16644 sequence to be generated.
16645
16646 -moutline-atomics
16647 -mno-outline-atomics
16648 Enable or disable calls to out-of-line helpers to implement atomic
16649 operations. These helpers will, at runtime, determine if the LSE
16650 instructions from ARMv8.1-A can be used; if not, they will use the
16651 load/store-exclusive instructions that are present in the base
16652 ARMv8.0 ISA.
16653
16654 This option is only applicable when compiling for the base ARMv8.0
16655 instruction set. If using a later revision, e.g. -march=armv8.1-a
16656 or -march=armv8-a+lse, the ARMv8.1-Atomics instructions will be
16657 used directly. The same applies when using -mcpu= when the
16658 selected cpu supports the lse feature. This option is on by
16659 default.
16660
16661 -march=name
16662 Specify the name of the target architecture and, optionally, one or
16663 more feature modifiers. This option has the form
16664 -march=arch{+[no]feature}*.
16665
16666 The table below summarizes the permissible values for arch and the
16667 features that they enable by default:
16668
16669 arch value : Architecture : Includes by default
16670 armv8-a : Armv8-A : +fp, +simd
16671 armv8.1-a : Armv8.1-A : armv8-a, +crc, +lse, +rdma
16672 armv8.2-a : Armv8.2-A : armv8.1-a
16673 armv8.3-a : Armv8.3-A : armv8.2-a, +pauth
16674 armv8.4-a : Armv8.4-A : armv8.3-a, +flagm, +fp16fml, +dotprod
16675 armv8.5-a : Armv8.5-A : armv8.4-a, +sb, +ssbs, +predres
16676 armv8.6-a : Armv8.6-A : armv8.5-a, +bf16, +i8mm
16677 armv8.7-a : Armv8.7-A : armv8.6-a, +ls64
16678 armv8.8-a : Armv8.8-a : armv8.7-a, +mops
16679 armv9-a : Armv9-A : armv8.5-a, +sve, +sve2
16680 armv8-r : Armv8-R : armv8-r
16681
16682 The value native is available on native AArch64 GNU/Linux and
16683 causes the compiler to pick the architecture of the host system.
16684 This option has no effect if the compiler is unable to recognize
16685 the architecture of the host system,
16686
16687 The permissible values for feature are listed in the sub-section on
16688 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
16689 Where conflicting feature modifiers are specified, the right-most
16690 feature is used.
16691
16692 GCC uses name to determine what kind of instructions it can emit
16693 when generating assembly code. If -march is specified without
16694 either of -mtune or -mcpu also being specified, the code is tuned
16695 to perform well across a range of target processors implementing
16696 the target architecture.
16697
16698 -mtune=name
16699 Specify the name of the target processor for which GCC should tune
16700 the performance of the code. Permissible values for this option
16701 are: generic, cortex-a35, cortex-a53, cortex-a55, cortex-a57,
16702 cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae,
16703 cortex-a77, cortex-a65, cortex-a65ae, cortex-a34, cortex-a78,
16704 cortex-a78ae, cortex-a78c, ares, exynos-m1, emag, falkor,
16705 neoverse-512tvb, neoverse-e1, neoverse-n1, neoverse-n2,
16706 neoverse-v1, qdf24xx, saphira, phecda, xgene1, vulcan, octeontx,
16707 octeontx81, octeontx83, octeontx2, octeontx2t98, octeontx2t96
16708 octeontx2t93, octeontx2f95, octeontx2f95n, octeontx2f95mm, a64fx,
16709 thunderx, thunderxt88, thunderxt88p1, thunderxt81, tsv110,
16710 thunderxt83, thunderx2t99, thunderx3t110, zeus,
16711 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
16712 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
16713 cortex-a75.cortex-a55, cortex-a76.cortex-a55, cortex-r82,
16714 cortex-x1, cortex-x2, cortex-a510, cortex-a710, ampere1, native.
16715
16716 The values cortex-a57.cortex-a53, cortex-a72.cortex-a53,
16717 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
16718 cortex-a75.cortex-a55, cortex-a76.cortex-a55 specify that GCC
16719 should tune for a big.LITTLE system.
16720
16721 The value neoverse-512tvb specifies that GCC should tune for
16722 Neoverse cores that (a) implement SVE and (b) have a total vector
16723 bandwidth of 512 bits per cycle. In other words, the option tells
16724 GCC to tune for Neoverse cores that can execute 4 128-bit Advanced
16725 SIMD arithmetic instructions a cycle and that can execute an
16726 equivalent number of SVE arithmetic instructions per cycle (2 for
16727 256-bit SVE, 4 for 128-bit SVE). This is more general than tuning
16728 for a specific core like Neoverse V1 but is more specific than the
16729 default tuning described below.
16730
16731 Additionally on native AArch64 GNU/Linux systems the value native
16732 tunes performance to the host system. This option has no effect if
16733 the compiler is unable to recognize the processor of the host
16734 system.
16735
16736 Where none of -mtune=, -mcpu= or -march= are specified, the code is
16737 tuned to perform well across a range of target processors.
16738
16739 This option cannot be suffixed by feature modifiers.
16740
16741 -mcpu=name
16742 Specify the name of the target processor, optionally suffixed by
16743 one or more feature modifiers. This option has the form
16744 -mcpu=cpu{+[no]feature}*, where the permissible values for cpu are
16745 the same as those available for -mtune. The permissible values for
16746 feature are documented in the sub-section on
16747 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
16748 Where conflicting feature modifiers are specified, the right-most
16749 feature is used.
16750
16751 GCC uses name to determine what kind of instructions it can emit
16752 when generating assembly code (as if by -march) and to determine
16753 the target processor for which to tune for performance (as if by
16754 -mtune). Where this option is used in conjunction with -march or
16755 -mtune, those options take precedence over the appropriate part of
16756 this option.
16757
16758 -mcpu=neoverse-512tvb is special in that it does not refer to a
16759 specific core, but instead refers to all Neoverse cores that (a)
16760 implement SVE and (b) have a total vector bandwidth of 512 bits a
16761 cycle. Unless overridden by -march, -mcpu=neoverse-512tvb
16762 generates code that can run on a Neoverse V1 core, since Neoverse
16763 V1 is the first Neoverse core with these properties. Unless
16764 overridden by -mtune, -mcpu=neoverse-512tvb tunes code in the same
16765 way as for -mtune=neoverse-512tvb.
16766
16767 -moverride=string
16768 Override tuning decisions made by the back-end in response to a
16769 -mtune= switch. The syntax, semantics, and accepted values for
16770 string in this option are not guaranteed to be consistent across
16771 releases.
16772
16773 This option is only intended to be useful when developing GCC.
16774
16775 -mverbose-cost-dump
16776 Enable verbose cost model dumping in the debug dump files. This
16777 option is provided for use in debugging the compiler.
16778
16779 -mpc-relative-literal-loads
16780 -mno-pc-relative-literal-loads
16781 Enable or disable PC-relative literal loads. With this option
16782 literal pools are accessed using a single instruction and emitted
16783 after each function. This limits the maximum size of functions to
16784 1MB. This is enabled by default for -mcmodel=tiny.
16785
16786 -msign-return-address=scope
16787 Select the function scope on which return address signing will be
16788 applied. Permissible values are none, which disables return
16789 address signing, non-leaf, which enables pointer signing for
16790 functions which are not leaf functions, and all, which enables
16791 pointer signing for all functions. The default value is none. This
16792 option has been deprecated by -mbranch-protection.
16793
16794 -mbranch-protection=none|standard|pac-ret[+leaf+b-key]|bti
16795 Select the branch protection features to use. none is the default
16796 and turns off all types of branch protection. standard turns on
16797 all types of branch protection features. If a feature has
16798 additional tuning options, then standard sets it to its standard
16799 level. pac-ret[+leaf] turns on return address signing to its
16800 standard level: signing functions that save the return address to
16801 memory (non-leaf functions will practically always do this) using
16802 the a-key. The optional argument leaf can be used to extend the
16803 signing to include leaf functions. The optional argument b-key can
16804 be used to sign the functions with the B-key instead of the A-key.
16805 bti turns on branch target identification mechanism.
16806
16807 -mharden-sls=opts
16808 Enable compiler hardening against straight line speculation (SLS).
16809 opts is a comma-separated list of the following options:
16810
16811 retbr
16812 blr
16813
16814 In addition, -mharden-sls=all enables all SLS hardening while
16815 -mharden-sls=none disables all SLS hardening.
16816
16817 -msve-vector-bits=bits
16818 Specify the number of bits in an SVE vector register. This option
16819 only has an effect when SVE is enabled.
16820
16821 GCC supports two forms of SVE code generation: "vector-length
16822 agnostic" output that works with any size of vector register and
16823 "vector-length specific" output that allows GCC to make assumptions
16824 about the vector length when it is useful for optimization reasons.
16825 The possible values of bits are: scalable, 128, 256, 512, 1024 and
16826 2048. Specifying scalable selects vector-length agnostic output.
16827 At present -msve-vector-bits=128 also generates vector-length
16828 agnostic output for big-endian targets. All other values generate
16829 vector-length specific code. The behavior of these values may
16830 change in future releases and no value except scalable should be
16831 relied on for producing code that is portable across different
16832 hardware SVE vector lengths.
16833
16834 The default is -msve-vector-bits=scalable, which produces vector-
16835 length agnostic code.
16836
16837 -march and -mcpu Feature Modifiers
16838
16839 Feature modifiers used with -march and -mcpu can be any of the
16840 following and their inverses nofeature:
16841
16842 crc Enable CRC extension. This is on by default for -march=armv8.1-a.
16843
16844 crypto
16845 Enable Crypto extension. This also enables Advanced SIMD and
16846 floating-point instructions.
16847
16848 fp Enable floating-point instructions. This is on by default for all
16849 possible values for options -march and -mcpu.
16850
16851 simd
16852 Enable Advanced SIMD instructions. This also enables floating-
16853 point instructions. This is on by default for all possible values
16854 for options -march and -mcpu.
16855
16856 sve Enable Scalable Vector Extension instructions. This also enables
16857 Advanced SIMD and floating-point instructions.
16858
16859 lse Enable Large System Extension instructions. This is on by default
16860 for -march=armv8.1-a.
16861
16862 rdma
16863 Enable Round Double Multiply Accumulate instructions. This is on
16864 by default for -march=armv8.1-a.
16865
16866 fp16
16867 Enable FP16 extension. This also enables floating-point
16868 instructions.
16869
16870 fp16fml
16871 Enable FP16 fmla extension. This also enables FP16 extensions and
16872 floating-point instructions. This option is enabled by default for
16873 -march=armv8.4-a. Use of this option with architectures prior to
16874 Armv8.2-A is not supported.
16875
16876 rcpc
16877 Enable the RcPc extension. This does not change code generation
16878 from GCC, but is passed on to the assembler, enabling inline asm
16879 statements to use instructions from the RcPc extension.
16880
16881 dotprod
16882 Enable the Dot Product extension. This also enables Advanced SIMD
16883 instructions.
16884
16885 aes Enable the Armv8-a aes and pmull crypto extension. This also
16886 enables Advanced SIMD instructions.
16887
16888 sha2
16889 Enable the Armv8-a sha2 crypto extension. This also enables
16890 Advanced SIMD instructions.
16891
16892 sha3
16893 Enable the sha512 and sha3 crypto extension. This also enables
16894 Advanced SIMD instructions. Use of this option with architectures
16895 prior to Armv8.2-A is not supported.
16896
16897 sm4 Enable the sm3 and sm4 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 profile
16902 Enable the Statistical Profiling extension. This option is only to
16903 enable the extension at the assembler level and does not affect
16904 code generation.
16905
16906 rng Enable the Armv8.5-a Random Number instructions. This option is
16907 only to enable the extension at the assembler level and does not
16908 affect code generation.
16909
16910 memtag
16911 Enable the Armv8.5-a Memory Tagging Extensions. Use of this option
16912 with architectures prior to Armv8.5-A is not supported.
16913
16914 sb Enable the Armv8-a Speculation Barrier instruction. This option is
16915 only to enable the extension at the assembler level and does not
16916 affect code generation. This option is enabled by default for
16917 -march=armv8.5-a.
16918
16919 ssbs
16920 Enable the Armv8-a Speculative Store Bypass Safe instruction. This
16921 option is only to enable the extension at the assembler level and
16922 does not affect code generation. This option is enabled by default
16923 for -march=armv8.5-a.
16924
16925 predres
16926 Enable the Armv8-a Execution and Data Prediction Restriction
16927 instructions. This option is only to enable the extension at the
16928 assembler level and does not affect code generation. This option
16929 is enabled by default for -march=armv8.5-a.
16930
16931 sve2
16932 Enable the Armv8-a Scalable Vector Extension 2. This also enables
16933 SVE instructions.
16934
16935 sve2-bitperm
16936 Enable SVE2 bitperm instructions. This also enables SVE2
16937 instructions.
16938
16939 sve2-sm4
16940 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16941
16942 sve2-aes
16943 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16944
16945 sve2-sha3
16946 Enable SVE2 sha3 instructions. This also enables SVE2
16947 instructions.
16948
16949 tme Enable the Transactional Memory Extension.
16950
16951 i8mm
16952 Enable 8-bit Integer Matrix Multiply instructions. This also
16953 enables Advanced SIMD and floating-point instructions. This option
16954 is enabled by default for -march=armv8.6-a. Use of this option
16955 with architectures prior to Armv8.2-A is not supported.
16956
16957 f32mm
16958 Enable 32-bit Floating point Matrix Multiply instructions. This
16959 also enables SVE instructions. Use of this option with
16960 architectures prior to Armv8.2-A is not supported.
16961
16962 f64mm
16963 Enable 64-bit Floating point Matrix Multiply instructions. This
16964 also enables SVE instructions. Use of this option with
16965 architectures prior to Armv8.2-A is not supported.
16966
16967 bf16
16968 Enable brain half-precision floating-point instructions. This also
16969 enables Advanced SIMD and floating-point instructions. This option
16970 is enabled by default for -march=armv8.6-a. Use of this option
16971 with architectures prior to Armv8.2-A is not supported.
16972
16973 ls64
16974 Enable the 64-byte atomic load and store instructions for
16975 accelerators. This option is enabled by default for
16976 -march=armv8.7-a.
16977
16978 mops
16979 Enable the instructions to accelerate memory operations like
16980 "memcpy", "memmove", "memset". This option is enabled by default
16981 for -march=armv8.8-a
16982
16983 flagm
16984 Enable the Flag Manipulation instructions Extension.
16985
16986 pauth
16987 Enable the Pointer Authentication Extension.
16988
16989 Feature crypto implies aes, sha2, and simd, which implies fp.
16990 Conversely, nofp implies nosimd, which implies nocrypto, noaes and
16991 nosha2.
16992
16993 Adapteva Epiphany Options
16994
16995 These -m options are defined for Adapteva Epiphany:
16996
16997 -mhalf-reg-file
16998 Don't allocate any register in the range "r32"..."r63". That
16999 allows code to run on hardware variants that lack these registers.
17000
17001 -mprefer-short-insn-regs
17002 Preferentially allocate registers that allow short instruction
17003 generation. This can result in increased instruction count, so
17004 this may either reduce or increase overall code size.
17005
17006 -mbranch-cost=num
17007 Set the cost of branches to roughly num "simple" instructions.
17008 This cost is only a heuristic and is not guaranteed to produce
17009 consistent results across releases.
17010
17011 -mcmove
17012 Enable the generation of conditional moves.
17013
17014 -mnops=num
17015 Emit num NOPs before every other generated instruction.
17016
17017 -mno-soft-cmpsf
17018 For single-precision floating-point comparisons, emit an "fsub"
17019 instruction and test the flags. This is faster than a software
17020 comparison, but can get incorrect results in the presence of NaNs,
17021 or when two different small numbers are compared such that their
17022 difference is calculated as zero. The default is -msoft-cmpsf,
17023 which uses slower, but IEEE-compliant, software comparisons.
17024
17025 -mstack-offset=num
17026 Set the offset between the top of the stack and the stack pointer.
17027 E.g., a value of 8 means that the eight bytes in the range
17028 "sp+0...sp+7" can be used by leaf functions without stack
17029 allocation. Values other than 8 or 16 are untested and unlikely to
17030 work. Note also that this option changes the ABI; compiling a
17031 program with a different stack offset than the libraries have been
17032 compiled with generally does not work. This option can be useful
17033 if you want to evaluate if a different stack offset would give you
17034 better code, but to actually use a different stack offset to build
17035 working programs, it is recommended to configure the toolchain with
17036 the appropriate --with-stack-offset=num option.
17037
17038 -mno-round-nearest
17039 Make the scheduler assume that the rounding mode has been set to
17040 truncating. The default is -mround-nearest.
17041
17042 -mlong-calls
17043 If not otherwise specified by an attribute, assume all calls might
17044 be beyond the offset range of the "b" / "bl" instructions, and
17045 therefore load the function address into a register before
17046 performing a (otherwise direct) call. This is the default.
17047
17048 -mshort-calls
17049 If not otherwise specified by an attribute, assume all direct calls
17050 are in the range of the "b" / "bl" instructions, so use these
17051 instructions for direct calls. The default is -mlong-calls.
17052
17053 -msmall16
17054 Assume addresses can be loaded as 16-bit unsigned values. This
17055 does not apply to function addresses for which -mlong-calls
17056 semantics are in effect.
17057
17058 -mfp-mode=mode
17059 Set the prevailing mode of the floating-point unit. This
17060 determines the floating-point mode that is provided and expected at
17061 function call and return time. Making this mode match the mode you
17062 predominantly need at function start can make your programs smaller
17063 and faster by avoiding unnecessary mode switches.
17064
17065 mode can be set to one the following values:
17066
17067 caller
17068 Any mode at function entry is valid, and retained or restored
17069 when the function returns, and when it calls other functions.
17070 This mode is useful for compiling libraries or other
17071 compilation units you might want to incorporate into different
17072 programs with different prevailing FPU modes, and the
17073 convenience of being able to use a single object file outweighs
17074 the size and speed overhead for any extra mode switching that
17075 might be needed, compared with what would be needed with a more
17076 specific choice of prevailing FPU mode.
17077
17078 truncate
17079 This is the mode used for floating-point calculations with
17080 truncating (i.e. round towards zero) rounding mode. That
17081 includes conversion from floating point to integer.
17082
17083 round-nearest
17084 This is the mode used for floating-point calculations with
17085 round-to-nearest-or-even rounding mode.
17086
17087 int This is the mode used to perform integer calculations in the
17088 FPU, e.g. integer multiply, or integer multiply-and-
17089 accumulate.
17090
17091 The default is -mfp-mode=caller
17092
17093 -mno-split-lohi
17094 -mno-postinc
17095 -mno-postmodify
17096 Code generation tweaks that disable, respectively, splitting of
17097 32-bit loads, generation of post-increment addresses, and
17098 generation of post-modify addresses. The defaults are msplit-lohi,
17099 -mpost-inc, and -mpost-modify.
17100
17101 -mnovect-double
17102 Change the preferred SIMD mode to SImode. The default is
17103 -mvect-double, which uses DImode as preferred SIMD mode.
17104
17105 -max-vect-align=num
17106 The maximum alignment for SIMD vector mode types. num may be 4 or
17107 8. The default is 8. Note that this is an ABI change, even though
17108 many library function interfaces are unaffected if they don't use
17109 SIMD vector modes in places that affect size and/or alignment of
17110 relevant types.
17111
17112 -msplit-vecmove-early
17113 Split vector moves into single word moves before reload. In theory
17114 this can give better register allocation, but so far the reverse
17115 seems to be generally the case.
17116
17117 -m1reg-reg
17118 Specify a register to hold the constant -1, which makes loading
17119 small negative constants and certain bitmasks faster. Allowable
17120 values for reg are r43 and r63, which specify use of that register
17121 as a fixed register, and none, which means that no register is used
17122 for this purpose. The default is -m1reg-none.
17123
17124 AMD GCN Options
17125
17126 These options are defined specifically for the AMD GCN port.
17127
17128 -march=gpu
17129 -mtune=gpu
17130 Set architecture type or tuning for gpu. Supported values for gpu
17131 are
17132
17133 fiji
17134 Compile for GCN3 Fiji devices (gfx803).
17135
17136 gfx900
17137 Compile for GCN5 Vega 10 devices (gfx900).
17138
17139 gfx906
17140 Compile for GCN5 Vega 20 devices (gfx906).
17141
17142 -msram-ecc=on
17143 -msram-ecc=off
17144 -msram-ecc=any
17145 Compile binaries suitable for devices with the SRAM-ECC feature
17146 enabled, disabled, or either mode. This feature can be enabled
17147 per-process on some devices. The compiled code must match the
17148 device mode. The default is any, for devices that support it.
17149
17150 -mstack-size=bytes
17151 Specify how many bytes of stack space will be requested for each
17152 GPU thread (wave-front). Beware that there may be many threads and
17153 limited memory available. The size of the stack allocation may
17154 also have an impact on run-time performance. The default is 32KB
17155 when using OpenACC or OpenMP, and 1MB otherwise.
17156
17157 -mxnack
17158 Compile binaries suitable for devices with the XNACK feature
17159 enabled. Some devices always require XNACK and some allow the user
17160 to configure XNACK. The compiled code must match the device mode.
17161 The default is -mno-xnack. At present this option is a placeholder
17162 for support that is not yet implemented.
17163
17164 ARC Options
17165
17166 The following options control the architecture variant for which code
17167 is being compiled:
17168
17169 -mbarrel-shifter
17170 Generate instructions supported by barrel shifter. This is the
17171 default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
17172
17173 -mjli-always
17174 Force to call a function using jli_s instruction. This option is
17175 valid only for ARCv2 architecture.
17176
17177 -mcpu=cpu
17178 Set architecture type, register usage, and instruction scheduling
17179 parameters for cpu. There are also shortcut alias options
17180 available for backward compatibility and convenience. Supported
17181 values for cpu are
17182
17183 arc600
17184 Compile for ARC600. Aliases: -mA6, -mARC600.
17185
17186 arc601
17187 Compile for ARC601. Alias: -mARC601.
17188
17189 arc700
17190 Compile for ARC700. Aliases: -mA7, -mARC700. This is the
17191 default when configured with --with-cpu=arc700.
17192
17193 arcem
17194 Compile for ARC EM.
17195
17196 archs
17197 Compile for ARC HS.
17198
17199 em Compile for ARC EM CPU with no hardware extensions.
17200
17201 em4 Compile for ARC EM4 CPU.
17202
17203 em4_dmips
17204 Compile for ARC EM4 DMIPS CPU.
17205
17206 em4_fpus
17207 Compile for ARC EM4 DMIPS CPU with the single-precision
17208 floating-point extension.
17209
17210 em4_fpuda
17211 Compile for ARC EM4 DMIPS CPU with single-precision floating-
17212 point and double assist instructions.
17213
17214 hs Compile for ARC HS CPU with no hardware extensions except the
17215 atomic instructions.
17216
17217 hs34
17218 Compile for ARC HS34 CPU.
17219
17220 hs38
17221 Compile for ARC HS38 CPU.
17222
17223 hs38_linux
17224 Compile for ARC HS38 CPU with all hardware extensions on.
17225
17226 arc600_norm
17227 Compile for ARC 600 CPU with "norm" instructions enabled.
17228
17229 arc600_mul32x16
17230 Compile for ARC 600 CPU with "norm" and 32x16-bit multiply
17231 instructions enabled.
17232
17233 arc600_mul64
17234 Compile for ARC 600 CPU with "norm" and "mul64"-family
17235 instructions enabled.
17236
17237 arc601_norm
17238 Compile for ARC 601 CPU with "norm" instructions enabled.
17239
17240 arc601_mul32x16
17241 Compile for ARC 601 CPU with "norm" and 32x16-bit multiply
17242 instructions enabled.
17243
17244 arc601_mul64
17245 Compile for ARC 601 CPU with "norm" and "mul64"-family
17246 instructions enabled.
17247
17248 nps400
17249 Compile for ARC 700 on NPS400 chip.
17250
17251 em_mini
17252 Compile for ARC EM minimalist configuration featuring reduced
17253 register set.
17254
17255 -mdpfp
17256 -mdpfp-compact
17257 Generate double-precision FPX instructions, tuned for the compact
17258 implementation.
17259
17260 -mdpfp-fast
17261 Generate double-precision FPX instructions, tuned for the fast
17262 implementation.
17263
17264 -mno-dpfp-lrsr
17265 Disable "lr" and "sr" instructions from using FPX extension aux
17266 registers.
17267
17268 -mea
17269 Generate extended arithmetic instructions. Currently only "divaw",
17270 "adds", "subs", and "sat16" are supported. Only valid for
17271 -mcpu=ARC700.
17272
17273 -mno-mpy
17274 Do not generate "mpy"-family instructions for ARC700. This option
17275 is deprecated.
17276
17277 -mmul32x16
17278 Generate 32x16-bit multiply and multiply-accumulate instructions.
17279
17280 -mmul64
17281 Generate "mul64" and "mulu64" instructions. Only valid for
17282 -mcpu=ARC600.
17283
17284 -mnorm
17285 Generate "norm" instructions. This is the default if -mcpu=ARC700
17286 is in effect.
17287
17288 -mspfp
17289 -mspfp-compact
17290 Generate single-precision FPX instructions, tuned for the compact
17291 implementation.
17292
17293 -mspfp-fast
17294 Generate single-precision FPX instructions, tuned for the fast
17295 implementation.
17296
17297 -msimd
17298 Enable generation of ARC SIMD instructions via target-specific
17299 builtins. Only valid for -mcpu=ARC700.
17300
17301 -msoft-float
17302 This option ignored; it is provided for compatibility purposes
17303 only. Software floating-point code is emitted by default, and this
17304 default can overridden by FPX options; -mspfp, -mspfp-compact, or
17305 -mspfp-fast for single precision, and -mdpfp, -mdpfp-compact, or
17306 -mdpfp-fast for double precision.
17307
17308 -mswap
17309 Generate "swap" instructions.
17310
17311 -matomic
17312 This enables use of the locked load/store conditional extension to
17313 implement atomic memory built-in functions. Not available for ARC
17314 6xx or ARC EM cores.
17315
17316 -mdiv-rem
17317 Enable "div" and "rem" instructions for ARCv2 cores.
17318
17319 -mcode-density
17320 Enable code density instructions for ARC EM. This option is on by
17321 default for ARC HS.
17322
17323 -mll64
17324 Enable double load/store operations for ARC HS cores.
17325
17326 -mtp-regno=regno
17327 Specify thread pointer register number.
17328
17329 -mmpy-option=multo
17330 Compile ARCv2 code with a multiplier design option. You can
17331 specify the option using either a string or numeric value for
17332 multo. wlh1 is the default value. The recognized values are:
17333
17334 0
17335 none
17336 No multiplier available.
17337
17338 1
17339 w 16x16 multiplier, fully pipelined. The following instructions
17340 are enabled: "mpyw" and "mpyuw".
17341
17342 2
17343 wlh1
17344 32x32 multiplier, fully pipelined (1 stage). The following
17345 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17346 "mpymu", and "mpy_s".
17347
17348 3
17349 wlh2
17350 32x32 multiplier, fully pipelined (2 stages). The following
17351 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17352 "mpymu", and "mpy_s".
17353
17354 4
17355 wlh3
17356 Two 16x16 multipliers, blocking, sequential. The following
17357 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17358 "mpymu", and "mpy_s".
17359
17360 5
17361 wlh4
17362 One 16x16 multiplier, blocking, sequential. The following
17363 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17364 "mpymu", and "mpy_s".
17365
17366 6
17367 wlh5
17368 One 32x4 multiplier, blocking, sequential. The following
17369 instructions are additionally enabled: "mpy", "mpyu", "mpym",
17370 "mpymu", and "mpy_s".
17371
17372 7
17373 plus_dmpy
17374 ARC HS SIMD support.
17375
17376 8
17377 plus_macd
17378 ARC HS SIMD support.
17379
17380 9
17381 plus_qmacw
17382 ARC HS SIMD support.
17383
17384 This option is only available for ARCv2 cores.
17385
17386 -mfpu=fpu
17387 Enables support for specific floating-point hardware extensions for
17388 ARCv2 cores. Supported values for fpu are:
17389
17390 fpus
17391 Enables support for single-precision floating-point hardware
17392 extensions.
17393
17394 fpud
17395 Enables support for double-precision floating-point hardware
17396 extensions. The single-precision floating-point extension is
17397 also enabled. Not available for ARC EM.
17398
17399 fpuda
17400 Enables support for double-precision floating-point hardware
17401 extensions using double-precision assist instructions. The
17402 single-precision floating-point extension is also enabled.
17403 This option is only available for ARC EM.
17404
17405 fpuda_div
17406 Enables support for double-precision floating-point hardware
17407 extensions using double-precision assist instructions. The
17408 single-precision floating-point, square-root, and divide
17409 extensions are also enabled. This option is only available for
17410 ARC EM.
17411
17412 fpuda_fma
17413 Enables support for double-precision floating-point hardware
17414 extensions using double-precision assist instructions. The
17415 single-precision floating-point and fused multiply and add
17416 hardware extensions are also enabled. This option is only
17417 available for ARC EM.
17418
17419 fpuda_all
17420 Enables support for double-precision floating-point hardware
17421 extensions using double-precision assist instructions. All
17422 single-precision floating-point hardware extensions are also
17423 enabled. This option is only available for ARC EM.
17424
17425 fpus_div
17426 Enables support for single-precision floating-point, square-
17427 root and divide hardware extensions.
17428
17429 fpud_div
17430 Enables support for double-precision floating-point, square-
17431 root and divide hardware extensions. This option includes
17432 option fpus_div. Not available for ARC EM.
17433
17434 fpus_fma
17435 Enables support for single-precision floating-point and fused
17436 multiply and add hardware extensions.
17437
17438 fpud_fma
17439 Enables support for double-precision floating-point and fused
17440 multiply and add hardware extensions. This option includes
17441 option fpus_fma. Not available for ARC EM.
17442
17443 fpus_all
17444 Enables support for all single-precision floating-point
17445 hardware extensions.
17446
17447 fpud_all
17448 Enables support for all single- and double-precision floating-
17449 point hardware extensions. Not available for ARC EM.
17450
17451 -mirq-ctrl-saved=register-range, blink, lp_count
17452 Specifies general-purposes registers that the processor
17453 automatically saves/restores on interrupt entry and exit.
17454 register-range is specified as two registers separated by a dash.
17455 The register range always starts with "r0", the upper limit is "fp"
17456 register. blink and lp_count are optional. This option is only
17457 valid for ARC EM and ARC HS cores.
17458
17459 -mrgf-banked-regs=number
17460 Specifies the number of registers replicated in second register
17461 bank on entry to fast interrupt. Fast interrupts are interrupts
17462 with the highest priority level P0. These interrupts save only PC
17463 and STATUS32 registers to avoid memory transactions during
17464 interrupt entry and exit sequences. Use this option when you are
17465 using fast interrupts in an ARC V2 family processor. Permitted
17466 values are 4, 8, 16, and 32.
17467
17468 -mlpc-width=width
17469 Specify the width of the "lp_count" register. Valid values for
17470 width are 8, 16, 20, 24, 28 and 32 bits. The default width is
17471 fixed to 32 bits. If the width is less than 32, the compiler does
17472 not attempt to transform loops in your program to use the zero-
17473 delay loop mechanism unless it is known that the "lp_count"
17474 register can hold the required loop-counter value. Depending on
17475 the width specified, the compiler and run-time library might
17476 continue to use the loop mechanism for various needs. This option
17477 defines macro "__ARC_LPC_WIDTH__" with the value of width.
17478
17479 -mrf16
17480 This option instructs the compiler to generate code for a 16-entry
17481 register file. This option defines the "__ARC_RF16__" preprocessor
17482 macro.
17483
17484 -mbranch-index
17485 Enable use of "bi" or "bih" instructions to implement jump tables.
17486
17487 The following options are passed through to the assembler, and also
17488 define preprocessor macro symbols.
17489
17490 -mdsp-packa
17491 Passed down to the assembler to enable the DSP Pack A extensions.
17492 Also sets the preprocessor symbol "__Xdsp_packa". This option is
17493 deprecated.
17494
17495 -mdvbf
17496 Passed down to the assembler to enable the dual Viterbi butterfly
17497 extension. Also sets the preprocessor symbol "__Xdvbf". This
17498 option is deprecated.
17499
17500 -mlock
17501 Passed down to the assembler to enable the locked load/store
17502 conditional extension. Also sets the preprocessor symbol
17503 "__Xlock".
17504
17505 -mmac-d16
17506 Passed down to the assembler. Also sets the preprocessor symbol
17507 "__Xxmac_d16". This option is deprecated.
17508
17509 -mmac-24
17510 Passed down to the assembler. Also sets the preprocessor symbol
17511 "__Xxmac_24". This option is deprecated.
17512
17513 -mrtsc
17514 Passed down to the assembler to enable the 64-bit time-stamp
17515 counter extension instruction. Also sets the preprocessor symbol
17516 "__Xrtsc". This option is deprecated.
17517
17518 -mswape
17519 Passed down to the assembler to enable the swap byte ordering
17520 extension instruction. Also sets the preprocessor symbol
17521 "__Xswape".
17522
17523 -mtelephony
17524 Passed down to the assembler to enable dual- and single-operand
17525 instructions for telephony. Also sets the preprocessor symbol
17526 "__Xtelephony". This option is deprecated.
17527
17528 -mxy
17529 Passed down to the assembler to enable the XY memory extension.
17530 Also sets the preprocessor symbol "__Xxy".
17531
17532 The following options control how the assembly code is annotated:
17533
17534 -misize
17535 Annotate assembler instructions with estimated addresses.
17536
17537 -mannotate-align
17538 Explain what alignment considerations lead to the decision to make
17539 an instruction short or long.
17540
17541 The following options are passed through to the linker:
17542
17543 -marclinux
17544 Passed through to the linker, to specify use of the "arclinux"
17545 emulation. This option is enabled by default in tool chains built
17546 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
17547 profiling is not requested.
17548
17549 -marclinux_prof
17550 Passed through to the linker, to specify use of the "arclinux_prof"
17551 emulation. This option is enabled by default in tool chains built
17552 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
17553 profiling is requested.
17554
17555 The following options control the semantics of generated code:
17556
17557 -mlong-calls
17558 Generate calls as register indirect calls, thus providing access to
17559 the full 32-bit address range.
17560
17561 -mmedium-calls
17562 Don't use less than 25-bit addressing range for calls, which is the
17563 offset available for an unconditional branch-and-link instruction.
17564 Conditional execution of function calls is suppressed, to allow use
17565 of the 25-bit range, rather than the 21-bit range with conditional
17566 branch-and-link. This is the default for tool chains built for
17567 "arc-linux-uclibc" and "arceb-linux-uclibc" targets.
17568
17569 -G num
17570 Put definitions of externally-visible data in a small data section
17571 if that data is no bigger than num bytes. The default value of num
17572 is 4 for any ARC configuration, or 8 when we have double load/store
17573 operations.
17574
17575 -mno-sdata
17576 Do not generate sdata references. This is the default for tool
17577 chains built for "arc-linux-uclibc" and "arceb-linux-uclibc"
17578 targets.
17579
17580 -mvolatile-cache
17581 Use ordinarily cached memory accesses for volatile references.
17582 This is the default.
17583
17584 -mno-volatile-cache
17585 Enable cache bypass for volatile references.
17586
17587 The following options fine tune code generation:
17588
17589 -malign-call
17590 Does nothing. Preserved for backward compatibility.
17591
17592 -mauto-modify-reg
17593 Enable the use of pre/post modify with register displacement.
17594
17595 -mbbit-peephole
17596 Enable bbit peephole2.
17597
17598 -mno-brcc
17599 This option disables a target-specific pass in arc_reorg to
17600 generate compare-and-branch ("brcc") instructions. It has no
17601 effect on generation of these instructions driven by the combiner
17602 pass.
17603
17604 -mcase-vector-pcrel
17605 Use PC-relative switch case tables to enable case table shortening.
17606 This is the default for -Os.
17607
17608 -mcompact-casesi
17609 Enable compact "casesi" pattern. This is the default for -Os, and
17610 only available for ARCv1 cores. This option is deprecated.
17611
17612 -mno-cond-exec
17613 Disable the ARCompact-specific pass to generate conditional
17614 execution instructions.
17615
17616 Due to delay slot scheduling and interactions between operand
17617 numbers, literal sizes, instruction lengths, and the support for
17618 conditional execution, the target-independent pass to generate
17619 conditional execution is often lacking, so the ARC port has kept a
17620 special pass around that tries to find more conditional execution
17621 generation opportunities after register allocation, branch
17622 shortening, and delay slot scheduling have been done. This pass
17623 generally, but not always, improves performance and code size, at
17624 the cost of extra compilation time, which is why there is an option
17625 to switch it off. If you have a problem with call instructions
17626 exceeding their allowable offset range because they are
17627 conditionalized, you should consider using -mmedium-calls instead.
17628
17629 -mearly-cbranchsi
17630 Enable pre-reload use of the "cbranchsi" pattern.
17631
17632 -mexpand-adddi
17633 Expand "adddi3" and "subdi3" at RTL generation time into "add.f",
17634 "adc" etc. This option is deprecated.
17635
17636 -mindexed-loads
17637 Enable the use of indexed loads. This can be problematic because
17638 some optimizers then assume that indexed stores exist, which is not
17639 the case.
17640
17641 -mlra
17642 Enable Local Register Allocation. This is still experimental for
17643 ARC, so by default the compiler uses standard reload (i.e.
17644 -mno-lra).
17645
17646 -mlra-priority-none
17647 Don't indicate any priority for target registers.
17648
17649 -mlra-priority-compact
17650 Indicate target register priority for r0..r3 / r12..r15.
17651
17652 -mlra-priority-noncompact
17653 Reduce target register priority for r0..r3 / r12..r15.
17654
17655 -mmillicode
17656 When optimizing for size (using -Os), prologues and epilogues that
17657 have to save or restore a large number of registers are often
17658 shortened by using call to a special function in libgcc; this is
17659 referred to as a millicode call. As these calls can pose
17660 performance issues, and/or cause linking issues when linking in a
17661 nonstandard way, this option is provided to turn on or off
17662 millicode call generation.
17663
17664 -mcode-density-frame
17665 This option enable the compiler to emit "enter" and "leave"
17666 instructions. These instructions are only valid for CPUs with
17667 code-density feature.
17668
17669 -mmixed-code
17670 Does nothing. Preserved for backward compatibility.
17671
17672 -mq-class
17673 Ths option is deprecated. Enable q instruction alternatives. This
17674 is the default for -Os.
17675
17676 -mRcq
17677 Enable Rcq constraint handling. Most short code generation depends
17678 on this. This is the default.
17679
17680 -mRcw
17681 Enable Rcw constraint handling. Most ccfsm condexec mostly depends
17682 on this. This is the default.
17683
17684 -msize-level=level
17685 Fine-tune size optimization with regards to instruction lengths and
17686 alignment. The recognized values for level are:
17687
17688 0 No size optimization. This level is deprecated and treated
17689 like 1.
17690
17691 1 Short instructions are used opportunistically.
17692
17693 2 In addition, alignment of loops and of code after barriers are
17694 dropped.
17695
17696 3 In addition, optional data alignment is dropped, and the option
17697 Os is enabled.
17698
17699 This defaults to 3 when -Os is in effect. Otherwise, the behavior
17700 when this is not set is equivalent to level 1.
17701
17702 -mtune=cpu
17703 Set instruction scheduling parameters for cpu, overriding any
17704 implied by -mcpu=.
17705
17706 Supported values for cpu are
17707
17708 ARC600
17709 Tune for ARC600 CPU.
17710
17711 ARC601
17712 Tune for ARC601 CPU.
17713
17714 ARC700
17715 Tune for ARC700 CPU with standard multiplier block.
17716
17717 ARC700-xmac
17718 Tune for ARC700 CPU with XMAC block.
17719
17720 ARC725D
17721 Tune for ARC725D CPU.
17722
17723 ARC750D
17724 Tune for ARC750D CPU.
17725
17726 -mmultcost=num
17727 Cost to assume for a multiply instruction, with 4 being equal to a
17728 normal instruction.
17729
17730 -munalign-prob-threshold=probability
17731 Does nothing. Preserved for backward compatibility.
17732
17733 The following options are maintained for backward compatibility, but
17734 are now deprecated and will be removed in a future release:
17735
17736 -margonaut
17737 Obsolete FPX.
17738
17739 -mbig-endian
17740 -EB Compile code for big-endian targets. Use of these options is now
17741 deprecated. Big-endian code is supported by configuring GCC to
17742 build "arceb-elf32" and "arceb-linux-uclibc" targets, for which big
17743 endian is the default.
17744
17745 -mlittle-endian
17746 -EL Compile code for little-endian targets. Use of these options is
17747 now deprecated. Little-endian code is supported by configuring GCC
17748 to build "arc-elf32" and "arc-linux-uclibc" targets, for which
17749 little endian is the default.
17750
17751 -mbarrel_shifter
17752 Replaced by -mbarrel-shifter.
17753
17754 -mdpfp_compact
17755 Replaced by -mdpfp-compact.
17756
17757 -mdpfp_fast
17758 Replaced by -mdpfp-fast.
17759
17760 -mdsp_packa
17761 Replaced by -mdsp-packa.
17762
17763 -mEA
17764 Replaced by -mea.
17765
17766 -mmac_24
17767 Replaced by -mmac-24.
17768
17769 -mmac_d16
17770 Replaced by -mmac-d16.
17771
17772 -mspfp_compact
17773 Replaced by -mspfp-compact.
17774
17775 -mspfp_fast
17776 Replaced by -mspfp-fast.
17777
17778 -mtune=cpu
17779 Values arc600, arc601, arc700 and arc700-xmac for cpu are replaced
17780 by ARC600, ARC601, ARC700 and ARC700-xmac respectively.
17781
17782 -multcost=num
17783 Replaced by -mmultcost.
17784
17785 ARM Options
17786
17787 These -m options are defined for the ARM port:
17788
17789 -mabi=name
17790 Generate code for the specified ABI. Permissible values are: apcs-
17791 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
17792
17793 -mapcs-frame
17794 Generate a stack frame that is compliant with the ARM Procedure
17795 Call Standard for all functions, even if this is not strictly
17796 necessary for correct execution of the code. Specifying
17797 -fomit-frame-pointer with this option causes the stack frames not
17798 to be generated for leaf functions. The default is
17799 -mno-apcs-frame. This option is deprecated.
17800
17801 -mapcs
17802 This is a synonym for -mapcs-frame and is deprecated.
17803
17804 -mthumb-interwork
17805 Generate code that supports calling between the ARM and Thumb
17806 instruction sets. Without this option, on pre-v5 architectures,
17807 the two instruction sets cannot be reliably used inside one
17808 program. The default is -mno-thumb-interwork, since slightly
17809 larger code is generated when -mthumb-interwork is specified. In
17810 AAPCS configurations this option is meaningless.
17811
17812 -mno-sched-prolog
17813 Prevent the reordering of instructions in the function prologue, or
17814 the merging of those instruction with the instructions in the
17815 function's body. This means that all functions start with a
17816 recognizable set of instructions (or in fact one of a choice from a
17817 small set of different function prologues), and this information
17818 can be used to locate the start of functions inside an executable
17819 piece of code. The default is -msched-prolog.
17820
17821 -mfloat-abi=name
17822 Specifies which floating-point ABI to use. Permissible values are:
17823 soft, softfp and hard.
17824
17825 Specifying soft causes GCC to generate output containing library
17826 calls for floating-point operations. softfp allows the generation
17827 of code using hardware floating-point instructions, but still uses
17828 the soft-float calling conventions. hard allows generation of
17829 floating-point instructions and uses FPU-specific calling
17830 conventions.
17831
17832 The default depends on the specific target configuration. Note
17833 that the hard-float and soft-float ABIs are not link-compatible;
17834 you must compile your entire program with the same ABI, and link
17835 with a compatible set of libraries.
17836
17837 -mgeneral-regs-only
17838 Generate code which uses only the general-purpose registers. This
17839 will prevent the compiler from using floating-point and Advanced
17840 SIMD registers but will not impose any restrictions on the
17841 assembler.
17842
17843 -mlittle-endian
17844 Generate code for a processor running in little-endian mode. This
17845 is the default for all standard configurations.
17846
17847 -mbig-endian
17848 Generate code for a processor running in big-endian mode; the
17849 default is to compile code for a little-endian processor.
17850
17851 -mbe8
17852 -mbe32
17853 When linking a big-endian image select between BE8 and BE32
17854 formats. The option has no effect for little-endian images and is
17855 ignored. The default is dependent on the selected target
17856 architecture. For ARMv6 and later architectures the default is
17857 BE8, for older architectures the default is BE32. BE32 format has
17858 been deprecated by ARM.
17859
17860 -march=name[+extension...]
17861 This specifies the name of the target ARM architecture. GCC uses
17862 this name to determine what kind of instructions it can emit when
17863 generating assembly code. This option can be used in conjunction
17864 with or instead of the -mcpu= option.
17865
17866 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
17867 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
17868 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
17869 armv8.6-a, armv9-a, armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m,
17870 armv7e-m, armv8-m.base, armv8-m.main, armv8.1-m.main, armv9-a,
17871 iwmmxt and iwmmxt2.
17872
17873 Additionally, the following architectures, which lack support for
17874 the Thumb execution state, are recognized but support is
17875 deprecated: armv4.
17876
17877 Many of the architectures support extensions. These can be added
17878 by appending +extension to the architecture name. Extension
17879 options are processed in order and capabilities accumulate. An
17880 extension will also enable any necessary base extensions upon which
17881 it depends. For example, the +crypto extension will always enable
17882 the +simd extension. The exception to the additive construction is
17883 for extensions that are prefixed with +no...: these extensions
17884 disable the specified option and any other extensions that may
17885 depend on the presence of that extension.
17886
17887 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
17888 writing -march=armv7-a+vfpv4 since the +simd option is entirely
17889 disabled by the +nofp option that follows it.
17890
17891 Most extension names are generically named, but have an effect that
17892 is dependent upon the architecture to which it is applied. For
17893 example, the +simd option can be applied to both armv7-a and
17894 armv8-a architectures, but will enable the original ARMv7-A
17895 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
17896 for armv8-a.
17897
17898 The table below lists the supported extensions for each
17899 architecture. Architectures not mentioned do not support any
17900 extensions.
17901
17902 armv5te
17903 armv6
17904 armv6j
17905 armv6k
17906 armv6kz
17907 armv6t2
17908 armv6z
17909 armv6zk
17910 +fp The VFPv2 floating-point instructions. The extension
17911 +vfpv2 can be used as an alias for this extension.
17912
17913 +nofp
17914 Disable the floating-point instructions.
17915
17916 armv7
17917 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
17918 architectures.
17919
17920 +fp The VFPv3 floating-point instructions, with 16 double-
17921 precision registers. The extension +vfpv3-d16 can be used
17922 as an alias for this extension. Note that floating-point
17923 is not supported by the base ARMv7-M architecture, but is
17924 compatible with both the ARMv7-A and ARMv7-R architectures.
17925
17926 +nofp
17927 Disable the floating-point instructions.
17928
17929 armv7-a
17930 +mp The multiprocessing extension.
17931
17932 +sec
17933 The security extension.
17934
17935 +fp The VFPv3 floating-point instructions, with 16 double-
17936 precision registers. The extension +vfpv3-d16 can be used
17937 as an alias for this extension.
17938
17939 +simd
17940 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17941 instructions. The extensions +neon and +neon-vfpv3 can be
17942 used as aliases for this extension.
17943
17944 +vfpv3
17945 The VFPv3 floating-point instructions, with 32 double-
17946 precision registers.
17947
17948 +vfpv3-d16-fp16
17949 The VFPv3 floating-point instructions, with 16 double-
17950 precision registers and the half-precision floating-point
17951 conversion operations.
17952
17953 +vfpv3-fp16
17954 The VFPv3 floating-point instructions, with 32 double-
17955 precision registers and the half-precision floating-point
17956 conversion operations.
17957
17958 +vfpv4-d16
17959 The VFPv4 floating-point instructions, with 16 double-
17960 precision registers.
17961
17962 +vfpv4
17963 The VFPv4 floating-point instructions, with 32 double-
17964 precision registers.
17965
17966 +neon-fp16
17967 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
17968 instructions, with the half-precision floating-point
17969 conversion operations.
17970
17971 +neon-vfpv4
17972 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17973 instructions.
17974
17975 +nosimd
17976 Disable the Advanced SIMD instructions (does not disable
17977 floating point).
17978
17979 +nofp
17980 Disable the floating-point and Advanced SIMD instructions.
17981
17982 armv7ve
17983 The extended version of the ARMv7-A architecture with support
17984 for virtualization.
17985
17986 +fp The VFPv4 floating-point instructions, with 16 double-
17987 precision registers. The extension +vfpv4-d16 can be used
17988 as an alias for this extension.
17989
17990 +simd
17991 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
17992 instructions. The extension +neon-vfpv4 can be used as an
17993 alias for this extension.
17994
17995 +vfpv3-d16
17996 The VFPv3 floating-point instructions, with 16 double-
17997 precision registers.
17998
17999 +vfpv3
18000 The VFPv3 floating-point instructions, with 32 double-
18001 precision registers.
18002
18003 +vfpv3-d16-fp16
18004 The VFPv3 floating-point instructions, with 16 double-
18005 precision registers and the half-precision floating-point
18006 conversion operations.
18007
18008 +vfpv3-fp16
18009 The VFPv3 floating-point instructions, with 32 double-
18010 precision registers and the half-precision floating-point
18011 conversion operations.
18012
18013 +vfpv4-d16
18014 The VFPv4 floating-point instructions, with 16 double-
18015 precision registers.
18016
18017 +vfpv4
18018 The VFPv4 floating-point instructions, with 32 double-
18019 precision registers.
18020
18021 +neon
18022 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
18023 instructions. The extension +neon-vfpv3 can be used as an
18024 alias for this extension.
18025
18026 +neon-fp16
18027 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
18028 instructions, with the half-precision floating-point
18029 conversion operations.
18030
18031 +nosimd
18032 Disable the Advanced SIMD instructions (does not disable
18033 floating point).
18034
18035 +nofp
18036 Disable the floating-point and Advanced SIMD instructions.
18037
18038 armv8-a
18039 +crc
18040 The Cyclic Redundancy Check (CRC) instructions.
18041
18042 +simd
18043 The ARMv8-A Advanced SIMD and floating-point instructions.
18044
18045 +crypto
18046 The cryptographic instructions.
18047
18048 +nocrypto
18049 Disable the cryptographic instructions.
18050
18051 +nofp
18052 Disable the floating-point, Advanced SIMD and cryptographic
18053 instructions.
18054
18055 +sb Speculation Barrier Instruction.
18056
18057 +predres
18058 Execution and Data Prediction Restriction Instructions.
18059
18060 armv8.1-a
18061 +simd
18062 The ARMv8.1-A Advanced SIMD and floating-point
18063 instructions.
18064
18065 +crypto
18066 The cryptographic instructions. This also enables the
18067 Advanced SIMD and floating-point instructions.
18068
18069 +nocrypto
18070 Disable the cryptographic instructions.
18071
18072 +nofp
18073 Disable the floating-point, Advanced SIMD and cryptographic
18074 instructions.
18075
18076 +sb Speculation Barrier Instruction.
18077
18078 +predres
18079 Execution and Data Prediction Restriction Instructions.
18080
18081 armv8.2-a
18082 armv8.3-a
18083 +fp16
18084 The half-precision floating-point data processing
18085 instructions. This also enables the Advanced SIMD and
18086 floating-point instructions.
18087
18088 +fp16fml
18089 The half-precision floating-point fmla extension. This
18090 also enables the half-precision floating-point extension
18091 and Advanced SIMD and floating-point instructions.
18092
18093 +simd
18094 The ARMv8.1-A Advanced SIMD and floating-point
18095 instructions.
18096
18097 +crypto
18098 The cryptographic instructions. This also enables the
18099 Advanced SIMD and floating-point instructions.
18100
18101 +dotprod
18102 Enable the Dot Product extension. This also enables
18103 Advanced SIMD instructions.
18104
18105 +nocrypto
18106 Disable the cryptographic extension.
18107
18108 +nofp
18109 Disable the floating-point, Advanced SIMD and cryptographic
18110 instructions.
18111
18112 +sb Speculation Barrier Instruction.
18113
18114 +predres
18115 Execution and Data Prediction Restriction Instructions.
18116
18117 +i8mm
18118 8-bit Integer Matrix Multiply instructions. This also
18119 enables Advanced SIMD and floating-point instructions.
18120
18121 +bf16
18122 Brain half-precision floating-point instructions. This
18123 also enables Advanced SIMD and floating-point instructions.
18124
18125 armv8.4-a
18126 +fp16
18127 The half-precision floating-point data processing
18128 instructions. This also enables the Advanced SIMD and
18129 floating-point instructions as well as the Dot Product
18130 extension and the half-precision floating-point fmla
18131 extension.
18132
18133 +simd
18134 The ARMv8.3-A Advanced SIMD and floating-point instructions
18135 as well as the Dot Product extension.
18136
18137 +crypto
18138 The cryptographic instructions. This also enables the
18139 Advanced SIMD and floating-point instructions as well as
18140 the Dot Product extension.
18141
18142 +nocrypto
18143 Disable the cryptographic extension.
18144
18145 +nofp
18146 Disable the floating-point, Advanced SIMD and cryptographic
18147 instructions.
18148
18149 +sb Speculation Barrier Instruction.
18150
18151 +predres
18152 Execution and Data Prediction Restriction Instructions.
18153
18154 +i8mm
18155 8-bit Integer Matrix Multiply instructions. This also
18156 enables Advanced SIMD and floating-point instructions.
18157
18158 +bf16
18159 Brain half-precision floating-point instructions. This
18160 also enables Advanced SIMD and floating-point instructions.
18161
18162 armv8.5-a
18163 +fp16
18164 The half-precision floating-point data processing
18165 instructions. This also enables the Advanced SIMD and
18166 floating-point instructions as well as the Dot Product
18167 extension and the half-precision floating-point fmla
18168 extension.
18169
18170 +simd
18171 The ARMv8.3-A Advanced SIMD and floating-point instructions
18172 as well as the Dot Product extension.
18173
18174 +crypto
18175 The cryptographic instructions. This also enables the
18176 Advanced SIMD and floating-point instructions as well as
18177 the Dot Product extension.
18178
18179 +nocrypto
18180 Disable the cryptographic extension.
18181
18182 +nofp
18183 Disable the floating-point, Advanced SIMD and cryptographic
18184 instructions.
18185
18186 +i8mm
18187 8-bit Integer Matrix Multiply instructions. This also
18188 enables Advanced SIMD and floating-point instructions.
18189
18190 +bf16
18191 Brain half-precision floating-point instructions. This
18192 also enables Advanced SIMD and floating-point instructions.
18193
18194 armv8.6-a
18195 +fp16
18196 The half-precision floating-point data processing
18197 instructions. This also enables the Advanced SIMD and
18198 floating-point instructions as well as the Dot Product
18199 extension and the half-precision floating-point fmla
18200 extension.
18201
18202 +simd
18203 The ARMv8.3-A Advanced SIMD and floating-point instructions
18204 as well as the Dot Product extension.
18205
18206 +crypto
18207 The cryptographic instructions. This also enables the
18208 Advanced SIMD and floating-point instructions as well as
18209 the Dot Product extension.
18210
18211 +nocrypto
18212 Disable the cryptographic extension.
18213
18214 +nofp
18215 Disable the floating-point, Advanced SIMD and cryptographic
18216 instructions.
18217
18218 +i8mm
18219 8-bit Integer Matrix Multiply instructions. This also
18220 enables Advanced SIMD and floating-point instructions.
18221
18222 +bf16
18223 Brain half-precision floating-point instructions. This
18224 also enables Advanced SIMD and floating-point instructions.
18225
18226 armv7-r
18227 +fp.sp
18228 The single-precision VFPv3 floating-point instructions.
18229 The extension +vfpv3xd can be used as an alias for this
18230 extension.
18231
18232 +fp The VFPv3 floating-point instructions with 16 double-
18233 precision registers. The extension +vfpv3-d16 can be used
18234 as an alias for this extension.
18235
18236 +vfpv3xd-d16-fp16
18237 The single-precision VFPv3 floating-point instructions with
18238 16 double-precision registers and the half-precision
18239 floating-point conversion operations.
18240
18241 +vfpv3-d16-fp16
18242 The VFPv3 floating-point instructions with 16 double-
18243 precision registers and the half-precision floating-point
18244 conversion operations.
18245
18246 +nofp
18247 Disable the floating-point extension.
18248
18249 +idiv
18250 The ARM-state integer division instructions.
18251
18252 +noidiv
18253 Disable the ARM-state integer division extension.
18254
18255 armv7e-m
18256 +fp The single-precision VFPv4 floating-point instructions.
18257
18258 +fpv5
18259 The single-precision FPv5 floating-point instructions.
18260
18261 +fp.dp
18262 The single- and double-precision FPv5 floating-point
18263 instructions.
18264
18265 +nofp
18266 Disable the floating-point extensions.
18267
18268 armv8.1-m.main
18269 +dsp
18270 The DSP instructions.
18271
18272 +mve
18273 The M-Profile Vector Extension (MVE) integer instructions.
18274
18275 +mve.fp
18276 The M-Profile Vector Extension (MVE) integer and single
18277 precision floating-point instructions.
18278
18279 +fp The single-precision floating-point instructions.
18280
18281 +fp.dp
18282 The single- and double-precision floating-point
18283 instructions.
18284
18285 +nofp
18286 Disable the floating-point extension.
18287
18288 +cdecp0, +cdecp1, ... , +cdecp7
18289 Enable the Custom Datapath Extension (CDE) on selected
18290 coprocessors according to the numbers given in the options
18291 in the range 0 to 7.
18292
18293 armv8-m.main
18294 +dsp
18295 The DSP instructions.
18296
18297 +nodsp
18298 Disable the DSP extension.
18299
18300 +fp The single-precision floating-point instructions.
18301
18302 +fp.dp
18303 The single- and double-precision floating-point
18304 instructions.
18305
18306 +nofp
18307 Disable the floating-point extension.
18308
18309 +cdecp0, +cdecp1, ... , +cdecp7
18310 Enable the Custom Datapath Extension (CDE) on selected
18311 coprocessors according to the numbers given in the options
18312 in the range 0 to 7.
18313
18314 armv8-r
18315 +crc
18316 The Cyclic Redundancy Check (CRC) instructions.
18317
18318 +fp.sp
18319 The single-precision FPv5 floating-point instructions.
18320
18321 +simd
18322 The ARMv8-A Advanced SIMD and floating-point instructions.
18323
18324 +crypto
18325 The cryptographic instructions.
18326
18327 +nocrypto
18328 Disable the cryptographic instructions.
18329
18330 +nofp
18331 Disable the floating-point, Advanced SIMD and cryptographic
18332 instructions.
18333
18334 -march=native causes the compiler to auto-detect the architecture
18335 of the build computer. At present, this feature is only supported
18336 on GNU/Linux, and not all architectures are recognized. If the
18337 auto-detect is unsuccessful the option has no effect.
18338
18339 -mtune=name
18340 This option specifies the name of the target ARM processor for
18341 which GCC should tune the performance of the code. For some ARM
18342 implementations better performance can be obtained by using this
18343 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
18344 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
18345 strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t, arm922t,
18346 arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t, arm9tdmi,
18347 arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e, arm1022e,
18348 arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp, arm1156t2-s,
18349 arm1156t2f-s, arm1176jz-s, arm1176jzf-s, generic-armv7-a,
18350 cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
18351 cortex-a17, cortex-a32, cortex-a35, cortex-a53, cortex-a55,
18352 cortex-a57, cortex-a72, cortex-a73, cortex-a75, cortex-a76,
18353 cortex-a76ae, cortex-a77, cortex-a78, cortex-a78ae, cortex-a78c,
18354 cortex-a710, ares, cortex-r4, cortex-r4f, cortex-r5, cortex-r7,
18355 cortex-r8, cortex-r52, cortex-r52plus, cortex-m0, cortex-m0plus,
18356 cortex-m1, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33,
18357 cortex-m35p, cortex-m55, cortex-x1, cortex-m1.small-multiply,
18358 cortex-m0.small-multiply, cortex-m0plus.small-multiply, exynos-m1,
18359 marvell-pj4, neoverse-n1, neoverse-n2, neoverse-v1, xscale, iwmmxt,
18360 iwmmxt2, ep9312, fa526, fa626, fa606te, fa626te, fmp626, fa726te,
18361 xgene1.
18362
18363 Additionally, this option can specify that GCC should tune the
18364 performance of the code for a big.LITTLE system. Permissible names
18365 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
18366 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
18367 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
18368 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
18369
18370 -mtune=generic-arch specifies that GCC should tune the performance
18371 for a blend of processors within architecture arch. The aim is to
18372 generate code that run well on the current most popular processors,
18373 balancing between optimizations that benefit some CPUs in the
18374 range, and avoiding performance pitfalls of other CPUs. The
18375 effects of this option may change in future GCC versions as CPU
18376 models come and go.
18377
18378 -mtune permits the same extension options as -mcpu, but the
18379 extension options do not affect the tuning of the generated code.
18380
18381 -mtune=native causes the compiler to auto-detect the CPU of the
18382 build computer. At present, this feature is only supported on
18383 GNU/Linux, and not all architectures are recognized. If the auto-
18384 detect is unsuccessful the option has no effect.
18385
18386 -mcpu=name[+extension...]
18387 This specifies the name of the target ARM processor. GCC uses this
18388 name to derive the name of the target ARM architecture (as if
18389 specified by -march) and the ARM processor type for which to tune
18390 for performance (as if specified by -mtune). Where this option is
18391 used in conjunction with -march or -mtune, those options take
18392 precedence over the appropriate part of this option.
18393
18394 Many of the supported CPUs implement optional architectural
18395 extensions. Where this is so the architectural extensions are
18396 normally enabled by default. If implementations that lack the
18397 extension exist, then the extension syntax can be used to disable
18398 those extensions that have been omitted. For floating-point and
18399 Advanced SIMD (Neon) instructions, the settings of the options
18400 -mfloat-abi and -mfpu must also be considered: floating-point and
18401 Advanced SIMD instructions will only be used if -mfloat-abi is not
18402 set to soft; and any setting of -mfpu other than auto will override
18403 the available floating-point and SIMD extension instructions.
18404
18405 For example, cortex-a9 can be found in three major configurations:
18406 integer only, with just a floating-point unit or with floating-
18407 point and Advanced SIMD. The default is to enable all the
18408 instructions, but the extensions +nosimd and +nofp can be used to
18409 disable just the SIMD or both the SIMD and floating-point
18410 instructions respectively.
18411
18412 Permissible names for this option are the same as those for -mtune.
18413
18414 The following extension options are common to the listed CPUs:
18415
18416 +nodsp
18417 Disable the DSP instructions on cortex-m33, cortex-m35p.
18418
18419 +nofp
18420 Disables the floating-point instructions on arm9e, arm946e-s,
18421 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
18422 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
18423 cortex-m7, cortex-m33 and cortex-m35p. Disables the floating-
18424 point and SIMD instructions on generic-armv7-a, cortex-a5,
18425 cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
18426 cortex-a17, cortex-a15.cortex-a7, cortex-a17.cortex-a7,
18427 cortex-a32, cortex-a35, cortex-a53 and cortex-a55.
18428
18429 +nofp.dp
18430 Disables the double-precision component of the floating-point
18431 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52,
18432 cortex-r52plus and cortex-m7.
18433
18434 +nosimd
18435 Disables the SIMD (but not floating-point) instructions on
18436 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
18437
18438 +crypto
18439 Enables the cryptographic instructions on cortex-a32,
18440 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
18441 cortex-a73, cortex-a75, exynos-m1, xgene1,
18442 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
18443 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
18444 cortex-a75.cortex-a55.
18445
18446 Additionally the generic-armv7-a pseudo target defaults to VFPv3
18447 with 16 double-precision registers. It supports the following
18448 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
18449 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
18450 neon-vfpv4. The meanings are the same as for the extensions to
18451 -march=armv7-a.
18452
18453 -mcpu=generic-arch is also permissible, and is equivalent to
18454 -march=arch -mtune=generic-arch. See -mtune for more information.
18455
18456 -mcpu=native causes the compiler to auto-detect the CPU of the
18457 build computer. At present, this feature is only supported on
18458 GNU/Linux, and not all architectures are recognized. If the auto-
18459 detect is unsuccessful the option has no effect.
18460
18461 -mfpu=name
18462 This specifies what floating-point hardware (or hardware emulation)
18463 is available on the target. Permissible names are: auto, vfpv2,
18464 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
18465 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
18466 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
18467 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
18468 and vfp is an alias for vfpv2.
18469
18470 The setting auto is the default and is special. It causes the
18471 compiler to select the floating-point and Advanced SIMD
18472 instructions based on the settings of -mcpu and -march.
18473
18474 If the selected floating-point hardware includes the NEON extension
18475 (e.g. -mfpu=neon), note that floating-point operations are not
18476 generated by GCC's auto-vectorization pass unless
18477 -funsafe-math-optimizations is also specified. This is because
18478 NEON hardware does not fully implement the IEEE 754 standard for
18479 floating-point arithmetic (in particular denormal values are
18480 treated as zero), so the use of NEON instructions may lead to a
18481 loss of precision.
18482
18483 You can also set the fpu name at function level by using the
18484 "target("fpu=")" function attributes or pragmas.
18485
18486 -mfp16-format=name
18487 Specify the format of the "__fp16" half-precision floating-point
18488 type. Permissible names are none, ieee, and alternative; the
18489 default is none, in which case the "__fp16" type is not defined.
18490
18491 -mstructure-size-boundary=n
18492 The sizes of all structures and unions are rounded up to a multiple
18493 of the number of bits set by this option. Permissible values are
18494 8, 32 and 64. The default value varies for different toolchains.
18495 For the COFF targeted toolchain the default value is 8. A value of
18496 64 is only allowed if the underlying ABI supports it.
18497
18498 Specifying a larger number can produce faster, more efficient code,
18499 but can also increase the size of the program. Different values
18500 are potentially incompatible. Code compiled with one value cannot
18501 necessarily expect to work with code or libraries compiled with
18502 another value, if they exchange information using structures or
18503 unions.
18504
18505 This option is deprecated.
18506
18507 -mabort-on-noreturn
18508 Generate a call to the function "abort" at the end of a "noreturn"
18509 function. It is executed if the function tries to return.
18510
18511 -mlong-calls
18512 -mno-long-calls
18513 Tells the compiler to perform function calls by first loading the
18514 address of the function into a register and then performing a
18515 subroutine call on this register. This switch is needed if the
18516 target function lies outside of the 64-megabyte addressing range of
18517 the offset-based version of subroutine call instruction.
18518
18519 Even if this switch is enabled, not all function calls are turned
18520 into long calls. The heuristic is that static functions, functions
18521 that have the "short_call" attribute, functions that are inside the
18522 scope of a "#pragma no_long_calls" directive, and functions whose
18523 definitions have already been compiled within the current
18524 compilation unit are not turned into long calls. The exceptions to
18525 this rule are that weak function definitions, functions with the
18526 "long_call" attribute or the "section" attribute, and functions
18527 that are within the scope of a "#pragma long_calls" directive are
18528 always turned into long calls.
18529
18530 This feature is not enabled by default. Specifying -mno-long-calls
18531 restores the default behavior, as does placing the function calls
18532 within the scope of a "#pragma long_calls_off" directive. Note
18533 these switches have no effect on how the compiler generates code to
18534 handle function calls via function pointers.
18535
18536 -msingle-pic-base
18537 Treat the register used for PIC addressing as read-only, rather
18538 than loading it in the prologue for each function. The runtime
18539 system is responsible for initializing this register with an
18540 appropriate value before execution begins.
18541
18542 -mpic-register=reg
18543 Specify the register to be used for PIC addressing. For standard
18544 PIC base case, the default is any suitable register determined by
18545 compiler. For single PIC base case, the default is R9 if target is
18546 EABI based or stack-checking is enabled, otherwise the default is
18547 R10.
18548
18549 -mpic-data-is-text-relative
18550 Assume that the displacement between the text and data segments is
18551 fixed at static link time. This permits using PC-relative
18552 addressing operations to access data known to be in the data
18553 segment. For non-VxWorks RTP targets, this option is enabled by
18554 default. When disabled on such targets, it will enable
18555 -msingle-pic-base by default.
18556
18557 -mpoke-function-name
18558 Write the name of each function into the text section, directly
18559 preceding the function prologue. The generated code is similar to
18560 this:
18561
18562 t0
18563 .ascii "arm_poke_function_name", 0
18564 .align
18565 t1
18566 .word 0xff000000 + (t1 - t0)
18567 arm_poke_function_name
18568 mov ip, sp
18569 stmfd sp!, {fp, ip, lr, pc}
18570 sub fp, ip, #4
18571
18572 When performing a stack backtrace, code can inspect the value of
18573 "pc" stored at "fp + 0". If the trace function then looks at
18574 location "pc - 12" and the top 8 bits are set, then we know that
18575 there is a function name embedded immediately preceding this
18576 location and has length "((pc[-3]) & 0xff000000)".
18577
18578 -mthumb
18579 -marm
18580 Select between generating code that executes in ARM and Thumb
18581 states. The default for most configurations is to generate code
18582 that executes in ARM state, but the default can be changed by
18583 configuring GCC with the --with-mode=state configure option.
18584
18585 You can also override the ARM and Thumb mode for each function by
18586 using the "target("thumb")" and "target("arm")" function attributes
18587 or pragmas.
18588
18589 -mflip-thumb
18590 Switch ARM/Thumb modes on alternating functions. This option is
18591 provided for regression testing of mixed Thumb/ARM code generation,
18592 and is not intended for ordinary use in compiling code.
18593
18594 -mtpcs-frame
18595 Generate a stack frame that is compliant with the Thumb Procedure
18596 Call Standard for all non-leaf functions. (A leaf function is one
18597 that does not call any other functions.) The default is
18598 -mno-tpcs-frame.
18599
18600 -mtpcs-leaf-frame
18601 Generate a stack frame that is compliant with the Thumb Procedure
18602 Call Standard for all leaf functions. (A leaf function is one that
18603 does not call any other functions.) The default is
18604 -mno-apcs-leaf-frame.
18605
18606 -mcallee-super-interworking
18607 Gives all externally visible functions in the file being compiled
18608 an ARM instruction set header which switches to Thumb mode before
18609 executing the rest of the function. This allows these functions to
18610 be called from non-interworking code. This option is not valid in
18611 AAPCS configurations because interworking is enabled by default.
18612
18613 -mcaller-super-interworking
18614 Allows calls via function pointers (including virtual functions) to
18615 execute correctly regardless of whether the target code has been
18616 compiled for interworking or not. There is a small overhead in the
18617 cost of executing a function pointer if this option is enabled.
18618 This option is not valid in AAPCS configurations because
18619 interworking is enabled by default.
18620
18621 -mtp=name
18622 Specify the access model for the thread local storage pointer. The
18623 valid models are soft, which generates calls to "__aeabi_read_tp",
18624 cp15, which fetches the thread pointer from "cp15" directly
18625 (supported in the arm6k architecture), and auto, which uses the
18626 best available method for the selected processor. The default
18627 setting is auto.
18628
18629 -mtls-dialect=dialect
18630 Specify the dialect to use for accessing thread local storage. Two
18631 dialects are supported---gnu and gnu2. The gnu dialect selects the
18632 original GNU scheme for supporting local and global dynamic TLS
18633 models. The gnu2 dialect selects the GNU descriptor scheme, which
18634 provides better performance for shared libraries. The GNU
18635 descriptor scheme is compatible with the original scheme, but does
18636 require new assembler, linker and library support. Initial and
18637 local exec TLS models are unaffected by this option and always use
18638 the original scheme.
18639
18640 -mword-relocations
18641 Only generate absolute relocations on word-sized values (i.e.
18642 R_ARM_ABS32). This is enabled by default on targets (uClinux,
18643 SymbianOS) where the runtime loader imposes this restriction, and
18644 when -fpic or -fPIC is specified. This option conflicts with
18645 -mslow-flash-data.
18646
18647 -mfix-cortex-m3-ldrd
18648 Some Cortex-M3 cores can cause data corruption when "ldrd"
18649 instructions with overlapping destination and base registers are
18650 used. This option avoids generating these instructions. This
18651 option is enabled by default when -mcpu=cortex-m3 is specified.
18652
18653 -mfix-cortex-a57-aes-1742098
18654 -mno-fix-cortex-a57-aes-1742098
18655 -mfix-cortex-a72-aes-1655431
18656 -mno-fix-cortex-a72-aes-1655431
18657 Enable (disable) mitigation for an erratum on Cortex-A57 and
18658 Cortex-A72 that affects the AES cryptographic instructions. This
18659 option is enabled by default when either -mcpu=cortex-a57 or
18660 -mcpu=cortex-a72 is specified.
18661
18662 -munaligned-access
18663 -mno-unaligned-access
18664 Enables (or disables) reading and writing of 16- and 32- bit values
18665 from addresses that are not 16- or 32- bit aligned. By default
18666 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
18667 ARMv8-M Baseline architectures, and enabled for all other
18668 architectures. If unaligned access is not enabled then words in
18669 packed data structures are accessed a byte at a time.
18670
18671 The ARM attribute "Tag_CPU_unaligned_access" is set in the
18672 generated object file to either true or false, depending upon the
18673 setting of this option. If unaligned access is enabled then the
18674 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
18675
18676 -mneon-for-64bits
18677 This option is deprecated and has no effect.
18678
18679 -mslow-flash-data
18680 Assume loading data from flash is slower than fetching instruction.
18681 Therefore literal load is minimized for better performance. This
18682 option is only supported when compiling for ARMv7 M-profile and off
18683 by default. It conflicts with -mword-relocations.
18684
18685 -masm-syntax-unified
18686 Assume inline assembler is using unified asm syntax. The default
18687 is currently off which implies divided syntax. This option has no
18688 impact on Thumb2. However, this may change in future releases of
18689 GCC. Divided syntax should be considered deprecated.
18690
18691 -mrestrict-it
18692 Restricts generation of IT blocks to conform to the rules of
18693 ARMv8-A. IT blocks can only contain a single 16-bit instruction
18694 from a select set of instructions. This option is on by default for
18695 ARMv8-A Thumb mode.
18696
18697 -mprint-tune-info
18698 Print CPU tuning information as comment in assembler file. This is
18699 an option used only for regression testing of the compiler and not
18700 intended for ordinary use in compiling code. This option is
18701 disabled by default.
18702
18703 -mverbose-cost-dump
18704 Enable verbose cost model dumping in the debug dump files. This
18705 option is provided for use in debugging the compiler.
18706
18707 -mpure-code
18708 Do not allow constant data to be placed in code sections.
18709 Additionally, when compiling for ELF object format give all text
18710 sections the ELF processor-specific section attribute
18711 "SHF_ARM_PURECODE". This option is only available when generating
18712 non-pic code for M-profile targets.
18713
18714 -mcmse
18715 Generate secure code as per the "ARMv8-M Security Extensions:
18716 Requirements on Development Tools Engineering Specification", which
18717 can be found on
18718 <https://developer.arm.com/documentation/ecm0359818/latest/>.
18719
18720 -mfix-cmse-cve-2021-35465
18721 Mitigate against a potential security issue with the "VLLDM"
18722 instruction in some M-profile devices when using CMSE
18723 (CVE-2021-365465). This option is enabled by default when the
18724 option -mcpu= is used with "cortex-m33", "cortex-m35p" or
18725 "cortex-m55". The option -mno-fix-cmse-cve-2021-35465 can be used
18726 to disable the mitigation.
18727
18728 -mstack-protector-guard=guard
18729 -mstack-protector-guard-offset=offset
18730 Generate stack protection code using canary at guard. Supported
18731 locations are global for a global canary or tls for a canary
18732 accessible via the TLS register. The option
18733 -mstack-protector-guard-offset= is for use with
18734 -fstack-protector-guard=tls and not for use in user-land code.
18735
18736 -mfdpic
18737 -mno-fdpic
18738 Select the FDPIC ABI, which uses 64-bit function descriptors to
18739 represent pointers to functions. When the compiler is configured
18740 for "arm-*-uclinuxfdpiceabi" targets, this option is on by default
18741 and implies -fPIE if none of the PIC/PIE-related options is
18742 provided. On other targets, it only enables the FDPIC-specific
18743 code generation features, and the user should explicitly provide
18744 the PIC/PIE-related options as needed.
18745
18746 Note that static linking is not supported because it would still
18747 involve the dynamic linker when the program self-relocates. If
18748 such behavior is acceptable, use -static and -Wl,-dynamic-linker
18749 options.
18750
18751 The opposite -mno-fdpic option is useful (and required) to build
18752 the Linux kernel using the same ("arm-*-uclinuxfdpiceabi")
18753 toolchain as the one used to build the userland programs.
18754
18755 AVR Options
18756
18757 These options are defined for AVR implementations:
18758
18759 -mmcu=mcu
18760 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18761
18762 The default for this option is avr2.
18763
18764 GCC supports the following AVR devices and ISAs:
18765
18766 "avr2"
18767 "Classic" devices with up to 8 KiB of program memory. mcu =
18768 "attiny22", "attiny26", "at90s2313", "at90s2323", "at90s2333",
18769 "at90s2343", "at90s4414", "at90s4433", "at90s4434",
18770 "at90c8534", "at90s8515", "at90s8535".
18771
18772 "avr25"
18773 "Classic" devices with up to 8 KiB of program memory and with
18774 the "MOVW" instruction. mcu = "attiny13", "attiny13a",
18775 "attiny24", "attiny24a", "attiny25", "attiny261", "attiny261a",
18776 "attiny2313", "attiny2313a", "attiny43u", "attiny44",
18777 "attiny44a", "attiny45", "attiny48", "attiny441", "attiny461",
18778 "attiny461a", "attiny4313", "attiny84", "attiny84a",
18779 "attiny85", "attiny87", "attiny88", "attiny828", "attiny841",
18780 "attiny861", "attiny861a", "ata5272", "ata6616c", "at86rf401".
18781
18782 "avr3"
18783 "Classic" devices with 16 KiB up to 64 KiB of program memory.
18784 mcu = "at76c711", "at43usb355".
18785
18786 "avr31"
18787 "Classic" devices with 128 KiB of program memory. mcu =
18788 "atmega103", "at43usb320".
18789
18790 "avr35"
18791 "Classic" devices with 16 KiB up to 64 KiB of program memory
18792 and with the "MOVW" instruction. mcu = "attiny167",
18793 "attiny1634", "atmega8u2", "atmega16u2", "atmega32u2",
18794 "ata5505", "ata6617c", "ata664251", "at90usb82", "at90usb162".
18795
18796 "avr4"
18797 "Enhanced" devices with up to 8 KiB of program memory. mcu =
18798 "atmega48", "atmega48a", "atmega48p", "atmega48pa",
18799 "atmega48pb", "atmega8", "atmega8a", "atmega8hva", "atmega88",
18800 "atmega88a", "atmega88p", "atmega88pa", "atmega88pb",
18801 "atmega8515", "atmega8535", "ata6285", "ata6286", "ata6289",
18802 "ata6612c", "at90pwm1", "at90pwm2", "at90pwm2b", "at90pwm3",
18803 "at90pwm3b", "at90pwm81".
18804
18805 "avr5"
18806 "Enhanced" devices with 16 KiB up to 64 KiB of program memory.
18807 mcu = "atmega16", "atmega16a", "atmega16hva", "atmega16hva2",
18808 "atmega16hvb", "atmega16hvbrevb", "atmega16m1", "atmega16u4",
18809 "atmega161", "atmega162", "atmega163", "atmega164a",
18810 "atmega164p", "atmega164pa", "atmega165", "atmega165a",
18811 "atmega165p", "atmega165pa", "atmega168", "atmega168a",
18812 "atmega168p", "atmega168pa", "atmega168pb", "atmega169",
18813 "atmega169a", "atmega169p", "atmega169pa", "atmega32",
18814 "atmega32a", "atmega32c1", "atmega32hvb", "atmega32hvbrevb",
18815 "atmega32m1", "atmega32u4", "atmega32u6", "atmega323",
18816 "atmega324a", "atmega324p", "atmega324pa", "atmega324pb",
18817 "atmega325", "atmega325a", "atmega325p", "atmega325pa",
18818 "atmega328", "atmega328p", "atmega328pb", "atmega329",
18819 "atmega329a", "atmega329p", "atmega329pa", "atmega3250",
18820 "atmega3250a", "atmega3250p", "atmega3250pa", "atmega3290",
18821 "atmega3290a", "atmega3290p", "atmega3290pa", "atmega406",
18822 "atmega64", "atmega64a", "atmega64c1", "atmega64hve",
18823 "atmega64hve2", "atmega64m1", "atmega64rfr2", "atmega640",
18824 "atmega644", "atmega644a", "atmega644p", "atmega644pa",
18825 "atmega644rfr2", "atmega645", "atmega645a", "atmega645p",
18826 "atmega649", "atmega649a", "atmega649p", "atmega6450",
18827 "atmega6450a", "atmega6450p", "atmega6490", "atmega6490a",
18828 "atmega6490p", "ata5795", "ata5790", "ata5790n", "ata5791",
18829 "ata6613c", "ata6614q", "ata5782", "ata5831", "ata8210",
18830 "ata8510", "ata5702m322", "at90pwm161", "at90pwm216",
18831 "at90pwm316", "at90can32", "at90can64", "at90scr100",
18832 "at90usb646", "at90usb647", "at94k", "m3000".
18833
18834 "avr51"
18835 "Enhanced" devices with 128 KiB of program memory. mcu =
18836 "atmega128", "atmega128a", "atmega128rfa1", "atmega128rfr2",
18837 "atmega1280", "atmega1281", "atmega1284", "atmega1284p",
18838 "atmega1284rfr2", "at90can128", "at90usb1286", "at90usb1287".
18839
18840 "avr6"
18841 "Enhanced" devices with 3-byte PC, i.e. with more than 128 KiB
18842 of program memory. mcu = "atmega256rfr2", "atmega2560",
18843 "atmega2561", "atmega2564rfr2".
18844
18845 "avrxmega2"
18846 "XMEGA" devices with more than 8 KiB and up to 64 KiB of
18847 program memory. mcu = "atxmega8e5", "atxmega16a4",
18848 "atxmega16a4u", "atxmega16c4", "atxmega16d4", "atxmega16e5",
18849 "atxmega32a4", "atxmega32a4u", "atxmega32c3", "atxmega32c4",
18850 "atxmega32d3", "atxmega32d4", "atxmega32e5".
18851
18852 "avrxmega3"
18853 "XMEGA" devices with up to 64 KiB of combined program memory
18854 and RAM, and with program memory visible in the RAM address
18855 space. mcu = "attiny202", "attiny204", "attiny212",
18856 "attiny214", "attiny402", "attiny404", "attiny406",
18857 "attiny412", "attiny414", "attiny416", "attiny417",
18858 "attiny804", "attiny806", "attiny807", "attiny814",
18859 "attiny816", "attiny817", "attiny1604", "attiny1606",
18860 "attiny1607", "attiny1614", "attiny1616", "attiny1617",
18861 "attiny3214", "attiny3216", "attiny3217", "atmega808",
18862 "atmega809", "atmega1608", "atmega1609", "atmega3208",
18863 "atmega3209", "atmega4808", "atmega4809".
18864
18865 "avrxmega4"
18866 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
18867 program memory. mcu = "atxmega64a3", "atxmega64a3u",
18868 "atxmega64a4u", "atxmega64b1", "atxmega64b3", "atxmega64c3",
18869 "atxmega64d3", "atxmega64d4".
18870
18871 "avrxmega5"
18872 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
18873 program memory and more than 64 KiB of RAM. mcu =
18874 "atxmega64a1", "atxmega64a1u".
18875
18876 "avrxmega6"
18877 "XMEGA" devices with more than 128 KiB of program memory. mcu
18878 = "atxmega128a3", "atxmega128a3u", "atxmega128b1",
18879 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
18880 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
18881 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
18882 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
18883 "atxmega256d3", "atxmega384c3", "atxmega384d3".
18884
18885 "avrxmega7"
18886 "XMEGA" devices with more than 128 KiB of program memory and
18887 more than 64 KiB of RAM. mcu = "atxmega128a1",
18888 "atxmega128a1u", "atxmega128a4u".
18889
18890 "avrtiny"
18891 "TINY" Tiny core devices with 512 B up to 4 KiB of program
18892 memory. mcu = "attiny4", "attiny5", "attiny9", "attiny10",
18893 "attiny20", "attiny40".
18894
18895 "avr1"
18896 This ISA is implemented by the minimal AVR core and supported
18897 for assembler only. mcu = "attiny11", "attiny12", "attiny15",
18898 "attiny28", "at90s1200".
18899
18900 -mabsdata
18901 Assume that all data in static storage can be accessed by LDS / STS
18902 instructions. This option has only an effect on reduced Tiny
18903 devices like ATtiny40. See also the "absdata" AVR Variable
18904 Attributes,variable attribute.
18905
18906 -maccumulate-args
18907 Accumulate outgoing function arguments and acquire/release the
18908 needed stack space for outgoing function arguments once in function
18909 prologue/epilogue. Without this option, outgoing arguments are
18910 pushed before calling a function and popped afterwards.
18911
18912 Popping the arguments after the function call can be expensive on
18913 AVR so that accumulating the stack space might lead to smaller
18914 executables because arguments need not be removed from the stack
18915 after such a function call.
18916
18917 This option can lead to reduced code size for functions that
18918 perform several calls to functions that get their arguments on the
18919 stack like calls to printf-like functions.
18920
18921 -mbranch-cost=cost
18922 Set the branch costs for conditional branch instructions to cost.
18923 Reasonable values for cost are small, non-negative integers. The
18924 default branch cost is 0.
18925
18926 -mcall-prologues
18927 Functions prologues/epilogues are expanded as calls to appropriate
18928 subroutines. Code size is smaller.
18929
18930 -mdouble=bits
18931 -mlong-double=bits
18932 Set the size (in bits) of the "double" or "long double" type,
18933 respectively. Possible values for bits are 32 and 64. Whether or
18934 not a specific value for bits is allowed depends on the
18935 "--with-double=" and "--with-long-double=" configure options
18936 ("https://gcc.gnu.org/install/configure.html#avr"), and the same
18937 applies for the default values of the options.
18938
18939 -mgas-isr-prologues
18940 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
18941 instruction supported by GNU Binutils. If this option is on, the
18942 feature can still be disabled for individual ISRs by means of the
18943 AVR Function Attributes,,"no_gccisr" function attribute. This
18944 feature is activated per default if optimization is on (but not
18945 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
18946 PR21683 ("https://sourceware.org/PR21683").
18947
18948 -mint8
18949 Assume "int" to be 8-bit integer. This affects the sizes of all
18950 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
18951 and "long long" is 4 bytes. Please note that this option does not
18952 conform to the C standards, but it results in smaller code size.
18953
18954 -mmain-is-OS_task
18955 Do not save registers in "main". The effect is the same like
18956 attaching attribute AVR Function Attributes,,"OS_task" to "main".
18957 It is activated per default if optimization is on.
18958
18959 -mn-flash=num
18960 Assume that the flash memory has a size of num times 64 KiB.
18961
18962 -mno-interrupts
18963 Generated code is not compatible with hardware interrupts. Code
18964 size is smaller.
18965
18966 -mrelax
18967 Try to replace "CALL" resp. "JMP" instruction by the shorter
18968 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
18969 just adds the --mlink-relax option to the assembler's command line
18970 and the --relax option to the linker's command line.
18971
18972 Jump relaxing is performed by the linker because jump offsets are
18973 not known before code is located. Therefore, the assembler code
18974 generated by the compiler is the same, but the instructions in the
18975 executable may differ from instructions in the assembler code.
18976
18977 Relaxing must be turned on if linker stubs are needed, see the
18978 section on "EIND" and linker stubs below.
18979
18980 -mrmw
18981 Assume that the device supports the Read-Modify-Write instructions
18982 "XCH", "LAC", "LAS" and "LAT".
18983
18984 -mshort-calls
18985 Assume that "RJMP" and "RCALL" can target the whole program memory.
18986
18987 This option is used internally for multilib selection. It is not
18988 an optimization option, and you don't need to set it by hand.
18989
18990 -msp8
18991 Treat the stack pointer register as an 8-bit register, i.e. assume
18992 the high byte of the stack pointer is zero. In general, you don't
18993 need to set this option by hand.
18994
18995 This option is used internally by the compiler to select and build
18996 multilibs for architectures "avr2" and "avr25". These
18997 architectures mix devices with and without "SPH". For any setting
18998 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
18999 removes this option from the compiler proper's command line,
19000 because the compiler then knows if the device or architecture has
19001 an 8-bit stack pointer and thus no "SPH" register or not.
19002
19003 -mstrict-X
19004 Use address register "X" in a way proposed by the hardware. This
19005 means that "X" is only used in indirect, post-increment or pre-
19006 decrement addressing.
19007
19008 Without this option, the "X" register may be used in the same way
19009 as "Y" or "Z" which then is emulated by additional instructions.
19010 For example, loading a value with "X+const" addressing with a small
19011 non-negative "const < 64" to a register Rn is performed as
19012
19013 adiw r26, const ; X += const
19014 ld <Rn>, X ; <Rn> = *X
19015 sbiw r26, const ; X -= const
19016
19017 -mtiny-stack
19018 Only change the lower 8 bits of the stack pointer.
19019
19020 -mfract-convert-truncate
19021 Allow to use truncation instead of rounding towards zero for
19022 fractional fixed-point types.
19023
19024 -nodevicelib
19025 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
19026
19027 -nodevicespecs
19028 Don't add -specs=device-specs/specs-mcu to the compiler driver's
19029 command line. The user takes responsibility for supplying the sub-
19030 processes like compiler proper, assembler and linker with
19031 appropriate command line options. This means that the user has to
19032 supply her private device specs file by means of -specs=path-to-
19033 specs-file. There is no more need for option -mmcu=mcu.
19034
19035 This option can also serve as a replacement for the older way of
19036 specifying custom device-specs files that needed -B some-path to
19037 point to a directory which contains a folder named "device-specs"
19038 which contains a specs file named "specs-mcu", where mcu was
19039 specified by -mmcu=mcu.
19040
19041 -Waddr-space-convert
19042 Warn about conversions between address spaces in the case where the
19043 resulting address space is not contained in the incoming address
19044 space.
19045
19046 -Wmisspelled-isr
19047 Warn if the ISR is misspelled, i.e. without __vector prefix.
19048 Enabled by default.
19049
19050 "EIND" and Devices with More Than 128 Ki Bytes of Flash
19051
19052 Pointers in the implementation are 16 bits wide. The address of a
19053 function or label is represented as word address so that indirect jumps
19054 and calls can target any code address in the range of 64 Ki words.
19055
19056 In order to facilitate indirect jump on devices with more than 128 Ki
19057 bytes of program memory space, there is a special function register
19058 called "EIND" that serves as most significant part of the target
19059 address when "EICALL" or "EIJMP" instructions are used.
19060
19061 Indirect jumps and calls on these devices are handled as follows by the
19062 compiler and are subject to some limitations:
19063
19064 * The compiler never sets "EIND".
19065
19066 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
19067 instructions or might read "EIND" directly in order to emulate an
19068 indirect call/jump by means of a "RET" instruction.
19069
19070 * The compiler assumes that "EIND" never changes during the startup
19071 code or during the application. In particular, "EIND" is not
19072 saved/restored in function or interrupt service routine
19073 prologue/epilogue.
19074
19075 * For indirect calls to functions and computed goto, the linker
19076 generates stubs. Stubs are jump pads sometimes also called
19077 trampolines. Thus, the indirect call/jump jumps to such a stub.
19078 The stub contains a direct jump to the desired address.
19079
19080 * Linker relaxation must be turned on so that the linker generates
19081 the stubs correctly in all situations. See the compiler option
19082 -mrelax and the linker option --relax. There are corner cases
19083 where the linker is supposed to generate stubs but aborts without
19084 relaxation and without a helpful error message.
19085
19086 * The default linker script is arranged for code with "EIND = 0". If
19087 code is supposed to work for a setup with "EIND != 0", a custom
19088 linker script has to be used in order to place the sections whose
19089 name start with ".trampolines" into the segment where "EIND" points
19090 to.
19091
19092 * The startup code from libgcc never sets "EIND". Notice that
19093 startup code is a blend of code from libgcc and AVR-LibC. For the
19094 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
19095 ("http://nongnu.org/avr-libc/user-manual/").
19096
19097 * It is legitimate for user-specific startup code to set up "EIND"
19098 early, for example by means of initialization code located in
19099 section ".init3". Such code runs prior to general startup code that
19100 initializes RAM and calls constructors, but after the bit of
19101 startup code from AVR-LibC that sets "EIND" to the segment where
19102 the vector table is located.
19103
19104 #include <avr/io.h>
19105
19106 static void
19107 __attribute__((section(".init3"),naked,used,no_instrument_function))
19108 init3_set_eind (void)
19109 {
19110 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
19111 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
19112 }
19113
19114 The "__trampolines_start" symbol is defined in the linker script.
19115
19116 * Stubs are generated automatically by the linker if the following
19117 two conditions are met:
19118
19119 -<The address of a label is taken by means of the "gs" modifier>
19120 (short for generate stubs) like so:
19121
19122 LDI r24, lo8(gs(<func>))
19123 LDI r25, hi8(gs(<func>))
19124
19125 -<The final location of that label is in a code segment>
19126 outside the segment where the stubs are located.
19127
19128 * The compiler emits such "gs" modifiers for code labels in the
19129 following situations:
19130
19131 -<Taking address of a function or code label.>
19132 -<Computed goto.>
19133 -<If prologue-save function is used, see -mcall-prologues>
19134 command-line option.
19135
19136 -<Switch/case dispatch tables. If you do not want such dispatch>
19137 tables you can specify the -fno-jump-tables command-line
19138 option.
19139
19140 -<C and C++ constructors/destructors called during
19141 startup/shutdown.>
19142 -<If the tools hit a "gs()" modifier explained above.>
19143 * Jumping to non-symbolic addresses like so is not supported:
19144
19145 int main (void)
19146 {
19147 /* Call function at word address 0x2 */
19148 return ((int(*)(void)) 0x2)();
19149 }
19150
19151 Instead, a stub has to be set up, i.e. the function has to be
19152 called through a symbol ("func_4" in the example):
19153
19154 int main (void)
19155 {
19156 extern int func_4 (void);
19157
19158 /* Call function at byte address 0x4 */
19159 return func_4();
19160 }
19161
19162 and the application be linked with -Wl,--defsym,func_4=0x4.
19163 Alternatively, "func_4" can be defined in the linker script.
19164
19165 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
19166 Registers
19167
19168 Some AVR devices support memories larger than the 64 KiB range that can
19169 be accessed with 16-bit pointers. To access memory locations outside
19170 this 64 KiB range, the content of a "RAMP" register is used as high
19171 part of the address: The "X", "Y", "Z" address register is concatenated
19172 with the "RAMPX", "RAMPY", "RAMPZ" special function register,
19173 respectively, to get a wide address. Similarly, "RAMPD" is used
19174 together with direct addressing.
19175
19176 * The startup code initializes the "RAMP" special function registers
19177 with zero.
19178
19179 * If a AVR Named Address Spaces,named address space other than
19180 generic or "__flash" is used, then "RAMPZ" is set as needed before
19181 the operation.
19182
19183 * If the device supports RAM larger than 64 KiB and the compiler
19184 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
19185 reset to zero after the operation.
19186
19187 * If the device comes with a specific "RAMP" register, the ISR
19188 prologue/epilogue saves/restores that SFR and initializes it with
19189 zero in case the ISR code might (implicitly) use it.
19190
19191 * RAM larger than 64 KiB is not supported by GCC for AVR targets. If
19192 you use inline assembler to read from locations outside the 16-bit
19193 address range and change one of the "RAMP" registers, you must
19194 reset it to zero after the access.
19195
19196 AVR Built-in Macros
19197
19198 GCC defines several built-in macros so that the user code can test for
19199 the presence or absence of features. Almost any of the following
19200 built-in macros are deduced from device capabilities and thus triggered
19201 by the -mmcu= command-line option.
19202
19203 For even more AVR-specific built-in macros see AVR Named Address Spaces
19204 and AVR Built-in Functions.
19205
19206 "__AVR_ARCH__"
19207 Build-in macro that resolves to a decimal number that identifies
19208 the architecture and depends on the -mmcu=mcu option. Possible
19209 values are:
19210
19211 2, 25, 3, 31, 35, 4, 5, 51, 6
19212
19213 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
19214 "avr51", "avr6",
19215
19216 respectively and
19217
19218 100, 102, 103, 104, 105, 106, 107
19219
19220 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
19221 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
19222 specifies a device, this built-in macro is set accordingly. For
19223 example, with -mmcu=atmega8 the macro is defined to 4.
19224
19225 "__AVR_Device__"
19226 Setting -mmcu=device defines this built-in macro which reflects the
19227 device's name. For example, -mmcu=atmega8 defines the built-in
19228 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
19229 "__AVR_ATtiny261A__", etc.
19230
19231 The built-in macros' names follow the scheme "__AVR_Device__" where
19232 Device is the device name as from the AVR user manual. The
19233 difference between Device in the built-in macro and device in
19234 -mmcu=device is that the latter is always lowercase.
19235
19236 If device is not a device but only a core architecture like avr51,
19237 this macro is not defined.
19238
19239 "__AVR_DEVICE_NAME__"
19240 Setting -mmcu=device defines this built-in macro to the device's
19241 name. For example, with -mmcu=atmega8 the macro is defined to
19242 "atmega8".
19243
19244 If device is not a device but only a core architecture like avr51,
19245 this macro is not defined.
19246
19247 "__AVR_XMEGA__"
19248 The device / architecture belongs to the XMEGA family of devices.
19249
19250 "__AVR_HAVE_ELPM__"
19251 The device has the "ELPM" instruction.
19252
19253 "__AVR_HAVE_ELPMX__"
19254 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
19255
19256 "__AVR_HAVE_MOVW__"
19257 The device has the "MOVW" instruction to perform 16-bit register-
19258 register moves.
19259
19260 "__AVR_HAVE_LPMX__"
19261 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
19262
19263 "__AVR_HAVE_MUL__"
19264 The device has a hardware multiplier.
19265
19266 "__AVR_HAVE_JMP_CALL__"
19267 The device has the "JMP" and "CALL" instructions. This is the case
19268 for devices with more than 8 KiB of program memory.
19269
19270 "__AVR_HAVE_EIJMP_EICALL__"
19271 "__AVR_3_BYTE_PC__"
19272 The device has the "EIJMP" and "EICALL" instructions. This is the
19273 case for devices with more than 128 KiB of program memory. This
19274 also means that the program counter (PC) is 3 bytes wide.
19275
19276 "__AVR_2_BYTE_PC__"
19277 The program counter (PC) is 2 bytes wide. This is the case for
19278 devices with up to 128 KiB of program memory.
19279
19280 "__AVR_HAVE_8BIT_SP__"
19281 "__AVR_HAVE_16BIT_SP__"
19282 The stack pointer (SP) register is treated as 8-bit respectively
19283 16-bit register by the compiler. The definition of these macros is
19284 affected by -mtiny-stack.
19285
19286 "__AVR_HAVE_SPH__"
19287 "__AVR_SP8__"
19288 The device has the SPH (high part of stack pointer) special
19289 function register or has an 8-bit stack pointer, respectively. The
19290 definition of these macros is affected by -mmcu= and in the cases
19291 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
19292
19293 "__AVR_HAVE_RAMPD__"
19294 "__AVR_HAVE_RAMPX__"
19295 "__AVR_HAVE_RAMPY__"
19296 "__AVR_HAVE_RAMPZ__"
19297 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
19298 function register, respectively.
19299
19300 "__NO_INTERRUPTS__"
19301 This macro reflects the -mno-interrupts command-line option.
19302
19303 "__AVR_ERRATA_SKIP__"
19304 "__AVR_ERRATA_SKIP_JMP_CALL__"
19305 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
19306 instructions because of a hardware erratum. Skip instructions are
19307 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
19308 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
19309
19310 "__AVR_ISA_RMW__"
19311 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
19312 LAT).
19313
19314 "__AVR_SFR_OFFSET__=offset"
19315 Instructions that can address I/O special function registers
19316 directly like "IN", "OUT", "SBI", etc. may use a different address
19317 as if addressed by an instruction to access RAM like "LD" or "STS".
19318 This offset depends on the device architecture and has to be
19319 subtracted from the RAM address in order to get the respective I/O
19320 address.
19321
19322 "__AVR_SHORT_CALLS__"
19323 The -mshort-calls command line option is set.
19324
19325 "__AVR_PM_BASE_ADDRESS__=addr"
19326 Some devices support reading from flash memory by means of "LD*"
19327 instructions. The flash memory is seen in the data address space
19328 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
19329 defined, this feature is not available. If defined, the address
19330 space is linear and there is no need to put ".rodata" into RAM.
19331 This is handled by the default linker description file, and is
19332 currently available for "avrtiny" and "avrxmega3". Even more
19333 convenient, there is no need to use address spaces like "__flash"
19334 or features like attribute "progmem" and "pgm_read_*".
19335
19336 "__WITH_AVRLIBC__"
19337 The compiler is configured to be used together with AVR-Libc. See
19338 the --with-avrlibc configure option.
19339
19340 "__HAVE_DOUBLE_MULTILIB__"
19341 Defined if -mdouble= acts as a multilib option.
19342
19343 "__HAVE_DOUBLE32__"
19344 "__HAVE_DOUBLE64__"
19345 Defined if the compiler supports 32-bit double resp. 64-bit double.
19346 The actual layout is specified by option -mdouble=.
19347
19348 "__DEFAULT_DOUBLE__"
19349 The size in bits of "double" if -mdouble= is not set. To test the
19350 layout of "double" in a program, use the built-in macro
19351 "__SIZEOF_DOUBLE__".
19352
19353 "__HAVE_LONG_DOUBLE32__"
19354 "__HAVE_LONG_DOUBLE64__"
19355 "__HAVE_LONG_DOUBLE_MULTILIB__"
19356 "__DEFAULT_LONG_DOUBLE__"
19357 Same as above, but for "long double" instead of "double".
19358
19359 "__WITH_DOUBLE_COMPARISON__"
19360 Reflects the "--with-double-comparison={tristate|bool|libf7}"
19361 configure option ("https://gcc.gnu.org/install/configure.html#avr")
19362 and is defined to 2 or 3.
19363
19364 "__WITH_LIBF7_LIBGCC__"
19365 "__WITH_LIBF7_MATH__"
19366 "__WITH_LIBF7_MATH_SYMBOLS__"
19367 Reflects the "--with-libf7={libgcc|math|math-symbols}"
19368 configure option
19369 ("https://gcc.gnu.org/install/configure.html#avr").
19370
19371 Blackfin Options
19372
19373 -mcpu=cpu[-sirevision]
19374 Specifies the name of the target Blackfin processor. Currently,
19375 cpu can be one of bf512, bf514, bf516, bf518, bf522, bf523, bf524,
19376 bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf536, bf537,
19377 bf538, bf539, bf542, bf544, bf547, bf548, bf549, bf542m, bf544m,
19378 bf547m, bf548m, bf549m, bf561, bf592.
19379
19380 The optional sirevision specifies the silicon revision of the
19381 target Blackfin processor. Any workarounds available for the
19382 targeted silicon revision are enabled. If sirevision is none, no
19383 workarounds are enabled. If sirevision is any, all workarounds for
19384 the targeted processor are enabled. The "__SILICON_REVISION__"
19385 macro is defined to two hexadecimal digits representing the major
19386 and minor numbers in the silicon revision. If sirevision is none,
19387 the "__SILICON_REVISION__" is not defined. If sirevision is any,
19388 the "__SILICON_REVISION__" is defined to be 0xffff. If this
19389 optional sirevision is not used, GCC assumes the latest known
19390 silicon revision of the targeted Blackfin processor.
19391
19392 GCC defines a preprocessor macro for the specified cpu. For the
19393 bfin-elf toolchain, this option causes the hardware BSP provided by
19394 libgloss to be linked in if -msim is not given.
19395
19396 Without this option, bf532 is used as the processor by default.
19397
19398 Note that support for bf561 is incomplete. For bf561, only the
19399 preprocessor macro is defined.
19400
19401 -msim
19402 Specifies that the program will be run on the simulator. This
19403 causes the simulator BSP provided by libgloss to be linked in.
19404 This option has effect only for bfin-elf toolchain. Certain other
19405 options, such as -mid-shared-library and -mfdpic, imply -msim.
19406
19407 -momit-leaf-frame-pointer
19408 Don't keep the frame pointer in a register for leaf functions.
19409 This avoids the instructions to save, set up and restore frame
19410 pointers and makes an extra register available in leaf functions.
19411
19412 -mspecld-anomaly
19413 When enabled, the compiler ensures that the generated code does not
19414 contain speculative loads after jump instructions. If this option
19415 is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
19416
19417 -mno-specld-anomaly
19418 Don't generate extra code to prevent speculative loads from
19419 occurring.
19420
19421 -mcsync-anomaly
19422 When enabled, the compiler ensures that the generated code does not
19423 contain CSYNC or SSYNC instructions too soon after conditional
19424 branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS"
19425 is defined.
19426
19427 -mno-csync-anomaly
19428 Don't generate extra code to prevent CSYNC or SSYNC instructions
19429 from occurring too soon after a conditional branch.
19430
19431 -mlow64k
19432 When enabled, the compiler is free to take advantage of the
19433 knowledge that the entire program fits into the low 64k of memory.
19434
19435 -mno-low64k
19436 Assume that the program is arbitrarily large. This is the default.
19437
19438 -mstack-check-l1
19439 Do stack checking using information placed into L1 scratchpad
19440 memory by the uClinux kernel.
19441
19442 -mid-shared-library
19443 Generate code that supports shared libraries via the library ID
19444 method. This allows for execute in place and shared libraries in
19445 an environment without virtual memory management. This option
19446 implies -fPIC. With a bfin-elf target, this option implies -msim.
19447
19448 -mno-id-shared-library
19449 Generate code that doesn't assume ID-based shared libraries are
19450 being used. This is the default.
19451
19452 -mleaf-id-shared-library
19453 Generate code that supports shared libraries via the library ID
19454 method, but assumes that this library or executable won't link
19455 against any other ID shared libraries. That allows the compiler to
19456 use faster code for jumps and calls.
19457
19458 -mno-leaf-id-shared-library
19459 Do not assume that the code being compiled won't link against any
19460 ID shared libraries. Slower code is generated for jump and call
19461 insns.
19462
19463 -mshared-library-id=n
19464 Specifies the identification number of the ID-based shared library
19465 being compiled. Specifying a value of 0 generates more compact
19466 code; specifying other values forces the allocation of that number
19467 to the current library but is no more space- or time-efficient than
19468 omitting this option.
19469
19470 -msep-data
19471 Generate code that allows the data segment to be located in a
19472 different area of memory from the text segment. This allows for
19473 execute in place in an environment without virtual memory
19474 management by eliminating relocations against the text section.
19475
19476 -mno-sep-data
19477 Generate code that assumes that the data segment follows the text
19478 segment. This is the default.
19479
19480 -mlong-calls
19481 -mno-long-calls
19482 Tells the compiler to perform function calls by first loading the
19483 address of the function into a register and then performing a
19484 subroutine call on this register. This switch is needed if the
19485 target function lies outside of the 24-bit addressing range of the
19486 offset-based version of subroutine call instruction.
19487
19488 This feature is not enabled by default. Specifying -mno-long-calls
19489 restores the default behavior. Note these switches have no effect
19490 on how the compiler generates code to handle function calls via
19491 function pointers.
19492
19493 -mfast-fp
19494 Link with the fast floating-point library. This library relaxes
19495 some of the IEEE floating-point standard's rules for checking
19496 inputs against Not-a-Number (NAN), in the interest of performance.
19497
19498 -minline-plt
19499 Enable inlining of PLT entries in function calls to functions that
19500 are not known to bind locally. It has no effect without -mfdpic.
19501
19502 -mmulticore
19503 Build a standalone application for multicore Blackfin processors.
19504 This option causes proper start files and link scripts supporting
19505 multicore to be used, and defines the macro "__BFIN_MULTICORE". It
19506 can only be used with -mcpu=bf561[-sirevision].
19507
19508 This option can be used with -mcorea or -mcoreb, which selects the
19509 one-application-per-core programming model. Without -mcorea or
19510 -mcoreb, the single-application/dual-core programming model is
19511 used. In this model, the main function of Core B should be named as
19512 "coreb_main".
19513
19514 If this option is not used, the single-core application programming
19515 model is used.
19516
19517 -mcorea
19518 Build a standalone application for Core A of BF561 when using the
19519 one-application-per-core programming model. Proper start files and
19520 link scripts are used to support Core A, and the macro
19521 "__BFIN_COREA" is defined. This option can only be used in
19522 conjunction with -mmulticore.
19523
19524 -mcoreb
19525 Build a standalone application for Core B of BF561 when using the
19526 one-application-per-core programming model. Proper start files and
19527 link scripts are used to support Core B, and the macro
19528 "__BFIN_COREB" is defined. When this option is used, "coreb_main"
19529 should be used instead of "main". This option can only be used in
19530 conjunction with -mmulticore.
19531
19532 -msdram
19533 Build a standalone application for SDRAM. Proper start files and
19534 link scripts are used to put the application into SDRAM, and the
19535 macro "__BFIN_SDRAM" is defined. The loader should initialize
19536 SDRAM before loading the application.
19537
19538 -micplb
19539 Assume that ICPLBs are enabled at run time. This has an effect on
19540 certain anomaly workarounds. For Linux targets, the default is to
19541 assume ICPLBs are enabled; for standalone applications the default
19542 is off.
19543
19544 C6X Options
19545
19546 -march=name
19547 This specifies the name of the target architecture. GCC uses this
19548 name to determine what kind of instructions it can emit when
19549 generating assembly code. Permissible names are: c62x, c64x,
19550 c64x+, c67x, c67x+, c674x.
19551
19552 -mbig-endian
19553 Generate code for a big-endian target.
19554
19555 -mlittle-endian
19556 Generate code for a little-endian target. This is the default.
19557
19558 -msim
19559 Choose startup files and linker script suitable for the simulator.
19560
19561 -msdata=default
19562 Put small global and static data in the ".neardata" section, which
19563 is pointed to by register "B14". Put small uninitialized global
19564 and static data in the ".bss" section, which is adjacent to the
19565 ".neardata" section. Put small read-only data into the ".rodata"
19566 section. The corresponding sections used for large pieces of data
19567 are ".fardata", ".far" and ".const".
19568
19569 -msdata=all
19570 Put all data, not just small objects, into the sections reserved
19571 for small data, and use addressing relative to the "B14" register
19572 to access them.
19573
19574 -msdata=none
19575 Make no use of the sections reserved for small data, and use
19576 absolute addresses to access all data. Put all initialized global
19577 and static data in the ".fardata" section, and all uninitialized
19578 data in the ".far" section. Put all constant data into the
19579 ".const" section.
19580
19581 CRIS Options
19582
19583 These options are defined specifically for the CRIS ports.
19584
19585 -march=architecture-type
19586 -mcpu=architecture-type
19587 Generate code for the specified architecture. The choices for
19588 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
19589 ETRAX 100, and ETRAX 100 LX. Default is v0.
19590
19591 -mtune=architecture-type
19592 Tune to architecture-type everything applicable about the generated
19593 code, except for the ABI and the set of available instructions.
19594 The choices for architecture-type are the same as for
19595 -march=architecture-type.
19596
19597 -mmax-stack-frame=n
19598 Warn when the stack frame of a function exceeds n bytes.
19599
19600 -metrax4
19601 -metrax100
19602 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
19603 -march=v8 respectively.
19604
19605 -mmul-bug-workaround
19606 -mno-mul-bug-workaround
19607 Work around a bug in the "muls" and "mulu" instructions for CPU
19608 models where it applies. This option is disabled by default.
19609
19610 -mpdebug
19611 Enable CRIS-specific verbose debug-related information in the
19612 assembly code. This option also has the effect of turning off the
19613 #NO_APP formatted-code indicator to the assembler at the beginning
19614 of the assembly file.
19615
19616 -mcc-init
19617 Do not use condition-code results from previous instruction; always
19618 emit compare and test instructions before use of condition codes.
19619
19620 -mno-side-effects
19621 Do not emit instructions with side effects in addressing modes
19622 other than post-increment.
19623
19624 -mstack-align
19625 -mno-stack-align
19626 -mdata-align
19627 -mno-data-align
19628 -mconst-align
19629 -mno-const-align
19630 These options (no- options) arrange (eliminate arrangements) for
19631 the stack frame, individual data and constants to be aligned for
19632 the maximum single data access size for the chosen CPU model. The
19633 default is to arrange for 32-bit alignment. ABI details such as
19634 structure layout are not affected by these options.
19635
19636 -m32-bit
19637 -m16-bit
19638 -m8-bit
19639 Similar to the stack- data- and const-align options above, these
19640 options arrange for stack frame, writable data and constants to all
19641 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
19642 alignment.
19643
19644 -mno-prologue-epilogue
19645 -mprologue-epilogue
19646 With -mno-prologue-epilogue, the normal function prologue and
19647 epilogue which set up the stack frame are omitted and no return
19648 instructions or return sequences are generated in the code. Use
19649 this option only together with visual inspection of the compiled
19650 code: no warnings or errors are generated when call-saved registers
19651 must be saved, or storage for local variables needs to be
19652 allocated.
19653
19654 -melf
19655 Legacy no-op option.
19656
19657 -sim
19658 This option arranges to link with input-output functions from a
19659 simulator library. Code, initialized data and zero-initialized
19660 data are allocated consecutively.
19661
19662 -sim2
19663 Like -sim, but pass linker options to locate initialized data at
19664 0x40000000 and zero-initialized data at 0x80000000.
19665
19666 CR16 Options
19667
19668 These options are defined specifically for the CR16 ports.
19669
19670 -mmac
19671 Enable the use of multiply-accumulate instructions. Disabled by
19672 default.
19673
19674 -mcr16cplus
19675 -mcr16c
19676 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
19677 is default.
19678
19679 -msim
19680 Links the library libsim.a which is in compatible with simulator.
19681 Applicable to ELF compiler only.
19682
19683 -mint32
19684 Choose integer type as 32-bit wide.
19685
19686 -mbit-ops
19687 Generates "sbit"/"cbit" instructions for bit manipulations.
19688
19689 -mdata-model=model
19690 Choose a data model. The choices for model are near, far or medium.
19691 medium is default. However, far is not valid with -mcr16c, as the
19692 CR16C architecture does not support the far data model.
19693
19694 C-SKY Options
19695
19696 GCC supports these options when compiling for C-SKY V2 processors.
19697
19698 -march=arch
19699 Specify the C-SKY target architecture. Valid values for arch are:
19700 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
19701
19702 -mcpu=cpu
19703 Specify the C-SKY target processor. Valid values for cpu are:
19704 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
19705 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
19706 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
19707 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
19708 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
19709 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
19710 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
19711 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
19712 ck810tv, ck810ft, and ck810ftv.
19713
19714 -mbig-endian
19715 -EB
19716 -mlittle-endian
19717 -EL Select big- or little-endian code. The default is little-endian.
19718
19719 -mfloat-abi=name
19720 Specifies which floating-point ABI to use. Permissible values are:
19721 soft, softfp and hard.
19722
19723 Specifying soft causes GCC to generate output containing library
19724 calls for floating-point operations. softfp allows the generation
19725 of code using hardware floating-point instructions, but still uses
19726 the soft-float calling conventions. hard allows generation of
19727 floating-point instructions and uses FPU-specific calling
19728 conventions.
19729
19730 The default depends on the specific target configuration. Note
19731 that the hard-float and soft-float ABIs are not link-compatible;
19732 you must compile your entire program with the same ABI, and link
19733 with a compatible set of libraries.
19734
19735 -mhard-float
19736 -msoft-float
19737 Select hardware or software floating-point implementations. The
19738 default is soft float.
19739
19740 -mdouble-float
19741 -mno-double-float
19742 When -mhard-float is in effect, enable generation of double-
19743 precision float instructions. This is the default except when
19744 compiling for CK803.
19745
19746 -mfdivdu
19747 -mno-fdivdu
19748 When -mhard-float is in effect, enable generation of "frecipd",
19749 "fsqrtd", and "fdivd" instructions. This is the default except
19750 when compiling for CK803.
19751
19752 -mfpu=fpu
19753 Select the floating-point processor. This option can only be used
19754 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
19755 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
19756 and fpv2_divd (-mdouble-float -mdivdu).
19757
19758 -melrw
19759 -mno-elrw
19760 Enable the extended "lrw" instruction. This option defaults to on
19761 for CK801 and off otherwise.
19762
19763 -mistack
19764 -mno-istack
19765 Enable interrupt stack instructions; the default is off.
19766
19767 The -mistack option is required to handle the "interrupt" and "isr"
19768 function attributes.
19769
19770 -mmp
19771 Enable multiprocessor instructions; the default is off.
19772
19773 -mcp
19774 Enable coprocessor instructions; the default is off.
19775
19776 -mcache
19777 Enable coprocessor instructions; the default is off.
19778
19779 -msecurity
19780 Enable C-SKY security instructions; the default is off.
19781
19782 -mtrust
19783 Enable C-SKY trust instructions; the default is off.
19784
19785 -mdsp
19786 -medsp
19787 -mvdsp
19788 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
19789 respectively. All of these options default to off.
19790
19791 -mdiv
19792 -mno-div
19793 Generate divide instructions. Default is off.
19794
19795 -msmart
19796 -mno-smart
19797 Generate code for Smart Mode, using only registers numbered 0-7 to
19798 allow use of 16-bit instructions. This option is ignored for CK801
19799 where this is the required behavior, and it defaults to on for
19800 CK802. For other targets, the default is off.
19801
19802 -mhigh-registers
19803 -mno-high-registers
19804 Generate code using the high registers numbered 16-31. This option
19805 is not supported on CK801, CK802, or CK803, and is enabled by
19806 default for other processors.
19807
19808 -manchor
19809 -mno-anchor
19810 Generate code using global anchor symbol addresses.
19811
19812 -mpushpop
19813 -mno-pushpop
19814 Generate code using "push" and "pop" instructions. This option
19815 defaults to on.
19816
19817 -mmultiple-stld
19818 -mstm
19819 -mno-multiple-stld
19820 -mno-stm
19821 Generate code using "stm" and "ldm" instructions. This option
19822 isn't supported on CK801 but is enabled by default on other
19823 processors.
19824
19825 -mconstpool
19826 -mno-constpool
19827 Create constant pools in the compiler instead of deferring it to
19828 the assembler. This option is the default and required for correct
19829 code generation on CK801 and CK802, and is optional on other
19830 processors.
19831
19832 -mstack-size
19833 -mno-stack-size
19834 Emit ".stack_size" directives for each function in the assembly
19835 output. This option defaults to off.
19836
19837 -mccrt
19838 -mno-ccrt
19839 Generate code for the C-SKY compiler runtime instead of libgcc.
19840 This option defaults to off.
19841
19842 -mbranch-cost=n
19843 Set the branch costs to roughly "n" instructions. The default is
19844 1.
19845
19846 -msched-prolog
19847 -mno-sched-prolog
19848 Permit scheduling of function prologue and epilogue sequences.
19849 Using this option can result in code that is not compliant with the
19850 C-SKY V2 ABI prologue requirements and that cannot be debugged or
19851 backtraced. It is disabled by default.
19852
19853 -msim
19854 Links the library libsemi.a which is in compatible with simulator.
19855 Applicable to ELF compiler only.
19856
19857 Darwin Options
19858
19859 These options are defined for all architectures running the Darwin
19860 operating system.
19861
19862 FSF GCC on Darwin does not create "fat" object files; it creates an
19863 object file for the single architecture that GCC was built to target.
19864 Apple's GCC on Darwin does create "fat" files if multiple -arch options
19865 are used; it does so by running the compiler or linker multiple times
19866 and joining the results together with lipo.
19867
19868 The subtype of the file created (like ppc7400 or ppc970 or i686) is
19869 determined by the flags that specify the ISA that GCC is targeting,
19870 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
19871 override this.
19872
19873 The Darwin tools vary in their behavior when presented with an ISA
19874 mismatch. The assembler, as, only permits instructions to be used that
19875 are valid for the subtype of the file it is generating, so you cannot
19876 put 64-bit instructions in a ppc750 object file. The linker for shared
19877 libraries, /usr/bin/libtool, fails and prints an error if asked to
19878 create a shared library with a less restrictive subtype than its input
19879 files (for instance, trying to put a ppc970 object file in a ppc7400
19880 library). The linker for executables, ld, quietly gives the executable
19881 the most restrictive subtype of any of its input files.
19882
19883 -Fdir
19884 Add the framework directory dir to the head of the list of
19885 directories to be searched for header files. These directories are
19886 interleaved with those specified by -I options and are scanned in a
19887 left-to-right order.
19888
19889 A framework directory is a directory with frameworks in it. A
19890 framework is a directory with a Headers and/or PrivateHeaders
19891 directory contained directly in it that ends in .framework. The
19892 name of a framework is the name of this directory excluding the
19893 .framework. Headers associated with the framework are found in one
19894 of those two directories, with Headers being searched first. A
19895 subframework is a framework directory that is in a framework's
19896 Frameworks directory. Includes of subframework headers can only
19897 appear in a header of a framework that contains the subframework,
19898 or in a sibling subframework header. Two subframeworks are
19899 siblings if they occur in the same framework. A subframework
19900 should not have the same name as a framework; a warning is issued
19901 if this is violated. Currently a subframework cannot have
19902 subframeworks; in the future, the mechanism may be extended to
19903 support this. The standard frameworks can be found in
19904 /System/Library/Frameworks and /Library/Frameworks. An example
19905 include looks like "#include <Framework/header.h>", where Framework
19906 denotes the name of the framework and header.h is found in the
19907 PrivateHeaders or Headers directory.
19908
19909 -iframeworkdir
19910 Like -F except the directory is a treated as a system directory.
19911 The main difference between this -iframework and -F is that with
19912 -iframework the compiler does not warn about constructs contained
19913 within header files found via dir. This option is valid only for
19914 the C family of languages.
19915
19916 -gused
19917 Emit debugging information for symbols that are used. For stabs
19918 debugging format, this enables -feliminate-unused-debug-symbols.
19919 This is by default ON.
19920
19921 -gfull
19922 Emit debugging information for all symbols and types.
19923
19924 -mmacosx-version-min=version
19925 The earliest version of MacOS X that this executable will run on is
19926 version. Typical values of version include 10.1, 10.2, and 10.3.9.
19927
19928 If the compiler was built to use the system's headers by default,
19929 then the default for this option is the system version on which the
19930 compiler is running, otherwise the default is to make choices that
19931 are compatible with as many systems and code bases as possible.
19932
19933 -mkernel
19934 Enable kernel development mode. The -mkernel option sets -static,
19935 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
19936 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
19937 where applicable. This mode also sets -mno-altivec, -msoft-float,
19938 -fno-builtin and -mlong-branch for PowerPC targets.
19939
19940 -mone-byte-bool
19941 Override the defaults for "bool" so that "sizeof(bool)==1". By
19942 default "sizeof(bool)" is 4 when compiling for Darwin/PowerPC and 1
19943 when compiling for Darwin/x86, so this option has no effect on x86.
19944
19945 Warning: The -mone-byte-bool switch causes GCC to generate code
19946 that is not binary compatible with code generated without that
19947 switch. Using this switch may require recompiling all other
19948 modules in a program, including system libraries. Use this switch
19949 to conform to a non-default data model.
19950
19951 -mfix-and-continue
19952 -ffix-and-continue
19953 -findirect-data
19954 Generate code suitable for fast turnaround development, such as to
19955 allow GDB to dynamically load .o files into already-running
19956 programs. -findirect-data and -ffix-and-continue are provided for
19957 backwards compatibility.
19958
19959 -all_load
19960 Loads all members of static archive libraries. See man ld(1) for
19961 more information.
19962
19963 -arch_errors_fatal
19964 Cause the errors having to do with files that have the wrong
19965 architecture to be fatal.
19966
19967 -bind_at_load
19968 Causes the output file to be marked such that the dynamic linker
19969 will bind all undefined references when the file is loaded or
19970 launched.
19971
19972 -bundle
19973 Produce a Mach-o bundle format file. See man ld(1) for more
19974 information.
19975
19976 -bundle_loader executable
19977 This option specifies the executable that will load the build
19978 output file being linked. See man ld(1) for more information.
19979
19980 -dynamiclib
19981 When passed this option, GCC produces a dynamic library instead of
19982 an executable when linking, using the Darwin libtool command.
19983
19984 -force_cpusubtype_ALL
19985 This causes GCC's output file to have the ALL subtype, instead of
19986 one controlled by the -mcpu or -march option.
19987
19988 -allowable_client client_name
19989 -client_name
19990 -compatibility_version
19991 -current_version
19992 -dead_strip
19993 -dependency-file
19994 -dylib_file
19995 -dylinker_install_name
19996 -dynamic
19997 -exported_symbols_list
19998 -filelist
19999 -flat_namespace
20000 -force_flat_namespace
20001 -headerpad_max_install_names
20002 -image_base
20003 -init
20004 -install_name
20005 -keep_private_externs
20006 -multi_module
20007 -multiply_defined
20008 -multiply_defined_unused
20009 -noall_load
20010 -no_dead_strip_inits_and_terms
20011 -nofixprebinding
20012 -nomultidefs
20013 -noprebind
20014 -noseglinkedit
20015 -pagezero_size
20016 -prebind
20017 -prebind_all_twolevel_modules
20018 -private_bundle
20019 -read_only_relocs
20020 -sectalign
20021 -sectobjectsymbols
20022 -whyload
20023 -seg1addr
20024 -sectcreate
20025 -sectobjectsymbols
20026 -sectorder
20027 -segaddr
20028 -segs_read_only_addr
20029 -segs_read_write_addr
20030 -seg_addr_table
20031 -seg_addr_table_filename
20032 -seglinkedit
20033 -segprot
20034 -segs_read_only_addr
20035 -segs_read_write_addr
20036 -single_module
20037 -static
20038 -sub_library
20039 -sub_umbrella
20040 -twolevel_namespace
20041 -umbrella
20042 -undefined
20043 -unexported_symbols_list
20044 -weak_reference_mismatches
20045 -whatsloaded
20046 These options are passed to the Darwin linker. The Darwin linker
20047 man page describes them in detail.
20048
20049 DEC Alpha Options
20050
20051 These -m options are defined for the DEC Alpha implementations:
20052
20053 -mno-soft-float
20054 -msoft-float
20055 Use (do not use) the hardware floating-point instructions for
20056 floating-point operations. When -msoft-float is specified,
20057 functions in libgcc.a are used to perform floating-point
20058 operations. Unless they are replaced by routines that emulate the
20059 floating-point operations, or compiled in such a way as to call
20060 such emulations routines, these routines issue floating-point
20061 operations. If you are compiling for an Alpha without floating-
20062 point operations, you must ensure that the library is built so as
20063 not to call them.
20064
20065 Note that Alpha implementations without floating-point operations
20066 are required to have floating-point registers.
20067
20068 -mfp-reg
20069 -mno-fp-regs
20070 Generate code that uses (does not use) the floating-point register
20071 set. -mno-fp-regs implies -msoft-float. If the floating-point
20072 register set is not used, floating-point operands are passed in
20073 integer registers as if they were integers and floating-point
20074 results are passed in $0 instead of $f0. This is a non-standard
20075 calling sequence, so any function with a floating-point argument or
20076 return value called by code compiled with -mno-fp-regs must also be
20077 compiled with that option.
20078
20079 A typical use of this option is building a kernel that does not
20080 use, and hence need not save and restore, any floating-point
20081 registers.
20082
20083 -mieee
20084 The Alpha architecture implements floating-point hardware optimized
20085 for maximum performance. It is mostly compliant with the IEEE
20086 floating-point standard. However, for full compliance, software
20087 assistance is required. This option generates code fully IEEE-
20088 compliant code except that the inexact-flag is not maintained (see
20089 below). If this option is turned on, the preprocessor macro
20090 "_IEEE_FP" is defined during compilation. The resulting code is
20091 less efficient but is able to correctly support denormalized
20092 numbers and exceptional IEEE values such as not-a-number and
20093 plus/minus infinity. Other Alpha compilers call this option
20094 -ieee_with_no_inexact.
20095
20096 -mieee-with-inexact
20097 This is like -mieee except the generated code also maintains the
20098 IEEE inexact-flag. Turning on this option causes the generated
20099 code to implement fully-compliant IEEE math. In addition to
20100 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
20101 On some Alpha implementations the resulting code may execute
20102 significantly slower than the code generated by default. Since
20103 there is very little code that depends on the inexact-flag, you
20104 should normally not specify this option. Other Alpha compilers
20105 call this option -ieee_with_inexact.
20106
20107 -mfp-trap-mode=trap-mode
20108 This option controls what floating-point related traps are enabled.
20109 Other Alpha compilers call this option -fptm trap-mode. The trap
20110 mode can be set to one of four values:
20111
20112 n This is the default (normal) setting. The only traps that are
20113 enabled are the ones that cannot be disabled in software (e.g.,
20114 division by zero trap).
20115
20116 u In addition to the traps enabled by n, underflow traps are
20117 enabled as well.
20118
20119 su Like u, but the instructions are marked to be safe for software
20120 completion (see Alpha architecture manual for details).
20121
20122 sui Like su, but inexact traps are enabled as well.
20123
20124 -mfp-rounding-mode=rounding-mode
20125 Selects the IEEE rounding mode. Other Alpha compilers call this
20126 option -fprm rounding-mode. The rounding-mode can be one of:
20127
20128 n Normal IEEE rounding mode. Floating-point numbers are rounded
20129 towards the nearest machine number or towards the even machine
20130 number in case of a tie.
20131
20132 m Round towards minus infinity.
20133
20134 c Chopped rounding mode. Floating-point numbers are rounded
20135 towards zero.
20136
20137 d Dynamic rounding mode. A field in the floating-point control
20138 register (fpcr, see Alpha architecture reference manual)
20139 controls the rounding mode in effect. The C library
20140 initializes this register for rounding towards plus infinity.
20141 Thus, unless your program modifies the fpcr, d corresponds to
20142 round towards plus infinity.
20143
20144 -mtrap-precision=trap-precision
20145 In the Alpha architecture, floating-point traps are imprecise.
20146 This means without software assistance it is impossible to recover
20147 from a floating trap and program execution normally needs to be
20148 terminated. GCC can generate code that can assist operating system
20149 trap handlers in determining the exact location that caused a
20150 floating-point trap. Depending on the requirements of an
20151 application, different levels of precisions can be selected:
20152
20153 p Program precision. This option is the default and means a trap
20154 handler can only identify which program caused a floating-point
20155 exception.
20156
20157 f Function precision. The trap handler can determine the
20158 function that caused a floating-point exception.
20159
20160 i Instruction precision. The trap handler can determine the
20161 exact instruction that caused a floating-point exception.
20162
20163 Other Alpha compilers provide the equivalent options called
20164 -scope_safe and -resumption_safe.
20165
20166 -mieee-conformant
20167 This option marks the generated code as IEEE conformant. You must
20168 not use this option unless you also specify -mtrap-precision=i and
20169 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
20170 to emit the line .eflag 48 in the function prologue of the
20171 generated assembly file.
20172
20173 -mbuild-constants
20174 Normally GCC examines a 32- or 64-bit integer constant to see if it
20175 can construct it from smaller constants in two or three
20176 instructions. If it cannot, it outputs the constant as a literal
20177 and generates code to load it from the data segment at run time.
20178
20179 Use this option to require GCC to construct all integer constants
20180 using code, even if it takes more instructions (the maximum is
20181 six).
20182
20183 You typically use this option to build a shared library dynamic
20184 loader. Itself a shared library, it must relocate itself in memory
20185 before it can find the variables and constants in its own data
20186 segment.
20187
20188 -mbwx
20189 -mno-bwx
20190 -mcix
20191 -mno-cix
20192 -mfix
20193 -mno-fix
20194 -mmax
20195 -mno-max
20196 Indicate whether GCC should generate code to use the optional BWX,
20197 CIX, FIX and MAX instruction sets. The default is to use the
20198 instruction sets supported by the CPU type specified via -mcpu=
20199 option or that of the CPU on which GCC was built if none is
20200 specified.
20201
20202 -mfloat-vax
20203 -mfloat-ieee
20204 Generate code that uses (does not use) VAX F and G floating-point
20205 arithmetic instead of IEEE single and double precision.
20206
20207 -mexplicit-relocs
20208 -mno-explicit-relocs
20209 Older Alpha assemblers provided no way to generate symbol
20210 relocations except via assembler macros. Use of these macros does
20211 not allow optimal instruction scheduling. GNU binutils as of
20212 version 2.12 supports a new syntax that allows the compiler to
20213 explicitly mark which relocations should apply to which
20214 instructions. This option is mostly useful for debugging, as GCC
20215 detects the capabilities of the assembler when it is built and sets
20216 the default accordingly.
20217
20218 -msmall-data
20219 -mlarge-data
20220 When -mexplicit-relocs is in effect, static data is accessed via
20221 gp-relative relocations. When -msmall-data is used, objects 8
20222 bytes long or smaller are placed in a small data area (the ".sdata"
20223 and ".sbss" sections) and are accessed via 16-bit relocations off
20224 of the $gp register. This limits the size of the small data area
20225 to 64KB, but allows the variables to be directly accessed via a
20226 single instruction.
20227
20228 The default is -mlarge-data. With this option the data area is
20229 limited to just below 2GB. Programs that require more than 2GB of
20230 data must use "malloc" or "mmap" to allocate the data in the heap
20231 instead of in the program's data segment.
20232
20233 When generating code for shared libraries, -fpic implies
20234 -msmall-data and -fPIC implies -mlarge-data.
20235
20236 -msmall-text
20237 -mlarge-text
20238 When -msmall-text is used, the compiler assumes that the code of
20239 the entire program (or shared library) fits in 4MB, and is thus
20240 reachable with a branch instruction. When -msmall-data is used,
20241 the compiler can assume that all local symbols share the same $gp
20242 value, and thus reduce the number of instructions required for a
20243 function call from 4 to 1.
20244
20245 The default is -mlarge-text.
20246
20247 -mcpu=cpu_type
20248 Set the instruction set and instruction scheduling parameters for
20249 machine type cpu_type. You can specify either the EV style name or
20250 the corresponding chip number. GCC supports scheduling parameters
20251 for the EV4, EV5 and EV6 family of processors and chooses the
20252 default values for the instruction set from the processor you
20253 specify. If you do not specify a processor type, GCC defaults to
20254 the processor on which the compiler was built.
20255
20256 Supported values for cpu_type are
20257
20258 ev4
20259 ev45
20260 21064
20261 Schedules as an EV4 and has no instruction set extensions.
20262
20263 ev5
20264 21164
20265 Schedules as an EV5 and has no instruction set extensions.
20266
20267 ev56
20268 21164a
20269 Schedules as an EV5 and supports the BWX extension.
20270
20271 pca56
20272 21164pc
20273 21164PC
20274 Schedules as an EV5 and supports the BWX and MAX extensions.
20275
20276 ev6
20277 21264
20278 Schedules as an EV6 and supports the BWX, FIX, and MAX
20279 extensions.
20280
20281 ev67
20282 21264a
20283 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
20284 extensions.
20285
20286 Native toolchains also support the value native, which selects the
20287 best architecture option for the host processor. -mcpu=native has
20288 no effect if GCC does not recognize the processor.
20289
20290 -mtune=cpu_type
20291 Set only the instruction scheduling parameters for machine type
20292 cpu_type. The instruction set is not changed.
20293
20294 Native toolchains also support the value native, which selects the
20295 best architecture option for the host processor. -mtune=native has
20296 no effect if GCC does not recognize the processor.
20297
20298 -mmemory-latency=time
20299 Sets the latency the scheduler should assume for typical memory
20300 references as seen by the application. This number is highly
20301 dependent on the memory access patterns used by the application and
20302 the size of the external cache on the machine.
20303
20304 Valid options for time are
20305
20306 number
20307 A decimal number representing clock cycles.
20308
20309 L1
20310 L2
20311 L3
20312 main
20313 The compiler contains estimates of the number of clock cycles
20314 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
20315 (also called Dcache, Scache, and Bcache), as well as to main
20316 memory. Note that L3 is only valid for EV5.
20317
20318 eBPF Options
20319
20320 -mframe-limit=bytes
20321 This specifies the hard limit for frame sizes, in bytes.
20322 Currently, the value that can be specified should be less than or
20323 equal to 32767. Defaults to whatever limit is imposed by the
20324 version of the Linux kernel targeted.
20325
20326 -mkernel=version
20327 This specifies the minimum version of the kernel that will run the
20328 compiled program. GCC uses this version to determine which
20329 instructions to use, what kernel helpers to allow, etc. Currently,
20330 version can be one of 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8,
20331 4.9, 4.10, 4.11, 4.12, 4.13, 4.14, 4.15, 4.16, 4.17, 4.18, 4.19,
20332 4.20, 5.0, 5.1, 5.2, latest and native.
20333
20334 -mbig-endian
20335 Generate code for a big-endian target.
20336
20337 -mlittle-endian
20338 Generate code for a little-endian target. This is the default.
20339
20340 -mjmpext
20341 Enable generation of extra conditional-branch instructions.
20342 Enabled for CPU v2 and above.
20343
20344 -mjmp32
20345 Enable 32-bit jump instructions. Enabled for CPU v3 and above.
20346
20347 -malu32
20348 Enable 32-bit ALU instructions. Enabled for CPU v3 and above.
20349
20350 -mcpu=version
20351 This specifies which version of the eBPF ISA to target. Newer
20352 versions may not be supported by all kernels. The default is v3.
20353
20354 Supported values for version are:
20355
20356 v1 The first stable eBPF ISA with no special features or
20357 extensions.
20358
20359 v2 Supports the jump extensions, as in -mjmpext.
20360
20361 v3 All features of v2, plus:
20362
20363 -<32-bit jump operations, as in -mjmp32>
20364 -<32-bit ALU operations, as in -malu32>
20365 -mco-re
20366 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires
20367 and is implied by -gbtf.
20368
20369 -mno-co-re
20370 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-
20371 RE support is enabled by default when generating BTF debug
20372 information for the BPF target.
20373
20374 -mxbpf
20375 Generate code for an expanded version of BPF, which relaxes some of
20376 the restrictions imposed by the BPF architecture:
20377
20378 -<Save and restore callee-saved registers at function entry and>
20379 exit, respectively.
20380
20381 FR30 Options
20382
20383 These options are defined specifically for the FR30 port.
20384
20385 -msmall-model
20386 Use the small address space model. This can produce smaller code,
20387 but it does assume that all symbolic values and addresses fit into
20388 a 20-bit range.
20389
20390 -mno-lsim
20391 Assume that runtime support has been provided and so there is no
20392 need to include the simulator library (libsim.a) on the linker
20393 command line.
20394
20395 FT32 Options
20396
20397 These options are defined specifically for the FT32 port.
20398
20399 -msim
20400 Specifies that the program will be run on the simulator. This
20401 causes an alternate runtime startup and library to be linked. You
20402 must not use this option when generating programs that will run on
20403 real hardware; you must provide your own runtime library for
20404 whatever I/O functions are needed.
20405
20406 -mlra
20407 Enable Local Register Allocation. This is still experimental for
20408 FT32, so by default the compiler uses standard reload.
20409
20410 -mnodiv
20411 Do not use div and mod instructions.
20412
20413 -mft32b
20414 Enable use of the extended instructions of the FT32B processor.
20415
20416 -mcompress
20417 Compress all code using the Ft32B code compression scheme.
20418
20419 -mnopm
20420 Do not generate code that reads program memory.
20421
20422 FRV Options
20423
20424 -mgpr-32
20425 Only use the first 32 general-purpose registers.
20426
20427 -mgpr-64
20428 Use all 64 general-purpose registers.
20429
20430 -mfpr-32
20431 Use only the first 32 floating-point registers.
20432
20433 -mfpr-64
20434 Use all 64 floating-point registers.
20435
20436 -mhard-float
20437 Use hardware instructions for floating-point operations.
20438
20439 -msoft-float
20440 Use library routines for floating-point operations.
20441
20442 -malloc-cc
20443 Dynamically allocate condition code registers.
20444
20445 -mfixed-cc
20446 Do not try to dynamically allocate condition code registers, only
20447 use "icc0" and "fcc0".
20448
20449 -mdword
20450 Change ABI to use double word insns.
20451
20452 -mno-dword
20453 Do not use double word instructions.
20454
20455 -mdouble
20456 Use floating-point double instructions.
20457
20458 -mno-double
20459 Do not use floating-point double instructions.
20460
20461 -mmedia
20462 Use media instructions.
20463
20464 -mno-media
20465 Do not use media instructions.
20466
20467 -mmuladd
20468 Use multiply and add/subtract instructions.
20469
20470 -mno-muladd
20471 Do not use multiply and add/subtract instructions.
20472
20473 -mfdpic
20474 Select the FDPIC ABI, which uses function descriptors to represent
20475 pointers to functions. Without any PIC/PIE-related options, it
20476 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
20477 small data are within a 12-bit range from the GOT base address;
20478 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
20479 bfin-elf target, this option implies -msim.
20480
20481 -minline-plt
20482 Enable inlining of PLT entries in function calls to functions that
20483 are not known to bind locally. It has no effect without -mfdpic.
20484 It's enabled by default if optimizing for speed and compiling for
20485 shared libraries (i.e., -fPIC or -fpic), or when an optimization
20486 option such as -O3 or above is present in the command line.
20487
20488 -mTLS
20489 Assume a large TLS segment when generating thread-local code.
20490
20491 -mtls
20492 Do not assume a large TLS segment when generating thread-local
20493 code.
20494
20495 -mgprel-ro
20496 Enable the use of "GPREL" relocations in the FDPIC ABI for data
20497 that is known to be in read-only sections. It's enabled by
20498 default, except for -fpic or -fpie: even though it may help make
20499 the global offset table smaller, it trades 1 instruction for 4.
20500 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
20501 may be shared by multiple symbols, and it avoids the need for a GOT
20502 entry for the referenced symbol, so it's more likely to be a win.
20503 If it is not, -mno-gprel-ro can be used to disable it.
20504
20505 -multilib-library-pic
20506 Link with the (library, not FD) pic libraries. It's implied by
20507 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
20508 should never have to use it explicitly.
20509
20510 -mlinked-fp
20511 Follow the EABI requirement of always creating a frame pointer
20512 whenever a stack frame is allocated. This option is enabled by
20513 default and can be disabled with -mno-linked-fp.
20514
20515 -mlong-calls
20516 Use indirect addressing to call functions outside the current
20517 compilation unit. This allows the functions to be placed anywhere
20518 within the 32-bit address space.
20519
20520 -malign-labels
20521 Try to align labels to an 8-byte boundary by inserting NOPs into
20522 the previous packet. This option only has an effect when VLIW
20523 packing is enabled. It doesn't create new packets; it merely adds
20524 NOPs to existing ones.
20525
20526 -mlibrary-pic
20527 Generate position-independent EABI code.
20528
20529 -macc-4
20530 Use only the first four media accumulator registers.
20531
20532 -macc-8
20533 Use all eight media accumulator registers.
20534
20535 -mpack
20536 Pack VLIW instructions.
20537
20538 -mno-pack
20539 Do not pack VLIW instructions.
20540
20541 -mno-eflags
20542 Do not mark ABI switches in e_flags.
20543
20544 -mcond-move
20545 Enable the use of conditional-move instructions (default).
20546
20547 This switch is mainly for debugging the compiler and will likely be
20548 removed in a future version.
20549
20550 -mno-cond-move
20551 Disable the use of conditional-move instructions.
20552
20553 This switch is mainly for debugging the compiler and will likely be
20554 removed in a future version.
20555
20556 -mscc
20557 Enable the use of conditional set instructions (default).
20558
20559 This switch is mainly for debugging the compiler and will likely be
20560 removed in a future version.
20561
20562 -mno-scc
20563 Disable the use of conditional set instructions.
20564
20565 This switch is mainly for debugging the compiler and will likely be
20566 removed in a future version.
20567
20568 -mcond-exec
20569 Enable the use of conditional execution (default).
20570
20571 This switch is mainly for debugging the compiler and will likely be
20572 removed in a future version.
20573
20574 -mno-cond-exec
20575 Disable the use of conditional execution.
20576
20577 This switch is mainly for debugging the compiler and will likely be
20578 removed in a future version.
20579
20580 -mvliw-branch
20581 Run a pass to pack branches into VLIW instructions (default).
20582
20583 This switch is mainly for debugging the compiler and will likely be
20584 removed in a future version.
20585
20586 -mno-vliw-branch
20587 Do not run a pass to pack branches into VLIW instructions.
20588
20589 This switch is mainly for debugging the compiler and will likely be
20590 removed in a future version.
20591
20592 -mmulti-cond-exec
20593 Enable optimization of "&&" and "||" in conditional execution
20594 (default).
20595
20596 This switch is mainly for debugging the compiler and will likely be
20597 removed in a future version.
20598
20599 -mno-multi-cond-exec
20600 Disable optimization of "&&" and "||" in conditional execution.
20601
20602 This switch is mainly for debugging the compiler and will likely be
20603 removed in a future version.
20604
20605 -mnested-cond-exec
20606 Enable nested conditional execution optimizations (default).
20607
20608 This switch is mainly for debugging the compiler and will likely be
20609 removed in a future version.
20610
20611 -mno-nested-cond-exec
20612 Disable nested conditional execution optimizations.
20613
20614 This switch is mainly for debugging the compiler and will likely be
20615 removed in a future version.
20616
20617 -moptimize-membar
20618 This switch removes redundant "membar" instructions from the
20619 compiler-generated code. It is enabled by default.
20620
20621 -mno-optimize-membar
20622 This switch disables the automatic removal of redundant "membar"
20623 instructions from the generated code.
20624
20625 -mtomcat-stats
20626 Cause gas to print out tomcat statistics.
20627
20628 -mcpu=cpu
20629 Select the processor type for which to generate code. Possible
20630 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
20631 and simple.
20632
20633 GNU/Linux Options
20634
20635 These -m options are defined for GNU/Linux targets:
20636
20637 -mglibc
20638 Use the GNU C library. This is the default except on
20639 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
20640 targets.
20641
20642 -muclibc
20643 Use uClibc C library. This is the default on *-*-linux-*uclibc*
20644 targets.
20645
20646 -mmusl
20647 Use the musl C library. This is the default on *-*-linux-*musl*
20648 targets.
20649
20650 -mbionic
20651 Use Bionic C library. This is the default on *-*-linux-*android*
20652 targets.
20653
20654 -mandroid
20655 Compile code compatible with Android platform. This is the default
20656 on *-*-linux-*android* targets.
20657
20658 When compiling, this option enables -mbionic, -fPIC,
20659 -fno-exceptions and -fno-rtti by default. When linking, this
20660 option makes the GCC driver pass Android-specific options to the
20661 linker. Finally, this option causes the preprocessor macro
20662 "__ANDROID__" to be defined.
20663
20664 -tno-android-cc
20665 Disable compilation effects of -mandroid, i.e., do not enable
20666 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
20667
20668 -tno-android-ld
20669 Disable linking effects of -mandroid, i.e., pass standard Linux
20670 linking options to the linker.
20671
20672 H8/300 Options
20673
20674 These -m options are defined for the H8/300 implementations:
20675
20676 -mrelax
20677 Shorten some address references at link time, when possible; uses
20678 the linker option -relax.
20679
20680 -mh Generate code for the H8/300H.
20681
20682 -ms Generate code for the H8S.
20683
20684 -mn Generate code for the H8S and H8/300H in the normal mode. This
20685 switch must be used either with -mh or -ms.
20686
20687 -ms2600
20688 Generate code for the H8S/2600. This switch must be used with -ms.
20689
20690 -mexr
20691 Extended registers are stored on stack before execution of function
20692 with monitor attribute. Default option is -mexr. This option is
20693 valid only for H8S targets.
20694
20695 -mno-exr
20696 Extended registers are not stored on stack before execution of
20697 function with monitor attribute. Default option is -mno-exr. This
20698 option is valid only for H8S targets.
20699
20700 -mint32
20701 Make "int" data 32 bits by default.
20702
20703 -malign-300
20704 On the H8/300H and H8S, use the same alignment rules as for the
20705 H8/300. The default for the H8/300H and H8S is to align longs and
20706 floats on 4-byte boundaries. -malign-300 causes them to be aligned
20707 on 2-byte boundaries. This option has no effect on the H8/300.
20708
20709 HPPA Options
20710
20711 These -m options are defined for the HPPA family of computers:
20712
20713 -march=architecture-type
20714 Generate code for the specified architecture. The choices for
20715 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
20716 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
20717 system to determine the proper architecture option for your
20718 machine. Code compiled for lower numbered architectures runs on
20719 higher numbered architectures, but not the other way around.
20720
20721 -mpa-risc-1-0
20722 -mpa-risc-1-1
20723 -mpa-risc-2-0
20724 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
20725
20726 -mcaller-copies
20727 The caller copies function arguments passed by hidden reference.
20728 This option should be used with care as it is not compatible with
20729 the default 32-bit runtime. However, only aggregates larger than
20730 eight bytes are passed by hidden reference and the option provides
20731 better compatibility with OpenMP.
20732
20733 -mjump-in-delay
20734 This option is ignored and provided for compatibility purposes
20735 only.
20736
20737 -mdisable-fpregs
20738 Prevent floating-point registers from being used in any manner.
20739 This is necessary for compiling kernels that perform lazy context
20740 switching of floating-point registers. If you use this option and
20741 attempt to perform floating-point operations, the compiler aborts.
20742
20743 -mdisable-indexing
20744 Prevent the compiler from using indexing address modes. This
20745 avoids some rather obscure problems when compiling MIG generated
20746 code under MACH.
20747
20748 -mno-space-regs
20749 Generate code that assumes the target has no space registers. This
20750 allows GCC to generate faster indirect calls and use unscaled index
20751 address modes.
20752
20753 Such code is suitable for level 0 PA systems and kernels.
20754
20755 -mfast-indirect-calls
20756 Generate code that assumes calls never cross space boundaries.
20757 This allows GCC to emit code that performs faster indirect calls.
20758
20759 This option does not work in the presence of shared libraries or
20760 nested functions.
20761
20762 -mfixed-range=register-range
20763 Generate code treating the given register range as fixed registers.
20764 A fixed register is one that the register allocator cannot use.
20765 This is useful when compiling kernel code. A register range is
20766 specified as two registers separated by a dash. Multiple register
20767 ranges can be specified separated by a comma.
20768
20769 -mlong-load-store
20770 Generate 3-instruction load and store sequences as sometimes
20771 required by the HP-UX 10 linker. This is equivalent to the +k
20772 option to the HP compilers.
20773
20774 -mportable-runtime
20775 Use the portable calling conventions proposed by HP for ELF
20776 systems.
20777
20778 -mgas
20779 Enable the use of assembler directives only GAS understands.
20780
20781 -mschedule=cpu-type
20782 Schedule code according to the constraints for the machine type
20783 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
20784 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
20785 to determine the proper scheduling option for your machine. The
20786 default scheduling is 8000.
20787
20788 -mlinker-opt
20789 Enable the optimization pass in the HP-UX linker. Note this makes
20790 symbolic debugging impossible. It also triggers a bug in the HP-UX
20791 8 and HP-UX 9 linkers in which they give bogus error messages when
20792 linking some programs.
20793
20794 -msoft-float
20795 Generate output containing library calls for floating point.
20796 Warning: the requisite libraries are not available for all HPPA
20797 targets. Normally the facilities of the machine's usual C compiler
20798 are used, but this cannot be done directly in cross-compilation.
20799 You must make your own arrangements to provide suitable library
20800 functions for cross-compilation.
20801
20802 -msoft-float changes the calling convention in the output file;
20803 therefore, it is only useful if you compile all of a program with
20804 this option. In particular, you need to compile libgcc.a, the
20805 library that comes with GCC, with -msoft-float in order for this to
20806 work.
20807
20808 -msio
20809 Generate the predefine, "_SIO", for server IO. The default is
20810 -mwsio. This generates the predefines, "__hp9000s700",
20811 "__hp9000s700__" and "_WSIO", for workstation IO. These options
20812 are available under HP-UX and HI-UX.
20813
20814 -mgnu-ld
20815 Use options specific to GNU ld. This passes -shared to ld when
20816 building a shared library. It is the default when GCC is
20817 configured, explicitly or implicitly, with the GNU linker. This
20818 option does not affect which ld is called; it only changes what
20819 parameters are passed to that ld. The ld that is called is
20820 determined by the --with-ld configure option, GCC's program search
20821 path, and finally by the user's PATH. The linker used by GCC can
20822 be printed using which `gcc -print-prog-name=ld`. This option is
20823 only available on the 64-bit HP-UX GCC, i.e. configured with
20824 hppa*64*-*-hpux*.
20825
20826 -mhp-ld
20827 Use options specific to HP ld. This passes -b to ld when building
20828 a shared library and passes +Accept TypeMismatch to ld on all
20829 links. It is the default when GCC is configured, explicitly or
20830 implicitly, with the HP linker. This option does not affect which
20831 ld is called; it only changes what parameters are passed to that
20832 ld. The ld that is called is determined by the --with-ld configure
20833 option, GCC's program search path, and finally by the user's PATH.
20834 The linker used by GCC can be printed using which `gcc
20835 -print-prog-name=ld`. This option is only available on the 64-bit
20836 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
20837
20838 -mlong-calls
20839 Generate code that uses long call sequences. This ensures that a
20840 call is always able to reach linker generated stubs. The default
20841 is to generate long calls only when the distance from the call site
20842 to the beginning of the function or translation unit, as the case
20843 may be, exceeds a predefined limit set by the branch type being
20844 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
20845 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
20846 always limited at 240,000 bytes.
20847
20848 Distances are measured from the beginning of functions when using
20849 the -ffunction-sections option, or when using the -mgas and
20850 -mno-portable-runtime options together under HP-UX with the SOM
20851 linker.
20852
20853 It is normally not desirable to use this option as it degrades
20854 performance. However, it may be useful in large applications,
20855 particularly when partial linking is used to build the application.
20856
20857 The types of long calls used depends on the capabilities of the
20858 assembler and linker, and the type of code being generated. The
20859 impact on systems that support long absolute calls, and long pic
20860 symbol-difference or pc-relative calls should be relatively small.
20861 However, an indirect call is used on 32-bit ELF systems in pic code
20862 and it is quite long.
20863
20864 -munix=unix-std
20865 Generate compiler predefines and select a startfile for the
20866 specified UNIX standard. The choices for unix-std are 93, 95 and
20867 98. 93 is supported on all HP-UX versions. 95 is available on HP-
20868 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
20869 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
20870 11.00, and 98 for HP-UX 11.11 and later.
20871
20872 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
20873 -munix=95 provides additional predefines for "XOPEN_UNIX" and
20874 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
20875 provides additional predefines for "_XOPEN_UNIX",
20876 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
20877 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
20878
20879 It is important to note that this option changes the interfaces for
20880 various library routines. It also affects the operational behavior
20881 of the C library. Thus, extreme care is needed in using this
20882 option.
20883
20884 Library code that is intended to operate with more than one UNIX
20885 standard must test, set and restore the variable
20886 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
20887 provide this capability.
20888
20889 -nolibdld
20890 Suppress the generation of link options to search libdld.sl when
20891 the -static option is specified on HP-UX 10 and later.
20892
20893 -static
20894 The HP-UX implementation of setlocale in libc has a dependency on
20895 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20896 when the -static option is specified, special link options are
20897 needed to resolve this dependency.
20898
20899 On HP-UX 10 and later, the GCC driver adds the necessary options to
20900 link with libdld.sl when the -static option is specified. This
20901 causes the resulting binary to be dynamic. On the 64-bit port, the
20902 linkers generate dynamic binaries by default in any case. The
20903 -nolibdld option can be used to prevent the GCC driver from adding
20904 these link options.
20905
20906 -threads
20907 Add support for multithreading with the dce thread library under
20908 HP-UX. This option sets flags for both the preprocessor and
20909 linker.
20910
20911 IA-64 Options
20912
20913 These are the -m options defined for the Intel IA-64 architecture.
20914
20915 -mbig-endian
20916 Generate code for a big-endian target. This is the default for HP-
20917 UX.
20918
20919 -mlittle-endian
20920 Generate code for a little-endian target. This is the default for
20921 AIX5 and GNU/Linux.
20922
20923 -mgnu-as
20924 -mno-gnu-as
20925 Generate (or don't) code for the GNU assembler. This is the
20926 default.
20927
20928 -mgnu-ld
20929 -mno-gnu-ld
20930 Generate (or don't) code for the GNU linker. This is the default.
20931
20932 -mno-pic
20933 Generate code that does not use a global pointer register. The
20934 result is not position independent code, and violates the IA-64
20935 ABI.
20936
20937 -mvolatile-asm-stop
20938 -mno-volatile-asm-stop
20939 Generate (or don't) a stop bit immediately before and after
20940 volatile asm statements.
20941
20942 -mregister-names
20943 -mno-register-names
20944 Generate (or don't) in, loc, and out register names for the stacked
20945 registers. This may make assembler output more readable.
20946
20947 -mno-sdata
20948 -msdata
20949 Disable (or enable) optimizations that use the small data section.
20950 This may be useful for working around optimizer bugs.
20951
20952 -mconstant-gp
20953 Generate code that uses a single constant global pointer value.
20954 This is useful when compiling kernel code.
20955
20956 -mauto-pic
20957 Generate code that is self-relocatable. This implies
20958 -mconstant-gp. This is useful when compiling firmware code.
20959
20960 -minline-float-divide-min-latency
20961 Generate code for inline divides of floating-point values using the
20962 minimum latency algorithm.
20963
20964 -minline-float-divide-max-throughput
20965 Generate code for inline divides of floating-point values using the
20966 maximum throughput algorithm.
20967
20968 -mno-inline-float-divide
20969 Do not generate inline code for divides of floating-point values.
20970
20971 -minline-int-divide-min-latency
20972 Generate code for inline divides of integer values using the
20973 minimum latency algorithm.
20974
20975 -minline-int-divide-max-throughput
20976 Generate code for inline divides of integer values using the
20977 maximum throughput algorithm.
20978
20979 -mno-inline-int-divide
20980 Do not generate inline code for divides of integer values.
20981
20982 -minline-sqrt-min-latency
20983 Generate code for inline square roots using the minimum latency
20984 algorithm.
20985
20986 -minline-sqrt-max-throughput
20987 Generate code for inline square roots using the maximum throughput
20988 algorithm.
20989
20990 -mno-inline-sqrt
20991 Do not generate inline code for "sqrt".
20992
20993 -mfused-madd
20994 -mno-fused-madd
20995 Do (don't) generate code that uses the fused multiply/add or
20996 multiply/subtract instructions. The default is to use these
20997 instructions.
20998
20999 -mno-dwarf2-asm
21000 -mdwarf2-asm
21001 Don't (or do) generate assembler code for the DWARF line number
21002 debugging info. This may be useful when not using the GNU
21003 assembler.
21004
21005 -mearly-stop-bits
21006 -mno-early-stop-bits
21007 Allow stop bits to be placed earlier than immediately preceding the
21008 instruction that triggered the stop bit. This can improve
21009 instruction scheduling, but does not always do so.
21010
21011 -mfixed-range=register-range
21012 Generate code treating the given register range as fixed registers.
21013 A fixed register is one that the register allocator cannot use.
21014 This is useful when compiling kernel code. A register range is
21015 specified as two registers separated by a dash. Multiple register
21016 ranges can be specified separated by a comma.
21017
21018 -mtls-size=tls-size
21019 Specify bit size of immediate TLS offsets. Valid values are 14,
21020 22, and 64.
21021
21022 -mtune=cpu-type
21023 Tune the instruction scheduling for a particular CPU, Valid values
21024 are itanium, itanium1, merced, itanium2, and mckinley.
21025
21026 -milp32
21027 -mlp64
21028 Generate code for a 32-bit or 64-bit environment. The 32-bit
21029 environment sets int, long and pointer to 32 bits. The 64-bit
21030 environment sets int to 32 bits and long and pointer to 64 bits.
21031 These are HP-UX specific flags.
21032
21033 -mno-sched-br-data-spec
21034 -msched-br-data-spec
21035 (Dis/En)able data speculative scheduling before reload. This
21036 results in generation of "ld.a" instructions and the corresponding
21037 check instructions ("ld.c" / "chk.a"). The default setting is
21038 disabled.
21039
21040 -msched-ar-data-spec
21041 -mno-sched-ar-data-spec
21042 (En/Dis)able data speculative scheduling after reload. This
21043 results in generation of "ld.a" instructions and the corresponding
21044 check instructions ("ld.c" / "chk.a"). The default setting is
21045 enabled.
21046
21047 -mno-sched-control-spec
21048 -msched-control-spec
21049 (Dis/En)able control speculative scheduling. This feature is
21050 available only during region scheduling (i.e. before reload). This
21051 results in generation of the "ld.s" instructions and the
21052 corresponding check instructions "chk.s". The default setting is
21053 disabled.
21054
21055 -msched-br-in-data-spec
21056 -mno-sched-br-in-data-spec
21057 (En/Dis)able speculative scheduling of the instructions that are
21058 dependent on the data speculative loads before reload. This is
21059 effective only with -msched-br-data-spec enabled. The default
21060 setting is enabled.
21061
21062 -msched-ar-in-data-spec
21063 -mno-sched-ar-in-data-spec
21064 (En/Dis)able speculative scheduling of the instructions that are
21065 dependent on the data speculative loads after reload. This is
21066 effective only with -msched-ar-data-spec enabled. The default
21067 setting is enabled.
21068
21069 -msched-in-control-spec
21070 -mno-sched-in-control-spec
21071 (En/Dis)able speculative scheduling of the instructions that are
21072 dependent on the control speculative loads. This is effective only
21073 with -msched-control-spec enabled. The default setting is enabled.
21074
21075 -mno-sched-prefer-non-data-spec-insns
21076 -msched-prefer-non-data-spec-insns
21077 If enabled, data-speculative instructions are chosen for schedule
21078 only if there are no other choices at the moment. This makes the
21079 use of the data speculation much more conservative. The default
21080 setting is disabled.
21081
21082 -mno-sched-prefer-non-control-spec-insns
21083 -msched-prefer-non-control-spec-insns
21084 If enabled, control-speculative instructions are chosen for
21085 schedule only if there are no other choices at the moment. This
21086 makes the use of the control speculation much more conservative.
21087 The default setting is disabled.
21088
21089 -mno-sched-count-spec-in-critical-path
21090 -msched-count-spec-in-critical-path
21091 If enabled, speculative dependencies are considered during
21092 computation of the instructions priorities. This makes the use of
21093 the speculation a bit more conservative. The default setting is
21094 disabled.
21095
21096 -msched-spec-ldc
21097 Use a simple data speculation check. This option is on by default.
21098
21099 -msched-control-spec-ldc
21100 Use a simple check for control speculation. This option is on by
21101 default.
21102
21103 -msched-stop-bits-after-every-cycle
21104 Place a stop bit after every cycle when scheduling. This option is
21105 on by default.
21106
21107 -msched-fp-mem-deps-zero-cost
21108 Assume that floating-point stores and loads are not likely to cause
21109 a conflict when placed into the same instruction group. This
21110 option is disabled by default.
21111
21112 -msel-sched-dont-check-control-spec
21113 Generate checks for control speculation in selective scheduling.
21114 This flag is disabled by default.
21115
21116 -msched-max-memory-insns=max-insns
21117 Limit on the number of memory insns per instruction group, giving
21118 lower priority to subsequent memory insns attempting to schedule in
21119 the same instruction group. Frequently useful to prevent cache bank
21120 conflicts. The default value is 1.
21121
21122 -msched-max-memory-insns-hard-limit
21123 Makes the limit specified by msched-max-memory-insns a hard limit,
21124 disallowing more than that number in an instruction group.
21125 Otherwise, the limit is "soft", meaning that non-memory operations
21126 are preferred when the limit is reached, but memory operations may
21127 still be scheduled.
21128
21129 LM32 Options
21130
21131 These -m options are defined for the LatticeMico32 architecture:
21132
21133 -mbarrel-shift-enabled
21134 Enable barrel-shift instructions.
21135
21136 -mdivide-enabled
21137 Enable divide and modulus instructions.
21138
21139 -mmultiply-enabled
21140 Enable multiply instructions.
21141
21142 -msign-extend-enabled
21143 Enable sign extend instructions.
21144
21145 -muser-enabled
21146 Enable user-defined instructions.
21147
21148 LoongArch Options
21149
21150 These command-line options are defined for LoongArch targets:
21151
21152 -march=cpu-type
21153 Generate instructions for the machine type cpu-type. In contrast
21154 to -mtune=cpu-type, which merely tunes the generated code for the
21155 specified cpu-type, -march=cpu-type allows GCC to generate code
21156 that may not run at all on processors other than the one indicated.
21157 Specifying -march=cpu-type implies -mtune=cpu-type, except where
21158 noted otherwise.
21159
21160 The choices for cpu-type are:
21161
21162 native
21163 This selects the CPU to generate code for at compilation time
21164 by determining the processor type of the compiling machine.
21165 Using -march=native enables all instruction subsets supported
21166 by the local machine (hence the result might not run on
21167 different machines). Using -mtune=native produces code
21168 optimized for the local machine under the constraints of the
21169 selected instruction set.
21170
21171 loongarch64
21172 A generic CPU with 64-bit extensions.
21173
21174 la464
21175 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
21176
21177 -mtune=cpu-type
21178 Optimize the output for the given processor, specified by
21179 microarchitecture name.
21180
21181 -mabi=base-abi-type
21182 Generate code for the specified calling convention. base-abi-type
21183 can be one of:
21184
21185 lp64d
21186 Uses 64-bit general purpose registers and 32/64-bit floating-
21187 point registers for parameter passing. Data model is LP64,
21188 where int is 32 bits, while long int and pointers are 64 bits.
21189
21190 lp64f
21191 Uses 64-bit general purpose registers and 32-bit floating-point
21192 registers for parameter passing. Data model is LP64, where int
21193 is 32 bits, while long int and pointers are 64 bits.
21194
21195 lp64s
21196 Uses 64-bit general purpose registers and no floating-point
21197 registers for parameter passing. Data model is LP64, where int
21198 is 32 bits, while long int and pointers are 64 bits.
21199
21200 -mfpu=fpu-type
21201 Generate code for the specified FPU type, which can be one of:
21202
21203 64 Allow the use of hardware floating-point instructions for
21204 32-bit and 64-bit operations.
21205
21206 32 Allow the use of hardware floating-point instructions for
21207 32-bit operations.
21208
21209 none
21210 0 Prevent the use of hardware floating-point instructions.
21211
21212 -msoft-float
21213 Force -mfpu=none and prevents the use of floating-point registers
21214 for parameter passing. This option may change the target ABI.
21215
21216 -msingle-float
21217 Force -mfpu=32 and allow the use of 32-bit floating-point registers
21218 for parameter passing. This option may change the target ABI.
21219
21220 -mdouble-float
21221 Force -mfpu=64 and allow the use of 32/64-bit floating-point
21222 registers for parameter passing. This option may change the target
21223 ABI.
21224
21225 -mbranch-cost=n
21226 Set the cost of branches to roughly n instructions.
21227
21228 -mcheck-zero-division
21229 -mno-check-zero-divison
21230 Trap (do not trap) on integer division by zero. The default is
21231 -mcheck-zero-division.
21232
21233 -mcond-move-int
21234 -mno-cond-move-int
21235 Conditional moves for integral data in general-purpose registers
21236 are enabled (disabled). The default is -mcond-move-int.
21237
21238 -mcond-move-float
21239 -mno-cond-move-float
21240 Conditional moves for floating-point registers are enabled
21241 (disabled). The default is -mcond-move-float.
21242
21243 -mmemcpy
21244 -mno-memcpy
21245 Force (do not force) the use of "memcpy" for non-trivial block
21246 moves. The default is -mno-memcpy, which allows GCC to inline most
21247 constant-sized copies. Setting optimization level to -Os also
21248 forces the use of "memcpy", but -mno-memcpy may override this
21249 behavior if explicitly specified, regardless of the order these
21250 options on the command line.
21251
21252 -mstrict-align
21253 -mno-strict-align
21254 Avoid or allow generating memory accesses that may not be aligned
21255 on a natural object boundary as described in the architecture
21256 specification. The default is -mno-strict-align.
21257
21258 -msmall-data-limit=number
21259 Put global and static data smaller than number bytes into a special
21260 section (on some targets). The default value is 0.
21261
21262 -mmax-inline-memcpy-size=n
21263 Inline all block moves (such as calls to "memcpy" or structure
21264 copies) less than or equal to n bytes. The default value of n is
21265 1024.
21266
21267 -mcmodel=code-model
21268 Set the code model to one of:
21269
21270 tiny-static
21271 * local symbol and global strong symbol: The data section
21272 must be within +/-2MiB addressing space. The text section
21273 must be within +/-128MiB addressing space.
21274
21275 * global weak symbol: The got table must be within +/-2GiB
21276 addressing space.
21277
21278 tiny
21279 * local symbol: The data section must be within +/-2MiB
21280 addressing space. The text section must be within
21281 +/-128MiB addressing space.
21282
21283 * global symbol: The got table must be within +/-2GiB
21284 addressing space.
21285
21286 normal
21287 * local symbol: The data section must be within +/-2GiB
21288 addressing space. The text section must be within
21289 +/-128MiB addressing space.
21290
21291 * global symbol: The got table must be within +/-2GiB
21292 addressing space.
21293
21294 large
21295 * local symbol: The data section must be within +/-2GiB
21296 addressing space. The text section must be within
21297 +/-128GiB addressing space.
21298
21299 * global symbol: The got table must be within +/-2GiB
21300 addressing space.
21301
21302 extreme(Not implemented yet)
21303 * local symbol: The data and text section must be within
21304 +/-8EiB addressing space.
21305
21306 * global symbol: The data got table must be within +/-8EiB
21307 addressing space.
21308
21309 The default code model is "normal".
21310
21311 M32C Options
21312
21313 -mcpu=name
21314 Select the CPU for which code is generated. name may be one of r8c
21315 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
21316 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
21317
21318 -msim
21319 Specifies that the program will be run on the simulator. This
21320 causes an alternate runtime library to be linked in which supports,
21321 for example, file I/O. You must not use this option when
21322 generating programs that will run on real hardware; you must
21323 provide your own runtime library for whatever I/O functions are
21324 needed.
21325
21326 -memregs=number
21327 Specifies the number of memory-based pseudo-registers GCC uses
21328 during code generation. These pseudo-registers are used like real
21329 registers, so there is a tradeoff between GCC's ability to fit the
21330 code into available registers, and the performance penalty of using
21331 memory instead of registers. Note that all modules in a program
21332 must be compiled with the same value for this option. Because of
21333 that, you must not use this option with GCC's default runtime
21334 libraries.
21335
21336 M32R/D Options
21337
21338 These -m options are defined for Renesas M32R/D architectures:
21339
21340 -m32r2
21341 Generate code for the M32R/2.
21342
21343 -m32rx
21344 Generate code for the M32R/X.
21345
21346 -m32r
21347 Generate code for the M32R. This is the default.
21348
21349 -mmodel=small
21350 Assume all objects live in the lower 16MB of memory (so that their
21351 addresses can be loaded with the "ld24" instruction), and assume
21352 all subroutines are reachable with the "bl" instruction. This is
21353 the default.
21354
21355 The addressability of a particular object can be set with the
21356 "model" attribute.
21357
21358 -mmodel=medium
21359 Assume objects may be anywhere in the 32-bit address space (the
21360 compiler generates "seth/add3" instructions to load their
21361 addresses), and assume all subroutines are reachable with the "bl"
21362 instruction.
21363
21364 -mmodel=large
21365 Assume objects may be anywhere in the 32-bit address space (the
21366 compiler generates "seth/add3" instructions to load their
21367 addresses), and assume subroutines may not be reachable with the
21368 "bl" instruction (the compiler generates the much slower
21369 "seth/add3/jl" instruction sequence).
21370
21371 -msdata=none
21372 Disable use of the small data area. Variables are put into one of
21373 ".data", ".bss", or ".rodata" (unless the "section" attribute has
21374 been specified). This is the default.
21375
21376 The small data area consists of sections ".sdata" and ".sbss".
21377 Objects may be explicitly put in the small data area with the
21378 "section" attribute using one of these sections.
21379
21380 -msdata=sdata
21381 Put small global and static data in the small data area, but do not
21382 generate special code to reference them.
21383
21384 -msdata=use
21385 Put small global and static data in the small data area, and
21386 generate special instructions to reference them.
21387
21388 -G num
21389 Put global and static objects less than or equal to num bytes into
21390 the small data or BSS sections instead of the normal data or BSS
21391 sections. The default value of num is 8. The -msdata option must
21392 be set to one of sdata or use for this option to have any effect.
21393
21394 All modules should be compiled with the same -G num value.
21395 Compiling with different values of num may or may not work; if it
21396 doesn't the linker gives an error message---incorrect code is not
21397 generated.
21398
21399 -mdebug
21400 Makes the M32R-specific code in the compiler display some
21401 statistics that might help in debugging programs.
21402
21403 -malign-loops
21404 Align all loops to a 32-byte boundary.
21405
21406 -mno-align-loops
21407 Do not enforce a 32-byte alignment for loops. This is the default.
21408
21409 -missue-rate=number
21410 Issue number instructions per cycle. number can only be 1 or 2.
21411
21412 -mbranch-cost=number
21413 number can only be 1 or 2. If it is 1 then branches are preferred
21414 over conditional code, if it is 2, then the opposite applies.
21415
21416 -mflush-trap=number
21417 Specifies the trap number to use to flush the cache. The default
21418 is 12. Valid numbers are between 0 and 15 inclusive.
21419
21420 -mno-flush-trap
21421 Specifies that the cache cannot be flushed by using a trap.
21422
21423 -mflush-func=name
21424 Specifies the name of the operating system function to call to
21425 flush the cache. The default is _flush_cache, but a function call
21426 is only used if a trap is not available.
21427
21428 -mno-flush-func
21429 Indicates that there is no OS function for flushing the cache.
21430
21431 M680x0 Options
21432
21433 These are the -m options defined for M680x0 and ColdFire processors.
21434 The default settings depend on which architecture was selected when the
21435 compiler was configured; the defaults for the most common choices are
21436 given below.
21437
21438 -march=arch
21439 Generate code for a specific M680x0 or ColdFire instruction set
21440 architecture. Permissible values of arch for M680x0 architectures
21441 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
21442 architectures are selected according to Freescale's ISA
21443 classification and the permissible values are: isaa, isaaplus, isab
21444 and isac.
21445
21446 GCC defines a macro "__mcfarch__" whenever it is generating code
21447 for a ColdFire target. The arch in this macro is one of the -march
21448 arguments given above.
21449
21450 When used together, -march and -mtune select code that runs on a
21451 family of similar processors but that is optimized for a particular
21452 microarchitecture.
21453
21454 -mcpu=cpu
21455 Generate code for a specific M680x0 or ColdFire processor. The
21456 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
21457 68332 and cpu32. The ColdFire cpus are given by the table below,
21458 which also classifies the CPUs into families:
21459
21460 Family : -mcpu arguments
21461 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
21462 5206 : 5202 5204 5206
21463 5206e : 5206e
21464 5208 : 5207 5208
21465 5211a : 5210a 5211a
21466 5213 : 5211 5212 5213
21467 5216 : 5214 5216
21468 52235 : 52230 52231 52232 52233 52234 52235
21469 5225 : 5224 5225
21470 52259 : 52252 52254 52255 52256 52258 52259
21471 5235 : 5232 5233 5234 5235 523x
21472 5249 : 5249
21473 5250 : 5250
21474 5271 : 5270 5271
21475 5272 : 5272
21476 5275 : 5274 5275
21477 5282 : 5280 5281 5282 528x
21478 53017 : 53011 53012 53013 53014 53015 53016 53017
21479 5307 : 5307
21480 5329 : 5327 5328 5329 532x
21481 5373 : 5372 5373 537x
21482 5407 : 5407
21483 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
21484 5485
21485
21486 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
21487 Other combinations of -mcpu and -march are rejected.
21488
21489 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
21490 selected. It also defines "__mcf_family_family", where the value
21491 of family is given by the table above.
21492
21493 -mtune=tune
21494 Tune the code for a particular microarchitecture within the
21495 constraints set by -march and -mcpu. The M680x0 microarchitectures
21496 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
21497 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
21498
21499 You can also use -mtune=68020-40 for code that needs to run
21500 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
21501 is similar but includes 68060 targets as well. These two options
21502 select the same tuning decisions as -m68020-40 and -m68020-60
21503 respectively.
21504
21505 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
21506 680x0 architecture arch. It also defines "mcarch" unless either
21507 -ansi or a non-GNU -std option is used. If GCC is tuning for a
21508 range of architectures, as selected by -mtune=68020-40 or
21509 -mtune=68020-60, it defines the macros for every architecture in
21510 the range.
21511
21512 GCC also defines the macro "__muarch__" when tuning for ColdFire
21513 microarchitecture uarch, where uarch is one of the arguments given
21514 above.
21515
21516 -m68000
21517 -mc68000
21518 Generate output for a 68000. This is the default when the compiler
21519 is configured for 68000-based systems. It is equivalent to
21520 -march=68000.
21521
21522 Use this option for microcontrollers with a 68000 or EC000 core,
21523 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21524
21525 -m68010
21526 Generate output for a 68010. This is the default when the compiler
21527 is configured for 68010-based systems. It is equivalent to
21528 -march=68010.
21529
21530 -m68020
21531 -mc68020
21532 Generate output for a 68020. This is the default when the compiler
21533 is configured for 68020-based systems. It is equivalent to
21534 -march=68020.
21535
21536 -m68030
21537 Generate output for a 68030. This is the default when the compiler
21538 is configured for 68030-based systems. It is equivalent to
21539 -march=68030.
21540
21541 -m68040
21542 Generate output for a 68040. This is the default when the compiler
21543 is configured for 68040-based systems. It is equivalent to
21544 -march=68040.
21545
21546 This option inhibits the use of 68881/68882 instructions that have
21547 to be emulated by software on the 68040. Use this option if your
21548 68040 does not have code to emulate those instructions.
21549
21550 -m68060
21551 Generate output for a 68060. This is the default when the compiler
21552 is configured for 68060-based systems. It is equivalent to
21553 -march=68060.
21554
21555 This option inhibits the use of 68020 and 68881/68882 instructions
21556 that have to be emulated by software on the 68060. Use this option
21557 if your 68060 does not have code to emulate those instructions.
21558
21559 -mcpu32
21560 Generate output for a CPU32. This is the default when the compiler
21561 is configured for CPU32-based systems. It is equivalent to
21562 -march=cpu32.
21563
21564 Use this option for microcontrollers with a CPU32 or CPU32+ core,
21565 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
21566 68341, 68349 and 68360.
21567
21568 -m5200
21569 Generate output for a 520X ColdFire CPU. This is the default when
21570 the compiler is configured for 520X-based systems. It is
21571 equivalent to -mcpu=5206, and is now deprecated in favor of that
21572 option.
21573
21574 Use this option for microcontroller with a 5200 core, including the
21575 MCF5202, MCF5203, MCF5204 and MCF5206.
21576
21577 -m5206e
21578 Generate output for a 5206e ColdFire CPU. The option is now
21579 deprecated in favor of the equivalent -mcpu=5206e.
21580
21581 -m528x
21582 Generate output for a member of the ColdFire 528X family. The
21583 option is now deprecated in favor of the equivalent -mcpu=528x.
21584
21585 -m5307
21586 Generate output for a ColdFire 5307 CPU. The option is now
21587 deprecated in favor of the equivalent -mcpu=5307.
21588
21589 -m5407
21590 Generate output for a ColdFire 5407 CPU. The option is now
21591 deprecated in favor of the equivalent -mcpu=5407.
21592
21593 -mcfv4e
21594 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
21595 This includes use of hardware floating-point instructions. The
21596 option is equivalent to -mcpu=547x, and is now deprecated in favor
21597 of that option.
21598
21599 -m68020-40
21600 Generate output for a 68040, without using any of the new
21601 instructions. This results in code that can run relatively
21602 efficiently on either a 68020/68881 or a 68030 or a 68040. The
21603 generated code does use the 68881 instructions that are emulated on
21604 the 68040.
21605
21606 The option is equivalent to -march=68020 -mtune=68020-40.
21607
21608 -m68020-60
21609 Generate output for a 68060, without using any of the new
21610 instructions. This results in code that can run relatively
21611 efficiently on either a 68020/68881 or a 68030 or a 68040. The
21612 generated code does use the 68881 instructions that are emulated on
21613 the 68060.
21614
21615 The option is equivalent to -march=68020 -mtune=68020-60.
21616
21617 -mhard-float
21618 -m68881
21619 Generate floating-point instructions. This is the default for
21620 68020 and above, and for ColdFire devices that have an FPU. It
21621 defines the macro "__HAVE_68881__" on M680x0 targets and
21622 "__mcffpu__" on ColdFire targets.
21623
21624 -msoft-float
21625 Do not generate floating-point instructions; use library calls
21626 instead. This is the default for 68000, 68010, and 68832 targets.
21627 It is also the default for ColdFire devices that have no FPU.
21628
21629 -mdiv
21630 -mno-div
21631 Generate (do not generate) ColdFire hardware divide and remainder
21632 instructions. If -march is used without -mcpu, the default is "on"
21633 for ColdFire architectures and "off" for M680x0 architectures.
21634 Otherwise, the default is taken from the target CPU (either the
21635 default CPU, or the one specified by -mcpu). For example, the
21636 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
21637
21638 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
21639
21640 -mshort
21641 Consider type "int" to be 16 bits wide, like "short int".
21642 Additionally, parameters passed on the stack are also aligned to a
21643 16-bit boundary even on targets whose API mandates promotion to
21644 32-bit.
21645
21646 -mno-short
21647 Do not consider type "int" to be 16 bits wide. This is the
21648 default.
21649
21650 -mnobitfield
21651 -mno-bitfield
21652 Do not use the bit-field instructions. The -m68000, -mcpu32 and
21653 -m5200 options imply -mnobitfield.
21654
21655 -mbitfield
21656 Do use the bit-field instructions. The -m68020 option implies
21657 -mbitfield. This is the default if you use a configuration
21658 designed for a 68020.
21659
21660 -mrtd
21661 Use a different function-calling convention, in which functions
21662 that take a fixed number of arguments return with the "rtd"
21663 instruction, which pops their arguments while returning. This
21664 saves one instruction in the caller since there is no need to pop
21665 the arguments there.
21666
21667 This calling convention is incompatible with the one normally used
21668 on Unix, so you cannot use it if you need to call libraries
21669 compiled with the Unix compiler.
21670
21671 Also, you must provide function prototypes for all functions that
21672 take variable numbers of arguments (including "printf"); otherwise
21673 incorrect code is generated for calls to those functions.
21674
21675 In addition, seriously incorrect code results if you call a
21676 function with too many arguments. (Normally, extra arguments are
21677 harmlessly ignored.)
21678
21679 The "rtd" instruction is supported by the 68010, 68020, 68030,
21680 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21681
21682 The default is -mno-rtd.
21683
21684 -malign-int
21685 -mno-align-int
21686 Control whether GCC aligns "int", "long", "long long", "float",
21687 "double", and "long double" variables on a 32-bit boundary
21688 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
21689 variables on 32-bit boundaries produces code that runs somewhat
21690 faster on processors with 32-bit busses at the expense of more
21691 memory.
21692
21693 Warning: if you use the -malign-int switch, GCC aligns structures
21694 containing the above types differently than most published
21695 application binary interface specifications for the m68k.
21696
21697 Use the pc-relative addressing mode of the 68000 directly, instead
21698 of using a global offset table. At present, this option implies
21699 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
21700 -fPIC is not presently supported with -mpcrel, though this could be
21701 supported for 68020 and higher processors.
21702
21703 -mno-strict-align
21704 -mstrict-align
21705 Do not (do) assume that unaligned memory references are handled by
21706 the system.
21707
21708 -msep-data
21709 Generate code that allows the data segment to be located in a
21710 different area of memory from the text segment. This allows for
21711 execute-in-place in an environment without virtual memory
21712 management. This option implies -fPIC.
21713
21714 -mno-sep-data
21715 Generate code that assumes that the data segment follows the text
21716 segment. This is the default.
21717
21718 -mid-shared-library
21719 Generate code that supports shared libraries via the library ID
21720 method. This allows for execute-in-place and shared libraries in
21721 an environment without virtual memory management. This option
21722 implies -fPIC.
21723
21724 -mno-id-shared-library
21725 Generate code that doesn't assume ID-based shared libraries are
21726 being used. This is the default.
21727
21728 -mshared-library-id=n
21729 Specifies the identification number of the ID-based shared library
21730 being compiled. Specifying a value of 0 generates more compact
21731 code; specifying other values forces the allocation of that number
21732 to the current library, but is no more space- or time-efficient
21733 than omitting this option.
21734
21735 -mxgot
21736 -mno-xgot
21737 When generating position-independent code for ColdFire, generate
21738 code that works if the GOT has more than 8192 entries. This code
21739 is larger and slower than code generated without this option. On
21740 M680x0 processors, this option is not needed; -fPIC suffices.
21741
21742 GCC normally uses a single instruction to load values from the GOT.
21743 While this is relatively efficient, it only works if the GOT is
21744 smaller than about 64k. Anything larger causes the linker to
21745 report an error such as:
21746
21747 relocation truncated to fit: R_68K_GOT16O foobar
21748
21749 If this happens, you should recompile your code with -mxgot. It
21750 should then work with very large GOTs. However, code generated
21751 with -mxgot is less efficient, since it takes 4 instructions to
21752 fetch the value of a global symbol.
21753
21754 Note that some linkers, including newer versions of the GNU linker,
21755 can create multiple GOTs and sort GOT entries. If you have such a
21756 linker, you should only need to use -mxgot when compiling a single
21757 object file that accesses more than 8192 GOT entries. Very few do.
21758
21759 These options have no effect unless GCC is generating position-
21760 independent code.
21761
21762 -mlong-jump-table-offsets
21763 Use 32-bit offsets in "switch" tables. The default is to use
21764 16-bit offsets.
21765
21766 MCore Options
21767
21768 These are the -m options defined for the Motorola M*Core processors.
21769
21770 -mhardlit
21771 -mno-hardlit
21772 Inline constants into the code stream if it can be done in two
21773 instructions or less.
21774
21775 -mdiv
21776 -mno-div
21777 Use the divide instruction. (Enabled by default).
21778
21779 -mrelax-immediate
21780 -mno-relax-immediate
21781 Allow arbitrary-sized immediates in bit operations.
21782
21783 -mwide-bitfields
21784 -mno-wide-bitfields
21785 Always treat bit-fields as "int"-sized.
21786
21787 -m4byte-functions
21788 -mno-4byte-functions
21789 Force all functions to be aligned to a 4-byte boundary.
21790
21791 -mcallgraph-data
21792 -mno-callgraph-data
21793 Emit callgraph information.
21794
21795 -mslow-bytes
21796 -mno-slow-bytes
21797 Prefer word access when reading byte quantities.
21798
21799 -mlittle-endian
21800 -mbig-endian
21801 Generate code for a little-endian target.
21802
21803 -m210
21804 -m340
21805 Generate code for the 210 processor.
21806
21807 -mno-lsim
21808 Assume that runtime support has been provided and so omit the
21809 simulator library (libsim.a) from the linker command line.
21810
21811 -mstack-increment=size
21812 Set the maximum amount for a single stack increment operation.
21813 Large values can increase the speed of programs that contain
21814 functions that need a large amount of stack space, but they can
21815 also trigger a segmentation fault if the stack is extended too
21816 much. The default value is 0x1000.
21817
21818 MeP Options
21819
21820 -mabsdiff
21821 Enables the "abs" instruction, which is the absolute difference
21822 between two registers.
21823
21824 -mall-opts
21825 Enables all the optional instructions---average, multiply, divide,
21826 bit operations, leading zero, absolute difference, min/max, clip,
21827 and saturation.
21828
21829 -maverage
21830 Enables the "ave" instruction, which computes the average of two
21831 registers.
21832
21833 -mbased=n
21834 Variables of size n bytes or smaller are placed in the ".based"
21835 section by default. Based variables use the $tp register as a base
21836 register, and there is a 128-byte limit to the ".based" section.
21837
21838 -mbitops
21839 Enables the bit operation instructions---bit test ("btstm"), set
21840 ("bsetm"), clear ("bclrm"), invert ("bnotm"), and test-and-set
21841 ("tas").
21842
21843 -mc=name
21844 Selects which section constant data is placed in. name may be
21845 tiny, near, or far.
21846
21847 -mclip
21848 Enables the "clip" instruction. Note that -mclip is not useful
21849 unless you also provide -mminmax.
21850
21851 -mconfig=name
21852 Selects one of the built-in core configurations. Each MeP chip has
21853 one or more modules in it; each module has a core CPU and a variety
21854 of coprocessors, optional instructions, and peripherals. The
21855 "MeP-Integrator" tool, not part of GCC, provides these
21856 configurations through this option; using this option is the same
21857 as using all the corresponding command-line options. The default
21858 configuration is default.
21859
21860 -mcop
21861 Enables the coprocessor instructions. By default, this is a 32-bit
21862 coprocessor. Note that the coprocessor is normally enabled via the
21863 -mconfig= option.
21864
21865 -mcop32
21866 Enables the 32-bit coprocessor's instructions.
21867
21868 -mcop64
21869 Enables the 64-bit coprocessor's instructions.
21870
21871 -mivc2
21872 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21873
21874 -mdc
21875 Causes constant variables to be placed in the ".near" section.
21876
21877 -mdiv
21878 Enables the "div" and "divu" instructions.
21879
21880 -meb
21881 Generate big-endian code.
21882
21883 -mel
21884 Generate little-endian code.
21885
21886 -mio-volatile
21887 Tells the compiler that any variable marked with the "io" attribute
21888 is to be considered volatile.
21889
21890 -ml Causes variables to be assigned to the ".far" section by default.
21891
21892 -mleadz
21893 Enables the "leadz" (leading zero) instruction.
21894
21895 -mm Causes variables to be assigned to the ".near" section by default.
21896
21897 -mminmax
21898 Enables the "min" and "max" instructions.
21899
21900 -mmult
21901 Enables the multiplication and multiply-accumulate instructions.
21902
21903 -mno-opts
21904 Disables all the optional instructions enabled by -mall-opts.
21905
21906 -mrepeat
21907 Enables the "repeat" and "erepeat" instructions, used for low-
21908 overhead looping.
21909
21910 -ms Causes all variables to default to the ".tiny" section. Note that
21911 there is a 65536-byte limit to this section. Accesses to these
21912 variables use the %gp base register.
21913
21914 -msatur
21915 Enables the saturation instructions. Note that the compiler does
21916 not currently generate these itself, but this option is included
21917 for compatibility with other tools, like "as".
21918
21919 -msdram
21920 Link the SDRAM-based runtime instead of the default ROM-based
21921 runtime.
21922
21923 -msim
21924 Link the simulator run-time libraries.
21925
21926 -msimnovec
21927 Link the simulator runtime libraries, excluding built-in support
21928 for reset and exception vectors and tables.
21929
21930 -mtf
21931 Causes all functions to default to the ".far" section. Without
21932 this option, functions default to the ".near" section.
21933
21934 -mtiny=n
21935 Variables that are n bytes or smaller are allocated to the ".tiny"
21936 section. These variables use the $gp base register. The default
21937 for this option is 4, but note that there's a 65536-byte limit to
21938 the ".tiny" section.
21939
21940 MicroBlaze Options
21941
21942 -msoft-float
21943 Use software emulation for floating point (default).
21944
21945 -mhard-float
21946 Use hardware floating-point instructions.
21947
21948 -mmemcpy
21949 Do not optimize block moves, use "memcpy".
21950
21951 -mno-clearbss
21952 This option is deprecated. Use -fno-zero-initialized-in-bss
21953 instead.
21954
21955 -mcpu=cpu-type
21956 Use features of, and schedule code for, the given CPU. Supported
21957 values are in the format vX.YY.Z, where X is a major version, YY is
21958 the minor version, and Z is compatibility code. Example values are
21959 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
21960
21961 -mxl-soft-mul
21962 Use software multiply emulation (default).
21963
21964 -mxl-soft-div
21965 Use software emulation for divides (default).
21966
21967 -mxl-barrel-shift
21968 Use the hardware barrel shifter.
21969
21970 -mxl-pattern-compare
21971 Use pattern compare instructions.
21972
21973 -msmall-divides
21974 Use table lookup optimization for small signed integer divisions.
21975
21976 -mxl-stack-check
21977 This option is deprecated. Use -fstack-check instead.
21978
21979 -mxl-gp-opt
21980 Use GP-relative ".sdata"/".sbss" sections.
21981
21982 -mxl-multiply-high
21983 Use multiply high instructions for high part of 32x32 multiply.
21984
21985 -mxl-float-convert
21986 Use hardware floating-point conversion instructions.
21987
21988 -mxl-float-sqrt
21989 Use hardware floating-point square root instruction.
21990
21991 -mbig-endian
21992 Generate code for a big-endian target.
21993
21994 -mlittle-endian
21995 Generate code for a little-endian target.
21996
21997 -mxl-reorder
21998 Use reorder instructions (swap and byte reversed load/store).
21999
22000 -mxl-mode-app-model
22001 Select application model app-model. Valid models are
22002
22003 executable
22004 normal executable (default), uses startup code crt0.o.
22005
22006 xmdstub
22007 for use with Xilinx Microprocessor Debugger (XMD) based
22008 software intrusive debug agent called xmdstub. This uses
22009 startup file crt1.o and sets the start address of the program
22010 to 0x800.
22011
22012 bootstrap
22013 for applications that are loaded using a bootloader. This
22014 model uses startup file crt2.o which does not contain a
22015 processor reset vector handler. This is suitable for
22016 transferring control on a processor reset to the bootloader
22017 rather than the application.
22018
22019 novectors
22020 for applications that do not require any of the MicroBlaze
22021 vectors. This option may be useful for applications running
22022 within a monitoring application. This model uses crt3.o as a
22023 startup file.
22024
22025 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
22026 model.
22027
22028 -mpic-data-is-text-relative
22029 Assume that the displacement between the text and data segments is
22030 fixed at static link time. This allows data to be referenced by
22031 offset from start of text address instead of GOT since PC-relative
22032 addressing is not supported.
22033
22034 MIPS Options
22035
22036 -EB Generate big-endian code.
22037
22038 -EL Generate little-endian code. This is the default for mips*el-*-*
22039 configurations.
22040
22041 -march=arch
22042 Generate code that runs on arch, which can be the name of a generic
22043 MIPS ISA, or the name of a particular processor. The ISA names
22044 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
22045 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
22046 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
22047 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
22048 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
22049 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
22050 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
22051 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
22052 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
22053 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
22054 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
22055 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
22056 and xlp. The special value from-abi selects the most compatible
22057 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
22058 and mips3 for 64-bit ABIs).
22059
22060 The native Linux/GNU toolchain also supports the value native,
22061 which selects the best architecture option for the host processor.
22062 -march=native has no effect if GCC does not recognize the
22063 processor.
22064
22065 In processor names, a final 000 can be abbreviated as k (for
22066 example, -march=r2k). Prefixes are optional, and vr may be written
22067 r.
22068
22069 Names of the form nf2_1 refer to processors with FPUs clocked at
22070 half the rate of the core, names of the form nf1_1 refer to
22071 processors with FPUs clocked at the same rate as the core, and
22072 names of the form nf3_2 refer to processors with FPUs clocked a
22073 ratio of 3:2 with respect to the core. For compatibility reasons,
22074 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
22075 as synonyms for nf1_1.
22076
22077 GCC defines two macros based on the value of this option. The
22078 first is "_MIPS_ARCH", which gives the name of target architecture,
22079 as a string. The second has the form "_MIPS_ARCH_foo", where foo
22080 is the capitalized value of "_MIPS_ARCH". For example,
22081 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
22082 "_MIPS_ARCH_R2000".
22083
22084 Note that the "_MIPS_ARCH" macro uses the processor names given
22085 above. In other words, it has the full prefix and does not
22086 abbreviate 000 as k. In the case of from-abi, the macro names the
22087 resolved architecture (either "mips1" or "mips3"). It names the
22088 default architecture when no -march option is given.
22089
22090 -mtune=arch
22091 Optimize for arch. Among other things, this option controls the
22092 way instructions are scheduled, and the perceived cost of
22093 arithmetic operations. The list of arch values is the same as for
22094 -march.
22095
22096 When this option is not used, GCC optimizes for the processor
22097 specified by -march. By using -march and -mtune together, it is
22098 possible to generate code that runs on a family of processors, but
22099 optimize the code for one particular member of that family.
22100
22101 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
22102 work in the same way as the -march ones described above.
22103
22104 -mips1
22105 Equivalent to -march=mips1.
22106
22107 -mips2
22108 Equivalent to -march=mips2.
22109
22110 -mips3
22111 Equivalent to -march=mips3.
22112
22113 -mips4
22114 Equivalent to -march=mips4.
22115
22116 -mips32
22117 Equivalent to -march=mips32.
22118
22119 -mips32r3
22120 Equivalent to -march=mips32r3.
22121
22122 -mips32r5
22123 Equivalent to -march=mips32r5.
22124
22125 -mips32r6
22126 Equivalent to -march=mips32r6.
22127
22128 -mips64
22129 Equivalent to -march=mips64.
22130
22131 -mips64r2
22132 Equivalent to -march=mips64r2.
22133
22134 -mips64r3
22135 Equivalent to -march=mips64r3.
22136
22137 -mips64r5
22138 Equivalent to -march=mips64r5.
22139
22140 -mips64r6
22141 Equivalent to -march=mips64r6.
22142
22143 -mips16
22144 -mno-mips16
22145 Generate (do not generate) MIPS16 code. If GCC is targeting a
22146 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
22147
22148 MIPS16 code generation can also be controlled on a per-function
22149 basis by means of "mips16" and "nomips16" attributes.
22150
22151 -mflip-mips16
22152 Generate MIPS16 code on alternating functions. This option is
22153 provided for regression testing of mixed MIPS16/non-MIPS16 code
22154 generation, and is not intended for ordinary use in compiling user
22155 code.
22156
22157 -minterlink-compressed
22158 -mno-interlink-compressed
22159 Require (do not require) that code using the standard
22160 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
22161 microMIPS code, and vice versa.
22162
22163 For example, code using the standard ISA encoding cannot jump
22164 directly to MIPS16 or microMIPS code; it must either use a call or
22165 an indirect jump. -minterlink-compressed therefore disables direct
22166 jumps unless GCC knows that the target of the jump is not
22167 compressed.
22168
22169 -minterlink-mips16
22170 -mno-interlink-mips16
22171 Aliases of -minterlink-compressed and -mno-interlink-compressed.
22172 These options predate the microMIPS ASE and are retained for
22173 backwards compatibility.
22174
22175 -mabi=32
22176 -mabi=o64
22177 -mabi=n32
22178 -mabi=64
22179 -mabi=eabi
22180 Generate code for the given ABI.
22181
22182 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
22183 generates 64-bit code when you select a 64-bit architecture, but
22184 you can use -mgp32 to get 32-bit code instead.
22185
22186 For information about the O64 ABI, see
22187 <https://gcc.gnu.org/projects/mipso64-abi.html>.
22188
22189 GCC supports a variant of the o32 ABI in which floating-point
22190 registers are 64 rather than 32 bits wide. You can select this
22191 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
22192 and "mfhc1" instructions and is therefore only supported for
22193 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
22194
22195 The register assignments for arguments and return values remain the
22196 same, but each scalar value is passed in a single 64-bit register
22197 rather than a pair of 32-bit registers. For example, scalar
22198 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
22199 The set of call-saved registers also remains the same in that the
22200 even-numbered double-precision registers are saved.
22201
22202 Two additional variants of the o32 ABI are supported to enable a
22203 transition from 32-bit to 64-bit registers. These are FPXX
22204 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
22205 mandates that all code must execute correctly when run using 32-bit
22206 or 64-bit registers. The code can be interlinked with either FP32
22207 or FP64, but not both. The FP64A extension is similar to the FP64
22208 extension but forbids the use of odd-numbered single-precision
22209 registers. This can be used in conjunction with the "FRE" mode of
22210 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
22211 interlink and run in the same process without changing FPU modes.
22212
22213 -mabicalls
22214 -mno-abicalls
22215 Generate (do not generate) code that is suitable for SVR4-style
22216 dynamic objects. -mabicalls is the default for SVR4-based systems.
22217
22218 -mshared
22219 -mno-shared
22220 Generate (do not generate) code that is fully position-independent,
22221 and that can therefore be linked into shared libraries. This
22222 option only affects -mabicalls.
22223
22224 All -mabicalls code has traditionally been position-independent,
22225 regardless of options like -fPIC and -fpic. However, as an
22226 extension, the GNU toolchain allows executables to use absolute
22227 accesses for locally-binding symbols. It can also use shorter GP
22228 initialization sequences and generate direct calls to locally-
22229 defined functions. This mode is selected by -mno-shared.
22230
22231 -mno-shared depends on binutils 2.16 or higher and generates
22232 objects that can only be linked by the GNU linker. However, the
22233 option does not affect the ABI of the final executable; it only
22234 affects the ABI of relocatable objects. Using -mno-shared
22235 generally makes executables both smaller and quicker.
22236
22237 -mshared is the default.
22238
22239 -mplt
22240 -mno-plt
22241 Assume (do not assume) that the static and dynamic linkers support
22242 PLTs and copy relocations. This option only affects -mno-shared
22243 -mabicalls. For the n64 ABI, this option has no effect without
22244 -msym32.
22245
22246 You can make -mplt the default by configuring GCC with
22247 --with-mips-plt. The default is -mno-plt otherwise.
22248
22249 -mxgot
22250 -mno-xgot
22251 Lift (do not lift) the usual restrictions on the size of the global
22252 offset table.
22253
22254 GCC normally uses a single instruction to load values from the GOT.
22255 While this is relatively efficient, it only works if the GOT is
22256 smaller than about 64k. Anything larger causes the linker to
22257 report an error such as:
22258
22259 relocation truncated to fit: R_MIPS_GOT16 foobar
22260
22261 If this happens, you should recompile your code with -mxgot. This
22262 works with very large GOTs, although the code is also less
22263 efficient, since it takes three instructions to fetch the value of
22264 a global symbol.
22265
22266 Note that some linkers can create multiple GOTs. If you have such
22267 a linker, you should only need to use -mxgot when a single object
22268 file accesses more than 64k's worth of GOT entries. Very few do.
22269
22270 These options have no effect unless GCC is generating position
22271 independent code.
22272
22273 -mgp32
22274 Assume that general-purpose registers are 32 bits wide.
22275
22276 -mgp64
22277 Assume that general-purpose registers are 64 bits wide.
22278
22279 -mfp32
22280 Assume that floating-point registers are 32 bits wide.
22281
22282 -mfp64
22283 Assume that floating-point registers are 64 bits wide.
22284
22285 -mfpxx
22286 Do not assume the width of floating-point registers.
22287
22288 -mhard-float
22289 Use floating-point coprocessor instructions.
22290
22291 -msoft-float
22292 Do not use floating-point coprocessor instructions. Implement
22293 floating-point calculations using library calls instead.
22294
22295 -mno-float
22296 Equivalent to -msoft-float, but additionally asserts that the
22297 program being compiled does not perform any floating-point
22298 operations. This option is presently supported only by some bare-
22299 metal MIPS configurations, where it may select a special set of
22300 libraries that lack all floating-point support (including, for
22301 example, the floating-point "printf" formats). If code compiled
22302 with -mno-float accidentally contains floating-point operations, it
22303 is likely to suffer a link-time or run-time failure.
22304
22305 -msingle-float
22306 Assume that the floating-point coprocessor only supports single-
22307 precision operations.
22308
22309 -mdouble-float
22310 Assume that the floating-point coprocessor supports double-
22311 precision operations. This is the default.
22312
22313 -modd-spreg
22314 -mno-odd-spreg
22315 Enable the use of odd-numbered single-precision floating-point
22316 registers for the o32 ABI. This is the default for processors that
22317 are known to support these registers. When using the o32 FPXX ABI,
22318 -mno-odd-spreg is set by default.
22319
22320 -mabs=2008
22321 -mabs=legacy
22322 These options control the treatment of the special not-a-number
22323 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
22324 machine instructions.
22325
22326 By default or when -mabs=legacy is used the legacy treatment is
22327 selected. In this case these instructions are considered
22328 arithmetic and avoided where correct operation is required and the
22329 input operand might be a NaN. A longer sequence of instructions
22330 that manipulate the sign bit of floating-point datum manually is
22331 used instead unless the -ffinite-math-only option has also been
22332 specified.
22333
22334 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
22335 case these instructions are considered non-arithmetic and therefore
22336 operating correctly in all cases, including in particular where the
22337 input operand is a NaN. These instructions are therefore always
22338 used for the respective operations.
22339
22340 -mnan=2008
22341 -mnan=legacy
22342 These options control the encoding of the special not-a-number
22343 (NaN) IEEE 754 floating-point data.
22344
22345 The -mnan=legacy option selects the legacy encoding. In this case
22346 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22347 significand field being 0, whereas signaling NaNs (sNaNs) are
22348 denoted by the first bit of their trailing significand field being
22349 1.
22350
22351 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
22352 case qNaNs are denoted by the first bit of their trailing
22353 significand field being 1, whereas sNaNs are denoted by the first
22354 bit of their trailing significand field being 0.
22355
22356 The default is -mnan=legacy unless GCC has been configured with
22357 --with-nan=2008.
22358
22359 -mllsc
22360 -mno-llsc
22361 Use (do not use) ll, sc, and sync instructions to implement atomic
22362 memory built-in functions. When neither option is specified, GCC
22363 uses the instructions if the target architecture supports them.
22364
22365 -mllsc is useful if the runtime environment can emulate the
22366 instructions and -mno-llsc can be useful when compiling for
22367 nonstandard ISAs. You can make either option the default by
22368 configuring GCC with --with-llsc and --without-llsc respectively.
22369 --with-llsc is the default for some configurations; see the
22370 installation documentation for details.
22371
22372 -mdsp
22373 -mno-dsp
22374 Use (do not use) revision 1 of the MIPS DSP ASE.
22375 This option defines the preprocessor macro "__mips_dsp". It also
22376 defines "__mips_dsp_rev" to 1.
22377
22378 -mdspr2
22379 -mno-dspr2
22380 Use (do not use) revision 2 of the MIPS DSP ASE.
22381 This option defines the preprocessor macros "__mips_dsp" and
22382 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
22383
22384 -msmartmips
22385 -mno-smartmips
22386 Use (do not use) the MIPS SmartMIPS ASE.
22387
22388 -mpaired-single
22389 -mno-paired-single
22390 Use (do not use) paired-single floating-point instructions.
22391 This option requires hardware floating-point support to be
22392 enabled.
22393
22394 -mdmx
22395 -mno-mdmx
22396 Use (do not use) MIPS Digital Media Extension instructions. This
22397 option can only be used when generating 64-bit code and requires
22398 hardware floating-point support to be enabled.
22399
22400 -mips3d
22401 -mno-mips3d
22402 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
22403 -mpaired-single.
22404
22405 -mmicromips
22406 -mno-micromips
22407 Generate (do not generate) microMIPS code.
22408
22409 MicroMIPS code generation can also be controlled on a per-function
22410 basis by means of "micromips" and "nomicromips" attributes.
22411
22412 -mmt
22413 -mno-mt
22414 Use (do not use) MT Multithreading instructions.
22415
22416 -mmcu
22417 -mno-mcu
22418 Use (do not use) the MIPS MCU ASE instructions.
22419
22420 -meva
22421 -mno-eva
22422 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22423
22424 -mvirt
22425 -mno-virt
22426 Use (do not use) the MIPS Virtualization (VZ) instructions.
22427
22428 -mxpa
22429 -mno-xpa
22430 Use (do not use) the MIPS eXtended Physical Address (XPA)
22431 instructions.
22432
22433 -mcrc
22434 -mno-crc
22435 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
22436 instructions.
22437
22438 -mginv
22439 -mno-ginv
22440 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22441
22442 -mloongson-mmi
22443 -mno-loongson-mmi
22444 Use (do not use) the MIPS Loongson MultiMedia extensions
22445 Instructions (MMI).
22446
22447 -mloongson-ext
22448 -mno-loongson-ext
22449 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22450
22451 -mloongson-ext2
22452 -mno-loongson-ext2
22453 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
22454 instructions.
22455
22456 -mlong64
22457 Force "long" types to be 64 bits wide. See -mlong32 for an
22458 explanation of the default and the way that the pointer size is
22459 determined.
22460
22461 -mlong32
22462 Force "long", "int", and pointer types to be 32 bits wide.
22463
22464 The default size of "int"s, "long"s and pointers depends on the
22465 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
22466 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
22467 "long"s. Pointers are the same size as "long"s, or the same size
22468 as integer registers, whichever is smaller.
22469
22470 -msym32
22471 -mno-sym32
22472 Assume (do not assume) that all symbols have 32-bit values,
22473 regardless of the selected ABI. This option is useful in
22474 combination with -mabi=64 and -mno-abicalls because it allows GCC
22475 to generate shorter and faster references to symbolic addresses.
22476
22477 -G num
22478 Put definitions of externally-visible data in a small data section
22479 if that data is no bigger than num bytes. GCC can then generate
22480 more efficient accesses to the data; see -mgpopt for details.
22481
22482 The default -G option depends on the configuration.
22483
22484 -mlocal-sdata
22485 -mno-local-sdata
22486 Extend (do not extend) the -G behavior to local data too, such as
22487 to static variables in C. -mlocal-sdata is the default for all
22488 configurations.
22489
22490 If the linker complains that an application is using too much small
22491 data, you might want to try rebuilding the less performance-
22492 critical parts with -mno-local-sdata. You might also want to build
22493 large libraries with -mno-local-sdata, so that the libraries leave
22494 more room for the main program.
22495
22496 -mextern-sdata
22497 -mno-extern-sdata
22498 Assume (do not assume) that externally-defined data is in a small
22499 data section if the size of that data is within the -G limit.
22500 -mextern-sdata is the default for all configurations.
22501
22502 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
22503 Mod references a variable Var that is no bigger than num bytes, you
22504 must make sure that Var is placed in a small data section. If Var
22505 is defined by another module, you must either compile that module
22506 with a high-enough -G setting or attach a "section" attribute to
22507 Var's definition. If Var is common, you must link the application
22508 with a high-enough -G setting.
22509
22510 The easiest way of satisfying these restrictions is to compile and
22511 link every module with the same -G option. However, you may wish
22512 to build a library that supports several different small data
22513 limits. You can do this by compiling the library with the highest
22514 supported -G setting and additionally using -mno-extern-sdata to
22515 stop the library from making assumptions about externally-defined
22516 data.
22517
22518 -mgpopt
22519 -mno-gpopt
22520 Use (do not use) GP-relative accesses for symbols that are known to
22521 be in a small data section; see -G, -mlocal-sdata and
22522 -mextern-sdata. -mgpopt is the default for all configurations.
22523
22524 -mno-gpopt is useful for cases where the $gp register might not
22525 hold the value of "_gp". For example, if the code is part of a
22526 library that might be used in a boot monitor, programs that call
22527 boot monitor routines pass an unknown value in $gp. (In such
22528 situations, the boot monitor itself is usually compiled with -G0.)
22529
22530 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
22531
22532 -membedded-data
22533 -mno-embedded-data
22534 Allocate variables to the read-only data section first if possible,
22535 then next in the small data section if possible, otherwise in data.
22536 This gives slightly slower code than the default, but reduces the
22537 amount of RAM required when executing, and thus may be preferred
22538 for some embedded systems.
22539
22540 -muninit-const-in-rodata
22541 -mno-uninit-const-in-rodata
22542 Put uninitialized "const" variables in the read-only data section.
22543 This option is only meaningful in conjunction with -membedded-data.
22544
22545 -mcode-readable=setting
22546 Specify whether GCC may generate code that reads from executable
22547 sections. There are three possible settings:
22548
22549 -mcode-readable=yes
22550 Instructions may freely access executable sections. This is
22551 the default setting.
22552
22553 -mcode-readable=pcrel
22554 MIPS16 PC-relative load instructions can access executable
22555 sections, but other instructions must not do so. This option
22556 is useful on 4KSc and 4KSd processors when the code TLBs have
22557 the Read Inhibit bit set. It is also useful on processors that
22558 can be configured to have a dual instruction/data SRAM
22559 interface and that, like the M4K, automatically redirect PC-
22560 relative loads to the instruction RAM.
22561
22562 -mcode-readable=no
22563 Instructions must not access executable sections. This option
22564 can be useful on targets that are configured to have a dual
22565 instruction/data SRAM interface but that (unlike the M4K) do
22566 not automatically redirect PC-relative loads to the instruction
22567 RAM.
22568
22569 -msplit-addresses
22570 -mno-split-addresses
22571 Enable (disable) use of the "%hi()" and "%lo()" assembler
22572 relocation operators. This option has been superseded by
22573 -mexplicit-relocs but is retained for backwards compatibility.
22574
22575 -mexplicit-relocs
22576 -mno-explicit-relocs
22577 Use (do not use) assembler relocation operators when dealing with
22578 symbolic addresses. The alternative, selected by
22579 -mno-explicit-relocs, is to use assembler macros instead.
22580
22581 -mexplicit-relocs is the default if GCC was configured to use an
22582 assembler that supports relocation operators.
22583
22584 -mcheck-zero-division
22585 -mno-check-zero-division
22586 Trap (do not trap) on integer division by zero.
22587
22588 The default is -mcheck-zero-division.
22589
22590 -mdivide-traps
22591 -mdivide-breaks
22592 MIPS systems check for division by zero by generating either a
22593 conditional trap or a break instruction. Using traps results in
22594 smaller code, but is only supported on MIPS II and later. Also,
22595 some versions of the Linux kernel have a bug that prevents trap
22596 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
22597 to allow conditional traps on architectures that support them and
22598 -mdivide-breaks to force the use of breaks.
22599
22600 The default is usually -mdivide-traps, but this can be overridden
22601 at configure time using --with-divide=breaks. Divide-by-zero
22602 checks can be completely disabled using -mno-check-zero-division.
22603
22604 -mload-store-pairs
22605 -mno-load-store-pairs
22606 Enable (disable) an optimization that pairs consecutive load or
22607 store instructions to enable load/store bonding. This option is
22608 enabled by default but only takes effect when the selected
22609 architecture is known to support bonding.
22610
22611 -munaligned-access
22612 -mno-unaligned-access
22613 Enable (disable) direct unaligned access for MIPS Release 6.
22614 MIPSr6 requires load/store unaligned-access support, by hardware or
22615 trap&emulate. So -mno-unaligned-access may be needed by kernel.
22616
22617 -mmemcpy
22618 -mno-memcpy
22619 Force (do not force) the use of "memcpy" for non-trivial block
22620 moves. The default is -mno-memcpy, which allows GCC to inline most
22621 constant-sized copies.
22622
22623 -mlong-calls
22624 -mno-long-calls
22625 Disable (do not disable) use of the "jal" instruction. Calling
22626 functions using "jal" is more efficient but requires the caller and
22627 callee to be in the same 256 megabyte segment.
22628
22629 This option has no effect on abicalls code. The default is
22630 -mno-long-calls.
22631
22632 -mmad
22633 -mno-mad
22634 Enable (disable) use of the "mad", "madu" and "mul" instructions,
22635 as provided by the R4650 ISA.
22636
22637 -mimadd
22638 -mno-imadd
22639 Enable (disable) use of the "madd" and "msub" integer instructions.
22640 The default is -mimadd on architectures that support "madd" and
22641 "msub" except for the 74k architecture where it was found to
22642 generate slower code.
22643
22644 -mfused-madd
22645 -mno-fused-madd
22646 Enable (disable) use of the floating-point multiply-accumulate
22647 instructions, when they are available. The default is
22648 -mfused-madd.
22649
22650 On the R8000 CPU when multiply-accumulate instructions are used,
22651 the intermediate product is calculated to infinite precision and is
22652 not subject to the FCSR Flush to Zero bit. This may be undesirable
22653 in some circumstances. On other processors the result is
22654 numerically identical to the equivalent computation using separate
22655 multiply, add, subtract and negate instructions.
22656
22657 -nocpp
22658 Tell the MIPS assembler to not run its preprocessor over user
22659 assembler files (with a .s suffix) when assembling them.
22660
22661 -mfix-24k
22662 -mno-fix-24k
22663 Work around the 24K E48 (lost data on stores during refill) errata.
22664 The workarounds are implemented by the assembler rather than by
22665 GCC.
22666
22667 -mfix-r4000
22668 -mno-fix-r4000
22669 Work around certain R4000 CPU errata:
22670
22671 - A double-word or a variable shift may give an incorrect result
22672 if executed immediately after starting an integer division.
22673
22674 - A double-word or a variable shift may give an incorrect result
22675 if executed while an integer multiplication is in progress.
22676
22677 - An integer division may give an incorrect result if started in
22678 a delay slot of a taken branch or a jump.
22679
22680 -mfix-r4400
22681 -mno-fix-r4400
22682 Work around certain R4400 CPU errata:
22683
22684 - A double-word or a variable shift may give an incorrect result
22685 if executed immediately after starting an integer division.
22686
22687 -mfix-r10000
22688 -mno-fix-r10000
22689 Work around certain R10000 errata:
22690
22691 - "ll"/"sc" sequences may not behave atomically on revisions
22692 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22693
22694 This option can only be used if the target architecture supports
22695 branch-likely instructions. -mfix-r10000 is the default when
22696 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
22697
22698 -mfix-r5900
22699 -mno-fix-r5900
22700 Do not attempt to schedule the preceding instruction into the delay
22701 slot of a branch instruction placed at the end of a short loop of
22702 six instructions or fewer and always schedule a "nop" instruction
22703 there instead. The short loop bug under certain conditions causes
22704 loops to execute only once or twice, due to a hardware bug in the
22705 R5900 chip. The workaround is implemented by the assembler rather
22706 than by GCC.
22707
22708 -mfix-rm7000
22709 -mno-fix-rm7000
22710 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
22711 are implemented by the assembler rather than by GCC.
22712
22713 -mfix-vr4120
22714 -mno-fix-vr4120
22715 Work around certain VR4120 errata:
22716
22717 - "dmultu" does not always produce the correct result.
22718
22719 - "div" and "ddiv" do not always produce the correct result if
22720 one of the operands is negative.
22721
22722 The workarounds for the division errata rely on special functions
22723 in libgcc.a. At present, these functions are only provided by the
22724 "mips64vr*-elf" configurations.
22725
22726 Other VR4120 errata require a NOP to be inserted between certain
22727 pairs of instructions. These errata are handled by the assembler,
22728 not by GCC itself.
22729
22730 -mfix-vr4130
22731 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
22732 implemented by the assembler rather than by GCC, although GCC
22733 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
22734 "dmacc" and "dmacchi" instructions are available instead.
22735
22736 -mfix-sb1
22737 -mno-fix-sb1
22738 Work around certain SB-1 CPU core errata. (This flag currently
22739 works around the SB-1 revision 2 "F1" and "F2" floating-point
22740 errata.)
22741
22742 -mr10k-cache-barrier=setting
22743 Specify whether GCC should insert cache barriers to avoid the side
22744 effects of speculation on R10K processors.
22745
22746 In common with many processors, the R10K tries to predict the
22747 outcome of a conditional branch and speculatively executes
22748 instructions from the "taken" branch. It later aborts these
22749 instructions if the predicted outcome is wrong. However, on the
22750 R10K, even aborted instructions can have side effects.
22751
22752 This problem only affects kernel stores and, depending on the
22753 system, kernel loads. As an example, a speculatively-executed
22754 store may load the target memory into cache and mark the cache line
22755 as dirty, even if the store itself is later aborted. If a DMA
22756 operation writes to the same area of memory before the "dirty" line
22757 is flushed, the cached data overwrites the DMA-ed data. See the
22758 R10K processor manual for a full description, including other
22759 potential problems.
22760
22761 One workaround is to insert cache barrier instructions before every
22762 memory access that might be speculatively executed and that might
22763 have side effects even if aborted. -mr10k-cache-barrier=setting
22764 controls GCC's implementation of this workaround. It assumes that
22765 aborted accesses to any byte in the following regions does not have
22766 side effects:
22767
22768 1. the memory occupied by the current function's stack frame;
22769
22770 2. the memory occupied by an incoming stack argument;
22771
22772 3. the memory occupied by an object with a link-time-constant
22773 address.
22774
22775 It is the kernel's responsibility to ensure that speculative
22776 accesses to these regions are indeed safe.
22777
22778 If the input program contains a function declaration such as:
22779
22780 void foo (void);
22781
22782 then the implementation of "foo" must allow "j foo" and "jal foo"
22783 to be executed speculatively. GCC honors this restriction for
22784 functions it compiles itself. It expects non-GCC functions (such
22785 as hand-written assembly code) to do the same.
22786
22787 The option has three forms:
22788
22789 -mr10k-cache-barrier=load-store
22790 Insert a cache barrier before a load or store that might be
22791 speculatively executed and that might have side effects even if
22792 aborted.
22793
22794 -mr10k-cache-barrier=store
22795 Insert a cache barrier before a store that might be
22796 speculatively executed and that might have side effects even if
22797 aborted.
22798
22799 -mr10k-cache-barrier=none
22800 Disable the insertion of cache barriers. This is the default
22801 setting.
22802
22803 -mflush-func=func
22804 -mno-flush-func
22805 Specifies the function to call to flush the I and D caches, or to
22806 not call any such function. If called, the function must take the
22807 same arguments as the common "_flush_func", that is, the address of
22808 the memory range for which the cache is being flushed, the size of
22809 the memory range, and the number 3 (to flush both caches). The
22810 default depends on the target GCC was configured for, but commonly
22811 is either "_flush_func" or "__cpu_flush".
22812
22813 mbranch-cost=num
22814 Set the cost of branches to roughly num "simple" instructions.
22815 This cost is only a heuristic and is not guaranteed to produce
22816 consistent results across releases. A zero cost redundantly
22817 selects the default, which is based on the -mtune setting.
22818
22819 -mbranch-likely
22820 -mno-branch-likely
22821 Enable or disable use of Branch Likely instructions, regardless of
22822 the default for the selected architecture. By default, Branch
22823 Likely instructions may be generated if they are supported by the
22824 selected architecture. An exception is for the MIPS32 and MIPS64
22825 architectures and processors that implement those architectures;
22826 for those, Branch Likely instructions are not be generated by
22827 default because the MIPS32 and MIPS64 architectures specifically
22828 deprecate their use.
22829
22830 -mcompact-branches=never
22831 -mcompact-branches=optimal
22832 -mcompact-branches=always
22833 These options control which form of branches will be generated.
22834 The default is -mcompact-branches=optimal.
22835
22836 The -mcompact-branches=never option ensures that compact branch
22837 instructions will never be generated.
22838
22839 The -mcompact-branches=always option ensures that a compact branch
22840 instruction will be generated if available. If a compact branch
22841 instruction is not available, a delay slot form of the branch will
22842 be used instead.
22843
22844 This option is supported from MIPS Release 6 onwards.
22845
22846 The -mcompact-branches=optimal option will cause a delay slot
22847 branch to be used if one is available in the current ISA and the
22848 delay slot is successfully filled. If the delay slot is not
22849 filled, a compact branch will be chosen if one is available.
22850
22851 -mfp-exceptions
22852 -mno-fp-exceptions
22853 Specifies whether FP exceptions are enabled. This affects how FP
22854 instructions are scheduled for some processors. The default is
22855 that FP exceptions are enabled.
22856
22857 For instance, on the SB-1, if FP exceptions are disabled, and we
22858 are emitting 64-bit code, then we can use both FP pipes.
22859 Otherwise, we can only use one FP pipe.
22860
22861 -mvr4130-align
22862 -mno-vr4130-align
22863 The VR4130 pipeline is two-way superscalar, but can only issue two
22864 instructions together if the first one is 8-byte aligned. When
22865 this option is enabled, GCC aligns pairs of instructions that it
22866 thinks should execute in parallel.
22867
22868 This option only has an effect when optimizing for the VR4130. It
22869 normally makes code faster, but at the expense of making it bigger.
22870 It is enabled by default at optimization level -O3.
22871
22872 -msynci
22873 -mno-synci
22874 Enable (disable) generation of "synci" instructions on
22875 architectures that support it. The "synci" instructions (if
22876 enabled) are generated when "__builtin___clear_cache" is compiled.
22877
22878 This option defaults to -mno-synci, but the default can be
22879 overridden by configuring GCC with --with-synci.
22880
22881 When compiling code for single processor systems, it is generally
22882 safe to use "synci". However, on many multi-core (SMP) systems, it
22883 does not invalidate the instruction caches on all cores and may
22884 lead to undefined behavior.
22885
22886 -mrelax-pic-calls
22887 -mno-relax-pic-calls
22888 Try to turn PIC calls that are normally dispatched via register $25
22889 into direct calls. This is only possible if the linker can resolve
22890 the destination at link time and if the destination is within range
22891 for a direct call.
22892
22893 -mrelax-pic-calls is the default if GCC was configured to use an
22894 assembler and a linker that support the ".reloc" assembly directive
22895 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
22896 this optimization can be performed by the assembler and the linker
22897 alone without help from the compiler.
22898
22899 -mmcount-ra-address
22900 -mno-mcount-ra-address
22901 Emit (do not emit) code that allows "_mcount" to modify the calling
22902 function's return address. When enabled, this option extends the
22903 usual "_mcount" interface with a new ra-address parameter, which
22904 has type "intptr_t *" and is passed in register $12. "_mcount" can
22905 then modify the return address by doing both of the following:
22906
22907 * Returning the new address in register $31.
22908
22909 * Storing the new address in "*ra-address", if ra-address is
22910 nonnull.
22911
22912 The default is -mno-mcount-ra-address.
22913
22914 -mframe-header-opt
22915 -mno-frame-header-opt
22916 Enable (disable) frame header optimization in the o32 ABI. When
22917 using the o32 ABI, calling functions will allocate 16 bytes on the
22918 stack for the called function to write out register arguments.
22919 When enabled, this optimization will suppress the allocation of the
22920 frame header if it can be determined that it is unused.
22921
22922 This optimization is off by default at all optimization levels.
22923
22924 -mlxc1-sxc1
22925 -mno-lxc1-sxc1
22926 When applicable, enable (disable) the generation of "lwxc1",
22927 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
22928
22929 -mmadd4
22930 -mno-madd4
22931 When applicable, enable (disable) the generation of 4-operand
22932 "madd.s", "madd.d" and related instructions. Enabled by default.
22933
22934 MMIX Options
22935
22936 These options are defined for the MMIX:
22937
22938 -mlibfuncs
22939 -mno-libfuncs
22940 Specify that intrinsic library functions are being compiled,
22941 passing all values in registers, no matter the size.
22942
22943 -mepsilon
22944 -mno-epsilon
22945 Generate floating-point comparison instructions that compare with
22946 respect to the "rE" epsilon register.
22947
22948 -mabi=mmixware
22949 -mabi=gnu
22950 Generate code that passes function parameters and return values
22951 that (in the called function) are seen as registers $0 and up, as
22952 opposed to the GNU ABI which uses global registers $231 and up.
22953
22954 -mzero-extend
22955 -mno-zero-extend
22956 When reading data from memory in sizes shorter than 64 bits, use
22957 (do not use) zero-extending load instructions by default, rather
22958 than sign-extending ones.
22959
22960 -mknuthdiv
22961 -mno-knuthdiv
22962 Make the result of a division yielding a remainder have the same
22963 sign as the divisor. With the default, -mno-knuthdiv, the sign of
22964 the remainder follows the sign of the dividend. Both methods are
22965 arithmetically valid, the latter being almost exclusively used.
22966
22967 -mtoplevel-symbols
22968 -mno-toplevel-symbols
22969 Prepend (do not prepend) a : to all global symbols, so the assembly
22970 code can be used with the "PREFIX" assembly directive.
22971
22972 -melf
22973 Generate an executable in the ELF format, rather than the default
22974 mmo format used by the mmix simulator.
22975
22976 -mbranch-predict
22977 -mno-branch-predict
22978 Use (do not use) the probable-branch instructions, when static
22979 branch prediction indicates a probable branch.
22980
22981 -mbase-addresses
22982 -mno-base-addresses
22983 Generate (do not generate) code that uses base addresses. Using a
22984 base address automatically generates a request (handled by the
22985 assembler and the linker) for a constant to be set up in a global
22986 register. The register is used for one or more base address
22987 requests within the range 0 to 255 from the value held in the
22988 register. The generally leads to short and fast code, but the
22989 number of different data items that can be addressed is limited.
22990 This means that a program that uses lots of static data may require
22991 -mno-base-addresses.
22992
22993 -msingle-exit
22994 -mno-single-exit
22995 Force (do not force) generated code to have a single exit point in
22996 each function.
22997
22998 MN10300 Options
22999
23000 These -m options are defined for Matsushita MN10300 architectures:
23001
23002 -mmult-bug
23003 Generate code to avoid bugs in the multiply instructions for the
23004 MN10300 processors. This is the default.
23005
23006 -mno-mult-bug
23007 Do not generate code to avoid bugs in the multiply instructions for
23008 the MN10300 processors.
23009
23010 -mam33
23011 Generate code using features specific to the AM33 processor.
23012
23013 -mno-am33
23014 Do not generate code using features specific to the AM33 processor.
23015 This is the default.
23016
23017 -mam33-2
23018 Generate code using features specific to the AM33/2.0 processor.
23019
23020 -mam34
23021 Generate code using features specific to the AM34 processor.
23022
23023 -mtune=cpu-type
23024 Use the timing characteristics of the indicated CPU type when
23025 scheduling instructions. This does not change the targeted
23026 processor type. The CPU type must be one of mn10300, am33, am33-2
23027 or am34.
23028
23029 -mreturn-pointer-on-d0
23030 When generating a function that returns a pointer, return the
23031 pointer in both "a0" and "d0". Otherwise, the pointer is returned
23032 only in "a0", and attempts to call such functions without a
23033 prototype result in errors. Note that this option is on by
23034 default; use -mno-return-pointer-on-d0 to disable it.
23035
23036 -mno-crt0
23037 Do not link in the C run-time initialization object file.
23038
23039 -mrelax
23040 Indicate to the linker that it should perform a relaxation
23041 optimization pass to shorten branches, calls and absolute memory
23042 addresses. This option only has an effect when used on the command
23043 line for the final link step.
23044
23045 This option makes symbolic debugging impossible.
23046
23047 -mliw
23048 Allow the compiler to generate Long Instruction Word instructions
23049 if the target is the AM33 or later. This is the default. This
23050 option defines the preprocessor macro "__LIW__".
23051
23052 -mno-liw
23053 Do not allow the compiler to generate Long Instruction Word
23054 instructions. This option defines the preprocessor macro
23055 "__NO_LIW__".
23056
23057 -msetlb
23058 Allow the compiler to generate the SETLB and Lcc instructions if
23059 the target is the AM33 or later. This is the default. This option
23060 defines the preprocessor macro "__SETLB__".
23061
23062 -mno-setlb
23063 Do not allow the compiler to generate SETLB or Lcc instructions.
23064 This option defines the preprocessor macro "__NO_SETLB__".
23065
23066 Moxie Options
23067
23068 -meb
23069 Generate big-endian code. This is the default for moxie-*-*
23070 configurations.
23071
23072 -mel
23073 Generate little-endian code.
23074
23075 -mmul.x
23076 Generate mul.x and umul.x instructions. This is the default for
23077 moxiebox-*-* configurations.
23078
23079 -mno-crt0
23080 Do not link in the C run-time initialization object file.
23081
23082 MSP430 Options
23083
23084 These options are defined for the MSP430:
23085
23086 -masm-hex
23087 Force assembly output to always use hex constants. Normally such
23088 constants are signed decimals, but this option is available for
23089 testsuite and/or aesthetic purposes.
23090
23091 -mmcu=
23092 Select the MCU to target. This is used to create a C preprocessor
23093 symbol based upon the MCU name, converted to upper case and pre-
23094 and post-fixed with __. This in turn is used by the msp430.h
23095 header file to select an MCU-specific supplementary header file.
23096
23097 The option also sets the ISA to use. If the MCU name is one that
23098 is known to only support the 430 ISA then that is selected,
23099 otherwise the 430X ISA is selected. A generic MCU name of msp430
23100 can also be used to select the 430 ISA. Similarly the generic
23101 msp430x MCU name selects the 430X ISA.
23102
23103 In addition an MCU-specific linker script is added to the linker
23104 command line. The script's name is the name of the MCU with .ld
23105 appended. Thus specifying -mmcu=xxx on the gcc command line
23106 defines the C preprocessor symbol "__XXX__" and cause the linker to
23107 search for a script called xxx.ld.
23108
23109 The ISA and hardware multiply supported for the different MCUs is
23110 hard-coded into GCC. However, an external devices.csv file can be
23111 used to extend device support beyond those that have been hard-
23112 coded.
23113
23114 GCC searches for the devices.csv file using the following methods
23115 in the given precedence order, where the first method takes
23116 precendence over the second which takes precedence over the third.
23117
23118 Include path specified with "-I" and "-L"
23119 devices.csv will be searched for in each of the directories
23120 specified by include paths and linker library search paths.
23121
23122 Path specified by the environment variable MSP430_GCC_INCLUDE_DIR
23123 Define the value of the global environment variable
23124 MSP430_GCC_INCLUDE_DIR to the full path to the directory
23125 containing devices.csv, and GCC will search this directory for
23126 devices.csv. If devices.csv is found, this directory will also
23127 be registered as an include path, and linker library path.
23128 Header files and linker scripts in this directory can therefore
23129 be used without manually specifying "-I" and "-L" on the
23130 command line.
23131
23132 The msp430-elf{,bare}/include/devices directory
23133 Finally, GCC will examine msp430-elf{,bare}/include/devices
23134 from the toolchain root directory. This directory does not
23135 exist in a default installation, but if the user has created it
23136 and copied devices.csv there, then the MCU data will be read.
23137 As above, this directory will also be registered as an include
23138 path, and linker library path.
23139
23140 If none of the above search methods find devices.csv, then the
23141 hard-coded MCU data is used.
23142
23143 -mwarn-mcu
23144 -mno-warn-mcu
23145 This option enables or disables warnings about conflicts between
23146 the MCU name specified by the -mmcu option and the ISA set by the
23147 -mcpu option and/or the hardware multiply support set by the
23148 -mhwmult option. It also toggles warnings about unrecognized MCU
23149 names. This option is on by default.
23150
23151 -mcpu=
23152 Specifies the ISA to use. Accepted values are msp430, msp430x and
23153 msp430xv2. This option is deprecated. The -mmcu= option should be
23154 used to select the ISA.
23155
23156 -msim
23157 Link to the simulator runtime libraries and linker script.
23158 Overrides any scripts that would be selected by the -mmcu= option.
23159
23160 -mlarge
23161 Use large-model addressing (20-bit pointers, 20-bit "size_t").
23162
23163 -msmall
23164 Use small-model addressing (16-bit pointers, 16-bit "size_t").
23165
23166 -mrelax
23167 This option is passed to the assembler and linker, and allows the
23168 linker to perform certain optimizations that cannot be done until
23169 the final link.
23170
23171 mhwmult=
23172 Describes the type of hardware multiply supported by the target.
23173 Accepted values are none for no hardware multiply, 16bit for the
23174 original 16-bit-only multiply supported by early MCUs. 32bit for
23175 the 16/32-bit multiply supported by later MCUs and f5series for the
23176 16/32-bit multiply supported by F5-series MCUs. A value of auto
23177 can also be given. This tells GCC to deduce the hardware multiply
23178 support based upon the MCU name provided by the -mmcu option. If
23179 no -mmcu option is specified or if the MCU name is not recognized
23180 then no hardware multiply support is assumed. "auto" is the
23181 default setting.
23182
23183 Hardware multiplies are normally performed by calling a library
23184 routine. This saves space in the generated code. When compiling
23185 at -O3 or higher however the hardware multiplier is invoked inline.
23186 This makes for bigger, but faster code.
23187
23188 The hardware multiply routines disable interrupts whilst running
23189 and restore the previous interrupt state when they finish. This
23190 makes them safe to use inside interrupt handlers as well as in
23191 normal code.
23192
23193 -minrt
23194 Enable the use of a minimum runtime environment - no static
23195 initializers or constructors. This is intended for memory-
23196 constrained devices. The compiler includes special symbols in some
23197 objects that tell the linker and runtime which code fragments are
23198 required.
23199
23200 -mtiny-printf
23201 Enable reduced code size "printf" and "puts" library functions.
23202 The tiny implementations of these functions are not reentrant, so
23203 must be used with caution in multi-threaded applications.
23204
23205 Support for streams has been removed and the string to be printed
23206 will always be sent to stdout via the "write" syscall. The string
23207 is not buffered before it is sent to write.
23208
23209 This option requires Newlib Nano IO, so GCC must be configured with
23210 --enable-newlib-nano-formatted-io.
23211
23212 -mmax-inline-shift=
23213 This option takes an integer between 0 and 64 inclusive, and sets
23214 the maximum number of inline shift instructions which should be
23215 emitted to perform a shift operation by a constant amount. When
23216 this value needs to be exceeded, an mspabi helper function is used
23217 instead. The default value is 4.
23218
23219 This only affects cases where a shift by multiple positions cannot
23220 be completed with a single instruction (e.g. all shifts >1 on the
23221 430 ISA).
23222
23223 Shifts of a 32-bit value are at least twice as costly, so the value
23224 passed for this option is divided by 2 and the resulting value used
23225 instead.
23226
23227 -mcode-region=
23228 -mdata-region=
23229 These options tell the compiler where to place functions and data
23230 that do not have one of the "lower", "upper", "either" or "section"
23231 attributes. Possible values are "lower", "upper", "either" or
23232 "any". The first three behave like the corresponding attribute.
23233 The fourth possible value - "any" - is the default. It leaves
23234 placement entirely up to the linker script and how it assigns the
23235 standard sections (".text", ".data", etc) to the memory regions.
23236
23237 -msilicon-errata=
23238 This option passes on a request to assembler to enable the fixes
23239 for the named silicon errata.
23240
23241 -msilicon-errata-warn=
23242 This option passes on a request to the assembler to enable warning
23243 messages when a silicon errata might need to be applied.
23244
23245 -mwarn-devices-csv
23246 -mno-warn-devices-csv
23247 Warn if devices.csv is not found or there are problem parsing it
23248 (default: on).
23249
23250 NDS32 Options
23251
23252 These options are defined for NDS32 implementations:
23253
23254 -mbig-endian
23255 Generate code in big-endian mode.
23256
23257 -mlittle-endian
23258 Generate code in little-endian mode.
23259
23260 -mreduced-regs
23261 Use reduced-set registers for register allocation.
23262
23263 -mfull-regs
23264 Use full-set registers for register allocation.
23265
23266 -mcmov
23267 Generate conditional move instructions.
23268
23269 -mno-cmov
23270 Do not generate conditional move instructions.
23271
23272 -mext-perf
23273 Generate performance extension instructions.
23274
23275 -mno-ext-perf
23276 Do not generate performance extension instructions.
23277
23278 -mext-perf2
23279 Generate performance extension 2 instructions.
23280
23281 -mno-ext-perf2
23282 Do not generate performance extension 2 instructions.
23283
23284 -mext-string
23285 Generate string extension instructions.
23286
23287 -mno-ext-string
23288 Do not generate string extension instructions.
23289
23290 -mv3push
23291 Generate v3 push25/pop25 instructions.
23292
23293 -mno-v3push
23294 Do not generate v3 push25/pop25 instructions.
23295
23296 -m16-bit
23297 Generate 16-bit instructions.
23298
23299 -mno-16-bit
23300 Do not generate 16-bit instructions.
23301
23302 -misr-vector-size=num
23303 Specify the size of each interrupt vector, which must be 4 or 16.
23304
23305 -mcache-block-size=num
23306 Specify the size of each cache block, which must be a power of 2
23307 between 4 and 512.
23308
23309 -march=arch
23310 Specify the name of the target architecture.
23311
23312 -mcmodel=code-model
23313 Set the code model to one of
23314
23315 small
23316 All the data and read-only data segments must be within 512KB
23317 addressing space. The text segment must be within 16MB
23318 addressing space.
23319
23320 medium
23321 The data segment must be within 512KB while the read-only data
23322 segment can be within 4GB addressing space. The text segment
23323 should be still within 16MB addressing space.
23324
23325 large
23326 All the text and data segments can be within 4GB addressing
23327 space.
23328
23329 -mctor-dtor
23330 Enable constructor/destructor feature.
23331
23332 -mrelax
23333 Guide linker to relax instructions.
23334
23335 Nios II Options
23336
23337 These are the options defined for the Altera Nios II processor.
23338
23339 -G num
23340 Put global and static objects less than or equal to num bytes into
23341 the small data or BSS sections instead of the normal data or BSS
23342 sections. The default value of num is 8.
23343
23344 -mgpopt=option
23345 -mgpopt
23346 -mno-gpopt
23347 Generate (do not generate) GP-relative accesses. The following
23348 option names are recognized:
23349
23350 none
23351 Do not generate GP-relative accesses.
23352
23353 local
23354 Generate GP-relative accesses for small data objects that are
23355 not external, weak, or uninitialized common symbols. Also use
23356 GP-relative addressing for objects that have been explicitly
23357 placed in a small data section via a "section" attribute.
23358
23359 global
23360 As for local, but also generate GP-relative accesses for small
23361 data objects that are external, weak, or common. If you use
23362 this option, you must ensure that all parts of your program
23363 (including libraries) are compiled with the same -G setting.
23364
23365 data
23366 Generate GP-relative accesses for all data objects in the
23367 program. If you use this option, the entire data and BSS
23368 segments of your program must fit in 64K of memory and you must
23369 use an appropriate linker script to allocate them within the
23370 addressable range of the global pointer.
23371
23372 all Generate GP-relative addresses for function pointers as well as
23373 data pointers. If you use this option, the entire text, data,
23374 and BSS segments of your program must fit in 64K of memory and
23375 you must use an appropriate linker script to allocate them
23376 within the addressable range of the global pointer.
23377
23378 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
23379 equivalent to -mgpopt=none.
23380
23381 The default is -mgpopt except when -fpic or -fPIC is specified to
23382 generate position-independent code. Note that the Nios II ABI does
23383 not permit GP-relative accesses from shared libraries.
23384
23385 You may need to specify -mno-gpopt explicitly when building
23386 programs that include large amounts of small data, including large
23387 GOT data sections. In this case, the 16-bit offset for GP-relative
23388 addressing may not be large enough to allow access to the entire
23389 small data section.
23390
23391 -mgprel-sec=regexp
23392 This option specifies additional section names that can be accessed
23393 via GP-relative addressing. It is most useful in conjunction with
23394 "section" attributes on variable declarations and a custom linker
23395 script. The regexp is a POSIX Extended Regular Expression.
23396
23397 This option does not affect the behavior of the -G option, and the
23398 specified sections are in addition to the standard ".sdata" and
23399 ".sbss" small-data sections that are recognized by -mgpopt.
23400
23401 -mr0rel-sec=regexp
23402 This option specifies names of sections that can be accessed via a
23403 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
23404 32-bit address space. It is most useful in conjunction with
23405 "section" attributes on variable declarations and a custom linker
23406 script. The regexp is a POSIX Extended Regular Expression.
23407
23408 In contrast to the use of GP-relative addressing for small data,
23409 zero-based addressing is never generated by default and there are
23410 no conventional section names used in standard linker scripts for
23411 sections in the low or high areas of memory.
23412
23413 -mel
23414 -meb
23415 Generate little-endian (default) or big-endian (experimental) code,
23416 respectively.
23417
23418 -march=arch
23419 This specifies the name of the target Nios II architecture. GCC
23420 uses this name to determine what kind of instructions it can emit
23421 when generating assembly code. Permissible names are: r1, r2.
23422
23423 The preprocessor macro "__nios2_arch__" is available to programs,
23424 with value 1 or 2, indicating the targeted ISA level.
23425
23426 -mbypass-cache
23427 -mno-bypass-cache
23428 Force all load and store instructions to always bypass cache by
23429 using I/O variants of the instructions. The default is not to
23430 bypass the cache.
23431
23432 -mno-cache-volatile
23433 -mcache-volatile
23434 Volatile memory access bypass the cache using the I/O variants of
23435 the load and store instructions. The default is not to bypass the
23436 cache.
23437
23438 -mno-fast-sw-div
23439 -mfast-sw-div
23440 Do not use table-based fast divide for small numbers. The default
23441 is to use the fast divide at -O3 and above.
23442
23443 -mno-hw-mul
23444 -mhw-mul
23445 -mno-hw-mulx
23446 -mhw-mulx
23447 -mno-hw-div
23448 -mhw-div
23449 Enable or disable emitting "mul", "mulx" and "div" family of
23450 instructions by the compiler. The default is to emit "mul" and not
23451 emit "div" and "mulx".
23452
23453 -mbmx
23454 -mno-bmx
23455 -mcdx
23456 -mno-cdx
23457 Enable or disable generation of Nios II R2 BMX (bit manipulation)
23458 and CDX (code density) instructions. Enabling these instructions
23459 also requires -march=r2. Since these instructions are optional
23460 extensions to the R2 architecture, the default is not to emit them.
23461
23462 -mcustom-insn=N
23463 -mno-custom-insn
23464 Each -mcustom-insn=N option enables use of a custom instruction
23465 with encoding N when generating code that uses insn. For example,
23466 -mcustom-fadds=253 generates custom instruction 253 for single-
23467 precision floating-point add operations instead of the default
23468 behavior of using a library call.
23469
23470 The following values of insn are supported. Except as otherwise
23471 noted, floating-point operations are expected to be implemented
23472 with normal IEEE 754 semantics and correspond directly to the C
23473 operators or the equivalent GCC built-in functions.
23474
23475 Single-precision floating point:
23476
23477 fadds, fsubs, fdivs, fmuls
23478 Binary arithmetic operations.
23479
23480 fnegs
23481 Unary negation.
23482
23483 fabss
23484 Unary absolute value.
23485
23486 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
23487 Comparison operations.
23488
23489 fmins, fmaxs
23490 Floating-point minimum and maximum. These instructions are
23491 only generated if -ffinite-math-only is specified.
23492
23493 fsqrts
23494 Unary square root operation.
23495
23496 fcoss, fsins, ftans, fatans, fexps, flogs
23497 Floating-point trigonometric and exponential functions. These
23498 instructions are only generated if -funsafe-math-optimizations
23499 is also specified.
23500
23501 Double-precision floating point:
23502
23503 faddd, fsubd, fdivd, fmuld
23504 Binary arithmetic operations.
23505
23506 fnegd
23507 Unary negation.
23508
23509 fabsd
23510 Unary absolute value.
23511
23512 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
23513 Comparison operations.
23514
23515 fmind, fmaxd
23516 Double-precision minimum and maximum. These instructions are
23517 only generated if -ffinite-math-only is specified.
23518
23519 fsqrtd
23520 Unary square root operation.
23521
23522 fcosd, fsind, ftand, fatand, fexpd, flogd
23523 Double-precision trigonometric and exponential functions.
23524 These instructions are only generated if
23525 -funsafe-math-optimizations is also specified.
23526
23527 Conversions:
23528
23529 fextsd
23530 Conversion from single precision to double precision.
23531
23532 ftruncds
23533 Conversion from double precision to single precision.
23534
23535 fixsi, fixsu, fixdi, fixdu
23536 Conversion from floating point to signed or unsigned integer
23537 types, with truncation towards zero.
23538
23539 round
23540 Conversion from single-precision floating point to signed
23541 integer, rounding to the nearest integer and ties away from
23542 zero. This corresponds to the "__builtin_lroundf" function
23543 when -fno-math-errno is used.
23544
23545 floatis, floatus, floatid, floatud
23546 Conversion from signed or unsigned integer types to floating-
23547 point types.
23548
23549 In addition, all of the following transfer instructions for
23550 internal registers X and Y must be provided to use any of the
23551 double-precision floating-point instructions. Custom instructions
23552 taking two double-precision source operands expect the first
23553 operand in the 64-bit register X. The other operand (or only
23554 operand of a unary operation) is given to the custom arithmetic
23555 instruction with the least significant half in source register src1
23556 and the most significant half in src2. A custom instruction that
23557 returns a double-precision result returns the most significant 32
23558 bits in the destination register and the other half in 32-bit
23559 register Y. GCC automatically generates the necessary code
23560 sequences to write register X and/or read register Y when double-
23561 precision floating-point instructions are used.
23562
23563 fwrx
23564 Write src1 into the least significant half of X and src2 into
23565 the most significant half of X.
23566
23567 fwry
23568 Write src1 into Y.
23569
23570 frdxhi, frdxlo
23571 Read the most or least (respectively) significant half of X and
23572 store it in dest.
23573
23574 frdy
23575 Read the value of Y and store it into dest.
23576
23577 Note that you can gain more local control over generation of Nios
23578 II custom instructions by using the "target("custom-insn=N")" and
23579 "target("no-custom-insn")" function attributes or pragmas.
23580
23581 -mcustom-fpu-cfg=name
23582 This option enables a predefined, named set of custom instruction
23583 encodings (see -mcustom-insn above). Currently, the following sets
23584 are defined:
23585
23586 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
23587 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
23588
23589 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
23590 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
23591 -fsingle-precision-constant
23592
23593 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
23594 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
23595 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
23596 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
23597 -mcustom-fdivs=255 -fsingle-precision-constant
23598
23599 -mcustom-fpu-cfg=fph2 is equivalent to: -mcustom-fabss=224
23600 -mcustom-fnegs=225 -mcustom-fcmpnes=226 -mcustom-fcmpeqs=227
23601 -mcustom-fcmpges=228 -mcustom-fcmpgts=229 -mcustom-fcmples=230
23602 -mcustom-fcmplts=231 -mcustom-fmaxs=232 -mcustom-fmins=233
23603 -mcustom-round=248 -mcustom-fixsi=249 -mcustom-floatis=250
23604 -mcustom-fsqrts=251 -mcustom-fmuls=252 -mcustom-fadds=253
23605 -mcustom-fsubs=254 -mcustom-fdivs=255
23606
23607 Custom instruction assignments given by individual -mcustom-insn=
23608 options override those given by -mcustom-fpu-cfg=, regardless of
23609 the order of the options on the command line.
23610
23611 Note that you can gain more local control over selection of a FPU
23612 configuration by using the "target("custom-fpu-cfg=name")" function
23613 attribute or pragma.
23614
23615 The name fph2 is an abbreviation for Nios II Floating Point
23616 Hardware 2 Component. Please note that the custom instructions
23617 enabled by -mcustom-fmins=233 and -mcustom-fmaxs=234 are only
23618 generated if -ffinite-math-only is specified. The custom
23619 instruction enabled by -mcustom-round=248 is only generated if
23620 -fno-math-errno is specified. In contrast to the other
23621 configurations, -fsingle-precision-constant is not set.
23622
23623 These additional -m options are available for the Altera Nios II ELF
23624 (bare-metal) target:
23625
23626 -mhal
23627 Link with HAL BSP. This suppresses linking with the GCC-provided C
23628 runtime startup and termination code, and is typically used in
23629 conjunction with -msys-crt0= to specify the location of the
23630 alternate startup code provided by the HAL BSP.
23631
23632 -msmallc
23633 Link with a limited version of the C library, -lsmallc, rather than
23634 Newlib.
23635
23636 -msys-crt0=startfile
23637 startfile is the file name of the startfile (crt0) to use when
23638 linking. This option is only useful in conjunction with -mhal.
23639
23640 -msys-lib=systemlib
23641 systemlib is the library name of the library that provides low-
23642 level system calls required by the C library, e.g. "read" and
23643 "write". This option is typically used to link with a library
23644 provided by a HAL BSP.
23645
23646 Nvidia PTX Options
23647
23648 These options are defined for Nvidia PTX:
23649
23650 -m64
23651 Ignored, but preserved for backward compatibility. Only 64-bit ABI
23652 is supported.
23653
23654 -march=architecture-string
23655 Generate code for the specified PTX ISA target architecture (e.g.
23656 sm_35). Valid architecture strings are sm_30, sm_35, sm_53, sm_70,
23657 sm_75 and sm_80. The default target architecture is sm_30.
23658
23659 This option sets the value of the preprocessor macro "__PTX_SM__";
23660 for instance, for sm_35, it has the value 350.
23661
23662 -misa=architecture-string
23663 Alias of -march=.
23664
23665 -march-map=architecture-string
23666 Select the closest available -march= value that is not more
23667 capable. For instance, for -march-map=sm_50 select -march=sm_35,
23668 and for -march-map=sm_53 select -march=sm_53.
23669
23670 -mptx=version-string
23671 Generate code for the specified PTX ISA version (e.g. 7.0). Valid
23672 version strings include 3.1, 6.0, 6.3, and 7.0. The default PTX
23673 ISA version is 6.0, unless a higher version is required for
23674 specified PTX ISA target architecture via option -march=.
23675
23676 This option sets the values of the preprocessor macros
23677 "__PTX_ISA_VERSION_MAJOR__" and "__PTX_ISA_VERSION_MINOR__"; for
23678 instance, for 3.1 the macros have the values 3 and 1, respectively.
23679
23680 -mmainkernel
23681 Link in code for a __main kernel. This is for stand-alone instead
23682 of offloading execution.
23683
23684 -moptimize
23685 Apply partitioned execution optimizations. This is the default
23686 when any level of optimization is selected.
23687
23688 -msoft-stack
23689 Generate code that does not use ".local" memory directly for stack
23690 storage. Instead, a per-warp stack pointer is maintained
23691 explicitly. This enables variable-length stack allocation (with
23692 variable-length arrays or "alloca"), and when global memory is used
23693 for underlying storage, makes it possible to access automatic
23694 variables from other threads, or with atomic instructions. This
23695 code generation variant is used for OpenMP offloading, but the
23696 option is exposed on its own for the purpose of testing the
23697 compiler; to generate code suitable for linking into programs using
23698 OpenMP offloading, use option -mgomp.
23699
23700 -muniform-simt
23701 Switch to code generation variant that allows to execute all
23702 threads in each warp, while maintaining memory state and side
23703 effects as if only one thread in each warp was active outside of
23704 OpenMP SIMD regions. All atomic operations and calls to runtime
23705 (malloc, free, vprintf) are conditionally executed (iff current
23706 lane index equals the master lane index), and the register being
23707 assigned is copied via a shuffle instruction from the master lane.
23708 Outside of SIMD regions lane 0 is the master; inside, each thread
23709 sees itself as the master. Shared memory array "int __nvptx_uni[]"
23710 stores all-zeros or all-ones bitmasks for each warp, indicating
23711 current mode (0 outside of SIMD regions). Each thread can bitwise-
23712 and the bitmask at position "tid.y" with current lane index to
23713 compute the master lane index.
23714
23715 -mgomp
23716 Generate code for use in OpenMP offloading: enables -msoft-stack
23717 and -muniform-simt options, and selects corresponding multilib
23718 variant.
23719
23720 OpenRISC Options
23721
23722 These options are defined for OpenRISC:
23723
23724 -mboard=name
23725 Configure a board specific runtime. This will be passed to the
23726 linker for newlib board library linking. The default is "or1ksim".
23727
23728 -mnewlib
23729 This option is ignored; it is for compatibility purposes only.
23730 This used to select linker and preprocessor options for use with
23731 newlib.
23732
23733 -msoft-div
23734 -mhard-div
23735 Select software or hardware divide ("l.div", "l.divu")
23736 instructions. This default is hardware divide.
23737
23738 -msoft-mul
23739 -mhard-mul
23740 Select software or hardware multiply ("l.mul", "l.muli")
23741 instructions. This default is hardware multiply.
23742
23743 -msoft-float
23744 -mhard-float
23745 Select software or hardware for floating point operations. The
23746 default is software.
23747
23748 -mdouble-float
23749 When -mhard-float is selected, enables generation of double-
23750 precision floating point instructions. By default functions from
23751 libgcc are used to perform double-precision floating point
23752 operations.
23753
23754 -munordered-float
23755 When -mhard-float is selected, enables generation of unordered
23756 floating point compare and set flag ("lf.sfun*") instructions. By
23757 default functions from libgcc are used to perform unordered
23758 floating point compare and set flag operations.
23759
23760 -mcmov
23761 Enable generation of conditional move ("l.cmov") instructions. By
23762 default the equivalent will be generated using set and branch.
23763
23764 -mror
23765 Enable generation of rotate right ("l.ror") instructions. By
23766 default functions from libgcc are used to perform rotate right
23767 operations.
23768
23769 -mrori
23770 Enable generation of rotate right with immediate ("l.rori")
23771 instructions. By default functions from libgcc are used to perform
23772 rotate right with immediate operations.
23773
23774 -msext
23775 Enable generation of sign extension ("l.ext*") instructions. By
23776 default memory loads are used to perform sign extension.
23777
23778 -msfimm
23779 Enable generation of compare and set flag with immediate ("l.sf*i")
23780 instructions. By default extra instructions will be generated to
23781 store the immediate to a register first.
23782
23783 -mshftimm
23784 Enable generation of shift with immediate ("l.srai", "l.srli",
23785 "l.slli") instructions. By default extra instructions will be
23786 generated to store the immediate to a register first.
23787
23788 -mcmodel=small
23789 Generate OpenRISC code for the small model: The GOT is limited to
23790 64k. This is the default model.
23791
23792 -mcmodel=large
23793 Generate OpenRISC code for the large model: The GOT may grow up to
23794 4G in size.
23795
23796 PDP-11 Options
23797
23798 These options are defined for the PDP-11:
23799
23800 -mfpu
23801 Use hardware FPP floating point. This is the default. (FIS
23802 floating point on the PDP-11/40 is not supported.) Implies -m45.
23803
23804 -msoft-float
23805 Do not use hardware floating point.
23806
23807 -mac0
23808 Return floating-point results in ac0 (fr0 in Unix assembler
23809 syntax).
23810
23811 -mno-ac0
23812 Return floating-point results in memory. This is the default.
23813
23814 -m40
23815 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23816
23817 -m45
23818 Generate code for a PDP-11/45. This is the default.
23819
23820 -m10
23821 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23822
23823 -mint16
23824 -mno-int32
23825 Use 16-bit "int". This is the default.
23826
23827 -mint32
23828 -mno-int16
23829 Use 32-bit "int".
23830
23831 -msplit
23832 Target has split instruction and data space. Implies -m45.
23833
23834 -munix-asm
23835 Use Unix assembler syntax.
23836
23837 -mdec-asm
23838 Use DEC assembler syntax.
23839
23840 -mgnu-asm
23841 Use GNU assembler syntax. This is the default.
23842
23843 -mlra
23844 Use the new LRA register allocator. By default, the old "reload"
23845 allocator is used.
23846
23847 picoChip Options
23848
23849 These -m options are defined for picoChip implementations:
23850
23851 -mae=ae_type
23852 Set the instruction set, register set, and instruction scheduling
23853 parameters for array element type ae_type. Supported values for
23854 ae_type are ANY, MUL, and MAC.
23855
23856 -mae=ANY selects a completely generic AE type. Code generated with
23857 this option runs on any of the other AE types. The code is not as
23858 efficient as it would be if compiled for a specific AE type, and
23859 some types of operation (e.g., multiplication) do not work properly
23860 on all types of AE.
23861
23862 -mae=MUL selects a MUL AE type. This is the most useful AE type
23863 for compiled code, and is the default.
23864
23865 -mae=MAC selects a DSP-style MAC AE. Code compiled with this
23866 option may suffer from poor performance of byte (char)
23867 manipulation, since the DSP AE does not provide hardware support
23868 for byte load/stores.
23869
23870 -msymbol-as-address
23871 Enable the compiler to directly use a symbol name as an address in
23872 a load/store instruction, without first loading it into a register.
23873 Typically, the use of this option generates larger programs, which
23874 run faster than when the option isn't used. However, the results
23875 vary from program to program, so it is left as a user option,
23876 rather than being permanently enabled.
23877
23878 -mno-inefficient-warnings
23879 Disables warnings about the generation of inefficient code. These
23880 warnings can be generated, for example, when compiling code that
23881 performs byte-level memory operations on the MAC AE type. The MAC
23882 AE has no hardware support for byte-level memory operations, so all
23883 byte load/stores must be synthesized from word load/store
23884 operations. This is inefficient and a warning is generated to
23885 indicate that you should rewrite the code to avoid byte operations,
23886 or to target an AE type that has the necessary hardware support.
23887 This option disables these warnings.
23888
23889 PowerPC Options
23890
23891 These are listed under
23892
23893 PRU Options
23894
23895 These command-line options are defined for PRU target:
23896
23897 -minrt
23898 Link with a minimum runtime environment, with no support for static
23899 initializers and constructors. Using this option can significantly
23900 reduce the size of the final ELF binary. Beware that the compiler
23901 could still generate code with static initializers and
23902 constructors. It is up to the programmer to ensure that the source
23903 program will not use those features.
23904
23905 -mmcu=mcu
23906 Specify the PRU MCU variant to use. Check Newlib for the exact
23907 list of supported MCUs.
23908
23909 -mno-relax
23910 Make GCC pass the --no-relax command-line option to the linker
23911 instead of the --relax option.
23912
23913 -mloop
23914 Allow (or do not allow) GCC to use the LOOP instruction.
23915
23916 -mabi=variant
23917 Specify the ABI variant to output code for. -mabi=ti selects the
23918 unmodified TI ABI while -mabi=gnu selects a GNU variant that copes
23919 more naturally with certain GCC assumptions. These are the
23920 differences:
23921
23922 Function Pointer Size
23923 TI ABI specifies that function (code) pointers are 16-bit,
23924 whereas GNU supports only 32-bit data and code pointers.
23925
23926 Optional Return Value Pointer
23927 Function return values larger than 64 bits are passed by using
23928 a hidden pointer as the first argument of the function. TI
23929 ABI, though, mandates that the pointer can be NULL in case the
23930 caller is not using the returned value. GNU always passes and
23931 expects a valid return value pointer.
23932
23933 The current -mabi=ti implementation simply raises a compile error
23934 when any of the above code constructs is detected. As a
23935 consequence the standard C library cannot be built and it is
23936 omitted when linking with -mabi=ti.
23937
23938 Relaxation is a GNU feature and for safety reasons is disabled when
23939 using -mabi=ti. The TI toolchain does not emit relocations for
23940 QBBx instructions, so the GNU linker cannot adjust them when
23941 shortening adjacent LDI32 pseudo instructions.
23942
23943 RISC-V Options
23944
23945 These command-line options are defined for RISC-V targets:
23946
23947 -mbranch-cost=n
23948 Set the cost of branches to roughly n instructions.
23949
23950 -mplt
23951 -mno-plt
23952 When generating PIC code, do or don't allow the use of PLTs.
23953 Ignored for non-PIC. The default is -mplt.
23954
23955 -mabi=ABI-string
23956 Specify integer and floating-point calling convention. ABI-string
23957 contains two parts: the size of integer types and the registers
23958 used for floating-point types. For example -march=rv64ifd
23959 -mabi=lp64d means that long and pointers are 64-bit (implicitly
23960 defining int to be 32-bit), and that floating-point values up to 64
23961 bits wide are passed in F registers. Contrast this with
23962 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
23963 generate code that uses the F and D extensions but only allows
23964 floating-point values up to 32 bits long to be passed in registers;
23965 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
23966 will be passed in registers.
23967
23968 The default for this argument is system dependent, users who want a
23969 specific calling convention should specify one explicitly. The
23970 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
23971 and lp64d. Some calling conventions are impossible to implement on
23972 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
23973 because the ABI requires 64-bit values be passed in F registers,
23974 but F registers are only 32 bits wide. There is also the ilp32e
23975 ABI that can only be used with the rv32e architecture. This ABI is
23976 not well specified at present, and is subject to change.
23977
23978 -mfdiv
23979 -mno-fdiv
23980 Do or don't use hardware floating-point divide and square root
23981 instructions. This requires the F or D extensions for floating-
23982 point registers. The default is to use them if the specified
23983 architecture has these instructions.
23984
23985 -mdiv
23986 -mno-div
23987 Do or don't use hardware instructions for integer division. This
23988 requires the M extension. The default is to use them if the
23989 specified architecture has these instructions.
23990
23991 -misa-spec=ISA-spec-string
23992 Specify the version of the RISC-V Unprivileged (formerly User-
23993 Level) ISA specification to produce code conforming to. The
23994 possibilities for ISA-spec-string are:
23995
23996 2.2 Produce code conforming to version 2.2.
23997
23998 20190608
23999 Produce code conforming to version 20190608.
24000
24001 20191213
24002 Produce code conforming to version 20191213.
24003
24004 The default is -misa-spec=20191213 unless GCC has been configured
24005 with --with-isa-spec= specifying a different default version.
24006
24007 -march=ISA-string
24008 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
24009 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
24010
24011 When -march= is not specified, use the setting from -mcpu.
24012
24013 If both -march and -mcpu= are not specified, the default for this
24014 argument is system dependent, users who want a specific
24015 architecture extensions should specify one explicitly.
24016
24017 -mcpu=processor-string
24018 Use architecture of and optimize the output for the given
24019 processor, specified by particular CPU name. Permissible values
24020 for this option are: sifive-e20, sifive-e21, sifive-e24,
24021 sifive-e31, sifive-e34, sifive-e76, sifive-s21, sifive-s51,
24022 sifive-s54, sifive-s76, sifive-u54, and sifive-u74.
24023
24024 -mtune=processor-string
24025 Optimize the output for the given processor, specified by
24026 microarchitecture or particular CPU name. Permissible values for
24027 this option are: rocket, sifive-3-series, sifive-5-series,
24028 sifive-7-series, size, and all valid options for -mcpu=.
24029
24030 When -mtune= is not specified, use the setting from -mcpu, the
24031 default is rocket if both are not specified.
24032
24033 The size choice is not intended for use by end-users. This is used
24034 when -Os is specified. It overrides the instruction cost info
24035 provided by -mtune=, but does not override the pipeline info. This
24036 helps reduce code size while still giving good performance.
24037
24038 -mpreferred-stack-boundary=num
24039 Attempt to keep the stack boundary aligned to a 2 raised to num
24040 byte boundary. If -mpreferred-stack-boundary is not specified, the
24041 default is 4 (16 bytes or 128-bits).
24042
24043 Warning: If you use this switch, then you must build all modules
24044 with the same value, including any libraries. This includes the
24045 system libraries and startup modules.
24046
24047 -msmall-data-limit=n
24048 Put global and static data smaller than n bytes into a special
24049 section (on some targets).
24050
24051 -msave-restore
24052 -mno-save-restore
24053 Do or don't use smaller but slower prologue and epilogue code that
24054 uses library function calls. The default is to use fast inline
24055 prologues and epilogues.
24056
24057 -mshorten-memrefs
24058 -mno-shorten-memrefs
24059 Do or do not attempt to make more use of compressed load/store
24060 instructions by replacing a load/store of 'base register + large
24061 offset' with a new load/store of 'new base + small offset'. If the
24062 new base gets stored in a compressed register, then the new
24063 load/store can be compressed. Currently targets 32-bit integer
24064 load/stores only.
24065
24066 -mstrict-align
24067 -mno-strict-align
24068 Do not or do generate unaligned memory accesses. The default is
24069 set depending on whether the processor we are optimizing for
24070 supports fast unaligned access or not.
24071
24072 -mcmodel=medlow
24073 Generate code for the medium-low code model. The program and its
24074 statically defined symbols must lie within a single 2 GiB address
24075 range and must lie between absolute addresses -2 GiB and +2 GiB.
24076 Programs can be statically or dynamically linked. This is the
24077 default code model.
24078
24079 -mcmodel=medany
24080 Generate code for the medium-any code model. The program and its
24081 statically defined symbols must be within any single 2 GiB address
24082 range. Programs can be statically or dynamically linked.
24083
24084 The code generated by the medium-any code model is position-
24085 independent, but is not guaranteed to function correctly when
24086 linked into position-independent executables or libraries.
24087
24088 -mexplicit-relocs
24089 -mno-exlicit-relocs
24090 Use or do not use assembler relocation operators when dealing with
24091 symbolic addresses. The alternative is to use assembler macros
24092 instead, which may limit optimization.
24093
24094 -mrelax
24095 -mno-relax
24096 Take advantage of linker relaxations to reduce the number of
24097 instructions required to materialize symbol addresses. The default
24098 is to take advantage of linker relaxations.
24099
24100 -memit-attribute
24101 -mno-emit-attribute
24102 Emit (do not emit) RISC-V attribute to record extra information
24103 into ELF objects. This feature requires at least binutils 2.32.
24104
24105 -malign-data=type
24106 Control how GCC aligns variables and constants of array, structure,
24107 or union types. Supported values for type are xlen which uses x
24108 register width as the alignment value, and natural which uses
24109 natural alignment. xlen is the default.
24110
24111 -mbig-endian
24112 Generate big-endian code. This is the default when GCC is
24113 configured for a riscv64be-*-* or riscv32be-*-* target.
24114
24115 -mlittle-endian
24116 Generate little-endian code. This is the default when GCC is
24117 configured for a riscv64-*-* or riscv32-*-* but not a riscv64be-*-*
24118 or riscv32be-*-* target.
24119
24120 -mstack-protector-guard=guard
24121 -mstack-protector-guard-reg=reg
24122 -mstack-protector-guard-offset=offset
24123 Generate stack protection code using canary at guard. Supported
24124 locations are global for a global canary or tls for per-thread
24125 canary in the TLS block.
24126
24127 With the latter choice the options -mstack-protector-guard-reg=reg
24128 and -mstack-protector-guard-offset=offset furthermore specify which
24129 register to use as base register for reading the canary, and from
24130 what offset from that base register. There is no default register
24131 or offset as this is entirely for use within the Linux kernel.
24132
24133 RL78 Options
24134
24135 -msim
24136 Links in additional target libraries to support operation within a
24137 simulator.
24138
24139 -mmul=none
24140 -mmul=g10
24141 -mmul=g13
24142 -mmul=g14
24143 -mmul=rl78
24144 Specifies the type of hardware multiplication and division support
24145 to be used. The simplest is "none", which uses software for both
24146 multiplication and division. This is the default. The "g13" value
24147 is for the hardware multiply/divide peripheral found on the
24148 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
24149 multiplication and division instructions supported by the RL78/G14
24150 (S3 core) parts. The value "rl78" is an alias for "g14" and the
24151 value "mg10" is an alias for "none".
24152
24153 In addition a C preprocessor macro is defined, based upon the
24154 setting of this option. Possible values are: "__RL78_MUL_NONE__",
24155 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
24156
24157 -mcpu=g10
24158 -mcpu=g13
24159 -mcpu=g14
24160 -mcpu=rl78
24161 Specifies the RL78 core to target. The default is the G14 core,
24162 also known as an S3 core or just RL78. The G13 or S2 core does not
24163 have multiply or divide instructions, instead it uses a hardware
24164 peripheral for these operations. The G10 or S1 core does not have
24165 register banks, so it uses a different calling convention.
24166
24167 If this option is set it also selects the type of hardware multiply
24168 support to use, unless this is overridden by an explicit -mmul=none
24169 option on the command line. Thus specifying -mcpu=g13 enables the
24170 use of the G13 hardware multiply peripheral and specifying
24171 -mcpu=g10 disables the use of hardware multiplications altogether.
24172
24173 Note, although the RL78/G14 core is the default target, specifying
24174 -mcpu=g14 or -mcpu=rl78 on the command line does change the
24175 behavior of the toolchain since it also enables G14 hardware
24176 multiply support. If these options are not specified on the
24177 command line then software multiplication routines will be used
24178 even though the code targets the RL78 core. This is for backwards
24179 compatibility with older toolchains which did not have hardware
24180 multiply and divide support.
24181
24182 In addition a C preprocessor macro is defined, based upon the
24183 setting of this option. Possible values are: "__RL78_G10__",
24184 "__RL78_G13__" or "__RL78_G14__".
24185
24186 -mg10
24187 -mg13
24188 -mg14
24189 -mrl78
24190 These are aliases for the corresponding -mcpu= option. They are
24191 provided for backwards compatibility.
24192
24193 -mallregs
24194 Allow the compiler to use all of the available registers. By
24195 default registers "r24..r31" are reserved for use in interrupt
24196 handlers. With this option enabled these registers can be used in
24197 ordinary functions as well.
24198
24199 -m64bit-doubles
24200 -m32bit-doubles
24201 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
24202 (-m32bit-doubles) in size. The default is -m32bit-doubles.
24203
24204 -msave-mduc-in-interrupts
24205 -mno-save-mduc-in-interrupts
24206 Specifies that interrupt handler functions should preserve the MDUC
24207 registers. This is only necessary if normal code might use the
24208 MDUC registers, for example because it performs multiplication and
24209 division operations. The default is to ignore the MDUC registers
24210 as this makes the interrupt handlers faster. The target option
24211 -mg13 needs to be passed for this to work as this feature is only
24212 available on the G13 target (S2 core). The MDUC registers will
24213 only be saved if the interrupt handler performs a multiplication or
24214 division operation or it calls another function.
24215
24216 IBM RS/6000 and PowerPC Options
24217
24218 These -m options are defined for the IBM RS/6000 and PowerPC:
24219
24220 -mpowerpc-gpopt
24221 -mno-powerpc-gpopt
24222 -mpowerpc-gfxopt
24223 -mno-powerpc-gfxopt
24224 -mpowerpc64
24225 -mno-powerpc64
24226 -mmfcrf
24227 -mno-mfcrf
24228 -mpopcntb
24229 -mno-popcntb
24230 -mpopcntd
24231 -mno-popcntd
24232 -mfprnd
24233 -mno-fprnd
24234 -mcmpb
24235 -mno-cmpb
24236 -mhard-dfp
24237 -mno-hard-dfp
24238 You use these options to specify which instructions are available
24239 on the processor you are using. The default value of these options
24240 is determined when configuring GCC. Specifying the -mcpu=cpu_type
24241 overrides the specification of these options. We recommend you use
24242 the -mcpu=cpu_type option rather than the options listed above.
24243
24244 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
24245 architecture instructions in the General Purpose group, including
24246 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
24247 to use the optional PowerPC architecture instructions in the
24248 Graphics group, including floating-point select.
24249
24250 The -mmfcrf option allows GCC to generate the move from condition
24251 register field instruction implemented on the POWER4 processor and
24252 other processors that support the PowerPC V2.01 architecture. The
24253 -mpopcntb option allows GCC to generate the popcount and double-
24254 precision FP reciprocal estimate instruction implemented on the
24255 POWER5 processor and other processors that support the PowerPC
24256 V2.02 architecture. The -mpopcntd option allows GCC to generate
24257 the popcount instruction implemented on the POWER7 processor and
24258 other processors that support the PowerPC V2.06 architecture. The
24259 -mfprnd option allows GCC to generate the FP round to integer
24260 instructions implemented on the POWER5+ processor and other
24261 processors that support the PowerPC V2.03 architecture. The -mcmpb
24262 option allows GCC to generate the compare bytes instruction
24263 implemented on the POWER6 processor and other processors that
24264 support the PowerPC V2.05 architecture. The -mhard-dfp option
24265 allows GCC to generate the decimal floating-point instructions
24266 implemented on some POWER processors.
24267
24268 The -mpowerpc64 option allows GCC to generate the additional 64-bit
24269 instructions that are found in the full PowerPC64 architecture and
24270 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24271 -mno-powerpc64.
24272
24273 -mcpu=cpu_type
24274 Set architecture type, register usage, and instruction scheduling
24275 parameters for machine type cpu_type. Supported values for
24276 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
24277 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
24278 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
24279 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
24280 power4, power5, power5+, power6, power6x, power7, power8, power9,
24281 power10, powerpc, powerpc64, powerpc64le, rs64, and native.
24282
24283 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
24284 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
24285 64-bit little endian PowerPC architecture machine types, with an
24286 appropriate, generic processor model assumed for scheduling
24287 purposes.
24288
24289 Specifying native as cpu type detects and selects the architecture
24290 option that corresponds to the host processor of the system
24291 performing the compilation. -mcpu=native has no effect if GCC does
24292 not recognize the processor.
24293
24294 The other options specify a specific processor. Code generated
24295 under those options runs best on that processor, and may not run at
24296 all on others.
24297
24298 The -mcpu options automatically enable or disable the following
24299 options:
24300
24301 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
24302 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
24303 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
24304 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
24305 -mfloat128-hardware -mprefixed -mpcrel -mmma -mrop-protect
24306
24307 The particular options set for any particular CPU varies between
24308 compiler versions, depending on what setting seems to produce
24309 optimal code for that CPU; it doesn't necessarily reflect the
24310 actual hardware's capabilities. If you wish to set an individual
24311 option to a particular value, you may specify it after the -mcpu
24312 option, like -mcpu=970 -mno-altivec.
24313
24314 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
24315 disabled by the -mcpu option at present because AIX does not have
24316 full support for these options. You may still enable or disable
24317 them individually if you're sure it'll work in your environment.
24318
24319 -mtune=cpu_type
24320 Set the instruction scheduling parameters for machine type
24321 cpu_type, but do not set the architecture type or register usage,
24322 as -mcpu=cpu_type does. The same values for cpu_type are used for
24323 -mtune as for -mcpu. If both are specified, the code generated
24324 uses the architecture and registers set by -mcpu, but the
24325 scheduling parameters set by -mtune.
24326
24327 -mcmodel=small
24328 Generate PowerPC64 code for the small model: The TOC is limited to
24329 64k.
24330
24331 -mcmodel=medium
24332 Generate PowerPC64 code for the medium model: The TOC and other
24333 static data may be up to a total of 4G in size. This is the
24334 default for 64-bit Linux.
24335
24336 -mcmodel=large
24337 Generate PowerPC64 code for the large model: The TOC may be up to
24338 4G in size. Other data and code is only limited by the 64-bit
24339 address space.
24340
24341 -maltivec
24342 -mno-altivec
24343 Generate code that uses (does not use) AltiVec instructions, and
24344 also enable the use of built-in functions that allow more direct
24345 access to the AltiVec instruction set. You may also need to set
24346 -mabi=altivec to adjust the current ABI with AltiVec ABI
24347 enhancements.
24348
24349 When -maltivec is used, the element order for AltiVec intrinsics
24350 such as "vec_splat", "vec_extract", and "vec_insert" match array
24351 element order corresponding to the endianness of the target. That
24352 is, element zero identifies the leftmost element in a vector
24353 register when targeting a big-endian platform, and identifies the
24354 rightmost element in a vector register when targeting a little-
24355 endian platform.
24356
24357 -mvrsave
24358 -mno-vrsave
24359 Generate VRSAVE instructions when generating AltiVec code.
24360
24361 -msecure-plt
24362 Generate code that allows ld and ld.so to build executables and
24363 shared libraries with non-executable ".plt" and ".got" sections.
24364 This is a PowerPC 32-bit SYSV ABI option.
24365
24366 -mbss-plt
24367 Generate code that uses a BSS ".plt" section that ld.so fills in,
24368 and requires ".plt" and ".got" sections that are both writable and
24369 executable. This is a PowerPC 32-bit SYSV ABI option.
24370
24371 -misel
24372 -mno-isel
24373 This switch enables or disables the generation of ISEL
24374 instructions.
24375
24376 -mvsx
24377 -mno-vsx
24378 Generate code that uses (does not use) vector/scalar (VSX)
24379 instructions, and also enable the use of built-in functions that
24380 allow more direct access to the VSX instruction set.
24381
24382 -mcrypto
24383 -mno-crypto
24384 Enable the use (disable) of the built-in functions that allow
24385 direct access to the cryptographic instructions that were added in
24386 version 2.07 of the PowerPC ISA.
24387
24388 -mhtm
24389 -mno-htm
24390 Enable (disable) the use of the built-in functions that allow
24391 direct access to the Hardware Transactional Memory (HTM)
24392 instructions that were added in version 2.07 of the PowerPC ISA.
24393
24394 -mpower8-fusion
24395 -mno-power8-fusion
24396 Generate code that keeps (does not keeps) some integer operations
24397 adjacent so that the instructions can be fused together on power8
24398 and later processors.
24399
24400 -mpower8-vector
24401 -mno-power8-vector
24402 Generate code that uses (does not use) the vector and scalar
24403 instructions that were added in version 2.07 of the PowerPC ISA.
24404 Also enable the use of built-in functions that allow more direct
24405 access to the vector instructions.
24406
24407 -mquad-memory
24408 -mno-quad-memory
24409 Generate code that uses (does not use) the non-atomic quad word
24410 memory instructions. The -mquad-memory option requires use of
24411 64-bit mode.
24412
24413 -mquad-memory-atomic
24414 -mno-quad-memory-atomic
24415 Generate code that uses (does not use) the atomic quad word memory
24416 instructions. The -mquad-memory-atomic option requires use of
24417 64-bit mode.
24418
24419 -mfloat128
24420 -mno-float128
24421 Enable/disable the __float128 keyword for IEEE 128-bit floating
24422 point and use either software emulation for IEEE 128-bit floating
24423 point or hardware instructions.
24424
24425 The VSX instruction set (-mvsx) must be enabled to use the IEEE
24426 128-bit floating point support. The IEEE 128-bit floating point is
24427 only supported on Linux.
24428
24429 The default for -mfloat128 is enabled on PowerPC Linux systems
24430 using the VSX instruction set, and disabled on other systems.
24431
24432 If you use the ISA 3.0 instruction set (-mpower9-vector or
24433 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
24434 support will also enable the generation of ISA 3.0 IEEE 128-bit
24435 floating point instructions. Otherwise, if you do not specify to
24436 generate ISA 3.0 instructions or you are targeting a 32-bit big
24437 endian system, IEEE 128-bit floating point will be done with
24438 software emulation.
24439
24440 -mfloat128-hardware
24441 -mno-float128-hardware
24442 Enable/disable using ISA 3.0 hardware instructions to support the
24443 __float128 data type.
24444
24445 The default for -mfloat128-hardware is enabled on PowerPC Linux
24446 systems using the ISA 3.0 instruction set, and disabled on other
24447 systems.
24448
24449 -m32
24450 -m64
24451 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24452 targets (including GNU/Linux). The 32-bit environment sets int,
24453 long and pointer to 32 bits and generates code that runs on any
24454 PowerPC variant. The 64-bit environment sets int to 32 bits and
24455 long and pointer to 64 bits, and generates code for PowerPC64, as
24456 for -mpowerpc64.
24457
24458 -mfull-toc
24459 -mno-fp-in-toc
24460 -mno-sum-in-toc
24461 -mminimal-toc
24462 Modify generation of the TOC (Table Of Contents), which is created
24463 for every executable file. The -mfull-toc option is selected by
24464 default. In that case, GCC allocates at least one TOC entry for
24465 each unique non-automatic variable reference in your program. GCC
24466 also places floating-point constants in the TOC. However, only
24467 16,384 entries are available in the TOC.
24468
24469 If you receive a linker error message that saying you have
24470 overflowed the available TOC space, you can reduce the amount of
24471 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
24472 -mno-fp-in-toc prevents GCC from putting floating-point constants
24473 in the TOC and -mno-sum-in-toc forces GCC to generate code to
24474 calculate the sum of an address and a constant at run time instead
24475 of putting that sum into the TOC. You may specify one or both of
24476 these options. Each causes GCC to produce very slightly slower and
24477 larger code at the expense of conserving TOC space.
24478
24479 If you still run out of space in the TOC even when you specify both
24480 of these options, specify -mminimal-toc instead. This option
24481 causes GCC to make only one TOC entry for every file. When you
24482 specify this option, GCC produces code that is slower and larger
24483 but which uses extremely little TOC space. You may wish to use
24484 this option only on files that contain less frequently-executed
24485 code.
24486
24487 -maix64
24488 -maix32
24489 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
24490 64-bit "long" type, and the infrastructure needed to support them.
24491 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
24492 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
24493
24494 -mxl-compat
24495 -mno-xl-compat
24496 Produce code that conforms more closely to IBM XL compiler
24497 semantics when using AIX-compatible ABI. Pass floating-point
24498 arguments to prototyped functions beyond the register save area
24499 (RSA) on the stack in addition to argument FPRs. Do not assume
24500 that most significant double in 128-bit long double value is
24501 properly rounded when comparing values and converting to double.
24502 Use XL symbol names for long double support routines.
24503
24504 The AIX calling convention was extended but not initially
24505 documented to handle an obscure K&R C case of calling a function
24506 that takes the address of its arguments with fewer arguments than
24507 declared. IBM XL compilers access floating-point arguments that do
24508 not fit in the RSA from the stack when a subroutine is compiled
24509 without optimization. Because always storing floating-point
24510 arguments on the stack is inefficient and rarely needed, this
24511 option is not enabled by default and only is necessary when calling
24512 subroutines compiled by IBM XL compilers without optimization.
24513
24514 -mpe
24515 Support IBM RS/6000 SP Parallel Environment (PE). Link an
24516 application written to use message passing with special startup
24517 code to enable the application to run. The system must have PE
24518 installed in the standard location (/usr/lpp/ppe.poe/), or the
24519 specs file must be overridden with the -specs= option to specify
24520 the appropriate directory location. The Parallel Environment does
24521 not support threads, so the -mpe option and the -pthread option are
24522 incompatible.
24523
24524 -malign-natural
24525 -malign-power
24526 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24527 -malign-natural overrides the ABI-defined alignment of larger
24528 types, such as floating-point doubles, on their natural size-based
24529 boundary. The option -malign-power instructs GCC to follow the
24530 ABI-specified alignment rules. GCC defaults to the standard
24531 alignment defined in the ABI.
24532
24533 On 64-bit Darwin, natural alignment is the default, and
24534 -malign-power is not supported.
24535
24536 -msoft-float
24537 -mhard-float
24538 Generate code that does not use (uses) the floating-point register
24539 set. Software floating-point emulation is provided if you use the
24540 -msoft-float option, and pass the option to GCC when linking.
24541
24542 -mmultiple
24543 -mno-multiple
24544 Generate code that uses (does not use) the load multiple word
24545 instructions and the store multiple word instructions. These
24546 instructions are generated by default on POWER systems, and not
24547 generated on PowerPC systems. Do not use -mmultiple on little-
24548 endian PowerPC systems, since those instructions do not work when
24549 the processor is in little-endian mode. The exceptions are PPC740
24550 and PPC750 which permit these instructions in little-endian mode.
24551
24552 -mupdate
24553 -mno-update
24554 Generate code that uses (does not use) the load or store
24555 instructions that update the base register to the address of the
24556 calculated memory location. These instructions are generated by
24557 default. If you use -mno-update, there is a small window between
24558 the time that the stack pointer is updated and the address of the
24559 previous frame is stored, which means code that walks the stack
24560 frame across interrupts or signals may get corrupted data.
24561
24562 -mavoid-indexed-addresses
24563 -mno-avoid-indexed-addresses
24564 Generate code that tries to avoid (not avoid) the use of indexed
24565 load or store instructions. These instructions can incur a
24566 performance penalty on Power6 processors in certain situations,
24567 such as when stepping through large arrays that cross a 16M
24568 boundary. This option is enabled by default when targeting Power6
24569 and disabled otherwise.
24570
24571 -mfused-madd
24572 -mno-fused-madd
24573 Generate code that uses (does not use) the floating-point multiply
24574 and accumulate instructions. These instructions are generated by
24575 default if hardware floating point is used. The machine-dependent
24576 -mfused-madd option is now mapped to the machine-independent
24577 -ffp-contract=fast option, and -mno-fused-madd is mapped to
24578 -ffp-contract=off.
24579
24580 -mmulhw
24581 -mno-mulhw
24582 Generate code that uses (does not use) the half-word multiply and
24583 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
24584 processors. These instructions are generated by default when
24585 targeting those processors.
24586
24587 -mdlmzb
24588 -mno-dlmzb
24589 Generate code that uses (does not use) the string-search dlmzb
24590 instruction on the IBM 405, 440, 464 and 476 processors. This
24591 instruction is generated by default when targeting those
24592 processors.
24593
24594 -mno-bit-align
24595 -mbit-align
24596 On System V.4 and embedded PowerPC systems do not (do) force
24597 structures and unions that contain bit-fields to be aligned to the
24598 base type of the bit-field.
24599
24600 For example, by default a structure containing nothing but 8
24601 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
24602 and has a size of 4 bytes. By using -mno-bit-align, the structure
24603 is aligned to a 1-byte boundary and is 1 byte in size.
24604
24605 -mno-strict-align
24606 -mstrict-align
24607 On System V.4 and embedded PowerPC systems do not (do) assume that
24608 unaligned memory references are handled by the system.
24609
24610 -mrelocatable
24611 -mno-relocatable
24612 Generate code that allows (does not allow) a static executable to
24613 be relocated to a different address at run time. A simple embedded
24614 PowerPC system loader should relocate the entire contents of
24615 ".got2" and 4-byte locations listed in the ".fixup" section, a
24616 table of 32-bit addresses generated by this option. For this to
24617 work, all objects linked together must be compiled with
24618 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
24619 stack to an 8-byte boundary.
24620
24621 -mrelocatable-lib
24622 -mno-relocatable-lib
24623 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
24624 to allow static executables to be relocated at run time, but
24625 -mrelocatable-lib does not use the smaller stack alignment of
24626 -mrelocatable. Objects compiled with -mrelocatable-lib may be
24627 linked with objects compiled with any combination of the
24628 -mrelocatable options.
24629
24630 -mno-toc
24631 -mtoc
24632 On System V.4 and embedded PowerPC systems do not (do) assume that
24633 register 2 contains a pointer to a global area pointing to the
24634 addresses used in the program.
24635
24636 -mlittle
24637 -mlittle-endian
24638 On System V.4 and embedded PowerPC systems compile code for the
24639 processor in little-endian mode. The -mlittle-endian option is the
24640 same as -mlittle.
24641
24642 -mbig
24643 -mbig-endian
24644 On System V.4 and embedded PowerPC systems compile code for the
24645 processor in big-endian mode. The -mbig-endian option is the same
24646 as -mbig.
24647
24648 -mdynamic-no-pic
24649 On Darwin and Mac OS X systems, compile code so that it is not
24650 relocatable, but that its external references are relocatable. The
24651 resulting code is suitable for applications, but not shared
24652 libraries.
24653
24654 -msingle-pic-base
24655 Treat the register used for PIC addressing as read-only, rather
24656 than loading it in the prologue for each function. The runtime
24657 system is responsible for initializing this register with an
24658 appropriate value before execution begins.
24659
24660 -mprioritize-restricted-insns=priority
24661 This option controls the priority that is assigned to dispatch-slot
24662 restricted instructions during the second scheduling pass. The
24663 argument priority takes the value 0, 1, or 2 to assign no, highest,
24664 or second-highest (respectively) priority to dispatch-slot
24665 restricted instructions.
24666
24667 -msched-costly-dep=dependence_type
24668 This option controls which dependences are considered costly by the
24669 target during instruction scheduling. The argument dependence_type
24670 takes one of the following values:
24671
24672 no No dependence is costly.
24673
24674 all All dependences are costly.
24675
24676 true_store_to_load
24677 A true dependence from store to load is costly.
24678
24679 store_to_load
24680 Any dependence from store to load is costly.
24681
24682 number
24683 Any dependence for which the latency is greater than or equal
24684 to number is costly.
24685
24686 -minsert-sched-nops=scheme
24687 This option controls which NOP insertion scheme is used during the
24688 second scheduling pass. The argument scheme takes one of the
24689 following values:
24690
24691 no Don't insert NOPs.
24692
24693 pad Pad with NOPs any dispatch group that has vacant issue slots,
24694 according to the scheduler's grouping.
24695
24696 regroup_exact
24697 Insert NOPs to force costly dependent insns into separate
24698 groups. Insert exactly as many NOPs as needed to force an insn
24699 to a new group, according to the estimated processor grouping.
24700
24701 number
24702 Insert NOPs to force costly dependent insns into separate
24703 groups. Insert number NOPs to force an insn to a new group.
24704
24705 -mcall-sysv
24706 On System V.4 and embedded PowerPC systems compile code using
24707 calling conventions that adhere to the March 1995 draft of the
24708 System V Application Binary Interface, PowerPC processor
24709 supplement. This is the default unless you configured GCC using
24710 powerpc-*-eabiaix.
24711
24712 -mcall-sysv-eabi
24713 -mcall-eabi
24714 Specify both -mcall-sysv and -meabi options.
24715
24716 -mcall-sysv-noeabi
24717 Specify both -mcall-sysv and -mno-eabi options.
24718
24719 -mcall-aixdesc
24720 On System V.4 and embedded PowerPC systems compile code for the AIX
24721 operating system.
24722
24723 -mcall-linux
24724 On System V.4 and embedded PowerPC systems compile code for the
24725 Linux-based GNU system.
24726
24727 -mcall-freebsd
24728 On System V.4 and embedded PowerPC systems compile code for the
24729 FreeBSD operating system.
24730
24731 -mcall-netbsd
24732 On System V.4 and embedded PowerPC systems compile code for the
24733 NetBSD operating system.
24734
24735 -mcall-openbsd
24736 On System V.4 and embedded PowerPC systems compile code for the
24737 OpenBSD operating system.
24738
24739 -mtraceback=traceback_type
24740 Select the type of traceback table. Valid values for traceback_type
24741 are full, part, and no.
24742
24743 -maix-struct-return
24744 Return all structures in memory (as specified by the AIX ABI).
24745
24746 -msvr4-struct-return
24747 Return structures smaller than 8 bytes in registers (as specified
24748 by the SVR4 ABI).
24749
24750 -mabi=abi-type
24751 Extend the current ABI with a particular extension, or remove such
24752 extension. Valid values are: altivec, no-altivec, ibmlongdouble,
24753 ieeelongdouble, elfv1, elfv2, and for AIX: vec-extabi, vec-default.
24754
24755 -mabi=ibmlongdouble
24756 Change the current ABI to use IBM extended-precision long double.
24757 This is not likely to work if your system defaults to using IEEE
24758 extended-precision long double. If you change the long double type
24759 from IEEE extended-precision, the compiler will issue a warning
24760 unless you use the -Wno-psabi option. Requires -mlong-double-128
24761 to be enabled.
24762
24763 -mabi=ieeelongdouble
24764 Change the current ABI to use IEEE extended-precision long double.
24765 This is not likely to work if your system defaults to using IBM
24766 extended-precision long double. If you change the long double type
24767 from IBM extended-precision, the compiler will issue a warning
24768 unless you use the -Wno-psabi option. Requires -mlong-double-128
24769 to be enabled.
24770
24771 -mabi=elfv1
24772 Change the current ABI to use the ELFv1 ABI. This is the default
24773 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
24774 ABI requires special system support and is likely to fail in
24775 spectacular ways.
24776
24777 -mabi=elfv2
24778 Change the current ABI to use the ELFv2 ABI. This is the default
24779 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
24780 ABI requires special system support and is likely to fail in
24781 spectacular ways.
24782
24783 -mgnu-attribute
24784 -mno-gnu-attribute
24785 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24786 .gnu.attributes section that specify ABI variations in function
24787 parameters or return values.
24788
24789 -mprototype
24790 -mno-prototype
24791 On System V.4 and embedded PowerPC systems assume that all calls to
24792 variable argument functions are properly prototyped. Otherwise,
24793 the compiler must insert an instruction before every non-prototyped
24794 call to set or clear bit 6 of the condition code register ("CR") to
24795 indicate whether floating-point values are passed in the floating-
24796 point registers in case the function takes variable arguments.
24797 With -mprototype, only calls to prototyped variable argument
24798 functions set or clear the bit.
24799
24800 -msim
24801 On embedded PowerPC systems, assume that the startup module is
24802 called sim-crt0.o and that the standard C libraries are libsim.a
24803 and libc.a. This is the default for powerpc-*-eabisim
24804 configurations.
24805
24806 -mmvme
24807 On embedded PowerPC systems, assume that the startup module is
24808 called crt0.o and the standard C libraries are libmvme.a and
24809 libc.a.
24810
24811 -mads
24812 On embedded PowerPC systems, assume that the startup module is
24813 called crt0.o and the standard C libraries are libads.a and libc.a.
24814
24815 -myellowknife
24816 On embedded PowerPC systems, assume that the startup module is
24817 called crt0.o and the standard C libraries are libyk.a and libc.a.
24818
24819 -mvxworks
24820 On System V.4 and embedded PowerPC systems, specify that you are
24821 compiling for a VxWorks system.
24822
24823 -memb
24824 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
24825 header to indicate that eabi extended relocations are used.
24826
24827 -meabi
24828 -mno-eabi
24829 On System V.4 and embedded PowerPC systems do (do not) adhere to
24830 the Embedded Applications Binary Interface (EABI), which is a set
24831 of modifications to the System V.4 specifications. Selecting
24832 -meabi means that the stack is aligned to an 8-byte boundary, a
24833 function "__eabi" is called from "main" to set up the EABI
24834 environment, and the -msdata option can use both "r2" and "r13" to
24835 point to two separate small data areas. Selecting -mno-eabi means
24836 that the stack is aligned to a 16-byte boundary, no EABI
24837 initialization function is called from "main", and the -msdata
24838 option only uses "r13" to point to a single small data area. The
24839 -meabi option is on by default if you configured GCC using one of
24840 the powerpc*-*-eabi* options.
24841
24842 -msdata=eabi
24843 On System V.4 and embedded PowerPC systems, put small initialized
24844 "const" global and static data in the ".sdata2" section, which is
24845 pointed to by register "r2". Put small initialized non-"const"
24846 global and static data in the ".sdata" section, which is pointed to
24847 by register "r13". Put small uninitialized global and static data
24848 in the ".sbss" section, which is adjacent to the ".sdata" section.
24849 The -msdata=eabi option is incompatible with the -mrelocatable
24850 option. The -msdata=eabi option also sets the -memb option.
24851
24852 -msdata=sysv
24853 On System V.4 and embedded PowerPC systems, put small global and
24854 static data in the ".sdata" section, which is pointed to by
24855 register "r13". Put small uninitialized global and static data in
24856 the ".sbss" section, which is adjacent to the ".sdata" section.
24857 The -msdata=sysv option is incompatible with the -mrelocatable
24858 option.
24859
24860 -msdata=default
24861 -msdata
24862 On System V.4 and embedded PowerPC systems, if -meabi is used,
24863 compile code the same as -msdata=eabi, otherwise compile code the
24864 same as -msdata=sysv.
24865
24866 -msdata=data
24867 On System V.4 and embedded PowerPC systems, put small global data
24868 in the ".sdata" section. Put small uninitialized global data in
24869 the ".sbss" section. Do not use register "r13" to address small
24870 data however. This is the default behavior unless other -msdata
24871 options are used.
24872
24873 -msdata=none
24874 -mno-sdata
24875 On embedded PowerPC systems, put all initialized global and static
24876 data in the ".data" section, and all uninitialized data in the
24877 ".bss" section.
24878
24879 -mreadonly-in-sdata
24880 Put read-only objects in the ".sdata" section as well. This is the
24881 default.
24882
24883 -mblock-move-inline-limit=num
24884 Inline all block moves (such as calls to "memcpy" or structure
24885 copies) less than or equal to num bytes. The minimum value for num
24886 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
24887 default value is target-specific.
24888
24889 -mblock-compare-inline-limit=num
24890 Generate non-looping inline code for all block compares (such as
24891 calls to "memcmp" or structure compares) less than or equal to num
24892 bytes. If num is 0, all inline expansion (non-loop and loop) of
24893 block compare is disabled. The default value is target-specific.
24894
24895 -mblock-compare-inline-loop-limit=num
24896 Generate an inline expansion using loop code for all block compares
24897 that are less than or equal to num bytes, but greater than the
24898 limit for non-loop inline block compare expansion. If the block
24899 length is not constant, at most num bytes will be compared before
24900 "memcmp" is called to compare the remainder of the block. The
24901 default value is target-specific.
24902
24903 -mstring-compare-inline-limit=num
24904 Compare at most num string bytes with inline code. If the
24905 difference or end of string is not found at the end of the inline
24906 compare a call to "strcmp" or "strncmp" will take care of the rest
24907 of the comparison. The default is 64 bytes.
24908
24909 -G num
24910 On embedded PowerPC systems, put global and static items less than
24911 or equal to num bytes into the small data or BSS sections instead
24912 of the normal data or BSS section. By default, num is 8. The -G
24913 num switch is also passed to the linker. All modules should be
24914 compiled with the same -G num value.
24915
24916 -mregnames
24917 -mno-regnames
24918 On System V.4 and embedded PowerPC systems do (do not) emit
24919 register names in the assembly language output using symbolic
24920 forms.
24921
24922 -mlongcall
24923 -mno-longcall
24924 By default assume that all calls are far away so that a longer and
24925 more expensive calling sequence is required. This is required for
24926 calls farther than 32 megabytes (33,554,432 bytes) from the current
24927 location. A short call is generated if the compiler knows the call
24928 cannot be that far away. This setting can be overridden by the
24929 "shortcall" function attribute, or by "#pragma longcall(0)".
24930
24931 Some linkers are capable of detecting out-of-range calls and
24932 generating glue code on the fly. On these systems, long calls are
24933 unnecessary and generate slower code. As of this writing, the AIX
24934 linker can do this, as can the GNU linker for PowerPC/64. It is
24935 planned to add this feature to the GNU linker for 32-bit PowerPC
24936 systems as well.
24937
24938 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
24939 linkers, GCC can generate long calls using an inline PLT call
24940 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
24941 ELFv1 (big-endian) do not support inline PLT calls.
24942
24943 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
24944 L42", plus a branch island (glue code). The two target addresses
24945 represent the callee and the branch island. The Darwin/PPC linker
24946 prefers the first address and generates a "bl callee" if the PPC
24947 "bl" instruction reaches the callee directly; otherwise, the linker
24948 generates "bl L42" to call the branch island. The branch island is
24949 appended to the body of the calling function; it computes the full
24950 32-bit address of the callee and jumps to it.
24951
24952 On Mach-O (Darwin) systems, this option directs the compiler emit
24953 to the glue for every direct call, and the Darwin linker decides
24954 whether to use or discard it.
24955
24956 In the future, GCC may ignore all longcall specifications when the
24957 linker is known to generate glue.
24958
24959 -mpltseq
24960 -mno-pltseq
24961 Implement (do not implement) -fno-plt and long calls using an
24962 inline PLT call sequence that supports lazy linking and long calls
24963 to functions in dlopen'd shared libraries. Inline PLT calls are
24964 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
24965 newer GNU linkers, and are enabled by default if the support is
24966 detected when configuring GCC, and, in the case of 32-bit PowerPC,
24967 if GCC is configured with --enable-secureplt. -mpltseq code and
24968 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
24969 together.
24970
24971 -mtls-markers
24972 -mno-tls-markers
24973 Mark (do not mark) calls to "__tls_get_addr" with a relocation
24974 specifying the function argument. The relocation allows the linker
24975 to reliably associate function call with argument setup
24976 instructions for TLS optimization, which in turn allows GCC to
24977 better schedule the sequence.
24978
24979 -mrecip
24980 -mno-recip
24981 This option enables use of the reciprocal estimate and reciprocal
24982 square root estimate instructions with additional Newton-Raphson
24983 steps to increase precision instead of doing a divide or square
24984 root and divide for floating-point arguments. You should use the
24985 -ffast-math option when using -mrecip (or at least
24986 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
24987 and -fno-trapping-math). Note that while the throughput of the
24988 sequence is generally higher than the throughput of the non-
24989 reciprocal instruction, the precision of the sequence can be
24990 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
24991 0.99999994) for reciprocal square roots.
24992
24993 -mrecip=opt
24994 This option controls which reciprocal estimate instructions may be
24995 used. opt is a comma-separated list of options, which may be
24996 preceded by a "!" to invert the option:
24997
24998 all Enable all estimate instructions.
24999
25000 default
25001 Enable the default instructions, equivalent to -mrecip.
25002
25003 none
25004 Disable all estimate instructions, equivalent to -mno-recip.
25005
25006 div Enable the reciprocal approximation instructions for both
25007 single and double precision.
25008
25009 divf
25010 Enable the single-precision reciprocal approximation
25011 instructions.
25012
25013 divd
25014 Enable the double-precision reciprocal approximation
25015 instructions.
25016
25017 rsqrt
25018 Enable the reciprocal square root approximation instructions
25019 for both single and double precision.
25020
25021 rsqrtf
25022 Enable the single-precision reciprocal square root
25023 approximation instructions.
25024
25025 rsqrtd
25026 Enable the double-precision reciprocal square root
25027 approximation instructions.
25028
25029 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
25030 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
25031 "XVRSQRTEDP" instructions which handle the double-precision
25032 reciprocal square root calculations.
25033
25034 -mrecip-precision
25035 -mno-recip-precision
25036 Assume (do not assume) that the reciprocal estimate instructions
25037 provide higher-precision estimates than is mandated by the PowerPC
25038 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
25039 automatically selects -mrecip-precision. The double-precision
25040 square root estimate instructions are not generated by default on
25041 low-precision machines, since they do not provide an estimate that
25042 converges after three steps.
25043
25044 -mveclibabi=type
25045 Specifies the ABI type to use for vectorizing intrinsics using an
25046 external library. The only type supported at present is mass,
25047 which specifies to use IBM's Mathematical Acceleration Subsystem
25048 (MASS) libraries for vectorizing intrinsics using external
25049 libraries. GCC currently emits calls to "acosd2", "acosf4",
25050 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
25051 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
25052 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
25053 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
25054 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
25055 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
25056 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
25057 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
25058 "tanhf4" when generating code for power7. Both -ftree-vectorize
25059 and -funsafe-math-optimizations must also be enabled. The MASS
25060 libraries must be specified at link time.
25061
25062 -mfriz
25063 -mno-friz
25064 Generate (do not generate) the "friz" instruction when the
25065 -funsafe-math-optimizations option is used to optimize rounding of
25066 floating-point values to 64-bit integer and back to floating point.
25067 The "friz" instruction does not return the same value if the
25068 floating-point number is too large to fit in an integer.
25069
25070 -mpointers-to-nested-functions
25071 -mno-pointers-to-nested-functions
25072 Generate (do not generate) code to load up the static chain
25073 register ("r11") when calling through a pointer on AIX and 64-bit
25074 Linux systems where a function pointer points to a 3-word
25075 descriptor giving the function address, TOC value to be loaded in
25076 register "r2", and static chain value to be loaded in register
25077 "r11". The -mpointers-to-nested-functions is on by default. You
25078 cannot call through pointers to nested functions or pointers to
25079 functions compiled in other languages that use the static chain if
25080 you use -mno-pointers-to-nested-functions.
25081
25082 -msave-toc-indirect
25083 -mno-save-toc-indirect
25084 Generate (do not generate) code to save the TOC value in the
25085 reserved stack location in the function prologue if the function
25086 calls through a pointer on AIX and 64-bit Linux systems. If the
25087 TOC value is not saved in the prologue, it is saved just before the
25088 call through the pointer. The -mno-save-toc-indirect option is the
25089 default.
25090
25091 -mcompat-align-parm
25092 -mno-compat-align-parm
25093 Generate (do not generate) code to pass structure parameters with a
25094 maximum alignment of 64 bits, for compatibility with older versions
25095 of GCC.
25096
25097 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25098 structure parameter on a 128-bit boundary when that structure
25099 contained a member requiring 128-bit alignment. This is corrected
25100 in more recent versions of GCC. This option may be used to
25101 generate code that is compatible with functions compiled with older
25102 versions of GCC.
25103
25104 The -mno-compat-align-parm option is the default.
25105
25106 -mstack-protector-guard=guard
25107 -mstack-protector-guard-reg=reg
25108 -mstack-protector-guard-offset=offset
25109 -mstack-protector-guard-symbol=symbol
25110 Generate stack protection code using canary at guard. Supported
25111 locations are global for global canary or tls for per-thread canary
25112 in the TLS block (the default with GNU libc version 2.4 or later).
25113
25114 With the latter choice the options -mstack-protector-guard-reg=reg
25115 and -mstack-protector-guard-offset=offset furthermore specify which
25116 register to use as base register for reading the canary, and from
25117 what offset from that base register. The default for those is as
25118 specified in the relevant ABI.
25119 -mstack-protector-guard-symbol=symbol overrides the offset with a
25120 symbol reference to a canary in the TLS block.
25121
25122 -mpcrel
25123 -mno-pcrel
25124 Generate (do not generate) pc-relative addressing. The -mpcrel
25125 option requires that the medium code model (-mcmodel=medium) and
25126 prefixed addressing (-mprefixed) options are enabled.
25127
25128 -mprefixed
25129 -mno-prefixed
25130 Generate (do not generate) addressing modes using prefixed load and
25131 store instructions. The -mprefixed option requires that the option
25132 -mcpu=power10 (or later) is enabled.
25133
25134 -mmma
25135 -mno-mma
25136 Generate (do not generate) the MMA instructions. The -mma option
25137 requires that the option -mcpu=power10 (or later) is enabled.
25138
25139 -mrop-protect
25140 -mno-rop-protect
25141 Generate (do not generate) ROP protection instructions when the
25142 target processor supports them. Currently this option disables the
25143 shrink-wrap optimization (-fshrink-wrap).
25144
25145 -mprivileged
25146 -mno-privileged
25147 Generate (do not generate) code that will run in privileged state.
25148
25149 -mblock-ops-unaligned-vsx
25150 -mno-block-ops-unaligned-vsx
25151 Generate (do not generate) unaligned vsx loads and stores for
25152 inline expansion of "memcpy" and "memmove".
25153
25154 RX Options
25155
25156 These command-line options are defined for RX targets:
25157
25158 -m64bit-doubles
25159 -m32bit-doubles
25160 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
25161 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
25162 RX floating-point hardware only works on 32-bit values, which is
25163 why the default is -m32bit-doubles.
25164
25165 -fpu
25166 -nofpu
25167 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
25168 hardware. The default is enabled for the RX600 series and disabled
25169 for the RX200 series.
25170
25171 Floating-point instructions are only generated for 32-bit floating-
25172 point values, however, so the FPU hardware is not used for doubles
25173 if the -m64bit-doubles option is used.
25174
25175 Note If the -fpu option is enabled then -funsafe-math-optimizations
25176 is also enabled automatically. This is because the RX FPU
25177 instructions are themselves unsafe.
25178
25179 -mcpu=name
25180 Selects the type of RX CPU to be targeted. Currently three types
25181 are supported, the generic RX600 and RX200 series hardware and the
25182 specific RX610 CPU. The default is RX600.
25183
25184 The only difference between RX600 and RX610 is that the RX610 does
25185 not support the "MVTIPL" instruction.
25186
25187 The RX200 series does not have a hardware floating-point unit and
25188 so -nofpu is enabled by default when this type is selected.
25189
25190 -mbig-endian-data
25191 -mlittle-endian-data
25192 Store data (but not code) in the big-endian format. The default is
25193 -mlittle-endian-data, i.e. to store data in the little-endian
25194 format.
25195
25196 -msmall-data-limit=N
25197 Specifies the maximum size in bytes of global and static variables
25198 which can be placed into the small data area. Using the small data
25199 area can lead to smaller and faster code, but the size of area is
25200 limited and it is up to the programmer to ensure that the area does
25201 not overflow. Also when the small data area is used one of the
25202 RX's registers (usually "r13") is reserved for use pointing to this
25203 area, so it is no longer available for use by the compiler. This
25204 could result in slower and/or larger code if variables are pushed
25205 onto the stack instead of being held in this register.
25206
25207 Note, common variables (variables that have not been initialized)
25208 and constants are not placed into the small data area as they are
25209 assigned to other sections in the output executable.
25210
25211 The default value is zero, which disables this feature. Note, this
25212 feature is not enabled by default with higher optimization levels
25213 (-O2 etc) because of the potentially detrimental effects of
25214 reserving a register. It is up to the programmer to experiment and
25215 discover whether this feature is of benefit to their program. See
25216 the description of the -mpid option for a description of how the
25217 actual register to hold the small data area pointer is chosen.
25218
25219 -msim
25220 -mno-sim
25221 Use the simulator runtime. The default is to use the libgloss
25222 board-specific runtime.
25223
25224 -mas100-syntax
25225 -mno-as100-syntax
25226 When generating assembler output use a syntax that is compatible
25227 with Renesas's AS100 assembler. This syntax can also be handled by
25228 the GAS assembler, but it has some restrictions so it is not
25229 generated by default.
25230
25231 -mmax-constant-size=N
25232 Specifies the maximum size, in bytes, of a constant that can be
25233 used as an operand in a RX instruction. Although the RX
25234 instruction set does allow constants of up to 4 bytes in length to
25235 be used in instructions, a longer value equates to a longer
25236 instruction. Thus in some circumstances it can be beneficial to
25237 restrict the size of constants that are used in instructions.
25238 Constants that are too big are instead placed into a constant pool
25239 and referenced via register indirection.
25240
25241 The value N can be between 0 and 4. A value of 0 (the default) or
25242 4 means that constants of any size are allowed.
25243
25244 -mrelax
25245 Enable linker relaxation. Linker relaxation is a process whereby
25246 the linker attempts to reduce the size of a program by finding
25247 shorter versions of various instructions. Disabled by default.
25248
25249 -mint-register=N
25250 Specify the number of registers to reserve for fast interrupt
25251 handler functions. The value N can be between 0 and 4. A value of
25252 1 means that register "r13" is reserved for the exclusive use of
25253 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
25254 value of 3 reserves "r13", "r12" and "r11", and a value of 4
25255 reserves "r13" through "r10". A value of 0, the default, does not
25256 reserve any registers.
25257
25258 -msave-acc-in-interrupts
25259 Specifies that interrupt handler functions should preserve the
25260 accumulator register. This is only necessary if normal code might
25261 use the accumulator register, for example because it performs
25262 64-bit multiplications. The default is to ignore the accumulator
25263 as this makes the interrupt handlers faster.
25264
25265 -mpid
25266 -mno-pid
25267 Enables the generation of position independent data. When enabled
25268 any access to constant data is done via an offset from a base
25269 address held in a register. This allows the location of constant
25270 data to be determined at run time without requiring the executable
25271 to be relocated, which is a benefit to embedded applications with
25272 tight memory constraints. Data that can be modified is not
25273 affected by this option.
25274
25275 Note, using this feature reserves a register, usually "r13", for
25276 the constant data base address. This can result in slower and/or
25277 larger code, especially in complicated functions.
25278
25279 The actual register chosen to hold the constant data base address
25280 depends upon whether the -msmall-data-limit and/or the
25281 -mint-register command-line options are enabled. Starting with
25282 register "r13" and proceeding downwards, registers are allocated
25283 first to satisfy the requirements of -mint-register, then -mpid and
25284 finally -msmall-data-limit. Thus it is possible for the small data
25285 area register to be "r8" if both -mint-register=4 and -mpid are
25286 specified on the command line.
25287
25288 By default this feature is not enabled. The default can be
25289 restored via the -mno-pid command-line option.
25290
25291 -mno-warn-multiple-fast-interrupts
25292 -mwarn-multiple-fast-interrupts
25293 Prevents GCC from issuing a warning message if it finds more than
25294 one fast interrupt handler when it is compiling a file. The
25295 default is to issue a warning for each extra fast interrupt handler
25296 found, as the RX only supports one such interrupt.
25297
25298 -mallow-string-insns
25299 -mno-allow-string-insns
25300 Enables or disables the use of the string manipulation instructions
25301 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
25302 "RMPA" instruction. These instructions may prefetch data, which is
25303 not safe to do if accessing an I/O register. (See section 12.2.7
25304 of the RX62N Group User's Manual for more information).
25305
25306 The default is to allow these instructions, but it is not possible
25307 for GCC to reliably detect all circumstances where a string
25308 instruction might be used to access an I/O register, so their use
25309 cannot be disabled automatically. Instead it is reliant upon the
25310 programmer to use the -mno-allow-string-insns option if their
25311 program accesses I/O space.
25312
25313 When the instructions are enabled GCC defines the C preprocessor
25314 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
25315 "__RX_DISALLOW_STRING_INSNS__".
25316
25317 -mjsr
25318 -mno-jsr
25319 Use only (or not only) "JSR" instructions to access functions.
25320 This option can be used when code size exceeds the range of "BSR"
25321 instructions. Note that -mno-jsr does not mean to not use "JSR"
25322 but instead means that any type of branch may be used.
25323
25324 Note: The generic GCC command-line option -ffixed-reg has special
25325 significance to the RX port when used with the "interrupt" function
25326 attribute. This attribute indicates a function intended to process
25327 fast interrupts. GCC ensures that it only uses the registers "r10",
25328 "r11", "r12" and/or "r13" and only provided that the normal use of the
25329 corresponding registers have been restricted via the -ffixed-reg or
25330 -mint-register command-line options.
25331
25332 S/390 and zSeries Options
25333
25334 These are the -m options defined for the S/390 and zSeries
25335 architecture.
25336
25337 -mhard-float
25338 -msoft-float
25339 Use (do not use) the hardware floating-point instructions and
25340 registers for floating-point operations. When -msoft-float is
25341 specified, functions in libgcc.a are used to perform floating-point
25342 operations. When -mhard-float is specified, the compiler generates
25343 IEEE floating-point instructions. This is the default.
25344
25345 -mhard-dfp
25346 -mno-hard-dfp
25347 Use (do not use) the hardware decimal-floating-point instructions
25348 for decimal-floating-point operations. When -mno-hard-dfp is
25349 specified, functions in libgcc.a are used to perform decimal-
25350 floating-point operations. When -mhard-dfp is specified, the
25351 compiler generates decimal-floating-point hardware instructions.
25352 This is the default for -march=z9-ec or higher.
25353
25354 -mlong-double-64
25355 -mlong-double-128
25356 These switches control the size of "long double" type. A size of 64
25357 bits makes the "long double" type equivalent to the "double" type.
25358 This is the default.
25359
25360 -mbackchain
25361 -mno-backchain
25362 Store (do not store) the address of the caller's frame as backchain
25363 pointer into the callee's stack frame. A backchain may be needed
25364 to allow debugging using tools that do not understand DWARF call
25365 frame information. When -mno-packed-stack is in effect, the
25366 backchain pointer is stored at the bottom of the stack frame; when
25367 -mpacked-stack is in effect, the backchain is placed into the
25368 topmost word of the 96/160 byte register save area.
25369
25370 In general, code compiled with -mbackchain is call-compatible with
25371 code compiled with -mno-backchain; however, use of the backchain
25372 for debugging purposes usually requires that the whole binary is
25373 built with -mbackchain. Note that the combination of -mbackchain,
25374 -mpacked-stack and -mhard-float is not supported. In order to
25375 build a linux kernel use -msoft-float.
25376
25377 The default is to not maintain the backchain.
25378
25379 -mpacked-stack
25380 -mno-packed-stack
25381 Use (do not use) the packed stack layout. When -mno-packed-stack
25382 is specified, the compiler uses the all fields of the 96/160 byte
25383 register save area only for their default purpose; unused fields
25384 still take up stack space. When -mpacked-stack is specified,
25385 register save slots are densely packed at the top of the register
25386 save area; unused space is reused for other purposes, allowing for
25387 more efficient use of the available stack space. However, when
25388 -mbackchain is also in effect, the topmost word of the save area is
25389 always used to store the backchain, and the return address register
25390 is always saved two words below the backchain.
25391
25392 As long as the stack frame backchain is not used, code generated
25393 with -mpacked-stack is call-compatible with code generated with
25394 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
25395 S/390 or zSeries generated code that uses the stack frame backchain
25396 at run time, not just for debugging purposes. Such code is not
25397 call-compatible with code compiled with -mpacked-stack. Also, note
25398 that the combination of -mbackchain, -mpacked-stack and
25399 -mhard-float is not supported. In order to build a linux kernel
25400 use -msoft-float.
25401
25402 The default is to not use the packed stack layout.
25403
25404 -msmall-exec
25405 -mno-small-exec
25406 Generate (or do not generate) code using the "bras" instruction to
25407 do subroutine calls. This only works reliably if the total
25408 executable size does not exceed 64k. The default is to use the
25409 "basr" instruction instead, which does not have this limitation.
25410
25411 -m64
25412 -m31
25413 When -m31 is specified, generate code compliant to the GNU/Linux
25414 for S/390 ABI. When -m64 is specified, generate code compliant to
25415 the GNU/Linux for zSeries ABI. This allows GCC in particular to
25416 generate 64-bit instructions. For the s390 targets, the default is
25417 -m31, while the s390x targets default to -m64.
25418
25419 -mzarch
25420 -mesa
25421 When -mzarch is specified, generate code using the instructions
25422 available on z/Architecture. When -mesa is specified, generate
25423 code using the instructions available on ESA/390. Note that -mesa
25424 is not possible with -m64. When generating code compliant to the
25425 GNU/Linux for S/390 ABI, the default is -mesa. When generating
25426 code compliant to the GNU/Linux for zSeries ABI, the default is
25427 -mzarch.
25428
25429 -mhtm
25430 -mno-htm
25431 The -mhtm option enables a set of builtins making use of
25432 instructions available with the transactional execution facility
25433 introduced with the IBM zEnterprise EC12 machine generation S/390
25434 System z Built-in Functions. -mhtm is enabled by default when
25435 using -march=zEC12.
25436
25437 -mvx
25438 -mno-vx
25439 When -mvx is specified, generate code using the instructions
25440 available with the vector extension facility introduced with the
25441 IBM z13 machine generation. This option changes the ABI for some
25442 vector type values with regard to alignment and calling
25443 conventions. In case vector type values are being used in an ABI-
25444 relevant context a GAS .gnu_attribute command will be added to mark
25445 the resulting binary with the ABI used. -mvx is enabled by default
25446 when using -march=z13.
25447
25448 -mzvector
25449 -mno-zvector
25450 The -mzvector option enables vector language extensions and
25451 builtins using instructions available with the vector extension
25452 facility introduced with the IBM z13 machine generation. This
25453 option adds support for vector to be used as a keyword to define
25454 vector type variables and arguments. vector is only available when
25455 GNU extensions are enabled. It will not be expanded when
25456 requesting strict standard compliance e.g. with -std=c99. In
25457 addition to the GCC low-level builtins -mzvector enables a set of
25458 builtins added for compatibility with AltiVec-style implementations
25459 like Power and Cell. In order to make use of these builtins the
25460 header file vecintrin.h needs to be included. -mzvector is
25461 disabled by default.
25462
25463 -mmvcle
25464 -mno-mvcle
25465 Generate (or do not generate) code using the "mvcle" instruction to
25466 perform block moves. When -mno-mvcle is specified, use a "mvc"
25467 loop instead. This is the default unless optimizing for size.
25468
25469 -mdebug
25470 -mno-debug
25471 Print (or do not print) additional debug information when
25472 compiling. The default is to not print debug information.
25473
25474 -march=cpu-type
25475 Generate code that runs on cpu-type, which is the name of a system
25476 representing a certain processor type. Possible values for cpu-
25477 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
25478 z196/arch9, zEC12, z13/arch11, z14/arch12, z15/arch13, z16/arch14,
25479 and native.
25480
25481 The default is -march=z900.
25482
25483 Specifying native as cpu type can be used to select the best
25484 architecture option for the host processor. -march=native has no
25485 effect if GCC does not recognize the processor.
25486
25487 -mtune=cpu-type
25488 Tune to cpu-type everything applicable about the generated code,
25489 except for the ABI and the set of available instructions. The list
25490 of cpu-type values is the same as for -march. The default is the
25491 value used for -march.
25492
25493 -mtpf-trace
25494 -mno-tpf-trace
25495 Generate code that adds (does not add) in TPF OS specific branches
25496 to trace routines in the operating system. This option is off by
25497 default, even when compiling for the TPF OS.
25498
25499 -mtpf-trace-skip
25500 -mno-tpf-trace-skip
25501 Generate code that changes (does not change) the default branch
25502 targets enabled by -mtpf-trace to point to specialized trace
25503 routines providing the ability of selectively skipping function
25504 trace entries for the TPF OS. This option is off by default, even
25505 when compiling for the TPF OS and specifying -mtpf-trace.
25506
25507 -mfused-madd
25508 -mno-fused-madd
25509 Generate code that uses (does not use) the floating-point multiply
25510 and accumulate instructions. These instructions are generated by
25511 default if hardware floating point is used.
25512
25513 -mwarn-framesize=framesize
25514 Emit a warning if the current function exceeds the given frame
25515 size. Because this is a compile-time check it doesn't need to be a
25516 real problem when the program runs. It is intended to identify
25517 functions that most probably cause a stack overflow. It is useful
25518 to be used in an environment with limited stack size e.g. the linux
25519 kernel.
25520
25521 -mwarn-dynamicstack
25522 Emit a warning if the function calls "alloca" or uses dynamically-
25523 sized arrays. This is generally a bad idea with a limited stack
25524 size.
25525
25526 -mstack-guard=stack-guard
25527 -mstack-size=stack-size
25528 If these options are provided the S/390 back end emits additional
25529 instructions in the function prologue that trigger a trap if the
25530 stack size is stack-guard bytes above the stack-size (remember that
25531 the stack on S/390 grows downward). If the stack-guard option is
25532 omitted the smallest power of 2 larger than the frame size of the
25533 compiled function is chosen. These options are intended to be used
25534 to help debugging stack overflow problems. The additionally
25535 emitted code causes only little overhead and hence can also be used
25536 in production-like systems without greater performance degradation.
25537 The given values have to be exact powers of 2 and stack-size has to
25538 be greater than stack-guard without exceeding 64k. In order to be
25539 efficient the extra code makes the assumption that the stack starts
25540 at an address aligned to the value given by stack-size. The stack-
25541 guard option can only be used in conjunction with stack-size.
25542
25543 -mhotpatch=pre-halfwords,post-halfwords
25544 If the hotpatch option is enabled, a "hot-patching" function
25545 prologue is generated for all functions in the compilation unit.
25546 The funtion label is prepended with the given number of two-byte
25547 NOP instructions (pre-halfwords, maximum 1000000). After the
25548 label, 2 * post-halfwords bytes are appended, using the largest NOP
25549 like instructions the architecture allows (maximum 1000000).
25550
25551 If both arguments are zero, hotpatching is disabled.
25552
25553 This option can be overridden for individual functions with the
25554 "hotpatch" attribute.
25555
25556 Score Options
25557
25558 These options are defined for Score implementations:
25559
25560 -meb
25561 Compile code for big-endian mode. This is the default.
25562
25563 -mel
25564 Compile code for little-endian mode.
25565
25566 -mnhwloop
25567 Disable generation of "bcnz" instructions.
25568
25569 -muls
25570 Enable generation of unaligned load and store instructions.
25571
25572 -mmac
25573 Enable the use of multiply-accumulate instructions. Disabled by
25574 default.
25575
25576 -mscore5
25577 Specify the SCORE5 as the target architecture.
25578
25579 -mscore5u
25580 Specify the SCORE5U of the target architecture.
25581
25582 -mscore7
25583 Specify the SCORE7 as the target architecture. This is the default.
25584
25585 -mscore7d
25586 Specify the SCORE7D as the target architecture.
25587
25588 SH Options
25589
25590 These -m options are defined for the SH implementations:
25591
25592 -m1 Generate code for the SH1.
25593
25594 -m2 Generate code for the SH2.
25595
25596 -m2e
25597 Generate code for the SH2e.
25598
25599 -m2a-nofpu
25600 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
25601 way that the floating-point unit is not used.
25602
25603 -m2a-single-only
25604 Generate code for the SH2a-FPU, in such a way that no double-
25605 precision floating-point operations are used.
25606
25607 -m2a-single
25608 Generate code for the SH2a-FPU assuming the floating-point unit is
25609 in single-precision mode by default.
25610
25611 -m2a
25612 Generate code for the SH2a-FPU assuming the floating-point unit is
25613 in double-precision mode by default.
25614
25615 -m3 Generate code for the SH3.
25616
25617 -m3e
25618 Generate code for the SH3e.
25619
25620 -m4-nofpu
25621 Generate code for the SH4 without a floating-point unit.
25622
25623 -m4-single-only
25624 Generate code for the SH4 with a floating-point unit that only
25625 supports single-precision arithmetic.
25626
25627 -m4-single
25628 Generate code for the SH4 assuming the floating-point unit is in
25629 single-precision mode by default.
25630
25631 -m4 Generate code for the SH4.
25632
25633 -m4-100
25634 Generate code for SH4-100.
25635
25636 -m4-100-nofpu
25637 Generate code for SH4-100 in such a way that the floating-point
25638 unit is not used.
25639
25640 -m4-100-single
25641 Generate code for SH4-100 assuming the floating-point unit is in
25642 single-precision mode by default.
25643
25644 -m4-100-single-only
25645 Generate code for SH4-100 in such a way that no double-precision
25646 floating-point operations are used.
25647
25648 -m4-200
25649 Generate code for SH4-200.
25650
25651 -m4-200-nofpu
25652 Generate code for SH4-200 without in such a way that the floating-
25653 point unit is not used.
25654
25655 -m4-200-single
25656 Generate code for SH4-200 assuming the floating-point unit is in
25657 single-precision mode by default.
25658
25659 -m4-200-single-only
25660 Generate code for SH4-200 in such a way that no double-precision
25661 floating-point operations are used.
25662
25663 -m4-300
25664 Generate code for SH4-300.
25665
25666 -m4-300-nofpu
25667 Generate code for SH4-300 without in such a way that the floating-
25668 point unit is not used.
25669
25670 -m4-300-single
25671 Generate code for SH4-300 in such a way that no double-precision
25672 floating-point operations are used.
25673
25674 -m4-300-single-only
25675 Generate code for SH4-300 in such a way that no double-precision
25676 floating-point operations are used.
25677
25678 -m4-340
25679 Generate code for SH4-340 (no MMU, no FPU).
25680
25681 -m4-500
25682 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
25683 assembler.
25684
25685 -m4a-nofpu
25686 Generate code for the SH4al-dsp, or for a SH4a in such a way that
25687 the floating-point unit is not used.
25688
25689 -m4a-single-only
25690 Generate code for the SH4a, in such a way that no double-precision
25691 floating-point operations are used.
25692
25693 -m4a-single
25694 Generate code for the SH4a assuming the floating-point unit is in
25695 single-precision mode by default.
25696
25697 -m4a
25698 Generate code for the SH4a.
25699
25700 -m4al
25701 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
25702 assembler. GCC doesn't generate any DSP instructions at the
25703 moment.
25704
25705 -mb Compile code for the processor in big-endian mode.
25706
25707 -ml Compile code for the processor in little-endian mode.
25708
25709 -mdalign
25710 Align doubles at 64-bit boundaries. Note that this changes the
25711 calling conventions, and thus some functions from the standard C
25712 library do not work unless you recompile it first with -mdalign.
25713
25714 -mrelax
25715 Shorten some address references at link time, when possible; uses
25716 the linker option -relax.
25717
25718 -mbigtable
25719 Use 32-bit offsets in "switch" tables. The default is to use
25720 16-bit offsets.
25721
25722 -mbitops
25723 Enable the use of bit manipulation instructions on SH2A.
25724
25725 -mfmovd
25726 Enable the use of the instruction "fmovd". Check -mdalign for
25727 alignment constraints.
25728
25729 -mrenesas
25730 Comply with the calling conventions defined by Renesas.
25731
25732 -mno-renesas
25733 Comply with the calling conventions defined for GCC before the
25734 Renesas conventions were available. This option is the default for
25735 all targets of the SH toolchain.
25736
25737 -mnomacsave
25738 Mark the "MAC" register as call-clobbered, even if -mrenesas is
25739 given.
25740
25741 -mieee
25742 -mno-ieee
25743 Control the IEEE compliance of floating-point comparisons, which
25744 affects the handling of cases where the result of a comparison is
25745 unordered. By default -mieee is implicitly enabled. If
25746 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
25747 results in faster floating-point greater-equal and less-equal
25748 comparisons. The implicit settings can be overridden by specifying
25749 either -mieee or -mno-ieee.
25750
25751 -minline-ic_invalidate
25752 Inline code to invalidate instruction cache entries after setting
25753 up nested function trampolines. This option has no effect if
25754 -musermode is in effect and the selected code generation option
25755 (e.g. -m4) does not allow the use of the "icbi" instruction. If
25756 the selected code generation option does not allow the use of the
25757 "icbi" instruction, and -musermode is not in effect, the inlined
25758 code manipulates the instruction cache address array directly with
25759 an associative write. This not only requires privileged mode at
25760 run time, but it also fails if the cache line had been mapped via
25761 the TLB and has become unmapped.
25762
25763 -misize
25764 Dump instruction size and location in the assembly code.
25765
25766 -mpadstruct
25767 This option is deprecated. It pads structures to multiple of 4
25768 bytes, which is incompatible with the SH ABI.
25769
25770 -matomic-model=model
25771 Sets the model of atomic operations and additional parameters as a
25772 comma separated list. For details on the atomic built-in functions
25773 see __atomic Builtins. The following models and parameters are
25774 supported:
25775
25776 none
25777 Disable compiler generated atomic sequences and emit library
25778 calls for atomic operations. This is the default if the target
25779 is not "sh*-*-linux*".
25780
25781 soft-gusa
25782 Generate GNU/Linux compatible gUSA software atomic sequences
25783 for the atomic built-in functions. The generated atomic
25784 sequences require additional support from the
25785 interrupt/exception handling code of the system and are only
25786 suitable for SH3* and SH4* single-core systems. This option is
25787 enabled by default when the target is "sh*-*-linux*" and SH3*
25788 or SH4*. When the target is SH4A, this option also partially
25789 utilizes the hardware atomic instructions "movli.l" and
25790 "movco.l" to create more efficient code, unless strict is
25791 specified.
25792
25793 soft-tcb
25794 Generate software atomic sequences that use a variable in the
25795 thread control block. This is a variation of the gUSA
25796 sequences which can also be used on SH1* and SH2* targets. The
25797 generated atomic sequences require additional support from the
25798 interrupt/exception handling code of the system and are only
25799 suitable for single-core systems. When using this model, the
25800 gbr-offset= parameter has to be specified as well.
25801
25802 soft-imask
25803 Generate software atomic sequences that temporarily disable
25804 interrupts by setting "SR.IMASK = 1111". This model works only
25805 when the program runs in privileged mode and is only suitable
25806 for single-core systems. Additional support from the
25807 interrupt/exception handling code of the system is not
25808 required. This model is enabled by default when the target is
25809 "sh*-*-linux*" and SH1* or SH2*.
25810
25811 hard-llcs
25812 Generate hardware atomic sequences using the "movli.l" and
25813 "movco.l" instructions only. This is only available on SH4A
25814 and is suitable for multi-core systems. Since the hardware
25815 instructions support only 32 bit atomic variables access to 8
25816 or 16 bit variables is emulated with 32 bit accesses. Code
25817 compiled with this option is also compatible with other
25818 software atomic model interrupt/exception handling systems if
25819 executed on an SH4A system. Additional support from the
25820 interrupt/exception handling code of the system is not required
25821 for this model.
25822
25823 gbr-offset=
25824 This parameter specifies the offset in bytes of the variable in
25825 the thread control block structure that should be used by the
25826 generated atomic sequences when the soft-tcb model has been
25827 selected. For other models this parameter is ignored. The
25828 specified value must be an integer multiple of four and in the
25829 range 0-1020.
25830
25831 strict
25832 This parameter prevents mixed usage of multiple atomic models,
25833 even if they are compatible, and makes the compiler generate
25834 atomic sequences of the specified model only.
25835
25836 -mtas
25837 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
25838 that depending on the particular hardware and software
25839 configuration this can degrade overall performance due to the
25840 operand cache line flushes that are implied by the "tas.b"
25841 instruction. On multi-core SH4A processors the "tas.b" instruction
25842 must be used with caution since it can result in data corruption
25843 for certain cache configurations.
25844
25845 -mprefergot
25846 When generating position-independent code, emit function calls
25847 using the Global Offset Table instead of the Procedure Linkage
25848 Table.
25849
25850 -musermode
25851 -mno-usermode
25852 Don't allow (allow) the compiler generating privileged mode code.
25853 Specifying -musermode also implies -mno-inline-ic_invalidate if the
25854 inlined code would not work in user mode. -musermode is the
25855 default when the target is "sh*-*-linux*". If the target is SH1*
25856 or SH2* -musermode has no effect, since there is no user mode.
25857
25858 -multcost=number
25859 Set the cost to assume for a multiply insn.
25860
25861 -mdiv=strategy
25862 Set the division strategy to be used for integer division
25863 operations. strategy can be one of:
25864
25865 call-div1
25866 Calls a library function that uses the single-step division
25867 instruction "div1" to perform the operation. Division by zero
25868 calculates an unspecified result and does not trap. This is
25869 the default except for SH4, SH2A and SHcompact.
25870
25871 call-fp
25872 Calls a library function that performs the operation in double
25873 precision floating point. Division by zero causes a floating-
25874 point exception. This is the default for SHcompact with FPU.
25875 Specifying this for targets that do not have a double precision
25876 FPU defaults to "call-div1".
25877
25878 call-table
25879 Calls a library function that uses a lookup table for small
25880 divisors and the "div1" instruction with case distinction for
25881 larger divisors. Division by zero calculates an unspecified
25882 result and does not trap. This is the default for SH4.
25883 Specifying this for targets that do not have dynamic shift
25884 instructions defaults to "call-div1".
25885
25886 When a division strategy has not been specified the default
25887 strategy is selected based on the current target. For SH2A the
25888 default strategy is to use the "divs" and "divu" instructions
25889 instead of library function calls.
25890
25891 -maccumulate-outgoing-args
25892 Reserve space once for outgoing arguments in the function prologue
25893 rather than around each call. Generally beneficial for performance
25894 and size. Also needed for unwinding to avoid changing the stack
25895 frame around conditional code.
25896
25897 -mdivsi3_libfunc=name
25898 Set the name of the library function used for 32-bit signed
25899 division to name. This only affects the name used in the call
25900 division strategies, and the compiler still expects the same sets
25901 of input/output/clobbered registers as if this option were not
25902 present.
25903
25904 -mfixed-range=register-range
25905 Generate code treating the given register range as fixed registers.
25906 A fixed register is one that the register allocator cannot use.
25907 This is useful when compiling kernel code. A register range is
25908 specified as two registers separated by a dash. Multiple register
25909 ranges can be specified separated by a comma.
25910
25911 -mbranch-cost=num
25912 Assume num to be the cost for a branch instruction. Higher numbers
25913 make the compiler try to generate more branch-free code if
25914 possible. If not specified the value is selected depending on the
25915 processor type that is being compiled for.
25916
25917 -mzdcbranch
25918 -mno-zdcbranch
25919 Assume (do not assume) that zero displacement conditional branch
25920 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
25921 the compiler prefers zero displacement branch code sequences. This
25922 is enabled by default when generating code for SH4 and SH4A. It
25923 can be explicitly disabled by specifying -mno-zdcbranch.
25924
25925 -mcbranch-force-delay-slot
25926 Force the usage of delay slots for conditional branches, which
25927 stuffs the delay slot with a "nop" if a suitable instruction cannot
25928 be found. By default this option is disabled. It can be enabled
25929 to work around hardware bugs as found in the original SH7055.
25930
25931 -mfused-madd
25932 -mno-fused-madd
25933 Generate code that uses (does not use) the floating-point multiply
25934 and accumulate instructions. These instructions are generated by
25935 default if hardware floating point is used. The machine-dependent
25936 -mfused-madd option is now mapped to the machine-independent
25937 -ffp-contract=fast option, and -mno-fused-madd is mapped to
25938 -ffp-contract=off.
25939
25940 -mfsca
25941 -mno-fsca
25942 Allow or disallow the compiler to emit the "fsca" instruction for
25943 sine and cosine approximations. The option -mfsca must be used in
25944 combination with -funsafe-math-optimizations. It is enabled by
25945 default when generating code for SH4A. Using -mno-fsca disables
25946 sine and cosine approximations even if -funsafe-math-optimizations
25947 is in effect.
25948
25949 -mfsrra
25950 -mno-fsrra
25951 Allow or disallow the compiler to emit the "fsrra" instruction for
25952 reciprocal square root approximations. The option -mfsrra must be
25953 used in combination with -funsafe-math-optimizations and
25954 -ffinite-math-only. It is enabled by default when generating code
25955 for SH4A. Using -mno-fsrra disables reciprocal square root
25956 approximations even if -funsafe-math-optimizations and
25957 -ffinite-math-only are in effect.
25958
25959 -mpretend-cmove
25960 Prefer zero-displacement conditional branches for conditional move
25961 instruction patterns. This can result in faster code on the SH4
25962 processor.
25963
25964 -mfdpic
25965 Generate code using the FDPIC ABI.
25966
25967 Solaris 2 Options
25968
25969 These -m options are supported on Solaris 2:
25970
25971 -mclear-hwcap
25972 -mclear-hwcap tells the compiler to remove the hardware
25973 capabilities generated by the Solaris assembler. This is only
25974 necessary when object files use ISA extensions not supported by the
25975 current machine, but check at runtime whether or not to use them.
25976
25977 -mimpure-text
25978 -mimpure-text, used in addition to -shared, tells the compiler to
25979 not pass -z text to the linker when linking a shared object. Using
25980 this option, you can link position-dependent code into a shared
25981 object.
25982
25983 -mimpure-text suppresses the "relocations remain against
25984 allocatable but non-writable sections" linker error message.
25985 However, the necessary relocations trigger copy-on-write, and the
25986 shared object is not actually shared across processes. Instead of
25987 using -mimpure-text, you should compile all source code with -fpic
25988 or -fPIC.
25989
25990 These switches are supported in addition to the above on Solaris 2:
25991
25992 -pthreads
25993 This is a synonym for -pthread.
25994
25995 SPARC Options
25996
25997 These -m options are supported on the SPARC:
25998
25999 -mno-app-regs
26000 -mapp-regs
26001 Specify -mapp-regs to generate output using the global registers 2
26002 through 4, which the SPARC SVR4 ABI reserves for applications.
26003 Like the global register 1, each global register 2 through 4 is
26004 then treated as an allocable register that is clobbered by function
26005 calls. This is the default.
26006
26007 To be fully SVR4 ABI-compliant at the cost of some performance
26008 loss, specify -mno-app-regs. You should compile libraries and
26009 system software with this option.
26010
26011 -mflat
26012 -mno-flat
26013 With -mflat, the compiler does not generate save/restore
26014 instructions and uses a "flat" or single register window model.
26015 This model is compatible with the regular register window model.
26016 The local registers and the input registers (0--5) are still
26017 treated as "call-saved" registers and are saved on the stack as
26018 needed.
26019
26020 With -mno-flat (the default), the compiler generates save/restore
26021 instructions (except for leaf functions). This is the normal
26022 operating mode.
26023
26024 -mfpu
26025 -mhard-float
26026 Generate output containing floating-point instructions. This is
26027 the default.
26028
26029 -mno-fpu
26030 -msoft-float
26031 Generate output containing library calls for floating point.
26032 Warning: the requisite libraries are not available for all SPARC
26033 targets. Normally the facilities of the machine's usual C compiler
26034 are used, but this cannot be done directly in cross-compilation.
26035 You must make your own arrangements to provide suitable library
26036 functions for cross-compilation. The embedded targets sparc-*-aout
26037 and sparclite-*-* do provide software floating-point support.
26038
26039 -msoft-float changes the calling convention in the output file;
26040 therefore, it is only useful if you compile all of a program with
26041 this option. In particular, you need to compile libgcc.a, the
26042 library that comes with GCC, with -msoft-float in order for this to
26043 work.
26044
26045 -mhard-quad-float
26046 Generate output containing quad-word (long double) floating-point
26047 instructions.
26048
26049 -msoft-quad-float
26050 Generate output containing library calls for quad-word (long
26051 double) floating-point instructions. The functions called are
26052 those specified in the SPARC ABI. This is the default.
26053
26054 As of this writing, there are no SPARC implementations that have
26055 hardware support for the quad-word floating-point instructions.
26056 They all invoke a trap handler for one of these instructions, and
26057 then the trap handler emulates the effect of the instruction.
26058 Because of the trap handler overhead, this is much slower than
26059 calling the ABI library routines. Thus the -msoft-quad-float
26060 option is the default.
26061
26062 -mno-unaligned-doubles
26063 -munaligned-doubles
26064 Assume that doubles have 8-byte alignment. This is the default.
26065
26066 With -munaligned-doubles, GCC assumes that doubles have 8-byte
26067 alignment only if they are contained in another type, or if they
26068 have an absolute address. Otherwise, it assumes they have 4-byte
26069 alignment. Specifying this option avoids some rare compatibility
26070 problems with code generated by other compilers. It is not the
26071 default because it results in a performance loss, especially for
26072 floating-point code.
26073
26074 -muser-mode
26075 -mno-user-mode
26076 Do not generate code that can only run in supervisor mode. This is
26077 relevant only for the "casa" instruction emitted for the LEON3
26078 processor. This is the default.
26079
26080 -mfaster-structs
26081 -mno-faster-structs
26082 With -mfaster-structs, the compiler assumes that structures should
26083 have 8-byte alignment. This enables the use of pairs of "ldd" and
26084 "std" instructions for copies in structure assignment, in place of
26085 twice as many "ld" and "st" pairs. However, the use of this
26086 changed alignment directly violates the SPARC ABI. Thus, it's
26087 intended only for use on targets where the developer acknowledges
26088 that their resulting code is not directly in line with the rules of
26089 the ABI.
26090
26091 -mstd-struct-return
26092 -mno-std-struct-return
26093 With -mstd-struct-return, the compiler generates checking code in
26094 functions returning structures or unions to detect size mismatches
26095 between the two sides of function calls, as per the 32-bit ABI.
26096
26097 The default is -mno-std-struct-return. This option has no effect
26098 in 64-bit mode.
26099
26100 -mlra
26101 -mno-lra
26102 Enable Local Register Allocation. This is the default for SPARC
26103 since GCC 7 so -mno-lra needs to be passed to get old Reload.
26104
26105 -mcpu=cpu_type
26106 Set the instruction set, register set, and instruction scheduling
26107 parameters for machine type cpu_type. Supported values for
26108 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
26109 leon3v7, leon5, sparclite, f930, f934, sparclite86x, sparclet,
26110 tsc701, v9, ultrasparc, ultrasparc3, niagara, niagara2, niagara3,
26111 niagara4, niagara7 and m8.
26112
26113 Native Solaris and GNU/Linux toolchains also support the value
26114 native, which selects the best architecture option for the host
26115 processor. -mcpu=native has no effect if GCC does not recognize
26116 the processor.
26117
26118 Default instruction scheduling parameters are used for values that
26119 select an architecture and not an implementation. These are v7,
26120 v8, sparclite, sparclet, v9.
26121
26122 Here is a list of each supported architecture and their supported
26123 implementations.
26124
26125 v7 cypress, leon3v7
26126
26127 v8 supersparc, hypersparc, leon, leon3, leon5
26128
26129 sparclite
26130 f930, f934, sparclite86x
26131
26132 sparclet
26133 tsc701
26134
26135 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26136 niagara7, m8
26137
26138 By default (unless configured otherwise), GCC generates code for
26139 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
26140 compiler additionally optimizes it for the Cypress CY7C602 chip, as
26141 used in the SPARCStation/SPARCServer 3xx series. This is also
26142 appropriate for the older SPARCStation 1, 2, IPX etc.
26143
26144 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
26145 architecture. The only difference from V7 code is that the
26146 compiler emits the integer multiply and integer divide instructions
26147 which exist in SPARC-V8 but not in SPARC-V7. With
26148 -mcpu=supersparc, the compiler additionally optimizes it for the
26149 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
26150 series.
26151
26152 With -mcpu=sparclite, GCC generates code for the SPARClite variant
26153 of the SPARC architecture. This adds the integer multiply, integer
26154 divide step and scan ("ffs") instructions which exist in SPARClite
26155 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
26156 optimizes it for the Fujitsu MB86930 chip, which is the original
26157 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
26158 optimizes it for the Fujitsu MB86934 chip, which is the more recent
26159 SPARClite with FPU.
26160
26161 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
26162 the SPARC architecture. This adds the integer multiply,
26163 multiply/accumulate, integer divide step and scan ("ffs")
26164 instructions which exist in SPARClet but not in SPARC-V7. With
26165 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
26166 SPARClet chip.
26167
26168 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
26169 architecture. This adds 64-bit integer and floating-point move
26170 instructions, 3 additional floating-point condition code registers
26171 and conditional move instructions. With -mcpu=ultrasparc, the
26172 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
26173 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
26174 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26175 -mcpu=niagara, the compiler additionally optimizes it for Sun
26176 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
26177 additionally optimizes it for Sun UltraSPARC T2 chips. With
26178 -mcpu=niagara3, the compiler additionally optimizes it for Sun
26179 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
26180 additionally optimizes it for Sun UltraSPARC T4 chips. With
26181 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
26182 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
26183 it for Oracle M8 chips.
26184
26185 -mtune=cpu_type
26186 Set the instruction scheduling parameters for machine type
26187 cpu_type, but do not set the instruction set or register set that
26188 the option -mcpu=cpu_type does.
26189
26190 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
26191 but the only useful values are those that select a particular CPU
26192 implementation. Those are cypress, supersparc, hypersparc, leon,
26193 leon3, leon3v7, leon5, f930, f934, sparclite86x, tsc701,
26194 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26195 niagara7 and m8. With native Solaris and GNU/Linux toolchains,
26196 native can also be used.
26197
26198 -mv8plus
26199 -mno-v8plus
26200 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
26201 difference from the V8 ABI is that the global and out registers are
26202 considered 64 bits wide. This is enabled by default on Solaris in
26203 32-bit mode for all SPARC-V9 processors.
26204
26205 -mvis
26206 -mno-vis
26207 With -mvis, GCC generates code that takes advantage of the
26208 UltraSPARC Visual Instruction Set extensions. The default is
26209 -mno-vis.
26210
26211 -mvis2
26212 -mno-vis2
26213 With -mvis2, GCC generates code that takes advantage of version 2.0
26214 of the UltraSPARC Visual Instruction Set extensions. The default
26215 is -mvis2 when targeting a cpu that supports such instructions,
26216 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
26217
26218 -mvis3
26219 -mno-vis3
26220 With -mvis3, GCC generates code that takes advantage of version 3.0
26221 of the UltraSPARC Visual Instruction Set extensions. The default
26222 is -mvis3 when targeting a cpu that supports such instructions,
26223 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
26224 -mvis.
26225
26226 -mvis4
26227 -mno-vis4
26228 With -mvis4, GCC generates code that takes advantage of version 4.0
26229 of the UltraSPARC Visual Instruction Set extensions. The default
26230 is -mvis4 when targeting a cpu that supports such instructions,
26231 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
26232 -mvis2 and -mvis.
26233
26234 -mvis4b
26235 -mno-vis4b
26236 With -mvis4b, GCC generates code that takes advantage of version
26237 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
26238 additional VIS instructions introduced in the Oracle SPARC
26239 Architecture 2017. The default is -mvis4b when targeting a cpu
26240 that supports such instructions, such as m8 and later. Setting
26241 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
26242
26243 -mcbcond
26244 -mno-cbcond
26245 With -mcbcond, GCC generates code that takes advantage of the
26246 UltraSPARC Compare-and-Branch-on-Condition instructions. The
26247 default is -mcbcond when targeting a CPU that supports such
26248 instructions, such as Niagara-4 and later.
26249
26250 -mfmaf
26251 -mno-fmaf
26252 With -mfmaf, GCC generates code that takes advantage of the
26253 UltraSPARC Fused Multiply-Add Floating-point instructions. The
26254 default is -mfmaf when targeting a CPU that supports such
26255 instructions, such as Niagara-3 and later.
26256
26257 -mfsmuld
26258 -mno-fsmuld
26259 With -mfsmuld, GCC generates code that takes advantage of the
26260 Floating-point Multiply Single to Double (FsMULd) instruction. The
26261 default is -mfsmuld when targeting a CPU supporting the
26262 architecture versions V8 or V9 with FPU except -mcpu=leon.
26263
26264 -mpopc
26265 -mno-popc
26266 With -mpopc, GCC generates code that takes advantage of the
26267 UltraSPARC Population Count instruction. The default is -mpopc
26268 when targeting a CPU that supports such an instruction, such as
26269 Niagara-2 and later.
26270
26271 -msubxc
26272 -mno-subxc
26273 With -msubxc, GCC generates code that takes advantage of the
26274 UltraSPARC Subtract-Extended-with-Carry instruction. The default
26275 is -msubxc when targeting a CPU that supports such an instruction,
26276 such as Niagara-7 and later.
26277
26278 -mfix-at697f
26279 Enable the documented workaround for the single erratum of the
26280 Atmel AT697F processor (which corresponds to erratum #13 of the
26281 AT697E processor).
26282
26283 -mfix-ut699
26284 Enable the documented workarounds for the floating-point errata and
26285 the data cache nullify errata of the UT699 processor.
26286
26287 -mfix-ut700
26288 Enable the documented workaround for the back-to-back store errata
26289 of the UT699E/UT700 processor.
26290
26291 -mfix-gr712rc
26292 Enable the documented workaround for the back-to-back store errata
26293 of the GR712RC processor.
26294
26295 These -m options are supported in addition to the above on SPARC-V9
26296 processors in 64-bit environments:
26297
26298 -m32
26299 -m64
26300 Generate code for a 32-bit or 64-bit environment. The 32-bit
26301 environment sets int, long and pointer to 32 bits. The 64-bit
26302 environment sets int to 32 bits and long and pointer to 64 bits.
26303
26304 -mcmodel=which
26305 Set the code model to one of
26306
26307 medlow
26308 The Medium/Low code model: 64-bit addresses, programs must be
26309 linked in the low 32 bits of memory. Programs can be
26310 statically or dynamically linked.
26311
26312 medmid
26313 The Medium/Middle code model: 64-bit addresses, programs must
26314 be linked in the low 44 bits of memory, the text and data
26315 segments must be less than 2GB in size and the data segment
26316 must be located within 2GB of the text segment.
26317
26318 medany
26319 The Medium/Anywhere code model: 64-bit addresses, programs may
26320 be linked anywhere in memory, the text and data segments must
26321 be less than 2GB in size and the data segment must be located
26322 within 2GB of the text segment.
26323
26324 embmedany
26325 The Medium/Anywhere code model for embedded systems: 64-bit
26326 addresses, the text and data segments must be less than 2GB in
26327 size, both starting anywhere in memory (determined at link
26328 time). The global register %g4 points to the base of the data
26329 segment. Programs are statically linked and PIC is not
26330 supported.
26331
26332 -mmemory-model=mem-model
26333 Set the memory model in force on the processor to one of
26334
26335 default
26336 The default memory model for the processor and operating
26337 system.
26338
26339 rmo Relaxed Memory Order
26340
26341 pso Partial Store Order
26342
26343 tso Total Store Order
26344
26345 sc Sequential Consistency
26346
26347 These memory models are formally defined in Appendix D of the
26348 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
26349 field.
26350
26351 -mstack-bias
26352 -mno-stack-bias
26353 With -mstack-bias, GCC assumes that the stack pointer, and frame
26354 pointer if present, are offset by -2047 which must be added back
26355 when making stack frame references. This is the default in 64-bit
26356 mode. Otherwise, assume no such offset is present.
26357
26358 Options for System V
26359
26360 These additional options are available on System V Release 4 for
26361 compatibility with other compilers on those systems:
26362
26363 -G Create a shared object. It is recommended that -symbolic or
26364 -shared be used instead.
26365
26366 -Qy Identify the versions of each tool used by the compiler, in a
26367 ".ident" assembler directive in the output.
26368
26369 -Qn Refrain from adding ".ident" directives to the output file (this is
26370 the default).
26371
26372 -YP,dirs
26373 Search the directories dirs, and no others, for libraries specified
26374 with -l.
26375
26376 -Ym,dir
26377 Look in the directory dir to find the M4 preprocessor. The
26378 assembler uses this option.
26379
26380 TILE-Gx Options
26381
26382 These -m options are supported on the TILE-Gx:
26383
26384 -mcmodel=small
26385 Generate code for the small model. The distance for direct calls
26386 is limited to 500M in either direction. PC-relative addresses are
26387 32 bits. Absolute addresses support the full address range.
26388
26389 -mcmodel=large
26390 Generate code for the large model. There is no limitation on call
26391 distance, pc-relative addresses, or absolute addresses.
26392
26393 -mcpu=name
26394 Selects the type of CPU to be targeted. Currently the only
26395 supported type is tilegx.
26396
26397 -m32
26398 -m64
26399 Generate code for a 32-bit or 64-bit environment. The 32-bit
26400 environment sets int, long, and pointer to 32 bits. The 64-bit
26401 environment sets int to 32 bits and long and pointer to 64 bits.
26402
26403 -mbig-endian
26404 -mlittle-endian
26405 Generate code in big/little endian mode, respectively.
26406
26407 TILEPro Options
26408
26409 These -m options are supported on the TILEPro:
26410
26411 -mcpu=name
26412 Selects the type of CPU to be targeted. Currently the only
26413 supported type is tilepro.
26414
26415 -m32
26416 Generate code for a 32-bit environment, which sets int, long, and
26417 pointer to 32 bits. This is the only supported behavior so the
26418 flag is essentially ignored.
26419
26420 V850 Options
26421
26422 These -m options are defined for V850 implementations:
26423
26424 -mlong-calls
26425 -mno-long-calls
26426 Treat all calls as being far away (near). If calls are assumed to
26427 be far away, the compiler always loads the function's address into
26428 a register, and calls indirect through the pointer.
26429
26430 -mno-ep
26431 -mep
26432 Do not optimize (do optimize) basic blocks that use the same index
26433 pointer 4 or more times to copy pointer into the "ep" register, and
26434 use the shorter "sld" and "sst" instructions. The -mep option is
26435 on by default if you optimize.
26436
26437 -mno-prolog-function
26438 -mprolog-function
26439 Do not use (do use) external functions to save and restore
26440 registers at the prologue and epilogue of a function. The external
26441 functions are slower, but use less code space if more than one
26442 function saves the same number of registers. The -mprolog-function
26443 option is on by default if you optimize.
26444
26445 -mspace
26446 Try to make the code as small as possible. At present, this just
26447 turns on the -mep and -mprolog-function options.
26448
26449 -mtda=n
26450 Put static or global variables whose size is n bytes or less into
26451 the tiny data area that register "ep" points to. The tiny data
26452 area can hold up to 256 bytes in total (128 bytes for byte
26453 references).
26454
26455 -msda=n
26456 Put static or global variables whose size is n bytes or less into
26457 the small data area that register "gp" points to. The small data
26458 area can hold up to 64 kilobytes.
26459
26460 -mzda=n
26461 Put static or global variables whose size is n bytes or less into
26462 the first 32 kilobytes of memory.
26463
26464 -mv850
26465 Specify that the target processor is the V850.
26466
26467 -mv850e3v5
26468 Specify that the target processor is the V850E3V5. The
26469 preprocessor constant "__v850e3v5__" is defined if this option is
26470 used.
26471
26472 -mv850e2v4
26473 Specify that the target processor is the V850E3V5. This is an
26474 alias for the -mv850e3v5 option.
26475
26476 -mv850e2v3
26477 Specify that the target processor is the V850E2V3. The
26478 preprocessor constant "__v850e2v3__" is defined if this option is
26479 used.
26480
26481 -mv850e2
26482 Specify that the target processor is the V850E2. The preprocessor
26483 constant "__v850e2__" is defined if this option is used.
26484
26485 -mv850e1
26486 Specify that the target processor is the V850E1. The preprocessor
26487 constants "__v850e1__" and "__v850e__" are defined if this option
26488 is used.
26489
26490 -mv850es
26491 Specify that the target processor is the V850ES. This is an alias
26492 for the -mv850e1 option.
26493
26494 -mv850e
26495 Specify that the target processor is the V850E. The preprocessor
26496 constant "__v850e__" is defined if this option is used.
26497
26498 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
26499 -mv850e2v3 nor -mv850e3v5 are defined then a default target
26500 processor is chosen and the relevant __v850*__ preprocessor
26501 constant is defined.
26502
26503 The preprocessor constants "__v850" and "__v851__" are always
26504 defined, regardless of which processor variant is the target.
26505
26506 -mdisable-callt
26507 -mno-disable-callt
26508 This option suppresses generation of the "CALLT" instruction for
26509 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
26510 v850 architecture.
26511
26512 This option is enabled by default when the RH850 ABI is in use (see
26513 -mrh850-abi), and disabled by default when the GCC ABI is in use.
26514 If "CALLT" instructions are being generated then the C preprocessor
26515 symbol "__V850_CALLT__" is defined.
26516
26517 -mrelax
26518 -mno-relax
26519 Pass on (or do not pass on) the -mrelax command-line option to the
26520 assembler.
26521
26522 -mlong-jumps
26523 -mno-long-jumps
26524 Disable (or re-enable) the generation of PC-relative jump
26525 instructions.
26526
26527 -msoft-float
26528 -mhard-float
26529 Disable (or re-enable) the generation of hardware floating point
26530 instructions. This option is only significant when the target
26531 architecture is V850E2V3 or higher. If hardware floating point
26532 instructions are being generated then the C preprocessor symbol
26533 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
26534 defined.
26535
26536 -mloop
26537 Enables the use of the e3v5 LOOP instruction. The use of this
26538 instruction is not enabled by default when the e3v5 architecture is
26539 selected because its use is still experimental.
26540
26541 -mrh850-abi
26542 -mghs
26543 Enables support for the RH850 version of the V850 ABI. This is the
26544 default. With this version of the ABI the following rules apply:
26545
26546 * Integer sized structures and unions are returned via a memory
26547 pointer rather than a register.
26548
26549 * Large structures and unions (more than 8 bytes in size) are
26550 passed by value.
26551
26552 * Functions are aligned to 16-bit boundaries.
26553
26554 * The -m8byte-align command-line option is supported.
26555
26556 * The -mdisable-callt command-line option is enabled by default.
26557 The -mno-disable-callt command-line option is not supported.
26558
26559 When this version of the ABI is enabled the C preprocessor symbol
26560 "__V850_RH850_ABI__" is defined.
26561
26562 -mgcc-abi
26563 Enables support for the old GCC version of the V850 ABI. With this
26564 version of the ABI the following rules apply:
26565
26566 * Integer sized structures and unions are returned in register
26567 "r10".
26568
26569 * Large structures and unions (more than 8 bytes in size) are
26570 passed by reference.
26571
26572 * Functions are aligned to 32-bit boundaries, unless optimizing
26573 for size.
26574
26575 * The -m8byte-align command-line option is not supported.
26576
26577 * The -mdisable-callt command-line option is supported but not
26578 enabled by default.
26579
26580 When this version of the ABI is enabled the C preprocessor symbol
26581 "__V850_GCC_ABI__" is defined.
26582
26583 -m8byte-align
26584 -mno-8byte-align
26585 Enables support for "double" and "long long" types to be aligned on
26586 8-byte boundaries. The default is to restrict the alignment of all
26587 objects to at most 4-bytes. When -m8byte-align is in effect the C
26588 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
26589
26590 -mbig-switch
26591 Generate code suitable for big switch tables. Use this option only
26592 if the assembler/linker complain about out of range branches within
26593 a switch table.
26594
26595 -mapp-regs
26596 This option causes r2 and r5 to be used in the code generated by
26597 the compiler. This setting is the default.
26598
26599 -mno-app-regs
26600 This option causes r2 and r5 to be treated as fixed registers.
26601
26602 VAX Options
26603
26604 These -m options are defined for the VAX:
26605
26606 -munix
26607 Do not output certain jump instructions ("aobleq" and so on) that
26608 the Unix assembler for the VAX cannot handle across long ranges.
26609
26610 -mgnu
26611 Do output those jump instructions, on the assumption that the GNU
26612 assembler is being used.
26613
26614 -mg Output code for G-format floating-point numbers instead of
26615 D-format.
26616
26617 -mlra
26618 -mno-lra
26619 Enable Local Register Allocation. This is still experimental for
26620 the VAX, so by default the compiler uses standard reload.
26621
26622 Visium Options
26623
26624 -mdebug
26625 A program which performs file I/O and is destined to run on an MCM
26626 target should be linked with this option. It causes the libraries
26627 libc.a and libdebug.a to be linked. The program should be run on
26628 the target under the control of the GDB remote debugging stub.
26629
26630 -msim
26631 A program which performs file I/O and is destined to run on the
26632 simulator should be linked with option. This causes libraries
26633 libc.a and libsim.a to be linked.
26634
26635 -mfpu
26636 -mhard-float
26637 Generate code containing floating-point instructions. This is the
26638 default.
26639
26640 -mno-fpu
26641 -msoft-float
26642 Generate code containing library calls for floating-point.
26643
26644 -msoft-float changes the calling convention in the output file;
26645 therefore, it is only useful if you compile all of a program with
26646 this option. In particular, you need to compile libgcc.a, the
26647 library that comes with GCC, with -msoft-float in order for this to
26648 work.
26649
26650 -mcpu=cpu_type
26651 Set the instruction set, register set, and instruction scheduling
26652 parameters for machine type cpu_type. Supported values for
26653 cpu_type are mcm, gr5 and gr6.
26654
26655 mcm is a synonym of gr5 present for backward compatibility.
26656
26657 By default (unless configured otherwise), GCC generates code for
26658 the GR5 variant of the Visium architecture.
26659
26660 With -mcpu=gr6, GCC generates code for the GR6 variant of the
26661 Visium architecture. The only difference from GR5 code is that the
26662 compiler will generate block move instructions.
26663
26664 -mtune=cpu_type
26665 Set the instruction scheduling parameters for machine type
26666 cpu_type, but do not set the instruction set or register set that
26667 the option -mcpu=cpu_type would.
26668
26669 -msv-mode
26670 Generate code for the supervisor mode, where there are no
26671 restrictions on the access to general registers. This is the
26672 default.
26673
26674 -muser-mode
26675 Generate code for the user mode, where the access to some general
26676 registers is forbidden: on the GR5, registers r24 to r31 cannot be
26677 accessed in this mode; on the GR6, only registers r29 to r31 are
26678 affected.
26679
26680 VMS Options
26681
26682 These -m options are defined for the VMS implementations:
26683
26684 -mvms-return-codes
26685 Return VMS condition codes from "main". The default is to return
26686 POSIX-style condition (e.g. error) codes.
26687
26688 -mdebug-main=prefix
26689 Flag the first routine whose name starts with prefix as the main
26690 routine for the debugger.
26691
26692 -mmalloc64
26693 Default to 64-bit memory allocation routines.
26694
26695 -mpointer-size=size
26696 Set the default size of pointers. Possible options for size are 32
26697 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
26698 no for supporting only 32 bit pointers. The later option disables
26699 "pragma pointer_size".
26700
26701 VxWorks Options
26702
26703 The options in this section are defined for all VxWorks targets.
26704 Options specific to the target hardware are listed with the other
26705 options for that target.
26706
26707 -mrtp
26708 GCC can generate code for both VxWorks kernels and real time
26709 processes (RTPs). This option switches from the former to the
26710 latter. It also defines the preprocessor macro "__RTP__".
26711
26712 -non-static
26713 Link an RTP executable against shared libraries rather than static
26714 libraries. The options -static and -shared can also be used for
26715 RTPs; -static is the default.
26716
26717 -Bstatic
26718 -Bdynamic
26719 These options are passed down to the linker. They are defined for
26720 compatibility with Diab.
26721
26722 -Xbind-lazy
26723 Enable lazy binding of function calls. This option is equivalent
26724 to -Wl,-z,now and is defined for compatibility with Diab.
26725
26726 -Xbind-now
26727 Disable lazy binding of function calls. This option is the default
26728 and is defined for compatibility with Diab.
26729
26730 x86 Options
26731
26732 These -m options are defined for the x86 family of computers.
26733
26734 -march=cpu-type
26735 Generate instructions for the machine type cpu-type. In contrast
26736 to -mtune=cpu-type, which merely tunes the generated code for the
26737 specified cpu-type, -march=cpu-type allows GCC to generate code
26738 that may not run at all on processors other than the one indicated.
26739 Specifying -march=cpu-type implies -mtune=cpu-type, except where
26740 noted otherwise.
26741
26742 The choices for cpu-type are:
26743
26744 native
26745 This selects the CPU to generate code for at compilation time
26746 by determining the processor type of the compiling machine.
26747 Using -march=native enables all instruction subsets supported
26748 by the local machine (hence the result might not run on
26749 different machines). Using -mtune=native produces code
26750 optimized for the local machine under the constraints of the
26751 selected instruction set.
26752
26753 x86-64
26754 A generic CPU with 64-bit extensions.
26755
26756 x86-64-v2
26757 x86-64-v3
26758 x86-64-v4
26759 These choices for cpu-type select the corresponding micro-
26760 architecture level from the x86-64 psABI. On ABIs other than
26761 the x86-64 psABI they select the same CPU features as the
26762 x86-64 psABI documents for the particular micro-architecture
26763 level.
26764
26765 Since these cpu-type values do not have a corresponding -mtune
26766 setting, using -march with these values enables generic tuning.
26767 Specific tuning can be enabled using the -mtune=other-cpu-type
26768 option with an appropriate other-cpu-type value.
26769
26770 i386
26771 Original Intel i386 CPU.
26772
26773 i486
26774 Intel i486 CPU. (No scheduling is implemented for this chip.)
26775
26776 i586
26777 pentium
26778 Intel Pentium CPU with no MMX support.
26779
26780 lakemont
26781 Intel Lakemont MCU, based on Intel Pentium CPU.
26782
26783 pentium-mmx
26784 Intel Pentium MMX CPU, based on Pentium core with MMX
26785 instruction set support.
26786
26787 pentiumpro
26788 Intel Pentium Pro CPU.
26789
26790 i686
26791 When used with -march, the Pentium Pro instruction set is used,
26792 so the code runs on all i686 family chips. When used with
26793 -mtune, it has the same meaning as generic.
26794
26795 pentium2
26796 Intel Pentium II CPU, based on Pentium Pro core with MMX and
26797 FXSR instruction set support.
26798
26799 pentium3
26800 pentium3m
26801 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR
26802 and SSE instruction set support.
26803
26804 pentium-m
26805 Intel Pentium M; low-power version of Intel Pentium III CPU
26806 with MMX, SSE, SSE2 and FXSR instruction set support. Used by
26807 Centrino notebooks.
26808
26809 pentium4
26810 pentium4m
26811 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction
26812 set support.
26813
26814 prescott
26815 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2,
26816 SSE3 and FXSR instruction set support.
26817
26818 nocona
26819 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
26820 MMX, SSE, SSE2, SSE3 and FXSR instruction set support.
26821
26822 core2
26823 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
26824 SSSE3, CX16, SAHF and FXSR instruction set support.
26825
26826 nehalem
26827 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
26828 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction
26829 set support.
26830
26831 westmere
26832 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
26833 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and
26834 PCLMUL instruction set support.
26835
26836 sandybridge
26837 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
26838 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
26839 XSAVE and PCLMUL instruction set support.
26840
26841 ivybridge
26842 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
26843 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX,
26844 XSAVE, PCLMUL, FSGSBASE, RDRND and F16C instruction set
26845 support.
26846
26847 haswell
26848 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
26849 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26850 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26851 LZCNT, FMA, MOVBE and HLE instruction set support.
26852
26853 broadwell
26854 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
26855 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26856 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26857 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW instruction
26858 set support.
26859
26860 skylake
26861 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26862 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26863 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26864 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26865 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
26866
26867 bonnell
26868 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
26869 SSE2, SSE3 and SSSE3 instruction set support.
26870
26871 silvermont
26872 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
26873 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26874 PCLMUL, PREFETCHW and RDRND instruction set support.
26875
26876 goldmont
26877 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
26878 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26879 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
26880 XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction set
26881 support.
26882
26883 goldmont-plus
26884 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
26885 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26886 FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE,
26887 XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID
26888 and SGX instruction set support.
26889
26890 tremont
26891 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
26892 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26893 PCLMUL, PREFETCHW, RDRND, AES, SHA, RDSEED, XSAVE, XSAVEC,
26894 XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID, SGX,
26895 CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG
26896 instruction set support.
26897
26898 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
26899 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26900 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26901 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
26902 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1
26903 instruction set support.
26904
26905 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
26906 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26907 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26908 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AVX512PF,
26909 AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
26910 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
26911
26912 skylake-avx512
26913 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
26914 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26915 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26916 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26917 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
26918 AVX512BW, AVX512DQ and AVX512CD instruction set support.
26919
26920 cannonlake
26921 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX,
26922 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26923 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26924 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26925 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26926 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA
26927 instruction set support.
26928
26929 icelake-client
26930 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX,
26931 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26932 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26933 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26934 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26935 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
26936 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
26937 RDPID and AVX512VPOPCNTDQ instruction set support.
26938
26939 icelake-server
26940 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
26941 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26942 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26943 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26944 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26945 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
26946 AVX512VNNI, GFNI, VAES, AVX512VBMI2 , VPCLMULQDQ, AVX512BITALG,
26947 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB instruction
26948 set support.
26949
26950 cascadelake
26951 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26952 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26953 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26954 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26955 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
26956 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
26957 support.
26958
26959 cooperlake
26960 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26961 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26962 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26963 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26964 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL,
26965 AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16
26966 instruction set support.
26967
26968 tigerlake
26969 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26970 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
26971 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
26972 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26973 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26974 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
26975 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
26976 RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
26977 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
26978
26979 sapphirerapids
26980 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX,
26981 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF,
26982 FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI,
26983 BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
26984 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
26985 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA,
26986 AVX512VNNI, GFNI, VAES, AVX512VBMI2 VPCLMULQDQ, AVX512BITALG,
26987 RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, MOVDIRI,
26988 MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE,
26989 WAITPKG, SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE,
26990 AMX-INT8, AVX-VNNI, AVX512FP16 and AVX512BF16 instruction set
26991 support.
26992
26993 alderlake
26994 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
26995 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
26996 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
26997 PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
26998 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
26999 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL,
27000 WIDEKL and AVX-VNNI instruction set support.
27001
27002 rocketlake
27003 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
27004 SSE2, SSE3, SSSE3 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR,
27005 AVX, XSAVE, PCLMUL, FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2,
27006 LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
27007 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW,
27008 AVX512DQ, AVX512CD PKU, AVX512VBMI, AVX512IFMA, SHA,
27009 AVX512VNNI, GFNI, VAES, AVX512VBMI2, VPCLMULQDQ, AVX512BITALG,
27010 RDPID and AVX512VPOPCNTDQ instruction set support.
27011
27012 k6 AMD K6 CPU with MMX instruction set support.
27013
27014 k6-2
27015 k6-3
27016 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
27017 set support.
27018
27019 athlon
27020 athlon-tbird
27021 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
27022 prefetch instructions support.
27023
27024 athlon-4
27025 athlon-xp
27026 athlon-mp
27027 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
27028 full SSE instruction set support.
27029
27030 k8
27031 opteron
27032 athlon64
27033 athlon-fx
27034 Processors based on the AMD K8 core with x86-64 instruction set
27035 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
27036 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
27037 3DNow! and 64-bit instruction set extensions.)
27038
27039 k8-sse3
27040 opteron-sse3
27041 athlon64-sse3
27042 Improved versions of AMD K8 cores with SSE3 instruction set
27043 support.
27044
27045 amdfam10
27046 barcelona
27047 CPUs based on AMD Family 10h cores with x86-64 instruction set
27048 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
27049 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
27050
27051 bdver1
27052 CPUs based on AMD Family 15h cores with x86-64 instruction set
27053 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL,
27054 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
27055 and 64-bit instruction set extensions.)
27056
27057 bdver2
27058 AMD Family 15h core based CPUs with x86-64 instruction set
27059 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
27060 LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27061 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27062
27063 bdver3
27064 AMD Family 15h core based CPUs with x86-64 instruction set
27065 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
27066 AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27067 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27068 extensions.)
27069
27070 bdver4
27071 AMD Family 15h core based CPUs with x86-64 instruction set
27072 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
27073 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX,
27074 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
27075 instruction set extensions.)
27076
27077 znver1
27078 AMD Family 17h core based CPUs with x86-64 instruction set
27079 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
27080 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16,
27081 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
27082 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
27083 extensions.)
27084
27085 znver2
27086 AMD Family 17h core based CPUs with x86-64 instruction set
27087 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
27088 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
27089 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27090 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
27091 WBNOINVD, and 64-bit instruction set extensions.)
27092
27093 znver3
27094 AMD Family 19h core based CPUs with x86-64 instruction set
27095 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
27096 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
27097 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27098 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
27099 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set
27100 extensions.)
27101
27102 btver1
27103 CPUs based on AMD Family 14h cores with x86-64 instruction set
27104 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
27105 CX16, ABM and 64-bit instruction set extensions.)
27106
27107 btver2
27108 CPUs based on AMD Family 16h cores with x86-64 instruction set
27109 support. This includes MOVBE, F16C, BMI, AVX, PCLMUL, AES,
27110 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
27111 and 64-bit instruction set extensions.
27112
27113 winchip-c6
27114 IDT WinChip C6 CPU, dealt in same way as i486 with additional
27115 MMX instruction set support.
27116
27117 winchip2
27118 IDT WinChip 2 CPU, dealt in same way as i486 with additional
27119 MMX and 3DNow! instruction set support.
27120
27121 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
27122 scheduling is implemented for this chip.)
27123
27124 c3-2
27125 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
27126 support. (No scheduling is implemented for this chip.)
27127
27128 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
27129 set support. (No scheduling is implemented for this chip.)
27130
27131 samuel-2
27132 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
27133 support. (No scheduling is implemented for this chip.)
27134
27135 nehemiah
27136 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27137 (No scheduling is implemented for this chip.)
27138
27139 esther
27140 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
27141 set support. (No scheduling is implemented for this chip.)
27142
27143 eden-x2
27144 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
27145 instruction set support. (No scheduling is implemented for
27146 this chip.)
27147
27148 eden-x4
27149 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
27150 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
27151 scheduling is implemented for this chip.)
27152
27153 nano
27154 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
27155 SSSE3 instruction set support. (No scheduling is implemented
27156 for this chip.)
27157
27158 nano-1000
27159 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27160 instruction set support. (No scheduling is implemented for
27161 this chip.)
27162
27163 nano-2000
27164 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27165 instruction set support. (No scheduling is implemented for
27166 this chip.)
27167
27168 nano-3000
27169 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
27170 SSE4.1 instruction set support. (No scheduling is implemented
27171 for this chip.)
27172
27173 nano-x2
27174 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
27175 and SSE4.1 instruction set support. (No scheduling is
27176 implemented for this chip.)
27177
27178 nano-x4
27179 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
27180 and SSE4.1 instruction set support. (No scheduling is
27181 implemented for this chip.)
27182
27183 geode
27184 AMD Geode embedded processor with MMX and 3DNow! instruction
27185 set support.
27186
27187 -mtune=cpu-type
27188 Tune to cpu-type everything applicable about the generated code,
27189 except for the ABI and the set of available instructions. While
27190 picking a specific cpu-type schedules things appropriately for that
27191 particular chip, the compiler does not generate any code that
27192 cannot run on the default machine type unless you use a -march=cpu-
27193 type option. For example, if GCC is configured for
27194 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
27195 for Pentium 4 but still runs on i686 machines.
27196
27197 The choices for cpu-type are the same as for -march. In addition,
27198 -mtune supports 2 extra choices for cpu-type:
27199
27200 generic
27201 Produce code optimized for the most common IA32/AMD64/EM64T
27202 processors. If you know the CPU on which your code will run,
27203 then you should use the corresponding -mtune or -march option
27204 instead of -mtune=generic. But, if you do not know exactly
27205 what CPU users of your application will have, then you should
27206 use this option.
27207
27208 As new processors are deployed in the marketplace, the behavior
27209 of this option will change. Therefore, if you upgrade to a
27210 newer version of GCC, code generation controlled by this option
27211 will change to reflect the processors that are most common at
27212 the time that version of GCC is released.
27213
27214 There is no -march=generic option because -march indicates the
27215 instruction set the compiler can use, and there is no generic
27216 instruction set applicable to all processors. In contrast,
27217 -mtune indicates the processor (or, in this case, collection of
27218 processors) for which the code is optimized.
27219
27220 intel
27221 Produce code optimized for the most current Intel processors,
27222 which are Haswell and Silvermont for this version of GCC. If
27223 you know the CPU on which your code will run, then you should
27224 use the corresponding -mtune or -march option instead of
27225 -mtune=intel. But, if you want your application performs
27226 better on both Haswell and Silvermont, then you should use this
27227 option.
27228
27229 As new Intel processors are deployed in the marketplace, the
27230 behavior of this option will change. Therefore, if you upgrade
27231 to a newer version of GCC, code generation controlled by this
27232 option will change to reflect the most current Intel processors
27233 at the time that version of GCC is released.
27234
27235 There is no -march=intel option because -march indicates the
27236 instruction set the compiler can use, and there is no common
27237 instruction set applicable to all processors. In contrast,
27238 -mtune indicates the processor (or, in this case, collection of
27239 processors) for which the code is optimized.
27240
27241 -mcpu=cpu-type
27242 A deprecated synonym for -mtune.
27243
27244 -mfpmath=unit
27245 Generate floating-point arithmetic for selected unit unit. The
27246 choices for unit are:
27247
27248 387 Use the standard 387 floating-point coprocessor present on the
27249 majority of chips and emulated otherwise. Code compiled with
27250 this option runs almost everywhere. The temporary results are
27251 computed in 80-bit precision instead of the precision specified
27252 by the type, resulting in slightly different results compared
27253 to most of other chips. See -ffloat-store for more detailed
27254 description.
27255
27256 This is the default choice for non-Darwin x86-32 targets.
27257
27258 sse Use scalar floating-point instructions present in the SSE
27259 instruction set. This instruction set is supported by Pentium
27260 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
27261 and Athlon MP chips. The earlier version of the SSE
27262 instruction set supports only single-precision arithmetic, thus
27263 the double and extended-precision arithmetic are still done
27264 using 387. A later version, present only in Pentium 4 and AMD
27265 x86-64 chips, supports double-precision arithmetic too.
27266
27267 For the x86-32 compiler, you must use -march=cpu-type, -msse or
27268 -msse2 switches to enable SSE extensions and make this option
27269 effective. For the x86-64 compiler, these extensions are
27270 enabled by default.
27271
27272 The resulting code should be considerably faster in the
27273 majority of cases and avoid the numerical instability problems
27274 of 387 code, but may break some existing code that expects
27275 temporaries to be 80 bits.
27276
27277 This is the default choice for the x86-64 compiler, Darwin
27278 x86-32 targets, and the default choice for x86-32 targets with
27279 the SSE2 instruction set when -ffast-math is enabled.
27280
27281 sse,387
27282 sse+387
27283 both
27284 Attempt to utilize both instruction sets at once. This
27285 effectively doubles the amount of available registers, and on
27286 chips with separate execution units for 387 and SSE the
27287 execution resources too. Use this option with care, as it is
27288 still experimental, because the GCC register allocator does not
27289 model separate functional units well, resulting in unstable
27290 performance.
27291
27292 -masm=dialect
27293 Output assembly instructions using selected dialect. Also affects
27294 which dialect is used for basic "asm" and extended "asm". Supported
27295 choices (in dialect order) are att or intel. The default is att.
27296 Darwin does not support intel.
27297
27298 -mieee-fp
27299 -mno-ieee-fp
27300 Control whether or not the compiler uses IEEE floating-point
27301 comparisons. These correctly handle the case where the result of a
27302 comparison is unordered.
27303
27304 -m80387
27305 -mhard-float
27306 Generate output containing 80387 instructions for floating point.
27307
27308 -mno-80387
27309 -msoft-float
27310 Generate output containing library calls for floating point.
27311
27312 Warning: the requisite libraries are not part of GCC. Normally the
27313 facilities of the machine's usual C compiler are used, but this
27314 cannot be done directly in cross-compilation. You must make your
27315 own arrangements to provide suitable library functions for cross-
27316 compilation.
27317
27318 On machines where a function returns floating-point results in the
27319 80387 register stack, some floating-point opcodes may be emitted
27320 even if -msoft-float is used.
27321
27322 -mno-fp-ret-in-387
27323 Do not use the FPU registers for return values of functions.
27324
27325 The usual calling convention has functions return values of types
27326 "float" and "double" in an FPU register, even if there is no FPU.
27327 The idea is that the operating system should emulate an FPU.
27328
27329 The option -mno-fp-ret-in-387 causes such values to be returned in
27330 ordinary CPU registers instead.
27331
27332 -mno-fancy-math-387
27333 Some 387 emulators do not support the "sin", "cos" and "sqrt"
27334 instructions for the 387. Specify this option to avoid generating
27335 those instructions. This option is overridden when -march
27336 indicates that the target CPU always has an FPU and so the
27337 instruction does not need emulation. These instructions are not
27338 generated unless you also use the -funsafe-math-optimizations
27339 switch.
27340
27341 -malign-double
27342 -mno-align-double
27343 Control whether GCC aligns "double", "long double", and "long long"
27344 variables on a two-word boundary or a one-word boundary. Aligning
27345 "double" variables on a two-word boundary produces code that runs
27346 somewhat faster on a Pentium at the expense of more memory.
27347
27348 On x86-64, -malign-double is enabled by default.
27349
27350 Warning: if you use the -malign-double switch, structures
27351 containing the above types are aligned differently than the
27352 published application binary interface specifications for the
27353 x86-32 and are not binary compatible with structures in code
27354 compiled without that switch.
27355
27356 -m96bit-long-double
27357 -m128bit-long-double
27358 These switches control the size of "long double" type. The x86-32
27359 application binary interface specifies the size to be 96 bits, so
27360 -m96bit-long-double is the default in 32-bit mode.
27361
27362 Modern architectures (Pentium and newer) prefer "long double" to be
27363 aligned to an 8- or 16-byte boundary. In arrays or structures
27364 conforming to the ABI, this is not possible. So specifying
27365 -m128bit-long-double aligns "long double" to a 16-byte boundary by
27366 padding the "long double" with an additional 32-bit zero.
27367
27368 In the x86-64 compiler, -m128bit-long-double is the default choice
27369 as its ABI specifies that "long double" is aligned on 16-byte
27370 boundary.
27371
27372 Notice that neither of these options enable any extra precision
27373 over the x87 standard of 80 bits for a "long double".
27374
27375 Warning: if you override the default value for your target ABI,
27376 this changes the size of structures and arrays containing "long
27377 double" variables, as well as modifying the function calling
27378 convention for functions taking "long double". Hence they are not
27379 binary-compatible with code compiled without that switch.
27380
27381 -mlong-double-64
27382 -mlong-double-80
27383 -mlong-double-128
27384 These switches control the size of "long double" type. A size of 64
27385 bits makes the "long double" type equivalent to the "double" type.
27386 This is the default for 32-bit Bionic C library. A size of 128
27387 bits makes the "long double" type equivalent to the "__float128"
27388 type. This is the default for 64-bit Bionic C library.
27389
27390 Warning: if you override the default value for your target ABI,
27391 this changes the size of structures and arrays containing "long
27392 double" variables, as well as modifying the function calling
27393 convention for functions taking "long double". Hence they are not
27394 binary-compatible with code compiled without that switch.
27395
27396 -malign-data=type
27397 Control how GCC aligns variables. Supported values for type are
27398 compat uses increased alignment value compatible uses GCC 4.8 and
27399 earlier, abi uses alignment value as specified by the psABI, and
27400 cacheline uses increased alignment value to match the cache line
27401 size. compat is the default.
27402
27403 -mlarge-data-threshold=threshold
27404 When -mcmodel=medium is specified, data objects larger than
27405 threshold are placed in the large data section. This value must be
27406 the same across all objects linked into the binary, and defaults to
27407 65535.
27408
27409 -mrtd
27410 Use a different function-calling convention, in which functions
27411 that take a fixed number of arguments return with the "ret num"
27412 instruction, which pops their arguments while returning. This
27413 saves one instruction in the caller since there is no need to pop
27414 the arguments there.
27415
27416 You can specify that an individual function is called with this
27417 calling sequence with the function attribute "stdcall". You can
27418 also override the -mrtd option by using the function attribute
27419 "cdecl".
27420
27421 Warning: this calling convention is incompatible with the one
27422 normally used on Unix, so you cannot use it if you need to call
27423 libraries compiled with the Unix compiler.
27424
27425 Also, you must provide function prototypes for all functions that
27426 take variable numbers of arguments (including "printf"); otherwise
27427 incorrect code is generated for calls to those functions.
27428
27429 In addition, seriously incorrect code results if you call a
27430 function with too many arguments. (Normally, extra arguments are
27431 harmlessly ignored.)
27432
27433 -mregparm=num
27434 Control how many registers are used to pass integer arguments. By
27435 default, no registers are used to pass arguments, and at most 3
27436 registers can be used. You can control this behavior for a
27437 specific function by using the function attribute "regparm".
27438
27439 Warning: if you use this switch, and num is nonzero, then you must
27440 build all modules with the same value, including any libraries.
27441 This includes the system libraries and startup modules.
27442
27443 -msseregparm
27444 Use SSE register passing conventions for float and double arguments
27445 and return values. You can control this behavior for a specific
27446 function by using the function attribute "sseregparm".
27447
27448 Warning: if you use this switch then you must build all modules
27449 with the same value, including any libraries. This includes the
27450 system libraries and startup modules.
27451
27452 -mvect8-ret-in-mem
27453 Return 8-byte vectors in memory instead of MMX registers. This is
27454 the default on VxWorks to match the ABI of the Sun Studio compilers
27455 until version 12. Only use this option if you need to remain
27456 compatible with existing code produced by those previous compiler
27457 versions or older versions of GCC.
27458
27459 -mpc32
27460 -mpc64
27461 -mpc80
27462 Set 80387 floating-point precision to 32, 64 or 80 bits. When
27463 -mpc32 is specified, the significands of results of floating-point
27464 operations are rounded to 24 bits (single precision); -mpc64 rounds
27465 the significands of results of floating-point operations to 53 bits
27466 (double precision) and -mpc80 rounds the significands of results of
27467 floating-point operations to 64 bits (extended double precision),
27468 which is the default. When this option is used, floating-point
27469 operations in higher precisions are not available to the programmer
27470 without setting the FPU control word explicitly.
27471
27472 Setting the rounding of floating-point operations to less than the
27473 default 80 bits can speed some programs by 2% or more. Note that
27474 some mathematical libraries assume that extended-precision (80-bit)
27475 floating-point operations are enabled by default; routines in such
27476 libraries could suffer significant loss of accuracy, typically
27477 through so-called "catastrophic cancellation", when this option is
27478 used to set the precision to less than extended precision.
27479
27480 -mstackrealign
27481 Realign the stack at entry. On the x86, the -mstackrealign option
27482 generates an alternate prologue and epilogue that realigns the run-
27483 time stack if necessary. This supports mixing legacy codes that
27484 keep 4-byte stack alignment with modern codes that keep 16-byte
27485 stack alignment for SSE compatibility. See also the attribute
27486 "force_align_arg_pointer", applicable to individual functions.
27487
27488 -mpreferred-stack-boundary=num
27489 Attempt to keep the stack boundary aligned to a 2 raised to num
27490 byte boundary. If -mpreferred-stack-boundary is not specified, the
27491 default is 4 (16 bytes or 128 bits).
27492
27493 Warning: When generating code for the x86-64 architecture with SSE
27494 extensions disabled, -mpreferred-stack-boundary=3 can be used to
27495 keep the stack boundary aligned to 8 byte boundary. Since x86-64
27496 ABI require 16 byte stack alignment, this is ABI incompatible and
27497 intended to be used in controlled environment where stack space is
27498 important limitation. This option leads to wrong code when
27499 functions compiled with 16 byte stack alignment (such as functions
27500 from a standard library) are called with misaligned stack. In this
27501 case, SSE instructions may lead to misaligned memory access traps.
27502 In addition, variable arguments are handled incorrectly for 16 byte
27503 aligned objects (including x87 long double and __int128), leading
27504 to wrong results. You must build all modules with
27505 -mpreferred-stack-boundary=3, including any libraries. This
27506 includes the system libraries and startup modules.
27507
27508 -mincoming-stack-boundary=num
27509 Assume the incoming stack is aligned to a 2 raised to num byte
27510 boundary. If -mincoming-stack-boundary is not specified, the one
27511 specified by -mpreferred-stack-boundary is used.
27512
27513 On Pentium and Pentium Pro, "double" and "long double" values
27514 should be aligned to an 8-byte boundary (see -malign-double) or
27515 suffer significant run time performance penalties. On Pentium III,
27516 the Streaming SIMD Extension (SSE) data type "__m128" may not work
27517 properly if it is not 16-byte aligned.
27518
27519 To ensure proper alignment of this values on the stack, the stack
27520 boundary must be as aligned as that required by any value stored on
27521 the stack. Further, every function must be generated such that it
27522 keeps the stack aligned. Thus calling a function compiled with a
27523 higher preferred stack boundary from a function compiled with a
27524 lower preferred stack boundary most likely misaligns the stack. It
27525 is recommended that libraries that use callbacks always use the
27526 default setting.
27527
27528 This extra alignment does consume extra stack space, and generally
27529 increases code size. Code that is sensitive to stack space usage,
27530 such as embedded systems and operating system kernels, may want to
27531 reduce the preferred alignment to -mpreferred-stack-boundary=2.
27532
27533 -mmmx
27534 -msse
27535 -msse2
27536 -msse3
27537 -mssse3
27538 -msse4
27539 -msse4a
27540 -msse4.1
27541 -msse4.2
27542 -mavx
27543 -mavx2
27544 -mavx512f
27545 -mavx512pf
27546 -mavx512er
27547 -mavx512cd
27548 -mavx512vl
27549 -mavx512bw
27550 -mavx512dq
27551 -mavx512ifma
27552 -mavx512vbmi
27553 -msha
27554 -maes
27555 -mpclmul
27556 -mclflushopt
27557 -mclwb
27558 -mfsgsbase
27559 -mptwrite
27560 -mrdrnd
27561 -mf16c
27562 -mfma
27563 -mpconfig
27564 -mwbnoinvd
27565 -mfma4
27566 -mprfchw
27567 -mrdpid
27568 -mprefetchwt1
27569 -mrdseed
27570 -msgx
27571 -mxop
27572 -mlwp
27573 -m3dnow
27574 -m3dnowa
27575 -mpopcnt
27576 -mabm
27577 -madx
27578 -mbmi
27579 -mbmi2
27580 -mlzcnt
27581 -mfxsr
27582 -mxsave
27583 -mxsaveopt
27584 -mxsavec
27585 -mxsaves
27586 -mrtm
27587 -mhle
27588 -mtbm
27589 -mmwaitx
27590 -mclzero
27591 -mpku
27592 -mavx512vbmi2
27593 -mavx512bf16
27594 -mavx512fp16
27595 -mgfni
27596 -mvaes
27597 -mwaitpkg
27598 -mvpclmulqdq
27599 -mavx512bitalg
27600 -mmovdiri
27601 -mmovdir64b
27602 -menqcmd
27603 -muintr
27604 -mtsxldtrk
27605 -mavx512vpopcntdq
27606 -mavx512vp2intersect
27607 -mavx5124fmaps
27608 -mavx512vnni
27609 -mavxvnni
27610 -mavx5124vnniw
27611 -mcldemote
27612 -mserialize
27613 -mamx-tile
27614 -mamx-int8
27615 -mamx-bf16
27616 -mhreset
27617 -mkl
27618 -mwidekl
27619 These switches enable the use of instructions in the MMX, SSE,
27620 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
27621 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
27622 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
27623 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
27624 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
27625 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
27626 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
27627 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
27628 MOVDIRI, MOVDIR64B, AVX512BF16, ENQCMD, AVX512VPOPCNTDQ,
27629 AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE, UINTR, HRESET,
27630 AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512FP16 or
27631 CLDEMOTE extended instruction sets. Each has a corresponding -mno-
27632 option to disable use of these instructions.
27633
27634 These extensions are also available as built-in functions: see x86
27635 Built-in Functions, for details of the functions enabled and
27636 disabled by these switches.
27637
27638 To generate SSE/SSE2 instructions automatically from floating-point
27639 code (as opposed to 387 instructions), see -mfpmath=sse.
27640
27641 GCC depresses SSEx instructions when -mavx is used. Instead, it
27642 generates new AVX instructions or AVX equivalence for all SSEx
27643 instructions when needed.
27644
27645 These options enable GCC to use these extended instructions in
27646 generated code, even without -mfpmath=sse. Applications that
27647 perform run-time CPU detection must compile separate files for each
27648 supported architecture, using the appropriate flags. In
27649 particular, the file containing the CPU detection code should be
27650 compiled without these options.
27651
27652 -mdump-tune-features
27653 This option instructs GCC to dump the names of the x86 performance
27654 tuning features and default settings. The names can be used in
27655 -mtune-ctrl=feature-list.
27656
27657 -mtune-ctrl=feature-list
27658 This option is used to do fine grain control of x86 code generation
27659 features. feature-list is a comma separated list of feature names.
27660 See also -mdump-tune-features. When specified, the feature is
27661 turned on if it is not preceded with ^, otherwise, it is turned
27662 off. -mtune-ctrl=feature-list is intended to be used by GCC
27663 developers. Using it may lead to code paths not covered by testing
27664 and can potentially result in compiler ICEs or runtime errors.
27665
27666 -mno-default
27667 This option instructs GCC to turn off all tunable features. See
27668 also -mtune-ctrl=feature-list and -mdump-tune-features.
27669
27670 -mcld
27671 This option instructs GCC to emit a "cld" instruction in the
27672 prologue of functions that use string instructions. String
27673 instructions depend on the DF flag to select between autoincrement
27674 or autodecrement mode. While the ABI specifies the DF flag to be
27675 cleared on function entry, some operating systems violate this
27676 specification by not clearing the DF flag in their exception
27677 dispatchers. The exception handler can be invoked with the DF flag
27678 set, which leads to wrong direction mode when string instructions
27679 are used. This option can be enabled by default on 32-bit x86
27680 targets by configuring GCC with the --enable-cld configure option.
27681 Generation of "cld" instructions can be suppressed with the
27682 -mno-cld compiler option in this case.
27683
27684 -mvzeroupper
27685 This option instructs GCC to emit a "vzeroupper" instruction before
27686 a transfer of control flow out of the function to minimize the AVX
27687 to SSE transition penalty as well as remove unnecessary "zeroupper"
27688 intrinsics.
27689
27690 -mprefer-avx128
27691 This option instructs GCC to use 128-bit AVX instructions instead
27692 of 256-bit AVX instructions in the auto-vectorizer.
27693
27694 -mprefer-vector-width=opt
27695 This option instructs GCC to use opt-bit vector width in
27696 instructions instead of default on the selected platform.
27697
27698 -mmove-max=bits
27699 This option instructs GCC to set the maximum number of bits can be
27700 moved from memory to memory efficiently to bits. The valid bits
27701 are 128, 256 and 512.
27702
27703 -mstore-max=bits
27704 This option instructs GCC to set the maximum number of bits can be
27705 stored to memory efficiently to bits. The valid bits are 128, 256
27706 and 512.
27707
27708 none
27709 No extra limitations applied to GCC other than defined by the
27710 selected platform.
27711
27712 128 Prefer 128-bit vector width for instructions.
27713
27714 256 Prefer 256-bit vector width for instructions.
27715
27716 512 Prefer 512-bit vector width for instructions.
27717
27718 -mcx16
27719 This option enables GCC to generate "CMPXCHG16B" instructions in
27720 64-bit code to implement compare-and-exchange operations on 16-byte
27721 aligned 128-bit objects. This is useful for atomic updates of data
27722 structures exceeding one machine word in size. The compiler uses
27723 this instruction to implement __sync Builtins. However, for
27724 __atomic Builtins operating on 128-bit integers, a library call is
27725 always used.
27726
27727 -msahf
27728 This option enables generation of "SAHF" instructions in 64-bit
27729 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
27730 the introduction of Pentium 4 G1 step in December 2005, lacked the
27731 "LAHF" and "SAHF" instructions which are supported by AMD64. These
27732 are load and store instructions, respectively, for certain status
27733 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
27734 "fmod", "drem", and "remainder" built-in functions; see Other
27735 Builtins for details.
27736
27737 -mmovbe
27738 This option enables use of the "movbe" instruction to implement
27739 "__builtin_bswap32" and "__builtin_bswap64".
27740
27741 -mshstk
27742 The -mshstk option enables shadow stack built-in functions from x86
27743 Control-flow Enforcement Technology (CET).
27744
27745 -mcrc32
27746 This option enables built-in functions "__builtin_ia32_crc32qi",
27747 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
27748 "__builtin_ia32_crc32di" to generate the "crc32" machine
27749 instruction.
27750
27751 -mmwait
27752 This option enables built-in functions "__builtin_ia32_monitor",
27753 and "__builtin_ia32_mwait" to generate the "monitor" and "mwait"
27754 machine instructions.
27755
27756 -mrecip
27757 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
27758 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
27759 Newton-Raphson step to increase precision instead of "DIVSS" and
27760 "SQRTSS" (and their vectorized variants) for single-precision
27761 floating-point arguments. These instructions are generated only
27762 when -funsafe-math-optimizations is enabled together with
27763 -ffinite-math-only and -fno-trapping-math. Note that while the
27764 throughput of the sequence is higher than the throughput of the
27765 non-reciprocal instruction, the precision of the sequence can be
27766 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
27767 0.99999994).
27768
27769 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
27770 "RSQRTPS") already with -ffast-math (or the above option
27771 combination), and doesn't need -mrecip.
27772
27773 Also note that GCC emits the above sequence with additional Newton-
27774 Raphson step for vectorized single-float division and vectorized
27775 "sqrtf(x)" already with -ffast-math (or the above option
27776 combination), and doesn't need -mrecip.
27777
27778 -mrecip=opt
27779 This option controls which reciprocal estimate instructions may be
27780 used. opt is a comma-separated list of options, which may be
27781 preceded by a ! to invert the option:
27782
27783 all Enable all estimate instructions.
27784
27785 default
27786 Enable the default instructions, equivalent to -mrecip.
27787
27788 none
27789 Disable all estimate instructions, equivalent to -mno-recip.
27790
27791 div Enable the approximation for scalar division.
27792
27793 vec-div
27794 Enable the approximation for vectorized division.
27795
27796 sqrt
27797 Enable the approximation for scalar square root.
27798
27799 vec-sqrt
27800 Enable the approximation for vectorized square root.
27801
27802 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
27803 approximations, except for square root.
27804
27805 -mveclibabi=type
27806 Specifies the ABI type to use for vectorizing intrinsics using an
27807 external library. Supported values for type are svml for the Intel
27808 short vector math library and acml for the AMD math core library.
27809 To use this option, both -ftree-vectorize and
27810 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
27811 ABI-compatible library must be specified at link time.
27812
27813 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
27814 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
27815 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
27816 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
27817 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
27818 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
27819 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
27820 and "vmlsAcos4" for corresponding function type when
27821 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
27822 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
27823 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
27824 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
27825 corresponding function type when -mveclibabi=acml is used.
27826
27827 -mabi=name
27828 Generate code for the specified calling convention. Permissible
27829 values are sysv for the ABI used on GNU/Linux and other systems,
27830 and ms for the Microsoft ABI. The default is to use the Microsoft
27831 ABI when targeting Microsoft Windows and the SysV ABI on all other
27832 systems. You can control this behavior for specific functions by
27833 using the function attributes "ms_abi" and "sysv_abi".
27834
27835 -mforce-indirect-call
27836 Force all calls to functions to be indirect. This is useful when
27837 using Intel Processor Trace where it generates more precise timing
27838 information for function calls.
27839
27840 -mmanual-endbr
27841 Insert ENDBR instruction at function entry only via the "cf_check"
27842 function attribute. This is useful when used with the option
27843 -fcf-protection=branch to control ENDBR insertion at the function
27844 entry.
27845
27846 -mcall-ms2sysv-xlogues
27847 Due to differences in 64-bit ABIs, any Microsoft ABI function that
27848 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
27849 clobbered. By default, the code for saving and restoring these
27850 registers is emitted inline, resulting in fairly lengthy prologues
27851 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
27852 epilogues that use stubs in the static portion of libgcc to perform
27853 these saves and restores, thus reducing function size at the cost
27854 of a few extra instructions.
27855
27856 -mtls-dialect=type
27857 Generate code to access thread-local storage using the gnu or gnu2
27858 conventions. gnu is the conservative default; gnu2 is more
27859 efficient, but it may add compile- and run-time requirements that
27860 cannot be satisfied on all systems.
27861
27862 -mpush-args
27863 -mno-push-args
27864 Use PUSH operations to store outgoing parameters. This method is
27865 shorter and usually equally fast as method using SUB/MOV operations
27866 and is enabled by default. In some cases disabling it may improve
27867 performance because of improved scheduling and reduced
27868 dependencies.
27869
27870 -maccumulate-outgoing-args
27871 If enabled, the maximum amount of space required for outgoing
27872 arguments is computed in the function prologue. This is faster on
27873 most modern CPUs because of reduced dependencies, improved
27874 scheduling and reduced stack usage when the preferred stack
27875 boundary is not equal to 2. The drawback is a notable increase in
27876 code size. This switch implies -mno-push-args.
27877
27878 -mthreads
27879 Support thread-safe exception handling on MinGW. Programs that
27880 rely on thread-safe exception handling must compile and link all
27881 code with the -mthreads option. When compiling, -mthreads defines
27882 -D_MT; when linking, it links in a special thread helper library
27883 -lmingwthrd which cleans up per-thread exception-handling data.
27884
27885 -mms-bitfields
27886 -mno-ms-bitfields
27887 Enable/disable bit-field layout compatible with the native
27888 Microsoft Windows compiler.
27889
27890 If "packed" is used on a structure, or if bit-fields are used, it
27891 may be that the Microsoft ABI lays out the structure differently
27892 than the way GCC normally does. Particularly when moving packed
27893 data between functions compiled with GCC and the native Microsoft
27894 compiler (either via function call or as data in a file), it may be
27895 necessary to access either format.
27896
27897 This option is enabled by default for Microsoft Windows targets.
27898 This behavior can also be controlled locally by use of variable or
27899 type attributes. For more information, see x86 Variable Attributes
27900 and x86 Type Attributes.
27901
27902 The Microsoft structure layout algorithm is fairly simple with the
27903 exception of the bit-field packing. The padding and alignment of
27904 members of structures and whether a bit-field can straddle a
27905 storage-unit boundary are determine by these rules:
27906
27907 1. Structure members are stored sequentially in the order in which
27908 they are
27909 declared: the first member has the lowest memory address and
27910 the last member the highest.
27911
27912 2. Every data object has an alignment requirement. The alignment
27913 requirement
27914 for all data except structures, unions, and arrays is either
27915 the size of the object or the current packing size (specified
27916 with either the "aligned" attribute or the "pack" pragma),
27917 whichever is less. For structures, unions, and arrays, the
27918 alignment requirement is the largest alignment requirement of
27919 its members. Every object is allocated an offset so that:
27920
27921 offset % alignment_requirement == 0
27922
27923 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
27924 allocation
27925 unit if the integral types are the same size and if the next
27926 bit-field fits into the current allocation unit without
27927 crossing the boundary imposed by the common alignment
27928 requirements of the bit-fields.
27929
27930 MSVC interprets zero-length bit-fields in the following ways:
27931
27932 1. If a zero-length bit-field is inserted between two bit-fields
27933 that
27934 are normally coalesced, the bit-fields are not coalesced.
27935
27936 For example:
27937
27938 struct
27939 {
27940 unsigned long bf_1 : 12;
27941 unsigned long : 0;
27942 unsigned long bf_2 : 12;
27943 } t1;
27944
27945 The size of "t1" is 8 bytes with the zero-length bit-field. If
27946 the zero-length bit-field were removed, "t1"'s size would be 4
27947 bytes.
27948
27949 2. If a zero-length bit-field is inserted after a bit-field, "foo",
27950 and the
27951 alignment of the zero-length bit-field is greater than the
27952 member that follows it, "bar", "bar" is aligned as the type of
27953 the zero-length bit-field.
27954
27955 For example:
27956
27957 struct
27958 {
27959 char foo : 4;
27960 short : 0;
27961 char bar;
27962 } t2;
27963
27964 struct
27965 {
27966 char foo : 4;
27967 short : 0;
27968 double bar;
27969 } t3;
27970
27971 For "t2", "bar" is placed at offset 2, rather than offset 1.
27972 Accordingly, the size of "t2" is 4. For "t3", the zero-length
27973 bit-field does not affect the alignment of "bar" or, as a
27974 result, the size of the structure.
27975
27976 Taking this into account, it is important to note the
27977 following:
27978
27979 1. If a zero-length bit-field follows a normal bit-field, the
27980 type of the
27981 zero-length bit-field may affect the alignment of the
27982 structure as whole. For example, "t2" has a size of 4
27983 bytes, since the zero-length bit-field follows a normal
27984 bit-field, and is of type short.
27985
27986 2. Even if a zero-length bit-field is not followed by a normal
27987 bit-field, it may
27988 still affect the alignment of the structure:
27989
27990 struct
27991 {
27992 char foo : 6;
27993 long : 0;
27994 } t4;
27995
27996 Here, "t4" takes up 4 bytes.
27997
27998 3. Zero-length bit-fields following non-bit-field members are
27999 ignored:
28000 struct
28001 {
28002 char foo;
28003 long : 0;
28004 char bar;
28005 } t5;
28006
28007 Here, "t5" takes up 2 bytes.
28008
28009 -mno-align-stringops
28010 Do not align the destination of inlined string operations. This
28011 switch reduces code size and improves performance in case the
28012 destination is already aligned, but GCC doesn't know about it.
28013
28014 -minline-all-stringops
28015 By default GCC inlines string operations only when the destination
28016 is known to be aligned to least a 4-byte boundary. This enables
28017 more inlining and increases code size, but may improve performance
28018 of code that depends on fast "memcpy" and "memset" for short
28019 lengths. The option enables inline expansion of "strlen" for all
28020 pointer alignments.
28021
28022 -minline-stringops-dynamically
28023 For string operations of unknown size, use run-time checks with
28024 inline code for small blocks and a library call for large blocks.
28025
28026 -mstringop-strategy=alg
28027 Override the internal decision heuristic for the particular
28028 algorithm to use for inlining string operations. The allowed
28029 values for alg are:
28030
28031 rep_byte
28032 rep_4byte
28033 rep_8byte
28034 Expand using i386 "rep" prefix of the specified size.
28035
28036 byte_loop
28037 loop
28038 unrolled_loop
28039 Expand into an inline loop.
28040
28041 libcall
28042 Always use a library call.
28043
28044 -mmemcpy-strategy=strategy
28045 Override the internal decision heuristic to decide if
28046 "__builtin_memcpy" should be inlined and what inline algorithm to
28047 use when the expected size of the copy operation is known. strategy
28048 is a comma-separated list of alg:max_size:dest_align triplets. alg
28049 is specified in -mstringop-strategy, max_size specifies the max
28050 byte size with which inline algorithm alg is allowed. For the last
28051 triplet, the max_size must be "-1". The max_size of the triplets in
28052 the list must be specified in increasing order. The minimal byte
28053 size for alg is 0 for the first triplet and "max_size + 1" of the
28054 preceding range.
28055
28056 -mmemset-strategy=strategy
28057 The option is similar to -mmemcpy-strategy= except that it is to
28058 control "__builtin_memset" expansion.
28059
28060 -momit-leaf-frame-pointer
28061 Don't keep the frame pointer in a register for leaf functions.
28062 This avoids the instructions to save, set up, and restore frame
28063 pointers and makes an extra register available in leaf functions.
28064 The option -fomit-leaf-frame-pointer removes the frame pointer for
28065 leaf functions, which might make debugging harder.
28066
28067 -mtls-direct-seg-refs
28068 -mno-tls-direct-seg-refs
28069 Controls whether TLS variables may be accessed with offsets from
28070 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
28071 whether the thread base pointer must be added. Whether or not this
28072 is valid depends on the operating system, and whether it maps the
28073 segment to cover the entire TLS area.
28074
28075 For systems that use the GNU C Library, the default is on.
28076
28077 -msse2avx
28078 -mno-sse2avx
28079 Specify that the assembler should encode SSE instructions with VEX
28080 prefix. The option -mavx turns this on by default.
28081
28082 -mfentry
28083 -mno-fentry
28084 If profiling is active (-pg), put the profiling counter call before
28085 the prologue. Note: On x86 architectures the attribute
28086 "ms_hook_prologue" isn't possible at the moment for -mfentry and
28087 -pg.
28088
28089 -mrecord-mcount
28090 -mno-record-mcount
28091 If profiling is active (-pg), generate a __mcount_loc section that
28092 contains pointers to each profiling call. This is useful for
28093 automatically patching and out calls.
28094
28095 -mnop-mcount
28096 -mno-nop-mcount
28097 If profiling is active (-pg), generate the calls to the profiling
28098 functions as NOPs. This is useful when they should be patched in
28099 later dynamically. This is likely only useful together with
28100 -mrecord-mcount.
28101
28102 -minstrument-return=type
28103 Instrument function exit in -pg -mfentry instrumented functions
28104 with call to specified function. This only instruments true returns
28105 ending with ret, but not sibling calls ending with jump. Valid
28106 types are none to not instrument, call to generate a call to
28107 __return__, or nop5 to generate a 5 byte nop.
28108
28109 -mrecord-return
28110 -mno-record-return
28111 Generate a __return_loc section pointing to all return
28112 instrumentation code.
28113
28114 -mfentry-name=name
28115 Set name of __fentry__ symbol called at function entry for -pg
28116 -mfentry functions.
28117
28118 -mfentry-section=name
28119 Set name of section to record -mrecord-mcount calls (default
28120 __mcount_loc).
28121
28122 -mskip-rax-setup
28123 -mno-skip-rax-setup
28124 When generating code for the x86-64 architecture with SSE
28125 extensions disabled, -mskip-rax-setup can be used to skip setting
28126 up RAX register when there are no variable arguments passed in
28127 vector registers.
28128
28129 Warning: Since RAX register is used to avoid unnecessarily saving
28130 vector registers on stack when passing variable arguments, the
28131 impacts of this option are callees may waste some stack space,
28132 misbehave or jump to a random location. GCC 4.4 or newer don't
28133 have those issues, regardless the RAX register value.
28134
28135 -m8bit-idiv
28136 -mno-8bit-idiv
28137 On some processors, like Intel Atom, 8-bit unsigned integer divide
28138 is much faster than 32-bit/64-bit integer divide. This option
28139 generates a run-time check. If both dividend and divisor are
28140 within range of 0 to 255, 8-bit unsigned integer divide is used
28141 instead of 32-bit/64-bit integer divide.
28142
28143 -mavx256-split-unaligned-load
28144 -mavx256-split-unaligned-store
28145 Split 32-byte AVX unaligned load and store.
28146
28147 -mstack-protector-guard=guard
28148 -mstack-protector-guard-reg=reg
28149 -mstack-protector-guard-offset=offset
28150 Generate stack protection code using canary at guard. Supported
28151 locations are global for global canary or tls for per-thread canary
28152 in the TLS block (the default). This option has effect only when
28153 -fstack-protector or -fstack-protector-all is specified.
28154
28155 With the latter choice the options -mstack-protector-guard-reg=reg
28156 and -mstack-protector-guard-offset=offset furthermore specify which
28157 segment register (%fs or %gs) to use as base register for reading
28158 the canary, and from what offset from that base register. The
28159 default for those is as specified in the relevant ABI.
28160
28161 -mgeneral-regs-only
28162 Generate code that uses only the general-purpose registers. This
28163 prevents the compiler from using floating-point, vector, mask and
28164 bound registers.
28165
28166 -mrelax-cmpxchg-loop
28167 Relax cmpxchg loop by emitting an early load and compare before
28168 cmpxchg, execute pause if load value is not expected. This reduces
28169 excessive cachline bouncing when and works for all atomic logic
28170 fetch builtins that generates compare and swap loop.
28171
28172 -mindirect-branch=choice
28173 Convert indirect call and jump with choice. The default is keep,
28174 which keeps indirect call and jump unmodified. thunk converts
28175 indirect call and jump to call and return thunk. thunk-inline
28176 converts indirect call and jump to inlined call and return thunk.
28177 thunk-extern converts indirect call and jump to external call and
28178 return thunk provided in a separate object file. You can control
28179 this behavior for a specific function by using the function
28180 attribute "indirect_branch".
28181
28182 Note that -mcmodel=large is incompatible with
28183 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
28184 the thunk function may not be reachable in the large code model.
28185
28186 Note that -mindirect-branch=thunk-extern is compatible with
28187 -fcf-protection=branch since the external thunk can be made to
28188 enable control-flow check.
28189
28190 -mfunction-return=choice
28191 Convert function return with choice. The default is keep, which
28192 keeps function return unmodified. thunk converts function return
28193 to call and return thunk. thunk-inline converts function return to
28194 inlined call and return thunk. thunk-extern converts function
28195 return to external call and return thunk provided in a separate
28196 object file. You can control this behavior for a specific function
28197 by using the function attribute "function_return".
28198
28199 Note that -mindirect-return=thunk-extern is compatible with
28200 -fcf-protection=branch since the external thunk can be made to
28201 enable control-flow check.
28202
28203 Note that -mcmodel=large is incompatible with
28204 -mfunction-return=thunk and -mfunction-return=thunk-extern since
28205 the thunk function may not be reachable in the large code model.
28206
28207 -mindirect-branch-register
28208 Force indirect call and jump via register.
28209
28210 -mharden-sls=choice
28211 Generate code to mitigate against straight line speculation (SLS)
28212 with choice. The default is none which disables all SLS hardening.
28213 return enables SLS hardening for function returns. indirect-jmp
28214 enables SLS hardening for indirect jumps. all enables all SLS
28215 hardening.
28216
28217 -mindirect-branch-cs-prefix
28218 Add CS prefix to call and jmp to indirect thunk with branch target
28219 in r8-r15 registers so that the call and jmp instruction length is
28220 6 bytes to allow them to be replaced with lfence; call *%r8-r15 or
28221 lfence; jmp *%r8-r15 at run-time.
28222
28223 These -m switches are supported in addition to the above on x86-64
28224 processors in 64-bit environments.
28225
28226 -m32
28227 -m64
28228 -mx32
28229 -m16
28230 -miamcu
28231 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
28232 option sets "int", "long", and pointer types to 32 bits, and
28233 generates code that runs on any i386 system.
28234
28235 The -m64 option sets "int" to 32 bits and "long" and pointer types
28236 to 64 bits, and generates code for the x86-64 architecture. For
28237 Darwin only the -m64 option also turns off the -fno-pic and
28238 -mdynamic-no-pic options.
28239
28240 The -mx32 option sets "int", "long", and pointer types to 32 bits,
28241 and generates code for the x86-64 architecture.
28242
28243 The -m16 option is the same as -m32, except for that it outputs the
28244 ".code16gcc" assembly directive at the beginning of the assembly
28245 output so that the binary can run in 16-bit mode.
28246
28247 The -miamcu option generates code which conforms to Intel MCU
28248 psABI. It requires the -m32 option to be turned on.
28249
28250 -mno-red-zone
28251 Do not use a so-called "red zone" for x86-64 code. The red zone is
28252 mandated by the x86-64 ABI; it is a 128-byte area beyond the
28253 location of the stack pointer that is not modified by signal or
28254 interrupt handlers and therefore can be used for temporary data
28255 without adjusting the stack pointer. The flag -mno-red-zone
28256 disables this red zone.
28257
28258 -mcmodel=small
28259 Generate code for the small code model: the program and its symbols
28260 must be linked in the lower 2 GB of the address space. Pointers
28261 are 64 bits. Programs can be statically or dynamically linked.
28262 This is the default code model.
28263
28264 -mcmodel=kernel
28265 Generate code for the kernel code model. The kernel runs in the
28266 negative 2 GB of the address space. This model has to be used for
28267 Linux kernel code.
28268
28269 -mcmodel=medium
28270 Generate code for the medium model: the program is linked in the
28271 lower 2 GB of the address space. Small symbols are also placed
28272 there. Symbols with sizes larger than -mlarge-data-threshold are
28273 put into large data or BSS sections and can be located above 2GB.
28274 Programs can be statically or dynamically linked.
28275
28276 -mcmodel=large
28277 Generate code for the large model. This model makes no assumptions
28278 about addresses and sizes of sections.
28279
28280 -maddress-mode=long
28281 Generate code for long address mode. This is only supported for
28282 64-bit and x32 environments. It is the default address mode for
28283 64-bit environments.
28284
28285 -maddress-mode=short
28286 Generate code for short address mode. This is only supported for
28287 32-bit and x32 environments. It is the default address mode for
28288 32-bit and x32 environments.
28289
28290 -mneeded
28291 -mno-needed
28292 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
28293 indicate the micro-architecture ISA level required to execute the
28294 binary.
28295
28296 -mno-direct-extern-access
28297 Without -fpic nor -fPIC, always use the GOT pointer to access
28298 external symbols. With -fpic or -fPIC, treat access to protected
28299 symbols as local symbols. The default is -mdirect-extern-access.
28300
28301 Warning: shared libraries compiled with -mno-direct-extern-access
28302 and executable compiled with -mdirect-extern-access may not be
28303 binary compatible if protected symbols are used in shared libraries
28304 and executable.
28305
28306 x86 Windows Options
28307
28308 These additional options are available for Microsoft Windows targets:
28309
28310 -mconsole
28311 This option specifies that a console application is to be
28312 generated, by instructing the linker to set the PE header subsystem
28313 type required for console applications. This option is available
28314 for Cygwin and MinGW targets and is enabled by default on those
28315 targets.
28316
28317 -mdll
28318 This option is available for Cygwin and MinGW targets. It
28319 specifies that a DLL---a dynamic link library---is to be generated,
28320 enabling the selection of the required runtime startup object and
28321 entry point.
28322
28323 -mnop-fun-dllimport
28324 This option is available for Cygwin and MinGW targets. It
28325 specifies that the "dllimport" attribute should be ignored.
28326
28327 -mthreads
28328 This option is available for MinGW targets. It specifies that
28329 MinGW-specific thread support is to be used.
28330
28331 -municode
28332 This option is available for MinGW-w64 targets. It causes the
28333 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
28334 capable runtime startup code.
28335
28336 -mwin32
28337 This option is available for Cygwin and MinGW targets. It
28338 specifies that the typical Microsoft Windows predefined macros are
28339 to be set in the pre-processor, but does not influence the choice
28340 of runtime library/startup code.
28341
28342 -mwindows
28343 This option is available for Cygwin and MinGW targets. It
28344 specifies that a GUI application is to be generated by instructing
28345 the linker to set the PE header subsystem type appropriately.
28346
28347 -fno-set-stack-executable
28348 This option is available for MinGW targets. It specifies that the
28349 executable flag for the stack used by nested functions isn't set.
28350 This is necessary for binaries running in kernel mode of Microsoft
28351 Windows, as there the User32 API, which is used to set executable
28352 privileges, isn't available.
28353
28354 -fwritable-relocated-rdata
28355 This option is available for MinGW and Cygwin targets. It
28356 specifies that relocated-data in read-only section is put into the
28357 ".data" section. This is a necessary for older runtimes not
28358 supporting modification of ".rdata" sections for pseudo-relocation.
28359
28360 -mpe-aligned-commons
28361 This option is available for Cygwin and MinGW targets. It
28362 specifies that the GNU extension to the PE file format that permits
28363 the correct alignment of COMMON variables should be used when
28364 generating code. It is enabled by default if GCC detects that the
28365 target assembler found during configuration supports the feature.
28366
28367 See also under x86 Options for standard options.
28368
28369 Xstormy16 Options
28370
28371 These options are defined for Xstormy16:
28372
28373 -msim
28374 Choose startup files and linker script suitable for the simulator.
28375
28376 Xtensa Options
28377
28378 These options are supported for Xtensa targets:
28379
28380 -mconst16
28381 -mno-const16
28382 Enable or disable use of "CONST16" instructions for loading
28383 constant values. The "CONST16" instruction is currently not a
28384 standard option from Tensilica. When enabled, "CONST16"
28385 instructions are always used in place of the standard "L32R"
28386 instructions. The use of "CONST16" is enabled by default only if
28387 the "L32R" instruction is not available.
28388
28389 -mfused-madd
28390 -mno-fused-madd
28391 Enable or disable use of fused multiply/add and multiply/subtract
28392 instructions in the floating-point option. This has no effect if
28393 the floating-point option is not also enabled. Disabling fused
28394 multiply/add and multiply/subtract instructions forces the compiler
28395 to use separate instructions for the multiply and add/subtract
28396 operations. This may be desirable in some cases where strict IEEE
28397 754-compliant results are required: the fused multiply add/subtract
28398 instructions do not round the intermediate result, thereby
28399 producing results with more bits of precision than specified by the
28400 IEEE standard. Disabling fused multiply add/subtract instructions
28401 also ensures that the program output is not sensitive to the
28402 compiler's ability to combine multiply and add/subtract operations.
28403
28404 -mserialize-volatile
28405 -mno-serialize-volatile
28406 When this option is enabled, GCC inserts "MEMW" instructions before
28407 "volatile" memory references to guarantee sequential consistency.
28408 The default is -mserialize-volatile. Use -mno-serialize-volatile
28409 to omit the "MEMW" instructions.
28410
28411 -mforce-no-pic
28412 For targets, like GNU/Linux, where all user-mode Xtensa code must
28413 be position-independent code (PIC), this option disables PIC for
28414 compiling kernel code.
28415
28416 -mtext-section-literals
28417 -mno-text-section-literals
28418 These options control the treatment of literal pools. The default
28419 is -mno-text-section-literals, which places literals in a separate
28420 section in the output file. This allows the literal pool to be
28421 placed in a data RAM/ROM, and it also allows the linker to combine
28422 literal pools from separate object files to remove redundant
28423 literals and improve code size. With -mtext-section-literals, the
28424 literals are interspersed in the text section in order to keep them
28425 as close as possible to their references. This may be necessary
28426 for large assembly files. Literals for each function are placed
28427 right before that function.
28428
28429 -mauto-litpools
28430 -mno-auto-litpools
28431 These options control the treatment of literal pools. The default
28432 is -mno-auto-litpools, which places literals in a separate section
28433 in the output file unless -mtext-section-literals is used. With
28434 -mauto-litpools the literals are interspersed in the text section
28435 by the assembler. Compiler does not produce explicit ".literal"
28436 directives and loads literals into registers with "MOVI"
28437 instructions instead of "L32R" to let the assembler do relaxation
28438 and place literals as necessary. This option allows assembler to
28439 create several literal pools per function and assemble very big
28440 functions, which may not be possible with -mtext-section-literals.
28441
28442 -mtarget-align
28443 -mno-target-align
28444 When this option is enabled, GCC instructs the assembler to
28445 automatically align instructions to reduce branch penalties at the
28446 expense of some code density. The assembler attempts to widen
28447 density instructions to align branch targets and the instructions
28448 following call instructions. If there are not enough preceding
28449 safe density instructions to align a target, no widening is
28450 performed. The default is -mtarget-align. These options do not
28451 affect the treatment of auto-aligned instructions like "LOOP",
28452 which the assembler always aligns, either by widening density
28453 instructions or by inserting NOP instructions.
28454
28455 -mlongcalls
28456 -mno-longcalls
28457 When this option is enabled, GCC instructs the assembler to
28458 translate direct calls to indirect calls unless it can determine
28459 that the target of a direct call is in the range allowed by the
28460 call instruction. This translation typically occurs for calls to
28461 functions in other source files. Specifically, the assembler
28462 translates a direct "CALL" instruction into an "L32R" followed by a
28463 "CALLX" instruction. The default is -mno-longcalls. This option
28464 should be used in programs where the call target can potentially be
28465 out of range. This option is implemented in the assembler, not the
28466 compiler, so the assembly code generated by GCC still shows direct
28467 call instructions---look at the disassembled object code to see the
28468 actual instructions. Note that the assembler uses an indirect call
28469 for every cross-file call, not just those that really are out of
28470 range.
28471
28472 -mabi=name
28473 Generate code for the specified ABI. Permissible values are:
28474 call0, windowed. Default ABI is chosen by the Xtensa core
28475 configuration.
28476
28477 -mabi=call0
28478 When this option is enabled function parameters are passed in
28479 registers "a2" through "a7", registers "a12" through "a15" are
28480 caller-saved, and register "a15" may be used as a frame pointer.
28481 When this version of the ABI is enabled the C preprocessor symbol
28482 "__XTENSA_CALL0_ABI__" is defined.
28483
28484 -mabi=windowed
28485 When this option is enabled function parameters are passed in
28486 registers "a10" through "a15", and called function rotates register
28487 window by 8 registers on entry so that its arguments are found in
28488 registers "a2" through "a7". Register "a7" may be used as a frame
28489 pointer. Register window is rotated 8 registers back upon return.
28490 When this version of the ABI is enabled the C preprocessor symbol
28491 "__XTENSA_WINDOWED_ABI__" is defined.
28492
28493 zSeries Options
28494
28495 These are listed under
28496
28498 This section describes several environment variables that affect how
28499 GCC operates. Some of them work by specifying directories or prefixes
28500 to use when searching for various kinds of files. Some are used to
28501 specify other aspects of the compilation environment.
28502
28503 Note that you can also specify places to search using options such as
28504 -B, -I and -L. These take precedence over places specified using
28505 environment variables, which in turn take precedence over those
28506 specified by the configuration of GCC.
28507
28508 LANG
28509 LC_CTYPE
28510 LC_MESSAGES
28511 LC_ALL
28512 These environment variables control the way that GCC uses
28513 localization information which allows GCC to work with different
28514 national conventions. GCC inspects the locale categories LC_CTYPE
28515 and LC_MESSAGES if it has been configured to do so. These locale
28516 categories can be set to any value supported by your installation.
28517 A typical value is en_GB.UTF-8 for English in the United Kingdom
28518 encoded in UTF-8.
28519
28520 The LC_CTYPE environment variable specifies character
28521 classification. GCC uses it to determine the character boundaries
28522 in a string; this is needed for some multibyte encodings that
28523 contain quote and escape characters that are otherwise interpreted
28524 as a string end or escape.
28525
28526 The LC_MESSAGES environment variable specifies the language to use
28527 in diagnostic messages.
28528
28529 If the LC_ALL environment variable is set, it overrides the value
28530 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
28531 default to the value of the LANG environment variable. If none of
28532 these variables are set, GCC defaults to traditional C English
28533 behavior.
28534
28535 TMPDIR
28536 If TMPDIR is set, it specifies the directory to use for temporary
28537 files. GCC uses temporary files to hold the output of one stage of
28538 compilation which is to be used as input to the next stage: for
28539 example, the output of the preprocessor, which is the input to the
28540 compiler proper.
28541
28542 GCC_COMPARE_DEBUG
28543 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
28544 -fcompare-debug to the compiler driver. See the documentation of
28545 this option for more details.
28546
28547 GCC_EXEC_PREFIX
28548 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
28549 names of the subprograms executed by the compiler. No slash is
28550 added when this prefix is combined with the name of a subprogram,
28551 but you can specify a prefix that ends with a slash if you wish.
28552
28553 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
28554 appropriate prefix to use based on the pathname it is invoked with.
28555
28556 If GCC cannot find the subprogram using the specified prefix, it
28557 tries looking in the usual places for the subprogram.
28558
28559 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
28560 prefix is the prefix to the installed compiler. In many cases
28561 prefix is the value of "prefix" when you ran the configure script.
28562
28563 Other prefixes specified with -B take precedence over this prefix.
28564
28565 This prefix is also used for finding files such as crt0.o that are
28566 used for linking.
28567
28568 In addition, the prefix is used in an unusual way in finding the
28569 directories to search for header files. For each of the standard
28570 directories whose name normally begins with /usr/local/lib/gcc
28571 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
28572 replacing that beginning with the specified prefix to produce an
28573 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
28574 just before it searches the standard directory /usr/local/lib/bar.
28575 If a standard directory begins with the configured prefix then the
28576 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
28577 header files.
28578
28579 COMPILER_PATH
28580 The value of COMPILER_PATH is a colon-separated list of
28581 directories, much like PATH. GCC tries the directories thus
28582 specified when searching for subprograms, if it cannot find the
28583 subprograms using GCC_EXEC_PREFIX.
28584
28585 LIBRARY_PATH
28586 The value of LIBRARY_PATH is a colon-separated list of directories,
28587 much like PATH. When configured as a native compiler, GCC tries
28588 the directories thus specified when searching for special linker
28589 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
28590 GCC also uses these directories when searching for ordinary
28591 libraries for the -l option (but directories specified with -L come
28592 first).
28593
28594 LANG
28595 This variable is used to pass locale information to the compiler.
28596 One way in which this information is used is to determine the
28597 character set to be used when character literals, string literals
28598 and comments are parsed in C and C++. When the compiler is
28599 configured to allow multibyte characters, the following values for
28600 LANG are recognized:
28601
28602 C-JIS
28603 Recognize JIS characters.
28604
28605 C-SJIS
28606 Recognize SJIS characters.
28607
28608 C-EUCJP
28609 Recognize EUCJP characters.
28610
28611 If LANG is not defined, or if it has some other value, then the
28612 compiler uses "mblen" and "mbtowc" as defined by the default locale
28613 to recognize and translate multibyte characters.
28614
28615 GCC_EXTRA_DIAGNOSTIC_OUTPUT
28616 If GCC_EXTRA_DIAGNOSTIC_OUTPUT is set to one of the following
28617 values, then additional text will be emitted to stderr when fix-it
28618 hints are emitted. -fdiagnostics-parseable-fixits and
28619 -fno-diagnostics-parseable-fixits take precedence over this
28620 environment variable.
28621
28622 fixits-v1
28623 Emit parseable fix-it hints, equivalent to
28624 -fdiagnostics-parseable-fixits. In particular, columns are
28625 expressed as a count of bytes, starting at byte 1 for the
28626 initial column.
28627
28628 fixits-v2
28629 As "fixits-v1", but columns are expressed as display columns,
28630 as per -fdiagnostics-column-unit=display.
28631
28632 Some additional environment variables affect the behavior of the
28633 preprocessor.
28634
28635 CPATH
28636 C_INCLUDE_PATH
28637 CPLUS_INCLUDE_PATH
28638 OBJC_INCLUDE_PATH
28639 Each variable's value is a list of directories separated by a
28640 special character, much like PATH, in which to look for header
28641 files. The special character, "PATH_SEPARATOR", is target-
28642 dependent and determined at GCC build time. For Microsoft Windows-
28643 based targets it is a semicolon, and for almost all other targets
28644 it is a colon.
28645
28646 CPATH specifies a list of directories to be searched as if
28647 specified with -I, but after any paths given with -I options on the
28648 command line. This environment variable is used regardless of
28649 which language is being preprocessed.
28650
28651 The remaining environment variables apply only when preprocessing
28652 the particular language indicated. Each specifies a list of
28653 directories to be searched as if specified with -isystem, but after
28654 any paths given with -isystem options on the command line.
28655
28656 In all these variables, an empty element instructs the compiler to
28657 search its current working directory. Empty elements can appear at
28658 the beginning or end of a path. For instance, if the value of
28659 CPATH is ":/special/include", that has the same effect as
28660 -I. -I/special/include.
28661
28662 DEPENDENCIES_OUTPUT
28663 If this variable is set, its value specifies how to output
28664 dependencies for Make based on the non-system header files
28665 processed by the compiler. System header files are ignored in the
28666 dependency output.
28667
28668 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
28669 case the Make rules are written to that file, guessing the target
28670 name from the source file name. Or the value can have the form
28671 file target, in which case the rules are written to file file using
28672 target as the target name.
28673
28674 In other words, this environment variable is equivalent to
28675 combining the options -MM and -MF, with an optional -MT switch too.
28676
28677 SUNPRO_DEPENDENCIES
28678 This variable is the same as DEPENDENCIES_OUTPUT (see above),
28679 except that system header files are not ignored, so it implies -M
28680 rather than -MM. However, the dependence on the main input file is
28681 omitted.
28682
28683 SOURCE_DATE_EPOCH
28684 If this variable is set, its value specifies a UNIX timestamp to be
28685 used in replacement of the current date and time in the "__DATE__"
28686 and "__TIME__" macros, so that the embedded timestamps become
28687 reproducible.
28688
28689 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
28690 the number of seconds (excluding leap seconds) since 01 Jan 1970
28691 00:00:00 represented in ASCII; identical to the output of "date
28692 +%s" on GNU/Linux and other systems that support the %s extension
28693 in the "date" command.
28694
28695 The value should be a known timestamp such as the last modification
28696 time of the source or package and it should be set by the build
28697 process.
28698
28700 For instructions on reporting bugs, see <https://bugzilla.redhat.com/>.
28701
28703 1. On some systems, gcc -shared needs to build supplementary stub code
28704 for constructors to work. On multi-libbed systems, gcc -shared
28705 must select the correct support libraries to link against. Failing
28706 to supply the correct flags may lead to subtle defects. Supplying
28707 them in cases where they are not necessary is innocuous.
28708
28710 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1),
28711 dbx(1) and the Info entries for gcc, cpp, as, ld, binutils and gdb.
28712
28714 See the Info entry for gcc, or
28715 <https://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for
28716 contributors to GCC.
28717
28719 Copyright (c) 1988-2022 Free Software Foundation, Inc.
28720
28721 Permission is granted to copy, distribute and/or modify this document
28722 under the terms of the GNU Free Documentation License, Version 1.3 or
28723 any later version published by the Free Software Foundation; with the
28724 Invariant Sections being "GNU General Public License" and "Funding Free
28725 Software", the Front-Cover texts being (a) (see below), and with the
28726 Back-Cover Texts being (b) (see below). A copy of the license is
28727 included in the gfdl(7) man page.
28728
28729 (a) The FSF's Front-Cover Text is:
28730
28731 A GNU Manual
28732
28733 (b) The FSF's Back-Cover Text is:
28734
28735 You have freedom to copy and modify this GNU Manual, like GNU
28736 software. Copies published by the Free Software Foundation raise
28737 funds for GNU development.
28738
28739
28740
28741gcc-12.1.0 2022-05-06 GCC(1)